parent
35d5dc3d32
commit
8361ec77ec
|
|
@ -145,10 +145,12 @@
|
|||
content
|
||||
} = await $table.get(query)
|
||||
tables.hasAjax = true
|
||||
content = content.filter(v => v.status == 'idle')
|
||||
content = content.filter(v =>{
|
||||
return v.status == 'idle'||(v.status=='using')
|
||||
})
|
||||
console.log(content );
|
||||
tables.list = content
|
||||
tables.selIndex = content.findIndex(v => v.tableId == option.tableId)
|
||||
console.log(tables.selIndex );
|
||||
tables.originList = content
|
||||
}
|
||||
async function getArea() {
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@
|
|||
<view class="search u-flex u-col-center ">
|
||||
<view class="u-flex-1">
|
||||
<uni-search-bar bgColor="#F9F9F9" cancelButton="none" placeholder="搜索店内商品" @confirm="search"
|
||||
@clear="clearSearch"
|
||||
v-model="searchValue">
|
||||
@clear="clearSearch" v-model="searchValue">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
|
|
@ -46,8 +45,8 @@
|
|||
</view>
|
||||
<template v-if="!isSearch">
|
||||
<view class="u-menu-wrap">
|
||||
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="data.scrollTop"
|
||||
:scroll-into-view="data.itemId">
|
||||
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
|
||||
:scroll-top="data.scrollTop" :scroll-into-view="data.itemId">
|
||||
<view v-for="(item,index) in data.tabbar" :key="index" class="u-tab-item"
|
||||
:class="[data.current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
|
||||
<text class="u-line-1">{{item.name}}</text>
|
||||
|
|
@ -58,7 +57,7 @@
|
|||
<view class="page-view u-p-l-24">
|
||||
<view class="list-tight-top">
|
||||
<template v-if="lingshi.show">
|
||||
<view id="lingshi" class="lingshi" @tap="toLinshi" >
|
||||
<view id="lingshi" class="lingshi" @tap="toLinshi">
|
||||
<uni-icons type="plus-filled" size="24" :color="color.ColorMain"></uni-icons>
|
||||
<view class="u-m-t-24 color-main">临时菜</view>
|
||||
</view>
|
||||
|
|
@ -67,7 +66,8 @@
|
|||
<view style="height: 24px;"></view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="class-item" :id="'item' + index" v-for="(item , index) in data.tabbar" :key="index">
|
||||
<view class="class-item" :id="'item' + index" v-for="(item , index) in data.tabbar"
|
||||
:key="index">
|
||||
<view class="item-title">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
<goods-item @chooseGuige="chooseGuige($event,index)"
|
||||
@add="goodsUpdate($event,index,true)" @reduce="goodsUpdate($event,index,false)"
|
||||
:index="goodsIndex" :data="goodsItem"></goods-item>
|
||||
|
||||
|
||||
</view>
|
||||
<!-- <template v-if="item.name==='附加费'">
|
||||
<view class="addCai" @tap="surchargeShow">
|
||||
|
|
@ -95,10 +95,10 @@
|
|||
11
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
<view class="bottom w-full">
|
||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
|
||||
:data="cars" @clear="onClearCart"></my-car>
|
||||
<my-car :isCreateOrderToDetail="isCreateOrderToDetail" @updateNumber="carsNumberChange" :user="data.vipUser"
|
||||
:masterId="data.masterId" :table="data.table" :data="cars" @clear="onClearCart"></my-car>
|
||||
</view>
|
||||
|
||||
<!-- 选择规格 -->
|
||||
|
|
@ -113,7 +113,9 @@
|
|||
<script setup>
|
||||
import _ from 'lodash';
|
||||
import * as Api from '@/http/yskApi/Instead.js'
|
||||
import {$table} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$table
|
||||
} from '@/http/yskApi/table.js'
|
||||
import {
|
||||
$tbShopCategory
|
||||
} from '@/http/yskApi/goods.js'
|
||||
|
|
@ -134,7 +136,8 @@
|
|||
computed,
|
||||
reactive,
|
||||
ref,
|
||||
nextTick,getCurrentInstance ,
|
||||
nextTick,
|
||||
getCurrentInstance,
|
||||
watch
|
||||
} from 'vue';
|
||||
import myCar from './components/car'
|
||||
|
|
@ -151,15 +154,15 @@
|
|||
} from '@/http/yskApi/user.js'
|
||||
const instance = getCurrentInstance();
|
||||
//临时菜
|
||||
const lingshi=reactive({
|
||||
show:false
|
||||
const lingshi = reactive({
|
||||
show: false
|
||||
})
|
||||
//附加费
|
||||
const extraFee=reactive({
|
||||
show:false
|
||||
const extraFee = reactive({
|
||||
show: false
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
const cars = reactive([])
|
||||
const data = reactive({
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
|
|
@ -185,21 +188,21 @@
|
|||
},
|
||||
|
||||
})
|
||||
|
||||
|
||||
// 获取账号信息
|
||||
let $shop=ref({})
|
||||
let $shop = ref({})
|
||||
async function getTbShopInfo() {
|
||||
const res = await tbShopInfo()
|
||||
$shop.value = res
|
||||
const useType=data.table.status=='using'?data.table.useType:$returnUseType(res)
|
||||
uni.setStorageSync('useType',useType)
|
||||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(res)
|
||||
uni.setStorageSync('useType', useType)
|
||||
console.log(res);
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function setTabBar(category, goods, cars) {
|
||||
const goodsCategoryMap = goods.reduce((prve, cur) => {
|
||||
|
|
@ -287,7 +290,7 @@
|
|||
}
|
||||
//加入购物车
|
||||
function addCart(par) {
|
||||
if(!data.table.tableId){
|
||||
if (!data.table.tableId) {
|
||||
return infoBox.showToast('请先选择桌台!')
|
||||
}
|
||||
const submitPar = {
|
||||
|
|
@ -353,18 +356,20 @@
|
|||
|
||||
|
||||
//获取桌台信息
|
||||
async function getTableInfo(){
|
||||
const res=await $table.get({qrcode:data.table.tableId})
|
||||
async function getTableInfo() {
|
||||
const res = await $table.get({
|
||||
qrcode: data.table.tableId
|
||||
})
|
||||
console.log(res);
|
||||
if(res&&res.content[0]){
|
||||
if (res && res.content[0]) {
|
||||
// data.table=res.content[0]
|
||||
}
|
||||
}
|
||||
async function init() {
|
||||
const shopInfo = await tbShopInfo()
|
||||
$shop.value = shopInfo
|
||||
const useType=data.table.status=='using'?data.table.useType:$returnUseType(shopInfo)
|
||||
uni.setStorageSync('useType',useType)
|
||||
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
|
||||
uni.setStorageSync('useType', useType)
|
||||
console.log(shopInfo);
|
||||
getTableInfo()
|
||||
const categoryRes = await getCategory()
|
||||
|
|
@ -384,10 +389,10 @@
|
|||
}
|
||||
return isShow;
|
||||
});
|
||||
if(!data.table.tableId){
|
||||
if (!data.table.tableId) {
|
||||
//无桌台
|
||||
setTabBar(category, goods, [])
|
||||
return
|
||||
return
|
||||
}
|
||||
const {
|
||||
masterId
|
||||
|
|
@ -423,16 +428,18 @@
|
|||
|
||||
|
||||
let searchValue = ref('')
|
||||
let isSearch=ref(false)
|
||||
let isSearch = ref(false)
|
||||
|
||||
function search() {
|
||||
// isSearch.value=true
|
||||
console.log(searchValue.value);
|
||||
console.log(data.tabbar );
|
||||
console.log(data.tabbar);
|
||||
}
|
||||
function clearSearch(){
|
||||
|
||||
function clearSearch() {
|
||||
// isSearch.value=false
|
||||
}
|
||||
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
|
|
@ -608,7 +615,7 @@
|
|||
}
|
||||
|
||||
function chooseGuige(foodsindex, index) {
|
||||
if(!canAddGoods()){
|
||||
if (!canAddGoods()) {
|
||||
return infoBox.showToast('清先选择桌台')
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
|
|
@ -707,12 +714,12 @@
|
|||
carGoods
|
||||
} : false
|
||||
}
|
||||
|
||||
function canAddGoods(){
|
||||
|
||||
function canAddGoods() {
|
||||
return data.table.tableId
|
||||
}
|
||||
async function goodsUpdate(foodsindex, index, isAdd) {
|
||||
if(!canAddGoods()){
|
||||
if (!canAddGoods()) {
|
||||
return infoBox.showToast('清先选择桌台')
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
|
|
@ -765,10 +772,10 @@
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
onReady(() => {
|
||||
getElRect('list-tight-top').then(res=>{
|
||||
data.topZhanwei=res.height
|
||||
getElRect('list-tight-top').then(res => {
|
||||
data.topZhanwei = res.height
|
||||
})
|
||||
getMenuItemTop()
|
||||
})
|
||||
|
|
@ -803,7 +810,7 @@
|
|||
return;
|
||||
}
|
||||
console.log(res);
|
||||
if(dataVal){
|
||||
if (dataVal) {
|
||||
data[dataVal] = res.height;
|
||||
}
|
||||
resolve(res);
|
||||
|
|
@ -910,15 +917,19 @@
|
|||
setUser()
|
||||
})
|
||||
}
|
||||
watch(()=>data.table.tableId,(newval)=>{
|
||||
watch(() => data.table.tableId, (newval) => {
|
||||
console.log(newval);
|
||||
init()
|
||||
})
|
||||
onBeforeUnmount(() => {})
|
||||
|
||||
|
||||
function watchUpdate() {
|
||||
uni.$off('update:createOrderIndex')
|
||||
uni.$on('update:createOrderIndex', (data) => {
|
||||
uni.$on('update:createOrderIndex', () => {
|
||||
data.table = {
|
||||
tableId: ""
|
||||
}
|
||||
cars.length = 0
|
||||
console.log('update:createOrderIndex');
|
||||
init()
|
||||
})
|
||||
|
|
@ -928,15 +939,15 @@
|
|||
watchChooseTable()
|
||||
watchUpdate()
|
||||
})
|
||||
let isCreateOrderToDetail=ref(false)
|
||||
let isCreateOrderToDetail = ref(false)
|
||||
onLoad((opt) => {
|
||||
console.log(opt)
|
||||
Object.assign(data.table, opt)
|
||||
if(opt.useType){
|
||||
uni.setStorageSync('useType',opt.useType)
|
||||
if (opt.useType) {
|
||||
uni.setStorageSync('useType', opt.useType)
|
||||
}
|
||||
if(JSON.stringify(opt)=='{}'){
|
||||
isCreateOrderToDetail.value=true
|
||||
if (JSON.stringify(opt) == '{}') {
|
||||
isCreateOrderToDetail.value = true
|
||||
}
|
||||
// if (!opt.tableId) {
|
||||
// infoBox.showErrorToast('暂不支持不选择桌台下载,请从桌台点餐')
|
||||
|
|
|
|||
Loading…
Reference in New Issue