代客下单增加无台桌下单
This commit is contained in:
parent
1de0a53abe
commit
5fa402dca2
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
<view class="list ">
|
||||
<view class=" bg-fff box bg-fff">
|
||||
<template v-if="tables.list.length">
|
||||
<view class="u-flex item u-row-between" v-for="(item,index) in tables.list" :key="index"
|
||||
@tap="chooseTable(index,item)">
|
||||
<view class="u-flex">
|
||||
|
|
@ -45,6 +46,11 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<my-pagination :page="query.page" :totalElements="query.totalElements" :size="query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
</template>
|
||||
|
||||
|
||||
<template v-if="tables.list.length<=0">
|
||||
<my-img-empty tips="未找到相关的桌台"></my-img-empty>
|
||||
</template>
|
||||
|
|
@ -95,9 +101,12 @@
|
|||
}, 100)
|
||||
}
|
||||
let searchValue = ref('')
|
||||
function search(){
|
||||
|
||||
function search() {
|
||||
query.page=1
|
||||
getTable()
|
||||
}
|
||||
|
||||
function chooseTable(index, item) {
|
||||
if (item.status == 'closed') {
|
||||
return uni.showToast({
|
||||
|
|
@ -128,11 +137,20 @@
|
|||
function areaChange(e) {
|
||||
area.defaultCateIndex = e.detail.value
|
||||
area.sel = area.list[e.detail.value]
|
||||
query.page=1
|
||||
getTable()
|
||||
}
|
||||
const query = {
|
||||
page: 0,
|
||||
size: 100,
|
||||
areaId: 0
|
||||
page: 1,
|
||||
size: 10,
|
||||
areaId: 0,
|
||||
totalElements:0
|
||||
}
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
console.log(page);
|
||||
query.page = page
|
||||
getTable()
|
||||
}
|
||||
const tables = reactive({
|
||||
hasAjax: false,
|
||||
|
|
@ -141,14 +159,14 @@
|
|||
list: []
|
||||
})
|
||||
async function getTable() {
|
||||
// let state=status.list[status.active].key
|
||||
// state=state?(state=='all'?'':state):''
|
||||
const areaId=area.list[area.defaultCateIndex].id
|
||||
let {
|
||||
content
|
||||
} = await $table.get(query)
|
||||
tables.hasAjax = true
|
||||
content = content.filter(v =>{
|
||||
// return v.status == 'idle'||(v.status=='using')
|
||||
return v.status == 'idle'
|
||||
})
|
||||
content,total
|
||||
} = await $table.get({...query,areaId,name:searchValue.value,state:'idle'})
|
||||
query.totalElements=total||0;
|
||||
tables.hasAjax = true;
|
||||
console.log(content);
|
||||
tables.list = content
|
||||
tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
|
||||
|
|
@ -172,11 +190,7 @@
|
|||
}
|
||||
|
||||
watch(() => area.sel, (newval) => {
|
||||
if(!newval){
|
||||
tables.list = tables.originList
|
||||
return
|
||||
}
|
||||
tables.list = tables.originList.filter(v => v.areaId == newval.id)
|
||||
getTable()
|
||||
})
|
||||
let option = {}
|
||||
onLoad(opt => {
|
||||
|
|
@ -202,6 +216,7 @@
|
|||
background: #FFFFFF;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
|
||||
&.active {
|
||||
background-color: $my-main-color;
|
||||
border-color: $my-main-color;
|
||||
|
|
@ -225,11 +240,14 @@
|
|||
.scale7 {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
::v-deep .uni-searchbar {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.search {
|
||||
padding: 20rpx 28rpx 20rpx 28rpx;
|
||||
|
||||
.icon-saoma {
|
||||
margin-left: 20rpx;
|
||||
width: 34rpx;
|
||||
|
|
@ -239,6 +257,7 @@
|
|||
|
||||
.list {
|
||||
padding: 32rpx 24rpx;
|
||||
|
||||
.no-choose {
|
||||
padding: 36rpx 30rpx 36rpx 24rpx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="page-gray color-333 u-font-28">
|
||||
<template v-if="true">
|
||||
<view class="block u-p-t-32 u-p-b-32">
|
||||
<view class="block u-p-t-32 u-p-b-32" v-if="table&&table.tableId">
|
||||
<view>桌位号</view>
|
||||
<view class="font-bold u-font-32 u-m-t-16">
|
||||
{{table.name||''}}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,9 @@
|
|||
|
||||
|
||||
</view>
|
||||
<up-modal title="提示" content="是否清空全部已添加的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay @confirm="confirmModelConfirm"
|
||||
@cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)" width="300px"></up-modal>
|
||||
<up-modal title="提示" content="是否清空全部已添加的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay
|
||||
@confirm="confirmModelConfirm" @cancel="setModalShow('clear',false)" @close="setModalShow('clear',false)"
|
||||
width="300px"></up-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -163,6 +164,13 @@
|
|||
status,
|
||||
type
|
||||
} = props.table
|
||||
if (props.table.tableId == '') {
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
masterId: props.masterId,
|
||||
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0
|
||||
})
|
||||
return
|
||||
}
|
||||
go.to('PAGES_CONFIRM_ORDER', {
|
||||
masterId: props.masterId,
|
||||
type,
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
toRefs,
|
||||
watch
|
||||
} from 'vue';
|
||||
import util from '../util.js';
|
||||
const props = defineProps({
|
||||
img:{
|
||||
type:Object,
|
||||
|
|
@ -99,7 +100,7 @@
|
|||
}
|
||||
return (
|
||||
item.isPauseSale ||
|
||||
(item.typeEnum !== "sku" && item.specList[0].stockNumber <= 0)
|
||||
(item.typeEnum !== "sku" && item.isStock==1&& item.stockNumber <= 0)
|
||||
);
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@
|
|||
<list-goods-item :img="{width:'330rpx',height:'330rpx'}"
|
||||
@chooseGuige="chooseGuige(goodsItem.goodsIndex,goodsItem.index)"
|
||||
@add="searchGoodsUpdate(goodsItem,goodsIndex,true)"
|
||||
@reduce="searchGoodsUpdate(goodsItem,goodsIndex,false)" :index="goodsItem.goodsIndex"
|
||||
:data="goodsItem"></list-goods-item>
|
||||
@reduce="searchGoodsUpdate(goodsItem,goodsIndex,false)"
|
||||
:index="goodsItem.goodsIndex" :data="goodsItem"></list-goods-item>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -122,20 +122,27 @@
|
|||
</view>
|
||||
|
||||
<!-- 选择规格 -->
|
||||
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel"
|
||||
:goodsData="selGoods"
|
||||
<guige-model @update-sku="updateSkuSel" @confirm="guigeConfirm" ref="chooseGuigeModel" :goodsData="selGoods"
|
||||
:title="guigeModelData.title" :sku-map="guigeModelData.chooseGoods.skuMap"
|
||||
:skus="guigeModelData.chooseGoods.skus"></guige-model>
|
||||
<!-- 添加附加费 -->
|
||||
<my-surcharge @confirm="surchargeConfirm" ref="surcharge" title="添加附加费"></my-surcharge>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<up-modal title="提示" content="该台桌购物车里有商品,是否清除该台桌里的商品?" :show="modal.clear" showCancelButton closeOnClickOverlay
|
||||
@confirm="confirmModelConfirm" @cancel="confirmModelConfirm('cancel')" @close="setModalShow('clear',false)"
|
||||
width="300px">
|
||||
|
||||
</up-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import _ from 'lodash';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {
|
||||
$table
|
||||
$table,
|
||||
$choseTable,
|
||||
$returnTableDetail
|
||||
} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$tbShopCategory
|
||||
|
|
@ -158,7 +165,8 @@
|
|||
reactive,
|
||||
ref,
|
||||
nextTick,
|
||||
watch,getCurrentInstance
|
||||
watch,
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
import myCar from './components/car'
|
||||
import go from '@/commons/utils/go.js';
|
||||
|
|
@ -173,7 +181,41 @@
|
|||
import {
|
||||
tbShopInfo
|
||||
} from '@/http/yskApi/user.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
|
||||
|
||||
const modal = reactive({
|
||||
key: '',
|
||||
clear: false,
|
||||
data: ''
|
||||
})
|
||||
|
||||
async function confirmModelConfirm(isCancel = false) {
|
||||
if (modal.key == 'clear') {
|
||||
try {
|
||||
await $choseTable({
|
||||
masterId: data.masterId,
|
||||
tableId: modal.data.tableId,
|
||||
isClear: !isCancel ? true : false,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
//TODO handle the exception
|
||||
}
|
||||
data.table = modal.data;
|
||||
setModalShow('clear', false, '')
|
||||
}
|
||||
}
|
||||
|
||||
function setModalShow(key = 'show', show = true, data) {
|
||||
modal.key = key
|
||||
modal[key] = show
|
||||
modal.data = data
|
||||
}
|
||||
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
let canXiadan = ref(false)
|
||||
async function xiadanClick() {
|
||||
|
|
@ -533,8 +575,27 @@
|
|||
|
||||
function watchChooseTable() {
|
||||
uni.$off('choose-table')
|
||||
uni.$on('choose-table', (tableData) => {
|
||||
data.table = tableData
|
||||
uni.$on('choose-table', async (item) => {
|
||||
if (data.table.tableId || cars.length <= 0) {
|
||||
data.table = item
|
||||
return;
|
||||
}
|
||||
if (item.status != "idle") {
|
||||
return infoBox.showToast('该台桌已在使用中')
|
||||
}
|
||||
const res = await $returnTableDetail({
|
||||
tableId: item.tableId,
|
||||
});
|
||||
if (res.cartCount > 0) {
|
||||
setModalShow('clear', true, item)
|
||||
} else {
|
||||
await $choseTable({
|
||||
masterId: data.masterId,
|
||||
tableId: item.tableId,
|
||||
isClear:false
|
||||
});
|
||||
data.table = item
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -697,6 +758,7 @@
|
|||
|
||||
|
||||
let selGoods = ref({})
|
||||
|
||||
function chooseGuige(foodsindex, index) {
|
||||
if (!canAddGoods()) {
|
||||
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
|
||||
|
|
@ -811,6 +873,7 @@
|
|||
function searchGoodsUpdate(goodsItem, goodsIndex, isAdd) {
|
||||
goodsUpdate(goodsItem.goodsIndex, goodsItem.index, isAdd, goodsIndex)
|
||||
}
|
||||
|
||||
function setSearchGoods(index, chooseNumber) {
|
||||
if (index !== undefined) {
|
||||
searchResult.value[index].chooseNumber = chooseNumber
|
||||
|
|
@ -1230,10 +1293,12 @@
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::v-deep .uni-searchbar {
|
||||
padding-top: 12px !important;
|
||||
padding-bottom: 16px !important;
|
||||
}
|
||||
|
||||
.right-box {
|
||||
width: 572rpx;
|
||||
// background-color: rgb(250, 250, 250);
|
||||
|
|
@ -1257,6 +1322,7 @@
|
|||
.item-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
|
||||
&.active {
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue