76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
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 => {})
|
||
}
|
||
}) |