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