diff --git a/app.json b/app.json index 690151a..ac24f96 100644 --- a/app.json +++ b/app.json @@ -1,6 +1,9 @@ { "pages": [ "pages/index/index/index", + "pages/user/assistance/giftpacklist", + "pages/user/assistance/task_assistance", + "pages/user/share/share", "pages/giftpack/birthdaygift/birthdaygift", "pages/user/comment/comment", "pages/giftpack/evaluategift/evaluategift", @@ -85,8 +88,7 @@ "pages/user/my_service/tment_order_list", "pages/user/my_service/beauty_deta", "pages/user/labels/labels", - "pages/user/view_comment/view_comment", - "pages/user/assistance/assistance", + "pages/user/view_comment/view_comment" ], "permission": { "scope.userLocation": { diff --git a/pages/giftpack/birthdaygift/birthdaygift.js b/pages/giftpack/birthdaygift/birthdaygift.js index 3a695eb..c789f95 100644 --- a/pages/giftpack/birthdaygift/birthdaygift.js +++ b/pages/giftpack/birthdaygift/birthdaygift.js @@ -32,24 +32,28 @@ Page({ GetList: function () { var th = this; var url = "/api/weshop/marketing/giftbag/bound/get"; + wx.showLoading({ + title: '加载中', + }) getApp().request.promiseGet(url, { data: { "actId": th.data.getActId, //活动id - "actType":4, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 + "actType": 4, //活动类型 1新人礼 2评价有礼 3节日营销 4生日营销 "giftBagId": th.data.giftID, //礼包ID "storeId": a.stoid, //商家ID "userId": d.user_id //用户ID } }).then(res => { + wx.hideLoading(); if (res.data.code == 0) { - if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons!=null) { + if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons != null) { //礼包内容--礼券 th.setData({ cardShow: true, cards: res.data.data.lbCoupons }) } - if (res.data.data.lbSM.length > 0 && res.data.data.lbSM!=nll) { + if (res.data.data.lbSM.length > 0 && res.data.data.lbSM != nll) { //礼包内容--服务项目 th.setData({ itemShow: true, @@ -100,7 +104,8 @@ Page({ if (res.data.data.actIntro != '') { th.setData({ textShow: true, - textTitle: res.data.data.actIntro + textTitle: res.data.data.actIntro.replace(/\/g, '\div>') }) } } else { @@ -119,11 +124,7 @@ Page({ th.GetList(); }, onShow: function onShow() { - var th = this; - var textTitle = th.data.textTitle.replace(/

- - - - - - - - ______ - - - 新人专享\n你的美丽我来缔造 - - - ______ - - - - - - - - - - - - - - - - - - 免费领取 - - - {{item.fromName}} - - - - - {{item.fromName}} - - - {{"新人可免费享受专业"+item.fromName+",可以享受"+item.num+"次。"}} - - - - - + + + + + + + + ______ - - - - - + + 新人专享\n你的美丽我来缔造 - - - - - - - ——— - - - 新人专享优惠券 - - - ——— - - - - - - - - - 全场通用 - - - 品牌限定 - - - 品类限定 - - - 用途限定 - - - 分类限定 - - - {{item.sum+"元券"}} - {{"满"+item.buySum+"元可以用"}} - - - - + + ______ - - - - - - + + + + + + - - - - - - - - ——— - - - 新人专享福利 - - - ——— - - - - - - - - - - - - - - - - - - + + + + - - - - - - 活动规则: + + + + + 免费领取 + + + {{item.fromName}} + - - + + + {{item.fromName}} + + + {{"新人可免费享受专业"+item.fromName+",可以享受"+item.num+"次。"}} + + + 数量: + {{item.num}} + + - - - - + + + + + - - 本活动最终解释权归公司所有,如果有问题请联系客服 + + + + + + + + + ——— + + + 新人专享优惠券 + + + ——— + + + + + + + + 全场通用 + + + 品牌限定 + + + 品类限定 + + + 用途限定 + + + 分类限定 + + + + 包邮券 + + + {{item.sum+"元券"}} + {{"满"+item.buySum+"元可以用"}} + + + + + + + + + + + - - - - {{receiveState}} + + + + + + + ——— + + + 新人专享福利 + + + ——— + + + + + + + + + + + + + + + + + + + + + + + + 活动规则: + + + + + + + + + + + + 本活动最终解释权归公司所有,如果有问题请联系客服 + + + + + + {{receiveState}} + diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js index 74604d0..3ed78b4 100644 --- a/pages/giftpack/giftpacklist/giftpacklist.js +++ b/pages/giftpack/giftpacklist/giftpacklist.js @@ -33,8 +33,6 @@ Page({ var th = this; th.setData({ isBuy: options.isBuy, - getStorageID: a.stoid, - getUserID: d.user_id, getGiftID: options.lbId, orderSn: options.orderSn }) @@ -43,9 +41,6 @@ Page({ } else { th.GetBuyGiftList(); } - th.setData({ - giftRemark: th.data.giftRemark.replace(/

活动说明 - + - + 立即购买 @@ -112,7 +112,7 @@ - + 立即购买 diff --git a/pages/user/assistance/assistance.js b/pages/user/assistance/assistance.js index 8d29625..df28cf6 100644 --- a/pages/user/assistance/assistance.js +++ b/pages/user/assistance/assistance.js @@ -6,7 +6,7 @@ var t = getApp(), ut = i, s = require("../../../utils/common.js"); var regeneratorRuntime = require('../../../utils/runtime.js'); -var oo = t.globalData.setting; +var oo = t.globalData.setting,os=oo, ut= require("../../../utils/util.js"); Page({ /** @@ -24,6 +24,7 @@ Page({ is_show_more: 0, //是否加载更多 help_id:"",//助力活动的id timer:"",//任务列表的定时器 + s_num:"",//多少人已经领取任务 }, @@ -50,29 +51,36 @@ Page({ }, // 助力活动 - async assistance() { + assistance() { var th=this; var user_id = getApp().globalData.user_id; var store_id = os.stoid; - await getApp().request.promiseGet("/api/weshop/marketing/help/act/judge", { + getApp().request.promiseGet("/api/weshop/marketing/help/act/judge", { data: { storeId: store_id, userId: user_id } }).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 - }); + th.setData({ zl_act:help_data, help_id:help_data.id }); + return getApp().request.promiseGet("/api/weshop/marketing/help/involve/help/act/people/count", { + data: { + helpId: help_data.id, storeId: store_id + } + }) } - }) - + return ut.null_promise(); + }).then(res=>{ + if(res.data.code==0) + th.setData({s_num:res.data.data.countAll}) + }) + + }, //--点击获取用户任务列表--会员的任务列表 diff --git a/pages/user/assistance/assistance.wxml b/pages/user/assistance/assistance.wxml index 2fce9ba..eb5cf9b 100644 --- a/pages/user/assistance/assistance.wxml +++ b/pages/user/assistance/assistance.wxml @@ -76,10 +76,10 @@ 暂无任务记录 - + 已有 - {{zl_act.countAll}} + {{s_num}} 人领取了任务 diff --git a/pages/user/assistance/assistance_success.js b/pages/user/assistance/assistance_success.js index 9603900..f09db9a 100644 --- a/pages/user/assistance/assistance_success.js +++ b/pages/user/assistance/assistance_success.js @@ -1,6 +1,7 @@ var auth = require("../../../utils/auth.js"), rq = require("../../../utils/request.js"); var e = getApp(), app = e, s = e.globalData.setting, os = s, app_d = e.globalData; var regeneratorRuntime = require('../../../utils/runtime.js'); +var ut = require("../../../utils/util.js"); Page({ /** @@ -10,50 +11,53 @@ Page({ iurl: s.imghost, user:app_d.userInfo, zl_act:null, //助力活动 + s_num:0, //分享的人数 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - + //var helpid=options.helpid; + var helpid=23; + this.init(helpid); }, - /** * 生命周期函数--监听页面显示 */ - onShow: function () { - this.init(); + onShow: function (e) { + }, // ----初始化---- - init:function() { - + init:function(helpid) { var user_id = getApp().globalData.user_id; var store_id = os.stoid; var th=this; - getApp().request.promiseGet("http://172.20.3.102:8022/api/weshop/zl_act", { + + //链式调用接口,先获取活动,在获取参与活动的人数 + getApp().request.promiseGet("/api/weshop/marketing/help/help/act/get", { data: { - user_id: user_id, - store_id: store_id + storeId: store_id, + helpId: helpid } }).then(res => { - if(res.data.code==0) th.setData({zl_act:res.data.data}) - }) - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { + 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: { + storeId: store_id, + helpId: helpid + } + }) + } + return ut.null_promise(); + + }).then(res=>{ + if(res.data.code==0){ + th.setData({s_num:res.data.data.countAll}); + } + }) }, @@ -65,10 +69,7 @@ Page({ }, - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - + cklie_button:function(){ + getApp().goto("/pages/user/assistance/assistance") } }) \ No newline at end of file diff --git a/pages/user/assistance/assistance_success.wxml b/pages/user/assistance/assistance_success.wxml index 40188e9..06afae6 100644 --- a/pages/user/assistance/assistance_success.wxml +++ b/pages/user/assistance/assistance_success.wxml @@ -1,4 +1,4 @@ - + @@ -17,7 +17,7 @@ 我也要参加 -已有{{zl_act.qiang_num}}人领取礼盒 +已有{{s_num}}人领取礼盒 diff --git a/pages/user/assistance/friend_assistance.js b/pages/user/assistance/friend_assistance.js index 8d8d194..5d6217f 100644 --- a/pages/user/assistance/friend_assistance.js +++ b/pages/user/assistance/friend_assistance.js @@ -1,141 +1,152 @@ -var auth = require("../../../utils/auth.js"), rq = require("../../../utils/request.js"); -var e = getApp(), app = e, s = e.globalData.setting, os = s, app_d = e.globalData; +var auth = require("../../../utils/auth.js"), + rq = require("../../../utils/request.js"); +var e = getApp(), + app = e, + s = e.globalData.setting, + os = s, + app_d = e.globalData; var regeneratorRuntime = require('../../../utils/runtime.js'); +var ut = require("../../../utils/util.js"); + Page({ + /** + * 页面的初始数据 + */ + data: { + iurl: s.imghost, + is_show: 0, //显示弹框 + user: app_d.userInfo, + zl_act: null, //助力活动 + tasking: 0, //助力任务ID + userId: 0, //任务用户的ID + s_num: 0, //分享的人数 + taskId:0, //活动从表ID + }, - /** - * 页面的初始数据 - */ - data: { - iurl: s.imghost, - is_show:0,//显示弹框 - user:app_d.userInfo, - zl_act:null, //助力活动 - task_id:0, //助力任务ID - userId:0, //任务用户的ID - }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + var th = this; + if (options.tasking) this.data.tasking = options.tasking; + 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 + }); + } + }) - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - var th=this; - if(options.task_id) this.data.task_id=options.task_id; - if(options.userId) this.data.userId=options.userId; - //任务是不是为空 - if(this.data.task_id==0 || this.data.task_id==undefined){ - this.data.task_id= decodeURIComponent(options.scene); - if(this.data.task_id!=null && this.data.task_id!='undefined' && this.data.task_id!="" && this.data.task_id!=0){ - getApp().request.get("http://172.20.3.102:8022/api/weshop/zl_act_user",{ - data:{}, - success:function(res){ - if(res.data.code==0){ - th.data.userId=res.data.data.user_id; - } - } - }) - - } - } - }, + } + } + }, - // 跳转到助力成功页 - participate_activity:function(){ - wx.navigateTo({ - url: '/pages/user/assistance/assistance_success', - }) - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - this.init(); - }, - //点击开启礼盒 - cklie_button:function(){ - var th=this; - var t_user_id=app_d.user_id; - var data={id:this.data.task_id,storeId:os.stoid,userId:this.data.user_id, zlUserId:t_user_id}; - console.log(data); - getApp().request.json_post("/api/weshop/marketing/help/help/task/involve/insert", - data, //入参 - function(res){ //成功 - if(res.data.code==0) - this.setData({ is_show:1}); - else{ - getApp().my_warnning(res.data.msg,0,th) - } - }, - function(){//失败 - - } - ) - - - - }, - //点击关闭礼盒 - clike_none:function(){ - this.setData({ is_show:0}); - }, - //导航球 - close: function () { - var th = this; - var nav_b = th.selectComponent("#nav_b"); //组件的id - nav_b.close_box(); - nav_b.set_name("助力", ""); - }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { + // 跳转到助力成功页 + participate_activity: function() { + wx.navigateTo({ + url: '/pages/user/assistance/assistance_success', + }) + }, - }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { + }, + //点击开启礼盒 + cklie_button: function() { + var th = this; + var t_user_id = app_d.user_id; + var data = { + id: this.data.tasking, + storeId: os.stoid, + userId: this.data.userId, + zlUserId: t_user_id + }; + console.log(data); + getApp().request.json_post("/api/weshop/marketing/help/help/task/involve/insert", + data, //入参 + function(res) { //成功 + if (res.data.code == 0) + th.setData({ + is_show: 1 + }); + else { + getApp().my_warnning(res.data.msg, 0, th) + } + }, + function() { //失败 - }, + } + ) - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { + }, + //点击关闭礼盒 + clike_none: function() { + this.setData({is_show: 0}); + getApp().goto("/pages/user/assistance/assistance_success"); + }, + //导航球 + close: function() { + var th = this; + var nav_b = th.selectComponent("#nav_b"); //组件的id + nav_b.close_box(); + nav_b.set_name("助力", ""); + }, - }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { + }, - }, + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { + }, - }, - - // ----初始化---- - init:function() { - - var user_id = getApp().globalData.user_id; - var store_id = os.stoid; - var th=this; - getApp().request.promiseGet("http://172.20.3.102:8022/api/weshop/zl_act", { - data: { - user_id: user_id, - store_id: store_id - } - }).then(res => { - if(res.data.code==0) th.setData({zl_act:res.data.data}) - }) - - }, -}) \ No newline at end of file +}) diff --git a/pages/user/assistance/friend_assistance.wxml b/pages/user/assistance/friend_assistance.wxml index 3a1d9fc..e96ff62 100644 --- a/pages/user/assistance/friend_assistance.wxml +++ b/pages/user/assistance/friend_assistance.wxml @@ -14,12 +14,12 @@ - 活动时间:{{filter.fm_time(zl_act.begindate)}}-{{filter.fm_time(zl_act.begindate)}} + 活动时间:{{filter.fm_time(zl_act.beginDate)}}-{{filter.fm_time(zl_act.beginDate)}} 帮他拆礼盒 -已有{{zl_act.qiang_num}}人领取礼盒 +已有{{s_num}}人领取礼盒 diff --git a/pages/user/assistance/giftpacklist.js b/pages/user/assistance/giftpacklist.js new file mode 100644 index 0000000..dc7ffbb --- /dev/null +++ b/pages/user/assistance/giftpacklist.js @@ -0,0 +1,332 @@ +var e = getApp(), + a = e.globalData.setting, + os = a, + t = e.request, + d = e.globalData; +var ut = require("../../../utils/util.js"); + +Page({ + data: { + url: a.url, //接口网址 + iurl: a.imghost, //图片前缀网址 + isBuy: 0, + getGiftID: '', //礼包id + giftImage: '', + giftTitle: '', + giftDate: '', + giftPrice: '', + giftIntegral: '', + giftPosPrice: '', + giftQty: '', + giftRemark: '', + giftType: '', + actTitle: '', + getUrl: '', + wareCard: [], + orderSn: "", //订单编号 + lbId: "", + code: "", //核销码 + c_state: "0", //判断是否已经使用, 0正常 1已使用 2已过期 + is_lb: 0, //是否有礼包 + }, + 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 { + th.GetBuyGiftList(); + } + th.setData({ + giftRemark: th.data.giftRemark.replace(/

+ + + + + + {{giftTitle}} + + + {{"兑换截至时间:"+giftDate}} + + + + {{"¥"+giftPrice}} + + + / + + + {{giftIntegral+"积分"}} + + + {{actTitle}} + + + + + {{"原价:"+giftPosPrice+"元"}} + + + {{"已售:"+giftQty+"件"}} + + + + + + 礼包内容 + + + + + + + + + + + + + + + + + + + + + + + {{item.couponName}} + + + + + + {{"数量:"+item.num}} + + + + + + + + + + + + + + + + + + + + 奖励已发放 + + + + + + + + + 活动说明 + + + + + + + + + + + 立即购买 + + + + + 立即兑换 + + + + + 立即购买 + + + + + 立即兑换 + + + + + + + + + 无核销商品 + + + + + 立即使用 + + + 商品已核销 + + + 商品兑换时间已过 + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/user/assistance/giftpacklist.wxss b/pages/user/assistance/giftpacklist.wxss new file mode 100644 index 0000000..3d906ad --- /dev/null +++ b/pages/user/assistance/giftpacklist.wxss @@ -0,0 +1,244 @@ +@charset "UTF-8"; + +/* Author XGQ + * 2019-12-12 + */ + +.box.data-v-3a5b7e36 { + -webkit-align-content: center; + align-content: center; + background-color: #e85f93; +} + +.box_top.data-v-3a5b7e36 { + width: 100%; +} + +.box_top image.data-v-3a5b7e36 { + width: 100%; + max-height: 540rpx; +} + +.box_title.data-v-3a5b7e36 { + margin: 10rpx 20rpx 20rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius: 40rpx; +} + +.top_title.data-v-3a5b7e36 { + font-size: 30rpx; + margin-bottom: 10rpx; +} + +.top_time.data-v-3a5b7e36 { + font-size: 27rpx; + color: #b9b5b5; +} + +.top_price.data-v-3a5b7e36 { + font-size: 35rpx; + color: #d61b30; + margin-top: 30rpx; + margin-bottom: 5rpx; +} + +.top_foot.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; +} + +.top_foot_price.data-v-3a5b7e36 { + font-size: 22rpx; + color: #b9b5b5; + width: 50%; + text-decoration: line-through; +} + +.top_foot_qty.data-v-3a5b7e36 { + font-size: 22rpx; + color: #b9b5b5; + width: 50%; + -webkit-align-content: flex-end; + align-content: flex-end; + text-align: right; +} + +.box_ware.data-v-3a5b7e36 { + margin: 10rpx 20rpx 20rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius: 40rpx; +} + +.box_ware_title.data-v-3a5b7e36 { + font-size: 35rpx; + margin: 5rpx 0rpx 30rpx 0rpx; +} + +.box_ware_box.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 10rpx 0rpx 25rpx 0rpx; +} + +/* .box_ware_img.data-v-3a5b7e36 { + width: 30%; + height: 180rpx; + border: #999999 solid 1rpx; +} */ + +.box_ware_img image.data-v-3a5b7e36 { + /* width: 185rpx; + height: 190rpx; *//* background-color: rgba(138, 138, 138, 0.63); */ + border: 2rpx solid #999; + width: 120rpx; + height: 120rpx; +} + +.box_ware_item.data-v-3a5b7e36 { + width: 70%; + margin-left: 25rpx; + position: relative; +} + +.box_ware_item_title.data-v-3a5b7e36 { + font-size: 24rpx; + word-break: break-all; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; +} + +.box_ware_count.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; +} + +.box_ware_item_price.data-v-3a5b7e36 { + font-size: 25rpx; + color: #b9b5b5; + position: absolute; + bottom: 60rpx; + left: 0; +} + +.box_ware_item_qty.data-v-3a5b7e36 { + font-size: 22rpx; + position: absolute; + bottom: 15rpx; + left: 0; +} + +.box_ware_code.data-v-3a5b7e36 { + position: absolute; + right: 10rpx; + bottom: 10rpx; +} + +.box_ware_code image.data-v-3a5b7e36 { + width: 50rpx; + height: 50rpx; +} + +.box_ware_code text.data-v-3a5b7e36 { + font-size: 20rpx; +} + +.foot_box.data-v-3a5b7e36 { + margin: 10rpx 20rpx 50rpx 20rpx; + padding: 35rpx; + background-color: #fff; + border-radius: 40rpx; +} + +.foot_box_title.data-v-3a5b7e36 { + font-size: 35rpx; + margin-bottom: 30rpx; +} + +.foot_box_remark.data-v-3a5b7e36 { + font-size: 27rpx; + line-height: 40rpx; +} + +.foot_empty.data-v-3a5b7e36 { + height: 90rpx; +} + +.foot_button.data-v-3a5b7e36 { + display: -webkit-box; + display: -webkit-flex; + display: flex; + margin: 20rpx 0rpx 0rpx 0rpx; + padding: 25rpx 0rpx; + background: #fff; + text-align: center; + -webkit-box-pack: center; + -webkit-justify-content: center; + justify-content: center; + position: fixed; + bottom: 0; + left: 0; + width: 100%; +} + +.foot_button_left.data-v-3a5b7e36 { + background: #e4010c; + color: #fff; + width: 250rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_right.data-v-3a5b7e36 { + background: #ffbb42; + color: #fff; + width: 250rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_buy.data-v-3a5b7e36 { + background: #e4010c; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +.foot_button_intalge.data-v-3a5b7e36 { + background: #ffbb42; + color: #fff; + width: 400rpx; + height: 70rpx; + font-size: 28rpx; + line-height: 70rpx; + border-radius: 40rpx; +} + +page.data-v-3a5b7e36 { + background-color: #e85f93; +} + +.foot_box_remark.data-v-3a5b7e36 ._img { + width: 100%; +} + +.foot_box_remark.data-v-3a5b7e36 .img { + line-height: 0; +} +.overdue.data-v-3a5b7e36{ + background-color: rgb(153,153,153); +} \ No newline at end of file diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index e0852a8..5181a71 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -17,9 +17,9 @@ Page({ sw_index: 0, //轮播的下标控制 url: s.url, //接口网址 iurl: s.imghost, - is_task: 0, //判断标题名是任务1还是2 + endDate:"",//活动结束时间 activity_data: "25:20:59", //活动剩余时间 - task_number: 12, //任务数 + task_number:0, //任务数 is_task: 0, //历史记录与任务 aitem: "", //活动的轮播图 switch_head: 0, //0:我的任务,1:记录 @@ -28,9 +28,10 @@ Page({ shareImgPath: [], //生成的图片 screenWidth: "", //用户的屏幕宽度 gid: "", - images: ["miniapp/images/friendhelp/help.png", "miniapp/images/friendhelp/background.png", "miniapp/images/friendhelp/gift.png", "miniapp/images/friendhelp/no_check.png", - "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/unfinished.png", "miniapp/images/friendhelp/gift.png" - ] + timer: null,//全局的定时器 + user_task_list:null,//会员列表 + taskid:"",//任务id + usercount:0,//参与的人数 }, /** @@ -38,7 +39,6 @@ Page({ */ onLoad: function(options) { var help_id = options.help_id; - console.log("是什么鬼", help_id); var th = this; th.setData({ help_id: help_id @@ -50,57 +50,74 @@ Page({ } th.close(); th.syinfo(); - th.imageinfo(); + // th.imageinfo(); }, - // 轮播图点击左边 - click_pre: function() { - var index = this.data.sw_index; - index--; - if (index < 0) return; - this.setData({ - sw_index: index - }) + + + //选中任务保存 + add_onlicke:function(e){ + var th=this; + var taskid=e.target.dataset.taskid; + var help_id = th.data.help_id; + var user_id = getApp().globalData.user_id; + var stoid=os.stoid + getApp().request.json_post("/api/weshop/marketing/help/help/task/insert" + ,{ + helpId:help_id, + userId:user_id, + storeId:stoid, + taskId: taskid + }, + function(res) { + if(res.data.code==0){ + console.log(res.data.data); + getApp().my_warnning("任务领取成功", 1, th); + }else{ + getApp().my_warnning(res.data.msg, 0, th); + } + } + + ) }, - //轮播图点击右边 - click_next: function() { - var index = this.data.sw_index; - index++; - if (index >= this.data.aitem.length) return; - this.setData({ - sw_index: index - }) - }, - //任务领取 - onlicke: function() { + //帮拆记录的 + dismantle_record: function(e) { + console.log(); var th = this; - th.shareFrends(); - th.setData({ - is_share:1 - }) - getApp().my_warnning("任务领取成功", 1, th); - }, - - //我的任务和帮拆记录的替换 - switch_head: function(e) { - var th = this; - var index = e.currentTarget.dataset.index; //获取当前选择的是任务还是活动说明 - var switch_head = th.data.switch_head; //0任务,1活动说明 - if (index != switch_head) { + var index =1; //获取当前选择的是任务还是活动说明 + var is_task= th.data.is_task; //0任务,1活动说明 + console.log(e, "这是标签的", is_task, "这是"); + th.setData({ - switch_head: index, - is_task: index + is_task:1, + switch_head:1 + }); + rq.get("/api/weshop/marketing/help/help/task/involve/page", { + data: { + userId: user_id, + storeId: os.stoid + }, + success: function (res) {} + }) - } + + }, + + //划动的时候监听 onSli: function(e) { - + var th= this; var ind = e.detail.current; - this.setData({ - sw_index: ind + var aitem = this.data.aitem; + + var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; + th.setData({ + sw_index: ind, + task_number: task_number }) + console.log(th.data.sw_index,"滑动监听", ind); }, //导航球 close: function() { @@ -121,18 +138,41 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { + this.data.is_timer = 1; var th = this; var help_id = th.data.help_id; - /*-----统计-----*/ + var user_id = getApp().globalData.user_id; + + /*-----助力活动(判断)-----*/ + rq.get("/api/weshop/marketing/help/act/judge", { + data: { + userId: user_id, + storeId: os.stoid + }, + 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, + }); + + } + } + + + }); + + + /*-----获取助力活动的任务-----*/ rq.get("/api/weshop/marketing/help/help/task/page", { data: { helpId: help_id, storeId: os.stoid }, success: function(su) { - var data = su.data; - console.log('waitlist5555555555' + data.code); if (data.code != 0) { getApp().my_warnning(data.msg, 0, th); return false; @@ -142,21 +182,23 @@ Page({ var data_aissa = data.data.pageData; //当前时间戳 var nt = ut.gettimestamp(); - + data_aissa.forEach(function(val, ind) { - console.log(nt, "当前时间", "结束时间", val.end_time, "开始时间"); + //已开始 if (val.start_time < nt && val.end_time > nt) data_aissa[ind].status = 0; //未开始 else if (val.start_time > nt && val.end_time > nt) data_aissa[ind].status = 1; //已结束 - else if (val.start_time < nt && val.end_time < nt) data_aissa[ind].status = 2; - }); - + var task_number=data_aissa[0].giftQty - data_aissa[0].useGiftQty; + var taskid = data_aissa[0].id; + th.setData({ - aitem: data_aissa + aitem: data_aissa, + task_number: task_number, + taskid:taskid }); @@ -164,58 +206,97 @@ Page({ } }) - setTimeout(function() { - th.shareFrends(); - }, 1000) - + // 分享的 + // setTimeout(function() { + // th.shareFrends(); + // }, 1000) + //任务时间 设置全局定时器 + th.data.timer = setInterval(function () { + th.countDown(); + },1000); + //会员任务列表 + this.user_task_list(); + // 获取会员的参与的任务列表 我的任务 + this.get_user_task_num(); }, - //----助力任务----- - countDown() { - if (!this.data.is_timer) return false; - var th = this; - // 获取当前时间,同时得到活动结束时间数组 - var newTime = ut.gettimestamp(); - var List = this.data.aitem; - for (var j = 0; j < List.length; j++) { - var endTimeList = List[j]; - // 对结束时间进行处理渲染到页面 - for (var i = 0; i < endTimeList.length; i++) { - var o = endTimeList[i]; - var endTime = o.end_time - 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 + "][" + i + "].djs"; + // 获取会员的参与的任务列表 我的任务 + user_task_list:function(e){ + var th=this; + // var index = e.target.dataset.index; //获取当前选择的是任务还是活动说明 + var index =0; + var is_task = th.data.is_task; //0任务,1活动说明 + var help_id = th.data.help_id; + var user_id = getApp().globalData.user_id; + rq.get("/api/weshop/marketing/help/help/user/page", { + data: { + helpId: help_id, + storeId: os.stoid, + userId: user_id + }, + success: function (su) { th.setData({ - [txt]: obj + is_task: index, + switch_head: index }); + if (su.data.code == 0) { + var user_list=su.data.data.pageData; + console.log("会员列表",user_list); + th.setData({ + user_task_list: user_list + }); + }else{ + th.setData({ + user_task_list:null + }); + } } + }) + }, + //获取助力活动参与的人数 + get_user_task_num(){ + var th=this; + var help_id=th.data.help_id; + rq.get("/api/weshop/marketing/help/involve/help/act/people/count", { + data: { + helpId: help_id, + storeId: os.stoid, + }, + success: function (su) { + console.log(su.data.code, "获取助力活动参与的人数",su.data) + if (su.data.code == 0) { + var usercount=su.data.data.countAll; + + th.setData({ usercount: usercount}); + } else { + + } + } + }) + + }, + // 轮播图点击左边 + click_pre: function () { + 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; + this.setData({ + sw_index: index, + task_number: task_number + }) - } - setTimeout(th.countDown, 1000); + }, + //轮播图点击右边 + click_next: function () { + var index = this.data.sw_index; + index++; + if (index >= this.data.aitem.length) return; + var aitem = this.data.aitem; + var task_number = aitem[index].giftQty - aitem[index].useGiftQty; + this.setData({ + sw_index: index, task_number: task_number + }) }, @@ -223,7 +304,9 @@ Page({ * 生命周期函数--监听页面隐藏 */ onHide: function() { - + //--清理定时器-- + console.log("清理定时器"); + clearInterval(this.timer); }, /** @@ -239,6 +322,63 @@ Page({ onPullDownRefresh: function() { }, + //----助力任务的时间----- + countDown() { + if (!this.data.is_timer) return false; + 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 txt = "aitem[" + j + "]djs"; + th.setData({ + [txt]: obj + }); + + + } + setTimeout(th.countDown, 1000); + + }, + //---小于10的格式化函数---- + timeFormat(param) { + return param < 10 ? '0' + param : param; + }, /** * 页面上拉触底事件的处理函数 @@ -393,102 +533,103 @@ Page({ } }) }, - imageinfo: function() { - var th = this; - var images = th.data.images; - var iurl = th.data.iurl; - wx.getImageInfo({ - src: iurl + images[0], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[0] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[1], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[1] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[2], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[2] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[3], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[3] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[4], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[4] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[5], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[5] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - wx.getImageInfo({ - src: iurl + images[6], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[6] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }); - - wx.getImageInfo({ - src: iurl + images[7], - success: function(res) { - console.log(res + i); - //res.path是网络图片的本地地址 - images[7] = res.path; - }, - fail: function(res) { - console.log(res.toString() + "" + i); - } - }) - th.setData({ - images: images - }) - - } + //分享图 + // imageinfo: function() { + // var th = this; + // var images = th.data.images; + // var iurl = th.data.iurl; + // wx.getImageInfo({ + // src: iurl + images[0], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[0] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }); + // wx.getImageInfo({ + // src: iurl + images[1], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[1] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }); + // wx.getImageInfo({ + // src: iurl + images[2], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[2] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }); + // wx.getImageInfo({ + // src: iurl + images[3], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[3] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }); + // wx.getImageInfo({ + // src: iurl + images[4], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[4] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }); + // wx.getImageInfo({ + // src: iurl + images[5], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[5] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }); + // wx.getImageInfo({ + // src: iurl + images[6], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[6] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }); + + // wx.getImageInfo({ + // src: iurl + images[7], + // success: function(res) { + // console.log(res + i); + // //res.path是网络图片的本地地址 + // images[7] = res.path; + // }, + // fail: function(res) { + // console.log(res.toString() + "" + i); + // } + // }) + // th.setData({ + // images: images + // }) + + // } }) \ No newline at end of file diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml index b3a8a35..bed33b8 100644 --- a/pages/user/assistance/task_assistance.wxml +++ b/pages/user/assistance/task_assistance.wxml @@ -2,10 +2,11 @@ - {{aitem[sw_index].tite_name}} + {{sw_index}} + {{aitem[sw_index].helpTaskName}} - 活动剩余时间: {{activity_data}} + 活动剩余时间: {{aitem[0].djs.day}}:{{aitem[0].djs.hou}}:{{aitem[0].djs.min}}:{{aitem[0].djs.sec}} @@ -14,25 +15,27 @@ - - - - + - - + + + + + / + + 今天剩余可领{{task_number}}个任务 - + 就选它了 @@ -41,26 +44,30 @@ - + 我的任务 - + 帮拆记录 + - + + - 豪华任务一 + {{item.helpTaskName}} - - 进行中 + + {{item.zlHelpNum}}/{{item.helpNum}} + 查看详情 + 领取礼包 @@ -70,9 +77,7 @@ - - - + 豪华任务一 @@ -84,30 +89,23 @@ - - + + 暂无任务记录 - - - 已有 - 126 - 人领取了任务 - - - - + + 点击加载更多 已有 - 126 + {{usercount}} 人领取了任务 diff --git a/pages/user/assistance/task_assistance.wxss b/pages/user/assistance/task_assistance.wxss index 61968ed..101fae3 100644 --- a/pages/user/assistance/task_assistance.wxss +++ b/pages/user/assistance/task_assistance.wxss @@ -154,3 +154,19 @@ border-color: #fff; width: 70rpx; height: 70rpx; } +.plan-frame{ + width: 90%; + margin: auto; + +} +.plan-frame .plan_num{ + width: 90%; + background: #ffe7ab; + border-radius: 20rpx; + height: 32rpx; +} +.is_plam{ + height: 100%; + top: 0rpx; + left: 0rpx; +} \ No newline at end of file diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 8568ec1..b89522e 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -51,14 +51,15 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.birthday(); - this.is_assistance(); + this.birthday(); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { + + this.is_assistance(); var stoid = app_d.setting.stoid; var s = this,th=s,need_money=0,cur_g_num=0; @@ -128,10 +129,12 @@ Page({ await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get",{ data:{ storeId:os.stoid,userId:app_d.user_id } }).then(res=>{ - gid=res.data.data.GradeId; - var cz_val = res.data.data.GradeSum; - cz_vals=parseInt(cz_val); - GradeName=res.data.data.GradeName; + if (res.data.code == 0 && res.data.data){ + gid=res.data.data.GradeId; + var cz_val = res.data.data.GradeSum; + cz_vals=parseInt(cz_val); + GradeName=res.data.data.GradeName; + } //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid}); }) var obj = { cz_val: cz_vals, GradeName:GradeName, is_init: is_init, gradeId: gid }; diff --git a/utils/util.js b/utils/util.js index 5de0a30..d28ccb5 100644 --- a/utils/util.js +++ b/utils/util.js @@ -1,4 +1,3 @@ - function isString(str) { return (typeof str == 'string') && str.constructor == String; } @@ -309,6 +308,11 @@ function draw_randon_rect(ctx,x,y,r,w,h){ } + +function null_promise(){ + var promise=new Promise(function(resolve, reject){ var ob={code:-1,data:null}; resolve(ob); }); return promise; +} + module.exports = { formatTime: function(e, r) { var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { @@ -400,5 +404,6 @@ module.exports = { check_mobile: check_mobile,//验证手机 get_rand_item:get_rand_item, //随机获取元素 getDistance:getDistance, //获取俩个经纬网度之间的距离 - draw_randon_rect:draw_randon_rect //画图画圆角矩形 + draw_randon_rect:draw_randon_rect ,//画图画圆角矩形 + null_promise:null_promise,//返回空的promise };