修复代客下单起售数量问题
This commit is contained in:
parent
1bf3334127
commit
68c23e6e48
|
|
@ -52,8 +52,10 @@
|
|||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import infobox from '@/commons/utils/infoBox.js'
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import myButton from '@/components/my-components/my-button.vue'
|
||||
const props = defineProps({
|
||||
|
|
@ -98,6 +100,10 @@
|
|||
const goods=computed(()=>{
|
||||
return props.skuMap[selSku.value]
|
||||
})
|
||||
watch(()=>goods.value,(newval)=>{
|
||||
console.log(newval);
|
||||
number.value=newval.suit||1
|
||||
})
|
||||
|
||||
//全部规格是否都无法使用
|
||||
const isAllDisabled=computed(()=>{
|
||||
|
|
@ -142,7 +148,11 @@
|
|||
if(isDisabled()){
|
||||
return
|
||||
}
|
||||
const suit=goods.value.suit||1
|
||||
const newval = number.value - 1
|
||||
if(newval<suit){
|
||||
return infobox.showToast(suit+'个起售')
|
||||
}
|
||||
number.value = newval <= 1 ? 1 : newval
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -298,13 +298,14 @@
|
|||
return Api.getGoodsLists(par)
|
||||
}
|
||||
//获取购物车数据
|
||||
function getCart(par = {
|
||||
async function getCart(par = {
|
||||
page: 0,
|
||||
size: 300,
|
||||
masterId: data.masterId,
|
||||
tableId: data.table.tableId
|
||||
}) {
|
||||
return Api.getCart(par)
|
||||
const res= await Api.getCart(par)
|
||||
return res
|
||||
}
|
||||
//获取取餐码
|
||||
function getMasterId() {
|
||||
|
|
@ -742,7 +743,9 @@
|
|||
const cartId = goods.id
|
||||
const tabbarIndex = data.tabbar.findIndex(v => v.id == categoryId)
|
||||
const $goods = data.tabbar[tabbarIndex].foods.find(v => v.id == productId)
|
||||
if (num === 0) {
|
||||
const $sku = $goods.specList.find(v => v.id == skuId)
|
||||
|
||||
if (num === 0||num<$sku.suit) {
|
||||
//移除
|
||||
await removeCartGoods({
|
||||
cartId
|
||||
|
|
@ -793,13 +796,14 @@
|
|||
});
|
||||
const productId = $goods.id
|
||||
const skuId = $goods.specList[0].id
|
||||
const suit=$goods.specList[0].suit||1
|
||||
if (goodsInCarIndex !== -1) {
|
||||
//更新
|
||||
const carGoods = cars[goodsInCarIndex]
|
||||
const cartId = carGoods.id
|
||||
const step = isAdd ? 1 : -1
|
||||
const num = carGoods.number * 1 + step
|
||||
if (num === 0) {
|
||||
if (num === 0||num<suit) {
|
||||
//移除
|
||||
cars.splice(goodsInCarIndex, 1)
|
||||
$goods.chooseNumber = 0
|
||||
|
|
@ -819,7 +823,7 @@
|
|||
$goods.chooseNumber = number
|
||||
} else {
|
||||
//增加
|
||||
const num = 1
|
||||
const num = suit
|
||||
const cartGoods = await addCart({
|
||||
num,
|
||||
productId,
|
||||
|
|
|
|||
Loading…
Reference in New Issue