发货通知
parent
a2a7bb2121
commit
2a949d1b1f
|
@ -401,11 +401,14 @@
|
||||||
// todo:
|
// todo:
|
||||||
// 1.怎么检测是否开启了发货组件功能?如果没有开启的话就不能在这里return出去
|
// 1.怎么检测是否开启了发货组件功能?如果没有开启的话就不能在这里return出去
|
||||||
// 2.如果开启了走mpConfirm方法,需要在App.vue的show方法中拿到确认收货结果
|
// 2.如果开启了走mpConfirm方法,需要在App.vue的show方法中拿到确认收货结果
|
||||||
if (sheep.$platform.name === 'WechatMiniProgram' && !ignore) {
|
let isOpenBusinessView = true;
|
||||||
if (!isEmpty(state.orderInfo.wechat_extra_data) && tradeManaged.value === 1) {
|
if (
|
||||||
mpConfirm(orderId);
|
sheep.$platform.name === 'WechatMiniProgram' &&
|
||||||
return;
|
!isEmpty(state.orderInfo.wechat_extra_data) &&
|
||||||
}
|
isOpenBusinessView &&
|
||||||
|
!ignore
|
||||||
|
) {
|
||||||
|
mpConfirm(orderId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,8 +429,7 @@
|
||||||
wx.openBusinessView({
|
wx.openBusinessView({
|
||||||
businessType: 'weappOrderConfirm',
|
businessType: 'weappOrderConfirm',
|
||||||
extraData: {
|
extraData: {
|
||||||
// merchant_id: '1481069012',
|
merchant_trade_no: state.orderInfo.wechat_extra_data.merchant_trade_no,
|
||||||
// merchant_trade_no: state.orderInfo.wechat_extra_data.merchant_trade_no,
|
|
||||||
transaction_id: state.orderInfo.wechat_extra_data.transaction_id,
|
transaction_id: state.orderInfo.wechat_extra_data.transaction_id,
|
||||||
},
|
},
|
||||||
success(response) {
|
success(response) {
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
<button
|
<button
|
||||||
v-if="order.btns.includes('confirm')"
|
v-if="order.btns.includes('confirm')"
|
||||||
class="tool-btn ss-reset-button"
|
class="tool-btn ss-reset-button"
|
||||||
@tap.stop="onConfirm(order.id)"
|
@tap.stop="onConfirm(order)"
|
||||||
>
|
>
|
||||||
确认收货
|
确认收货
|
||||||
</button>
|
</button>
|
||||||
|
@ -239,6 +239,7 @@
|
||||||
import { formatOrderColor } from '@/sheep/hooks/useGoods';
|
import { formatOrderColor } from '@/sheep/hooks/useGoods';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
data: [],
|
data: [],
|
||||||
|
@ -329,21 +330,62 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认收货
|
// 确认收货
|
||||||
async function onConfirm(orderId) {
|
async function onConfirm(order, ignore = false) {
|
||||||
uni.showModal({
|
// 需开启确认收货组件
|
||||||
title: '提示',
|
// todo:
|
||||||
content: '请确认包裹全部到达后再确认收货',
|
// 1.怎么检测是否开启了发货组件功能?如果没有开启的话就不能在这里return出去
|
||||||
success: async function (res) {
|
// 2.如果开启了走mpConfirm方法,需要在App.vue的show方法中拿到确认收货结果
|
||||||
if (res.confirm) {
|
let isOpenBusinessView = true;
|
||||||
const { error, data } = await sheep.$api.order.confirm(orderId);
|
if (
|
||||||
if (error === 0) {
|
sheep.$platform.name === 'WechatMiniProgram' &&
|
||||||
let index = state.pagination.data.findIndex((order) => order.id === orderId);
|
!isEmpty(order.wechat_extra_data) &&
|
||||||
state.pagination.data[index] = data;
|
isOpenBusinessView &&
|
||||||
|
!ignore
|
||||||
|
) {
|
||||||
|
mpConfirm(order);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正常的确认收货流程
|
||||||
|
|
||||||
|
const { error } = await sheep.$api.order.confirm(order.id);
|
||||||
|
if (error === 0) {
|
||||||
|
state.pagination = pagination;
|
||||||
|
getOrderList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
// 小程序确认收货组件
|
||||||
|
function mpConfirm(order) {
|
||||||
|
if (!wx.openBusinessView) {
|
||||||
|
sheep.$helper.toast(`请升级微信版本`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wx.openBusinessView({
|
||||||
|
businessType: 'weappOrderConfirm',
|
||||||
|
extraData: {
|
||||||
|
merchant_id: '1481069012',
|
||||||
|
merchant_trade_no: order.wechat_extra_data.merchant_trade_no,
|
||||||
|
transaction_id: order.wechat_extra_data.transaction_id,
|
||||||
|
},
|
||||||
|
success(response) {
|
||||||
|
console.log('success:', response);
|
||||||
|
if (response.errMsg === 'openBusinessView:ok') {
|
||||||
|
if (response.extraData.status === 'success') {
|
||||||
|
onConfirm(order, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
fail(error) {
|
||||||
|
console.log('error:', error);
|
||||||
|
},
|
||||||
|
complete(result) {
|
||||||
|
console.log('result:', result);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
// 查看物流
|
// 查看物流
|
||||||
async function onExpress(orderId) {
|
async function onExpress(orderId) {
|
||||||
|
|
Loading…
Reference in New Issue