diff --git a/Utils/Api.js b/Utils/Api.js index 0045154..48c3f9d 100644 --- a/Utils/Api.js +++ b/Utils/Api.js @@ -199,6 +199,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/manifest.json b/manifest.json index 1d876a3..82fa52b 100644 --- a/manifest.json +++ b/manifest.json @@ -87,7 +87,7 @@ }, "devServer" : { "port" : "", - "https" : false + "https" : true }, "domain" : "https://hsgcs.dctpay.com", "template" : "index.html" diff --git a/pages.json b/pages.json index 7314c39..6a03fd5 100644 --- a/pages.json +++ b/pages.json @@ -36,7 +36,7 @@ "backgroundColorTop": "#0083f5", "enablePullDownRefresh": false } - + }, { "path": "pages/user/bindingCardList/bindingCardList", "style": { diff --git a/pages/goods/externalCoupon/externalCoupon.vue b/pages/goods/externalCoupon/externalCoupon.vue index e46c9a3..982e796 100644 --- a/pages/goods/externalCoupon/externalCoupon.vue +++ b/pages/goods/externalCoupon/externalCoupon.vue @@ -16,12 +16,57 @@ - - 去使用 - + + + + + + + 立即使用 + + + + 立即查看 + + + + 去使用 + - + + + + + + @@ -51,6 +96,34 @@ @getuserinfo="getuserinfo" withCredentials="true">点击领取 --> + + 温馨提示 + 请在有效期30天内使用。过期作废! + + + + 取消 + + + + + + + + @@ -62,8 +135,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 +150,17 @@ imageUrl: app.globalData.imgUrl, imagewxUrl: app.globalData.imageWxImg, imgadres: 'noorder.png', + imgadres1: 'noCoupon.jpg', + imgadres2: 'onCoupon.jpg', + imgadres3: 'showCoupon.jpg', pageNum: 1, pageSize: 10, isNoMoreData: false, couponsDetails: '', salesEndTime: '', codes: '', - userInfo: '' + userInfo: '', + usercouFeedbackHidden: 'none', // 默认隐藏 } }, filters: { @@ -109,9 +191,9 @@ } else { this.userInfo = 1; } - }, - fail() { - this.userInfo = 1; + }, + fail() { + this.userInfo = 1; } }); @@ -124,6 +206,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 +261,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 +313,7 @@ title: res.return_data, duration: 2000 }) + this.getDiscountByQrCode(); } else { uni.hideLoading(); uni.showToast({ @@ -266,6 +401,12 @@ duration: 2000 }) } + }, + //跳转列表 + jumpCounlist() { + uni.reLaunch({ + url: '/pages/user/coupon/coupon' + }) } } @@ -277,6 +418,43 @@ // 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; height: 80px; @@ -337,4 +515,12 @@ background-color: red; color: #FFFFFF; } + + .btnno { + height: 40px; + line-height: 40PX; + display: flex; + justify-content: center; + color: #ffffff; + } 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 9c90917..3f6847d 100644 --- a/pages/user/coupon/coupon.vue +++ b/pages/user/coupon/coupon.vue @@ -18,7 +18,7 @@ - + @@ -57,9 +57,18 @@ - + + + 去使用 + + + + + 去使用 + @@ -135,14 +144,46 @@ + + 温馨提示 + 请在有效期30天内使用。过期作废! + + + + 取消 + + + + + + +