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] =?UTF-8?q?1.=E5=AF=B9=E6=8E=A5=E4=B8=AD=E7=9F=B3=E6=B2=B9?= =?UTF-8?q?=E6=89=AB=E7=A0=81=E9=A2=86=E5=88=B8=20=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=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 @@