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/coupon-details/coupon-details.vue

310 lines
7.8 KiB

<template>
<view>
<view class="backcorf06 height100p"></view>
<view class="backcorfff backgrd width90 couhead">
<image class="couimg flleft" :src="imageUrl+couponDesInfo.couponInfo.couponImg"></image>
<view class="couhedcout">
<view class="height40 width100">
<view class="couStu flright fotct mart10" v-if="couponDesInfo.highUserCoupon.status == 2">已使用</view>
<view class="couStu flright fotct mart10" v-if="couponDesInfo.highUserCoupon.status == 1">未使用</view>
<view class="couStu flright fotct mart10" v-if="couponDesInfo.highUserCoupon.status == 0">已过期</view>
</view>
</view>
<view class="fontwig6 font16 fcor333 mart5">{{couponDesInfo.couponInfo.couponName}}</view>
<view class="fontwig6 font13 fcor999 mart5" v-if="oneTime">领取时间:{{oneTime | formatDate('-')}}</view>
<view class="fontwig6 font13 fcor999 mart5" v-if="twoTime">使用有效期:{{twoTime | formatDate('-')}}</view>
<view class="fontwig6 font13 fcor999 mart5" v-if="threeTime">消费时间:{{threeTime | formatDate('-')}}</view>
</view>
<view class="width90 backcorfff mart60 qrcs">
<view class="mart20 fotct fcorred font15 marb20 height20" v-if="couponDesInfo.highUserCoupon.status != 0">
请出示核销码(商户扫客户)</view>
<view class="width90 mart20 fotct" v-if="couponDesInfo.highUserCoupon.status != 0">
<image class="coupon-qr" :src="imageUrl+'couponCode/'+couponDesInfo.highUserCoupon.qrCodeImg"></image>
</view>
<view class="fotct fcor333 font15 marb10 mart10">{{couponDesInfo.couponCodeInfo.codeKey}}</view>
</view>
<view class="width90 mart10 googscs backcorfff">
<view class="width90 height45l font18 fcor666">门店信息</view>
<view class="line1 width100"></view>
<view class="width90 stoCont" v-for="(store,i) in storeList" :key="i">
<view class="width80p flleft mart10">
<view class="font16 fcor333 fontwig6 ">{{store.storeName}}</view>
<view class="font13 fcor666 mart5">{{store.address}}</view>
</view>
<view class="width20 flright mart10 fotrt" @click="seeloaction(store)">
<image mode="widthFix" style="width: 25px;height: 25px;" :src="imagewxUrl+imgadres1">
3 years ago
</image>
4 years ago
<view class="mart5 fcor999 font13">{{store.distance}}km</view>
</view>
</view>
</view>
<view class="height60"></view>
<button class="czlq width100" v-if="couponDesInfo.highUserCoupon.status == 0"
@click="againReceiveCoupon">重新领取</button>
</view>
</template>
<script>
import {
getUserCouponDetail,
getStoreListByCoupon,
againReceiveCoupon
} from "../../../Utils/Api.js"
let app = getApp()
export default {
data() {
return {
couDesId: '',
imageUrl: app.globalData.imgUrl,
3 years ago
imagewxUrl: app.globalData.imageWxImg,
imgadres1: 'dhl.png',
imgadres: 'noorder.png',
couponDesInfo: [],
storeList: [],
oneTime: '',
twoTime: '',
threeTime: '',
menddesId: ''
}
},
onLoad(option) {
this.couDesId = option.id;
this.menddesId = option.mendId;
this.getUserCouponDetail();
this.getStoreListByCoupon();
},
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
},
onReachBottom() {
this.getStoreListByCoupon();
},
methods: {
//我的卡券详情
getUserCouponDetail() {
uni.showLoading({
title: '加载中...'
})
let params = {
userCouponId: this.couDesId
}
getUserCouponDetail(params).then(res => {
if (res.return_code == '000000') {
this.couponDesInfo = res.return_data;
this.oneTime = res.return_data.highUserCoupon.createTime;
this.twoTime = res.return_data.highUserCoupon.useEndTime;
this.threeTime = res.return_data.highUserCoupon.consumeTime;
uni.hideLoading()
} else {
uni.hideLoading()
}
})
},
4 years ago
//导航
seeloaction(e) {
uni.openLocation({
latitude: Number(e.latitude), //目的地的定位
longitude: Number(e.longitude), //目的地的定位
name: e.storeName,
address: e.address
})
},
/**
* 查询门店列表
*/
getStoreListByCoupon() {
uni.showLoading({
title: '加载中...'
})
let params = {
couponId: this.menddesId,
4 years ago
longitude: app.globalData.longitude,
latitude: app.globalData.latitude
}
getStoreListByCoupon(params).then(res => {
4 years ago
if (res.return_code == '000000' && res.return_data.list != '') {
uni.hideLoading();
4 years ago
this.storeList = res.return_data;
} else {
this.storeList = [];
uni.hideLoading()
}
})
},
//领取
againReceiveCoupon() {
uni.showLoading({
title: '领取中...'
})
let params = {
couponId: this.couponDesInfo.couponInfo.id
}
againReceiveCoupon(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
uni.showToast({
icon: 'none',
title: '领取成功',
duration: 2000
})
this.couponDesInfo = res.return_data;
this.oneTime = res.return_data.highUserCoupon.createTime;
this.twoTime = res.return_data.highUserCoupon.useEndTime;
this.threeTime = res.return_data.highUserCoupon.consumeTime;
} else {
uni.hideLoading();
uni.showToast({
icon: 'none',
title: res.return_msg,
duration: 2000
})
}
})
},
scan() {
uni.scanCode({
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
}
});
}
}
}
</script>
<style lang="scss">
page {
background-color: #f5f5f5;
}
.couhead {
position: absolute;
top: 20px;
height: 280rpx;
border-radius: 10rpx;
.couimg {
width: 180rpx;
max-height: 180rpx;
margin-top: 70rpx;
margin-left: 10px;
}
.couhedcout {
margin-left: 200rpx;
}
.couStu {
background-color: #dceefe;
color: #0076dd;
height: 60rpx;
line-height: 60rpx;
width: 60px;
border-radius: 5px 0px 0px 5px;
}
}
.qrcs {
border-top-style: dotted;
border-top-color: #f6f6f6;
padding-bottom: 20px;
border-radius: 0px 0px 5px 5px;
}
.googscs {
border-radius: 5px;
}
.stoCont {
border-bottom: 1px solid #f6f6f6;
height: 170rpx;
}
.loading-text {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
height: 60upx;
color: #979797;
font-size: 24upx;
}
.coupon-status {
height: 35px;
line-height: 35px;
}
.coupon-mes {
margin-right: 90px;
}
.coupon-img {
width: 80px;
height: 80px;
}
.coupon-qr {
width: 250px;
height: 250px;
}
.coupon-des {
width: 80px;
height: 80px;
text-align: center;
color: white;
font-size: 28px;
border-radius: 10px;
background-color: red;
}
.coupon-cont-dh {
margin-left: 90px;
}
.coupon-map image {
width: 45px;
height: 45px;
}
.coupon-no {
height: 80px;
line-height: 80px;
border: 1px solid #b2b2b2;
border-radius: 10px;
}
.coupne-btn {
position: fixed;
bottom: 0px;
background-color: red;
color: #FFFFFF;
}
.czlq {
position: absolute;
bottom: 0;
background-color: red;
color: #FFFFFF;
}
</style>