代客下单更新
This commit is contained in:
@@ -35,6 +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">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
@@ -43,43 +44,58 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<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">
|
||||
<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>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view :scroll-top="data.scrollRightTop" scroll-y scroll-with-animation class="right-box"
|
||||
@scroll="rightScroll">
|
||||
<view class="page-view u-p-l-24">
|
||||
<view 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>
|
||||
<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">
|
||||
<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>
|
||||
</view>
|
||||
<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>
|
||||
<view class="item-container">
|
||||
<view class="thumb-box" v-for="(goodsItem, goodsIndex) in item.foods" :key="goodsIndex">
|
||||
<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">
|
||||
</scroll-view>
|
||||
<scroll-view :scroll-top="data.scrollRightTop" scroll-y scroll-with-animation class="right-box"
|
||||
@scroll="rightScroll">
|
||||
<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" >
|
||||
<uni-icons type="plus-filled" size="24" :color="color.ColorMain"></uni-icons>
|
||||
<view class="u-m-t-24 color-main">自定义添加</view>
|
||||
<view class="u-m-t-24 color-main">临时菜</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<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="item-title">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
<view class="item-container">
|
||||
<view class="thumb-box" v-for="(goodsItem, goodsIndex) in item.foods" :key="goodsIndex">
|
||||
<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">
|
||||
<uni-icons type="plus-filled" size="24" :color="color.ColorMain"></uni-icons>
|
||||
<view class="u-m-t-24 color-main">自定义添加</view>
|
||||
</view>
|
||||
</template> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="u-menu-wrap">
|
||||
11
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<view class="bottom w-full">
|
||||
<my-car @updateNumber="carsNumberChange" :user="data.vipUser" :masterId="data.masterId" :table="data.table"
|
||||
:data="cars" @clear="onClearCart"></my-car>
|
||||
@@ -102,7 +118,6 @@
|
||||
$tbShopCategory
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import util from './util.js';
|
||||
import classifyData from './classify.data.js';
|
||||
import color from '@/commons/color.js';
|
||||
import guigeModel from './components/guige'
|
||||
import goodsItem from './components/goods-item'
|
||||
@@ -134,6 +149,17 @@
|
||||
import {
|
||||
tbShopInfo
|
||||
} from '@/http/yskApi/user.js'
|
||||
|
||||
//临时菜
|
||||
const lingshi=reactive({
|
||||
show:false
|
||||
})
|
||||
//附加费
|
||||
const extraFee=reactive({
|
||||
show:false
|
||||
})
|
||||
|
||||
|
||||
const cars = reactive([])
|
||||
const data = reactive({
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
@@ -172,7 +198,8 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function setTabBar(category, goods, cars) {
|
||||
const goodsCategoryMap = goods.reduce((prve, cur) => {
|
||||
@@ -203,22 +230,17 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
tabbar.push({
|
||||
name: '附加费',
|
||||
foods: [{
|
||||
name: "小费",
|
||||
price: Math.ceil(Math.random() * 10),
|
||||
chooseNumber: 0,
|
||||
isDan: true
|
||||
},
|
||||
{
|
||||
name: "打包费",
|
||||
price: 1,
|
||||
chooseNumber: 0,
|
||||
isDan: true
|
||||
}
|
||||
]
|
||||
})
|
||||
// tabbar.push({
|
||||
// name: '附加费',
|
||||
// foods: [{
|
||||
// name: "餐位费",
|
||||
// price:$shop.value.tableFee,
|
||||
// chooseNumber: 0,
|
||||
// isSeatFee:true,
|
||||
// isDan: true
|
||||
// }
|
||||
// ]
|
||||
// })
|
||||
tabbar = tabbar.filter(v => {
|
||||
return v.foods.length
|
||||
})
|
||||
@@ -339,7 +361,11 @@
|
||||
}
|
||||
}
|
||||
async function init() {
|
||||
getTbShopInfo()
|
||||
const shopInfo = await tbShopInfo()
|
||||
$shop.value = shopInfo
|
||||
const useType=data.table.status=='using'?data.table.useType:$returnUseType(shopInfo)
|
||||
uni.setStorageSync('useType',useType)
|
||||
console.log(shopInfo);
|
||||
getTableInfo()
|
||||
const categoryRes = await getCategory()
|
||||
const category = categoryRes.content.reduce((prve, cur) => {
|
||||
@@ -397,12 +423,16 @@
|
||||
|
||||
|
||||
let searchValue = ref('')
|
||||
|
||||
let isSearch=ref(false)
|
||||
function search() {
|
||||
// isSearch.value=true
|
||||
console.log(searchValue.value);
|
||||
console.log(data.tabbar );
|
||||
}
|
||||
|
||||
function clearSearch(){
|
||||
// isSearch.value=false
|
||||
}
|
||||
|
||||
function chooseUser() {
|
||||
go.to('PAGES_CHOOSE_USER')
|
||||
}
|
||||
@@ -673,8 +703,14 @@
|
||||
carGoods
|
||||
} : false
|
||||
}
|
||||
|
||||
|
||||
function canAddGoods(){
|
||||
return data.table.tableId
|
||||
}
|
||||
async function goodsUpdate(foodsindex, index, isAdd) {
|
||||
if(!canAddGoods()){
|
||||
return infoBox.showToast('清先选择台桌')
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
if ($goods.isDan) {
|
||||
//单规格
|
||||
@@ -724,8 +760,11 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
onReady(() => {
|
||||
getElRect('list-tight-top').then(res=>{
|
||||
data.topZhanwei=res.height
|
||||
})
|
||||
getMenuItemTop()
|
||||
})
|
||||
|
||||
@@ -746,7 +785,7 @@
|
||||
}
|
||||
// 获取一个目标元素的高度
|
||||
function getElRect(elClass, dataVal) {
|
||||
new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('.' + elClass).fields({
|
||||
size: true
|
||||
@@ -758,8 +797,11 @@
|
||||
}, 10);
|
||||
return;
|
||||
}
|
||||
data[dataVal] = res.height;
|
||||
resolve();
|
||||
console.log(res);
|
||||
if(dataVal){
|
||||
data[dataVal] = res.height;
|
||||
}
|
||||
resolve(res);
|
||||
}).exec();
|
||||
})
|
||||
}
|
||||
@@ -1014,7 +1056,6 @@
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.right-box {
|
||||
|
||||
Reference in New Issue
Block a user