代客下单更新

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

View File

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

View File

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

View File

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

View File

@@ -97,7 +97,7 @@
</template> </template>
<view class="bottom w-full"> <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> :data="cars" @clear="onClearCart"></my-car>
</view> </view>
@@ -913,16 +913,29 @@
init() init()
}) })
onBeforeUnmount(() => {}) onBeforeUnmount(() => {})
function watchUpdate() {
uni.$off('update:createOrderIndex')
uni.$on('update:createOrderIndex', (data) => {
console.log('update:createOrderIndex');
init()
})
}
onShow(() => { onShow(() => {
// watchChooseuser() // watchChooseuser()
watchChooseTable() watchChooseTable()
watchUpdate()
}) })
let isCreateOrderToDetail=ref(false)
onLoad((opt) => { onLoad((opt) => {
console.log(opt) console.log(opt)
Object.assign(data.table, opt) Object.assign(data.table, opt)
if(opt.useType){ if(opt.useType){
uni.setStorageSync('useType',opt.useType) uni.setStorageSync('useType',opt.useType)
} }
if(JSON.stringify(opt)=='{}'){
isCreateOrderToDetail.value=true
}
// if (!opt.tableId) { // if (!opt.tableId) {
// infoBox.showErrorToast('暂不支持不选择桌台下载,请从桌台点餐') // infoBox.showErrorToast('暂不支持不选择桌台下载,请从桌台点餐')
// return setTimeout(() => { // return setTimeout(() => {

View File

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