代课下单bug修改

This commit is contained in:
duan
2024-12-04 09:38:18 +08:00
parent c4f43a0626
commit ff1e6f60e0
2 changed files with 28 additions and 23 deletions

View File

@@ -34,7 +34,6 @@
<view class="u-flex-1">
<input @input="discountMoneyInput" v-model="form.discountMoney" type="digit"
placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" />
</view>
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
<view></view>
@@ -70,7 +69,10 @@
<view class="u-p-30">
<view class="u-m-t-10">
<my-button @tap="confirm" shape="circle" showShadow>确认</my-button>
<my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button>
<view style="height: 20rpx;">
</view>
<!-- <my-button type="cancel" bgColor="#fff" @tap="confirm">取消</my-button> -->
</view>
</view>
</template>

View File

@@ -136,10 +136,15 @@
:key="index">
<view class="u-flex u-row-between ">
<view class="u-flex">
<image class="img" :src="item.coverImg" mode=""></image>
<image class="img" v-if="item.coverImg" :src="item.coverImg" mode=""></image>
<view
style="background-color: #3f9eff; width: 84rpx;height: 84rpx;line-height: 84rpx;text-align: center;color: #fff;"
v-else>
临时菜
</view>
<view class="u-m-l-32">
<view class="u-flex">
<view class="u-flex u-m-r-20" v-if="item.isWait">
<view class="u-flex u-m-r-20" v-if="item.isWaitCall">
<uni-tag text="等叫"
custom-style="background-color: #FFF0DF; border-color: #FFF0DF; color: #FF9F2E;">
</uni-tag>
@@ -217,7 +222,7 @@
</view>
<view class="u-flex u-m-r-20 ">
<button class="tag" hover-class="hover-class"
@tap="toggleWait(item)">{{item.isWait?'取消等叫':'等叫'}}</button>
@tap="toggleWait(item)">{{item.isWaitCall?'取消等叫':'等叫'}}</button>
</view>
<view class="u-flex u-m-r-20 ">
<button class="tag" hover-class="hover-class"
@@ -289,7 +294,8 @@
</view>
</view>
<model-discount title="菜品减免" :ref="setModel" name="discount" :price="modelData.data.salePrice" @confirm="discountconfirm"></model-discount>
<model-discount title="菜品减免" :ref="setModel" name="discount" :price="modelData.data.salePrice"
@confirm="discountconfirm"></model-discount>
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
<one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
@@ -363,7 +369,6 @@
// 单品打折
async function discountconfirm(form) {
console.log(form, '调试111111')
let str = ''
if (form.notes) {
form.notes.forEach(ele => {
@@ -378,6 +383,7 @@
cartId: modelData.data.id
}
const res = await Api.$updatePrice(obj)
getCart()
}
//用餐人数
@@ -445,19 +451,17 @@
par[key] = !item[key]
const res = await Api.$updateCart(par)
goods.list[index][key] = returnBoolean(res[key])
if (key == 'isPack') {
getCart()
}
}
//等叫
async function toggleWait(item) {
item.isWait = !item.isWait
item.isWaitCall = !item.isWaitCall
let obj = {
cartId: item.id,
isGift: item.isGift,
isPack: item.isPack,
isPrint: item.isPrint,
isWaitCall: item.isWait,
isWaitCall: item.isWaitCall,
masterId: option.masterId,
num: item.number, // 0会删除此商品
productId: item.productId,
@@ -467,7 +471,6 @@
let res = await Api.$updateCart(obj)
}
// 打印
async function toggisPrint(item) {
item.isPrint = !item.isPrint
let obj = {
@@ -475,7 +478,7 @@
isGift: item.isGift,
isPack: item.isPack,
isPrint: item.isPrint,
isWaitCall: item.isWait,
isWaitCall: item.isWaitCall,
masterId: option.masterId,
num: item.number, // 0会删除此商品
productId: item.productId,
@@ -578,11 +581,11 @@
const isVip = computed(() => {
return $shop.value.isMemberPrice && user.value && user.value.id && user.value.isVip
})
const discountSaleAmount=computed(()=>{
const discountSaleAmount = computed(() => {
return goods.list.filter((v) => v.discountSaleAmount && v.discountSaleAmount > 0)
.reduce((a, b) => {
return a + b.number * b.discountSaleAmount;
}, 0);
.reduce((a, b) => {
return a + b.number * b.discountSaleAmount;
}, 0);
})
const goodsPrice = computed(() => {
const goodsTotalPrice = goods.list.reduce((prve, cur) => {
@@ -591,10 +594,10 @@
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
return prve + (cur.isGift ? 0 : tPrice) + tpackFee
}, 0)
return ((goodsTotalPrice-discountSaleAmount.value) || 0).toFixed(2)
return ((goodsTotalPrice - discountSaleAmount.value) || 0).toFixed(2)
})
const allPrice = computed(() => {
console.log(goodsPrice.value,'调试2121');
console.log(goodsPrice.value, '调试2121');
const n = goodsPrice.value * 1 + $seatFee.totalAmount
return n.toFixed(2)
// const goodsTotalPrice = goods.list.reduce((prve, cur) => {
@@ -603,9 +606,9 @@
// return (goodsTotalPrice + ($seatFee.totalAmount || 0)).toFixed(2)
})
const youhui = computed(() => {
let goodsTotalPrice=0
let goodsTotalPrice = 0
if (user.value && user.value.id && user.value.isVip) {
goodsTotalPrice = goods.list.reduce((prve, cur) => {
goodsTotalPrice = goods.list.reduce((prve, cur) => {
const tPrice = cur.salePrice * cur.number
const tpackFee = cur.isPack ? cur.packFee * 1 : 0
return prve + tPrice + tpackFee
@@ -614,7 +617,7 @@
} else {
return (discountSaleAmount.value)
}
return (goodsTotalPrice+discountSaleAmount.value*1).toFixed(2)
return (goodsTotalPrice + discountSaleAmount.value * 1).toFixed(2)
})
function setGoodsItem(key, val) {