diff --git a/components/qr_code/qr_code.wxml b/components/qr_code/qr_code.wxml index b6da6b4..5aa0ec7 100644 --- a/components/qr_code/qr_code.wxml +++ b/components/qr_code/qr_code.wxml @@ -1,5 +1,5 @@ - + diff --git a/pages/giftpack/birthdaygift/birthdaygift.js b/pages/giftpack/birthdaygift/birthdaygift.js index 206af80..6610de1 100644 --- a/pages/giftpack/birthdaygift/birthdaygift.js +++ b/pages/giftpack/birthdaygift/birthdaygift.js @@ -37,12 +37,15 @@ Page({ data: { "actId": th.data.getActId, //活动id "actType": 4, //活动类型 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) { + th.setData({ + + giftID: res.data.data.id, + }) if (res.data.data.lbCoupons.length > 0 && res.data.data.lbCoupons != null) { //礼包内容--礼券 th.setData({ @@ -50,7 +53,7 @@ Page({ 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 != null) { //礼包内容--服务项目 th.setData({ itemShow: true, diff --git a/pages/giftpack/birthdaygift/birthdaygift.wxml b/pages/giftpack/birthdaygift/birthdaygift.wxml index fe5df0b..1aa6519 100644 --- a/pages/giftpack/birthdaygift/birthdaygift.wxml +++ b/pages/giftpack/birthdaygift/birthdaygift.wxml @@ -130,7 +130,7 @@ - + @@ -138,7 +138,7 @@ - + diff --git a/pages/giftpack/birthdaygift/birthdaygift.wxss b/pages/giftpack/birthdaygift/birthdaygift.wxss index 33e96fa..b2b445a 100644 --- a/pages/giftpack/birthdaygift/birthdaygift.wxss +++ b/pages/giftpack/birthdaygift/birthdaygift.wxss @@ -110,9 +110,10 @@ line-height: 45rpx; } .top_card { - width: calc(50% - 30rpx); + width: 309rpx; display: inline-block; margin: 15rpx; + vertical-align:top; } .top_card_box { background-size: cover; @@ -337,3 +338,17 @@ button::after { line-height: 0; } +.lvip { + left: 30rpx; + bottom: -58rpx; + width: 20rpx; + height: 90rpx; + z-index: 5; +} +.rvip { + right: 30rpx; + bottom: -58rpx; + width: 20rpx; + height: 90rpx; + z-index: 5; +} \ No newline at end of file diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js index dd2f08c..045eff7 100644 --- a/pages/giftpack/buygiftpack/giftpackbuy.js +++ b/pages/giftpack/buygiftpack/giftpackbuy.js @@ -151,7 +151,7 @@ Page({ data: { storeId: th.data.getStorageID, //商家ID userId: th.data.getUserID, //用户ID - page: th.data.pages, + page: th.data.curpage, pageSize: th.data.pageSize }, success: function(res) { @@ -170,7 +170,8 @@ Page({ }), wx.stopPullDownRefresh(); //停止下拉刷新 } else { th.setData({ - is_read: 1 + is_read: 1, + ismore:1 }) } } diff --git a/pages/giftpack/evaluategift/evaluategift.wxml b/pages/giftpack/evaluategift/evaluategift.wxml index 7bee311..07d1f83 100644 --- a/pages/giftpack/evaluategift/evaluategift.wxml +++ b/pages/giftpack/evaluategift/evaluategift.wxml @@ -130,7 +130,7 @@ - + @@ -138,7 +138,7 @@ - + diff --git a/pages/giftpack/evaluategift/evaluategift.wxss b/pages/giftpack/evaluategift/evaluategift.wxss index 02ad479..a9d2a14 100644 --- a/pages/giftpack/evaluategift/evaluategift.wxss +++ b/pages/giftpack/evaluategift/evaluategift.wxss @@ -121,9 +121,10 @@ } .top_card { - width: calc(50% - 30rpx); + width: 309rpx; display: inline-block; margin: 15rpx; + vertical-align:top; } .top_card_box { diff --git a/pages/giftpack/festival/festival.js b/pages/giftpack/festival/festival.js index c2fa8f3..a0e28e7 100644 --- a/pages/giftpack/festival/festival.js +++ b/pages/giftpack/festival/festival.js @@ -125,6 +125,9 @@ Page({ }) th.is_festival(); th.GetList(); + wx.setNavigationBarTitle({ + title: "节日有礼", + }); }, onShow: function() { @@ -182,7 +185,7 @@ Page({ }).then(res => { if (res.data.code == 0) { th.setData({ - bimg: res.data.data.actBoundImg, + bimg: res.data.data.actImg, actFontColor: res.data.data.actFontColor, //字体颜色 actBgColor: res.data.data.actBgColor, //背景颜色 diff --git a/pages/giftpack/festival/festival.wxml b/pages/giftpack/festival/festival.wxml index 00a37a1..a53246d 100644 --- a/pages/giftpack/festival/festival.wxml +++ b/pages/giftpack/festival/festival.wxml @@ -130,7 +130,7 @@ - + @@ -138,7 +138,7 @@ - + diff --git a/pages/giftpack/festival/festival.wxss b/pages/giftpack/festival/festival.wxss index 8fe8975..632b656 100644 --- a/pages/giftpack/festival/festival.wxss +++ b/pages/giftpack/festival/festival.wxss @@ -126,9 +126,10 @@ } .top_card { - width: calc(50% - 30rpx); + width: 309rpx; display: inline-block; margin: 15rpx; + vertical-align:top; } .top_card_box { @@ -137,7 +138,6 @@ background-repeat: no-repeat; border-radius: 20rpx; height: 250rpx; - margin: 5rpx; } .img1 { diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js index 6708adf..4944146 100644 --- a/pages/giftpack/mygiftpack/mygiftpack.js +++ b/pages/giftpack/mygiftpack/mygiftpack.js @@ -20,8 +20,8 @@ Page({ contentrefresh: '加载中...', contentnomore: '已加载全部' }, - ismore:0,//数据是否全部加载完成 - is_read:0,//是否查询过我的礼包接口 + ismore: 0, //数据是否全部加载完成 + is_read: 0, //是否查询过我的礼包接口 curpage: 1, //当前分页数 pageSize: 10, //页大小 total: 0, //总数量 @@ -42,16 +42,16 @@ Page({ }, getList: function() { var th = this; - + getApp().request.get('/api/weshop/marketing/my/giftbag/page', { - isShowLoading:true, + isShowLoading: true, data: { storeId: th.data.getStorageID, //商家ID userId: th.data.getUserID, //用户ID page: th.data.curpage, pageSize: th.data.pageSize }, - success: function success(res) { + success: function(res) { if (res.data.code == 0) { th.data.curpage++; var arr1 = th.data.wareCard; @@ -63,21 +63,22 @@ Page({ wareCard: arr3, total: res.data.data.total, ismore: ismore, - is_read:1 + is_read: 1 }), wx.stopPullDownRefresh(); //停止下拉刷新 } else { th.setData({ - is_read: 1 + is_read: 1, + ismore:1 }) } - + } - + }); }, //销毁界面跳转 - redirectTo: function (e) { + redirectTo: function(e) { var th = this; var url = e.currentTarget.dataset.url; //销毁跳转 @@ -86,20 +87,20 @@ Page({ }); }, //不销毁界面跳转 - navigateTo: function (e) { + navigateTo: function(e) { var th = this; var url = e.currentTarget.dataset.url; getApp().goto(url); }, //下拉事件 - onReachBottom: function () { + onReachBottom: function() { var th = this; if (th.data.total <= th.data.pageSize) return; if (th.data.ismore) return; th.getList(); }, //图片失败,默认图片 - bind_bnerr2: function (e) { + bind_bnerr2: function(e) { var _errImg = e.target.dataset.errorimg; var _errObj = {}; _errObj[_errImg] = "/public/images/empty.jpg"; diff --git a/pages/giftpack/newvipgift/newvipgift.wxml b/pages/giftpack/newvipgift/newvipgift.wxml index b3852a1..12078a6 100644 --- a/pages/giftpack/newvipgift/newvipgift.wxml +++ b/pages/giftpack/newvipgift/newvipgift.wxml @@ -130,7 +130,7 @@ - + @@ -138,7 +138,7 @@ - + diff --git a/pages/giftpack/newvipgift/newvipgift.wxss b/pages/giftpack/newvipgift/newvipgift.wxss index ed30127..02ac52f 100644 --- a/pages/giftpack/newvipgift/newvipgift.wxss +++ b/pages/giftpack/newvipgift/newvipgift.wxss @@ -126,9 +126,10 @@ } .top_card { - width: calc(50% - 30rpx); + width: 309rpx; display: inline-block; margin: 15rpx; + vertical-align:top; } .top_card_box { diff --git a/pages/index/index/index.js b/pages/index/index/index.js index ec7ff68..a94c78e 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -90,7 +90,7 @@ Page({ }); } }) - // th.is_festival(); + th.is_festival(); }, //关闭新用户领取广告 @@ -747,9 +747,9 @@ Page({ var giftBagId = res.data.data.gifBagId; //礼包id var nav_url = "/pages/giftpack/festival/festival?actId=" + actid + '&' + 'actType=' + 3 + '&' + 'giftBagId=' + giftBagId; var swiperimage = th.data.swiperimage; - var actImg = res.data.data.actImg; + var actBoundImg = res.data.data.actBoundImg; actBoundImg var img = { - image: actImg, + image: actBoundImg, nav_url: nav_url } swiperimage.unshift(img); diff --git a/pages/user/assistance/friend_assistance.js b/pages/user/assistance/friend_assistance.js index e92f55d..42711a4 100644 --- a/pages/user/assistance/friend_assistance.js +++ b/pages/user/assistance/friend_assistance.js @@ -99,7 +99,6 @@ Page({ cklie_button: function() { var th = this; var t_user_id = app_d.user_id; - t_user_id = 1433320; var data = { id: this.data.tasking, storeId: os.stoid, diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index c7a6af6..e69de29 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -1,923 +0,0 @@ -var auth = require("../../../utils/auth.js"), - rq = require("../../../utils/request.js"); -var e = getApp(), - app = e, - i = require("../../../utils/util.js"), - ut = i, - s = e.globalData.setting, - os = s, - app_d = e.globalData; -var regeneratorRuntime = require('../../../utils/runtime.js'); -Page({ - /** - * 页面的初始数据 - */ - data: { - sw_index: 0, //轮播的下标控制 - url: s.url, //接口网址 - iurl: s.imghost, - endDate: "", //活动结束时间 - activity_data: "25:20:59", //活动剩余时间 - task_number: 0, //任务数 - is_task: 0, //历史记录与任务 - aitem: "", //活动的轮播图数据 - switch_head: 0, //0:我的任务,1:记录 - help_id: "", //活动的id canvasHidden: 0, //分享图片是否已经生成 - gid: "", - timer: null, //全局的定时器 - user_task_list: null, //会员列表 - taskid: "", //任务id - usercount: 0, //参与的人数 - dismantle: null, //帮拆记录数据集 - is_user_task: null, //判断是不是领取的任务 - zzjx_id: "", //真正进行的任务id - is_show: 0, //任务的加载更多 - is_bc_show: 0, //帮拆的加载更多 - bc_page: 1, //帮拆的页码 - rw_page: 1, //任务的页码 - block: 0, //阻断助力的用户图片多次添加 - //*********************************************start钱 - canvasHidden: 0, //分享图片是否已经生成 - is_share: 0, //是否显示画布 - shareImgPath: [], //生成的图片 - screenWidth: "", //用户的屏幕宽度 - gid: "", - images: ["miniapp/images/friendhelp/help.png", "miniapp/images/friendhelp/background.png", "miniapp/images/friendhelp/no_check.png", - "miniapp/images/friendhelp/check.png", "miniapp/images/friendhelp/unfinished.png","miniapp/images/xc_ellipsis.png" - ], //固的分享图片 - - dynamic: null, //已助力的微信头像数组 - head_pic_arr: [], //助力的头像 - share_lb_img: "", //分享的礼包图片 - - is_generate: 0, //是否重复点击拆一拆 - already: 0, //已有几人助力 - lack: 0, //还差几人助力 - zltime: "", //助力时间 - djs: "", //定时器的显示 - //*********************************************end - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function(options) { - var th = this; - var help_id = options.help_id; - var nav_b = th.selectComponent("#nav_b"); //组件的id - nav_b.set_name("助力", "/pages/user/assistance/assistance"); - th.setData({ - help_id: help_id - }); - //start 钱 - if (options.gid != undefined) { - th.setData({ - gid: options.gid - }) - } - th.close(); - th.syinfo(); - th.imageinfo(); - - }, - - - //选中任务保存 - 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) { - 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); - } - } - - ) - - }, - - - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - 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; - th.setData({ - endDate: help_data.endDate, - }); - - //任务时间 设置全局定时器 - th.setData({ - timer: setInterval(function() { - th.countDown(); - }, 1000) - }) - - - } - } - }); - - - /*-----获取助力活动的任务-----*/ - rq.get("/api/weshop/marketing/help/help/task/page", { - data: { - helpId: help_id, - storeId: os.stoid - }, - success: function(su) { - var data = su.data; - if (data.code != 0) { - getApp().my_warnning(data.msg, 0, th); - return false; - } - if (data.code == 0) { - //轮播图的数据 - var data_aissa = data.data.pageData; - //当前时间戳 - var nt = ut.gettimestamp(); - - data_aissa.forEach(function(val, ind) { - - //已开始 - 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, - task_number: task_number, - taskid: taskid - }); - //判断是不是领取的任务 - th.get_user_task(); - - } - - } - }) - - // 分享的 - // setTimeout(function() { - // th.shareFrends(); - // }, 1000) - - //会员任务列表 - this.user_task_list(); - //获取助力活动参与的人数 - this.get_user_task_num(); - - }, - - - //帮拆记录的 - dismantle_record: function(e) { - //优化444444444444444444 - if (this.data.switch_head == 1) { - return false; - } - var aitem = this.data.aitem; //任务的数据集 - var sw_index = this.data.sw_index; //轮播的下标 - //任务id - var taskid = aitem[sw_index].id; - var th = this; - var index = 1; //获取当前选择的是任务还是活动说明 - 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, - block: 0, - }); - 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[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().my_warnning("暂无更多内容", 0, th); - } - - th.setData({ - dismantle: dismantle - }); - } else { - th.setData({ - dismantle: null - }); - } - } - - }) - }, - // 领取礼包 - get_libao: function(e) { - var libao_id = e.currentTarget.dataset.libaoid; //礼包id - var taskid= e.currentTarget.dataset.taskid; - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 +"&taskId="+taskid); - }, - //查看礼包id - select_libao: function(e) { - var orderSn = e.currentTarget.dataset.orderSn; - getApp().goto("/pages/user/assistance/giftpacklist?orderSn=" + orderSn); - }, - - //划动的时候监听 - onSli: function(e) { - var th = this; - var ind = e.detail.current; - var aitem = this.data.aitem; - var task_number = aitem[ind].giftQty - aitem[ind].useGiftQty; - var task_id = aitem[ind].id; - th.setData({ - sw_index: ind, - task_number: task_number, - taskid: task_id - }); - - 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(); - }, - // 获取会员的参与的任务列表 我的任务 - user_task_list: function(e) { - var th = this; - //防止已经当前位置的时候多次点击 - if (th.data.block == 1) { return false; } - var index = 0; - 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({block:1}); - if (su.data.code == 0) { - if (su.data.data.total > 5) { - var rw_page = th.data.rw_page + 1; - th.setData({ - rw_page: rw_page, - is_show: 1 - }) - getApp().my_warnning(su.data.msg, 1, th); - } - - var user_list = su.data.data.pageData; - th.setData({ - user_task_list: user_list - }); - } else { - getApp().my_warnning(su.data.msg, 0, th); - } - } - }) - }, - //判断是否有领取任务 获取正在进行中的任务 - 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({ - is_user_task: is_usertask - }); - } - } - }) - }, - //获取助力活动参与的人数 - 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", { - data: { - helpId: help_id, - storeId: os.stoid, - }, - success: function(su) { - if (su.data.code == 0) { - var usercount = su.data.data.countAll; - - th.setData({ - usercount: usercount - }); - } - } - }) - - }, - //轮播卡死的重置 - changeGoodsSwip: function(detail) { - if (detail.detail.source == "touch") { - //当页面卡死的时候,current的值会变成0 - if (detail.detail.current == 0) { - //有时候这算是正常情况,所以暂定连续出现3次就是卡了 - let swiperError = this.data.swiperError - swiperError += 1 - this.setData({ - swiperError: swiperError - }) - if (swiperError >= 3) { //在开关被触发3次以上 - this.setData({ - sw_index: this.data.preIndex - }); //,重置current为正确索引 - this.setData({ - swiperError: 0 - }) - } - } else { //正常轮播时,记录正确页码索引 - this.setData({ - preIndex: detail.detail.current - }); - //将开关重置为0 - this.setData({ - swiperError: 0 - }) - } - } - }, - - // 轮播图点击左边 - 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; - var task_id = aitem[index].id; - this.setData({ - sw_index: index, - 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++; - 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, - taskid: task_id - }) - if (this.data.switch_head == 1) { - this.dismantle_record(); - } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - //--清理定时器-- - clearInterval(this.data.timer); - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - //----助力任务的时间----- - countDown() { - if (!this.data.is_timer) return false; - var th = this; - // 获取当前时间,同时得到活动结束时间数组 - var newTime = ut.gettimestamp(); - - // 对结束时间进行处理渲染到页面 - - // var o = endTimeList[i]; - var endTime = th.data.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[" + 0 + "].djs"; - th.setData({ - [txt]: obj - }); - }, - //---小于10的格式化函数---- - timeFormat(param) { - return param < 10 ? '0' + param : param; - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - }, - - preview: function() { - var th = this; - var shareImgPath = th.data.shareImgPath; - wx.previewImage({ - url: shareImgPath[0], - urls: shareImgPath - }) - }, - - //关闭分享显示 - close_share: function() { - var th = this; - th.setData({ - is_share: 0 - }) - }, - syinfo: function() { - var th = this; - //获取用户设备信息,屏幕宽度 - wx.getSystemInfo({ - success: res => { - th.setData({ - screenWidth: res.screenWidth - }) - } - }) - }, - - - - //************************ */ - shareFrends: function(e) { - var th = this; - if (th.data.is_generate) return; - th.data.is_generate = 1; - - var scene = 1; - ///二微码 - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/index/index/index"; - //读取文件成功则OK-- - wx.getImageInfo({ - src: path3, - success: function(res) { - - var ewm_path = res.path; // - //var act_time="2019.06.26 - 2019.07.02"; //活动的时间 - var bg_time = ut.formar_no_full(th.data.dynamic.beginDate); - var end_time = ut.formar_no_full(th.data.dynamic.endDate); - var act_time = bg_time + "-" + end_time; - - - var iurl = th.data.iurl; //图片地址前缀 - const ctx = wx.createCanvasContext('share_id'); //绘图上下文 - var unit = th.data.screenWidth / 750 * 1.35; - var numsize = 20 * unit; //几人助力字体大小 - var head_list_img = th.data.head_pic_arr; - var num = th.data.head_pic_arr.length; //已有几位好友助力 - - var aitem = th.data.aitem; //任务的数据集 - var sw_index = th.data.sw_index; //轮播的下标 - //任务id - var help_num = aitem[sw_index].helpNum; - var q_num = help_num - num; //还差几位好友助力 - var already = num.toString().length + 1; //已有几位好友助力 - var lack = q_num.toString().length + 1; //还差几位好友助力 - - var size = 15 * unit; - 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(th.data.share_lb_img, 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("好友助力,还差", 116 * unit + already * numsize * unit, 430 * unit); - ctx.setFillStyle("#FF4746"); - ctx.setFontSize(numsize); - ctx.fillText(q_num + "位", 223 * unit + already * numsize * unit, 430 * unit); - ctx.setFillStyle("rgb(221,153,116)"); - ctx.setFontSize(size); - ctx.fillText("达成助力", 230 * unit + lack * numsize * unit + already * numsize * unit, 430 * unit); - var c = num / help_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 head_list_num = 30; - var is_head_list = 0; - - //当需要助力人数小与6个 - if (help_num < 6) { - var pos_arr=ut.get_box_arr(help_num,225.25*unit,505 * unit,spacing,imagesize / 2); - var now_ind=0; - //--判断已助力的人数-- - for (var a = 0; a < head_list_img.length; a++) { - var pos= pos_arr[now_ind]; - ut.draw_circle(ctx,pos.x, pos.y, imagesize / 2,head_list_img[a],'red',unit); - now_ind++; - } - //--显示还差的人数-- - if(help_num-head_list_img.length>0){ - var neednum=help_num-head_list_img.length; - //这个是还未助力的位置 - for (var i = 0; i < neednum; i++) { - var pos= pos_arr[now_ind]; - now_ind++; - // 助力人的头像 - ctx.drawImage(images[4], pos.x-imagesize/2, pos.y-imagesize/2,imagesize, imagesize); //分享的背景图片 - - } - } - - }else if(help_num>7){ - //助力头像数量, 是不是要显示省略图 - var zl_head=0,is_sheng=0; - if(head_list_img.length>=6) { - zl_head=5;is_sheng=1; - }else{ - zl_head=head_list_img.length; - } - - - //判断已助力的人数 - for (var a = 0; a < zl_head; a++) { - //绘制头像 - ut.draw_circle(ctx,left + imagesize / 2, 505 * unit, imagesize / 2,head_list_img[a],'red',unit); - left += imagesize + spacing; - } - - //如果是省略号的话 - if(is_sheng){ - ctx.drawImage(images[5], left , 505 * unit - imagesize / 2, imagesize, imagesize); //头像的省略图片 - }else{ - //这个是还未助力的位置 - for (var i = 0; i < 6-head_list_img.length; i++) { - // 助力人的头像 - ctx.drawImage(images[4], left , 505 * unit - imagesize / 2, imagesize, imagesize); //分享的?号图片 - left += imagesize + spacing; - } - } - }else{ - // 判断已助力的人数 - for (var a = 0; a < head_list_img.length; a++) { - 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(head_list_img[a], left , 505 * unit - imagesize / 2, imagesize, imagesize); - ctx.restore(); - left += imagesize + spacing; - } - - if(help_num-head_list_img.lengt>0){ - var neednum=help_num-head_list_img.length; - //这个是还未助力的位置 - for (var i = 0; i < neednum; i++) { - // 助力人的头像 - ctx.drawImage(images[4], 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(act_time, 37 * unit, 620 * unit); //绘制活动是时间 - ctx.setFillStyle("rgb(255,255,255)"); - ctx.setFontSize(size); - ctx.fillText("长按识别二维码,可帮我助力!", 37 * unit, 660 * unit); - ctx.drawImage(ewm_path, 325 * unit, 585 * 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, - is_generate: 0, - canvasHidden: 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; - wx.previewImage({ - url: shareImgPath[0], - urls: shareImgPath - }) - th.setData({ - is_share: 0 - }) - }, - - //关闭分享显示 - close_share: function() { - var th = this; - wx.hideLoading(); - th.setData({ - is_share: 0 - }) - }, - syinfo: function() { - var th = this; - //获取用户设备信息,屏幕宽度 - wx.getSystemInfo({ - success: res => { - th.setData({ - screenWidth: res.screenWidth - }) - } - }) - }, - - //把固定的图片加载到本地 - imageinfo: async function() { - var th = this; - var images = th.data.images; - var iurl = th.data.iurl; - for (var i in images) { - var img_path = iurl + images[i]; - await getApp().request.promise_downimg(img_path).then(res => { - images[i] = res; - }) - } - - th.data.images = images; - }, - - - //好友猜一猜 - save_share: function(e) { - var th = this; - var aitem = this.data.aitem; //任务的数据集 - var sw_index = this.data.sw_index; //轮播的下标 - var sw_item = aitem[sw_index]; - //任务id - var taskid = sw_item.id; - th.setData({ - is_share: 1 - }) - var url = "/api/weshop/marketing/help/help/task/involve/page"; - getApp().request.promiseGet(url, { - isShowLoading: true, - data: { - storeId: os.stoid, - taskId: taskid, - userId: getApp().globalData.user_id - } - }).then(res => { - if (res.data.code == 0) { - var data = res.data.data.pageData; //帮拆数组 - if (data.length > 0) { - th.data.dynamic = data[0]; - var path = th.data.iurl + sw_item.giftBagUrl; - //先获取礼包分享时的本地路径 - getApp().request.promise_downimg(path).then(res => { - th.data.share_lb_img = res; - //先获取会员的头像 - th.info_head(th.shareFrends); - }); - } - } else { - wx.hideLoading(); - getApp().my_warnning(res.data.msg, 0, th); - } - }) - }, - - //把已助力好友头像下载到本地 - info_head: async function(func) { - var th = this; - var images = th.data.dynamic.zlHelpUser; - var arr = new Array(); - var block = th.data.block; - if (images) { - th.data.head_pic_arr.length = 0; - for (var i in images) { - var img_path = images[i].headPic; - await getApp().request.promise_downimg(img_path).then(res => { - th.data.head_pic_arr.push(res); - }) - } - } - func(); - }, -//立即兑换 - redeem_now: function (e) { - var libao_id = e.currentTarget.dataset.libaoid; - var taskid = e.currentTarget.dataset.taskid; - getApp().goto("/pages/user/assistance/giftpacklist?libao_id=" + libao_id + "&is_libao=" + 1 + "&taskId=" + taskid); - }, - - - //礼包的详情 轮播图 - libao_details: function(e) { - var th = this; - var help_id = th.data.help_id; //活动id - var taskId = e.currentTarget.dataset.taskid; //任务id - getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + help_id + "&is_libao=" + 0 + "&taskId=" + taskId); - }, - //测试正在进行任务 - test: function (e) { - var taskid = e.currentTarget.dataset.taskid; - var uset_id = this.data.zlisuers_id; - getApp().goto("/pages/user/assistance/friend_assistance?tasking=" + taskid + "&userId=" + uset_id); - }, - -}) \ No newline at end of file diff --git a/pages/user/assistance/task_assistance.wxml b/pages/user/assistance/task_assistance.wxml index 7e469f0..8d71254 100644 --- a/pages/user/assistance/task_assistance.wxml +++ b/pages/user/assistance/task_assistance.wxml @@ -1,5 +1,5 @@ - + @@ -23,7 +23,7 @@ - + 礼包详情 @@ -52,7 +52,7 @@ 好友拆一拆 - + 立即兑换 @@ -90,7 +90,7 @@ {{item.zlHelpNum}}/{{item.helpNum}} 查看礼包 - 领取礼包 + 领取礼包 @@ -110,21 +110,20 @@ - + - - - + + {{item.nickName}} {{filter.format_time(item.zltime)}} - - + + - 点击加载更多 + 点击加载更多 @@ -141,12 +140,12 @@ - + - 点击加载更多 + 点击加载更多 - + 已有{{usercount}}人领取了任务 diff --git a/pages/user/assistance/task_assistance.wxss b/pages/user/assistance/task_assistance.wxss index d9359e0..b84cdcb 100644 --- a/pages/user/assistance/task_assistance.wxss +++ b/pages/user/assistance/task_assistance.wxss @@ -226,3 +226,13 @@ page { filter: alpha(opacity=60); bottom: 0rpx; } +.is_dismantle_frame{ + align-content: center; +height: 56rpx; +line-height: 48rpx; + +} +.bottom{ + margin-bottom: 50rpx; + margin-top: 20rpx; +} \ No newline at end of file diff --git a/pages/user/index/index.js b/pages/user/index/index.js index c084455..06d59f8 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -1,5 +1,10 @@ -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'); const { barcode, @@ -12,69 +17,74 @@ Page({ * 页面的初始数据 */ data: { - length:150, - iurl: s.imghost, - defaultAvatar:s.imghost+"/miniapp/images/no-head.jpg", - userInfo:null, - toji:null, //统计相关 - txmon:0, - byquan: 0, - yuer: 0, - currentPage:1, - recommend_list:[], - tc_hide: true, - sw_index:0, - qy_list:null, - gradeId:null, - is_init:0, - cz_val:0, - full_cz_val:0, - is_dengji:0, //是不是等级 - is_banner:0,//是不是有生日活动 - giftbagid:"",//生日活动的类型 - actId:"",//生日活动的id - actImg:"", - is_assistance:0,//助力活动 + length: 150, + iurl: s.imghost, + defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg", + userInfo: null, + toji: null, //统计相关 + txmon: 0, + byquan: 0, + yuer: 0, + currentPage: 1, + recommend_list: [], + tc_hide: true, + sw_index: 0, + qy_list: null, + gradeId: null, + is_init: 0, + cz_val: 0, + full_cz_val: 0, + is_dengji: 0, //是不是等级 + is_banner: 0, //是不是有生日活动 + giftbagid: "", //生日活动的类型 + actId: "", //生日活动的id + actImg: "", + is_assistance: 0, //助力活动 }, - goto_nav: function (e) { + goto_nav: function(e) { var th = this; var url = e.currentTarget.dataset.url; if (th.data.userInfo != null) { getApp().goto(url); } else { - wx.navigateTo({ - url: '/pages/getphone/getphone', - }) + wx.navigateTo({ + url: '/pages/getphone/getphone', + }) } }, /** * 生命周期函数--监听页面加载 */ - onLoad: function (options) { - this.birthday(); + onLoad: function(options) { + this.birthday(); }, /** * 生命周期函数--监听页面显示 */ - onShow: function () { - - this.is_assistance(); - + onShow: function() { + + this.is_assistance(); + var stoid = app_d.setting.stoid; - var s = this,th=s,need_money=0,cur_g_num=0; + var s = this, + th = s, + need_money = 0, + cur_g_num = 0; getApp().get_isbuy(th.setappdata); - if(getApp().globalData.user_id) getApp().requestCardNum(); + if (getApp().globalData.user_id) getApp().requestCardNum(); /*------会员登录------*/ - app.getUserFir(async function(e){ - if(e!=undefined && e!=null && e.mobile){ + app.getUserFir(async function(e) { + if (e != undefined && e != null && e.mobile) { s.setData({ userInfo: e }); /*-----统计-----*/ - rq.get("/api/weshop/order/waitlist",{ - data: { user_id: app_d.user_id}, - success: function (su) { + rq.get("/api/weshop/order/waitlist", { + data: { + user_id: app_d.user_id + }, + success: function(su) { s.setData({ toji: su.data.data, }); @@ -82,114 +92,155 @@ Page({ }) /*-----获取线下会员的预存款和优惠券的数量-----*/ rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { - success: function (su) { - var data=su.data.data; + success: function(su) { + var data = su.data.data; data.cashcount = parseInt(data.cashcount); - s.setData({ udata: data, }); + s.setData({ + udata: data, + }); } }) /*-----获取会员提现金额-----*/ rq.get("/api/weshop/withdrawals/summoney", { - data: { user_id: e.user_id, store_id: os.stoid, status: 0 }, - success: function (su) { + data: { + user_id: e.user_id, + store_id: os.stoid, + status: 0 + }, + success: function(su) { if (su.data.code == 0) { var yuer = parseFloat(th.data.userInfo.user_money - - th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2); - th.setData({ txmon: su.data.data.summoney, yuer: yuer }); + th.data.userInfo.frozen_money - su.data.data.summoney).toFixed(2); + th.setData({ + txmon: su.data.data.summoney, + yuer: yuer + }); } } }) /*-----获取会员包邮券的数量-----*/ rq.get("/api/weshop/userfeemail/page", { - data: { user_id: e.user_id, store_id: os.stoid, pageSize:1,isuse:0}, - success: function (su) { + data: { + user_id: e.user_id, + store_id: os.stoid, + pageSize: 1, + isuse: 0 + }, + success: function(su) { if (su.data.code == 0) { - th.setData({ byquan: parseInt(su.data.data.total)}); + th.setData({ + byquan: parseInt(su.data.data.total) + }); } } }) /*-----获取会员权益列表-----*/ rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", { - data: { storeId: os.stoid,pageSize:100}, - success: async function (res) { - var arr_data=res.data.data.pageData; - var gid=null,g_qy_list=null,cz_vals=0,need_money=0, - backClass = null, is_init = 0, GradeName=''; + data: { + storeId: os.stoid, + pageSize: 100 + }, + success: async function(res) { + var arr_data = res.data.data.pageData; + var gid = null, + g_qy_list = null, + cz_vals = 0, + need_money = 0, + backClass = null, + is_init = 0, + GradeName = ''; //--初始化是否有打勾-- await getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { - data: { storeId: os.stoid} + data: { + storeId: os.stoid + } }).then(res => { - is_init=res.data.data.isBool; + is_init = res.data.data.isBool; }) //获取成长值 - await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get",{ - data:{ storeId:os.stoid,userId:app_d.user_id } - }).then(res=>{ - 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 }; - - // 获取最大值 - await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", { - data: { storeId: os.stoid } - }).then(res => { - if (res.data.data) - backClass = res.data.data.pageData; - if (backClass){ - var full_cz_val = backClass[backClass.length - 1].BuyGradeSum; - //th.setData({ full_cz_val: full_cz_val}); - obj.full_cz_val = full_cz_val - } - }) - - //--会员权益中心页的修改-- - for(var i in backClass){ - var im=backClass[i]; - if(cz_vals { + 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 + }; + + // 获取最大值 + await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", { + data: { + storeId: os.stoid + } + }).then(res => { + if (res.data.data) + backClass = res.data.data.pageData; + if (backClass) { + var full_cz_val = backClass[backClass.length - 1].BuyGradeSum; + //th.setData({ full_cz_val: full_cz_val}); + obj.full_cz_val = full_cz_val + } + }) - //获取当前等级的特权 - await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page",{ - data: { storeId: os.stoid, GradeId: gid, userId: app_d.user_id, pageSize: 100} - }).then(res=>{ - if (res.data.data) - g_qy_list=res.data.data.pageData; - }); + //--会员权益中心页的修改-- + for (var i in backClass) { + var im = backClass[i]; + if (cz_vals < im.BuyGradeSum && need_money == 0) { + need_money = im.BuyGradeSum; + obj.need_money = need_money; + } + } - for(var i in arr_data){ - var item=arr_data[i]; - var FromId=th.check_is_has_qy(item,g_qy_list); - arr_data[i].ishas=0; - if(FromId){ - arr_data[i].ishas=1; - arr_data[i].FromId=FromId; - } + //获取当前等级的特权 + await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", { + data: { + storeId: os.stoid, + GradeId: gid, + userId: app_d.user_id, + pageSize: 100 } - arr_data.sort(function(a,b){ - return b.ishas-a.ishas - }) + }).then(res => { + if (res.data.data) + g_qy_list = res.data.data.pageData; + }); - //4个4个一组 - var arr = new Array(); - for(var i=0;i< arr_data.length;i+=4){ - arr.push(arr_data.slice(i,i+4)); + for (var i in arr_data) { + var item = arr_data[i]; + var FromId = th.check_is_has_qy(item, g_qy_list); + arr_data[i].ishas = 0; + if (FromId) { + arr_data[i].ishas = 1; + arr_data[i].FromId = FromId; } - //th.setData({ qy_list: arr, need_money: need_money}); - obj.qy_list=arr; - th.setData(obj); + } + arr_data.sort(function(a, b) { + return b.ishas - a.ishas + }) + + //4个4个一组 + var arr = new Array(); + for (var i = 0; i < arr_data.length; i += 4) { + arr.push(arr_data.slice(i, i + 4)); + } + //th.setData({ qy_list: arr, need_money: need_money}); + obj.qy_list = arr; + th.setData(obj); } }) @@ -197,21 +248,31 @@ Page({ th.requestRecommend(); /*-------系统是否开通等级卡,会员是等级卡-----*/ - getApp().getConfig2(function (e) { - var t_swi=e.switch_list; - if(t_swi) t_swi=JSON.parse(t_swi) - if(parseInt(t_swi.rank_switch)==2){ - var userInfo=th.data.userInfo; - if(userInfo.card_field!=null && userInfo.card_field!=undefined && userInfo.card_field!="" ){ - var now=ut.gettimestamp(); - var str= userInfo.card_expiredate; - var end = new Date(str); - end = Date.parse(end) / 1000; - //---判断是不是有过期--- - if(now0){ - var dd=[...th_recommend_list,...recommend_list]; - e.setData({recommend_list,dd}); - e.data.currentPage++; - }else{ - e.setData({nomore:1}); - } - } + requestRecommend: function() { + var e = this, + t = '/api/weshop/goods/page?page=' + e.data.currentPage; + var th_recommend_list = e.data.recommend_list; + getApp().request.get(t, { + data: { + is_mainshow: 1, + isonsale: 1, + is_recommend: 1, + is_on_sale: 1, + store_id: os.stoid, + pageSize: 10 + }, + success: function(ee) { + var recommend_list = ee.data.data.pageData; + if (recommend_list && recommend_list.length > 0) { + var dd = [...th_recommend_list, ...recommend_list]; + e.setData({ + recommend_list, + dd + }); + e.data.currentPage++; + } else { + e.setData({ + nomore: 1 + }); + } + } }) }, //--跳转到权益页面-- - go_qy:function () { - if(!this.data.userInfo) return false; - var url="/pages/user/userqy/userqy"; + go_qy: function() { + if (!this.data.userInfo) return false; + var url = "/pages/user/userqy/userqy"; getApp().goto(url); }, //--跳转到商品详情页面-- - go_goods:function (e) { - var gid=e.currentTarget.dataset.gid; - var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+gid; + go_goods: function(e) { + var gid = e.currentTarget.dataset.gid; + var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid; getApp().goto(url); }, - click_next:function(){ - var index=this.data.sw_index; + click_next: function() { + var index = this.data.sw_index; index++; - if(index>=this.data.qy_list.length) return; - this.setData({ sw_index:index}) + if (index >= this.data.qy_list.length) return; + this.setData({ + sw_index: index + }) }, - click_pre:function(){ - var index=this.data.sw_index; + click_pre: function() { + var index = this.data.sw_index; index--; - if(index<0) return; - this.setData({ sw_index:index}) + if (index < 0) return; + this.setData({ + sw_index: index + }) }, - onSli:function(e){ + onSli: function(e) { var that = this; that.setData({ sw_index: e.detail.current @@ -381,40 +461,51 @@ Page({ }, //--权益使用-- - go_qy_url:function (e) { - var th=this; - var no=e.currentTarget.dataset.no; - var ind=e.currentTarget.dataset.ind; - var find=e.currentTarget.dataset.find; - var item=th.data.qy_list[find][ind]; - if(item.ishas==undefined || !item.ishas){ + go_qy_url: function(e) { + var th = this; + var no = e.currentTarget.dataset.no; + var ind = e.currentTarget.dataset.ind; + var find = e.currentTarget.dataset.find; + var item = th.data.qy_list[find][ind]; + if (item.ishas == undefined || !item.ishas) { var qt_txt = th.selectComponent("#pop_txt"); //组件的id - var ob={title:"温馨提示",content:"当前会员暂无此权益"}; + var ob = { + title: "温馨提示", + content: "当前会员暂无此权益" + }; qt_txt.open(ob); return false; } - var url=e.currentTarget.dataset.img; + var url = e.currentTarget.dataset.img; switch (no) { case "01": - getApp().goto("/pages/user/user_coupon/user_coupon?img=" - +url+"&gradeId="+th.data.gradeId+"&FormId="+item.Id); + getApp().goto("/pages/user/user_coupon/user_coupon?img=" + + url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id); break; case "02": - getApp().goto("/pages/user/user_fw/user_fw?gradeId="+th.data.gradeId+"&FormId="+item.Id); + getApp().goto("/pages/user/user_fw/user_fw?gradeId=" + th.data.gradeId + "&FormId=" + item.Id); break; case "03": getApp().goto("/pages/user/user_spsy/user_spsy"); break; case "10": - getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get",{ - data:{storeId:os.stoid, formId:item.Id,userId:getApp().globalData.user_id,gradeId:th.data.gradeId}, - success:function (res) { - var val=res.data.data.Remark; - var title=res.data.data.PrivilegeName; + getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get", { + data: { + storeId: os.stoid, + formId: item.Id, + userId: getApp().globalData.user_id, + gradeId: th.data.gradeId + }, + success: function(res) { + var val = res.data.data.Remark; + var title = res.data.data.PrivilegeName; var qt_txt = th.selectComponent("#pop_txt"); //组件的id - var ob={title:title,content:val}; + var ob = { + title: title, + content: val + }; qt_txt.open(ob); } }) @@ -423,88 +514,94 @@ Page({ }, //跳转到链接 - goto:function (e) { - var url=e.currentTarget.dataset.url; - getApp().goto(url); + goto: function(e) { + var url = e.currentTarget.dataset.url; + getApp().goto(url); }, //---------联系客服------------ contactService: function() { - var s=getApp(); + var s = getApp(); s.getConfig(function(t) { - if(t.store_tel==undefined){ - getApp().request.get("/api/weshop/store/get/" + os.stoid,{ - isShowLoading:1, - data:{}, - success:function (rs) { + if (t.store_tel == undefined) { + getApp().request.get("/api/weshop/store/get/" + os.stoid, { + isShowLoading: 1, + data: {}, + success: function(rs) { getApp().globalData.config = rs.data.data; - if(rs.data.data.store_tel==null && rs.data.data.store_tel==undefined ){ + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { getApp().showWarning("商家未设置电话"); return false; } s.confirmBox("请联系客服:" + rs.data.data.store_tel); } }) - }else{ + } else { s.confirmBox("请联系客服:" + t.store_tel); } }); }, - go_info:function () { - getApp().goto("/pages/user/userinfo/userinfo"); + go_info: function() { + getApp().goto("/pages/user/userinfo/userinfo"); }, - jump: function () { + jump: function() { getApp().goto("/pages/user/grow_value/grow_value") }, // 判断生日营销的页面是不是存在 - birthday:function(){ + birthday: function() { + var th = this; - // rq.get("/api/weshop/marketing/birthday/act/judge", { - // data: { storeId: os.stoid, userId: app_d.user_id }, - // success: function (res) { - // var code = res.data.code; - // if (code == 0) { - // var giftbagid = res.data.data.giftBagId; - // var actId = res.data.data.id; - // var actImg = res.data.data.actImg; - // t.setData({ giftbagid: giftbagid, actId: actId, actImg: actImg }); - // t.setData({ is_banner: 1 }); - // } - - // } - // }) + rq.get("/api/weshop/marketing/birthday/act/judge", { + data: { storeId: os.stoid, userId: app_d.user_id }, + success: function (res) { + + var code = res.data.code; + if (code == 0) { + var giftbagid = res.data.data.giftBagId; + var actId = res.data.data.id; + var actImg = res.data.data.actImg; + th.setData({ giftbagid: giftbagid, actId: actId, actImg: actImg }); + th.setData({is_banner:1}); + } + + } + }) }, - clike_banne:function(){ + clike_banne: function() { var th = this; - var actId=th.data.actId; - var giftbagid=th.data.giftbagid; - if (actId != "" && giftbagid!=""){ - - wx.redirectTo({ - url: "/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3 - }); - }else{ + var actId = th.data.actId; + var giftbagid = th.data.giftbagid; - getApp().showWarning("请稍后重试"); + if (actId != "" && giftbagid != "") { + + getApp().goto("/pages/giftpack/birthdaygift/birthdaygift?actId=" + actId + "&gifbagid=" + giftbagid + "&orderType=" + 3); + } else { + + getApp().showWarning("请稍后重试"); } }, // 判断助力活动是不是存在 - is_assistance:function(){ - // var th = this; - // rq.get("/api/weshop/marketing/help/act/judge", { - // data: { storeId: os.stoid, userId: app_d.user_id }, - // success: function (res) { - // var code = res.data.code; - // if (code == 0) { - // th.setData({ is_assistance:1}); - // } - - // } - // }) + is_assistance: function() { + var th = this; + rq.get("/api/weshop/marketing/help/act/judge", { + data: { + storeId: os.stoid, + userId: app_d.user_id + }, + success: function(res) { + var code = res.data.code; + if (code == 0) { + th.setData({ + is_assistance: 1 + }); + } + + } + }) } diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 5b2764e..1375433 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -1,6 +1,6 @@ - + @@ -168,7 +168,7 @@ - - + 点击领取礼品