oil-station/gasStation-uni/pagesHome/certificate/details.vue

255 lines
6.2 KiB
Vue
Raw Normal View History

2024-09-19 11:18:34 +08:00
<template>
<view class="centenr">
<view class="Candywrapper">
<view class="bai-bs">
2024-09-27 10:20:09 +08:00
<view class="">
<image :src="couponInfo.backgroundImage" v-if="couponInfo.backgroundImage" style="width: 60px; height: 60px; "></image>
<image src="../../static/logo.png" v-else style="width: 60px; height: 60px; "></image>
2024-09-19 11:18:34 +08:00
</view>
<view class="rr-box">
2024-09-27 10:20:09 +08:00
<view class="title_">{{couponInfo.name}}</view>
<view style="font-size: 12px;color: #666666;">{{couponInfo.useCondition}}</view>
2024-09-19 11:18:34 +08:00
<view style="width: 100%;display: flex;justify-content: space-between; ">
2024-09-27 10:20:09 +08:00
<view class="red-size" v-if="couponInfo.type==1">代金券</view>
<view class="red-size" v-if="couponInfo.type==2">兑换券</view>
<view class="red-size" v-if="couponInfo.type==3">折扣券</view>
<view class="red-size" v-if="couponInfo.type==4">油品立减券</view>
<view class="red-size" v-if="couponInfo.type==5">单品代金券</view>
<view class="red-size">剩余{{ couponInfo.tfGetNum ? (couponInfo.tfTotal - couponInfo.tfGetNum) : couponInfo.tfTotal}}</view>
2024-09-19 11:18:34 +08:00
</view>
</view>
</view>
<view class="bai-box">
<view class="title_">使用须知</view>
2024-09-27 10:20:09 +08:00
<view class="si_">有效期领取后{{couponInfo.validityDay || 0}}天内有效</view>
<view class="si_">领取说明</view>
<view class="si_">1每人限领{{couponInfo.getNumLimit || 0}}</view>
<view class="si_">2每日限领{{couponInfo.dayGetLimit || 0}}</view>
<view class="si_">核销说明</view>
2024-09-27 17:33:11 +08:00
<view class="si_" style="display: flex;" v-for="(item,index) in couponInfo.hxList" :key="index">
<view style="width: 6px;height: 6px;border-radius: 50%;margin-right: 5px;background-color: #FF9655;margin-top: 6px;"></view>
<view>{{item}}</view>
</view>
2024-09-19 11:18:34 +08:00
</view>
<view class="bai-box">
<view style="width: 100%; display: flex;align-items: center;justify-content: space-between; ">
<view class="title_">适用门店</view>
2024-09-27 10:20:09 +08:00
<view class="d-s" style="font-size: 14px;color: #FF2828;" @click="goGoGo()">
2024-09-19 11:18:34 +08:00
<image src="../../static/icon/reddh.png" style="width: 18px; height: 18px; "></image>
导航
</view>
</view>
2024-09-27 10:20:09 +08:00
<view class="si">{{store.name}}</view>
<view class="si">{{store.address}} | {{distance}}km</view>
2024-09-19 11:18:34 +08:00
</view>
</view>
<view class="bottom-box">
<view class="or-num">免费</view>
<view class="anniu">立即领取</view>
</view>
</view>
</template>
<script>
2024-09-26 17:58:06 +08:00
import request from '../../utils/request';
2024-09-19 11:18:34 +08:00
export default {
data() {
return {
2024-09-26 17:58:06 +08:00
value: 0,
2024-09-27 10:20:09 +08:00
certificateId: '',
couponInfo: {},
AppToken: uni.getStorageSync("App-Token"),
// 当前经度信息
longitude: "",
// 当前纬度信息
latitude: "",
// 店铺经度信息
lon: "",
// 店铺纬度信息
lat: "",
// 店铺信息
store: {
name: "测试油站",
description: "济南分店",
address: "济南槐荫区"
},
distance: 0,
2024-09-19 11:18:34 +08:00
}
},
2024-09-27 10:20:09 +08:00
onLoad(e) {
this.certificateId = e.certificateId
this.getInfo()
this.getAddress(uni.getStorageSync("storeId"))
},
2024-09-19 11:18:34 +08:00
methods: {
2024-09-27 10:20:09 +08:00
goGoGo() {
let lat = Number(this.lat)
let lon = Number(this.lon)
uni.openLocation({
latitude: lat,
longitude: lon,
name: this.store.name,
address: this.store.address,
success: function() {
console.log('success');
},
complete: function(res) {
console.log(res);
}
});
},
// 获取当前位置
getAddress(storeId) {
let _this = this;
uni.getLocation({
// 谷歌使用wgs84 其他使用gcj02
type: 'gcj02', // 使用国测局坐标系
success: function(res) {
if (_this.longitude == "" && _this.latitude == "") {
_this.longitude = res.longitude;
_this.latitude = res.latitude
}
console.log('经度: ' + _this.longitude);
console.log('纬度: ' + _this.latitude);
request({
url: 'business/storeInformation/store/recentlyStore',
method: 'post',
data: {
"lon": _this.longitude,
"lat": _this.latitude,
"storeId": storeId,
"isLogin": _this.AppToken ? "0" : "1", // 0为登录
},
}).then((response) => {
if (response.data.store) {
_this.distance = (Math.ceil(response.data.distance))
.toFixed(1)
_this.store = response.data.store
_this.lon = _this.store.longitude
_this.lat = _this.store.latitude
console.log(_this.store, 129);
} else {
uni.showToast({
title: "当前店铺已关闭!!!",
icon: "none"
})
}
}).catch(err => {})
},
fail: function(err) {
console.log('获取位置信息失败: ' + err.errMsg);
}
});
},
getInfo() {
2024-09-26 17:58:06 +08:00
request({
2024-09-27 10:20:09 +08:00
url: '/cardCoupon/' + this.certificateId,
2024-09-26 17:58:06 +08:00
method: 'get',
}).then(res => {
2024-09-27 10:20:09 +08:00
console.log(res, 74);
2024-09-26 17:58:06 +08:00
if (res.code == 200) {
2024-09-27 10:20:09 +08:00
this.couponInfo = res.data
2024-09-26 17:58:06 +08:00
}
})
},
2024-09-19 11:18:34 +08:00
valChange(e) {
console.log('当前值为: ' + e.value)
}
}
}
</script>
<style scoped lang="scss">
.centenr {
width: 100%;
height: 100vh;
background: #F9F9F9;
}
.Candywrapper {
background: #F9F9F9;
box-sizing: border-box;
padding: 10px;
}
.bottom-box {
width: 100%;
background: #fff;
box-sizing: border-box;
padding: 15px 10px;
display: flex;
align-items: center;
justify-content: space-between;
position: fixed;
left: 0px;
bottom: 0px;
}
.or-num {
font-weight: 600;
font-size: 20px;
color: #FA6400;
}
.bai-box {
background-color: #fff;
box-sizing: border-box;
padding: 10px;
width: 100%;
margin: 10px auto;
}
.bai-bs {
background-color: #fff;
box-sizing: border-box;
padding: 10px;
width: 100%;
margin: 10px auto;
display: flex;
align-items: center;
justify-content: space-between;
}
.title_ {
font-weight: 600;
font-size: 16px;
margin-bottom: 5px;
}
.anniu {
width: 90px;
height: 30px;
2024-09-20 17:38:29 +08:00
background: #FA6400;
2024-09-19 11:18:34 +08:00
border-radius: 50px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.rr-box {
width: 80%;
}
.red-size {
font-size: 12px;
color: #E02020;
}
.si_ {
font-size: 14px;
color: #333333;
}
.d-s {
display: flex;
align-items: center;
}
2024-09-27 10:20:09 +08:00
</style>