1.对接中石油扫码领券 跳转中油好客

yj-dev
杨杰 2 years ago
parent 8a74b4e8fc
commit f6a6e8acfa
  1. 4
      Utils/Api.js
  2. 192
      pages/goods/externalCoupon/externalCoupon.vue
  3. 2
      pages/qianZhuPay/union-pay/union-pay.vue
  4. 190
      pages/user/coupon/coupon.vue

@ -198,6 +198,10 @@ export const againReceiveCoupon = params => {
export const getUserDiscountList = params => { export const getUserDiscountList = params => {
return POST('GET', `${base}/userDiscount/getUserDiscountList`, params).then(res => res.data); 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 => { export const getDiscountByUserDiscountId = params => {
return POST('GET', `${base}/userDiscount/getDiscountByUserDiscountId`, params).then(res => res.data); return POST('GET', `${base}/userDiscount/getDiscountByUserDiscountId`, params).then(res => res.data);

@ -16,11 +16,52 @@
<view class="line1 mart15"></view> <view class="line1 mart15"></view>
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN" <button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN"
@click="jumpres">点击领取</button> @click="jumpres">点击领取</button>
<button class="coupne-btn width60w mart20 marb20" v-else @click="receiveDiscount">点击领取</button> <button class="coupne-btn width60w mart20 marb20"
<view class="width90 mart10 fcor666">去使用</view> v-if="userInfo != 1 && couponsDetails.highDiscountAgentCode.status == 1 && couponsDetails.highDiscount.usingRange != 5"
<view v-if="minecoupones == '' " class="mart60 fotct font14 fcor666"> @click="receiveDiscount">点击领取</button>
<button class="coupne-btn width60w mart20 marb20"
v-if="userInfo != 1 && couponsDetails.highDiscountAgentCode.status == 1 && couponsDetails.highDiscount.usingRange == 5"
@click="receiveDiscount">点击领取</button>
<view class="alijus width90 mart20"
v-if="userInfo != 1 && couponsDetails.highDiscountAgentCode.status != 1 && couponsDetails.highDiscount.usingRange == 5">
<!-- <wx-open-launch-weapp style="width: 40%;margin-right: 5%;" id="launch-btn" username="gh_5fb54244cdbb">
<script type="text/wxtag-template">
<style>
.btn {
padding: 12px;
}
.download {
color: #ffffff;
background: #0083f5;
width:100%;
height:100%;
align-items: center;
justify-content: center;
font-size: 16px;
}
</style>
<button class="download btn" style="height:50px;width:100%;border:none;">立即使用</button>
</script>
</wx-open-launch-weapp> -->
<view class="width40" style="margin-right: 5%;" @click="useDiscount">
<view class="width100 btnno fotct font16 ">立即使用</view>
</view>
<view class="width40" style="margin-left: 5%;" @click="jumpCounlist">
<view class="width100 btnno fotct font16 ">立即查看</view>
</view>
</view>
<view class="width90 mart10 fcor666" v-if="couponsDetails.highDiscount.usingRange != 5">去使用</view>
<view v-if="minecoupones == '' && couponsDetails.highDiscount.usingRange != 5"
class="mart60 fotct font14 fcor666">
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> <image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
</view> </view>
<view class="width90 mart30" v-if="couponsDetails.highDiscount.usingRange == 5">
<image :src="imagewxUrl+imgadres1" mode="widthFix" class="width100" v-if="couponsDetails.highDiscountAgentCode.status ==1"></image>
<image :src="imagewxUrl+imgadres2" mode="widthFix" class="width100" v-if="couponsDetails.highDiscountAgentCode.status != 1"></image>
</view>
<view class="product-list mart20 width90"> <view class="product-list mart20 width90">
<view class="product" v-for="product in minecoupones" :key="product.id" <view class="product" v-for="product in minecoupones" :key="product.id"
@tap="toGoods(product.highCoupon.id)"> @tap="toGoods(product.highCoupon.id)">
@ -51,6 +92,34 @@
@getuserinfo="getuserinfo" withCredentials="true">点击领取</button> @getuserinfo="getuserinfo" withCredentials="true">点击领取</button>
<button class="coupne-btn width100" v-else @click="receiveDiscount">点击领取</button> --> <button class="coupne-btn width100" v-else @click="receiveDiscount">点击领取</button> -->
<!-- <authorize></authorize> --> <!-- <authorize></authorize> -->
<view :style="{display: usercouFeedbackHidden}" class="popup_content">
<view class="popup_title font18 fcor333 fontwig6 paddtop10">温馨提示</view>
<view class="popup_title font16 fcor666 paddtop20 height60">领取优惠券后请在有效期三十天内使用</view>
<view class="width100 bor-botm1 mart10"></view>
<view class="alijus width90 mart20">
<view class="width40" style="margin-right: 5%;" @click="hideDiv()">
<view class="width100 btnno font16 ">取消</view>
</view>
<wx-open-launch-weapp style="width: 40%;margin-left: 5%;" id="launch-btn" username="gh_5fb54244cdbb">
<script type="text/wxtag-template">
<style>
.download {
color: #ffffff;
background: #0083f5;
width:100%;
height:100%;
align-items: center;
justify-content: center;
font-size: 16px;
}
</style>
<button class="download" style="height:40px;line-height: 40PX;width:100%;border:none;">立即使用</button>
</script>
</wx-open-launch-weapp>
</view>
</view>
<view class="popup_overlay" :style="{display: usercouFeedbackHidden}" @click="hideDiv()"></view>
</view> </view>
</template> </template>
@ -62,8 +131,13 @@
HandleCode, HandleCode,
getUserInfo, getUserInfo,
getH5AccessToken, getH5AccessToken,
loginByPhone loginByPhone,
verifyWx,
useDiscount
} from '../../../Utils/Api.js'; } from '../../../Utils/Api.js';
// #ifdef H5
var wx = require('jweixin-module');
// #endif
let app = getApp(); let app = getApp();
export default { export default {
data() { data() {
@ -72,13 +146,16 @@
imageUrl: app.globalData.imgUrl, imageUrl: app.globalData.imgUrl,
imagewxUrl: app.globalData.imageWxImg, imagewxUrl: app.globalData.imageWxImg,
imgadres: 'noorder.png', imgadres: 'noorder.png',
imgadres1: 'noCoupon.jpg',
imgadres2: 'onCoupon.jpg',
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
isNoMoreData: false, isNoMoreData: false,
couponsDetails: '', couponsDetails: '',
salesEndTime: '', salesEndTime: '',
codes: '', codes: '',
userInfo: '' userInfo: '',
usercouFeedbackHidden: 'none', //
} }
}, },
filters: { filters: {
@ -124,6 +201,34 @@
this.getDiscountByQrCode(); 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: { methods: {
// //
getDiscountByQrCode() { 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) { getCouponByDiscount(item) {
let params = { let params = {
@ -179,6 +308,7 @@
title: res.return_data, title: res.return_data,
duration: 2000 duration: 2000
}) })
this.getDiscountByQrCode();
} else { } else {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
@ -266,6 +396,12 @@
duration: 2000 duration: 2000
}) })
} }
},
//
jumpCounlist(){
uni.reLaunch({
url:'/pages/user/coupon/coupon'
})
} }
} }
@ -277,6 +413,43 @@
// margin-right: 90px; // 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 { .coupon-img {
width: 80px; width: 80px;
height: 80px; height: 80px;
@ -337,4 +510,13 @@
background-color: red; background-color: red;
color: #FFFFFF; color: #FFFFFF;
} }
.btnno {
height: 40px;
line-height: 40PX;
display: flex;
justify-content: center;
color: #ffffff;
background: #999999;
}
</style> </style>

@ -127,7 +127,7 @@
jumpMp() { jumpMp() {
if (!app.globalData.openId) { if (!app.globalData.openId) {
location.href = 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 { } else {
uni.reLaunch({ uni.reLaunch({
url: '../../goods/externalCoupon/externalCoupon' url: '../../goods/externalCoupon/externalCoupon'

@ -13,7 +13,7 @@
<view class="tis" v-if="couponValidList.length==0"> <view class="tis" v-if="couponValidList.length==0">
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> <image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
</view> </view>
<view class="row" v-for="(row,index) in couponValidList" :key="index" @click="jumpcoupons(row)"> <view class="row" v-for="(row,index) in couponValidList" :key="index">
<!-- content --> <!-- content -->
<view class="carrier"> <view class="carrier">
<view class="left"> <view class="left">
@ -42,9 +42,18 @@
<!-- <view class="criteria"> <!-- <view class="criteria">
{{row.highDiscount.discountName}} {{row.highDiscount.discountName}}
</view> --> </view> -->
<view class="use"> <!-- #ifdef MP -->
<view class="use" @click="jumpcoupons(row)">
去使用
</view>
<!-- #endif -->
<!-- #ifdef H5 -->
<!-- <view class="btnsclick" v-if="row.highDiscount.usingRange == 5"
@click="useDiscount(row.discountAgentCodeId)"></view> -->
<view class="use" @click="jumpcoupons(row)">
去使用 去使用
</view> </view>
<!-- #endif -->
</view> </view>
</view> </view>
</view> </view>
@ -120,14 +129,46 @@
</view> </view>
</view> </view>
</view> </view>
<view :style="{display: usercouFeedbackHidden}" class="popup_content">
<view class="popup_title font18 fcor333 fontwig6 paddtop10">温馨提示</view>
<view class="popup_title font16 fcor666 paddtop20 height60">领取优惠券后请在有效期三十天内使用</view>
<view class="width100 bor-botm1 mart10"></view>
<view class="alijus width90 mart20">
<view class="width40" style="margin-right: 5%;" @click="hideDiv()">
<view class="width100 btnno font16 ">取消</view>
</view>
<wx-open-launch-weapp style="width: 40%;margin-left: 5%;" id="launch-btn" username="gh_5fb54244cdbb">
<script type="text/wxtag-template">
<style>
.download {
color: #ffffff;
background: #0083f5;
width:100%;
height:100%;
align-items: center;
justify-content: center;
font-size: 16px;
}
</style>
<button class="download" style="height:40px;line-height: 40PX;width:100%;border:none;">立即使用</button>
</script>
</wx-open-launch-weapp>
</view>
</view>
<view class="popup_overlay" :style="{display: usercouFeedbackHidden}" @click="hideDiv()"></view>
</view> </view>
</template> </template>
<script> <script>
import { import {
getUserDiscountList getUserDiscountList,
verifyWx,
useDiscount
} from '../../../Utils/Api.js'; } from '../../../Utils/Api.js';
// #ifdef H5
var wx = require('jweixin-module');
// #endif
let app = getApp(); let app = getApp();
export default { export default {
data() { data() {
@ -148,7 +189,8 @@
pageSize: 10, pageSize: 10,
isNoMoreData: false, isNoMoreData: false,
loadingText: '', loadingText: '',
couponcout: 0 couponcout: 0,
usercouFeedbackHidden: 'none', //
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@ -160,6 +202,34 @@
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, 1000); }, 1000);
}, },
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
},
onLoad() { onLoad() {
this.getUserDiscountList(1); this.getUserDiscountList(1);
//H5 //H5
@ -256,18 +326,65 @@
} else if (e.highDiscount.useScope == 5) { } else if (e.highDiscount.useScope == 5) {
app.globalData.distinguishid = 2; app.globalData.distinguishid = 2;
uni.navigateTo({ uni.navigateTo({
url: '/qianzhu-KFC/buffet-order/buffet-order' url: '/qianzhu-KFC/buffet-order/buffet-order'
}) })
} else if (e.highDiscount.useScope == 6) { } else if (e.highDiscount.useScope == 6) {
uni.navigateTo({ uni.navigateTo({
url: '/member-Recharge/choicepage/choicepage' url: '/member-Recharge/choicepage/choicepage'
}) })
} else{ } else if (e.highDiscount.usingRange == 5) {
this.useDiscount(e.discountAgentCodeId);
} else {
uni.navigateTo({ uni.navigateTo({
url: '../mineCouponsDestails/mineCouponsDestails?id=' + e.id url: '../mineCouponsDestails/mineCouponsDestails?id=' + e.id
}) })
} }
},
//使
useDiscount(item) {
let datas = {
discountAgentCodeId: item
}
useDiscount(datas).then(res => {
if (res.return_code == '000000') {
this.onhiddle();
// #ifdef MP
uni.showModal({
title: '温馨提示',
content: '领取优惠券后请在有效期三十天内使用',
success: function(res) {
if (res.confirm) {
uni.navigateToMiniProgram({
appId: 'wx7cd1712834749dcb',
extraData: {
'data1': 'release'
},
success(res) {
//
}
})
}
}
})
// #endif
// #ifdef H5
// #endif
} else {
uni.showToast({
title: res.return_msg,
duration: 2000,
icon: 'none'
})
}
})
},
//
onhiddle() {
this.usercouFeedbackHidden = 'block';
},
hideDiv() { //
this.usercouFeedbackHidden = 'none';
}, },
switchType(type) { switchType(type) {
if (this.typeClass == type) { if (this.typeClass == type) {
@ -308,14 +425,71 @@
view { view {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
}
.btnsclick {
width: 50px;
height: 20px;
justify-content: center;
align-items: center;
font-size: 12px;
border-radius: 20px;
padding: 0 5px;
position: fixed;
margin-top: 50px;
} }
page { page {
position: relative;
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.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);
}
.btnno {
height: 40px;
line-height: 40PX;
display: flex;
justify-content: center;
color: #ffffff;
background: #999999;
}
.hidden { .hidden {
display: none !important; display: none !important;
} }

Loading…
Cancel
Save