【新增】小程序端确认收货增加推送【微信发货信息管理】同步确认收货功能。

This commit is contained in:
大灰灰
2024-08-10 14:50:26 +08:00
parent 1876ff05d1
commit 04cc9448c4
4 changed files with 234 additions and 43 deletions

View File

@@ -435,6 +435,11 @@ const install = (Vue, vm) => {
//支付宝小程序手机授权(拉取手机号码)
let loginByGetPhoneNumberForAli = (params, config = {}) => http.post('/Api/User/DecryptPhoneNumberByAli', params, { custom: { methodName: 'user.loginByGetPhoneNumberForAli', needToken: false } });
//查询当前订单是否接入微信发货信息管理
let orderShippingList = (params, config = {}) => http.post('/Api/Order/OrderShippingList', params, { custom: { methodName: 'order.orderShippingList', needToken: true } });
//根据订单编号获取当前订单的支付信息
let getOrderPayInfo = (params, config = {}) => http.post('/Api/Order/GetOrderPayInfo', params, { custom: { methodName: 'order.getOrderPayInfo', needToken: true } });
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {
shopConfigV2,
@@ -641,7 +646,10 @@ const install = (Vue, vm) => {
submitInvoiceApply,
getAliPayAppAuthTokenBYCode,
loginByGetPhoneNumberForAli
loginByGetPhoneNumberForAli,
orderShippingList,
getOrderPayInfo
};
}

View File

@@ -729,34 +729,73 @@
tackDeliery(orderId) {
let _this = this;
this.$common.modelShow('提示', '确认收货操作吗?', () => {
let data = {
id: orderId
}
_this.$u.api.confirmOrder(data).then(res => {
if (res.status) {
_this.$refs.uToast.show({
message: '确认收货成功', type: 'success', complete: function () {
// 更改订单列表页的订单状态
let pages = getCurrentPages(); // 当前页
let beforePage = pages[pages.length - 2]; // 上个页面
if (beforePage !== undefined && beforePage.route === 'pages/member/order/index/index') {
// #ifdef MP-WEIXIN
beforePage.$vm.isReload = true
// #endif
// #ifdef APP-PLUS || APP-PLUS-NVUE
beforePage.isReload = true
// #endif
// #ifdef MP-ALIPAY || MP-TOUTIAO
_this.$db.set('orderUserShip', true, true);
// #endif
}
_this.orderDetail()
}
})
} else {
_this.$u.toast(res.msg)
// #ifdef MP-WEIXIN
if (_this.orderInfo.paymentItem[0].paymentCode == 'wechatpay' && _this.orderInfo.paymentItem[0].status == 2) {
let payData = {
id: _this.orderInfo.paymentItem[0].tradeNo
}
})
_this.$u.api.orderShippingList(payData).then(res => {
if (res.status && res.data == true) {
//拉起确认收货组件
if (wx.openBusinessView) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: {
transaction_id: _this.orderInfo.paymentItem[0].tradeNo
},
success(e) {
_this.doTackDeliery(orderId);
},
fail() { },
complete() { }
});
} else {
_this.$u.toast("您的微信版本过低,请升级微信");
}
} else {
_this.doTackDeliery(orderId);
}
})
} else {
_this.doTackDeliery(orderId);
}
// #endif
// #ifndef MP-WEIXIN
_this.doTackDeliery(orderId);
// #endif
})
},
//执行确认收货.
doTackDeliery(orderId) {
let _this = this;
let data = {
id: orderId
}
_this.$u.api.confirmOrder(data).then(res => {
if (res.status) {
_this.$refs.uToast.show({
message: '确认收货成功', type: 'success', complete: function () {
// 更改订单列表页的订单状态
let pages = getCurrentPages(); // 当前页
let beforePage = pages[pages.length - 2]; // 上个页面
if (beforePage !== undefined && beforePage.route === 'pages/member/order/index/index') {
// #ifdef MP-WEIXIN
beforePage.$vm.isReload = true;
// #endif
// #ifdef APP-PLUS || APP-PLUS-NVUE
beforePage.isReload = true;
// #endif
// #ifdef MP-ALIPAY || MP-TOUTIAO
_this.$db.set('orderUserShip', true, true);
// #endif
}
_this.orderDetail()
}
})
} else {
_this.$u.toast(res.msg)
}
})
},
// 申请售后

View File

@@ -172,25 +172,73 @@
// 确认收货
tackDelivery(index, orderIndex) {
let _this = this;
this.$common.modelShow('提示', '确认执行收货操作吗?', () => {
let data = {
id: _this.listData[orderIndex].orderId
var orderId = _this.listData[orderIndex].orderId;
this.$common.modelShow('提示', '确认收货操作吗?', () => {
// #ifdef MP-WEIXIN
let payInfoData = {
id: orderId
}
_this.$u.api.confirmOrder(data).then(res => {
if (res.status) {
_this.$refs.uToast.show({
message: '确认收货成功', type: 'success', complete: function () {
if (this.tab !== 0) {
_this.listData.splice(orderIndex, 1)
_this.$u.api.getOrderPayInfo(payInfoData).then(resPayInfo => {
console.log(resPayInfo);
if (resPayInfo.status && resPayInfo.data.paymentCode == 'wechatpay' && resPayInfo.data.status == 2) {
let payData = {
id: resPayInfo.data.tradeNo
}
_this.$u.api.orderShippingList(payData).then(res => {
if (res.status && res.data == true) {
//拉起确认收货组件
if (wx.openBusinessView) {
wx.openBusinessView({
businessType: 'weappOrderConfirm',
extraData: {
transaction_id: resPayInfo.data.tradeNo
},
success(e) {
_this.doTackDeliery(orderIndex, orderId);
},
fail() { },
complete() { }
});
} else {
_this.getOrders();
_this.$u.toast("您的微信版本过低,请升级微信");
}
} else {
_this.doTackDeliery(orderIndex, orderId);
}
})
} else {
_this.$u.toast(res.msg)
} else if (resPayInfo.status && resPayInfo.data.paymentCode != 'wechatpay' && resPayInfo.data.status == 2) {
_this.doTackDeliery(orderIndex, orderId);
}
else {
_this.$u.toast(resPayInfo.msg)
}
})
// #endif
// #ifndef MP-WEIXIN
_this.doTackDeliery(orderIndex, orderId);
// #endif
})
},
//执行确认收货.
doTackDeliery(orderIndex, orderId) {
let _this = this;
let data = {
id: orderId
}
_this.$u.api.confirmOrder(data).then(res => {
if (res.status) {
_this.$refs.uToast.show({
message: '确认收货成功', type: 'success', complete: function () {
if (this.tab !== 0) {
_this.listData.splice(orderIndex, 1)
} else {
_this.getOrders();
}
}
})
} else {
_this.$u.toast(res.msg)
}
})
},
// 订单状态统一在这处理