354 lines
8.4 KiB
Vue
354 lines
8.4 KiB
Vue
<template>
|
||
<view class="centenr">
|
||
<view class="Candywrapper">
|
||
<view class="bai-bs">
|
||
<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> -->
|
||
</view>
|
||
<view class="card-box" :style="'background: url('+bgImg+') no-repeat;background-size: 100% 100%; '">
|
||
<view style="width: 20%;"></view>
|
||
<view class="right-box">
|
||
<view class="title">{{couponInfo.name}}</view>
|
||
<view class="hui-size">{{couponInfo.useCondition}}</view>
|
||
<view style="width: 100%;display: flex;justify-content: space-between; ">
|
||
<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>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="bai-box">
|
||
<view class="title_">使用须知</view>
|
||
<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>
|
||
<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>
|
||
</view>
|
||
<view class="bai-box">
|
||
<view style="width: 100%; display: flex;align-items: center;justify-content: space-between; ">
|
||
<view class="title_">适用门店</view>
|
||
<view class="d-s" style="font-size: 14px;color: #FF2828;" @click="goGoGo()">
|
||
<image src="../../static/icon/reddh.png" style="width: 18px; height: 18px; "></image>
|
||
导航
|
||
</view>
|
||
</view>
|
||
<view class="si">{{store.name}}</view>
|
||
<view class="si">{{store.address}} | {{distance}}km</view>
|
||
|
||
</view>
|
||
<view class="but-sub" @click="showl=!showl">立即使用</view>
|
||
|
||
|
||
<u-popup :show="showl" :round="10" mode="bottom" @close="close" @open="open">
|
||
<view class="">
|
||
<view class="pop-top">
|
||
<view style="width: 20px;"></view>
|
||
<view class="">立即使用</view>
|
||
<view class=""><u-icon name="close"></u-icon></view>
|
||
</view>
|
||
<view class="popup-box">
|
||
<view class="">
|
||
<view class="">请向商家出示此码使用</view>
|
||
<view style="display: flex;align-items: center;justify-content: center; margin: 10px auto;">
|
||
<w-qrcode :options="options"></w-qrcode>
|
||
</view>
|
||
|
||
<view class="">核销码:6688172293684182</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</u-popup>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import request from '../../utils/request';
|
||
export default {
|
||
data() {
|
||
return {
|
||
value: 0,
|
||
certificateId: '',
|
||
bgImg: '',
|
||
couponInfo: {},
|
||
AppToken: uni.getStorageSync("App-Token"),
|
||
// 当前经度信息
|
||
longitude: "",
|
||
// 当前纬度信息
|
||
latitude: "",
|
||
// 店铺经度信息
|
||
lon: "",
|
||
// 店铺纬度信息
|
||
lat: "",
|
||
// 店铺信息
|
||
store: {
|
||
name: "测试油站",
|
||
description: "济南分店",
|
||
address: "济南槐荫区"
|
||
},
|
||
distance: 0,
|
||
showl: true,
|
||
options: {
|
||
code: 'https://oilapi.youkerr.com/oily?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni
|
||
.getStorageSync('userId') + '&type=yaoqingyouli',
|
||
// code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + ' &userId=' + uni
|
||
// .getStorageSync('userId'), // 生成二维码的值
|
||
size: 400, // 460代表生成的二维码的宽高均为460rpx
|
||
},
|
||
}
|
||
},
|
||
onLoad(e) {
|
||
this.certificateId = e.certificateId
|
||
this.bgImg = e.bgImg
|
||
this.getInfo()
|
||
this.getAddress(uni.getStorageSync("storeId"))
|
||
},
|
||
methods: {
|
||
close() {
|
||
this.showl = false
|
||
},
|
||
|
||
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() {
|
||
request({
|
||
url: '/cardCoupon/' + this.certificateId,
|
||
method: 'get',
|
||
}).then(res => {
|
||
console.log(res, 74);
|
||
if (res.code == 200) {
|
||
this.couponInfo = res.data
|
||
}
|
||
})
|
||
},
|
||
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;
|
||
background: #FA6400;
|
||
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;
|
||
}
|
||
|
||
.but-sub {
|
||
width: 305px;
|
||
height: 40px;
|
||
line-height: 40px;
|
||
margin: 0 auto;
|
||
background-color: #FF9655;
|
||
color: white;
|
||
border-radius: 50px;
|
||
text-align: center;
|
||
position: absolute;
|
||
bottom: 40px;
|
||
left: 11%;
|
||
}
|
||
|
||
.card-box {
|
||
width: 95%;
|
||
background: #ffffff;
|
||
height: 90px;
|
||
box-sizing: border-box;
|
||
padding: 15px;
|
||
|
||
margin: 10px auto;
|
||
display: flex;
|
||
}
|
||
|
||
.right-box {
|
||
width: 80%;
|
||
|
||
}
|
||
|
||
.hui-size {
|
||
font-size: 12px;
|
||
color: #999999;
|
||
white-space: nowrap;
|
||
text-overflow: ellipsis;
|
||
overflow: hidden;
|
||
margin: 5px 0;
|
||
}
|
||
|
||
.popup-box {
|
||
background: #fff;
|
||
box-sizing: border-box;
|
||
padding: 10px;
|
||
background: #ffffff;
|
||
margin: 15px auto;
|
||
box-sizing: border-box;
|
||
padding: 10px;
|
||
text-align: center;
|
||
}
|
||
|
||
.pop-top {
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding: 10px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
border-bottom: 1px solid #eee;
|
||
}
|
||
</style> |