Files
xuan_wechat/pages/refund/deliver/deliver.js
2023-08-29 13:53:48 +08:00

76 lines
1.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Page({
/**
* 页面的初始数据
*/
data: {
refund : '',
address : '',
mobile : '',
username: '',
text : ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
refund: options.no
})
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.refund.deliverInit(options.no).then(res => {
let { address, mobile, username } = res.data;
this.setData({
address,
mobile,
username,
text: '收件人:' + username + '\n手机号码'+ mobile + '\n收货地址' + address
})
wx.hideLoading()
})
},
/**
* 复制地址
*/
onCopyAddress(){
wx.setClipboardData({
data: this.data.text
})
},
/**
* 提交退货地址
*/
onSubmit(e){
let { number } = e.detail.value
if(number == ''){
wx.showToast({
title: '请输入快递单号',
icon : 'none',
mask : true
})
return
}
wx.showLoading({
title: '提交中...',
mask : true
})
wx.$api.refund.deliver(this.data.refund, { number }).then(res => {
wx.showModal({
title : '提示',
content : res.data,
showCancel : false,
confirmColor: '#da2b54',
success : modalRes => {
if(modalRes.confirm){
wx.navigateBack()
}
}
})
wx.hideLoading()
}).catch(err => {})
}
})