代课下单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"> <view class="u-flex-1">
<input @input="discountMoneyInput" v-model="form.discountMoney" type="digit" <input @input="discountMoneyInput" v-model="form.discountMoney" type="digit"
placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" /> placeholder-class="placeholder-class" placeholder="减8.55元请输入8.55" />
</view> </view>
<view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center"> <view class="color-999 u-p-l-48 u-p-r-48 u-flex u-row-center u-col-center">
<view></view> <view></view>
@@ -70,7 +69,10 @@
<view class="u-p-30"> <view class="u-p-30">
<view class="u-m-t-10"> <view class="u-m-t-10">
<my-button @tap="confirm" shape="circle" showShadow>确认</my-button> <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>
</view> </view>
</template> </template>

View File

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