diff --git a/components/nav_b/nav_b.wxss b/components/nav_b/nav_b.wxss index b71a95c..d3d8838 100644 --- a/components/nav_b/nav_b.wxss +++ b/components/nav_b/nav_b.wxss @@ -22,6 +22,7 @@ text-align: center; width: 80rpx; height: 80rpx; + line-height: 66rpx; color: #ffff; font-size: 50rpx; background: none; diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index ed1aa98..dd2f08c 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -47,7 +47,6 @@ Page({ var my_confirm = th.selectComponent("#my_confirm"); //组件的id var order_sn = e.currentTarget.dataset.order_sn; //订单号 var money = e.currentTarget.dataset.money; //支付金额 - my_confirm.open( "是否确定购买该礼包", "取消", @@ -57,9 +56,6 @@ Page({ }, function() { my_confirm.open_cancel(0); - wx.showLoading({ - title: '加载中', - }) var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -99,37 +95,7 @@ Page({ } ) - wx.request({ - url: url, - data: data, - method: 'post', - header: { - 'content-type': 'application/json' - }, // 设置请求的 header - success: function(res) { - wx.hideLoading(); - if (res.data.code == 0) { - var order_sn = res.data.data.orderSn; - res = res.data.data.result; - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; - wx.requestPayment({ - timeStamp: String(res.timeStamp), - nonceStr: res.nonceStr, - package: res.packageValue, - signType: res.signType, - paySign: res.paySign, - success: function(res) { - getApp().goto(url); - }, - fail: function(res) { - getApp().my_confirm("取消支付", 0, th); - } - }); - } else { - getApp().my_warnning(res.data.msg, 0, th); - } - } - }) + } @@ -151,9 +117,6 @@ Page({ }, function() { my_confirm.open_cancel(0); - wx.showLoading({ - title: '加载中', - }) var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -191,8 +154,7 @@ Page({ page: th.data.pages, pageSize: th.data.pageSize }, - success: function success(res) { - wx.hideLoading(); + success: function(res) { if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -236,9 +198,7 @@ Page({ var th = this; if (th.data.total <= th.data.pageSize) return; if (th.data.ismore) return; - wx.showLoading({ - title: '加载中...', - }) + th.getList(); }, //图片失败,默认图片 diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 050415b..ec28d16 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -61,7 +61,7 @@ Page({ }, function() { my_confirm.open_cancel(0); - + var json = { "actId": '', //活动Id "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -74,36 +74,36 @@ Page({ var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; - getApp().request.json_post(url,json, - function(res){ - if (res.data.code == 0) { - var res = res.data.data; - var order_sn = res.orderSn; - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; - wx.requestPayment({ - timeStamp: String(res.result.timeStamp), - nonceStr: res.result.nonceStr, - package: res.result.packageValue, - signType: res.result.signType, - paySign: res.result.paySign, - success: function (n) { - getApp().goto(url); - }, - fail: function (n) { - getApp().my_confirm("取消支付", 0, th); - } - }); - } else { - getApp().my_warnning(res.data.msg, 0, th); + getApp().request.json_post(url, json, + function(res) { + if (res.data.code == 0) { + var res = res.data.data; + var order_sn = res.orderSn; + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn; + wx.requestPayment({ + timeStamp: String(res.result.timeStamp), + nonceStr: res.result.nonceStr, + package: res.result.packageValue, + signType: res.result.signType, + paySign: res.result.paySign, + success: function(n) { + getApp().goto(url); + }, + fail: function(n) { + getApp().my_confirm("取消支付", 0, th); + } + }); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } + }, + function(res) { + } - }, - function(res){ - } + ) - ) - } @@ -136,18 +136,18 @@ Page({ var data = JSON.stringify(json); var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; getApp().request.json_post(url, json, - function (res) { - if (res.data.code == 0) { - getApp().my_warnning("兑换成功!", 1, th); - } else { - getApp().my_warnning(res.data.msg, 0, th); - } + function(res) { + if (res.data.code == 0) { + getApp().my_warnning("兑换成功!", 1, th); + } else { + getApp().my_warnning(res.data.msg, 0, th); + } }, - function (res) { + function(res) { } - ) + ) }) @@ -156,13 +156,13 @@ Page({ var _this = this; var th = this; getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { + isShowLoading: true, data: { "storeId": a.stoid, //商家ID "userId": d.user_id, //用户ID "orderSn": th.data.orderSn }, - success: function success(res) { - wx.hideLoading(); + success: function(res) { if (res.data.code == 0) { th.setData({ giftImage: th.data.iurl + res.data.data.lbUrl, @@ -224,6 +224,7 @@ Page({ var _this2 = this; var th = this.data; getApp().request.get('/api/weshop/marketing/giftbag/detail/get', { + isShowLoading: true, data: { "storeId": a.stoid, //商家ID "userId": d.user_id, //用户ID @@ -278,9 +279,6 @@ Page({ //获取核销码 getcode: function() { var th = this; - wx.showLoading({ - title: '加载中', - }) var orderSn = th.data.orderSn; //订单号 var json = { "storeId": a.stoid, @@ -288,15 +286,8 @@ Page({ }; var data = JSON.stringify(json); var url = th.data.url + "/api/weshop/marketing/gift/goods/verify/code/get"; //预约接口地址 - wx.request({ - url: url, - data: data, - method: 'put', - header: { - 'content-type': 'application/json' - }, // 设置请求的 header - success: function(res) { - wx.hideLoading(); + getApp().request.json_post(url, json, + function(res) { if (res.data.code == 0) { th.setData({ code: res.data.data @@ -305,8 +296,14 @@ Page({ } else { getApp().my_warnning(res.data.msg, 0, th); } - } - }) + }, + function(res) { + + }, + "put" + + ) + }, //界面跳转 goto: function(e) { diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxml b/pages/giftpack/giftpacklist/giftpacklist.wxml index a19778b..d72bc94 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.wxml +++ b/pages/giftpack/giftpacklist/giftpacklist.wxml @@ -37,7 +37,7 @@ 礼包内容 - + diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 5108445..6708adf 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -52,7 +52,6 @@ Page({ pageSize: th.data.pageSize }, success: function success(res) { - wx.hideLoading(); if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -97,9 +96,6 @@ Page({ var th = this; if (th.data.total <= th.data.pageSize) return; if (th.data.ismore) return; - wx.showLoading({ - title: '加载中...', - }) th.getList(); }, //图片失败,默认图片 diff --git a/pages/giftpack/newvipgift/newvipgift.js b/pages/giftpack/newvipgift/newvipgift.js index d19ccc0..601e05c 100644 --- a/pages/giftpack/newvipgift/newvipgift.js +++ b/pages/giftpack/newvipgift/newvipgift.js @@ -33,10 +33,8 @@ Page({ GetList: function() { var th = this; var url = "/api/weshop/marketing/giftbag/bound/get"; - wx.showLoading({ - title: '加载中', - }) getApp().request.promiseGet(url, { + isShowLoading: true, data: { "actId": th.data.getActId, //活动id "actType": 1, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 @@ -45,7 +43,6 @@ Page({ "userId": d.user_id //用户ID } }).then(res => { - wx.hideLoading(); if (res.data.code == 0) { if (res.data.data.lbCoupons != null && res.data.data.lbCoupons.length > 0) { //礼包内容--礼券 @@ -137,9 +134,6 @@ Page({ th.setData({ is_sub: 1 }) - wx.showLoading({ - title: '加载中', - }) var json = { "actId": th.data.getActId, //活动Id "actType": 1, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 @@ -149,15 +143,8 @@ Page({ }; 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' - }, // 设置请求的 header - success: function(res) { - wx.hideLoading(); + getApp().request.json_post(url, json, + function(res) { th.setData({ is_sub: 0 }) @@ -169,8 +156,13 @@ Page({ } else { getApp().my_warnning(res.data.msg, 0, th); } - } - }) + }, + function(res) { + + }, "post" + + ) + } }, //界面跳转 diff --git a/pages/user/assistance/assistance.js b/pages/user/assistance/assistance.js index df28cf6..41d119f 100644 --- a/pages/user/assistance/assistance.js +++ b/pages/user/assistance/assistance.js @@ -24,8 +24,8 @@ Page({ is_show_more: 0, //是否加载更多 help_id:"",//助力活动的id timer:"",//任务列表的定时器 - s_num:"",//多少人已经领取任务 - + s_num:"",//多少人已经领取任务 + page:1,//我的任务的当前页 }, /** @@ -34,7 +34,7 @@ Page({ onLoad: function(options) { var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id - nav_b.set_name("助力", ""); + nav_b.set_name("助力", "/pages/user/assistance/assistance"); // 助力活动 this.assistance(); }, @@ -43,12 +43,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { - var th=this; - this.data.timer= setInterval(function () { - th.get_list(); - - },2000) - + }, // 助力活动 assistance() { @@ -63,10 +58,13 @@ Page({ } }).then(res => { if (res.data.code == 0) { - var help_data=res.data.data; - console.log(help_data.id,'数据', res.data.data); th.setData({ zl_act:help_data, help_id:help_data.id }); + if (th.data.help_id != "" && th.data.help_id!=null) { + //我的任务 + th.get_list(); + } + return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", { data: { helpId: help_data.id, storeId: store_id @@ -85,39 +83,54 @@ Page({ //--点击获取用户任务列表--会员的任务列表 get_list:function() { + var th = this; + var page=th.data.page; var help_id=this.data.help_id; t.request.get("/api/weshop/marketing/help/help/user/page", { data: { userId:getApp().globalData.user_id, storeId: os.stoid, - helpId: help_id + helpId: help_id, + page: page, + pageSize:5 }, success: function(res) { clearTimeout(th.data.timer); - - if (!th.data.is_load) th.setData({ + + if (!th.data.is_load) + th.setData({ is_load: 1 }) + + if (res.data.code == 0) { - + var list = th.data.zl_user_list; - list = list.concat(res.data.data.pageData) //连接数组 + //连接数组 + list = list.concat(res.data.data.pageData); th.setData({ - zl_user_list: list + zl_user_list: list, + is_load: 1, }); - var n_all_num = th.data.cur_page * th.data.page_num; - if (res.data.data.total > n_all_num) th.setData({ - is_show_more: 1 - }) - else th.setData({ - is_show_more: 0 - }) - //页吗要更新一下 - th.data.cur_page++; + if (res.data.data.total <= 5) { + th.setData({ + is_show_more: 1 + }) + }else{ + var page = th.data.page + 1; + th.setData({ + is_show_more: 0, + page: page + }) + } + } else { + + getApp().showWarning("暂无更多内容",0); th.setData({ - is_show_more: 0 + is_show_more: 1, + page: page }) } @@ -127,8 +140,8 @@ Page({ //-----跳转到领取礼包的页面------ go_task: function() { + var help_id=this.data.help_id; - getApp().goto("/pages/user/assistance/task_assistance?help_id="+help_id); }, switch_head: function (e) { @@ -148,5 +161,17 @@ Page({ var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); }, - + // 领取礼包 + get_libao:function(e){ + var libao_id=e.currentTarget.dataset.libaoid; + var completeid= e.currentTarget.dataset.completeid; + + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); + }, + //查看礼包id + select_libao:function(){ + var libao_id = e.currentTarget.dataset.libaoid; + var ordersn = e.currentTarget.dataset.orderid; + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0 + "&ordersn=" + ordersn ); + } }) \ No newline at end of file diff --git a/pages/user/assistance/assistance.json b/pages/user/assistance/assistance.json index d1cfde4..63f5fe9 100644 --- a/pages/user/assistance/assistance.json +++ b/pages/user/assistance/assistance.json @@ -1,5 +1,5 @@ { - "navigationBarTitleText": "好友助力", + "navigationBarTitleText": "好友助力,得好礼", "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", diff --git a/pages/user/assistance/assistance.wxml b/pages/user/assistance/assistance.wxml index eb5cf9b..8b09dca 100644 --- a/pages/user/assistance/assistance.wxml +++ b/pages/user/assistance/assistance.wxml @@ -1,4 +1,5 @@ + @@ -7,7 +8,7 @@ - + 机会总是留给最有行动力的人 @@ -15,7 +16,7 @@ 活动时间: - {{filter.fm_time(zl_act.beginDate)}}-{{filter.fm_time(zl_act.endDate)}} + {{filter_s.format_time(zl_act.beginDate,0)}} 至 {{filter_s.format_time(zl_act.endDate,0)}} @@ -45,24 +46,25 @@ - {{item.help_taskname}} + {{item.helpTaskName}} - - 领取礼包 + + 领取礼包 - - {{item.helped}}/{{item.help_num}} + + {{item.zlHelpNum}}/{{item.helpNum}} - - 查看礼包 + + 查看礼包 - + 点击加载更多 diff --git a/pages/user/assistance/assistance_success.json b/pages/user/assistance/assistance_success.json index 5467480..d494c4d 100644 --- a/pages/user/assistance/assistance_success.json +++ b/pages/user/assistance/assistance_success.json @@ -1,4 +1,6 @@ { + "navigationBarTitleText": "好友助力,得好礼", + "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm", diff --git a/pages/user/assistance/friend_assistance.js b/pages/user/assistance/friend_assistance.js index 5d6217f..6d51dec 100644 --- a/pages/user/assistance/friend_assistance.js +++ b/pages/user/assistance/friend_assistance.js @@ -32,54 +32,53 @@ Page({ if (options.userId) this.data.userId = options.userId; //任务是不是为空 if (this.data.tasking == 0 || this.data.tasking == undefined) { - //this.data.task_id = decodeURIComponent(options.scene); - this.data.tasking =1; - if (this.data.tasking != null && this.data.tasking != 'undefined' && this.data.tasking != "" && this.data.tasking != - 0) { - getApp().request.promiseGet("/api/weshop/marketing/help/help/tasking/get", { - data: { - id: th.data.tasking, - storeId: os.stoid - } - }).then(res => { - if (res.data.code == 0) { - th.data.userId = res.data.data.userId; - th.data.taskId = res.data.data.taskId; - //获取活动的时间 - return getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", { - data: { - helpId: res.data.data.helpFormId, - storeId: os.stoid - } - }) - } - return ut.null_promise(); - }).then(res => { - if (res.data.code == 0) { - th.setData({ - zl_act: res.data.data - }) - //获取活动的参与的人数 - return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", { - data: { - helpId: res.data.data.id, - storeId: os.stoid - } - }) - } - return ut.null_promise(); - }).then(res => { - if (res.data.code == 0) { - th.setData({ - s_num: res.data.data.countAll - }); - } - }) - - } + this.data.tasking = decodeURIComponent(options.scene); } - }, + if (this.data.tasking != null && this.data.tasking != 'undefined' && this.data.tasking != "" && this.data.tasking != + 0) { + getApp().request.promiseGet("/api/weshop/marketing/help/help/tasking/get", { + data: { + id: th.data.tasking, + storeId: os.stoid + } + }).then(res => { + if (res.data.code == 0) { + th.data.userId = res.data.data.userId; + th.data.taskId = res.data.data.taskId; + //获取活动的时间 + return getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", { + data: { + helpId: res.data.data.helpFormId, + storeId: os.stoid + } + }) + } + return ut.null_promise(); + }).then(res => { + if (res.data.code == 0) { + th.setData({ + zl_act: res.data.data + }) + //获取活动的参与的人数 + return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", { + data: { + helpId: res.data.data.id, + storeId: os.stoid + } + }) + } + return ut.null_promise(); + }).then(res => { + if (res.data.code == 0) { + th.setData({ + s_num: res.data.data.countAll + }); + } + }) + + } + }, // 跳转到助力成功页 participate_activity: function() { @@ -132,7 +131,7 @@ Page({ var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); - nav_b.set_name("助力", ""); + nav_b.set_name("助力", "/pages/user/assistance/assistance"); }, /** diff --git a/pages/user/assistance/friend_assistance.json b/pages/user/assistance/friend_assistance.json index 2ee27f1..63f5fe9 100644 --- a/pages/user/assistance/friend_assistance.json +++ b/pages/user/assistance/friend_assistance.json @@ -1,4 +1,6 @@ { + "navigationBarTitleText": "好友助力,得好礼", + "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", "my_confirm": "/components/my_confirm/my_confirm", diff --git a/pages/user/assistance/giftpacklist.js b/pages/user/assistance/giftpacklist.js index dc7ffbb..a4c09b9 100644 --- a/pages/user/assistance/giftpacklist.js +++ b/pages/user/assistance/giftpacklist.js @@ -28,144 +28,120 @@ Page({ code: "", //核销码 c_state: "0", //判断是否已经使用, 0正常 1已使用 2已过期 is_lb: 0, //是否有礼包 + receiveState: 0, //0未领取 1已领取 + completeid: "", + is_sub: 0, //判断是否重复提交 + is_libao: 0, //0轮播查看活动 1领取礼包 2.查看礼包详情 + held_id: "", //活动id + taskId: "", //任务id + orderSn: "", //订单号 }, - onLoad: function (options) { + onLoad: function(options) { var th = this; - th.setData({ - isBuy: options.isBuy, - getStorageID: a.stoid, - getUserID: d.user_id, - getGiftID: options.lbId, - orderSn: options.orderSn - }) - if (options.isBuy == 0) { - th.GetMyGiftList(); - } else { + if (options.is_libao == 0) { + th.setData({ + held_id: options.help_id, //options.help_id + taskId: options.taskId, //options.libao_id + }) + th.help(); + } + if (options.is_libao == 1) { + th.setData({ + taskId: options.libao_id, + held_id: options.held_id + }) th.GetBuyGiftList(); } - th.setData({ - giftRemark: th.data.giftRemark.replace(/

{ + if (res.data.code == 0) { + th.setData({ + giftImage: th.data.iurl + res.data.data.lbUrl, + giftTitle: res.data.data.giftTitle + }) + if (res.data.data.giftRemark == '') { + th.setData({ + giftRemark: '暂无详情......' + }) + } else { + th.setData({ + giftRemark: res.data.data.giftRemark.replace(/\ {{giftTitle}} - + {{"兑换截至时间:"+giftDate}} @@ -67,7 +67,7 @@ - + @@ -76,13 +76,13 @@ - + - + - + 奖励已发放 @@ -95,52 +95,41 @@ 活动说明 - + - - - - - 立即购买 - - - - - 立即兑换 - - - - - 立即购买 - - - - - 立即兑换 - - - - - - - 无核销商品 - + + + + 已领取 + + + + + 一键全部领取 + + - - 立即使用 - - - 商品已核销 - - - 商品兑换时间已过 - - + + + 无核销商品 + + + + + 立即使用 + + + 商品已核销 + + + 商品兑换时间已过 + + diff --git a/pages/user/assistance/giftpacklist.wxss b/pages/user/assistance/giftpacklist.wxss index 3d906ad..5c97c3b 100644 --- a/pages/user/assistance/giftpacklist.wxss +++ b/pages/user/assistance/giftpacklist.wxss @@ -1,4 +1,4 @@ -@charset "UTF-8"; + @charset "UTF-8"; /* Author XGQ * 2019-12-12 diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index 3f60597..7d50b95 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -24,17 +24,18 @@ Page({ aitem: "", //活动的轮播图数据 switch_head: 0, //0:我的任务,1:记录 help_id: "", //活动的id canvasHidden: 0, //分享图片是否已经生成 - is_share: 1, //是否显示画布 - shareImgPath: [], //生成的图片 - screenWidth: "", //用户的屏幕宽度 gid: "", timer: null, //全局的定时器 user_task_list: null, //会员列表 taskid: "", //任务id usercount: 0, //参与的人数 dismantle: null, //帮拆记录数据集 - is_shares:111111,//判断是不是要分享的 - + is_user_task: null, //判断是不是领取的任务 + zzjx_id: "", //真正进行的任务id + is_show:0,//任务的加载更多 + is_bc_show:0,//帮拆的加载更多 + bc_page:1,//帮拆的页码 + rw_page:1,//任务的页码 //*********************************************start钱 canvasHidden: 0, //分享图片是否已经生成 is_share: 0, //是否显示画布 @@ -50,6 +51,7 @@ Page({ already: 0, //已有几人助力 lack: 0, //还差几人助力 zltime: "", //助力时间 + djs: "", //定时器的显示 //*********************************************end }, @@ -70,7 +72,7 @@ Page({ } th.close(); th.syinfo(); - // th.imageinfo(); + th.imageinfo(); //end }, @@ -89,10 +91,12 @@ Page({ taskId: taskid }, function(res) { - if (res.data.code == 0) { - console.log(res.data.data); getApp().my_warnning(res.data.data, 1, th); + //判断是不是领取的任务 + th.get_user_task(); + //会员任务列表 + th.user_task_list(); } else { getApp().my_warnning(res.data.msg, 0, th); } @@ -128,17 +132,21 @@ Page({ }, success: function(res) { if (res.data.code == 0) { - var help_data = res.data.data; - console.log('助力活动(判断)', res.data.data); th.setData({ endDate: help_data.endDate, }); + //任务时间 设置全局定时器 + th.setData({ + timer:setInterval(function () { + th.countDown(); + }, 1000) + }) + + } } - - }); @@ -171,29 +179,28 @@ Page({ }); var task_number = data_aissa[0].giftQty - data_aissa[0].useGiftQty; var taskid = data_aissa[0].id; - + console.log("参考", data_aissa); th.setData({ aitem: data_aissa, task_number: task_number, taskid: taskid }); - + //判断是不是领取的任务 + th.get_user_task(); } } }) + // 分享的 // setTimeout(function() { // th.shareFrends(); // }, 1000) - //任务时间 设置全局定时器 - th.data.timer = setInterval(function() { - th.countDown(); - }, 1000); + //会员任务列表 this.user_task_list(); - // 获取会员的参与的任务列表 我的任务 + //获取助力活动参与的人数 this.get_user_task_num(); }, @@ -209,36 +216,65 @@ Page({ var sw_index = this.data.sw_index; //轮播的下标 //任务id var taskid = aitem[sw_index].id; - console.log("任务id", taskid); var th = this; var index = 1; //获取当前选择的是任务还是活动说明 - var is_task = th.data.is_task; //0任务,1帮拆 - console.log("0任务,1帮拆", is_task, ); - th.setData({ + var is_task = this.data.is_task; //0任务,1帮拆 + if (is_task == undefined || is_task == null) { + is_task = 1; + } + var switch_head = this.data.switch_head; + if (switch_head == undefined || switch_head == null) { + switch_head = 1; + } + this.setData({ is_task: 1, switch_head: 1 }); + var bc_page = th.data.bc_page; rq.get("/api/weshop/marketing/help/help/task/involve/page", { data: { + page: bc_page, + pageSize: 5, taskId: taskid, userId: getApp().globalData.user_id, storeId: os.stoid }, success: function(res) { - if (res.data.code == 0) { - var dismantle = res.data.data.pageData; + var dismantle = res.data.data.pageData[0].zlHelpUser; + if(res.data.data.total>5){ + var bc_page = th.data.bc_page + 1; + th.data({ bc_page: bc_page, + is_bc_show:1 + }) + }else{ + getApp().showWarning("暂无更多内容", 0); + } + th.setData({ dismantle: dismantle }); + } else { + th.setData({ + dismantle: null + }); } } }) - - }, - + // 领取礼包 + get_libao: function(e) { + var libao_id = e.currentTarget.dataset.libaoid; + var completeid = e.currentTarget.dataset.completeid; + console.log("礼包id", libao_id); + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&completeid=" + completeid); + }, + //查看礼包id + select_libao: function() { + var libao_id = e.currentTarget.dataset.libaoid; + getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 0); + }, //划动的时候监听 onSli: function(e) { @@ -246,55 +282,105 @@ Page({ var ind = e.detail.current; var aitem = this.data.aitem; var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; - console.log("划动的任务总数", task_number, "任务所有的参数", aitem); + var task_id = aitem[ind].id; + console.log("划动的任务总数", task_number, "任务所有的参数", aitem, + "任务id", task_id); th.setData({ sw_index: ind, - task_number: task_number + task_number: task_number, + taskid: task_id }); - console.log("可以领取的的任务数", aitem[ind].giftQty, '已领取的任务数据', aitem[ind].useGiftQty); + + if (this.data.switch_head == 1) { + //判断有没有帮拆记录 + this.dismantle_record(); + } + //判断是不是领取的任务 + th.get_user_task(); + }, //导航球 close: function() { var th = this; var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); - nav_b.set_name("助力", ""); + nav_b.set_name("助力", "/pages/user/assistance/assistance"); }, // 获取会员的参与的任务列表 我的任务 user_task_list: function(e) { var th = this; - var index = 0; - var is_task = th.data.is_task; //0任务,1活动说明 + var is_task = this.data.is_task; //0任务,1帮拆 + if (is_task == undefined || is_task == null) { + is_task = 0; + } + var switch_head = this.data.switch_head; + if (switch_head == undefined || switch_head == null) { + switch_head = 0; + } + this.setData({ + is_task: index, + switch_head: index + }); var help_id = th.data.help_id; var user_id = getApp().globalData.user_id; + var rw_page=th.data.rw_page; rq.get("/api/weshop/marketing/help/help/user/page", { data: { + page:rw_page, + pageSize:5, helpId: help_id, storeId: os.stoid, userId: user_id }, success: function(su) { - th.setData({ - is_task: index, - switch_head: index - }); if (su.data.code == 0) { + if (su.data.data.total > 5){ + th.setData({ + rw_page: rw_page, + is_show: 1 + }) + getApp().showWarning("暂无更多内容", 0); + }else{ + var rw_page = th.data.rw_page + 1; + th.setData({ + rw_page: rw_page, + + }) + } var user_list = su.data.data.pageData; - console.log("会员列表", user_list); th.setData({ user_task_list: user_list }); - } else { + } + } + }) + }, + //判断是否有领取任务 获取正在进行中的任务 + get_user_task: function() { + var user_id = getApp().globalData.user_id; + var th = this; + var aitem = th.data.aitem; + var sw_index = th.data.sw_index; + var taskid = aitem[sw_index].id + rq.get("/api/weshop/marketing/help/help/task/get", { + data: { + storeId: os.stoid, + userId: user_id, + taskId: taskid + }, + success: function(res) { + if (res.data.code == 0) { + var is_usertask = res.data.data; th.setData({ - user_task_list: null + is_user_task: is_usertask }); } } }) }, //获取助力活动参与的人数 - get_user_task_num() { + get_user_task_num: function() { var th = this; var help_id = th.data.help_id; rq.get("/api/weshop/marketing/help/involve/help/act/people/count", { @@ -310,8 +396,6 @@ Page({ th.setData({ usercount: usercount }); - } else { - } } }) @@ -331,7 +415,7 @@ Page({ if (swiperError >= 3) { //在开关被触发3次以上 console.error(this.data.swiperError) this.setData({ - goodsIndex: this.data.preIndex + sw_index: this.data.preIndex }); //,重置current为正确索引 this.setData({ swiperError: 0 @@ -351,32 +435,41 @@ Page({ // 轮播图点击左边 click_pre: function() { - console.log("轮播图点击左边"); var index = this.data.sw_index; index--; if (index < 0) return; var aitem = this.data.aitem; var task_number = aitem[index].giftQty - aitem[index].useGiftQty; + var task_id = aitem[index].id; this.setData({ sw_index: index, - task_number: task_number + task_number: task_number, + taskid: task_id }) - + if (this.data.switch_head == 1) { + //判断有没有帮拆记录 + this.dismantle_record(); + } + //判断有没有领取任务 + this.get_user_task(); }, //轮播图点击右边 click_next: function() { var index = this.data.sw_index; index++; - console.log("轮播图点击右边"); if (index >= this.data.aitem.length) return; var aitem = this.data.aitem; var task_number = aitem[index].giftQty - aitem[index].useGiftQty; + var task_id = aitem[index].id; this.setData({ sw_index: index, - task_number: task_number + task_number: task_number, + taskid: task_id }) - + if (this.data.switch_head == 1) { + this.dismantle_record(); + } }, /** @@ -384,8 +477,7 @@ Page({ */ onHide: function() { //--清理定时器-- - console.log("清理定时器"); - clearInterval(this.timer); + clearInterval(this.data.timer); }, /** @@ -407,52 +499,42 @@ Page({ var th = this; // 获取当前时间,同时得到活动结束时间数组 var newTime = ut.gettimestamp(); - var List = this.data.aitem; - for (var j = 0; j < List.length; j++) { - var o = List[j]; - - // 对结束时间进行处理渲染到页面 - - // var o = endTimeList[i]; - var endTime = o.endDate - - // if (o.status == 0) endTime = o.start_time - - var obj = null; - // 如果活动未结束,对时间进行处理 - if (endTime - newTime > 0) { - - var time = (endTime - newTime); - // 获取天、时、分、秒 - var day = parseInt(time / (60 * 60 * 24)); - var hou = parseInt(time % (60 * 60 * 24) / 3600); - var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); - var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); - obj = { - day: this.timeFormat(day), - hou: this.timeFormat(hou), - min: this.timeFormat(min), - sec: this.timeFormat(sec) - } - } else { - //活动已结束,全部设置为'00' - obj = { - day: '00', - hou: '00', - min: '00', - sec: '00' - } + // 对结束时间进行处理渲染到页面 + + // var o = endTimeList[i]; + var endTime = th.data.endDate; + console.log("结束时间5555555", endTime); + // if (o.status == 0) endTime = o.start_time + + var obj = null; + // 如果活动未结束,对时间进行处理 + if (endTime - newTime > 0) { + var time = (endTime - newTime); + // 获取天、时、分、秒 + var day = parseInt(time / (60 * 60 * 24)); + var hou = parseInt(time % (60 * 60 * 24) / 3600); + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec) + } + } else { + //活动已结束,全部设置为'00' + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00' } - var txt = "aitem[" + j + "]djs"; - th.setData({ - [txt]: obj - }); - - } - setTimeout(th.countDown, 1000); - + var txt = "aitem[" +0+ "].djs"; + th.setData({ + [txt]: obj + }); }, //---小于10的格式化函数---- timeFormat(param) { @@ -472,119 +554,7 @@ Page({ onShareAppMessage: function() { }, - shareFrends: function(e) { - var th = this; - var scene = th.data.gid; - ///二微码 - // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - // a.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; - var iurl = th.data.iurl; //图片地址前缀 - const ctx = wx.createCanvasContext('share_id'); //绘图上下文 - var unit = th.data.screenWidth / 750 * 1.35; - var numsize = 20 * unit; //几人助力字体大小 - var size = 15 * unit; - var num = 10; - var q_num = 6; - var already = num.toString().length + 1; //已有几位好友助力 - var lack = q_num.toString().length + 1; //还差几位好友助力 - var imagesize = 40 * unit; //助力人的图片大小 - var left = 74 * unit; //助力人头像跟左边的距离 - var spacing = 12 * unit; //助力人图片间距 - var images = th.data.images; - ctx.drawImage(images[0], 0, 0, 445 * unit, 700 * unit); //分享的背景图片 - ctx.drawImage(images[1], 37 * unit, 185 * unit, 370 * unit, 377 * unit); //分享的背景图片 - ctx.drawImage(images[2], 90 * unit, 231 * unit, 266 * unit, 160 * unit); //分享的背景图片 - ctx.setFillStyle("rgb(221,153,116)"); - ctx.setFontSize(size) - ctx.fillText("已有", 77 * unit, 430 * unit); - ctx.setFillStyle("#FF4746"); - ctx.setFontSize(numsize) - ctx.fillText(num + "位", 108 * unit, 430 * unit); - ctx.setFillStyle("rgb(221,153,116)"); - ctx.setFontSize(size) - ctx.fillText("好友助力,还差", 114 * unit + already * numsize * unit, 430 * unit); - ctx.setFillStyle("#FF4746"); - ctx.setFontSize(numsize); - ctx.fillText(q_num + "位", 220 * unit + already * numsize * unit, 430 * unit); - ctx.setFillStyle("rgb(221,153,116)"); - ctx.setFontSize(size); - ctx.fillText("达成助力", 248 * unit + lack * numsize * unit + already * numsize - numsize * 2, 430 * unit); - var c = q_num / num; - ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit, 12 * unit); - ctx.drawImage(images[4], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit); - for (var i = 0; i < 6; i++) { - if (i == 0) { - ctx.save(); - ctx.beginPath(); //开始绘制 - ctx.arc(left + imagesize / 2, 505 * unit, imagesize / 2, 0, 2 * Math.PI); - ctx.setLineWidth(4 * unit); - ctx.setStrokeStyle('red'); - ctx.setFillStyle("white"); - ctx.fill(); - ctx.clip(); - ctx.drawImage(images[6], left, 505 * unit - imagesize / 2, imagesize, imagesize); - ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 还可以继续绘制 - } else { - // 助力人的头像 - ctx.drawImage(images[6], left, 505 * unit - imagesize / 2, imagesize, imagesize); //分享的背景图片 - } - left += imagesize + spacing; - } - ctx.setFillStyle("rgb(255,255,255)"); - ctx.setFontSize(size); - ctx.fillText("优惠乐翻天,精彩就在你身边!", 37 * unit, 595 * unit); - ctx.setFillStyle("rgb(255,255,255)"); - ctx.setFontSize(size); - ctx.fillText("2019.06.26 - 2019.07.02!", 37 * unit, 620 * unit); - ctx.setFillStyle("rgb(255,255,255)"); - ctx.setFontSize(size); - ctx.fillText("长按识别二维码,可帮我助力!", 37 * unit, 660 * unit); - ctx.drawImage(images[7], 325 * unit, 595 * unit, 77 * unit, 77 * unit); //分享的背景图片 - ctx.save(); - //读取文件成功则OK-- - // wx.getImageInfo({ - // src: path3, - // success: function (res) { - //把画板内容绘制成图片,并回调 画板图片路径 - ctx.draw(false, function() { - setTimeout(function() { - wx.canvasToTempFilePath({ - x: 0, - y: 0, - width: 300, - height: 500, - destWidth: 400 * 2, - destHeight: 720 * 2, - canvasId: 'share_id', - success: function(res) { - wx.hideLoading(); - var shareImgPath = th.data.shareImgPath; - shareImgPath[0] = res.tempFilePath; - - th.setData({ - shareImgPath: shareImgPath, - canvasHidden: 1, - is_share: 1 - }) - if (!res.tempFilePath) { - wx.showModal({ - title: '提示', - content: '图片绘制中,请稍后重试', - showCancel: false - }) - return false; - } - }, - fail(r) { - - } - }, 500) - }) - }) - // } - // }) - }, preview: function() { var th = this; var shareImgPath = th.data.shareImgPath; @@ -763,8 +733,8 @@ Page({ var c = q_num / num; ctx.drawImage(images[2], 65 * unit, 445 * unit, 320 * unit, 12 * unit); ctx.drawImage(images[3], 65 * unit, 445 * unit, 320 * unit * c, 12 * unit); - // var dynamic = th.data.dynamic; //助力的微信头像 - // console.log(dynamic[0].headPic + "动态图片显示"); + // var dynamic = th.data.dynamic; //助力的微信头像 + // console.log(dynamic[0].headPic + "动态图片显示"); for (var i = 0; i < 6; i++) { if (i < 0) { // ctx.beginPath(); @@ -948,21 +918,23 @@ Page({ }) }, -//好友猜一猜 - save_share: function (e) { + //好友猜一猜 + save_share: function(e) { + var th = this; var aitem = this.data.aitem; //任务的数据集 var sw_index = this.data.sw_index; //轮播的下标 //任务id - var taskid = aitem[sw_index].id; - console.log("好友猜一猜的任务id", taskid); - var th = this; - + var taskid = aitem[sw_index].id + th.setData({ + is_share: 1 + }) var url = "/api/weshop/marketing/help/help/task/involve/page"; getApp().request.promiseGet(url, { + isShowLoading: true, data: { - storeId: 1, + storeId: os.stoid, taskId: taskid, - userId: 1433390 + userId: getApp().globalData.user_id } }).then(res => { if (res.data.code == 0) { @@ -971,11 +943,11 @@ Page({ // th.setData({ // dynamic: data // }) - // th.info_head(); - th.imageinfo(); - setTimeout(function () { + // th.info_head(function() { th.shareFrends(); - }, 500) + // }); + //th.imageinfo(); + } } else { wx.hideLoading(); @@ -984,18 +956,18 @@ Page({ }) }, //把已助力好友头像下载到本地 - info_head: function (e) { + info_head: function(e) { var th = this; var images = th.data.dynamic; if (images[0] != null && images[0] != "" && images[0] != undefined) { console.log(images[0].headPic + "就将计就计"); wx.getImageInfo({ src: images[0].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[0].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -1003,11 +975,11 @@ Page({ if (images[1] != null && images[1] != "" && images[1] != undefined) { wx.getImageInfo({ src: images[1].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[1].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -1015,11 +987,11 @@ Page({ if (images[2] != null && images[2] != "" && images[2] != undefined) { wx.getImageInfo({ src: images[2].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[2].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -1027,11 +999,11 @@ Page({ if (images[3] != null && images[3] != "" && images[3] != undefined) { wx.getImageInfo({ src: images[3].headPic, - success: function (res) { + success: function(res) { //res.path是网络图片的本地地址 images[3].headPic = res.path; }, - fail: function (res) { + fail: function(res) { } }); @@ -1063,6 +1035,18 @@ Page({ th.setData({ dynamic: images }) + + }, + //礼包的详情 轮播图 + libao_details: function(e) { + var th = this; + var help_id = th.data.help_id;//活动id + var taskId = th.data.taskid;//任务id + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 0 + "&taskId=" + taskId); + }, + //正在进行任务 + test: function(e) { + getApp().goto("/pages/user/assistance/friend_assistance?tasking=13"); }, }) \ No newline at end of file diff --git a/pages/user/assistance/task_assistance.json b/pages/user/assistance/task_assistance.json index d1cfde4..63f5fe9 100644 --- a/pages/user/assistance/task_assistance.json +++ b/pages/user/assistance/task_assistance.json @@ -1,5 +1,5 @@ { - "navigationBarTitleText": "好友助力", + "navigationBarTitleText": "好友助力,得好礼", "navigationStyle": "custom", "usingComponents": { "warn": "/components/long_warn/long_warn", diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml index 7028232..22495c6 100644 --- a/pages/user/assistance/task_assistance.wxml +++ b/pages/user/assistance/task_assistance.wxml @@ -1,14 +1,13 @@ - + - {{aitem[sw_index].helpTaskName}} 活动剩余时间: {{aitem[0].djs.day}}:{{aitem[0].djs.hou}}:{{aitem[0].djs.min}}:{{aitem[0].djs.sec}} - + @@ -16,8 +15,11 @@ - - + + + + 礼包详情 + @@ -25,23 +27,28 @@ - + - + - / + + + {{is_user_task.zlHelpNum}}/{{is_user_task.helpNum}} 今天剩余可领{{task_number}}个任务 - + 就选它了 - + 好友拆一拆 + @@ -63,49 +70,70 @@ - + {{item.helpTaskName}} - {{item.zlHelpNum}}/{{item.helpNum}} - 查看详情 - 领取礼包 + {{item.zlHelpNum}}/{{item.helpNum}} + 查看礼包 + 领取礼包 + + + + 暂无任务记录 + + + + - + + + + + - - {{itme.nickName}} + + {{item.nickName}} - {{filter.format_time(itme.beginDate)}} + {{filter.format_time(item.zltime)}} - + + + 点击加载更多 + - + + + 暂无任务记录 + + + - + - 点击加载更多 + 点击加载更多 @@ -114,32 +142,17 @@ 人领取了任务 - - - - - - - - - - - - - - + - - - - - + + + - + - + diff --git a/pages/user/assistance/task_assistance.wxss b/pages/user/assistance/task_assistance.wxss index c9e1c26..30aeed1 100644 --- a/pages/user/assistance/task_assistance.wxss +++ b/pages/user/assistance/task_assistance.wxss @@ -165,8 +165,11 @@ border-color: #fff; background: #ffe7ab; border-radius: 20rpx; height: 22rpx; + margin-right: 10rpx; } .is_plam{ + border-radius: 20rpx; + background: #fcc001; height: 100%; top: 0rpx; left: 0rpx; @@ -185,7 +188,7 @@ border-color: #fff; .canvas { position: fixed; - z-index: 11; + z-index: 20; width: 100%; top:20rpx; } @@ -193,4 +196,13 @@ border-color: #fff; .close { width: 70rpx; height: 70rpx; +} +.select_details{ + width: 100%; + height: 50rpx; + line-height: 50rpx; + text-align: center; + background: #000; + opacity:0.6; filter: alpha(opacity=60); + bottom: 0rpx; } \ No newline at end of file diff --git a/pages/user/integral/filter.wxs b/pages/user/integral/filter.wxs index c352e51..c9e3dc3 100644 --- a/pages/user/integral/filter.wxs +++ b/pages/user/integral/filter.wxs @@ -1,20 +1,7 @@ var numFr = { getNum: function(x) { - var f = parseFloat(x); - if (isNaN(f)) { - return false; - } - var f = Math.round(x * 100) / 100; - var s = f.toString(); - var rs = s.indexOf('.'); - if (rs < 0) { - rs = s.length; - s += '.'; - } - while (s.length <= rs + 2) { - s += '0'; - } - return s; + var f = parseInt(x); + return f; } } module.exports = { diff --git a/pages/user/integral/integral.wxml b/pages/user/integral/integral.wxml index 57a0cd2..450c1b4 100644 --- a/pages/user/integral/integral.wxml +++ b/pages/user/integral/integral.wxml @@ -40,7 +40,7 @@ - {{(details.OutIntegral==0)?"+":""}}{{(details.InIntegral==0)?filter.getNum(details.OutIntegral):filter.getNum(details.InIntegral)}}积分 + {{(details.OutIntegral==0)?"+":"-"}}{{(details.InIntegral==0)?details.OutIntegral:details.InIntegral}}积分 diff --git a/utils/request.js b/utils/request.js index 4c49293..437cec9 100644 --- a/utils/request.js +++ b/utils/request.js @@ -220,15 +220,18 @@ module.exports = { * @param {Object} succ //成功的回调 * @param {Object} fail //失败的回调 */ - json_post:function(url,data,succ,fail){ - var th=this; + json_post:function(url,data,succ,fail,mathod){ + var th=this; + var Mathod="POST"; + + if (mathod) Mathod = mathod; this.showLoading(); if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; var str = JSON.stringify(data); wx.request({ url: url, data: str, - method: 'POST', + method: Mathod, header: { 'content-type': 'application/json' },// 设置请求的 header