Commit 007c5c32 by songbingqi

完成部分开发

parent 170cd1d0
......@@ -33,7 +33,6 @@
<u-icon name="close-circle" color="#666666" size="28" :top="-3"></u-icon>
</div>
<div class="code">取单码 {{ orderInfo.orderNum }}</div>
<!-- <image mode="scaleToFill" :src="qrCode" class="qr_code"></image> -->
<div class="qr_code_readly">
<image mode="scaleToFill" :src="orderInfo.pickCode" class="qr"></image>
</div>
......@@ -84,7 +83,6 @@ export default {
return {
orderInfo: {},
shopInfo:{},
qrCode: '',
show: false,
clientYStart:0,
clientYEnd:0,
......@@ -96,6 +94,16 @@ export default {
timer: ''
}
},
watch:{
'show':{
handler(val) {
console.log(val,'wywy')
if(!val) {
this.cleanTimeout()
}
}
}
},
computed: {
// 0 创建未校验
// 1 未支付
......@@ -131,6 +139,9 @@ export default {
return this.$store.getters.Authorization;
},
},
onShow() {
console.log('onShow')
},
async mounted() {
// console.log(123,this.shopInfo)
// if (!this.userms) return;
......@@ -147,8 +158,7 @@ export default {
// }
},
methods: {
async getOrderInfo(shopInfo) {
console.log(1)
async getOrderInfo(shopInfo, timerout = true) {
if(shopInfo)this.shopInfo = shopInfo
if (!this.userms) return;
const res = await Order.getHomeOrder({ shopId: this.shopInfo.id });
......@@ -157,10 +167,12 @@ export default {
// this.$set(data.data, 'state', '2');
// console.log("getHomeOrder:"+JSON.stringify(data.data));
this.buied = true;
this.timer = setTimeout(() => {
this.getOrderInfo()
clearTimeout(this.timer)
}, 5000);
if(timerout) {
this.timer = setTimeout(() => {
this.getOrderInfo()
clearTimeout(this.timer)
}, 2000);
}
this.orderInfo ={...data.data};
} else {
clearTimeout(this.timer)
......@@ -202,14 +214,7 @@ export default {
open(data, path) {
this.popupStyle.transform = 'translateY(0px)'
this.show = true;
// this.orderInfo = data;
// console.log("order:"+JSON.stringify(this.orderInfo));
// if(this.showMask) {
// this.qrCode = '';
// } else {
this.qrCode = path;
// }
this.getOrderInfo()
},
jsonParse(json) {
return JSON.parse(json)
......
<template>
<view class="menu-box">
<view class="menu-banner" :style="{ height: buied ? '360rpx' : '450rpx' }">
<!-- <image :src="img"/> -->
<u-swiper
v-if="swiperList.length!=0"
:list="swiperList"
:interval="5000"
circular
:height="200"
></u-swiper>
<ImageLoader
v-else
:defaultSrc="'../../static/imgs/shouyezhanweitu.png'"
:realSrc="img"
width="100%"
......@@ -151,6 +160,11 @@ export default {
img: "",
isInRange: true,
dayTitle: "",
list1: [
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png',
]
};
},
computed: {
......@@ -193,6 +207,9 @@ export default {
userInfo() {
return this.$store.state.user.userInfo;
},
swiperList() {
return this.$store.state.menu.swiperList.home;
}
},
created() {
let platform = uni.getSystemInfoSync().platform;
......@@ -244,7 +261,7 @@ export default {
this.getShopMenus(params);
});
} else {
// this.getShopMenus();
this.getShopMenus();
this.authLocation();
}
},
......@@ -307,6 +324,7 @@ export default {
uni.setStorageSync("shopInfo", JSON.stringify(this.shopInfo));
this.getMenuList(data.id);
this.getHomeOrder(data.id);
this.getBanerList(data.id)
// 判断店铺是否在范围内
const shopInfo = uni.getStorageSync("shopInfo");
const { distanceLimit, realDistance } = JSON.parse(shopInfo);
......@@ -325,6 +343,21 @@ export default {
});
User.getShopInfo(params);
},
async getBanerList(id = this.shopInfo.id) {
const {data = {}} = await Menu.getSwiperList({ id });
const sendData = {
home:[ 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png', ],
mine:[ 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png', ],
}
if(data.code===200) {
this.$store.commit("setSwiperList", sendData);
}
console.log(data)
},
async getHomeOrder(id = this.shopInfo.id) {
if (!this.userms) return;
const res = await Order.getHomeOrder({ shopId: id });
......@@ -335,7 +368,7 @@ export default {
this.buied = true;
this.orderInfo = data.data;
this.$nextTick(()=>{
this.$refs.OrderQrCode.getOrderInfo(this.shopInfo);
this.$refs.OrderQrCode.getOrderInfo(this.shopInfo,false);
})
} else {
this.buied = false;
......
......@@ -80,6 +80,17 @@
</view>
</view>
</view>
<view class="swiper">
<u-swiper
v-if="swiperList.length!=0"
:list="swiperList"
:interval="5000"
circular
:height="100"
></u-swiper>
</view>
<view
class="contents"
v-if="!userms"
......@@ -224,6 +235,9 @@ export default {
userInfo() {
return this.$store.state.user.userInfo;
},
swiperList() {
return this.$store.state.menu.swiperList.mine;
}
},
methods: {
getShareData(type) {
......@@ -424,7 +438,10 @@ button::after {
.mod11::after {
border-radius: 0rpx;
}
.swiper {
margin: 15rpx 32rpx 24rpx 32rpx;
}
.contents {
display: flex;
padding: 52rpx 64rpx 52rpx 70rpx;
......
......@@ -146,4 +146,17 @@ export default {
return err;
});
},
// 获取轮播图
getSwiperList(data) {
return uni.$u.http
.get(`/system/banner/getShopBanners?shopId=${data.id}`,{
params: {},
custom: { noLoading:true },
})
.then((res) => res)
.catch((err) => {
// uni.showToast({ title: '哎哟!刚刚走神了,请退出后重进', icon: 'none' })
console.log("哎哟!刚刚走神了,请退出后重进");
});
}
};
......@@ -3,7 +3,11 @@ const menu = {
state: {
menuAllInfo: null, //菜单信息
orderPrePayInfo: null, //(需要和购物车数据格式一致)
setMenuCategorys:[]
setMenuCategorys:[],
swiperList:{
home:[],
mine:[]
}
},
mutations: {
// 设置用户菜单信息
......@@ -17,6 +21,10 @@ const menu = {
// 设置首页商品信息
setMenuCategorys(state, setMenuCategorys){
state.setMenuCategorys = setMenuCategorys
},
// 存储轮播图
setSwiperList(state,val) {
state.swiperList = val
}
},
......
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