增加打包费

This commit is contained in:
2024-10-12 17:51:02 +08:00
parent 0fbc897d2c
commit b32a3a398b

View File

@@ -183,7 +183,7 @@
<button class="tag" hover-class="hover-class"
@tap="toggleGoodsItemKey(item,index,'isGift')">{{item.isGift?'取消赠送':'赠送'}}</button>
</view>
<view class="u-flex u-m-r-20 u-m-b-20">
<view class="u-flex u-m-r-20 u-m-b-20" v-if="eatTypes.active!='takeout'">
<button class="tag" hover-class="hover-class"
@tap="toggleGoodsItemKey(item,index,'isPack')">{{item.isPack?'取消打包':'打包'}}</button>
</view>
@@ -200,16 +200,26 @@
</view>
</view>
<template v-if="eatTypes.active=='takeout'">
</template>
<template v-else>
<view v-if="$seatFee&&$seatFee.totalAmount" class="u-flex u-row-between u-m-t-18 u-p-b-34 border-bottom">
<view>
<text >桌位费</text>
<view class="border-bottom">
<template v-if="$seatFee&&$seatFee.totalAmount">
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 ">
<view>
<text >桌位费</text>
</view>
<view>{{$seatFee.totalAmount||'0.00'}}</view>
</view>
<view>{{$seatFee.totalAmount||'0.00'}}</view>
</view>
</template>
</template>
<template v-if="$packFee>0">
<view class="u-flex u-row-between u-m-t-18 u-p-b-34 ">
<view>
<text >打包费</text>
</view>
<view>{{$packFee||'0.00'}}</view>
</view>
</template>
</view>
<view class="u-flex u-row-right u-m-t-38">
<!-- <template v-if="$shop.registerType=='munchies'">
@@ -363,6 +373,9 @@
par[key] = !item[key]
const res = await Api.addCart(par)
goods.list[index][key] = returnBoolean(res[key])
if(key=='isPack'){
getCart()
}
}
//等叫
function toggleWait(item) {
@@ -383,7 +396,12 @@
],
active: 'dine-in'
})
const $packFee=computed(()=>{
return goods.list.reduce((prve,cur)=>{
return prve+cur.packFee
},0).toFixed(2)
})
function chooseUser() {
go.to('PAGES_CHOOSE_USER')
@@ -460,12 +478,13 @@
})
const goodsPrice = computed(() => {
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
const tPrice=cur.salePrice * cur.number+cur.packFee*1
return prve +(cur.isGift?0:tPrice)
}, 0)
return (goodsTotalPrice|| 0).toFixed(2)
})
const allPrice = computed(() => {
const n=goodsPrice.value*1 + (eatTypes.active=='takeout'?0:($seatFee.totalAmount || 0))
const n=goodsPrice.value*1 + $seatFee.totalAmount
return n.toFixed(2)
// const goodsTotalPrice = goods.list.reduce((prve, cur) => {
// return prve + cur.salePrice * cur.number * (cur.isGift ? 0 : 1)
@@ -501,6 +520,8 @@
if (seatFee && seatFee.totalNumber) {
userNumbers.defaultCateIndex = seatFee.totalNumber-1 || 0
Object.assign($seatFee, seatFee)
}else{
$seatFee.totalAmount=0
}
console.log(goods.list);