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/index/index/index.js b/pages/index/index/index.js index ec7ff68..e836597 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -90,7 +90,7 @@ Page({ }); } }) - // th.is_festival(); + th.is_festival(); }, //关闭新用户领取广告 diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js index c7a6af6..4760a66 100644 --- a/pages/user/assistance/task_assistance.js +++ b/pages/user/assistance/task_assistance.js @@ -13,6 +13,8 @@ Page({ * 页面的初始数据 */ data: { + swpie_img: s.imghost +"/miniapp/images/user_index_powder.jpg", + defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg",//助力头像的默认图 sw_index: 0, //轮播的下标控制 url: s.url, //接口网址 iurl: s.imghost, @@ -25,17 +27,22 @@ Page({ help_id: "", //活动的id canvasHidden: 0, //分享图片是否已经生成 gid: "", timer: null, //全局的定时器 - user_task_list: null, //会员列表 + user_task_list: [], //会员列表 taskid: "", //任务id usercount: 0, //参与的人数 - dismantle: null, //帮拆记录数据集 + dismantle:[], //帮拆记录数据集 is_user_task: null, //判断是不是领取的任务 zzjx_id: "", //真正进行的任务id is_show: 0, //任务的加载更多 is_bc_show: 0, //帮拆的加载更多 bc_page: 1, //帮拆的页码 rw_page: 1, //任务的页码 - block: 0, //阻断助力的用户图片多次添加 + block: 0, //阻断助力的我的任务在当前位置多次点击 + is_dismantle:0, //阻断助力的帮拆记录在当前位置多次点击 + is_clik:0,//点击的时候控制划动 + is_dis_list:0,//多个数据的时候 + is_user_list:0,//我的任务点击加载更多的后 + //*********************************************start钱 canvasHidden: 0, //分享图片是否已经生成 is_share: 0, //是否显示画布 @@ -208,14 +215,18 @@ Page({ this.get_user_task_num(); }, - - + //记录加载更多 + dismantle_record_list:function(){ + this.setData({ is_dismantle:0}); + this.dismantle_record(); + }, //帮拆记录的 dismantle_record: function(e) { - //优化444444444444444444 - if (this.data.switch_head == 1) { + //优化 + if (this.data.is_dismantle == 1) { return false; } + var aitem = this.data.aitem; //任务的数据集 var sw_index = this.data.sw_index; //轮播的下标 //任务id @@ -235,6 +246,7 @@ Page({ switch_head: 1, block: 0, }); + var bc_page = th.data.bc_page; rq.get("/api/weshop/marketing/help/help/task/involve/page", { data: { @@ -246,19 +258,32 @@ Page({ }, success: function(res) { if (res.data.code == 0) { + th.setData({is_dismantle: 1}); var dismantle = res.data.data.pageData[0].zlHelpUser; if (res.data.data.total > 5) { var bc_page = th.data.bc_page + 1; - th.data({ + var dismantle_s = th.data.dismantle.concat(dismantle); + th.setData({ bc_page: bc_page, - is_bc_show: 1 + is_bc_show: 1, + dismantle: dismantle_s, + is_dis_list:1 }) } else { - getApp().my_warnning("暂无更多内容", 0, th); + th.setData({ + dismantle: dismantle, + is_dis_list: 0 + }); + } + var dis_len=th.data.dismantle.length; + if (res.data.data.total == dis_len){ + th.setData({ + is_dis_list: 0, + }) } - th.setData({ - dismantle: dismantle + + is_clik: 0, }); } else { th.setData({ @@ -273,7 +298,8 @@ Page({ 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); + var taskingid = e.currentTarget.dataset.taskingid; + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id="+taskingid); }, //查看礼包id select_libao: function(e) { @@ -283,6 +309,10 @@ Page({ //划动的时候监听 onSli: function(e) { + var arr=[]; + this.setData({ + dismantle: arr + }); var th = this; var ind = e.detail.current; var aitem = this.data.aitem; @@ -291,10 +321,12 @@ Page({ th.setData({ sw_index: ind, task_number: task_number, - taskid: task_id + taskid: task_id, + is_dismantle: 0, + bc_page:1 }); - - if (this.data.switch_head == 1) { + + if (this.data.switch_head == 1&&th.data.is_clik==0) { //判断有没有帮拆记录 this.dismantle_record(); } @@ -308,6 +340,11 @@ Page({ var nav_b = th.selectComponent("#nav_b"); //组件的id nav_b.close_box(); }, + //我的任务点击加载更多 + task_list:function(){ + this.setData({ block:0}); + this.user_task_list(); + }, // 获取会员的参与的任务列表 我的任务 user_task_list: function(e) { var th = this; @@ -346,14 +383,24 @@ Page({ rw_page: rw_page, is_show: 1 }) - getApp().my_warnning(su.data.msg, 1, th); + } - - var user_list = su.data.data.pageData; + + + var user_list = su.data.data.pageData; + // if (user_list == "" || user_list.length == 0 || user_list==null){ + // th.setData({ + // is_user_list: 1 + // }); + // console.log("走哪里1111"); + // }else{} + console.log("走哪里22222222"); + var user_lists=th.data.user_task_list.concat(user_list); th.setData({ - user_task_list: user_list + user_task_list: user_lists }); } else { + th.setData({ is_user_list: 1 }); getApp().my_warnning(su.data.msg, 0, th); } } @@ -436,6 +483,10 @@ Page({ // 轮播图点击左边 click_pre: function() { + var arr=[]; + this.setData({ + dismantle:arr + }); var index = this.data.sw_index; index--; if (index < 0) return; @@ -445,18 +496,29 @@ Page({ this.setData({ sw_index: index, task_number: task_number, - taskid: task_id + taskid: task_id, + is_dismantle: 0, + is_clik:1, + bc_page:1 }) if (this.data.switch_head == 1) { //判断有没有帮拆记录 + console.log("往左点////////////////////"); this.dismantle_record(); } - //判断有没有领取任务 - this.get_user_task(); + if (this.data.switch_head == 0){ + //判断有没有领取任务 + this.get_user_task(); + } + }, //轮播图点击右边 click_next: function() { - + var arr=[]; + this.setData({ + is_clik:1, + dismantle: arr + }); var index = this.data.sw_index; index++; if (index >= this.data.aitem.length) return; @@ -466,7 +528,9 @@ Page({ this.setData({ sw_index: index, task_number: task_number, - taskid: task_id + taskid: task_id, + is_dismantle: 0, + bc_page:1, }) if (this.data.switch_head == 1) { this.dismantle_record(); @@ -901,8 +965,11 @@ Page({ //立即兑换 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); + var sw_index=this.data.sw_index; + var aitem=this.data.aitem; + var taskid = aitem[sw_index].id; + var taskingid= e.currentTarget.dataset.taskingid; + getApp().goto("/pages/user/assistance/giftpacklist?help_id=" + this.data.help_id + "&is_libao=" + 1 + "&taskId=" + taskid + "&id="+taskingid); }, 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..35dd121 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,93 @@ 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; + t.setData({ giftbagid: giftbagid, actId: actId, actImg: actImg }); + t.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!=""){ + 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{ - - getApp().showWarning("请稍后重试"); + wx.redirectTo({ + url: "/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 + }); + } + + } + }) }