修改从订单列表执行立即付款时的执行逻辑

This commit is contained in:
赵毅 2025-09-17 16:05:48 +08:00
parent 3c87af65de
commit a732eab59f
4 changed files with 111 additions and 87 deletions

View File

@ -291,7 +291,8 @@ export default {
goToPay(item) {
//
const transformedItems = item.commodity_order_item_list.map(goods => ({
checked: true,
isafterSale: true,
orderId: item.id,
commodity_goods_info: {
commodity_brief: "",
commodity_id: goods.commodity_id,

View File

@ -292,7 +292,8 @@ export default {
goToPay(item) {
//
const transformedItems = item.commodity_order_item_list.map(goods => ({
checked: true,
isafterSale: true,
orderId: item.id,
commodity_goods_info: {
commodity_brief: "",
commodity_id: goods.commodity_id,

View File

@ -263,7 +263,8 @@ export default {
gotoPayment() {
//
const transformedItems = this.orderInfo.commodity_order_item_list.map(goods => ({
checked: true,
isafterSale: true,
orderId: item.id,
commodity_goods_info: {
commodity_brief: "",
commodity_id: goods.goods_id,

View File

@ -562,6 +562,41 @@ export default {
if (!isGroupBuyValid) break;
}
// isafterSaletrue
const hasAfterSaleItem = this.carList.some(item => item.isafterSale === true);
const orderIdFromAfterSale = hasAfterSaleItem ? this.carList.find(item => item.isafterSale === true)?.orderId : null;
// trans_type
// : 71, App: 51
const systemInfo = uni.getSystemInfoSync();
let trans_type = 51; // App
//
if (systemInfo.platform === 'devtools' || systemInfo.platform === 'unknown') {
trans_type = 71; //
}
//
// #ifdef MP
trans_type = 71; //
// #endif
// #ifdef APP-PLUS
trans_type = 51; // App
// #endif
// isafterSaletruecreateOrder
if (hasAfterSaleItem && orderIdFromAfterSale) {
const param = {
order_id: orderIdFromAfterSale,
user_id: uni.getStorageSync('userId'),
trans_type: trans_type
}
request(apiArr.mergePreorder, "POST", param).then(res => {
this.handleMergePreorderResponse(res, orderIdFromAfterSale);
})
} else {
//
const params = {
user_id: uni.getStorageSync('userId'),
is_group_buy: isGroupBuyValid,
@ -599,34 +634,21 @@ export default {
})
}
request(apiArr.createOrder, "POST", params).then(resVal => {
// trans_type
// : 71, App: 51
const systemInfo = uni.getSystemInfoSync();
let trans_type = 51; // App
//
if (systemInfo.platform === 'devtools' || systemInfo.platform === 'unknown') {
trans_type = 71; //
}
//
// #ifdef MP
trans_type = 71; //
// #endif
// #ifdef APP-PLUS
trans_type = 51; // App
// #endif
const param = {
order_id: resVal.order_id,
user_id: uni.getStorageSync('userId'),
trans_type: trans_type
}
request(apiArr.mergePreorder, "POST", param).then(res => {
this.handleMergePreorderResponse(res, resVal.order_id);
})
})
}
},
// mergePreorder
handleMergePreorderResponse(res, orderId) {
if (res && res.timeStamp && res.nonceStr && res.package && res.signType && res.paySign) {
//
uni.requestPayment({
@ -637,7 +659,7 @@ export default {
paySign: res.paySign,
success: (payRes) => {
const params = {
order_id: resVal.order_id,
order_id: orderId,
from: 2,
group_buy_activity_id: this.group_buy_activity_id,
}
@ -663,8 +685,7 @@ export default {
icon: 'none'
})
}
})
})
}
},
//
copyAddress() {