Commit 1e564142 by 程南

修改领券中心

parent 35c0a533
......@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应
const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 有直播
//2006 泰华 , wx40fec8944623c8b3 有直播 //门户 wx833d5ece112fc3fd
......@@ -26,7 +26,7 @@ const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门
//2002 巴黎贝甜 wx21968cb3a486d4ab
//2014 包小姐与鞋先生 wxa00302e2f53dd9c5
const BRANCH_ID = 1002
const BRANCH_ID = 1001
const isMall = true
// const needMock = '' //
......
......@@ -13,7 +13,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.8.2",
"appid": "wxac09792264c49b5c",
"appid": "wxc3b64b09b1d3dfc2",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": {
"hidedInDevtools": []
......@@ -652,6 +652,12 @@
"pathName": "subPackageA/page/pages/moneyBuyCoupon/moneyBuyCoupon",
"query": "",
"scene": null
},
{
"id": -1,
"name": "领券中心",
"pathName": "subPackage/page/pages/couponCenter/couponCenter",
"scene": null
}
]
}
......
......@@ -10,8 +10,8 @@ wxService.page({
data: {
query: '',
integralCouponList: [], // 积分兑换优惠券列表
showDialog : false,
dialogPicture : '',
showDialog: false,
dialogPicture: '',
},
......@@ -39,7 +39,7 @@ wxService.page({
//判断活动开始时间是不是已经开始了
item.isStart = true;
//判断是不是老活动
if(item.couponList){
if (item.couponList) {
item.isStart = util.compareCurrentDate(item.startTime);
}
});
......@@ -51,7 +51,7 @@ wxService.page({
}
}
if(refresh){
if (refresh) {
wx.showToast({
title: '刷新成功',
});
......@@ -71,52 +71,86 @@ wxService.page({
const { id } = e.currentTarget.dataset;
let item = e.currentTarget.dataset.item;
//先判断是不是老的活动
if(!item.couponList){
this.getCoupon(id,item);
return ;
if (!item.couponList) {
this.getCoupon(id, item);
return;
}
if(isStart){
this.getCoupon(id,item);
if (isStart) {
this.getCoupon(id, item);
}
//预约
else{
this.orderCouponActivity(id,item);
else {
this.orderCouponActivity(id, item);
}
},
//立即领取
getCoupon(id,item){
getCoupon(id, item) {
wxService.post(`/coupon/couponCenterActivity/buyer/coupon/draw?id=${id}`).then(res => {
wx.hideLoading();
if(res){
if(res.data.result == 0){
if (res) {
if (res.data.result == 0) {
//判断是不是老活动
if(item.couponList){
if (item.couponList) {
this.data.showDialog = true;
this.data.dialogPicture = item.dialogPicture;
this.setData({
showDialog : this.data.showDialog,
dialogPicture : this.data.dialogPicture
showDialog: this.data.showDialog,
dialogPicture: this.data.dialogPicture
});
}
else{
else {
wx.showToast({
title: '领取成功!',
});
}
}
else{
else {
wx.showToast({
title: '领取失败,请稍后再试',
icon : 'none'
icon: 'none'
});
}
}
});
},
//立即预约
orderCouponActivity(id){
orderCouponActivity(id) {
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgMapping/getListByParams'}`, {
scenarioIds: ['usernoticeappointment'],
sourceFrom: 2,
switchType: 3
}).then(res => {
let tempArr = res.data.data ? res.data.data : [];
if (tempArr.length == 0) {
return;
}
let tempids = [];
tempArr.map(item => {
tempids.push(item.templateId);
});
wx.requestSubscribeMessage({
tmplIds: tempids,
success: (res) => {
for (let i = 0; i < tempArr.length; i++) {
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: id,
memberId: baseUserInfo.memberId,
scenarioId: tempArr[i].scenarioId,
templateId: tempArr[i].templateId
}).then(resp => { });
}
},
complete: (res) => {
}
})
}).catch(err => {
})
},
//跳转到详情
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment