Merge branch 'coupon-dev' into dev

# Conflicts:
#	pages/user/coupon/coupon.vue
yj-dev
杨杰 2 years ago
commit 328f958b30
  1. 4
      Utils/Api.js
  2. 2
      manifest.json
  3. 198
      pages/goods/externalCoupon/externalCoupon.vue
  4. 2
      pages/qianZhuPay/union-pay/union-pay.vue
  5. 187
      pages/user/coupon/coupon.vue

@ -199,6 +199,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);

@ -87,7 +87,7 @@
}, },
"devServer" : { "devServer" : {
"port" : "", "port" : "",
"https" : false "https" : true
}, },
"domain" : "https://hsgcs.dctpay.com", "domain" : "https://hsgcs.dctpay.com",
"template" : "index.html" "template" : "index.html"

@ -16,12 +16,57 @@
<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 backcor008">立即使用</view>
</view>
<view class="width40" style="margin-left: 5%;" @click="jumpCounlist">
<view class="width100 btnno fotct font16 backcor008">立即查看</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="product-list mart20 width90"> <view class="width90 mart30" v-if="couponsDetails.highDiscount.usingRange == 5">
<image :src="imagewxUrl+imgadres3" mode="widthFix" class="width100"
v-if="couponsDetails.highDiscountAgentCode.status ==1"></image>
<!-- <image :src="imagewxUrl+imgadres1" mode="widthFix" class="width100"
v-if="couponsDetails.highDiscountAgentCode.status != 1"></image> -->
<image :src="imagewxUrl+imgadres2" mode="widthFix" class="width100 mart10"
v-if="couponsDetails.highDiscountAgentCode.status != 1"></image>
</view>
<view class="product-list mart20 width90" v-if="couponsDetails.highDiscount.usingRange != 5">
<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)">
<image mode="widthFix" :src="imageUrl+product.highCoupon.couponImg"></image> <image mode="widthFix" :src="imageUrl+product.highCoupon.couponImg"></image>
@ -51,6 +96,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">请在有效期30天内使用过期作废</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 backcor99">取消</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 +135,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 +150,17 @@
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',
imgadres3: 'showCoupon.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 +206,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 +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) { getCouponByDiscount(item) {
let params = { let params = {
@ -179,6 +313,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 +401,12 @@
duration: 2000 duration: 2000
}) })
} }
},
//
jumpCounlist() {
uni.reLaunch({
url: '/pages/user/coupon/coupon'
})
} }
} }
@ -277,6 +418,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 +515,12 @@
background-color: red; background-color: red;
color: #FFFFFF; color: #FFFFFF;
} }
.btnno {
height: 40px;
line-height: 40PX;
display: flex;
justify-content: center;
color: #ffffff;
}
</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'

@ -18,7 +18,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">
@ -57,9 +57,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>
@ -135,14 +144,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">请在有效期30天内使用过期作废</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>
<view class="popup_overlay" :style="{display: usercouFeedbackHidden}" @click="hideDiv()"></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() {
@ -166,7 +207,8 @@
loadingText: '', loadingText: '',
couponcout: 0, couponcout: 0,
orderTyplist: ['全部订单', '在线加油', '肯德基', '星巴克', '话费充值', '卡券订单'], // orderTyplist: ['全部订单', '在线加油', '肯德基', '星巴克', '话费充值', '卡券订单'], //
ordertypeid: 1 //id ordertypeid: 1, //id
usercouFeedbackHidden: 'none', //
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@ -178,6 +220,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() {
// #ifdef H5 // #ifdef H5
this.headerTop = '44PX'; this.headerTop = '44PX';
@ -275,14 +345,60 @@
}) })
}else if (e.highDiscount.useScope == 7) { }else if (e.highDiscount.useScope == 7) {
uni.navigateTo({ uni.navigateTo({
url: '../../goods/refuel/refuel' url: '/pages/goods/refuel/refuel'
}) })
} else if (e.highDiscount.usingRange == 5) {
this.useDiscount(e.discountAgentCodeId);
} else { } 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') {
// #ifdef MP
uni.showModal({
title: '温馨提示',
content: '请在有效期30天内使用。过期作废!',
success: function(res) {
if (res.confirm) {
uni.navigateToMiniProgram({
appId: 'wx7cd1712834749dcb',
extraData: {
'data1': 'release'
},
success(res) {
//
}
})
}
}
})
// #endif
// #ifdef H5
this.onhiddle();
// #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) {
@ -323,7 +439,18 @@
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;
} }
.srollview { .srollview {
@ -364,10 +491,56 @@
} }
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