fixbug: 修复部分bug

This commit is contained in:
2025-08-17 07:30:48 +08:00
parent 19fe51883f
commit 5398b4234d
9 changed files with 95 additions and 237 deletions
@@ -180,7 +180,7 @@
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,settlementOrder, 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'
@@ -216,14 +216,14 @@ export default {
selectAddress: {},// 收件地址选择
wayOption: [],
isShowBalance: false,
ji:0,
sed:null,
curPay:null
ji: 0,
sed: null,
curPay: null
};
},
onLoad(option) {
// const ids = option.ids;
if(option.sed){
if (option.sed) {
this.ji = 1;
this.sed = JSON.parse(option.sed)
this.getOrderTwo();
@@ -232,9 +232,11 @@ export default {
this.ids = option.ids;
this.getOrder();
}
const addressShow = option.addressShow;
if (addressShow && addressShow !== "null") {
this.addressShow = addressShow;
console.log("参数---", option)
const addressShowPop = option.addressShow;
if (addressShowPop && addressShowPop !== "null") {
this.addressShow = addressShowPop;
}
// 支付弹框
const payOpen = option.payOpen;
@@ -266,12 +268,12 @@ export default {
async getWayOption() {
let parmas = {
}
if(this.ji){
if (this.ji) {
parmas['types'] = '4';
}else{
} else {
parmas['types'] = '2,3';
}
console.log('this.ji',parmas)
console.log('this.ji', parmas)
const result = await getSupportPay(parmas);
if (result && result.bizcode === 100) {
const data = result.data || [];
@@ -285,7 +287,7 @@ export default {
this.isShowBalance = balanceFlag;
}
this.wayOption = data;
console.log('getWayOption',this.wayOption)
console.log('getWayOption', this.wayOption)
}
},
async getOrder() {
@@ -330,42 +332,42 @@ export default {
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,
amount: this.sed.goodsNum * this.sed.specsId.price,
shops: [{
addrTimes: [
{
address:null,
deliveryTime:data.deliveryTime,
postagesId:data.postagesId,
postagesType:1,
goods:[
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
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
], id: data.shop.id, logo: data.shop.logo, name: data.shop.name
}]
};
this.orderInfo.paymentMethod = null;
}
// const params = {
// cartIds: ids,
@@ -453,8 +455,8 @@ export default {
* 去支付
*/
async goPay() {
console.log('getWayOption',this.wayOption,this.orderInfo)
console.log('getWayOption', this.wayOption, this.orderInfo)
const orderInfo = this.orderInfo;
if (!orderInfo.address || Object.keys(orderInfo.address).length === 0) {
@@ -473,10 +475,10 @@ export default {
});
return;
}
let arr = this.wayOption.filter(i=>i.type == orderInfo.paymentMethod);
if(arr.length){
if(arr[0].type == 'balance' || arr[0].type == 'redpacket'){
if(arr[0].balance < orderInfo.amount){
let arr = this.wayOption.filter(i => i.type == orderInfo.paymentMethod);
if (arr.length) {
if (arr[0].type == 'balance' || arr[0].type == 'redpacket') {
if (arr[0].balance < orderInfo.amount) {
this.$refs.uToastRef.show({
type: 'error',
message: "余额不足",
@@ -484,14 +486,14 @@ export default {
return;
}
}
}else{
} else {
this.$refs.uToastRef.show({
type: 'error',
message: "请先选择支付方式",
});
return;
}
const params = {
addrId: orderInfo.address.id,// 收货地址ID
//结算的购物车ID,多个以逗号分割,ALL表示全选
@@ -499,19 +501,19 @@ export default {
remark: JSON.stringify(this.getRemark()),//备注信息'[{"sid":"店铺ID","rmk":"备注内容"},{"sid":"店铺ID","rmk":"备注内容"}]'
}
let resp = null;
if(this.sed){
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{
} else {
params['cartIds'] = this.ids;
resp = await settle(params);
}
console.log('getWayOption',resp)
console.log('getWayOption', resp)
// 提交订单成功,就唤起支付
if (resp && resp.bizcode === 100) {
const item = resp.data;