From f6a6e8acfacce4503b40e0e8b0c4b51893191d06 Mon Sep 17 00:00:00 2001 From: "USER-20200413TQ\\Administrator" <812952667@qq.com> Date: Tue, 18 Oct 2022 17:42:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.=E5=AF=B9=E6=8E=A5=E4=B8=AD=E7=9F=B3?= =?UTF-8?q?=E6=B2=B9=E6=89=AB=E7=A0=81=E9=A2=86=E5=88=B8=20=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E4=B8=AD=E6=B2=B9=E5=A5=BD=E5=AE=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/Api.js | 4 + pages/goods/externalCoupon/externalCoupon.vue | 198 +++++++++++++++++- pages/qianZhuPay/union-pay/union-pay.vue | 2 +- pages/user/coupon/coupon.vue | 196 ++++++++++++++++- 4 files changed, 380 insertions(+), 20 deletions(-) diff --git a/Utils/Api.js b/Utils/Api.js index 0359dd1..b52ff28 100644 --- a/Utils/Api.js +++ b/Utils/Api.js @@ -198,6 +198,10 @@ export const againReceiveCoupon = params => { export const getUserDiscountList = params => { return POST('GET', `${base}/userDiscount/getUserDiscountList`, params).then(res => res.data); } +//使用优惠券 +export const useDiscount = params => { + return POST('GET', `${base}/discount/useDiscount`, params).then(res => res.data); +} //我的优惠券查详情 export const getDiscountByUserDiscountId = params => { return POST('GET', `${base}/userDiscount/getDiscountByUserDiscountId`, params).then(res => res.data); diff --git a/pages/goods/externalCoupon/externalCoupon.vue b/pages/goods/externalCoupon/externalCoupon.vue index e46c9a3..957a1ee 100644 --- a/pages/goods/externalCoupon/externalCoupon.vue +++ b/pages/goods/externalCoupon/externalCoupon.vue @@ -16,11 +16,52 @@ - - 去使用 - + + + + + + + 立即使用 + + + + 立即查看 + + + + 去使用 + + + + + @@ -51,6 +92,34 @@ @getuserinfo="getuserinfo" withCredentials="true">点击领取 --> + + 温馨提示 + 领取优惠券后请在有效期三十天内使用 + + + + 取消 + + + + + + + + @@ -62,8 +131,13 @@ HandleCode, getUserInfo, getH5AccessToken, - loginByPhone + loginByPhone, + verifyWx, + useDiscount } from '../../../Utils/Api.js'; + // #ifdef H5 + var wx = require('jweixin-module'); + // #endif let app = getApp(); export default { data() { @@ -72,13 +146,16 @@ imageUrl: app.globalData.imgUrl, imagewxUrl: app.globalData.imageWxImg, imgadres: 'noorder.png', + imgadres1: 'noCoupon.jpg', + imgadres2: 'onCoupon.jpg', pageNum: 1, pageSize: 10, isNoMoreData: false, couponsDetails: '', salesEndTime: '', codes: '', - userInfo: '' + userInfo: '', + usercouFeedbackHidden: 'none', // 默认隐藏 } }, filters: { @@ -109,9 +186,9 @@ } else { this.userInfo = 1; } - }, - fail() { - this.userInfo = 1; + }, + fail() { + this.userInfo = 1; } }); @@ -124,6 +201,34 @@ this.getDiscountByQrCode(); }, + created() { + // #ifdef H5 + uni.showLoading({ + title: '加载中' + }) + let url = window.location.href.split('#')[0]; + let datas = { + url: url + } + verifyWx(datas).then(res => { + uni.hideLoading(); + if (res.return_code == '000000') { + wx.config({ + debug: false, // 开启调试模式,返回值会在客户端alert出来。 + appId: res.return_data.appId, // 必填,公众号的唯一标识 + timestamp: res.return_data.timestamp, // 必填,生成签名的时间戳 + nonceStr: res.return_data.nonceStr, // 必填,生成签名的随机串 + signature: res.return_data.signature, // 必填,签名 + jsApiList: ['onMenuShareTimeline'], // 必填,需要使用的JS接口列表 + openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表 + }); + wx.ready(function(res) {}); + wx.error(function(err) {}); + } + + }); + // #endif + }, methods: { //获取卡券详情 getDiscountByQrCode() { @@ -151,6 +256,30 @@ }); }, + //使用优惠券 + useDiscount() { + let datas = { + discountAgentCodeId: this.couponsDetails.highDiscountAgentCode.id + } + useDiscount(datas).then(res => { + if (res.return_code == '000000') { + this.onhiddle(); + } else { + uni.showToast({ + title: res.return_msg, + duration: 2000, + icon: 'none' + }) + } + }) + }, + //弹出框 + onhiddle() { + this.usercouFeedbackHidden = 'block'; + }, + hideDiv() { // 隐藏输入弹出框 + this.usercouFeedbackHidden = 'none'; + }, //根据优惠券查询卡券列表 getCouponByDiscount(item) { let params = { @@ -179,6 +308,7 @@ title: res.return_data, duration: 2000 }) + this.getDiscountByQrCode(); } else { uni.hideLoading(); uni.showToast({ @@ -266,6 +396,12 @@ duration: 2000 }) } + }, + //跳转列表 + jumpCounlist(){ + uni.reLaunch({ + url:'/pages/user/coupon/coupon' + }) } } @@ -276,6 +412,43 @@ .coupon-mes { // margin-right: 90px; } + + .popup_content { + position: fixed; + top: 40%; + left: 50%; + width: 520upx; + height: 400upx; + margin-left: -270upx; + margin-top: -270upx; + border: 10px solid white; + background-color: white; + z-index: 1002; + overflow: auto; + border-radius: 20upx; + } + + .popup_title { + display: flex; + justify-content: center; + text-align: center; + width: 480upx; + } + + // 弹窗 + .popup_overlay { + + position: fixed; + top: 0%; + left: 0%; + width: 100%; + height: 100%; + background-color: black; + z-index: 1001; + -moz-opacity: 0.8; + opacity: .80; + filter: alpha(opacity=88); + } .coupon-img { width: 80px; @@ -337,4 +510,13 @@ background-color: red; color: #FFFFFF; } + + .btnno { + height: 40px; + line-height: 40PX; + display: flex; + justify-content: center; + color: #ffffff; + background: #999999; + } diff --git a/pages/qianZhuPay/union-pay/union-pay.vue b/pages/qianZhuPay/union-pay/union-pay.vue index 6db1bbe..0c53ffb 100644 --- a/pages/qianZhuPay/union-pay/union-pay.vue +++ b/pages/qianZhuPay/union-pay/union-pay.vue @@ -127,7 +127,7 @@ jumpMp() { if (!app.globalData.openId) { location.href = - 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsg.dctpay.com%2FH5%2F%23%2Fpages%2Fgoods%2FexternalCoupon%2FexternalCoupon&response_type=code&scope=snsapi_base#wechat_redirect'; + 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa075e8509802f826&redirect_uri=https%3A%2F%2Fhsgcs.dctpay.com%2FH5%2F%23%2Fpages%2Fgoods%2FexternalCoupon%2FexternalCoupon&response_type=code&scope=snsapi_base#wechat_redirect'; } else { uni.reLaunch({ url: '../../goods/externalCoupon/externalCoupon' diff --git a/pages/user/coupon/coupon.vue b/pages/user/coupon/coupon.vue index 243309a..18a653e 100644 --- a/pages/user/coupon/coupon.vue +++ b/pages/user/coupon/coupon.vue @@ -1,6 +1,6 @@ --> - + - 立即使用 + 立即使用 - + - 立即查看 + 立即查看 @@ -59,10 +59,14 @@ - - + + + - + @@ -94,11 +98,11 @@ 温馨提示 - 领取优惠券后请在有效期三十天内使用 + 请在有效期30天内使用。过期作废! - 取消 + 取消 - + @@ -148,6 +152,7 @@ imgadres: 'noorder.png', imgadres1: 'noCoupon.jpg', imgadres2: 'onCoupon.jpg', + imgadres3: 'showCoupon.jpg', pageNum: 1, pageSize: 10, isNoMoreData: false, @@ -398,9 +403,9 @@ } }, //跳转列表 - jumpCounlist(){ + jumpCounlist() { uni.reLaunch({ - url:'/pages/user/coupon/coupon' + url: '/pages/user/coupon/coupon' }) } } @@ -412,7 +417,7 @@ .coupon-mes { // margin-right: 90px; } - + .popup_content { position: fixed; top: 40%; @@ -427,17 +432,17 @@ overflow: auto; border-radius: 20upx; } - + .popup_title { display: flex; justify-content: center; text-align: center; width: 480upx; } - + // 弹窗 .popup_overlay { - + position: fixed; top: 0%; left: 0%; @@ -517,6 +522,5 @@ display: flex; justify-content: center; color: #ffffff; - background: #999999; } diff --git a/pages/user/coupon/coupon.vue b/pages/user/coupon/coupon.vue index 18a653e..4239ef7 100644 --- a/pages/user/coupon/coupon.vue +++ b/pages/user/coupon/coupon.vue @@ -131,7 +131,7 @@ 温馨提示 - 领取优惠券后请在有效期三十天内使用 + 请在有效期30天内使用。过期作废! @@ -332,6 +332,10 @@ uni.navigateTo({ url: '/member-Recharge/choicepage/choicepage' }) + }else if (e.highDiscount.useScope == 7) { + uni.navigateTo({ + url: '/pages/goods/refuel/refuel' + }) } else if (e.highDiscount.usingRange == 5) { this.useDiscount(e.discountAgentCodeId); } else { @@ -347,11 +351,10 @@ } useDiscount(datas).then(res => { if (res.return_code == '000000') { - this.onhiddle(); // #ifdef MP uni.showModal({ title: '温馨提示', - content: '领取优惠券后请在有效期三十天内使用', + content: '请在有效期30天内使用。过期作废!', success: function(res) { if (res.confirm) { uni.navigateToMiniProgram({ @@ -366,9 +369,9 @@ } } }) - // #endif // #ifdef H5 + this.onhiddle(); // #endif } else { uni.showToast({ From be26bf55c5ae07035cec62f0b0b7f9c198ce3855 Mon Sep 17 00:00:00 2001 From: "USER-20200413TQ\\Administrator" <812952667@qq.com> Date: Thu, 20 Oct 2022 14:14:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?1.=E6=9B=B4=E6=8D=A2=E4=B8=AD=E7=9F=B3?= =?UTF-8?q?=E6=B2=B9=E5=88=B8=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods/externalCoupon/externalCoupon.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/goods/externalCoupon/externalCoupon.vue b/pages/goods/externalCoupon/externalCoupon.vue index bcbca16..982e796 100644 --- a/pages/goods/externalCoupon/externalCoupon.vue +++ b/pages/goods/externalCoupon/externalCoupon.vue @@ -61,8 +61,8 @@ - +