下单逻辑修改提测

This commit is contained in:
GaoHao
2024-09-27 18:28:49 +08:00
parent a3e1d951e6
commit e2881ebd7b
11 changed files with 99 additions and 108 deletions

View File

@@ -1,5 +1,5 @@
<template>
<viwe>
<view>
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@close="close">
<view class="cart-list-wrap">
@@ -15,24 +15,24 @@
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
<view class="shop-item-content">
<view class="cover" v-if="item.productId!=-999">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
<u-image :src="item.coverImg" width="120" radius="10" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price-wrap" style="padding-top: 0;" >
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<view class="operation-wrap">
<view class="btn" v-if="item.number&&item.productId!=-999" >
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn" v-if="item.productId!=-999">
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
</view>
@@ -40,7 +40,7 @@
</view>
</view>
</view>
<view class="shop-item-remark">
<view class="shop-item-remark" v-if="item.productId!=-999">
<view class="label">备注</view>
<u--input
placeholder="商品备注(选填)"
@@ -54,7 +54,7 @@
</scroll-view>
</view>
</u-popup>
</viwe>
</view>
</template>
@@ -116,7 +116,7 @@
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
this.addCart(params);
this.$emit("addCart",params)
} catch (e) {
//TODO handle the exception
}
@@ -137,20 +137,9 @@
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
this.addCart(params);
this.$emit("addCart",params)
},
/**
* 添加到购物车
*/
async addCart(data) {
let res = await this.api.cartAdd(data)
if (res.code == 0) {
this.showShopsku = false;
this.pagemetashow = false;
// this.$set(this, 'amountcartNumber', 0)
}
},
/**
* 清空购物车
*/

View File

@@ -13,7 +13,7 @@
<text class="i"></text>
<text class="num">{{cartLists.amount||'0.00'}}</text>
</view>
<view class="btn" @tap="orderdetail">
<view class="btn" @tap="$u.debounce(orderdetail, 500)" >
<text class="t">去结算</text>
</view>
</view>
@@ -26,11 +26,11 @@
data() {
return {
orderdetailFlag: true,
}
},
props:{
cartListsdatashow: {
type: Boolean
},
@@ -72,10 +72,7 @@
* 结算直接生成订单
*/
orderdetail() {
if (!this.orderdetailFlag) {
return;
}
this.orderdetailFlag = false;
if (this.cartLists.data.length == 0) {
uni.showToast({
title: '请先添加商品',