diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js index 7ac451a..83eb91e 100644 --- a/components/diy_goodsGroup/diy_goodsGroup.js +++ b/components/diy_goodsGroup/diy_goodsGroup.js @@ -50,11 +50,19 @@ Component({ ready: function () {}, lifetimes: { - attached: function() { + attached: function() { + //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法 var nav_item=this.data.object; var nav_list= this.data.object.nav_list; + + if(parseInt(nav_item.is_automore)){ + 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]; @@ -158,6 +166,7 @@ Component({ await app.request.get("/api/weshop/goods/getgoodslistOrdby?store_id=" + os.stoid + "&goodsidlist=" + str, { isShowLoading:false, success: function(res) { + th.data.loading=0; if(res.data.code==0 && res.data.data){ var rData = th.data.requestData; @@ -210,6 +219,7 @@ Component({ await app.request.promiseGet("/api/weshop/goods/page", { data:r_data }).then(res => { + th.data.loading=0; //商品地址 var goods = res.data.data.pageData; th.setData({ @@ -233,6 +243,7 @@ Component({ isonsale: 1, } }).then(res => { + th.data.loading=0; //商品地址 var goods = res.data.data.pageData; th.setData({ @@ -250,6 +261,8 @@ Component({ setLoading: function () { var that = this; + if(this.data.loading) return false; + this.data.loading=1; that.init(that.data.classstyle_id, that.data.wgroup); }, @@ -461,7 +474,16 @@ Component({ }); } - } + }, + + re_show:function () { + if(this.data.object.goodscount *this.data.page { - if(res.data.code==0 && res.data.data){ - if(res.data.data.is_show!=1){ - isok=0; - } - //如果活动已经结束 - if(res.data.data.is_end==1){ - isok=0; - } - //已经结束 - if(ut.gettimestamp()>res.data.data.end_time){ - isok=0; - } - //还未开始 - if(ut.gettimestamp() { + if(res.data.code==0 && res.data.data){ + if(res.data.data.is_show!=1){ + isok=0; + } + //如果活动已经结束 + if(res.data.data.is_end==1){ + isok=0; + } + //已经结束 + if(ut.gettimestamp()>res.data.data.end_time){ + isok=0; + } + //还未开始 + if(ut.gettimestamp() { - if (ut.ajax_ok(res)) { - gdlist = res.data.data.pageData[0]; - item.buyqty=gdlist.buyqty; + }) + if (!isok){ + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + getApp().request.delete(url, {}); + th.data.zuhe_map[item.prom_id]=-1; + continue; } - }) + th.data.zuhe_map[item.prom_id]=act; + + var url1 = "/api/weshop/prom/zhbuyGoods/page"; + var req_data = { + page: 1, + pageSize: 2000, + store_id: os.stoid, + zh_id: item.prom_id, + goods_id:item.goods_id + } + await getApp().request.promiseGet(url1, { + data: req_data + }).then(res => { + if (ut.ajax_ok(res)) { + var gdlist = res.data.data.pageData; + th.data.zuhe_map_good[item.prom_id]=gdlist; + } + }) + } + if(th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id]!=-1 ){ + var gdlist=th.data.zuhe_map_good[item.prom_id]; + var t_item=gdlist.find(function (ele) { + return ele.goods_id==item.goods_id + }) + item.buyqty=t_item.buyqty; + item.zh_b_num=promgoodsbuynum; + item.act=th.data.zuhe_map[item.prom_id]; + } } else if(item.prom_type == 0) { //如果有优惠活动,要更新活动 @@ -425,6 +444,19 @@ Page({ item.erpwareid=good.erpwareid; //要同步下线商品的id item.shop_price=good.shop_price; //要同步下线商品的id + //当商品要计算等级价的售 + if(item.prom_type == 0 || item.prom_type == 3 || item.prom_type == 5 || item.prom_type == 7){ + if(th.data.card_field){ + item.goods_price=good[th.data.card_field]; //要同步下线商品的id + }else{ + item.goods_price=good.shop_price; + } + + var t=item; + getApp().request.put("/api/weshop/cart/update", {isShowLoading:0,data: t,}) + + } + var pcid = item.pick_id; var find = 0; //---------循环查找门店--- diff --git a/pages/cart/cart/zh_calculate.js b/pages/cart/cart/zh_calculate.js index ad2fc1a..79213cd 100644 --- a/pages/cart/cart/zh_calculate.js +++ b/pages/cart/cart/zh_calculate.js @@ -60,7 +60,7 @@ module.exports = { var txt = "requestData[" + a + "].need_list"; //活动的列表都存储在这里面,可以快速查询 var zh_prom_goods=car_item.zh_prom_goods; - if (!car_item.zh_map && !zh_prom_goods) { + if (!car_item.zh_map || !zh_prom_goods) { var res = { tfeel: tfeel, offline_price: offline_price, diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 9bf77e9..05e9df8 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -601,6 +601,14 @@ Page({ onReachBottom: function() { var goods_list = this.selectComponent("#goods_list"); //组件的id if (goods_list) goods_list.get_list(); + + if(getApp().globalData.func_list) + { + for(let i in getApp().globalData.func_list){ + let item=getApp().globalData.func_list[i]; + item.re_show(); + } + } }, onPullDownRefresh: function(e) { diff --git a/pages/template/index.js b/pages/template/index.js index bfbc70d..75a3f69 100644 --- a/pages/template/index.js +++ b/pages/template/index.js @@ -82,16 +82,27 @@ Page({ setCountTime: function(e) { }, - - + + onPageScroll: function(e) { - + }, onShareAppMessage: function(e) { }, + //---加载更多是靠这个函数---- + onReachBottom: function() { + if(getApp().globalData.func_list) + { + for(let i in getApp().globalData.func_list){ + let item=getApp().globalData.func_list[i]; + item.re_show(); + } + } + }, + }); \ No newline at end of file diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js index e3604d0..49538cd 100644 --- a/pages/user/order_detail/order_detail.js +++ b/pages/user/order_detail/order_detail.js @@ -1,6 +1,7 @@ var e = getApp(), r = e.request,rq=r,t = require("../../../utils/util.js"), o = require("../../../utils/common.js"),oo=e.globalData,os=oo.setting; var regeneratorRuntime = require('../../../utils/runtime.js'); var ut= require('../../../utils/util.js'); +var py = require("../../../utils/pay.js"); Page({ @@ -637,12 +638,20 @@ Page({ } } - + + /*--- o.jumpToCart4({ order_sn: this.data.order.order_sn, order_amount: this.data.order.order_amount, type: 1 //正常单 - }, 1); + }, 1);--*/ + + py.pay(this.data.order.order_sn, function() { + wx.showToast({title: '支付成功'}) + wx.navigateBack(); + },null,os.stoid,1); + + }, checkTeam: function() { wx.navigateTo({ diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 8ea2e4f..6aac307 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -13,6 +13,7 @@ var t = function(t) { s = new t.default(); var regeneratorRuntime = require('../../../utils/runtime.js'); var ut= require('../../../utils/util.js'); +var t = require("../../../utils/pay.js"); Page({ data: { @@ -435,7 +436,7 @@ Page({ /*----------跳转支付-----------*/ async jumpToCart4(t) { var o_index = t.currentTarget.dataset.idx; - var e = this.data.orderList[t.currentTarget.dataset.idx]; + var e = this.data.orderList[o_index]; var th = this; var order=e ; var order_goods=e.order_goods; @@ -753,15 +754,12 @@ Page({ } - th.pay_next(e); + th.pay_next(e,o_index); }, - pay_next(e){ + pay_next(e,o_index){ var th=this; - - - if (e.order_amount == 0) { var dd = { parent_sn: e.order_sn, @@ -779,12 +777,22 @@ Page({ } }) return false; - } + } + + /*--- a.jumpToCart4({ order_sn: e.order_sn, order_amount: e.order_amount, type: 1 //正常单 - }); + });--*/ + + t.pay(e.order_sn, function() { + wx.showToast({title: '支付成功'}) + th.data.orderList.splice(o_index,1); + th.setData({orderList:th.data.orderList}); + },null,os.stoid,1); + + }, //---检验线下库存的数量的子函数---