新增商品其他售价逻辑

修复下单重复创建订单问题
This commit is contained in:
2024-05-16 15:38:34 +08:00
parent 62c9994444
commit f547216c2b
8 changed files with 52 additions and 17 deletions

View File

@@ -3,7 +3,7 @@
<view class='swiper-container'>
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
<swiper-item v-for='(item,index) in [goodsBean?.images]' :key='index'>
<image :src='item||defaultImage' />
<image :src='item||defaultImage' mode='aspectFill' />
</swiper-item>
</swiper>
<view class='indicator' style='display: none'>
@@ -25,7 +25,7 @@
</view>
<view class='c-flex-row'>
<text style='flex: 1'>{{ goodsBean?.name }}</text>
<text style='flex: 1'>{{ goodsBean?.name || '未知' }}</text>
<view class='share-button'>
<image :src='assetsUrl("ic_share.png")'></image>
<button class='btn' plain open-type='share'>分享</button>
@@ -129,6 +129,7 @@ const swiperIndex = ref(0);
onLoad(async (e: any) => {
await uni.showLoading();
goodsBean.value = await getGoodsDetail(e.goodsId);
goodsBean.value.price = userStore.getRealGoodsPrice(goodsBean.value?.price, goodsBean.value?.priceExt);
const { rows } = await getGoodsList({
page: {
page: 1,
@@ -140,6 +141,9 @@ onLoad(async (e: any) => {
}
});
recommendList.value = rows;
recommendList.value?.forEach(e => {
e.price = userStore.getRealGoodsPrice(e.price, e.priceExt);
});
uni.hideLoading();
});

View File

@@ -42,7 +42,7 @@
<image class='goods-image' :src='item.images||defaultImage' />
<view class='c-flex-column' style='flex: 1;'>
<view class='c-flex-row'>
<text class='goods-name'>{{ item.name }}</text>
<text class='goods-name'>{{ item.name || '未知' }}</text>
</view>
<text style='color: #999999;margin-top: 30rpx'>
{{ item.code }}
@@ -193,6 +193,10 @@ const navigateTo = (e: any) => {
},
onFailure: () => {
console.error('pay onFailure');
if(orderBean.value?.id) {
orderBean.value.id = '';
}
createOrder();
}
});
};
@@ -233,10 +237,12 @@ const createOrder = async () => {
))
};
await uni.showLoading();
const result = await orderCreate(params);
orderBean.value!.id = result.id;
uni.hideLoading();
if(orderBean.value?.id == undefined || orderBean.value?.id == '') {
await uni.showLoading();
const result = await orderCreate(params);
orderBean.value!.id = result.id;
uni.hideLoading();
}
//删除购物车已存在商品
orderBean?.value?.orderGoods?.forEach(item => {