代客下单更新

This commit is contained in:
YeMingfei666 2024-10-10 16:22:09 +08:00
parent efa346ade6
commit 0632e395ce
6 changed files with 61 additions and 23 deletions

View File

@ -45,6 +45,9 @@
</view>
</view>
</view>
<template v-if="tables.list.length<=0">
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
</template>
</view>
@ -142,7 +145,7 @@
content
} = await $table.get(query)
tables.hasAjax = true
content = content.filter(v => v.status != 'closed')
content = content.filter(v => v.status == 'idle')
tables.list = content
tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
console.log(tables.selIndex );
@ -166,6 +169,10 @@
}
watch(() => area.sel, (newval) => {
if(!newval){
tables.list = tables.originList
return
}
tables.list = tables.originList.filter(v => v.areaId == newval.id)
})
let option = {}

View File

@ -48,6 +48,7 @@
function changeCauses(item) {
let prve=form.remark?',':''
form.remark +=prve+item.name
console.log(form.remark);
}
const causes = reactive([{

View File

@ -221,7 +221,7 @@
<model-discount title="菜品打折/减免" :ref="setModel" name="discount" :price="allPrice"></model-discount>
<give-food title="赠菜" :ref="setModel" name="giveFood"></give-food>
<my-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></my-remark>
<one-remark @confirm="goodsOneRemarkConfirm" title="单品备注" :ref="setModel" name="remark"></one-remark>
<edit-discount title="优惠金额" :ref="setModel" name="editMoney" :price="allPrice"></edit-discount>
</view>
@ -240,10 +240,9 @@
computed,
watch
} from 'vue';
import myButton from '@/components/my-components/my-button'
import modelDiscount from './components/discount'
import giveFood from './components/give-food'
import myRemark from './components/remark'
import oneRemark from './components/remark'
import editDiscount from '@/pagesCreateOrder/components/edit-discount.vue'
import go from '@/commons/utils/go.js';
import {
@ -273,10 +272,12 @@
}
function showModel(key, index) {
modelData.data =goods.list[index]
modelData.selIndex =index
modelData.data = goods.list[index]
modelData.selIndex = index
const model = models.get(key)
model && model.open({remark:modelData.data.note})
model && model.open({
remark: modelData.data.note||''
})
}
function formatPrice(n) {
@ -398,11 +399,11 @@
//
watch(() => table.value, (newval, oldval) => {
if (newval && oldval) {
Api.$choseTable({
orderId: 4462,
oldTableId: oldval.tableId,
newTableId: newval.tableId,
})
// Api.$choseTable({
// orderId: 4462,
// oldTableId: oldval.tableId,
// newTableId: newval.tableId,
// })
}
})
@ -510,9 +511,16 @@
})
} else {
//
uni.navigateBack({
delta: 2
})
if (option.isCreateOrderToDetail) {
go.to('PAGES_ORDER_DETAIL', {
id: res.id
})
} else {
uni.navigateBack({
delta: 2
})
}
// return go.to('PAGES_ORDER_DETAIL', {
// id: res.id
// })
@ -531,7 +539,7 @@
//
async function goodsOneRemarkConfirm(e) {
const cart=goods.list[modelData.selIndex]
const cart = goods.list[modelData.selIndex]
await Api.$updateCart({
cartId: cart.id,
productId: cart.productId,
@ -540,11 +548,16 @@
note: e.remark,
num: cart.number // 0
})
cart.note= e.remark
cart.note = e.remark
}
function init() {
async function init() {
await getTbShopInfo()
await getCart()
console.log($seatFee);
if (!$seatFee.totalNumber) {
updateChoseCount()
}
}
onLoad((opt) => {
@ -558,8 +571,7 @@
}
}
init()
getCart()
getTbShopInfo()
// updateChoseCount()
})

View File

@ -76,6 +76,9 @@
return []
}
},
isCreateOrderToDetail:{
type:Boolean,default:false
},
user:{
type: Object,
default: () => {
@ -123,7 +126,7 @@
const {tableId,name,maxCapacity,status,type}=props.table
go.to('PAGES_CONFIRM_ORDER',{
masterId:props.masterId,type,
tableId,name,maxCapacity,status
tableId,name,maxCapacity,status,isCreateOrderToDetail:props.isCreateOrderToDetail
})
}

View File

@ -97,7 +97,7 @@
</template>
<view class="bottom w-full">
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
:data="cars" @clear="onClearCart"></my-car>
</view>
@ -913,16 +913,29 @@
init()
})
onBeforeUnmount(() => {})
function watchUpdate() {
uni.$off('update:createOrderIndex')
uni.$on('update:createOrderIndex', (data) => {
console.log('update:createOrderIndex');
init()
})
}
onShow(() => {
// watchChooseuser()
watchChooseTable()
watchUpdate()
})
let isCreateOrderToDetail=ref(false)
onLoad((opt) => {
console.log(opt)
Object.assign(data.table, opt)
if(opt.useType){
uni.setStorageSync('useType',opt.useType)
}
if(JSON.stringify(opt)=='{}'){
isCreateOrderToDetail.value=true
}
// if (!opt.tableId) {
// infoBox.showErrorToast('')
// return setTimeout(() => {

View File

@ -122,6 +122,8 @@
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
uni.$emit('update:createOrderIndex')
console.log('update:createOrderIndex');
uni.navigateBack({
delta: 2
})