Commit efe98ac95116dc93c96ea9afd27c996b74dc5f51
1 parent
88672417
商品的会员团开团的显示
Showing
4 changed files
with
66 additions
and
36 deletions
pages/goods/goodsInfo/goodsInfo.js
| @@ -4678,12 +4678,14 @@ Page({ | @@ -4678,12 +4678,14 @@ Page({ | ||
| 4678 | 4678 | ||
| 4679 | //--获取有多少人在开团-- | 4679 | //--获取有多少人在开团-- |
| 4680 | async get_team_group(prom_id) { | 4680 | async get_team_group(prom_id) { |
| 4681 | - var teamgroup = [], | 4681 | + var teamgroup_arr = [], |
| 4682 | th = this, | 4682 | th = this, |
| 4683 | grounp_tatal = 0; | 4683 | grounp_tatal = 0; |
| 4684 | //如果活动是开团不是商家团 | 4684 | //如果活动是开团不是商家团 |
| 4685 | if (this.data.prom_act.kttype > 1) { | 4685 | if (this.data.prom_act.kttype > 1) { |
| 4686 | 4686 | ||
| 4687 | + var teamgroup=null; | ||
| 4688 | + | ||
| 4687 | var req_data = { | 4689 | var req_data = { |
| 4688 | store_id: os.stoid, | 4690 | store_id: os.stoid, |
| 4689 | pageSize: 3, | 4691 | pageSize: 3, |
| @@ -4701,30 +4703,43 @@ Page({ | @@ -4701,30 +4703,43 @@ Page({ | ||
| 4701 | await getApp().request.promiseGet("/api/weshop/teamgroup/page", { | 4703 | await getApp().request.promiseGet("/api/weshop/teamgroup/page", { |
| 4702 | data: req_data | 4704 | data: req_data |
| 4703 | }).then(res => { | 4705 | }).then(res => { |
| 4704 | - teamgroup = res.data.data.pageData; | ||
| 4705 | - grounp_tatal = res.data.data.total; | 4706 | + if(ut.ajax_ok(res)){ |
| 4707 | + teamgroup = res.data.data.pageData; | ||
| 4708 | + grounp_tatal = res.data.data.total; | ||
| 4709 | + } | ||
| 4710 | + | ||
| 4706 | }) | 4711 | }) |
| 4707 | - //获取订单的总数这个接口不能用 | ||
| 4708 | - for (i = 0; i < teamgroup.length; i++) { | ||
| 4709 | - await getApp().request.promiseGet("/api/weshop/order/page", { | ||
| 4710 | - data: { | ||
| 4711 | - store_id: os.stoid, | ||
| 4712 | - pt_status: 1, | ||
| 4713 | - pt_listno: teamgroup[i].listno | ||
| 4714 | - } | ||
| 4715 | - }).then(res => { | ||
| 4716 | - var order = res.data.data.pageData; | ||
| 4717 | - teamgroup[i].open_num = order.length; | ||
| 4718 | - }) | ||
| 4719 | - await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + teamgroup[i].openvipid, {}).then(res => { | ||
| 4720 | - var user = res.data.data; | ||
| 4721 | - teamgroup[i].user = user; | ||
| 4722 | - }) | 4712 | + if(teamgroup){ |
| 4713 | + //获取订单的总数这个接口不能用 | ||
| 4714 | + for (i = 0; i < teamgroup.length; i++) { | ||
| 4715 | + await getApp().request.promiseGet("/api/weshop/order/page", { | ||
| 4716 | + data: { | ||
| 4717 | + store_id: os.stoid, | ||
| 4718 | + pt_status: 1, | ||
| 4719 | + pt_listno: teamgroup[i].listno | ||
| 4720 | + } | ||
| 4721 | + }).then(res => { | ||
| 4722 | + if(ut.ajax_ok(res)){ | ||
| 4723 | + var order = res.data.data.pageData; | ||
| 4724 | + teamgroup[i].open_num = order.length; | ||
| 4725 | + } | ||
| 4726 | + }) | ||
| 4727 | + | ||
| 4728 | + if(!teamgroup[i].open_num) continue; | ||
| 4729 | + | ||
| 4730 | + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + teamgroup[i].openvipid, {}).then(res => { | ||
| 4731 | + var user = res.data.data; | ||
| 4732 | + teamgroup[i].user = user; | ||
| 4733 | + }) | ||
| 4734 | + teamgroup_arr.push(teamgroup[i]); | ||
| 4735 | + | ||
| 4736 | + } | ||
| 4723 | } | 4737 | } |
| 4724 | 4738 | ||
| 4725 | - if (teamgroup.length > 0) { | 4739 | + |
| 4740 | + if (teamgroup_arr.length > 0) { | ||
| 4726 | th.setData({ | 4741 | th.setData({ |
| 4727 | - teamgroup: teamgroup, | 4742 | + teamgroup: teamgroup_arr, |
| 4728 | grounp_tatal: grounp_tatal | 4743 | grounp_tatal: grounp_tatal |
| 4729 | }); | 4744 | }); |
| 4730 | th.countDown2(); | 4745 | th.countDown2(); |
pages/goods/goodsInfo/goodsInfo.wxml
| @@ -218,7 +218,9 @@ | @@ -218,7 +218,9 @@ | ||
| 218 | </view> | 218 | </view> |
| 219 | </view> | 219 | </view> |
| 220 | </view> | 220 | </view> |
| 221 | - <view class='group' wx:for="{{teamgroup}}" wx:for-index="t_ind" wx:key="teamgroup"> | 221 | + |
| 222 | + <block wx:for="{{teamgroup}}" wx:for-index="t_ind"> | ||
| 223 | + <view class='group' wx:if="{{item.open_num>0}}" > | ||
| 222 | <view class='group-list' bindtap="go_cj_team" data-ind="{{t_ind}}" data-goodsid="{{data.goods_id}}"> | 224 | <view class='group-list' bindtap="go_cj_team" data-ind="{{t_ind}}" data-goodsid="{{data.goods_id}}"> |
| 223 | <!-- <view class="flex ai_c"> --> | 225 | <!-- <view class="flex ai_c"> --> |
| 224 | <!-- //选项框头像 --> | 226 | <!-- //选项框头像 --> |
| @@ -245,6 +247,7 @@ | @@ -245,6 +247,7 @@ | ||
| 245 | <!-- <view class="clear"></view> --> | 247 | <!-- <view class="clear"></view> --> |
| 246 | </view> | 248 | </view> |
| 247 | </view> | 249 | </view> |
| 250 | + </block> | ||
| 248 | </view> | 251 | </view> |
| 249 | 252 | ||
| 250 | 253 |
pages/team/team_more/team_more.js
| @@ -54,6 +54,7 @@ Page({ | @@ -54,6 +54,7 @@ Page({ | ||
| 54 | //加载更多的函数 | 54 | //加载更多的函数 |
| 55 | async init(team_id) { | 55 | async init(team_id) { |
| 56 | 56 | ||
| 57 | + var teamgroup_arr = [];//活動从表 | ||
| 57 | var teamgroup = null,//活動从表 | 58 | var teamgroup = null,//活動从表 |
| 58 | user = null, | 59 | user = null, |
| 59 | ee = this, th=ee, | 60 | ee = this, th=ee, |
| @@ -73,9 +74,12 @@ Page({ | @@ -73,9 +74,12 @@ Page({ | ||
| 73 | await getApp().request.promiseGet("/api/weshop/teamgroup/page", { | 74 | await getApp().request.promiseGet("/api/weshop/teamgroup/page", { |
| 74 | data: req_data | 75 | data: req_data |
| 75 | }).then(res => { | 76 | }).then(res => { |
| 76 | - teamgroup = res.data.data.pageData; | ||
| 77 | - console.log(teamgroup); | ||
| 78 | - ee.data.currentPage++; | 77 | + if(ut.ajax_ok(res)){ |
| 78 | + teamgroup = res.data.data.pageData; | ||
| 79 | + console.log(teamgroup); | ||
| 80 | + ee.data.currentPage++; | ||
| 81 | + } | ||
| 82 | + | ||
| 79 | }) | 83 | }) |
| 80 | 84 | ||
| 81 | //获取订单的总数这个接口不能用 | 85 | //获取订单的总数这个接口不能用 |
| @@ -83,23 +87,30 @@ Page({ | @@ -83,23 +87,30 @@ Page({ | ||
| 83 | await getApp().request.promiseGet("/api/weshop/order/page", { | 87 | await getApp().request.promiseGet("/api/weshop/order/page", { |
| 84 | data: { store_id: os.stoid, pt_status: 1, pt_listno: teamgroup[i].listno } | 88 | data: { store_id: os.stoid, pt_status: 1, pt_listno: teamgroup[i].listno } |
| 85 | }).then(res => { | 89 | }).then(res => { |
| 86 | - var order = res.data.data.pageData; | ||
| 87 | - teamgroup[i].open_num = order.length; | 90 | + if(ut.ajax_ok(res)){ |
| 91 | + var order = res.data.data.pageData; | ||
| 92 | + teamgroup[i].open_num = order.length; | ||
| 93 | + } | ||
| 88 | }) | 94 | }) |
| 89 | 95 | ||
| 96 | + if(!teamgroup[i].open_num) continue; | ||
| 97 | + | ||
| 90 | await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + teamgroup[i].openvipid, { | 98 | await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + teamgroup[i].openvipid, { |
| 91 | }).then(res => { | 99 | }).then(res => { |
| 92 | var user = res.data.data; | 100 | var user = res.data.data; |
| 93 | teamgroup[i].user = user; | 101 | teamgroup[i].user = user; |
| 94 | }) | 102 | }) |
| 103 | + | ||
| 104 | + teamgroup_arr.push(teamgroup[i]); | ||
| 95 | } | 105 | } |
| 96 | - //设置值 | ||
| 97 | - for(var ii=0;ii<teamgroup.length;ii++){ | ||
| 98 | - th.data.requestData.push(teamgroup[ii]); | 106 | + // //设置值 |
| 107 | + // for(var ii=0;ii<teamgroup.length;ii++){ | ||
| 108 | + // th.data.requestData.push(teamgroup[ii]); | ||
| 109 | + // } | ||
| 110 | + if(teamgroup_arr.length){ | ||
| 111 | + th.setData({ teamgroup: teamgroup_arr}); | ||
| 112 | + ee.countDown2(); | ||
| 99 | } | 113 | } |
| 100 | - th.setData({ teamgroup: th.data.requestData}); | ||
| 101 | - ee.countDown2(); | ||
| 102 | - | ||
| 103 | }, | 114 | }, |
| 104 | //滚动到底部 | 115 | //滚动到底部 |
| 105 | onReachBottom: function () { | 116 | onReachBottom: function () { |
pages/team/team_more/team_more.wxml
| 1 | <!--//选项框--> | 1 | <!--//选项框--> |
| 2 | - | ||
| 3 | -<view class='group' wx:for="{{teamgroup}}"> | 2 | +<block wx:for="{{teamgroup}}"> |
| 3 | +<view class='group' wx:if="{{item.open_num>0}}"> | ||
| 4 | <view class='group-list' bindtap="go_team_show" data-tid="{{item.id}}" data-team_id="{{item.team_id}}" > | 4 | <view class='group-list' bindtap="go_team_show" data-tid="{{item.id}}" data-team_id="{{item.team_id}}" > |
| 5 | <!--//选项框头像--> | 5 | <!--//选项框头像--> |
| 6 | <view class='gtou' > | 6 | <view class='gtou' > |
| @@ -32,4 +32,5 @@ | @@ -32,4 +32,5 @@ | ||
| 32 | </view> | 32 | </view> |
| 33 | <view class="clear"></view> | 33 | <view class="clear"></view> |
| 34 | </view> | 34 | </view> |
| 35 | -</view> | ||
| 36 | \ No newline at end of file | 35 | \ No newline at end of file |
| 36 | +</view> | ||
| 37 | +</block> | ||
| 37 | \ No newline at end of file | 38 | \ No newline at end of file |