From 725c8f7165687f280791cc9cbf6c3d5e36b4668f Mon Sep 17 00:00:00 2001 From: F5VT98DI7XY4X12\Administrator <765199919@qq.com> Date: Tue, 10 Sep 2019 15:38:51 +0800 Subject: [PATCH] 系统开关控制 --- pages/cart/cart2/cart2.js | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------- pages/cart/cart2_pt/cart2_pt.js | 5 ++++- pages/cart/cart_wk/cart_wk.js | 13 ++++++++----- pages/cart/cart_wk/cart_wk.wxml | 2 +- pages/goods/goodsInfo/goodsInfo.js | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------- pages/goods/goodsInfo/goodsInfo.wxml | 2 +- pages/user/coupons/coupons.js | 7 ++++++- pages/user/coupons/coupons.wxml | 2 +- pages/user/deposit/deposit.js | 7 +++++++ pages/user/deposit/deposit.wxml | 2 +- pages/user/integral/integral.js | 12 ++++++++---- pages/user/integral/integral.wxml | 5 +++-- pages/user/integral/integral.wxss | 4 ++-- 13 files changed, 200 insertions(+), 107 deletions(-) diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index 6ff839f..f8b89a1 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -72,18 +72,64 @@ Page({ selected_quan_list:null, //选择的券的门店 selected_quan_pick:null, + is_close_quan:0, }, onLoad: function(t) { - wx.setNavigationBarTitle({ title: "填写订单",}) var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); th.data.param=t; - //-----先获取物流,再获取用户信息,再展示页面----- - th.get_wuliu(th.get_info(th.show_page)); - + //先获取是否有关闭使用优惠券 + getApp().getConfig2(function (ee) { + var json_d = JSON.parse(ee.switch_list); + th.setData({ is_close_quan: json_d.is_close_quan }); + //-----先获取物流,再获取用户信息,再展示页面----- + th.get_wuliu(th.get_info(th.show_page)); + }) }, onUnload: function () { this.setData({ isclose: 1 })}, + + //----------子页返回父页触发---------- + onShow: function() { + console.log('onshow'); + var th=this; + console.log(th.data.isclose); + if (th.data.isclose==0){ + /*--- + wx.navigateTo({ + url: "/pages/user/index/index" + //url: "/pages/index/index/index" + })---*/ + wx.switchTab({ + url: "/pages/index/index/index" + }) + + }else{ + this.getuser_addr(function(ie){ + + console.log("getuser_addr") + console.log(ie) + + th.setData({user_addr: ie }); + var going=0; + + //使用计算器,避免空现象 + var jishi= setInterval(function () { + if (th.data.is_b_now == 1 && going==0) { + if(th.data.bn_goods) { + th.calculatePrice2();going=1;clearInterval(jishi); + } + }else if(going==0) { + if (th.data.cartlist){ + th.calculatePrice();going = 1; clearInterval(jishi); + } + } + },500) + + }); + } + }, + //-------------------获取物流--------------- get_wuliu(func) { var th = this; @@ -112,10 +158,15 @@ Page({ ];---*/ var user_addr = su.data.data.pageData; var item = null; + var def_item=null; for (var i = 0; i < user_addr.length; i++) { - if (user_addr[i]['is_default'] == 1) { item = user_addr[i]; break; } + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i];} + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } } + + if (item == null) item = def_item; if (item == null) item = user_addr[0]; + if(item==undefined) item=null; func(item); } @@ -260,14 +311,17 @@ Page({ arr[ind].check_quan_ware_list=check_quan_ware_list; arr[ind].check_quan_price_list=check_quan_price_list; - //调用接口,获取优惠券的列表 - var url="/api/weshop/couponList/getUseCouponList"; - await app.request.promiseGet(url,{ - data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100} - }).then(res=>{ - if(res.data.code==0) - arr[ind].quan_list=res.data.data.pageData; - }) + //是否关闭使用优惠券 + if (th.data.is_close_quan != 1) { + //调用接口,获取优惠券的列表 + var url="/api/weshop/couponList/getUseCouponList"; + await app.request.promiseGet(url,{ + data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:ckeck_quan_price,WareIds:check_quan_ware_list,pageSize:100} + }).then(res=>{ + if(res.data.code==0) + arr[ind].quan_list=res.data.data.pageData; + }) + } } th.setData({ @@ -314,13 +368,16 @@ Page({ th.data.check_quan_ware_list=t.data.data.erpwareid+""; var quanlist=null; - var url="/api/weshop/couponList/getUseCouponList"; - await app.request.promiseGet(url,{ - data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:th.data.ckeck_quan_price,WareIds:th.data.check_quan_ware_list,pageSize:100} - }).then(res=>{ - if(res.data.code==0) - quanlist=res.data.data.pageData; - }) + + if (th.data.is_close_quan != 1) { + var url="/api/weshop/couponList/getUseCouponList"; + await app.request.promiseGet(url,{ + data:{storeId:oo.stoid,userId:app.globalData.user_id,BuySum:th.data.ckeck_quan_price,WareIds:th.data.check_quan_ware_list,pageSize:100} + }).then(res=>{ + if(res.data.code==0) + quanlist=res.data.data.pageData; + }) + } t.data.data.prom_id = 0; t.data.data.prom_type = 0; @@ -371,36 +428,6 @@ Page({ } }, - //----------子页返回父页触发---------- - onShow: function() { - console.log('onshow'); - var th=this; - console.log(th.data.isclose); - if (th.data.isclose==0){ - /*--- - wx.navigateTo({ - url: "/pages/user/index/index" - //url: "/pages/index/index/index" - })---*/ - wx.switchTab({ - url: "/pages/index/index/index" - }) - - }else{ - this.getuser_addr(function(ie){ - - console.log("getuser_addr") - console.log(ie) - - th.setData({user_addr: ie }); - if (th.data.is_b_now == 1) { - th.calculatePrice2(); - } else { - th.calculatePrice(); - } - }); - } - }, //---------------检查是否有收货地址------------------- checkAddressList: function() { var t = this; diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index a38357e..2e733c3 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -107,9 +107,12 @@ Page({ var user_addr = su.data.data.pageData; var item = null; + var def_item=null; for (var i = 0; i < user_addr.length; i++) { - if (user_addr[i]['is_default'] == 1) { item = user_addr[i]; break; } + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; } + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } } + if (item == null) item = def_item; if (item == null) item = user_addr[0]; if (item == undefined) item = null; func(item); diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index 8235649..3ad0600 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -110,12 +110,13 @@ Page({ success: function(su) { var user_addr = su.data.data.pageData; var item = null; + var def_item = null; for (var i = 0; i < user_addr.length; i++) { - if (user_addr[i]['is_default'] == 1) { - item = user_addr[i]; - break; - } + if (user_addr[i]['is_default'] == 1) { def_item = user_addr[i]; } + if (user_addr[i]['is_pickup'] == 1) { item = user_addr[i]; } } + + if (item == null) item = def_item; if (item == null) item = user_addr[0]; if (item == undefined) item = null; func(item); @@ -218,7 +219,9 @@ Page({ jsarr.forEach(function(value,index){ if(count>=value['rynum']) price=value['price']; }) - var tail_money=price*order_goods.goods_num-order['order_amount']-order['user_money']; + var tail_money =(price*order_goods.goods_num-order['order_amount']-order['user_money']).toFixed(2); + + tail_money = parseFloat(tail_money); order.tail_money=tail_money; //--判断物流-- diff --git a/pages/cart/cart_wk/cart_wk.wxml b/pages/cart/cart_wk/cart_wk.wxml index 1fb7997..a4aa7a6 100644 --- a/pages/cart/cart_wk/cart_wk.wxml +++ b/pages/cart/cart_wk/cart_wk.wxml @@ -78,7 +78,7 @@ {{teamgroup.jt_ct_num}} - 成团单价 + 成团金额 {{filters.toFix(order.order_amount+order.user_money+order.tail_money,2)}} diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 801184f..a544746 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -50,8 +50,7 @@ Page({ activeCategoryId: 0, supportPageScroll: !1, address: { - address: "", - district: 0 + address: "", district: 0 }, shipping: "", shippingCost: 0, @@ -145,7 +144,7 @@ Page({ pd_xx: 0, is_normal: 0, //是否普通购买 teamgroup:null, //有多少人开团 - grounp_tatal:0, //有几个人开团 + grounp_tatal:0, //有几个人开团 timer:[], //商品的购买次数 @@ -201,12 +200,13 @@ Page({ is_show_pl:0, //是否品类 is_show_pp:0, //是否品牌 is_show_gb:0, //是否国别 + is_closecoupon:0, }, //------初始化加载---------- onLoad: function(t) { wx.setNavigationBarTitle({ title: "商品详情",}) - var ee = this, that=ee, + var ee = this, that=ee,th=ee, gid = t.goods_id; //如果tg_id是空的话,分享回来 @@ -218,33 +218,35 @@ Page({ gid: gid }); + + getApp().getConfig2(function (e) { + if (e.categoryset.indexOf("," + 1 + ",") != -1) { ee.setData({ is_show_pl: 1 }); } + if (e.categoryset.indexOf("," + 3 + ",") != -1) { ee.setData({ is_show_pp: 1 }); } + if (e.categoryset.indexOf("," + 2 + ",") != -1) { ee.setData({ is_show_gb: 1 }); } + + var json_d = JSON.parse(e.switch_list); + ee.setData({ store_config: e, is_closecoupon: json_d.is_closecoupon }); + ee.init(gid); + //------几人评价------- + n.init(th, "", "comments"); + th.requestCardNum(), wx.pageScrollTo && th.setData({ + supportPageScroll: !0 + }); + + }) + + //获取用户设备信息,屏幕宽度 wx.getSystemInfo({ success: res => { that.setData({ screenWidth: res.screenWidth }) } }) - - ee.init(gid); - //------几人评价------- - n.init(this, "", "comments"); - this.requestCardNum(), wx.pageScrollTo && this.setData({ - supportPageScroll: !0 - }); - - getApp().getConfig2(function (e) { - - if(e.categoryset.indexOf(","+1+",")!=-1){ ee.setData({is_show_pl:1}); } - if(e.categoryset.indexOf(","+3+",")!=-1){ ee.setData({is_show_pp:1}); } - if(e.categoryset.indexOf(","+2+",")!=-1){ ee.setData({is_show_gb:1}); } - ee.setData({store_config:e}); - }) - }, //------------程序初始化入口------------- async init(gid) { - var ee = this, + var ee = this,th=ee, gallery = null, is_collect = 0, collect_id = 0, @@ -344,17 +346,19 @@ Page({ } } - //----获取详情页的券的数量---- - await getApp().request.promiseGet("/api/weshop/prom/coupon/page", { - data: { - store_id: os.stoid, - type:1, - pageSize: 3, - page:1, - }, - }).then(res1 => { - fir_quan=res1.data.data.pageData; - }) + if (th.data.is_closecoupon!=1){ + //----获取详情页的券的数量---- + await getApp().request.promiseGet("/api/weshop/prom/coupon/page", { + data: { + store_id: os.stoid, + type:1, + pageSize: 3, + page:1, + }, + }).then(res1 => { + fir_quan=res1.data.data.pageData; + }) + } //--------获取视频图片--------- @@ -1426,7 +1430,7 @@ Page({ //----已经结束----- if (t.data.data.is_end == 1) { ee.setData({ - prom_type: 0,isshow:1, + prom_type: 0,isshow:1, }); ee.get_sku(os.stoid, ee.data.data.sku, gid); return false; @@ -1465,13 +1469,32 @@ Page({ th.data.buy_order = odr; if (odr.pt_status == 0 && odr.order_status == 1) { th.setData({ - user_order_pt_state: 1 + user_order_pt_state: 1 }); } if (odr.pt_status == 1 && odr.order_status == 1) { - th.setData({ - user_order_pt_state: 2 - }); + if (odr.is_zsorder == 4){ + getApp().request.promiseGet("/api/weshop/teamgroup/page/", { + data: { store_id: oo.stoid, team_id: odr.pt_prom_id, listno: odr.pt_listno } + }).then(res => { + var now=ut.gettimestamp(); + var tgr = res.data.data.pageData[0]; + //如果团的时间已经到了 + if (now >= tgr.kt_end_time){ + th.update_jiti(tgr.id); + }else{ + th.setData({ + user_order_pt_state: 2 + }); + } + + }) + + }else{ + th.setData({ + user_order_pt_state: 2 + }); + } } if (odr.pt_status == 2 && odr.is_zsorder == 4) { @@ -1895,7 +1918,7 @@ Page({ if (newd.kt_type > 1) { newd.is_pt_tz = 1; //开团类型 } - if (newd.kt_type == 3){ + if (newd.kt_type == 3 && th.data.is_normal!=1){ th.data.sto_sele_distr=1; } @@ -2569,6 +2592,26 @@ Page({ var ob={}; ob[txt] = this.data.iurl + "/miniapp/images/default_g_img.gif"; this.setData(ob); + }, + + //--调用更新阶梯团的接口-- + update_jiti:function(id){ + var th=this; + //--更新阶梯团-- + getApp().request.put("/api/weshop/teamgroup/updateTeamOrder/"+os.stoid+"/"+id, { + success: function (ee) { + //--等于0是要去支付尾款,接口调用失败,就要去查看参团详情-- + if (ee.code==0) { + th.setData({ + user_order_pt_state: 3, + }); + }else if(ee.code==-1){ + th.setData({ + user_order_pt_state: 2, + }); + } + } + }) } }); \ No newline at end of file diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index b1bbff4..d0c8e97 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -300,7 +300,7 @@ - + 领券 diff --git a/pages/user/coupons/coupons.js b/pages/user/coupons/coupons.js index f573065..f667760 100644 --- a/pages/user/coupons/coupons.js +++ b/pages/user/coupons/coupons.js @@ -48,6 +48,7 @@ Page({ show: true, udata: null, iurl:os.imghost, + is_show_dhwz:0, }, // 点击选中二维码 click: function(e) { @@ -130,7 +131,11 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { - + var th = this; + getApp().getConfig2(function (ee) { + var json_d = JSON.parse(ee.switch_list); + th.setData({ is_show_dhwz: json_d.dhwz_switch }); + }) }, diff --git a/pages/user/coupons/coupons.wxml b/pages/user/coupons/coupons.wxml index 4fb6230..938ead2 100644 --- a/pages/user/coupons/coupons.wxml +++ b/pages/user/coupons/coupons.wxml @@ -9,7 +9,7 @@ 微券查询 - 微券兑换 + 微券兑换 diff --git a/pages/user/deposit/deposit.js b/pages/user/deposit/deposit.js index c1c9c04..a3a29a1 100644 --- a/pages/user/deposit/deposit.js +++ b/pages/user/deposit/deposit.js @@ -11,6 +11,7 @@ Page({ yucun_money:0, parameter:true, iurl: o.imghost, + is_show_yckcz:0, }, /** * 生命周期函数--监听页面显示 @@ -25,6 +26,12 @@ Page({ wx.setNavigationBarTitle({ title: "预存款", }) + + var th = this; + getApp().getConfig2(function (ee) { + var json_d = JSON.parse(ee.switch_list); + th.setData({ is_show_yckcz: json_d.yckcz_switch }); + }) }, /** diff --git a/pages/user/deposit/deposit.wxml b/pages/user/deposit/deposit.wxml index 2c39478..2fdc92f 100644 --- a/pages/user/deposit/deposit.wxml +++ b/pages/user/deposit/deposit.wxml @@ -7,7 +7,7 @@ - + 预存款充值 diff --git a/pages/user/integral/integral.js b/pages/user/integral/integral.js index 3b68f08..98611ca 100644 --- a/pages/user/integral/integral.js +++ b/pages/user/integral/integral.js @@ -30,6 +30,8 @@ Page({ money:1.00, integral:50, iurl: o.imghost, + + is_show_jfcz:0, }, /** * 刷出积分劵 @@ -47,9 +49,7 @@ Page({ data:get_data }).then(res => { var msg = res.data; - console.log("是什么",msg); - result = msg.data.pageData; - console.log("是什sssssss么", result); + result = msg.data.pageData; }) e.setData({ result: result @@ -192,7 +192,11 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + var th=this; + getApp().getConfig2(function(ee){ + var json_d = JSON.parse(ee.switch_list); + th.setData({ is_show_jfcz: json_d.jfcz_switch }); + }) }, /** diff --git a/pages/user/integral/integral.wxml b/pages/user/integral/integral.wxml index cf0ad36..57a0cd2 100644 --- a/pages/user/integral/integral.wxml +++ b/pages/user/integral/integral.wxml @@ -16,7 +16,7 @@ 积分明细 - 积分充值 + 积分充值 @@ -41,7 +41,8 @@ {{(details.OutIntegral==0)?"+":""}}{{(details.InIntegral==0)?filter.getNum(details.OutIntegral):filter.getNum(details.InIntegral)}}积分 - + + diff --git a/pages/user/integral/integral.wxss b/pages/user/integral/integral.wxss index f4afa89..9fec40e 100644 --- a/pages/user/integral/integral.wxss +++ b/pages/user/integral/integral.wxss @@ -431,7 +431,7 @@ line-height:85rpx; } /*左边的数据 */ .left{ - width:80%; + width:70%; height: 120rpx; } @@ -459,7 +459,7 @@ line-height:85rpx; font-size: 27rpx; font-family: 'SimHei',Arial; text-align:right; - + float: right } /* .更多 */ -- libgit2 0.21.4