Commit 9ac07820 by weijiguang
parents f234919c 12a5ac2b
<template> <template>
<div> <div>
<u-popup :show="show" :round="10" mode="bottom" @close="close" :safeAreaInsetBottom="false" zIndex="10078" > <u-popup :show="show" :round="10" mode="bottom" @close="close" :safeAreaInsetBottom="false" zIndex="10078" >
<view class="bigBox" :style="{'height':'94vh'}"> <view class="bigBox" :style="{'height':'94vh'}" @touchstart="start" @touchend="end" ref="op">
<div class="order_flow" > <div class="order_flow" >
<div class="code">取单码 {{ orderInfo.orderNum }}</div> <div class="code">取单码 {{ orderInfo.orderNum }}</div>
<!-- <image mode="scaleToFill" :src="qrCode" class="qr_code"></image> --> <!-- <image mode="scaleToFill" :src="qrCode" class="qr_code"></image> -->
...@@ -40,6 +40,9 @@ export default { ...@@ -40,6 +40,9 @@ export default {
orderInfo: {}, orderInfo: {},
qrCode: '', qrCode: '',
show: false, show: false,
clientYStart:0,
clientYEnd:0,
bigBox:{}
} }
}, },
computed: { computed: {
...@@ -78,6 +81,16 @@ export default { ...@@ -78,6 +81,16 @@ export default {
}, },
methods: { methods: {
start(e) {
this.clientYStart = e.changedTouches[0].clientY
},
end(e) {
this.clientYEnd = e.changedTouches[0].clientY;
const val = parseInt((this.clientYStart-this.clientYEnd))
if(val<-500){
this.close()
}
},
close() { close() {
this.show = false; this.show = false;
}, },
......
...@@ -56,7 +56,6 @@ export default { ...@@ -56,7 +56,6 @@ export default {
'--scroll-height': 0 '--scroll-height': 0
}, },
Utils, Utils,
classifyData: [],
categoryId: '', categoryId: '',
categoryPostion: [], categoryPostion: [],
scrollLeftTop: 0, scrollLeftTop: 0,
...@@ -79,6 +78,30 @@ export default { ...@@ -79,6 +78,30 @@ export default {
} }
} }
}, },
computed:{
classifyData(){
const categorys = JSON.parse(JSON.stringify(this.$store.state.menu.setMenuCategorys))
// 删除没有商品的分类
if(categorys) {
for(var i=categorys.length-1; i>=0; i--) {
var category = categorys[i];
if(!category.goods || category.goods.length<=0) {
categorys.splice(i, 1);
}
}
if(categorys.length>0){
this.categoryId = categorys[0].id;
}
}
this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this);
query.selectAll('.box').boundingClientRect(data => {
this.categoryPostion = data
}).exec();
})
return categorys
}
},
created() { created() {
$EventBus.$off('updateCar'); $EventBus.$off('updateCar');
}, },
...@@ -105,27 +128,27 @@ export default { ...@@ -105,27 +128,27 @@ export default {
return sku; return sku;
}, },
createList(data) { createList(data) {
this.classifyData = data; // this.classifyData = data;
console.log(this.classifyData); // console.log(this.classifyData);
// 删除没有商品的分类 // // 删除没有商品的分类
if(this.classifyData) { // if(this.classifyData) {
for(var i=this.classifyData.length-1; i>=0; i--) { // for(var i=this.classifyData.length-1; i>=0; i--) {
var category = this.classifyData[i]; // var category = this.classifyData[i];
if(!category.goods || category.goods.length<=0) { // if(!category.goods || category.goods.length<=0) {
this.classifyData.splice(i, 1); // this.classifyData.splice(i, 1);
} // }
} // }
if(this.classifyData.length>0){ // if(this.classifyData.length>0){
this.categoryId = this.classifyData[0].id; // this.categoryId = this.classifyData[0].id;
} // }
} // }
this.$nextTick(() => { // this.$nextTick(() => {
const query = uni.createSelectorQuery().in(this); // const query = uni.createSelectorQuery().in(this);
query.selectAll('.box').boundingClientRect(data => { // query.selectAll('.box').boundingClientRect(data => {
this.categoryPostion = data // this.categoryPostion = data
}).exec(); // }).exec();
}) // })
}, },
getallNum(item, category) { getallNum(item, category) {
this.$emit('getallNum', item, category) this.$emit('getallNum', item, category)
...@@ -386,7 +409,8 @@ export default { ...@@ -386,7 +409,8 @@ export default {
} }
.box:last-child{ .box:last-child{
padding-bottom: 590rpx; padding-bottom: 255rpx;
// height: 100%;
} }
.nav-right-item image { .nav-right-item image {
......
...@@ -84,6 +84,7 @@ ...@@ -84,6 +84,7 @@
import Utils from '@/utils/utils' import Utils from '@/utils/utils'
import User from '@/request/user'; import User from '@/request/user';
import Order from '@/request/order' import Order from '@/request/order'
import Menu from '@/request/menu'
export default { export default {
data() { data() {
return { return {
...@@ -298,13 +299,14 @@ export default { ...@@ -298,13 +299,14 @@ export default {
if(state == 2){ if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' }); this.showToast({ title: '本商品已经售罄', icon: 'none' });
this.getMenuList()
return; return;
}else{ }else{
goods.num = this.size; goods.num = this.size;
Utils.getallNum(goods) Utils.getallNum(goods)
uni.switchTab({ url: '/pages/menu/menu' }) uni.switchTab({ url: '/pages/menu/menu' })
} }
return // return
// const { data } = await Order.checkSku({skuId:goods.skuId}) // const { data } = await Order.checkSku({skuId:goods.skuId})
// else{ // else{
// goods.num = this.size; // goods.num = this.size;
...@@ -332,6 +334,7 @@ export default { ...@@ -332,6 +334,7 @@ export default {
if(state == 2){ if(state == 2){
this.showToast({ title: '本商品已经售罄', icon: 'none' }); this.showToast({ title: '本商品已经售罄', icon: 'none' });
this.getMenuList()
return; return;
}else{ }else{
goods.num = this.size goods.num = this.size
...@@ -339,6 +342,18 @@ export default { ...@@ -339,6 +342,18 @@ export default {
uni.navigateTo({ url: `/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1` }) uni.navigateTo({ url: `/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1` })
} }
}, },
async getMenuList() {
const shopId = uni.getStorageSync('shopData').id
let { data } = await Menu.getMenuList(shopId);
// console.log("menus:"+JSON.stringify(data));
if (data.code == 200) {
data.data = data.data;
this.$store.commit('setMenuAllInfo', data.data);
this.$store.commit('setMenuCategorys', data.data.categorys);
uni.setStorageSync('countOfOrder', parseInt(data.data.countOfOrder));
// this.$refs.MenuAssembly.createList(data.data.categorys)
}
},
// 付款前未登录发起授权 // 付款前未登录发起授权
loginByPhoneNumber(e) { loginByPhoneNumber(e) {
if (e.detail.errMsg == 'getPhoneNumber:ok') { if (e.detail.errMsg == 'getPhoneNumber:ok') {
......
...@@ -259,8 +259,9 @@ export default { ...@@ -259,8 +259,9 @@ export default {
if (data.code == 200) { if (data.code == 200) {
data.data = data.data; data.data = data.data;
this.$store.commit('setMenuAllInfo', data.data); this.$store.commit('setMenuAllInfo', data.data);
this.$store.commit('setMenuCategorys', data.data.categorys);
uni.setStorageSync('countOfOrder', parseInt(data.data.countOfOrder)); uni.setStorageSync('countOfOrder', parseInt(data.data.countOfOrder));
this.$refs.MenuAssembly.createList(data.data.categorys) // this.$refs.MenuAssembly.createList(data.data.categorys)
} }
}, },
// 加入购物车数据 // 加入购物车数据
......
...@@ -3,6 +3,7 @@ const menu = { ...@@ -3,6 +3,7 @@ const menu = {
state: { state: {
menuAllInfo: null, //菜单信息 menuAllInfo: null, //菜单信息
orderPrePayInfo: null, //(需要和购物车数据格式一致) orderPrePayInfo: null, //(需要和购物车数据格式一致)
setMenuCategorys:[]
}, },
mutations: { mutations: {
// 设置用户菜单信息 // 设置用户菜单信息
...@@ -13,6 +14,10 @@ const menu = { ...@@ -13,6 +14,10 @@ const menu = {
saveOrderPrePayInfo(state, orderPrePayInfo) { saveOrderPrePayInfo(state, orderPrePayInfo) {
state.orderPrePayInfo = orderPrePayInfo; state.orderPrePayInfo = orderPrePayInfo;
}, },
// 设置首页商品信息
setMenuCategorys(state, setMenuCategorys){
state.setMenuCategorys = setMenuCategorys
}
}, },
actions: { actions: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment