var t = require("../../../utils/util.js"), ut = t, e = require("../../../utils/common.js"), a = require("../../../utils/wxParse/wxParse.js"), s = getApp(), i = s.request, rq = i, oo = s.globalData, o = s.globalData.setting, os = o; var regeneratorRuntime = require('../../../utils/runtime.js'); var e = getApp(),oo = e.globalData.setting; Page({ data: { wu:false, imageurl: os.imghost,//有礼派图片地址, iurl: os.imghost,//有礼派图片地址, pt_state:0, order : null,//订单数据 currentTab: 0, current:0, ordertx:[],//头像 baseUrl: "/api/weshop/order/page?1=1", resourceUrl: e.globalData.setting.resourceUrl, currentPage: 1, requestData: null, original_img:null, timer:null, }, onLoad: function () { this.data.requestData=new Array(); this.init(0); wx.setNavigationBarTitle({ title: "我的拼团",}) }, onShow:function(){ var th=this; //设置全局定时器 th.data.timer=setInterval(function () { th.countDown(); },1000); }, /** * 点击tab切换 */ swichNav: function (e) { this.data.requestData=[]; this.data.currentPage=1; var that = this; if (that.data.order == null){ that.setData({ wu:true }) } if (this.data.currentTab === e.target.dataset.current) { return false; } else { that.setData({ currentTab: e.target.dataset.current, }) that.init(e.target.dataset.current); } }, async init(current) { var where="1=1"; var user_id = getApp().globalData.user_id; switch (current){ case "1": where+="&pt_status=1"; break; case "2": where += "&pt_ok=1"; break; case "3": where += "&pt_status=3"; break; } var goods_id = 0,//商品ID, original_img = [],//商品图片 ee = this, ordertx=[],//头像 order = null,//订单数据 goods = null,//商品数据 users = null,//会员数据 order_goods=null;//订单商品表 //获取订单表的信息根据活动user_id,pt_prom_id>0 AND pay_time>0 /*--- await getApp().request.promiseGet("/api/weshop/order/page?"+where, { data: { is_pt:1,store_id: os.stoid, user_id: user_id, pageSize: 6, page: this.data.currentPage,} }).then(res => { order = res.data.data.pageData; this.data.currentPage++; })--*/ await getApp().request.promiseGet("/api/weshop/order/pageTuan?"+where, { data: { is_pt:1,store_id: os.stoid, user_id: user_id, pageSize: 6, page: this.data.currentPage,} }).then(res => { order = res.data.data.pageData; this.data.currentPage++; }) wx.showLoading({ title: "加载中"}); for (i = 0; i < order.length; i++) { //获取订单从表信息 await getApp().request.promiseGet("/api/weshop/ordergoods/pageGoods", { data: { store_id: os.stoid, order_id: order[i].order_id } }).then(res => { order_goods = res.data.data.pageData; order[i].order_goods = order_goods; order[i].gimage = ee.data.imageurl + order_goods[0].original_img; }) //获取订单表信息根据上面查询的订单号order[i].pt_listno await getApp().request.promiseGet("/api/weshop/order/pagePtList", { data: { store_id: os.stoid, pt_listno: order[i].pt_listno,pageSize:60,page:1} }).then(res => { //console.log("ordertx"); ordertx = res.data.data.pageData; //console.log(ordertx); order[i].tx=ordertx; }) if (order[i].is_zsorder== 4) { var num = 0; var jt_data = JSON.parse(order[i].ct_rylist); for (var m in jt_data) { if (jt_data[m].rynum > num) num = jt_data[m].rynum; } order[i].max_ct_num = num; } var sf_num = order[i].ct_num; if (order[i].ct_num>=3){ sf_num=3;} sf_num=sf_num-ordertx.length; if(sf_num>0) { var arr = []; for(var j=0;j