Merge branch 'dongjian' into develop

This commit is contained in:
2025-08-14 23:19:27 +08:00
3 changed files with 136 additions and 21 deletions
+7
View File
@@ -57,3 +57,10 @@ export function settle(data) {
data,
});
}
export function settlementOrder(data) {
return request({
url: "/cart/settlementOrder",
method: "post",
data,
});
}
+111 -11
View File
@@ -49,7 +49,28 @@
</view>
</view>
<!-- 产品详情 -->
<view class="order_item_content" v-for="(pItem, pIndex) in addItem.goods" :key="pItem.id">
<view v-if="ids" class="order_item_content" v-for="(pItem, pIndex) in addItem.goods" :key="pItem.id">
<up-image :src="pItem.img" width="80" height="80" bgColor="#f1f6ff00"
@click="jumpProductInfo(pItem)"></up-image>
<view class="content_info_right">
<view class="content_info_left_total" @click="jumpProductInfo(pItem)">
<view class="content_info_title">{{ pItem.title }}</view>
<view class="content_info_tag">{{ pItem.specs }}</view>
</view>
<view class="content_info_right_total">
<view class="content_right_total">
<view>¥<text style="font-size: 36rpx;">{{ pItem.totalPrice }}</text></view>
<view>每件到手价¥{{ pItem.unitPrice }}</view>
</view>
<view class="shopping_info_quantity">
<view class="quantity_but" @click="quantityFun('minus', index, addIndex, pIndex)">-</view>
<view class="quantity_value">{{ pItem.num }}</view>
<view class="quantity_but" @click="quantityFun('add', index, addIndex, pIndex)">+</view>
</view>
</view>
</view>
</view>
<view v-else class="order_item_content" v-for="(pItem, pIndex) in addItem.goods" :key="pItem.id">
<up-image :src="pItem.img" width="80" height="80" bgColor="#f1f6ff00"
@click="jumpProductInfo(pItem)"></up-image>
<view class="content_info_right">
@@ -157,8 +178,9 @@
<script>
import Address from '@/components/address.vue';
import { getGoodsDetail } from '@/api/product.js';
import { PAYMENT_WAY, PAYMENT_WAY_, PRODUCT_DELIVERY_TIME, getValue, WAY_LIST } from '@/utils/enumUtils.js';
import { getSettleList, settle, updateGoodsNum } from '@/api/cart.js';
import { getSettleList, settle,settlementOrder, updateGoodsNum } from '@/api/cart.js';
import { getSupportPay } from '@/api/order.js';
import { feedback } from '@/api/payment.js';
import { assembleAddress } from '@/utils/index.js'
@@ -194,16 +216,19 @@ export default {
selectAddress: {},// 收件地址选择
wayOption: [],
isShowBalance: false,
ji:0
ji:0,
sed:null
};
},
onLoad(option) {
const ids = option.ids;
if(option.ji){
// const ids = option.ids;
if(option.sed){
this.ji = 1;
this.sed = JSON.parse(option.sed)
this.getOrderTwo();
}
if (ids && ids !== "null") {
this.ids = ids;
if (option.ids) {
this.ids = option.ids;
this.getOrder();
}
const addressShow = option.addressShow;
@@ -241,7 +266,7 @@ export default {
let parmas = {
}
if(this.ji){
params['type'] = 4;
parmas['type'] = 4;
}
const result = await getSupportPay(parmas);
if (result && result.bizcode === 100) {
@@ -292,6 +317,71 @@ export default {
this.orderInfo = data;
}
},
async getOrderTwo() {
const params = {
id: this.sed.id,
}
const resp = await getGoodsDetail(params);
if (resp && resp.bizcode === 100) {
const data = resp.data;
this.ji = data.type == 3 ? 1 : 0;
this.orderInfo = {
address:null,
amount:this.sed.goodsNum * this.sed.specsId.price,
shops:[{
addrTimes:[
{
address:null,
deliveryTime:data.deliveryTime,
postagesId:data.postagesId,
postagesType:1,
goods:[
{
adress:null,
addressId:null,
areaName:null,
cityName:null,
goodsId:this.sed.id,
id:this.sed.specsId.id,
img:data.goodsGraph,
name:null,
num:this.sed.goodsNum,
phone:null,
provinceName:null,
specs:this.sed.specsId.combNames,
title:data.name,
totalPrice:this.sed.goodsNum * this.sed.specsId.price,
unitPrice:this.sed.specsId.price
}
]
}
],id:data.shop.id,logo:data.shop.logo,name:data.shop.name
}]
};
this.orderInfo.paymentMethod = null;
}
// const params = {
// cartIds: ids,
// }
// const resp = await getSettleList(params);
// if (resp && resp.bizcode === 100) {
// const data = resp.data;
// const shops = data.shops;
// if (shops && shops.length !== 0) {
// shops.map(item => {
// item.addrTimes.map(addItem => {
// addItem.remark = null;
// })
// })
// }
// data.shops = shops;
// data.paymentMethod = null;// 支付方式
// this.orderInfo = data;
// }
},
/**
* 数量进行增加删除
* @param {Object} type 区分是 + 还是 -
@@ -380,12 +470,22 @@ export default {
const params = {
addrId: orderInfo.address.id,// 收货地址ID
cartIds: this.ids,//结算的购物车ID,多个以逗号分割,ALL表示全选
//结算的购物车ID,多个以逗号分割,ALL表示全选
payway: way,// 支付方式:1-微信,2-支付宝
remark: JSON.stringify(this.getRemark()),//备注信息'[{"sid":"店铺ID","rmk":"备注内容"},{"sid":"店铺ID","rmk":"备注内容"}]'
}
console.log("params", params);
const resp = await settle(params);
const resp = null;
if(this.sed){
params['goodsId'] = this.sed.id;
params['specsId'] = this.sed.specsId.id;
params['goodsNum'] = this.orderInfo.shops[0].addrTimes[0].goods[0].num;
resp = await settlementOrder(params);
}else{
params['cartIds'] = this.ids;
resp = await settle(params);
}
// 提交订单成功,就唤起支付
if (resp && resp.bizcode === 100) {
const item = resp.data;
@@ -275,9 +275,7 @@ export default {
onLoad(options) {
const id = options.id;
const source = options.source;
if(options.ji){
this.ji = 1;
}
if (id && id !== 0) {
this.id = id ? parseInt(id, 10) : 0;
if (source && source === 'supply_chain') {
@@ -326,6 +324,7 @@ export default {
const resp = await getGoodsDetail(params);
if (resp && resp.bizcode === 100) {
const data = resp.data;
this.ji = data.type == 3 ? 1 : 0;
// 商品图
if (data.goodsGraph) {
this.swiperList = data.goodsGraph.split(",");
@@ -495,24 +494,33 @@ export default {
});
return;
}
const params = {
id: this.id,
specsId: selectTempl.id,// 规格ID
goodsNum: this.orderInfo.quantity,// 商品数量
}
console.log('selectTempl',selectTempl)
if(isBy){
params['specsId'] = selectTempl;
uni.navigateTo({
url: `/pages/order_package/order_submit/order_submit?sed=${JSON.stringify(params)}`,
})
return;
}
const resp = await addGoods(params);
if (resp && resp.bizcode === 100) {
if (isBy) {
uni.navigateTo({
url: `/pages/order_package/order_submit/order_submit?ids=${resp.data}&ji=${ji}`,
})
} else {
// if (isBy) {
// uni.navigateTo({
// url: `/pages/order_package/order_submit/order_submit?ids=${resp.data}&ji=${this.ji}`,
// })
// } else {
uni.showToast({
title: '成功加入购物车',
icon: 'success', // 可选 success/loading/none
duration: 2000 // 持续时长,单位ms
});
}
// }
setTimeout(() => {
this.checkSpecification(false, null);
}, 2000)