diff --git a/high-unionPay/App.vue b/high-unionPay/App.vue index 749f788..d41fe0c 100644 --- a/high-unionPay/App.vue +++ b/high-unionPay/App.vue @@ -1,59 +1,60 @@ - - - diff --git a/high-unionPay/Utils/Api.js b/high-unionPay/Utils/Api.js index 5bdaf55..a5a6567 100644 --- a/high-unionPay/Utils/Api.js +++ b/high-unionPay/Utils/Api.js @@ -5,7 +5,19 @@ import { POSTBREST} from "./bRequest.js"; let app = getApp(); let base = app.globalData.url; +let v1base = app.globalData.v1url; let brestBase = app.globalData.brestUrl; +//公众号获取跳小程序参数 +export const verifyWx = params => { + return POST('GET', `${v1base}/wxMsg/verifyWx`, params).then(res => res.data); +} +//公众号获取跳转小程序地址 +export const getScheme = params => { + return POST('GET', `${v1base}/wxMsg/getScheme`, params).then(res => res.data); +} + + + //根据code获取openId export const HandleCode = params => { return POST('GET', `${base}/wechat/handleCode`, params).then(res => res.data); @@ -417,6 +429,12 @@ export const cancelOrderByOrderNo = params => { return POST('GET', `${base}/highOrder/cancelOrderByOrderNo`, params).then(res => res.data); } +//中石油生成二维码 +export const getVerifyQRCode = params => { + return POST('GET', `${base}/coupon/getVerifyQRCode`, params).then(res => res.data); +} + + //分销统计数据 export const userDistributionStatistics = params => { return POST('GET', `${base}/highUser/userDistributionStatistics`, params).then(res => res.data); diff --git a/high-unionPay/pages/goods/coupon-details/coupon-details.vue b/high-unionPay/pages/goods/coupon-details/coupon-details.vue index 5feaea7..c416c56 100644 --- a/high-unionPay/pages/goods/coupon-details/coupon-details.vue +++ b/high-unionPay/pages/goods/coupon-details/coupon-details.vue @@ -2,7 +2,9 @@ - + 已使用 @@ -13,19 +15,31 @@ 领取时间:{{oneTime | formatDate('-')}} 使用有效期:{{twoTime | formatDate('-')}} 消费时间:{{threeTime | formatDate('-')}} - + 加油站点:{{couponDesInfo.couponCodeInfo.storeName}} - + 刷新二维码 + + + + 视频教程 + + + 视频教程 + + + + 预约订单已成功 门店会在24小时内联系您 @@ -33,17 +47,20 @@ v-if="!couponDesInfo.couponInfo.reserveStatus && couponDesInfo.highUserCoupon.status != 0 && couponDesInfo.couponInfo.couponSource == 3"> 请出示核销码(商户扫客户) + v-if="!couponDesInfo.couponInfo.reserveStatus && couponDesInfo.highUserCoupon.status != 0 && couponDesInfo.couponInfo.couponSource != 3 && couponDesInfo.couponInfo.couponSource != 5"> 请告知加油员用码商支付 - + + + v-if="couponDesInfo.couponInfo.couponSource != 4 && couponDesInfo.couponInfo.couponSource != 5"> {{couponDesInfo.couponCodeInfo.codeKey}} + - + - + @@ -78,7 +94,9 @@ import { getUserCouponDetail, getStoreListByCoupon, - againReceiveCoupon + getVerifyQRCode, + verifyWx, + getScheme } from "../../../Utils/Api.js" import xiaoVideoElement from '../../../components/yy-video-player/yy-video-player.nvue' let app = getApp() @@ -91,10 +109,13 @@ couDesId: '', imageUrl: app.globalData.imgUrl, imagewxUrl: app.globalData.imageWxImg, + imageqrUrl: app.globalData.imageqrImg, imgadres1: 'dhl.png', imgadres2: 'video.jpg', imgadres3: 'playVideo.mp4', imgadres: 'noorder.png', + imgadres5: 'petrovideo.jpg', //重庆中石油 + imgadres6: 'petroplayVideo.mp4', //重庆中石油 couponDesInfo: [], storeList: [], oneTime: '', @@ -103,7 +124,8 @@ menddesId: '', pageNum: 1, pageSize: 1, - isNoMoreData: false + isNoMoreData: false, + qrimageurl: '' //中石油二维码 } }, onLoad(option) { @@ -129,10 +151,33 @@ return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`; } }, - onReachBottom() { - // this.getStoreListByCoupon(); - }, + onReachBottom() {}, methods: { + onUnload() { + clearInterval(this.Timer); + }, + Timer() {}, + //倒计时一分钟 + setTimer() { + let that = this; + let holdTime = 60; + that.Timer = setInterval(() => { + if (holdTime <= 0) { + uni.showModal({ + title: '提示', + content: '当前二维码已失效,请刷新后展示', + success: function(res) { + if (res.confirm) { + that.getVerifyQRCode(that.couponDesInfo.highUserCoupon.id); + } + } + }) + clearInterval(that.Timer); + return; + } + holdTime--; + }, 1000) + }, //我的卡券详情 getUserCouponDetail() { uni.showLoading({ @@ -145,7 +190,11 @@ if (res.return_code == '000000') { this.couponDesInfo = res.return_data; uni.hideLoading(); - if (res.return_data.couponInfo.couponSource == 4) { + if (res.return_data.couponInfo.couponSource == 5) { + this.getVerifyQRCode(res.return_data.highUserCoupon.id); + } + if (res.return_data.couponInfo.couponSource == 4 || res.return_data.couponInfo + .couponSource == 5) { this.oneTime = res.return_data.highUserCoupon.createTime; this.twoTime = res.return_data.highUserCoupon.useEndTime; this.threeTime = res.return_data.highUserCoupon.consumeTime; @@ -160,6 +209,19 @@ } }) }, + //生成二维码 + getVerifyQRCode(item) { + let params = { + userCouponId: item + } + getVerifyQRCode(params).then(res => { + if (res.return_code == '000000') { + this.qrimageurl = res.return_data; + clearInterval(this.Timer); + this.setTimer(); + } + }); + }, //导航 seeloaction(e) { uni.openLocation({ @@ -209,33 +271,11 @@ } }) }, - //领取 - againReceiveCoupon() { - uni.showLoading({ - title: '领取中...' - }) - let params = { - couponId: this.couponDesInfo.couponInfo.id - } - againReceiveCoupon(params).then(res => { + //跳转中油好客 + jumpzyhk() { + getScheme().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 - }) + location.href = res.return_data.url_link; } }) }, @@ -256,6 +296,16 @@ background-color: #f5f5f5; } + .relybtn { + background-color: #0083f5; + width: 110px; + margin-left: auto; + margin-right: auto; + height: 30px; + border-radius: 5px; + line-height: 30px; + } + .couhead { position: absolute; top: 20px; @@ -277,6 +327,7 @@ background-color: #dceefe; color: #0076dd; height: 60rpx; + font-size: 12px; line-height: 60rpx; width: 60px; border-radius: 5px 0px 0px 5px; @@ -358,7 +409,7 @@ position: fixed; bottom: 0px; background-color: red; - color: #FFFFFF; + color: #FFFFFF; border-radius: 0px; } @@ -368,4 +419,15 @@ background-color: red; color: #FFFFFF; } + + .coupne-btn { + position: fixed; + bottom: 0px; + background-color: #0083f5; + color: #FFFFFF; + height: 45px; + line-height: 45px; + border-radius: 0px; + z-index: 9999; + } diff --git a/high-unionPay/pages/goods/coupons-info-details/coupons-info-details.vue b/high-unionPay/pages/goods/coupons-info-details/coupons-info-details.vue index 6b06dad..2d90a37 100644 --- a/high-unionPay/pages/goods/coupons-info-details/coupons-info-details.vue +++ b/high-unionPay/pages/goods/coupons-info-details/coupons-info-details.vue @@ -1,228 +1,232 @@ - - - - - diff --git a/high-unionPay/pages/goods/goods.vue b/high-unionPay/pages/goods/goods.vue index 8a8bab0..e9058fd 100644 --- a/high-unionPay/pages/goods/goods.vue +++ b/high-unionPay/pages/goods/goods.vue @@ -1,7 +1,7 @@ @@ -91,7 +118,8 @@ import { getUserNewCouponDetail, getStoreListByCoupon, - getActivityByCoupon + getActivityByCoupon, + getVerifyQRCode } from "../../../Utils/Api.js"; import xiaoVideoElement from '../../../components/yy-video-player/yy-video-player.nvue'; import wybPopup from '../../../components/wyb-popup/wyb-popup.vue'; @@ -106,8 +134,11 @@ couDesId: '', imageUrl: app.globalData.imgUrl, imagewxUrl: app.globalData.imageWxImg, - imgadres2: 'video.jpg', - imgadres3: 'playVideo.mp4', + imageqrUrl: app.globalData.imageqrImg, + imgadres2: 'video.jpg', //贵州中石化 + imgadres3: 'playVideo.mp4', //贵州中石化 + imgadres5: 'petrovideo.jpg', //重庆中石油 + imgadres6: 'petroplayVideo.mp4', //重庆中石油 imgadres4: 'activityimg.png', imgadres1: 'dhl.png', couponDesInfo: [], @@ -117,7 +148,9 @@ threeTime: '', pageNum: 1, pageSize: 1, - isNoMoreData: false + isNoMoreData: false, + qrimageurl: '' ,//中石油二维码 + coupstus:0 } }, onLoad(option) { @@ -144,7 +177,7 @@ } }, onReachBottom() { - this.getStoreListByCoupon(); + // this.getStoreListByCoupon(); }, methods: { //我的卡券详情 @@ -158,8 +191,13 @@ getUserNewCouponDetail(params).then(res => { if (res.return_code == '000000') { uni.hideLoading(); - this.couponDesInfo = res.return_data; - if(res.return_data.couponInfo.couponSource == 4){ + this.couponDesInfo = res.return_data; + this.coupstus = res.return_data.highUserCoupon.status; + if (res.return_data.couponInfo.couponSource == 5) { + this.getVerifyQRCode(res.return_data.highUserCoupon.id); + } + if (res.return_data.couponInfo.couponSource == 4 || res.return_data.couponInfo + .couponSource == 5) { this.oneTime = res.return_data.highUserCoupon.createTime; this.twoTime = res.return_data.highUserCoupon.useEndTime; this.threeTime = res.return_data.highUserCoupon.consumeTime; @@ -174,6 +212,41 @@ } }) }, + //生成二维码 + getVerifyQRCode(item) { + let params = { + userCouponId: item + } + getVerifyQRCode(params).then(res => { + if (res.return_code == '000000') { + this.qrimageurl = res.return_data; + clearInterval(this.Timer); + this.setTimer(); + } + }); + }, + Timer() {}, + //倒计时一分钟 + setTimer() { + let that = this; + let holdTime = 60; + that.Timer = setInterval(() => { + if (holdTime <= 0) { + uni.showModal({ + title: '提示', + content: '当前二维码已失效,请刷新后展示', + success: function(res) { + if (res.confirm) { + that.getVerifyQRCode(that.couponDesInfo.highUserCoupon.id); + } + } + }) + clearInterval(that.Timer); + return; + } + holdTime--; + }, 1000) + }, //显示弹出 showPopup() { this.$refs.popup.show(); @@ -194,17 +267,17 @@ }); }, //跳转抽奖活动 - jumpcjhuod(){ + jumpcjhuod() { this.closePopup(); uni.reLaunch({ - url:'../../../subPages/lottery/lottery?id='+this.couDesId + url: '../../../subPages/lottery/lottery?id=' + this.couDesId + }) + }, + //跳转门店 + jumpstorelist() { + uni.navigateTo({ + url: '../../../subPages/sotre-details-list/sotre-details-list?id=' + this.couDesId }) - }, - //跳转门店 - jumpstorelist() { - uni.navigateTo({ - url: '../../../subPages/sotre-details-list/sotre-details-list?id=' + this.couDesId - }) }, //导航 seeloaction(e) { @@ -251,12 +324,9 @@ }) }, toUser() { - // uni.switchTab({ - // url: '/pages/tabBar/user/user' - // }); - uni.reLaunch({ + uni.switchTab({ url: '/pages/tabBar/user/user' - }) + }); }, scan() { uni.scanCode({ @@ -270,8 +340,28 @@ }