You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/pages/goods/store-list/store-details.vue

315 lines
20 KiB

<template>
<view>
4 years ago
<view class="width90 mart20" style="height: 90px;">
<view class="store-des flleft" @click="seeloaction">
立即<br>前往
</view>
<view class="store-cont">
<view class="store-title flleft width70">
4 years ago
<view class="font20 fcor333 fontwig6 width100">{{merchanList.storeName}}</view>
<view class="font14 fcor999 width100 text2 mart5">{{merchanList.address}}</view>
</view>
4 years ago
<view class="store-map flright width30 fotrt" @click="seeloaction">
<!-- 地图logo -->
4 years ago
<image
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAgAElEQVR4Xu1dB3xUVdb/v+klmUx6JSSBEJIQ6aiAFEXsoqtY1oaromtBiW3V3TXu7rd+rvrZde2ioIJKEaSJlNAxhECoaQRC6qROb2/e97tvnDATprwpmYya+/vNbyBz7r3nnvt/59577jnnURgsv2sJUL/r0Q8OHoMA+J2DYBAAgwD4nUvgdz78QQ0wCIDwS2BL1xal1MzPhJCXIaD5aYsOyyf4y8W88/THnevUqE6MrO45WidWSPdxacvUYxqTF1s4nNDmJAyv4VLHG01dew3b1omuIzXiGHEF1/b4oDtEkDY9nP9sB9c6oaQLiwZ450hJVKY47+lEY/LDfKNIMWH8FJ7zIGLeroXabOM8LqWYh66HhvXSW21W/M/2v7D/V6RGc2rHrDPDqDbh1lH3YER8Pqc63oi6DB14c9+LkColEEqFfrfHAGYKaAKDZobBRh6D7xcWlJT73ZCfFfoNACVMCW9y9ejnpDzZjdGILoqBkmo0nQHVycfkqRe7sBkqAIjkIkgUYk4isBitMHQZcGPB7ShMHMOpjjciM23GizueZfsnfISkUNQRxsaso4CfikeWrA9Jm30a6RcAlNasXRHHJF4lp+Quj0IkAcBqpqHv0GNO3s0YkzIxJLJ9YdsT7ORzBaFfnVLUah6YDx4bUbLGr3o+iEMKgOUnltyZzkv7TxKVnOyu30gCgM1qg1alw5W512Ni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WgFZZeI9oZCkw9Zgh5Ilw+fA5IUtBGyySQgoABzN1vBoIVB
</image>
<view class="mart5 fcor999 font13">{{distance}}km</view>
</view>
</view>
</view>
<view class="line1 mart15 marb40"></view>
<!-- //暂未购买卡券 -->
<view class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="menCoupnList == '' && user != ''">
你还没有买券哦~
4 years ago
</view>
<button class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="user == '' " open-type="getUserInfo"
@getuserinfo="getuserinfo">
点击授权查询个人卡券
</button>
4 years ago
<view class="width90 store-list mart10" v-for="mers in menCoupnList" :key="mers.id">
<view class="width100" style="height: 55px;">
<view class="flleft width70">
4 years ago
<view class="width90 fcor333 font15 mart5">{{mers.highCouponModel.couponName}}</view>
<view class="width90 fcorred font14 mart5">
过期时间:{{mers.highCouponModel.salesEndTime | formatDate('-')}}</view>
</view>
4 years ago
</view>
<view class="width90">
4 years ago
<button class="store-jdes flleft mart5" @click="jumpCoupondes(mers.highCouponModel.id)">查看详情</button>
</view>
</view>
4 years ago
<view class="loading-text" v-if="productList != '' ">{{ loadingText }}</view>
<!-- <authorize></authorize> -->
</view>
</template>
<script>
4 years ago
import {
getMerchantStoreById,
getCouponListByStoreId,
getUserInfo
4 years ago
} from '../../../Utils/Api.js';
// import authorize from '../../../components/Authorize';
4 years ago
let app = getApp();
export default {
// components: {
// authorize
// },
data() {
return {
4 years ago
imageUrl: app.globalData.imgUrl,
merchanId: '',
merchanList: '',
distance: '',
menCoupnList: [],
pageNum: 1,
pageSize: 10,
isNoMoreData: false,
loadingText: '',
user: ''
}
},
4 years ago
filters: {
//过滤器 用于格式化时间
formatDate: function(value, spe = '/') {
let data = new Date(value);
let year = data.getFullYear();
let month = data.getMonth() + 1;
let day = data.getDate();
let h = data.getHours();
let mm = data.getMinutes();
let s = data.getSeconds();
month = month > 10 ? month : "0" + month;
day = day > 10 ? day : "0" + day;
h = h > 10 ? h : "0" + h;
mm = mm > 10 ? mm : "0" + mm;
s = s > 10 ? s : "0" + s;
return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`;
}
4 years ago
},
onLoad(option) {
this.user = app.globalData.userInfo;
4 years ago
this.merchanId = option.id;
this.distance = option.juli;
this.getMerchantStoreById();
if (!this.user) {
} else {
this.getCouponListByStoreId();
}
4 years ago
},
onReachBottom() {
this.getCouponListByStoreId();
},
methods: {
//获取登陆信息
getuserinfo() {
uni.showLoading({
title: '加载中...'
});
let that = this;
wx.login({
success(res) {
if (res.code) {
//发起网络请求
var code = res.code
// 获取微信用户信息
uni.getUserInfo({
success: function(res) {
let params = {
openId: app.globalData.openId,
iv: res.iv,
encryptedData: res.encryptedData
}
getUserInfo(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
app.globalData.userInfo = res
.return_data
.object
.highUser;
app.globalData.token = res
.return_data.uniqueCode;
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
uni.setStorage({
key: "token",
data: res.return_data
.uniqueCode
})
that.user = res.return_data.object.highUser;
that.getCouponListByStoreId();
} else {
uni.hideLoading();
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
});
},
fail: res => {
uni.hideLoading();
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
})
} else {
fail: res => {
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
}
},
fail(res) {
uni.hideLoading();
}
})
},
4 years ago
//查询门店详情
getMerchantStoreById() {
uni.showLoading({
title: '加载中...'
})
let params = {
id: this.merchanId
}
getMerchantStoreById(params).then(res => {
if (res.return_code == '000000') {
this.merchanList = res.return_data;
uni.hideLoading();
} else {
uni.hideLoading()
}
})
},
// 跳转卡券详情
jumpCoupondes(e) {
uni.navigateTo({
url: '../coupon-details/coupon-details?id='+e
})
},
//前往导航
seeloaction() {
uni.openLocation({
latitude: Number(this.merchanList.latitude), //目的地的定位
longitude: Number(this.merchanList.longitude), //目的地的定位
name: this.merchanList.storeName,
address: this.merchanList.address
})
},
//查询门店对应的卡券
getCouponListByStoreId() {
uni.showLoading({
title: '加载中...'
})
if (this.isNoMoreData) {
uni.hideLoading()
this.loadingText = '到底了';
return false;
}
let pagenum = this.pageNum;
let params = {
pageNum: pagenum,
storeId: this.merchanId,
pageSize: this.pageSize
}
getCouponListByStoreId(params).then(res => {
if (res.return_code == '000000' && res.return_data.list != '') {
uni.hideLoading();
this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
this.menCoupnList = this.menCoupnList.concat(res.return_data.list);
if(res.return_data.total == (this.pageNum * this.pageSize)){
this.isNoMoreData = true;
}
this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;
4 years ago
} else {
this.menCoupnList = [];
uni.hideLoading()
}
})
},
}
}
</script>
<style lang="scss">
.store-des {
4 years ago
width: 80px;
height: 80px;
text-align: center;
color: white;
font-size: 28px;
border-radius: 10px;
background-color: red;
}
.loading-text {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
height: 60upx;
color: #979797;
font-size: 24upx;
}
.store-cont {
margin-left: 90px;
}
.store-map image {
width: 45px;
height: 45px;
}
.store-no {
height: 80px;
line-height: 80px;
border: 1px solid #b2b2b2;
border-radius: 10px;
}
.store-list {
4 years ago
height: 100px;
border: 1px solid #b2b2b2;
border-radius: 5px;
}
.store-list image {
width: 60px;
height: 60px;
}
.store-jdes {
width: 70px;
height: 30px;
line-height: 30px;
background-color: #eb5823;
color: #FFFFFF;
font-size: 12px;
padding: 0px;
}
.store-ims {
margin-left: 75px;
}
</style>