更新购物车
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
<scroll-view scroll-y class="scroll-view">
|
||||
<view class="head">
|
||||
<view class="head_bg"></view>
|
||||
<!-- <view class="tips" v-if="shopInfo.registerType == 'before'"> -->
|
||||
<view class="tips">
|
||||
<image class="informIcon"
|
||||
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/informIcon.png"
|
||||
@@ -65,32 +64,27 @@
|
||||
<image class="img" :src="item.coverImg" mode="aspectFill" />
|
||||
<view class="center">
|
||||
<text class="center_title"> {{item.name}} </text>
|
||||
<text class="type" v-if="item.skuList">
|
||||
<text class="type" v-if="item.skuList && item.type == 'sku'">
|
||||
<text v-for="i in item.skuList" :key="i.id">
|
||||
{{item.id == i.productId && item.skuId == i.id ? i.specInfo :""}}
|
||||
{{item.cartListinfo.sku_id == i.id ? i.name :""}}
|
||||
</text>
|
||||
</text>
|
||||
|
||||
<text class="type" v-if="item.type == 'package'">
|
||||
<text v-for="(a,b) in dataprocessing(item.cartListinfo)" :key="b">
|
||||
<text v-for="i in a.goods" :key="i.proId" style="margin-left: 4rpx;">
|
||||
{{i.proName }}
|
||||
</text>
|
||||
</text>
|
||||
</text>
|
||||
|
||||
<text class="num"> X{{ ifcartNumber(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text
|
||||
class="price">¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}</text>
|
||||
<text class="price">
|
||||
¥{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice||item.salePrice):item.salePrice}}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 餐位费 -->
|
||||
<view class="cell-item" v-if="shopTable.useNum>0">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{shopTable.seatNum}}</view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{Seatcharge}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="totalPrice">
|
||||
<text style="margin-bottom: 5rpx;">小计¥</text>
|
||||
<text class="totalPriceNum"> {{totalCost}} </text>
|
||||
</view> -->
|
||||
<!-- <u-divider color="#fa3534" half-width="200" border-color="#6d6d6d">姑苏城外寒山寺</u-divider> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -103,28 +97,12 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 支付方式 -->
|
||||
<!-- <view style="padding: 0 20rpx;" v-if="shopInfo.registerType == 'before'">
|
||||
<paymentMethod ref="paymentMethodref" @groupChange="groupChange">
|
||||
</paymentMethod>
|
||||
</view> -->
|
||||
|
||||
<!-- boutton -->
|
||||
<view style="width: 100%;height: 200rpx;"> </view>
|
||||
<view class="bottom">
|
||||
<view class="bottom_left">
|
||||
<text style="margin-bottom: 5rpx;">实付金额</text>
|
||||
<text class="totalAmount">¥{{ totalPrices }} </text>
|
||||
</view>
|
||||
<!-- <block v-if="shopInfo.registerType == 'before'">
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-if="shopInfo">
|
||||
{{ paymentmethod.paymentBtnText }}
|
||||
</view>
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else>
|
||||
{{ paymentmethod.paymentBtnText }}
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="shopInfo.registerType == 'after'"> -->
|
||||
<block>
|
||||
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)"> 提交订单 </view>
|
||||
</block>
|
||||
@@ -231,7 +209,7 @@
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice || item.salePrice) * parseFloat(item
|
||||
.cartNumber);
|
||||
.cartNumber);
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.salePrice || 0) * parseFloat(item.cartNumber);
|
||||
@@ -353,7 +331,17 @@
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
const dataprocessing = computed(() => {
|
||||
return (item) => {
|
||||
let res = null
|
||||
try {
|
||||
res = JSON.parse(item.pro_group_info)
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
return res
|
||||
};
|
||||
})
|
||||
|
||||
const thisdata = reactive({
|
||||
opacitys: false,
|
||||
|
||||
@@ -141,23 +141,26 @@
|
||||
}
|
||||
// 购物车加减
|
||||
const cartListadd = async (item, i) => {
|
||||
// 是否起售 如果小于或者大于都是1
|
||||
const cartNumberFloat = parseFloat(item.cartNumber);
|
||||
const suitNum = item.suitNum >= cartNumberFloat && i == '-' ? item.cartNumber : 1;
|
||||
|
||||
emits('customevent', {
|
||||
id: item.cartListId ? item.cartListId : '',
|
||||
type: 'shopping',
|
||||
table_code: uni.cache.get('tableCode'),
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
operate_type: calculateValue(item.cartNumber, i) == 'del' ? 'del' : item.cartListId &&
|
||||
operate_type: calculateValue(item.cartNumber, i, suitNum) == 'del' ? 'del' : item.cartListId &&
|
||||
item.cartNumber > 0 ? 'edit' : 'add',
|
||||
product_id: item.id,
|
||||
sku_id: item.skuId,
|
||||
number: await calculateValue(item.cartNumber, i),
|
||||
number: await calculateValue(item.cartNumber, i, suitNum),
|
||||
is_print: 1,
|
||||
})
|
||||
}
|
||||
|
||||
const dataprocessing = computed(() => {
|
||||
return (item) => {
|
||||
console.log(item.pro_group_info)
|
||||
let res = null
|
||||
try {
|
||||
res = JSON.parse(item.pro_group_info)
|
||||
@@ -168,16 +171,16 @@
|
||||
};
|
||||
})
|
||||
|
||||
// 封装加法函数
|
||||
const calculateValue = (cartNumber, i, step = 1) => {
|
||||
if (i == '+') {
|
||||
const result = parseFloat(cartNumber) + step;
|
||||
const result = parseFloat(cartNumber) + parseFloat(step);
|
||||
return result.toFixed(2);
|
||||
} else {
|
||||
const result = parseFloat(cartNumber) - step;
|
||||
// 当减到0返回del
|
||||
const result = parseFloat(cartNumber) - parseFloat(step);
|
||||
return result == 0 ? 'del' : result.toFixed(2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 菜品备注修改
|
||||
const productBlur = (item) => {
|
||||
|
||||
Reference in New Issue
Block a user