Commit 007c5c32 by songbingqi

完成部分开发

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