diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index 6064565..bae83d3 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -46,6 +46,7 @@ Component({ title_index: 0, swiper_hei: 0, title_class: "", + is_no_plus:1, }, ready: function () { }, @@ -62,8 +63,7 @@ Component({ if (!getApp().globalData.func_list) getApp().globalData.func_list = []; getApp().globalData.func_list.push(this); } - - + //最新的版本才有nav_list if (nav_list) { nav_item = nav_list[0]; @@ -142,8 +142,10 @@ Component({ pageLifetimes: { //游客登录后,只要更新卡的情况 show: function () { + let th = this; //--初始化卡类-- this.card_init(); + }, }, @@ -190,38 +192,8 @@ Component({ th.data.loading = 0; if (res.data.code == 0 && res.data.data) { - var goods = res.data.data; - /*-- - var rData = th.data.requestData; - if (rData == null) rData=[]; - var now=ut.gettimestamp(); - - var new_arr=[]; - for (var ii in res.data.data){ - var item=res.data.data[ii]; - item.goods_img=th.data.imghost + item.original_img; - if(item.e_timenow) {item.prom_type=0; item.prom_price=0;} - new_arr.push(item); - } - rData = rData.concat(new_arr); - - th.data.requestData = rData; - - if(th.data.object.column==5){ - var arr = new Array(); - //--三个三个一组--- - for(var i=0;i< rData.length;i+=3){ - arr.push(rData.slice(i,i+3)); - } - th.setData({ goods_array: arr }); - }else{ - th.setData({ goods_array: rData }); - }--*/ - th.set_good(goods); - //---控制有没有加载更多的按钮--- if (th.data.firist_type_curr >= len) { th.setData({ goods_btn: [] }); } else th.setData({ goods_btn: [1, 2] }); @@ -293,6 +265,24 @@ Component({ }) break; } + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + console.log(res); + if (res.data.code == 0) { + + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) + }, setLoading: function () { @@ -455,7 +445,6 @@ Component({ var val = goods[i]; var item = {}; var prom_id = null; - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { var url = "/api/weshop/activitylist/getGoodActInfo"; var req_data = { diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxml b/components/diy_goodsGroup/diy_goodsGroup.wxml index f73d30d..29a2c8a 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.wxml +++ b/components/diy_goodsGroup/diy_goodsGroup.wxml @@ -59,7 +59,7 @@ - + @@ -210,7 +210,7 @@ ¥{{item.market_price}} - + @@ -360,7 +360,7 @@ ¥{{item.market_price}} - + @@ -516,7 +516,7 @@ - + @@ -691,7 +691,7 @@ ¥{{aitem.market_price}} - + diff --git a/components/diy_luckyGo/diy_luckyGo.js b/components/diy_luckyGo/diy_luckyGo.js index 245e973..c5a47ba 100644 --- a/components/diy_luckyGo/diy_luckyGo.js +++ b/components/diy_luckyGo/diy_luckyGo.js @@ -1,9 +1,3 @@ -// var e = function(e) { -// return e && e.__esModule ? e : { -// default: e -// }; -// }(require("../../utils/LoadMore3.js")), -// n = new e.default(), var t = getApp(), a = t.request, o = t.globalData.setting, diff --git a/components/diy_pingd_buy/diy_pingd_buy.js b/components/diy_pingd_buy/diy_pingd_buy.js index 26d126f..a33ca6c 100644 --- a/components/diy_pingd_buy/diy_pingd_buy.js +++ b/components/diy_pingd_buy/diy_pingd_buy.js @@ -1,9 +1,4 @@ -// var e = function(e) { -// return e && e.__esModule ? e : { -// default: e -// }; -// }(require("../../utils/LoadMore3.js")), -// n = new e.default(), + var t = getApp(), a = t.request, o = t.globalData.setting, diff --git a/components/diy_richtext/diy_richtext.js b/components/diy_richtext/diy_richtext.js index 67c2ba9..b58c5df 100644 --- a/components/diy_richtext/diy_richtext.js +++ b/components/diy_richtext/diy_richtext.js @@ -4,7 +4,7 @@ Component({ nodes: { type: String, - value: '

javascript - js同步编程与异步编程的区别,异步有哪些优点,为什么...

2016年5月20日 - 从编程方式来讲当然是同步编程的方式更为简单,但是同步有其局限性一是假如是单线程那么一旦遇到阻塞调用,会造成整个线程阻塞,导致cpu无法得到有效利用...
 - 百度快照
为您推荐:js同步和异步ajax异步和同步的区别
', + value: '', }, my:{ type: String, diff --git a/components/diy_richtext/diy_richtext.wxml b/components/diy_richtext/diy_richtext.wxml index ec52b63..affb040 100644 --- a/components/diy_richtext/diy_richtext.wxml +++ b/components/diy_richtext/diy_richtext.wxml @@ -1,11 +1,2 @@ - - - - - diff --git a/components/diy_serviceCard/diy_serviceCard.js b/components/diy_serviceCard/diy_serviceCard.js index 5d74dd5..58cd02e 100644 --- a/components/diy_serviceCard/diy_serviceCard.js +++ b/components/diy_serviceCard/diy_serviceCard.js @@ -226,33 +226,6 @@ Component({ if (res.data.code == 0 && res.data.data) { var goods = res.data.data.pageData; - // console.log('goods', goods); - // var rData = th.data.requestData; - // if (rData == null) rData=[]; - // var now=ut.gettimestamp(); - - // var new_arr=[]; - // for (var ii in res.data.data){ - // var item=res.data.data[ii]; - // item.goods_img=th.data.imghost + item.original_img; - // if(item.e_timenow) {item.prom_type=0; item.prom_price=0;} - // new_arr.push(item); - // } - // rData = rData.concat(new_arr); - - // th.data.requestData = rData; - - // if(th.data.object.column==5){ - // var arr = new Array(); - // //--三个三个一组--- - // for(var i=0;i< rData.length;i+=3){ - // arr.push(rData.slice(i,i+3)); - // } - // th.setData({ goods_array: arr }); - // }else{ - // th.setData({ goods_array: rData }); - // }-- th.set_good(goods); @@ -353,91 +326,13 @@ Component({ //---卡的初始化---- card_init: function() { - // var th = this, - // os = getApp().globalData.setting; - // if (!getApp().globalData.user_id) return false; - // getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, { - // isShowLoading: false, - // success: function(e) { - // getApp().globalData.userInfo = e.data.data; - // getApp().getConfig2(function(e) { - // var swithc_list = e.switch_list; - // var sw_arr = JSON.parse(swithc_list); - // //---如果后台又开等级卡的开关--- - // if (sw_arr.rank_switch && sw_arr.rank_switch == "2") { - // th.setData({ - // rank_switch: true - // }); - // //---回调卡的列表--- - // th.getPlusCardType(function(ob) { - // th.setData({ - // card_list: ob.card_list - // }); - // var ti = setInterval(function() { - // var user = getApp().globalData.userInfo; - // if (!user) return false; - // clearInterval(ti); - - // if (user.card_field && user['card_expiredate']) { - // var str = user['card_expiredate'].replace(/-/g, '/'); - // var end = new Date(str); - // end = Date.parse(end) / 1000; - // var now = ut.gettimestamp(); - - // //--- 判断是等级会员,且在有效期范围内 --- - // if (user.card_field && now < end) { - // var card_name = ob.name_map.get(user.card_field); - // if (card_name.length > 4) card_name = card_name.substring(0, 4); - // th.setData({ - // card_field: user.card_field, - // card_name: card_name, - // card_list: ob.card_list - // }); - // } - - // } - - // }, 500) - // }) - - // } - // }) - // } - // }) + }, //--- 获取卡类列表 --- getPlusCardType: function(func) { - // var storid = o.stoid; - // var th = this; - // getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { - // var plusCard = res.data.data; - // var arr = [1219, 2089, 3031]; - // var new_arr = new Array(); - // var card_name_map = new Map(); - - // var user = getApp().globalData.userInfo; - - // if (plusCard) { - - // for (var i = 0; i < plusCard.length; i++) { - // if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { - // continue; - // } - - // var name = "card" + plusCard[i].CorrPrice.toLowerCase(); - // card_name_map.set(name, plusCard[i].CardName); - // new_arr.push(plusCard[i]); - // } - // } - - // var ob = { - // "card_list": new_arr, - // "name_map": card_name_map - // }; - // func(ob); - // }) + }, @@ -505,26 +400,7 @@ Component({ var val = goods[i]; var item = {}; var prom_id = null; - //app.request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + val.goods_id, {}).then(res => { - - // var url = "/api/weshop/activitylist/getGoodActInfo"; - // var req_data = { - // store_id: os.stoid, - // goodsidlist: val.goods_id, - // is_detail: 1, - // user_id: user_id - // }; - - //获取商品的实际活动 - // await getApp().request.promiseGet(url, { - // data: req_data - // }).then(res => { - // if (res.data.code == 0 && res.data.data && res.data.data.length == 1) { - // item.prom_type = res.data.data[0].prom_type; - // item.prom_id = res.data.data[0].act_id; - // } - // }) - // console.log('val++++++<<<<<', val); + item.goods_name = val.serviceName; item.goods_img = th.data.imghost + val.imgUrl; item.market_price = val.show_price; @@ -532,12 +408,6 @@ Component({ item.sales_sum = val.sales_sum; item.goods_id = val.id; - // item.cardprice1 = val.cardprice1; - // item.cardprice2 = val.cardprice2; - // item.cardprice3 = val.cardprice3; - // item.prom_type = val.prom_type; - // item.prom_id = val.prom_id; - if (val.prom_price) item.prom_price = val.prom_price; if (val.prom_integral) item.prom_integral = val.prom_integral; @@ -547,44 +417,6 @@ Component({ var url = ""; - // switch (prom_type) { - // case 1: - // var user_id = getApp().globalData.user_id; - // if (!user_id) user_id = 0; - // url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id; - // break; - // case 2: - // url = "/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + val.goods_id + "/" + prom_id - // break; - // case 4: - // url = "/api/weshop/integralbuy/get/" + os.stoid + "/" + prom_id; - // break; - // case 6: - // url = "/api/weshop/teamlist/get/" + os.stoid + "/" + prom_id; - // break; - // case 8: - // var presell_id = prom_id; - // var url1 = "/api/weshop/marketing/marketingPresellList/list"; - // var rd = { - // store_id: os.stoid, - // presell_id: presell_id, - // goods_id: val.goods_id - // } - // //------获取预售从表---------- - // await getApp().request.promiseGet(url1, { - // data: rd - // }).then(res => { - // if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { - // var arr = res.data.data[0]; - // item.prom_price = arr.luck_goods_price; - // item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0); - // } - // }) - // break; - // default: - // break - // } - if (url != null && url != '') { await getApp().request.promiseGet(url, {}).then(res => { var prom = null; @@ -627,9 +459,7 @@ Component({ page: th.data.currentPage - 1, }); } - - - // console.log('goods_array0000000000====>>>', th.data.goods_array); + }, diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js index 5c9ce87..f1dbfec 100644 --- a/components/goods_list/goods_list.js +++ b/components/goods_list/goods_list.js @@ -16,7 +16,8 @@ Component({ card_field: "", card_name: "", max_card_field: "", - card_list: null + card_list: null, + is_no_plus:1, }, properties: { // 这⾥定义了innerText属性,属性值可以在组件使⽤时指定 @@ -87,20 +88,25 @@ Component({ } - }) + }), + + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) }, - // get_list: function () { - // var th = this; - // var url = "http://172.20.0.233:8022/api/weshop/display"; - // wx.request({ - // url: url, - // success: function (res) { - // th.setData({ - // recommend: res.data.data.pageData - // }) - // } - // }) - // }, + get_list: function () { var that = this; if (that.data.is_no_more == 0) return false; diff --git a/components/goods_list/goods_list.wxml b/components/goods_list/goods_list.wxml index 7675f86..dfd190a 100644 --- a/components/goods_list/goods_list.wxml +++ b/components/goods_list/goods_list.wxml @@ -2,153 +2,153 @@ - - + + - - - - - - - - - {{item.goods_name}} - - + + + + + + + + + {{item.goods_name}} + + - - {{item.prom_integral}}积分 - + - - - - {{item.prom_price}} - - - - - - - {{item.market_price}} - - + + {{item.prom_integral}}积分 + + + + + + {{item.prom_price}} + + + + + + + {{item.market_price}} + + - - - - - - - - - - - - - - {{filter.toFix(item[card_field],2)}} - - - {{card_name}} - - - - - - - - {{item.market_price}} - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - {{item.market_price}} - - - - + + + + + + + + + + + + + {{filter.toFix(item[card_field],2)}} + + + {{card_name}} + + + + + + + + {{item.market_price}} + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + + + + + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + {{item.market_price}} + + + + - - {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} - - - {{g_filter.get_card_price(item,card_list,1)}} + + {{filter.toFix(g_filter.get_card_price(item,card_list,0),2)}} + + + + {{g_filter.get_card_price(item,card_list,1)}} - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - - {{filter.toFix(item.shop_price,2)}} - - - - - - - {{item.market_price}} - - - - - - - - - - - 没有更多内容了 - - + +
+ + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + +
+
+ + + + + + + {{filter.toFix(item.shop_price,2)}} + + + + + + + {{item.market_price}} + + + +
+ + + + + + + 没有更多内容了 + + \ No newline at end of file diff --git a/components/serviceCard_list/serviceCard_list.js b/components/serviceCard_list/serviceCard_list.js index d642be6..210b188 100644 --- a/components/serviceCard_list/serviceCard_list.js +++ b/components/serviceCard_list/serviceCard_list.js @@ -90,18 +90,6 @@ Component({ } }) }, - // get_list: function () { - // var th = this; - // var url = "http://172.20.0.233:8022/api/weshop/display"; - // wx.request({ - // url: url, - // success: function (res) { - // th.setData({ - // recommend: res.data.data.pageData - // }) - // } - // }) - // }, get_list: function () { var that = this; if (that.data.is_no_more == 0) return false; @@ -109,18 +97,8 @@ Component({ if(!user_id) user_id=0; var curPage = that.data.curPage; - - // page: curPage, - // pageSize: 6, - // orderField: "sort", - // orderType: 'asc', - // // user_id: user_id, - // // is_mainshow: 1, - // // isonsale: 1, - // // is_on_sale: 1, - // is_recommend: 1, - // store_id: o.stoid, - + + getApp().request.get('/api/weshop/serviceCard/page', { isShowLoading: false, data: { diff --git a/components/timePicker/timePicker.js b/components/timePicker/timePicker.js index 0096d7d..ed02ede 100644 --- a/components/timePicker/timePicker.js +++ b/components/timePicker/timePicker.js @@ -83,14 +83,10 @@ Component({ * 组件的初始数据 */ data: { - // pickerShow:true - // limitStartTime: new Date().getTime()-1000*60*60*24*30, - // limitEndTime: new Date().getTime(), - // yearStart:2000, - // yearEnd:2100 + }, detached: function() { - console.log("dele"); + }, attached: function() {}, ready: function() { @@ -384,11 +380,7 @@ Component({ this.setStartDate(startYear, startMonth, startDay, startHour, startMinute, startSecond); this.setEndDate(endYear, endMonth, endDay, endHour, endMinute, endSecond); - //!!! - // setTimeout(() => { - // this.setStartDate(nowYear, nowMonth, nowDay, nowHour, nowMinute) - // this.setEndDate(nowYear, nowMonth, nowDay, nowHour, nowMinute) - // }, 0); + }, setPickerDateArr(type, year, month, day, hour, minute, second) { let yearIdx = 0; diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index ad7d3e8..532967a 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -107,15 +107,11 @@ Component({ fontcolor:data.fontcolor, is_custum:1 }) - // console.log('abc=======<<<<<', this.data.list); + }, nav_goto:function(e){ - // const data = e.currentTarget.dataset - // this.setData({ - // active: data.index - // }) - // console.log('active***********<<<<<', this.data.active); + var url=e.currentTarget.dataset.url; if(!url) return false; if(url[0]!='/') url='/'+url; @@ -123,18 +119,7 @@ Component({ getApp().goto(url); }, - - // switchTab(e) { - // const data = e.currentTarget.dataset - // const url = data.path - // wx.switchTab({url}) - // this.setData({ - // selected: data.index - // }) - // } - - } diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index 0c417bb..23f8d7f 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -4,9 +4,6 @@ - - {{cartGoodsNum}} @@ -23,8 +20,7 @@ - + diff --git a/packageA/pages/distribution/shop/shop.js b/packageA/pages/distribution/shop/shop.js index 951e5b5..d6f6f83 100644 --- a/packageA/pages/distribution/shop/shop.js +++ b/packageA/pages/distribution/shop/shop.js @@ -36,6 +36,7 @@ Page({ card_list: null, isAll: true, + is_no_plus:1, default_img: '/miniapp/images/default_g_img.gif', }, @@ -214,6 +215,23 @@ Page({ } }) } + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + console.log(res); + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) + if (app.globalData.key_word) { this.setData({ diff --git a/packageA/pages/distribution/shop/shop.wxml b/packageA/pages/distribution/shop/shop.wxml index 419c52f..e7e0abf 100644 --- a/packageA/pages/distribution/shop/shop.wxml +++ b/packageA/pages/distribution/shop/shop.wxml @@ -99,7 +99,7 @@ - + @@ -155,7 +155,7 @@ {{item.market_price}} - + @@ -243,7 +243,7 @@ - + diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js index e6c1775..05e480a 100644 --- a/pages/activity/pind_list/pind_list.js +++ b/pages/activity/pind_list/pind_list.js @@ -61,11 +61,6 @@ Page({ }); } }) - // var user_id=getApp().globalData.user_id; - // if(!user_id) user_id=0; - // this.setData({ - // user_id, - // }) this.requestSalelist(); }, @@ -74,15 +69,7 @@ Page({ this.data.currentPage = 1; this.data.ismore = 1; var th = this; - // var userInfo = wx.getStorageSync('userinfo'); - // if (userInfo) { - // //调用列表 - // this.requestSalelist(userInfo.user_id); - // } else { - // getApp().goto("/pages/togoin/togoin"); - // } - //设置全局定时器 th.data.timer = setInterval(function () { th.countDown(); diff --git a/pages/cart/cart2/c_filter.wxs b/pages/cart/cart2/c_filter.wxs index e8eda3e..01114fe 100644 --- a/pages/cart/cart2/c_filter.wxs +++ b/pages/cart/cart2/c_filter.wxs @@ -15,6 +15,7 @@ var filters = { if(ind==1 ) return "green"; if(ind==2) return "blue"; if(ind==11) return "green"; + if(ind==13) return "red"; if(ind==12) return "blue"; if(ind==20) return "green"; return ""; @@ -44,6 +45,7 @@ var filters = { if (ind == 2) return "指定品类"; if (ind == 11) return "指定用途"; if (ind == 12) return "指定分类1"; + if (ind == 13) return "全场通用"; if (ind == 20) return "指定单品"; return ""; }, diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 4e12a82..d7accad 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -1609,11 +1609,15 @@ Page({ //累积商品重量 每种商品的重量 * 数量 goods_weight += item[jo]['weight'] * item[jo]['goods_num']; by_g_weight+=item[jo]['weight'] * item[jo]['goods_num']; - if (weight_free > 0) { - out_of_weight = (weight_free * 1000) - by_g_weight; - }else{ - out_of_weight= -by_g_weight; + + if(free1>0){ + if (weight_free > 0) { + out_of_weight = (weight_free * 1000) - by_g_weight; + }else{ + out_of_weight= -by_g_weight; + } } + } } //这个是在不包邮列表礼包 @@ -1629,11 +1633,13 @@ Page({ } } - //当商品没有超出的时候 - if(out_of_weight>=0){ - out_of_weight= -by_g_weight; - }else{ - out_of_weight= -weight_free * 1000; + if(free1>0) { + //当商品没有超出的时候 + if (out_of_weight >= 0) { + out_of_weight = -by_g_weight; + } else { + if (weight_free > 0) out_of_weight = -weight_free * 1000; + } } //所有的商品都不在不包邮商品列表,freight_free为0的时候,以及不是区域包邮 diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js index caee622..029a2a3 100644 --- a/pages/goods/goodsList/goodsList.js +++ b/pages/goods/goodsList/goodsList.js @@ -24,6 +24,7 @@ Page({ rq_data:null, isToggle: false, //切换商品视图控制符 show_all:1, //判断显示 + is_no_plus:1 }, onLoad: function(t) { @@ -186,7 +187,22 @@ Page({ }) },500) } - }); + }); + //调用接口判断商家plus有没有过期 + getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" + oo.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) + } + } + } + } + }) }, //设置优惠券的 diff --git a/pages/goods/goodsList/goodsList.wxml b/pages/goods/goodsList/goodsList.wxml index 96377db..3371d20 100644 --- a/pages/goods/goodsList/goodsList.wxml +++ b/pages/goods/goodsList/goodsList.wxml @@ -88,7 +88,7 @@ - + diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml index 2d0812a..9a21925 100644 --- a/pages/index/index/index.wxml +++ b/pages/index/index/index.wxml @@ -461,7 +461,6 @@ - diff --git a/pages/user/index/index.js b/pages/user/index/index.js index d553601..4455d69 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -25,7 +25,7 @@ Page({ txmon: 0, byquan: 0, yuer: 0, - is_no_plus:1, + is_no_plus: 1, currentPage: 1, recommend_list: [], tc_hide: true, @@ -41,12 +41,12 @@ Page({ actId: "", //生日活动的id actImg: "", is_assistance: 0, //助力活动 - ad_img:"", - add_card_data:'', //等级卡的内容 + ad_img: "", + add_card_data: '', //等级卡的内容 + - }, - goto_nav: function(e) { + goto_nav: function (e) { var th = this; var url = e.currentTarget.dataset.url; if (th.data.userInfo != null) { @@ -60,124 +60,124 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { - var th=this; - getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { - data: { - enabled: 1 - }, - success:function(res){ - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){ - var item=res.data.data.pageData[0]; - if (item && item.ad_code) th.setData({ad_img:item.ad_code}) - } - } - }) - app.getUserFir(); + onLoad: function (options) { + var th = this; + getApp().request.get("/api/weshop/ad/page?pid=401&store_id=" + os.stoid, { + data: { + enabled: 1 + }, + success: function (res) { + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length) { + var item = res.data.data.pageData[0]; + if (item && item.ad_code) th.setData({ ad_img: item.ad_code }) + } + } + }) + app.getUserFir(); - - //-- 读取会员中心按钮列表 -- - /*-- - getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { - success:function(res){ - if(ut.ajax_ok(res)) { - var d_list=res.data.data.pageData; - getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ - var dis=rs.data.data; - for(var i in d_list){ - if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ - d_list.splice(i,1); - } - } - th.setData({user_tool:d_list}); + + //-- 读取会员中心按钮列表 -- + /*-- + getApp().request.get("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { + success:function(res){ + if(ut.ajax_ok(res)) { + var d_list=res.data.data.pageData; + getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ + var dis=rs.data.data; + for(var i in d_list){ + if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ + d_list.splice(i,1); + } + } + th.setData({user_tool:d_list}); - }) - } - } - }) - --*/ - this.init_user_tool() + }) + } + } +}) + --*/ + this.init_user_tool() }, /** * 生命周期函数--监听页面显示 */ - onShow: function() { - //看一下小程序是不是过期了 - getApp().getConfig2(function(config2){ - if(config2 && config2.is_overdue==1){ - getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{ - var o=res; - if (o.data.code == 0) { - var ob = { isout: 0, isbuy: 1 }; - var arr = o.data.data.pageData; - var isbuy = 0; - //----如果数组不为空---- - if (arr.length > 0) { - arr.forEach(function (val, ind) { - if (val.is_sy == 0 && val.type == 5) { - isbuy = 1; - var now = ut.gettimestamp(); - if (now > val.end_time) ob.isout = 1; - return false; - } - }) - } - ob.isbuy = isbuy; - th.setappdata(ob); - } + onShow: function () { + //看一下小程序是不是过期了 + getApp().getConfig2(function (config2) { + if (config2 && config2.is_overdue == 1) { + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=5", {}).then(res => { + var o = res; + if (o.data.code == 0) { + var ob = { isout: 0, isbuy: 1 }; + var arr = o.data.data.pageData; + var isbuy = 0; + //----如果数组不为空---- + if (arr.length > 0) { + arr.forEach(function (val, ind) { + if (val.is_sy == 0 && val.type == 5) { + isbuy = 1; + var now = ut.gettimestamp(); + if (now > val.end_time) ob.isout = 1; + return false; + } }) + } + ob.isbuy = isbuy; + th.setappdata(ob); } - }) + }) + } + }) - //调用接口判断商家plus有没有过期 - rq.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { - if (res.data.code == 0) { - var arr = res.data.data.pageData; - if (arr.length > 0) { - var item = arr[0]; - if (item.is_sy == 0) { - var now = Date.parse(new Date()); now = now / 1000; - if (item.end_time < now) { - th.setData({ is_no_plus: 0 }) - } - } + //调用接口判断商家plus有没有过期 + rq.promiseGet("/store/storemoduleendtime/page?store_id=" + os.stoid + "&type=3", {}).then(res => { + if (res.data.code == 0) { + var arr = res.data.data.pageData; + if (arr.length > 0) { + var item = arr[0]; + if (item.is_sy == 0) { + var now = Date.parse(new Date()); now = now / 1000; + if (item.end_time < now) { + th.setData({ is_no_plus: 0 }) } + } } + } }) - var th=this; - - // 判断是否开启美业 - getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => { - if(res.data.code == 0) { - th.setData({ - enableMeiye: res.data.data.EnableMeiye, - }); - }; - }); - - + var th = this; + + // 判断是否开启美业 + getApp().promiseGet('/api/weshop/store/getTabSys/' + os.stoid, {}).then(res => { + if (res.data.code == 0) { + th.setData({ + enableMeiye: res.data.data.EnableMeiye, + }); + }; + }); + + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + os.stoid, {}).then(res => { - if(res.data.code==0){ + if (res.data.code == 0) { var plusCard = res.data.data; for (var i = 0; i < plusCard.length; i++) { - if(!plusCard[i].IsStopBuy) { th.setData({show_buy_plus:1}); break; } + if (!plusCard[i].IsStopBuy) { th.setData({ show_buy_plus: 1 }); break; } } } }) - - if (typeof this.getTabBar === 'function' && this.getTabBar()) { - var index=getApp().getPageIndex(this); - this.getTabBar().setData({ - active: index //数字是当前页面在tabbar的索引 - }); - //getApp().requestCardNum(this); - } + + if (typeof this.getTabBar === 'function' && this.getTabBar()) { + var index = getApp().getPageIndex(this); + this.getTabBar().setData({ + active: index //数字是当前页面在tabbar的索引 + }); + //getApp().requestCardNum(this); + } var stoid = app_d.setting.stoid; @@ -186,295 +186,293 @@ Page({ cur_g_num = 0; /*------会员登录------*/ - var e=getApp().globalData.userInfo; + var e = getApp().globalData.userInfo; if (e != undefined && e != null && e.mobile) { - this.birthday(); - this.is_assistance(); + this.birthday(); + this.is_assistance(); - s.setData({ - userInfo: e - }); - - //-- 要调用接口,获取卡的钱 -- - var url="/api/weshop/wxuser/getWxCardInfo?storeId="+os.stoid+"&userId="+e.user_id; - rq.get(url,{ - isShowLoading:0, - success: function(su) { - if(su.data.code==0){ - s.setData({ - add_card_data: su.data.data, - }); - } - } - }); - - /*-----统计-----*/ - rq.get("/api/weshop/order/waitlist", { - isShowLoading:0, - data: { - user_id: app_d.user_id - }, - success: function(su) { + s.setData({ + userInfo: e + }); + + //-- 要调用接口,获取卡的钱 -- + var url = "/api/weshop/wxuser/getWxCardInfo?storeId=" + os.stoid + "&userId=" + e.user_id; + rq.get(url, { + isShowLoading: 0, + success: function (su) { + if (su.data.code == 0) { s.setData({ - toji: su.data.data, + add_card_data: su.data.data, }); } - }) - /*-----获取线下会员的预存款和优惠券的数量-----*/ - rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { - isShowLoading:0, - success: function(su) { - if(su.data.code==0 && su.data.data ) { - var data = su.data.data; - if(!data) data={}; - data.cashcount = parseInt(data.cashcount); - s.setData({ - udata: data, - }); - } - + } + }); + + /*-----统计-----*/ + rq.get("/api/weshop/order/waitlist", { + isShowLoading: 0, + data: { + user_id: app_d.user_id + }, + success: function (su) { + s.setData({ + toji: su.data.data, + }); + } + }) + /*-----获取线下会员的预存款和优惠券的数量-----*/ + rq.get("/api/weshop/users/getinfo/" + os.stoid + "/" + e.user_id, { + isShowLoading: 0, + success: function (su) { + if (su.data.code == 0 && su.data.data) { + var data = su.data.data; + if (!data) data = {}; + data.cashcount = parseInt(data.cashcount); + s.setData({ + udata: data, + }); } - }) - /*-----获取会员提现金额-----*/ - rq.get("/api/weshop/withdrawals/summoney", { - isShowLoading:0, - 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 - }); - } + + } + }) + /*-----获取会员提现金额-----*/ + rq.get("/api/weshop/withdrawals/summoney", { + isShowLoading: 0, + 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 + }); } - }) + } + }) - /*-----获取会员包邮券的数量-----*/ - rq.get("/api/weshop/userfeemail/page", { - isShowLoading:0, - 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) - }); - } + /*-----获取会员包邮券的数量-----*/ + rq.get("/api/weshop/userfeemail/page", { + isShowLoading: 0, + 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) + }); } - }); - - /*-----物流信息提醒-----*/ - rq.get('/api/weshop/order/countDadaOrder', { - isShowLoading:0, - data: { - user_id: e.user_id, - store_id: os.stoid, - }, - success: function(su) { - if (su.data.code == 0) { - th.setData({ - countDadaOrder: su.data.data - }); - } - } - }); - - - - - //--初始化是否有打勾-- - getApp().request.get("/api/weshop/users/grade/vip/init/get", { - data: { - storeId: os.stoid - }, - success:function (rs) { - if(rs.data.code==0 && rs.data.data.isBool){ - th.setData({is_init:1}); - /*-----获取会员权益列表-----*/ - rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", { - isShowLoading:0, - data: { - storeId: os.stoid, - pageSize: 100 - }, - success: async function(res) { - - //判断有没有值,没有值返回 - if(!ut.ajax_ok(res)) return false; - - var arr_data = res.data.data.pageData; - var gid = null, - g_qy_list = null, - cz_vals = 0, - need_money = 0, - backClass = null, - - GradeName = ''; - - //获取成长值 - 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, - gradeId: gid, - is_grad_get:1 - }; - - // 获取最大值 - 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 < im.BuyGradeSum && need_money == 0) { - need_money = im.BuyGradeSum; - obj.need_money = need_money; - } - } - - //获取当前等级的特权 - 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 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; - } - } - 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); - } - }) - } - } - }) - - - - /*-- 获取 --*/ - th.requestRecommend(); - - /*-------系统是否开通等级卡,会员是等级卡-----*/ - getApp().getConfig2(function(e) { - var t_swi = e.switch_list; - if (t_swi) t_swi = JSON.parse(t_swi) - if(t_swi){ - th.setData({sys_switch:t_swi}); - - var user_tool=[]; - if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); - th.setData({c_list:user_tool}) - + } + }); + + /*-----物流信息提醒-----*/ + rq.get('/api/weshop/order/countDadaOrder', { + isShowLoading: 0, + data: { + user_id: e.user_id, + store_id: os.stoid, + }, + success: function (su) { + if (su.data.code == 0) { + th.setData({ + countDadaOrder: su.data.data + }); } + } + }); + + + + + //--初始化是否有打勾-- + getApp().request.get("/api/weshop/users/grade/vip/init/get", { + data: { + storeId: os.stoid + }, + success: function (rs) { + if (rs.data.code == 0 && rs.data.data.isBool) { + th.setData({ is_init: 1 }); + /*-----获取会员权益列表-----*/ + rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", { + isShowLoading: 0, + data: { + storeId: os.stoid, + pageSize: 100 + }, + success: async function (res) { + + //判断有没有值,没有值返回 + if (!ut.ajax_ok(res)) return false; + var arr_data = res.data.data.pageData; + var gid = null, + g_qy_list = null, + cz_vals = 0, + need_money = 0, + backClass = null, - 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 (now < end) { - th.setData({ - is_dengji: 1 + GradeName = ''; + + //获取成长值 + 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}); }) - } else { - th.setData({ - is_dengji: 3 + var obj = { + cz_val: cz_vals, + GradeName: GradeName, + gradeId: gid, + is_grad_get: 1 + }; + + // 获取最大值 + 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 < im.BuyGradeSum && need_money == 0) { + need_money = im.BuyGradeSum; + obj.need_money = need_money; + } + } + + //获取当前等级的特权 + 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 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; + } + } + 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); } + }) + } + } + }) + + /*-- 获取 --*/ + th.requestRecommend(); + + /*-------系统是否开通等级卡,会员是等级卡-----*/ + getApp().getConfig2(function (e) { + var t_swi = e.switch_list; + if (t_swi) t_swi = JSON.parse(t_swi) + if (t_swi) { + th.setData({ sys_switch: t_swi }); + + var user_tool = []; + if (t_swi.usertool) user_tool = JSON.parse(t_swi.usertool); + th.setData({ c_list: user_tool }) + + } + + + 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 (now < end) { + th.setData({ + is_dengji: 1 + }) } else { th.setData({ - is_dengji: 2 + is_dengji: 3 }) } + } else { + th.setData({ + is_dengji: 2 + }) } - }) - //th.requestRecommend(); - - - - - - } - - /*-- - var t_swi= getApp().globalData.config2.switch_list - if (t_swi){ - t_swi = JSON.parse(t_swi); - var user_tool=[]; - if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); - th.setData({c_list:user_tool}) - } --*/ + } + }) + //th.requestRecommend(); + + + - //自定义组件一定要等到页面加载完了,才来调用selectComponnent - setTimeout(function () { - if (getApp().globalData.user_id) getApp().requestCardNum(th); - var goods_list = th.selectComponent("#goods_recommend"); //组件的id - goods_list.init(); - goods_list.get_list(); - },800) + + } + + /*-- + var t_swi= getApp().globalData.config2.switch_list + if (t_swi){ + t_swi = JSON.parse(t_swi); + var user_tool=[]; + if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); + th.setData({c_list:user_tool}) + } --*/ + + //自定义组件一定要等到页面加载完了,才来调用selectComponnent + setTimeout(function () { + if (getApp().globalData.user_id) getApp().requestCardNum(th); + var goods_list = th.selectComponent("#goods_recommend"); //组件的id + goods_list.init(); + goods_list.get_list(); + }, 800) @@ -483,7 +481,7 @@ Page({ //判断会员是后有改服务项目 - check_is_has_qy: function(item, g_qy_list) { + check_is_has_qy: function (item, g_qy_list) { if (!g_qy_list) return false; for (var i in g_qy_list) { @@ -496,13 +494,13 @@ Page({ /** * 生命周期函数--监听页面隐藏 */ - onHide: function() { - for(var i = 1; i < 100; i++) { + onHide: function () { + for (var i = 1; i < 100; i++) { clearInterval(i); } }, - setappdata: function(t) { - var t=getApp().globalData.wxapp_buy_obj; + setappdata: function (t) { + var t = getApp().globalData.wxapp_buy_obj; if (t && t.isout == 1) wx.navigateTo({ url: "/pages/error/error?msg=小程序已经过期", @@ -516,11 +514,11 @@ Page({ /** * 页面上拉触底事件的处理函数 */ - onReachBottom: function() { + onReachBottom: function () { //!this.nomore && this.requestRecommend(); var goods_list = this.selectComponent("#goods_recommend"); //组件的id goods_list.init(); - setTimeout(function() { + setTimeout(function () { goods_list.get_list(); }, 300) }, @@ -528,42 +526,42 @@ Page({ /** * 用户点击右上角分享 */ - onShareAppMessage: function() {}, + onShareAppMessage: function () { }, //------卡片的显示和关闭-------- - show_tc: function() { + show_tc: function () { if (!this.data.userInfo) return false; //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') - var val=this.data.userInfo.mobile+"|"+ut.formatTime(); - val="^"+ut.base64_encode(val); + var val = this.data.userInfo.mobile + "|" + ut.formatTime(); + val = "^" + ut.base64_encode(val); qrcode('qrcode', val, 480, 480, this); this.setData({ tc_hide: false, }); }, - hide_tc: function() { + hide_tc: function () { this.setData({ tc_hide: true, }); }, //--跳转到预存款页面-- - deposit: function() { + deposit: function () { if (!this.data.userInfo) return false; wx.navigateTo({ url: '../deposit/deposit', }) }, //--跳转到余额页面-- - balance: function() { + balance: function () { if (!this.data.userInfo) return false; wx.navigateTo({ url: '../member/menber', }) }, //--跳转到优惠券-- - coupon: function() { + coupon: function () { var th = this; if (!this.data.userInfo) return false; // th.sendsm(); @@ -572,20 +570,20 @@ Page({ }) }, //--跳转到积分-- - integral: function() { + integral: function () { if (!this.data.userInfo) return false; wx.navigateTo({ url: '../integral/integral', }) }, //--跳到绑定页面-- - gobindtel: function() { + gobindtel: function () { wx.navigateTo({ url: '/pages/togoin/togoin', }) }, - go_order: function(e) { + go_order: function (e) { if (!this.data.userInfo) return false; var url = e.currentTarget.dataset.url; wx.navigateTo({ @@ -595,7 +593,7 @@ Page({ }, //--加载更多商品-- - requestRecommend: function() { + requestRecommend: function () { var e = this, t = '/api/weshop/goods/page?page=' + e.data.currentPage; var th_recommend_list = e.data.recommend_list; @@ -608,7 +606,7 @@ Page({ store_id: os.stoid, pageSize: 10 }, - success: function(ee) { + success: function (ee) { var recommend_list = ee.data.data.pageData; if (recommend_list && recommend_list.length > 0) { var dd = [...th_recommend_list, ...recommend_list]; @@ -627,20 +625,20 @@ Page({ }, //--跳转到权益页面-- - go_qy: function() { + go_qy: function () { if (!this.data.userInfo) return false; var url = "/pages/user/userqy/userqy"; getApp().goto(url); }, //--跳转到商品详情页面-- - go_goods: function(e) { + 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() { + click_next: function () { var index = this.data.sw_index; index++; if (index >= this.data.qy_list.length) return; @@ -649,7 +647,7 @@ Page({ }) }, - click_pre: function() { + click_pre: function () { var index = this.data.sw_index; index--; if (index < 0) return; @@ -658,7 +656,7 @@ Page({ }) }, - onSli: function(e) { + onSli: function (e) { var that = this; that.setData({ sw_index: e.detail.current @@ -666,7 +664,7 @@ Page({ }, //--权益使用-- - go_qy_url: function(e) { + go_qy_url: function (e) { var th = this; var no = e.currentTarget.dataset.no; var ind = e.currentTarget.dataset.ind; @@ -683,8 +681,8 @@ Page({ } var url = e.currentTarget.dataset.img; - if(!url || url==""){ - url=`/public/upload/userqy/quanbg.jpg` + if (!url || url == "") { + url = `/public/upload/userqy/quanbg.jpg` } switch (no) { case "01": @@ -696,7 +694,7 @@ Page({ break; case "03": getApp().goto("/pages/user/user_spsy/user_spsy?img=" + - url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id); + url + "&gradeId=" + th.data.gradeId + "&FormId=" + item.Id); break; case "10": getApp().request.get("/api/weshop/users/grade/vipprivilegelist/other/get", { @@ -706,7 +704,7 @@ Page({ userId: getApp().globalData.user_id, gradeId: th.data.gradeId }, - success: function(res) { + success: function (res) { var val = res.data.data.Remark; var title = res.data.data.PrivilegeName; var qt_txt = th.selectComponent("#pop_txt"); //组件的id @@ -722,20 +720,20 @@ Page({ }, //跳转到链接 - goto: function(e) { + goto: function (e) { var url = e.currentTarget.dataset.url; getApp().goto(url); }, //---------联系客服------------ - contactService: function() { + contactService: function () { var s = getApp(); - s.getConfig(function(t) { + s.getConfig(function (t) { if (t.store_tel == undefined) { getApp().request.get("/api/weshop/store/get/" + os.stoid, { isShowLoading: 1, data: {}, - success: function(rs) { + success: function (rs) { getApp().globalData.config = rs.data.data; if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { getApp().showWarning("商家未设置电话"); @@ -750,15 +748,15 @@ Page({ }); }, - go_info: function() { + 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", { @@ -771,13 +769,13 @@ Page({ 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}); + th.setData({ is_banner: 1 }); } } }) }, - clike_banne: function() { + clike_banne: function () { var th = this; var actId = th.data.actId; var giftbagid = th.data.giftbagid; @@ -792,143 +790,141 @@ Page({ }, // 判断助力活动是不是存在 - is_assistance: function() { - var th = this,r=Math.random()*100; + is_assistance: function () { + var th = this, r = Math.random() * 100; rq.get("/api/weshop/marketing/help/act/judge", { data: { storeId: os.stoid, userId: app_d.user_id, - r:r, + r: r, }, - success: function(res) { + success: function (res) { var code = res.data.code; if (code == 0) { th.setData({ is_assistance: 1 }); - }else{ - th.setData({ - is_assistance: 0 - }); - } + } else { + th.setData({ + is_assistance: 0 + }); + } } }) }, //导航跳转 - nav_goto:function(e){ - var url=e.currentTarget.dataset.url; - if(!url || url=='') return; - if(url[0]!='/') url='/'+url; - getApp().goto(url); - }, - - //添加卡包 - addcard:function(){ - var res=this.data.add_card_data; - if(!res) return false; - - var arr = new Array(6) - arr[0] = res.code; - arr[1] = res.timestamp; - arr[2] = res.jsapiTicket; - arr[3] = res.openid; - arr[4] = res.cardid; - arr[5] = res.nonceStr; - var c=arr.sort(); - var newstr=""; - for (var i=0;i 0) { - template_id = res.data.data.pageData[0].template_id; - // //授权订阅 - wx.requestSubscribeMessage({ - tmplIds: [template_id], - success(res) { - - }, - fail(res) { - - } - }) - } + nav_goto: function (e) { + var url = e.currentTarget.dataset.url; + if (!url || url == '') return; + if (url[0] != '/') url = '/' + url; + getApp().goto(url); + }, + + //添加卡包 + addcard: function () { + var res = this.data.add_card_data; + if (!res) return false; + + var arr = new Array(6) + arr[0] = res.code; + arr[1] = res.timestamp; + arr[2] = res.jsapiTicket; + arr[3] = res.openid; + arr[4] = res.cardid; + arr[5] = res.nonceStr; + var c = arr.sort(); + var newstr = ""; + for (var i = 0; i < c.length; i++) { + newstr += c[i]; + } + + var sh1 = ut.sha1(newstr); + wx.addCard({ + cardList: [ + { + cardId: res.cardid, + cardExt: '{"code": "' + res.code + '", "openid": "' + res.openid + '","timestamp": "' + res.timestamp + '","nonce_str":"' + res.nonceStr + '","outer_str":"web", "signature":"' + sh1 + '"}' } - }) - }, - - con_weixin:function () { - var url=this.data.sys_switch.weapp_customertype_url; - var id=this.data.sys_switch.weapp_customertype_appid; - wx.openCustomerServiceChat({ - extInfo: {url: url}, - corpId: id, - success(res) {} - }) - }, - - //初始话按钮图标 - init_user_tool:async function () { - var d_list=null; - //读取user_tool按钮图标 - await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id="+os.stoid, { - }).then(res=>{ - if(ut.ajax_ok(res)) { - d_list=res.data.data.pageData; - } - }) - if(!d_list) return false; - //过滤掉分销关闭的 - await getApp().promiseGet("/api/weshop/storeDistribut/get/"+os.stoid,{}).then(rs=>{ - if(rs.data.code==0){ - var dis=rs.data.data; - for(var i in d_list){ - if(d_list[i].name=='我的分销' && (!dis || dis.switch==0)){ - d_list.splice(i,1); - } - } - } - }) - //判断右没有开AI测肤 - await getApp().promiseGet("/api/weshop/wx/weappSkin/get/"+os.stoid,{}).then(rs=>{ - if(rs.data.code!=0 || !rs.data.data){ - for(var i in d_list){ - if(d_list[i].name=='AI测肤'){ - d_list.splice(i,1); - } - } + ], + success: function (res) { }, + cancel: function (res) { } + }); + }, + + //订阅消息提醒 + sendsm: function () { + var template_id = ""; + rq.get("/api/wx/weappSendlist/page", { + data: { + store_id: os.stoid, + typeid: "1020" + }, + success: function (res) { + if (res.data.code == 0 && res.data.data.pageData.length > 0) { + template_id = res.data.data.pageData[0].template_id; + // //授权订阅 + wx.requestSubscribeMessage({ + tmplIds: [template_id], + success(res) { + + }, + fail(res) { + } - }) - this.setData({user_tool:d_list}); - } + }) + } + } + }) + }, + + con_weixin: function () { + var url = this.data.sys_switch.weapp_customertype_url; + var id = this.data.sys_switch.weapp_customertype_appid; + wx.openCustomerServiceChat({ + extInfo: { url: url }, + corpId: id, + success(res) { } + }) + }, + + //初始话按钮图标 + init_user_tool: async function () { + var d_list = null; + //读取user_tool按钮图标 + await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id=" + os.stoid, { + }).then(res => { + if (ut.ajax_ok(res)) { + d_list = res.data.data.pageData; + } + }) + if (!d_list) return false; + //过滤掉分销关闭的 + await getApp().promiseGet("/api/weshop/storeDistribut/get/" + os.stoid, {}).then(rs => { + if (rs.data.code == 0) { + var dis = rs.data.data; + for (var i in d_list) { + if (d_list[i].name == '我的分销' && (!dis || dis.switch == 0)) { + d_list.splice(i, 1); + } + } + } + }) + + //判断右没有开AI测肤 + await getApp().promiseGet("/api/weshop/wx/weappSkin/get/" + os.stoid, {}).then(rs => { + if (rs.data.code != 0 || !rs.data.data) { + for (var i in d_list) { + if (d_list[i].name == 'AI测肤') { + d_list.splice(i, 1); + } + } + } + }) + this.setData({ user_tool: d_list }); + } diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index fc4fe8a..59eb0a5 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -2,343 +2,349 @@