酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

142 lines
2.9 KiB

export default {
methods: {
// 酒店支付订单
payOrder(id, orderId, replacePay){
console.log(id, orderId);
let self = this
this.$api(replacePay ? 'replacePay' : 'orderPay', {
id : replacePay ? orderId : id,
}, res => {
if (res.code == 200) {
uni.requestPayment({
provider: 'wxpay', // 服务提提供商
timeStamp: res.result.timeStamp, // 时间戳
nonceStr: res.result.nonceStr, // 随机字符串
package: res.result.packageValue,
signType: res.result.signType, // 签名算法
paySign: res.result.paySign, // 签名
success: function(res) {
self.getData()
},
fail: function(err) {
console.log('支付失败', err);
// self.$refs.confirmationPopup.close()
uni.showToast({
icon: 'none',
title: "支付失败"
})
}
});
}else{
setTimeout(self.getData, 500)
}
})
},
// 酒店取消订单
orderCancel(item){
let self = this
uni.showModal({
title: '您确认取消吗?',
success(res) {
if (res.confirm) {
self.$api('orderCancel', {
id: item.id
}, res => {
if (res.code == 200) {
self.getData()
}
})
}
}
})
},
// 确认收货
confirmReceiveGoods(item) {
let self = this
let api = 'orderConfirm'
// 水洗订单,确认快递收货完成
if([21].includes(item.status)){
api = 'orderConfirmWashReceipt'
}
uni.showModal({
title: '您收到货了吗?',
success(res) {
if (res.confirm) {
self.$api(api, {
id: item.id
}, res => {
if (res.code == 200) {
self.getData()
}
})
}
}
})
},
// 水洗店确认接单, logisticsFlag = 0:快递取货、快递寄回,1自行配送
orderConfirmAccept(item, args = {},flag = 0){
if([6].includes(item.status)){
flag = 1
}
let self = this
this.$api('orderConfirmAccept', {
id: item.id,
flag,
...args,
}, res => {
if (res.code == 200) {
uni.showToast({
title: '接单成功',
icon: 'none'
})
self.getData()
}
})
},
// 水洗店确认破损 0确认接单 1确认正常 2破损上报
orderConfirmedDamage(item, flag, args = {}, fn){
let self = this
this.$api('orderConfirmAccept', {
id: item.id,
flag,
...args
}, res => {
if (res.code == 200) {
uni.showToast({
title: '上报成功',
icon: 'none'
})
fn && fn()
self.getData()
}
})
},
// 水洗店完成水洗
orderFinishedWashing(item){
let self = this
self.$api('orderConfirm', {
id: item.id
}, res => {
if (res.code == 200) {
self.getData()
}
})
},
// 查看物流
toQueryLogistics(item){
// if([2, 23].includes(item.status)){
uni.navigateTo({
url: `/pages_order/order/queryLogistics?no=${item.logisticsCode}`
})
// }
},
}
}