From 8c6d0b2c8c8208fbde40a386083800b88a3ba2d8 Mon Sep 17 00:00:00 2001 From: iceling Date: Fri, 3 Jan 2020 18:06:23 +0800 Subject: [PATCH] 新人有礼数据填充 --- pages/giftpack/newvipgift/newvipgift.js | 363 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pages/giftpack/newvipgift/newvipgift.json | 5 ++++- pages/giftpack/newvipgift/newvipgift.wxml | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- pages/giftpack/newvipgift/newvipgift.wxss | 3 +-- 4 files changed, 247 insertions(+), 220 deletions(-) diff --git a/pages/giftpack/newvipgift/newvipgift.js b/pages/giftpack/newvipgift/newvipgift.js index b571253..3e3756b 100644 --- a/pages/giftpack/newvipgift/newvipgift.js +++ b/pages/giftpack/newvipgift/newvipgift.js @@ -5,197 +5,218 @@ var e = getApp(), t = e.request, d = e.globalData; Page({ + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + itemShow: false, //项目栏目是否显示 + cardShow: false, //代金券栏目是否显示 + packShow: false, //福利栏目是否显示 + textShow: false, //规则是否显示 + integralShow: true, //积分领取是否显示 + growUpShow: true, //成长值领取是否显示 + itemButton: '', + cardButton: '', + getActId: '', + getActType: '', + giftID: '', + receiveState: '一键全部领取', + textTitle: '', + getUrl: '', + noShow: false, + cards: [], //礼包内容--礼券 + itemWare: [], //礼包内容--服务项目 + integralTitle: "", + growUpTitle: "", + is_sub: 0, //是否重复领取 + }, + GetList: function() { + var th = this; + var url = "/api/weshop/marketing/giftbag/bound/get"; + getApp().request.promiseGet(url, { data: { - iurl: a.imghost, //图片前缀网址 - itemShow: false, //项目栏目是否显示 - cardShow: false, //代金券栏目是否显示 - packShow: false, //福利栏目是否显示 - textShow: false, //规则是否显示 - integralShow: true, //积分领取是否显示 - growUpShow: true, //成长值领取是否显示 - itemButton: '', - cardButton: '', - getActId: '', - getActType: '', - giftID: '', - getUserID: '', - getStorageID: '', - receiveState: '已领取', - integralTitle: '已领取', - growUpTitle: '已领取', - textTitle: '', - getUrl: '', - noShow: false, - cards: [], - itemWare: [] - }, - //判断中间的连接线是否显示 - itemShows: function itemShows() { - if (this.itemShow) { - if (this.cardShow) { - return true; + "actId": th.data.getActId, //活动id + "actType": th.data.getActType, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 + "giftBagId": th.data.giftID, //礼包ID + "storeId": a.stoid, //商家ID + "userId": d.user_id //用户ID + } + }).then(res => { + if (res.data.code == 0) { + if (res.data.data.lbCoupons != null) { + //礼包内容--礼券 + th.setData({ + cardShow: true, + cards: res.data.data.lbCoupons + }) + } + if (res.data.data.lbSM != null) { + //礼包内容--服务项目 + th.setData({ + itemShow: true, + itemWare: res.data.data.lbSM + }) + } + //礼包积分 + if (res.data.data.lbIntegral <= 0) { + if (res.data.data.lbGrowthValue <= 0) { + th.setData({ + packShow: false + }) } else { - return false; + th.setData({ + packShow: false, + integralShow: false, + growUpShow: true + }) } + } else { - if (this.cardShow) { - return false; + if (res.data.data.lbGrowthValue > 0) { + th.setData({ + packShow: true + }) } else { - return false; + th.setData({ + packShow: true, + integralShow: true, + growUpShow: false + }) } - } - }, - //判断中间的连接线是否显示 - cardShows: function cardShows() { - if (this.cardShow) { - if (this.packShow) { - return true; - } else { - return false; - } + th.setData({ + integralTitle: '领取' + res.data.data.lbIntegral + '积分', + growUpTitle: '领取' + res.data.data.lbGrowthValue + '成长值' + }) + if (res.data.data.receiveState == 0) { + th.setData({ + receiveState: '一键全部领取' + }) } else { - if (this.packShow) { - return false; - } else { - return false; - } + th.setData({ + receiveState: '已领取' + }) + } + if (res.data.data.actIntro != '') { + th.setData({ + textShow: true, + textTitle: res.data.data.actIntro + }) } - }, + } else { + getApp().my_warnning(res.data.msg, 0, th); + return false; + } + }) + }, + //判断中间的连接线是否显示 + itemShows: function() { + if (this.itemShow) { + if (this.cardShow) { + return true; + } else { + return false; + } + } else { + if (this.cardShow) { + return false; + } else { + return false; + } - onLoad: function onLoad(options) { + } + }, + //判断中间的连接线是否显示 + cardShows: function() { + if (this.cardShow) { + if (this.packShow) { + return true; + } else { + return false; + } + } else { + if (this.packShow) { + return false; + } else { + return false; + } - this.getActId = options.actId; //活动id - this.getActType = options.actType; //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 - this.giftID = options.giftBagId; //礼包ID - this.getStorageID = options.storeId; //商家ID - this.getUserID = options.userId; //用户ID - this.GetList(); + } + }, + onLoad: function onLoad(options) { + var th = this; + th.setData({ + getActId: options.actId, + getActType: options.actType, + giftID: options.giftBagId + }) + th.GetList(); }, onShow: function onShow() { - this.textTitle = this.textTitle.replace(/

0) { - _this.packShow = true; - } else { - _this.packShow = true; - _this.integralShow = true; - _this.growUpShow = false; - } - } - - _this.integralTitle = '领取' + res.data.data.lbIntegral + '积分'; - _this.growUpTitle = '领取' + res.data.data.lbGrowthValue + '积分'; - if (res.data.data.receiveState == 0) { - _this.receiveState = '一键全部领取'; - } else { - _this.receiveState = '已领取'; - } - - - if (res.data.data.actIntro != '') { - _this.textShow = true; - console.log(res.data.data.actIntro); - _this.textTitle = res.data.data.actIntro; - } - - } else { - console.log(res.data.msg); - } - } - }); - - }, - GetWebHttp: function GetWebHttp() { - this.getUrl = this.$GetInfo.HtmlHttp + '/mobile/index/index/stoid/' + this.getStorageID + '.html'; - window.location.href = this.getUrl; - }, - GetReceive: function GetReceive() { - var that = this; - if (that.receiveState == '已领取') { - return false; - } - uni.request({ - url: that.$GetInfo.ApiHttp + '/api/weshop/marketing/free/receive/gift/record/insert', - data: { - "actId": that.getActId, //活动Id - "actType": '1', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 - "lbId": that.giftID, //礼包Id - "storeId": that.getStorageID, //商家Id - "userId": that.getUserID //用户ID - }, - method: 'POST', + GetReceive: function() { + var th = this; + if (th.data.receiveState == '已领取') { + return false; + } + var is_sub = th.data.is_sub; //判断是否重复提交 + if (is_sub == 0) { + th.setData({ + is_sub: 1 + }) + + var json = { + "actId": th.data.getActId, //活动Id + "actType": 1, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 + "lbId": th.data.giftID, //礼包Id + "storeId": a.stoid, //商家Id + "userId": d.user_id //用户ID + }; + var data = JSON.stringify(json); + var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; + wx.request({ + url: url, + data: data, + method: 'post', header: { - 'Content-Type': 'application/json' //自定义请求头信息 - }, - success: function success(res) { - console.log(res.data); + 'content-type': 'application/json' + }, // 设置请求的 header + success: function(res) { + th.setData({ + is_sub: 0 + }) if (res.data.code == 0) { - console.log(res.data.msg); - that.receiveState = '已领取'; - uni.showToast({ - icon: 'none', - title: '领取成功!' - }); - + th.setData({ + receiveState: '已领取' + }) + getApp().my_warnning("领取成功", 1, th); } else { - console.log(res.data.msg); - uni.showToast({ - icon: 'none', - title: res.data.msg - }); - + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); } } - }); - + }) + } + }, + //界面跳转 + goto:function(e){ + var url = e.currentTarget.dataset.url; + getApp().goto(url); + }, + //图片失败,默认图片 + bind_bnerr1: function (e) { + var th = this; + var _errImg = e.target.dataset.errorimg; + var _Img = e.target.dataset.img; + if (_Img != undefined) { + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/giftbag/gift02.png"; + th.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; } + }, }); \ No newline at end of file diff --git a/pages/giftpack/newvipgift/newvipgift.json b/pages/giftpack/newvipgift/newvipgift.json index b818239..8699cd6 100644 --- a/pages/giftpack/newvipgift/newvipgift.json +++ b/pages/giftpack/newvipgift/newvipgift.json @@ -1,5 +1,8 @@ { "navigationBarTitleText": "新人礼", "navigationStyle": "custom", - "usingComponents": {} + "usingComponents": { + "warn": "/components/long_warn/long_warn", + "my_confirm": "/components/my_confirm/my_confirm" + } } \ No newline at end of file diff --git a/pages/giftpack/newvipgift/newvipgift.wxml b/pages/giftpack/newvipgift/newvipgift.wxml index 69961db..7cbb7a6 100644 --- a/pages/giftpack/newvipgift/newvipgift.wxml +++ b/pages/giftpack/newvipgift/newvipgift.wxml @@ -1,15 +1,15 @@ - + - + ______ - 新人专享\n你的美丽我来缔造 + 新人专享\n你的美丽我来缔造 ______ @@ -18,27 +18,27 @@ - - + + - + - + - 免费领取 + 免费领取 - {{item.fromName}} + {{item.fromName}} - {{item.fromName}} + {{item.fromName}} {{"新人可免费享受专业"+item.fromName+",可以享受"+item.num+"次。"}} @@ -49,13 +49,13 @@ - + - - + + - + @@ -71,22 +71,23 @@ - + + - 全场通用 + 全场通用 - 品牌限定 + 品牌限定 - 品类限定 + 品类限定 - 用途限定 + 用途限定 - 分类1限定 + 分类限定 {{item.sum+"元券"}} @@ -97,15 +98,15 @@ - - - - - + + + + + - + @@ -119,47 +120,50 @@ ——— - - + + - - + + - + - - - + + + - - - - 活动规则: + + + + 活动规则: - - + + - + - + 本活动最终解释权归公司所有,如果有问题请联系客服 - - - {{this.receiveState}} + + + {{receiveState}} - \ No newline at end of file + + + + \ No newline at end of file diff --git a/pages/giftpack/newvipgift/newvipgift.wxss b/pages/giftpack/newvipgift/newvipgift.wxss index 7a4b82a..d528db9 100644 --- a/pages/giftpack/newvipgift/newvipgift.wxss +++ b/pages/giftpack/newvipgift/newvipgift.wxss @@ -258,7 +258,6 @@ border-radius: 20rpx; } .foot_box_title { - font-size: 43rpx; color: #000000; padding: 20rpx 30rpx 20rpx 30rpx; } @@ -313,7 +312,7 @@ height: 70rpx; font-size: 28rpx; line-height: 70rpx; - border-radius: 30rpx 30rpx 30rpx 30rpx; + border-radius: 30rpx; } .foot_button_notbuy{ background: #999999; -- libgit2 0.21.4