Commit 11e6d778b81a47a63ecfd0c1679afd9f93c02d9b

Authored by yvan.ni
1 parent 422e1ad3

1. 商品分组的优化 (1)直角 圆角 无边框 (2)滑动 (3)标题栏

2.   参团的购买优化
components/diy_goodsGroup/diy_goodsGroup.js
... ... @@ -41,34 +41,57 @@ Component({
41 41 goodscount: null,
42 42 firist_type_data: null,
43 43 firist_type_curr: 0,
  44 + is_nav:0,
  45 + nav_list:null,
  46 + title_index:0,
44 47 },
45 48  
46   - ready: function () {
47   -
48   - },
49   -
50   -
  49 + ready: function () {},
  50 +
51 51 lifetimes: {
52   - attached: function() {
  52 + attached: function() {
  53 +
  54 + //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法
  55 + var nav_item=this.data.object;
  56 + var nav_list= this.data.object.nav_list;
  57 + //最新的版本才有nav_list
  58 + if(nav_list){
  59 + nav_item=nav_list[0];
  60 + //要算一下商品goodsid
  61 + for(var ij in nav_list){
  62 + var item=nav_list[ij];
  63 + var idlist="";
  64 + //如果商品有手动选择的时候
  65 + if(item.data && item.data.length>0){
  66 + for(var im in item.data){
  67 + idlist+= item.data[im]+",";
  68 + }
  69 + }
  70 + if(idlist) idlist=ut.sub_last(idlist);
  71 + nav_list[ij].idlist=idlist;
  72 + }
  73 + this.setData({nav_list:nav_list,is_nav:this.data.object.is_nav});
  74 + }
  75 +
  76 +
53 77 // 在组件实例进入页面节点树时执行
54   - this.data.classstyle_id = this.data.object.classstyle;
  78 + this.data.classstyle_id = nav_item.classstyle;
55 79 this.data.goodscount = this.data.object.goodscount;
56   - this.data.wgroup = this.data.object.wgroup;
  80 + this.data.wgroup =nav_item.wgroup;
57 81  
58   - this.setData({
59   - classstyle_id: this.data.object.classstyle
60   - })
61   - if (this.data.object.goodsclass == 1) {
  82 +
  83 + if (nav_item.goodsclass == 1) {
62 84 this.data.is_recommend = 1
63 85 }
64   - if (this.data.object.goodsclass == 2) {
  86 + if (nav_item.goodsclass == 2) {
65 87 this.data.is_hot = 1
66 88 }
67   - if (this.data.object.goodsclass == 3) {
  89 + if (nav_item.goodsclass == 3) {
68 90 this.data.is_new = 1
69 91 }
  92 +
70 93 this.data.requestData = new Array();
71   - this.data.g_id = this.data.object.data;
  94 + this.data.g_id = nav_item.data;
72 95 var arr = [];
73 96  
74 97 for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) {
... ... @@ -111,7 +134,6 @@ Component({
111 134 var os=getApp().globalData.setting;
112 135 classstyle_id = classstyle_id + "";
113 136 switch (classstyle_id) {
114   -
115 137 //---手动选择商品---
116 138 case "1":
117 139 var str="";
... ... @@ -120,8 +142,9 @@ Component({
120 142 }
121 143 str=str.substring(0, str.length - 1);
122 144 app.request.get("/api/weshop/goods/getgoodslistOrdby?store_id=" + os.stoid + "&goodsidlist=" + str, {
  145 + isShowLoading:false,
123 146 success: function(res) {
124   - console.log("121212");
  147 +
125 148 if(res.data.code==0 && res.data.data){
126 149 var rData = th.data.requestData;
127 150 if (rData == null) rData=[];
... ... @@ -137,7 +160,18 @@ Component({
137 160 }
138 161 rData = rData.concat(new_arr);
139 162 th.data.requestData = rData;
140   - th.setData({ goods_array: rData });
  163 +
  164 + if(th.data.object.column==5){
  165 + var arr = new Array();
  166 + //--三个三个一组---
  167 + for(var i=0;i< rData.length;i+=3){
  168 + arr.push(rData.slice(i,i+3));
  169 + }
  170 + th.setData({ goods_array: arr });
  171 + }else{
  172 + th.setData({ goods_array: rData });
  173 + }
  174 +
141 175 //---控制有没有加载更多的按钮---
142 176 if (th.data.firist_type_curr == th.data.firist_type_data.length) {th.setData({ goods_btn: [] }); }
143 177 else th.setData({ goods_btn: res.data});
... ... @@ -391,6 +425,47 @@ Component({
391 425 })
392 426 },
393 427  
  428 + //--- 点击tab的事件 ---
  429 + gr_set_nav:function(e){
  430 +
  431 + var title_idx=e.currentTarget.dataset.index;
  432 + if(title_idx==this.data.title_index) return false;
  433 + wx.showLoading();
  434 +
  435 + var nav_item=this.data.object.nav_list[title_idx];
  436 +
  437 + this.data.g_id = this.data.object.nav_list[0].data;
  438 + var arr = [];
  439 + for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) {
  440 + arr.push(this.data.g_id.slice(i, i + this.data.goodscount));
  441 + }
  442 + this.data.firist_type_data = arr;
  443 + this.data.firist_type_curr=0;
  444 + this.data.requestData=[];
  445 +
  446 + // 在组件实例进入页面节点树时执行
  447 + this.data.classstyle_id = nav_item.classstyle;
  448 + this.data.wgroup =nav_item.wgroup;
  449 +
  450 + this.data.is_recommend = this.data.is_hot=this.data.is_new=0;
  451 + //推荐,热卖,新品
  452 + if (nav_item.goodsclass == 1) {
  453 + this.data.is_recommend = 1
  454 + }
  455 + if (nav_item.goodsclass == 2) {
  456 + this.data.is_hot = 1
  457 + }
  458 + if (nav_item.goodsclass == 3) {
  459 + this.data.is_new = 1
  460 + }
  461 +
  462 +
  463 + this.data.currentPage=1;
  464 + this.setData({goods_array:null,total:null,title_index:title_idx});
  465 + //初始化
  466 + this.init(this.data.classstyle_id, this.data.wgroup);
  467 + setTimeout(function(){ wx.hideLoading();},1000)
  468 + }
394 469  
395 470 }
396 471 })
397 472 \ No newline at end of file
... ...
components/diy_goodsGroup/diy_goodsGroup.wxml
1 1 <!--pages/diy_zs/diy_zs.wxml-->
2 2 <wxs module="filter" src="../../utils/filter.wxs"></wxs>
3 3 <wxs module="g_filter" src="g_filter.wxs"></wxs>
  4 +
  5 +<!-- 要不要顶部标题 -->
  6 +<block wx:if="{{is_nav}}">
  7 + <view class="flex gr_title_list" style="overflow-x: auto;">
  8 + <view class="gr_title_item" wx:for="{{nav_list}}" data-index="{{index}}" bindtap="gr_set_nav" data-idlist="{{item.idlist}}" data-wgroup="{{item.wgroup}}" data-classstyle="{{item.classstyle}}" >
  9 + <text class="{{index==title_index?'t_red':''}}">{{item.title}}</text>
  10 + </view>
  11 + </view>
  12 +</block>
  13 +
4 14 <!--1个列表的时候-->
5 15 <view class="zs_goods_wai" wx:if='{{object.column==1}}'>
6 16 <block wx:for="{{goods_array}}" >
7   - <view class='zs_goods'>
  17 + <view class='zs_goods {{g_filter.get_border_type(object.big_order_type)}}'>
8 18 <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" class="s1_gk_a1">
9 19 <view class='zs_top rel'>
10 20 <image class='zs_t_img' src="{{item.goods_img}}"
... ... @@ -148,7 +158,7 @@
148 158 <block wx:if="{{object.column==2}}">
149 159 <block wx:for="{{goods_array}}" >
150 160 <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" class="s1_gk_a1">
151   - <view class="zs_goods_wai_ban">
  161 + <view class="zs_goods_wai_ban {{g_filter.get_border_type(object.big_order_type)}}">
152 162 <view class="zs_goods_ban">
153 163 <view class='zs_goods_2l'>
154 164 <view class='zs_top_2l rel'>
... ... @@ -293,7 +303,7 @@
293 303 <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" class="s1_gk_a1">
294 304 <view class="zs_goods_wai_san" >
295 305 <view class="zs_goods_san">
296   - <view class='zs_goods_3l'>
  306 + <view class='zs_goods_3l {{g_filter.get_border_type(object.big_order_type)}}'>
297 307 <view class='zs_top_3l rel'>
298 308 <image class='zs_t_img_3l' src="{{item.goods_img}}" data-errorimg="goods_array[{{index}}].goods_img"
299 309 binderror="bind_bnerr3"></image>
... ... @@ -430,7 +440,7 @@
430 440 <view class="clear"></view>
431 441 </block>
432 442 <!-- 列表显示 -->
433   -<view class="zs_goods_xiao_wai" wx:if='{{object.column==4 }}'>
  443 +<view class="zs_goods_xiao_wai" wx:if='{{object.column==4}}'>
434 444 <block wx:for="{{goods_array}}" >
435 445 <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" class="s1_gk_a1">
436 446 <view class="{{object.noboder==0?'zs_goods_xiao_bottom':'zs_goods_xiao'}}" >
... ... @@ -562,7 +572,8 @@
562 572 </block>
563 573 <view class="clear"></view>
564 574 </view>
565   -
  575 +<!-- 商品的显示不是左右 -->
  576 +<block wx:if="{{object.column!=5}}">
566 577 <block wx:if="{{object.classstyle=='1' }}"><view class="button-wrapper" wx:if="{{goods_btn.length!=0 }}" style="border: none">
567 578 <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading" style="background-color: rgba(0,0,0,0);border:none">
568 579 {{loadText}}
... ... @@ -572,4 +583,132 @@
572 583 <view class="button-wrapper" wx:if="{{object.goodscount * page <total }}" style="border: none">
573 584 <button type="default" size="default" loading="{{loading}}" disabled="{{disabled}}" bindtap="setLoading" style="background-color: rgba(0,0,0,0);border:none">{{loadText}}</button>
574 585 </view>
575   -</block>
576 586 \ No newline at end of file
  587 +</block>
  588 +</block>
  589 +
  590 +
  591 +<!--商品展示-->
  592 + <swiper class="s_prom" indicator-active-color='red' indicator-dots="false" wx:if="{{object.column==5}}">
  593 + <view class="sp">
  594 + <swiper-item class="s_it" wx:for="{{goods_array}}">
  595 + <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind">
  596 + <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}" >
  597 + <view class='one'>
  598 + <view class='sp_top'>
  599 + <view class='s_img'>
  600 + <image src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image>
  601 + </view>
  602 + <view class='clear'></view>
  603 + </view>
  604 +
  605 + <view class='sp_wz'>
  606 + <view class='zs_wz1_3l' wx:if="{{object.goodstit}}">{{aitem.goods_name}}</view>
  607 + <view class='zs_wz2_3l' wx:if="{{object.goodsprice}}">
  608 + <block wx:if="{{aitem.prom_price}}">
  609 + <view class='wz_red'>¥{{aitem.prom_price}}</view>
  610 + <view class='del'>¥{{aitem.market_price}}</view>
  611 + </block>
  612 + <block wx:else>
  613 + <block wx:if="{{g_filter.is_has_rank(rank_switch,aitem)}}" >
  614 + <!-- 当会员是等级卡的时候 -->
  615 + <block wx:if="{{card_field}}">
  616 + <!-- 等级价>0 -->
  617 + <block wx:if="{{aitem[card_field]>0}}">
  618 + <view class="money flex" >
  619 + <!-- 办卡价 -->
  620 + <view class="flex xc-wc ai_and">
  621 + <view class="fs24 wz_red">¥</view>
  622 + <view class="fs35 wz_red">{{filter.toFix(aitem[card_field],2)}}</view>
  623 + <view class="card_bg ellipsis-1">
  624 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  625 + <text class="card_name">{{card_name}}</text>
  626 + </view>
  627 + </view>
  628 + </view>
  629 + <view class="flex" style="line-height: 28rpx;" >
  630 + <!-- 原价 -->
  631 + <view class="price flex xc-ash line_th">
  632 + <view class="fs22">¥</view>
  633 + <view class="fs22">{{aitem.market_price}}</view>
  634 + </view>
  635 + </view>
  636 + </block>
  637 + <blocK wx:else>
  638 + <view class="money flex" >
  639 + <!-- 办卡价 -->
  640 + <view class="flex xc-wc">
  641 + <view class="fs24 wz_red">¥</view>
  642 + <view class="fs35 wz_red">{{filter.toFix(aitem.shop_price,2)}}</view>
  643 + </view>
  644 + </view>
  645 + <view class="flex" style="line-height: 28rpx;" >
  646 + <!-- 原价 -->
  647 + <view class="price flex xc-ash line_th">
  648 + <view class="fs22">¥</view>
  649 + <view class="fs22">{{aitem.market_price}}</view>
  650 + </view>
  651 + </view>
  652 + </blocK>
  653 + </block>
  654 + <block wx:else>
  655 + <!-- 如果商品有设置等级价大于0的 -->
  656 + <block wx:if="{{g_filter.get_card_price(aitem,card_list,0)}}">
  657 + <view class="money flex" >
  658 + <!-- 办卡价 -->
  659 + <view class="flex xc-wc">
  660 + <view class="fs24 wz_red">¥</view>
  661 + <view class="fs35 wz_red">{{filter.toFix(aitem.shop_price,2)}}</view>
  662 + </view>
  663 + <!-- 原价 -->
  664 + <view class="price flex xc-ash line_th">
  665 + <view class="fs22">¥</view>
  666 + <view class="fs22">{{aitem.market_price}}</view>
  667 + </view>
  668 +
  669 + </view>
  670 + <view class="flex" style="line-height: 28rpx;" >
  671 + <!-- 等级价 -->
  672 + <view class="price flex ai_and">
  673 + <view class="fs22">¥</view>
  674 + <view class="fs28">{{filter.toFix(g_filter.get_card_price(aitem,card_list,0),2)}}</view>
  675 + <view class="card_bg ellipsis-1">
  676 + <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
  677 + <text class="card_name">{{g_filter.get_card_price(aitem,card_list,1)}}</text>
  678 + </view>
  679 + </view>
  680 + </view>
  681 + </block>
  682 + <block wx:else>
  683 + <view class="money flex" >
  684 + <!-- 办卡价 -->
  685 + <view class="flex xc-wc">
  686 + <view class="fs24 wz_red">¥</view>
  687 + <view class="fs35 wz_red">{{filter.toFix(aitem.shop_price,2)}}</view>
  688 + </view>
  689 + </view>
  690 + <view class="flex" style="line-height: 28rpx;" >
  691 + <!-- 原价 -->
  692 + <view class="price flex xc-ash line_th">
  693 + <view class="fs22">¥</view>
  694 + <view class="fs22">{{aitem.market_price}}</view>
  695 + </view>
  696 + </view>
  697 + </block>
  698 + </block>
  699 + </block>
  700 + <block wx:else>
  701 + <view class='wz_red'>¥{{aitem.shop_price}}</view>
  702 + <view class='del'>¥{{aitem.market_price}}</view>
  703 + </block>
  704 + </block>
  705 + </view>
  706 + <view class='zs_wz5_3l' wx:if="{{object.goodsnum}}">销量:{{aitem.sales_sum}}件</view>
  707 + <view style="height: 10rpx;"></view>
  708 + </view>
  709 +
  710 + </view>
  711 + </navigator>
  712 + </block>
  713 + </swiper-item>
  714 + </view>
  715 + </swiper>
577 716 \ No newline at end of file
... ...
components/diy_goodsGroup/diy_goodsGroup.wxss
... ... @@ -6,9 +6,9 @@
6 6  
7 7 .zs_goods {
8 8 width: 700rpx;
9   - border: 1rpx #ddd solid;
10 9 margin-bottom: 10rpx;
11 10 margin: 0 auto;
  11 + overflow:hidden
12 12 }
13 13  
14 14 .s1_gk_a1 {
... ... @@ -263,11 +263,11 @@
263 263 float: left;
264 264 background: #fff;
265 265 margin-left: 1%;
266   - border:1rpx solid rgb(214, 214, 214);
267   - border-radius: 25rpx;
268 266 margin-top: 10rpx;
269 267 }
270 268  
  269 +
  270 +
271 271 .zs_goods_2l {
272 272 width: 94%;
273 273 min-height: 300rpx;
... ... @@ -390,6 +390,7 @@
390 390 float: left;
391 391 margin-bottom: 8rpx;
392 392 background-color: white;
  393 + overflow: hidden;
393 394 }
394 395  
395 396 .zs_goods_san {
... ... @@ -399,9 +400,9 @@
399 400 .zs_goods_3l {
400 401 width: 236rpx;
401 402 min-height: 300rpx;
402   - border: 2rpx #ddd solid;
403 403 margin: 0 auto;
404 404 padding: 2rpx;
  405 + overflow: hidden;
405 406 }
406 407  
407 408 .zs_top_3l {
... ... @@ -571,6 +572,216 @@
571 572 white-space: nowrap;
572 573 }
573 574  
  575 +.ai-center{align-items: center;}
  576 +
  577 +.gr_title_list{ width:95%; margin-left:2.5%}
  578 +.gr_title_item{ padding:0 10rpx;flex-shrink: 0;}
  579 +
  580 +
  581 +.border_zhijiao{
  582 + border:1rpx solid rgb(214, 214, 214);
  583 +}
  584 +.border_yuanjiao{
  585 + border:1rpx solid rgb(214, 214, 214);
  586 + border-radius: 25rpx;
  587 +}
  588 +.top {
  589 + background-color: white;
  590 + height: 70rpx;
  591 + line-height: 70rpx;
  592 + color: #000;
  593 + border-bottom: 2rpx solid #eee;
  594 + padding:0rpx 20rpx;
  595 + display: flex;
  596 + justify-content: space-between;
  597 + font-size: 32rpx;
  598 +}
574 599  
  600 +.s_it {
  601 + width: 100%;
  602 + display: flex;
  603 + background-color: white;
  604 +}
  605 +
  606 +.s_prom {
  607 + width: 100%;
  608 + background-color: white;
  609 + min-height: 200rpx;
  610 +}
  611 +
  612 +swiper {
  613 + display: block;
  614 + height: 400rpx;
  615 +}
  616 +
  617 +.right_k {
  618 + width: 30rpx;
  619 +}
  620 +.right_k image{
  621 + width: 30rpx;
  622 + height: 30rpx;
  623 +}
  624 + .t_left {
  625 + width: 10rpx;
  626 + height: 38rpx;
  627 + background: #c4182e;
  628 + margin-right: 10rpx;
  629 +}
  630 +
  631 +
  632 +.sp {
  633 + min-height: 300rpx;
  634 + width: 100%;
  635 + background-color: white;
  636 + padding: 18rpx;
  637 + display: flex;
  638 +}
  639 +
  640 +.sp .sp_top {
  641 + height: 220rpx;
  642 + min-width: 30%;
  643 +}
  644 +
  645 +.sp .sp_top .s_img {
  646 + width: 210rpx;
  647 + height: 100%;
  648 +}
  649 +
  650 +.sp .sp_top .s_img image {
  651 + width: 210rpx;
  652 + height: 100%;
  653 + position: relative;
  654 + top: -74rpx;
  655 + left: 0rpx;
  656 +}
  657 +
  658 +.sp .sp_top .s_top_kill {
  659 + background-color: #c4182e;
  660 + font-size: 24rpx;
  661 + height: 38rpx;
  662 + line-height: 38rpx;
  663 + left: 6rpx;
  664 + padding: 4rpx 10rpx;
  665 + border-radius: 10rpx;
  666 + z-index: 999;
  667 + position: relative;
  668 + top: -6rpx;
  669 + width: 210rpx;
  670 + color: #fff;
  671 + text-align: center;
  672 +}
  673 +
  674 +.po {
  675 + position: absolute;
  676 +}
  677 +
  678 +.sp .sp_top .s_foot_kill {
  679 + font-size: 20rpx;
  680 + position: relative;
  681 + top: -90rpx;
  682 + width: 210rpx;
  683 + height: 38rpx;
  684 + line-height: 38rpx;
  685 + color: #fff;
  686 + text-align: center;
  687 + background-color: rgba(0, 0, 0, 0.5);
  688 +}
  689 +
  690 +.sp_wz {
  691 + width: 210rpx;
  692 + min-height: 100rpx;
  693 +}
  694 +
  695 +.sp_wz .sp_wzi {
  696 + font-size: 30rpx;
  697 + border-bottom: 2rpx solid #dcdcdc;
  698 + width: 100%;
  699 + text-align: left;
  700 + padding: 4rpx 0;
  701 + overflow: hidden;
  702 + height: 48rpx;
  703 + text-overflow: ellipsis;
  704 + white-space: nowrap;
  705 + line-height: 48rpx;
  706 +}
  707 +
  708 +.sp_wz .sp_jg {
  709 + color: #c4182e;
  710 + font-size: 30rpx;
  711 + overflow: hidden;
  712 + display: inline-block;
  713 + text-overflow: ellipsis;
  714 + white-space: nowrap;
  715 + margin-right: 10rpx;
  716 +}
  717 +
  718 +.sp_wz .sp_jgx {
  719 + color: #adadad;
  720 + text-decoration: line-through;
  721 + font-size: 24rpx;
  722 + overflow: hidden;
  723 + display: inline-block;
  724 + text-overflow: ellipsis;
  725 + white-space: nowrap;
  726 +}
  727 +
  728 +.one {
  729 + margin-left: 14rpx;
  730 +}
  731 +
  732 +.sp .sp_top .s_top1_kill {
  733 + position: absolute;
  734 + background-color: #c4182e;
  735 + font-size: 24rpx;
  736 + height: 38rpx;
  737 + line-height: 38rpx;
  738 + left: 265rpx;
  739 + top: 100rpx;
  740 + padding: 0 10rpx;
  741 + color: white;
  742 + border-radius: 10rpx;
  743 +}
  744 +
  745 +.sp .sp_top .s_top2_kill {
  746 + position: absolute;
  747 + background-color: #c4182e;
  748 + font-size: 24rpx;
  749 + height: 38rpx;
  750 + line-height: 38rpx;
  751 + right: 146rpx;
  752 + top: 100rpx;
  753 + padding: 0 10rpx;
  754 + color: white;
  755 + border-radius: 10rpx;
  756 +}
  757 +
  758 +.sp .sp_top .s_foot1_kill {
  759 + font-size: 20rpx;
  760 + position: absolute;
  761 + top: 270rpx;
  762 + width: 210rpx;
  763 + height: 38rpx;
  764 + line-height: 38rpx;
  765 + color: #fff;
  766 + text-align: center;
  767 + background-color: rgba(0, 0, 0, 0.5);
  768 +}
  769 +
  770 +.po1 {
  771 + position: absolute;
  772 +}
  773 +
  774 +.sp .sp_top .s_foot2_kill {
  775 + font-size: 20rpx;
  776 + position: absolute;
  777 + top: 270rpx;
  778 + width: 210rpx;
  779 + height: 38rpx;
  780 + line-height: 38rpx;
  781 + color: #fff;
  782 + text-align: center;
  783 + background-color: rgba(0, 0, 0, 0.5);
  784 +}
575 785  
  786 +.t_red{ color:red;}
576 787  
... ...
components/diy_goodsGroup/g_filter.wxs
... ... @@ -8,11 +8,21 @@ var get_class = function(column,position) {
8 8 if(column==3){ return "zs_t"+position+"_3l"; }
9 9 //----列表的情况-----
10 10 if(column==4 ){ return "zs_t1_x"+position; }
11   -
12 11 }
13 12  
14 13  
15 14 var g_filters = {
  15 + //判断边框类型
  16 + get_border_type:function(type){
  17 + if(!type) type=0;
  18 + var type=parseInt(type);
  19 + switch(type){
  20 + case 0: return "border_zhijiao";
  21 + case 1: return "border_yuanjiao";
  22 + }
  23 + return "";
  24 + }
  25 +
16 26 //-- 判断是不是有等级价 --
17 27 is_has_rank:function(rank_switch,item){
18 28 if(!rank_switch) return false;
... ... @@ -74,6 +84,8 @@ var g_filters = {
74 84 if(min_name.length>4 ) min_name=min_name.substring(0, 4);
75 85 return min_name;
76 86 },
  87 +
  88 +
77 89 }
78 90  
79 91  
... ... @@ -81,4 +93,5 @@ module.exports = {
81 93 get_class: get_class,
82 94 is_has_rank:g_filters.is_has_rank,
83 95 get_card_price:g_filters.get_card_price,
  96 + get_border_type:g_filters.get_border_type,
84 97 }
... ...
pages/team/team_show/team_show.js
... ... @@ -62,11 +62,33 @@ Page({
62 62 iurl:os.imghost,
63 63  
64 64  
65   - openSpecModal: !1,
66   - openSpecModal_pt: !1, //拼单的弹起,
  65 + openSpecModal: !1,
  66 + openSpecModal_pt: !1, //拼单的弹起,
  67 +
  68 +
  69 + //门店相关
  70 + ismend: 0,
  71 + is_sec_mend: 0,
  72 + sto_sele_name: "", //选中的门店名称
  73 + sto_sele_id: "", //选中的门店id
  74 + sto_sele_distr: "", //选择的门店的配送方式
  75 + is_show_sto_cat: 1, //是否显示门店分类
  76 + only_pk: null,
  77 + all_sto: null,
  78 + sec_sto: null, //选择了的门店分类
  79 + pickpu_list: null, //读出的所有门店list
  80 + def_pickpu_list: null, //一开始5个门店list
  81 + sec_pick_index: 0, //第二级门店选择ID
  82 + fir_pick_index: 0, //第一级门店选择ID
  83 + all_pick_list:null,//所有的门店先记录起来
  84 + bconfig:null,
  85 + def_pick_store: null, // 默认的门店
  86 + fir_def_store:null, //客户默认的门店的
  87 + lat: null, //维度
  88 + lon: null, //经度
  89 +
  90 + is_get_local_ok: 0, //获取坐标是否完成
67 91  
68   - showStore: true,
69   - selectStore: 0,
70 92 },
71 93 onLoad: function(options) {
72 94  
... ... @@ -94,20 +116,21 @@ Page({
94 116 })
95 117 }
96 118  
97   -
98 119 this.setData({tg_id: tg_id });
99   - getApp().globalData.to_group=null;
  120 + getApp().globalData.to_group=null;
  121 +
  122 + var th=this;
  123 + getApp().getConfig2(function(e) {
  124 + th.setData({ bconfig: e,});
  125 + th.wait_for_store_config(); //获取默认的门店
  126 + })
  127 +
100 128 },
101 129  
102 130 //显示加载
103 131 onShow:function(){
104 132 var tg_id = this.data.tg_id,th=this;
105   - this.init(tg_id);
106   -
107   - getApp().get_user_store(function (e) {
108   - if(e)
109   - th.setData({ pick_id: e.pickup_id, end_name: e.pickup_name,ii:1 })
110   - })
  133 + this.init(tg_id);
111 134 },
112 135  
113 136 //c点击打开拼团弹窗
... ... @@ -334,7 +357,8 @@ Page({
334 357 teamgroup = null, //活動从表
335 358 max_num = 0,
336 359 min_price = 0,
337   - th=this;
  360 + th=this,
  361 + that=th;
338 362  
339 363 //获取活动从表信息team_id,listno团编号(券号)
340 364 await getApp().request.promiseGet("/api/weshop/teamgroup/get/"+os.stoid+"/"+tg_id, {
... ... @@ -458,7 +482,21 @@ Page({
458 482 original_img = ee.data.imageurl + res.data.data.original_img,
459 483 goods = res.data.data
460 484 })
461   -
  485 +
  486 + //显示商品规格
  487 + var gg = "";
  488 + if(goods.goods_spec=="null" || goods.goods_spec==null ) goods.goods_spec="";
  489 + if(goods.goods_color=="null" || goods.goods_color==null) goods.goods_color="";
  490 +
  491 + if (goods.goods_spec != "" && goods.goods_color != "") {
  492 + gg = goods.goods_spec + "/" + goods.goods_color;
  493 + } else if (goods.goods_spec != "" || goods.goods_color != "") {
  494 + gg = goods.goods_spec + goods.goods_color;
  495 + } else {
  496 + gg = "规格1";
  497 + }
  498 + goods.gg = gg;
  499 +
462 500 //只装5个
463 501 var ordertx2 = [], sf_num = 0, ct_nun = teamlist.ct_num;
464 502 if (max_num) {
... ... @@ -519,7 +557,83 @@ Page({
519 557 pageteam = res.data.data.pageData;
520 558 });
521 559  
522   - //获取下redis长度,如果团已经弄完,或者拼单已经卖完
  560 + //-- 获取用户的默认门店 --
  561 + getApp().get_user_store(function(ee) {
  562 + if(!ee) {
  563 + th.data.fir_def_store={}; //赋值空对象
  564 + return false;
  565 + }
  566 + //--定时器推迟一下--
  567 + setTimeout(function () {
  568 + var g_distr_type=th.data.goods.distr_type;
  569 + //--如果默认门店的配送方式不对,就不能被选择--
  570 + if(ee.distr_type!=0 && g_distr_type!=0 && ee.distr_type!=g_distr_type ){
  571 + th.data.fir_def_store={}; //赋值空对象
  572 + return false;
  573 + }
  574 +
  575 + var appd=getApp().globalData;
  576 + var w_time = setInterval(function() {
  577 + if (that.data.is_get_local_ok == 0) return false;
  578 + clearInterval(w_time);
  579 + var distance = null;
  580 + var e=JSON.parse(JSON.stringify(ee));
  581 +
  582 + //如果有开启近距离的话,同时距离优不一样了
  583 + if (that.data.lat != null) {
  584 + //如果经纬度有变化的话
  585 + if( appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){
  586 + that.data.fir_def_store=e;
  587 + that.setData({
  588 + def_pick_store: e,
  589 + sto_sele_name: e.pickup_name,
  590 + sto_sele_id: e.pickup_id,
  591 + sto_sele_distr: e.distr_type
  592 + })
  593 + }else{
  594 + //要用接口是获取距离,js的计算不准
  595 + getApp().request.promiseGet("/api/weshop/pickup/list",{
  596 + data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon},
  597 + }).then(res=>{
  598 + if(res.data.code==0){
  599 + e=res.data.data.pageData[0];
  600 + if (e){
  601 + appd.pk_store=e;
  602 + that.data.fir_def_store=e;
  603 + that.setData({
  604 + def_pick_store: e,
  605 + sto_sele_name: e.pickup_name,
  606 + sto_sele_id: e.pickup_id,
  607 + sto_sele_distr: e.distr_type
  608 + })
  609 + }
  610 +
  611 + }
  612 + })
  613 + }
  614 +
  615 + //e.distance = distance;
  616 + appd.lat=that.data.lat;
  617 + appd.lon=that.data.lon;
  618 +
  619 + }else{
  620 + if (e) {
  621 + e.distance = null;
  622 + that.data.fir_def_store=e;
  623 + that.setData({
  624 + def_pick_store: e,
  625 + sto_sele_name: e.pickup_name,
  626 + sto_sele_id: e.pickup_id,
  627 + sto_sele_distr: e.distr_type
  628 + })
  629 + }
  630 + }
  631 +
  632 + }, 500)
  633 + },1000)
  634 + });
  635 +
  636 + //获取下redis长度,如果团已经弄完,或者拼单已经卖完
523 637 //设置值
524 638 ee.setData({
525 639 ordertx2: ordertx2,
... ... @@ -533,11 +647,10 @@ Page({
533 647 sf_arr: sf_arr
534 648 });
535 649 ee.countDown2();
536   - //---设置门店---
537   - ee.get_sto();
538   -
  650 + //---设置门店---
  651 + ee.get_sto();
539 652 //---定时设置一下待支付的订单---
540   - ee.time_out();
  653 + ee.time_out();
541 654 },
542 655  
543 656 onHide:function(){
... ... @@ -730,6 +843,11 @@ Page({
730 843 //------去支付,购买-------
731 844 go_pay:function () {
732 845 var th=this;
  846 + var def_pick_store=this.data.def_pick_store;
  847 + if(def_pick_store) {
  848 + th.data.pick_id=def_pick_store.pickup_id; //选择门店
  849 + th.data.end_name=def_pick_store.pickup_name;
  850 + }
733 851 if (th.data.pick_id == 0) return s.my_warnning("请选择门店", 0, th);
734 852  
735 853 //----判断起购数----
... ... @@ -967,103 +1085,488 @@ Page({
967 1085  
968 1086  
969 1087  
970   - // 选择门店
  1088 + //-- 选择门店。此时的门店选择与门店有关系 --
971 1089 choice_store: function(ee) {
  1090 +
  1091 + var th = this;
  1092 + var bconfig = th.data.bconfig;
  1093 + if(!th.data.only_pk && !th.data.def_pickpu_list){
  1094 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1095 + return false;
  1096 + }
  1097 + if(th.data.only_pk && !th.data.only_pk.length){
  1098 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1099 + return false;
  1100 + }
  1101 + if(th.data.def_pickpu_list && !th.data.def_pickpu_list.length){
  1102 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  1103 + return false;
  1104 + }
972 1105  
973   - // console.log('1');
974   - this.setData({
975   - // store: 1,
976   - yijian: false,
977   - showStore: false,
978   - });
  1106 + if (bconfig.is_sort_storage) {
  1107 + wx.getLocation({
  1108 + type: 'wgs84',
  1109 + success: function(res) {
979 1110  
980   - // var th = this;
981   - // var ind=ee.currentTarget.dataset.ind;
982   - // var bconfig = th.data.bconfig;
983   -
984   - // if(!th.data.only_pk && !th.data.def_pickpu_list){
985   - // getApp().confirmBox("门店库存不足", null, 25000, !1);
986   - // return false;
987   - // }
988   -
989   - // if(th.data.only_pk && !th.data.only_pk.length){
990   - // getApp().confirmBox("门店库存不足", null, 25000, !1);
991   - // return false;
992   - // }
993   - // if(th.data.def_pickpu_list && !th.data.def_pickpu_list.length){
994   - // getApp().confirmBox("门店库存不足", null, 25000, !1);
995   - // return false;
996   - // }
997   -
998   -
999   - // if (bconfig.is_sort_storage) {
1000   - // wx.getLocation({
1001   - // type: 'wgs84',
1002   - // success: function(res) {
1003   -
1004   - // th.data.lat = res.latitude;
1005   - // th.data.lon = res.longitude;
1006   - // th.data.is_get_local_ok = 1;
1007   - // th.setData({
1008   - // is_gps: 1
1009   - // });
1010   - // //th.onShow();
1011   - // th.get_sto();
1012   - // },
1013   - // fail: function(res) {
1014   - // //th.onShow();
1015   - // th.data.is_get_local_ok = 1;
1016   - // th.get_sto();
1017   - // if (res.errCode == 2) {
1018   - // th.setData({
1019   - // is_gps: 0
1020   - // });
1021   - // if (th.data.is_gps == 0) {
1022   - // getApp().confirmBox("请开启GPS定位", null, 25000, !1);
1023   - // }
1024   - // } else {
1025   - // th.setData({
1026   - // is_gps: "3"
1027   - // });
1028   - // }
1029   -
1030   - // }
1031   - // })
1032   - // }else{
1033   - // th.data.is_get_local_ok = 1;
1034   - // th.get_sto();
1035   - // }
1036   -
1037   - // if(ind!=undefined && ind!=null ){
1038   - // this.setData({
1039   - // open_ind_store: ind,
1040   - // store: 1,
1041   - // openSpecModal: !1,
1042   - // openSpecModal_pt: !1
1043   - // })
1044   - // }else{
1045   - // this.setData({
1046   - // store: 1,
1047   - // openSpecModal: !1,
1048   - // openSpecModal_pt: !1
1049   - // })
1050   - // }
1051   - },
1052   -
  1111 + th.data.lat = res.latitude;
  1112 + th.data.lon = res.longitude;
  1113 + th.data.is_get_local_ok = 1;
  1114 + th.setData({
  1115 + is_gps: 1
  1116 + });
  1117 + //th.onShow();
  1118 + th.get_sto();
  1119 + },
  1120 + fail: function(res) {
  1121 + //th.onShow();
  1122 + th.data.is_get_local_ok = 1;
  1123 + th.get_sto();
  1124 + if (res.errCode == 2) {
  1125 + th.setData({
  1126 + is_gps: 0
  1127 + });
  1128 + if (th.data.is_gps == 0) {
  1129 + getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  1130 + }
  1131 + } else {
  1132 + th.setData({
  1133 + is_gps: "3"
  1134 + });
  1135 + }
  1136 +
  1137 + }
  1138 + })
  1139 + }else{
  1140 + th.data.is_get_local_ok = 1;
  1141 + th.get_sto();
  1142 + }
1053 1143  
  1144 + this.setData({
  1145 + store: 1,
  1146 + yijian: false,
  1147 + })
  1148 +
  1149 + },
1054 1150  
  1151 +
1055 1152 //选择更多门店
1056 1153 more_store: function() {
1057   - this.setData({
1058   - selectStore: 1
1059   - });
  1154 + this.setData({ sort_store: 1});
1060 1155 },
1061 1156  
1062 1157 // 返回按钮
1063 1158 returns: function() {
1064 1159 this.setData({
1065   - selectStore: 0,
  1160 + sort_store: 0,choice_sort_store: 0
  1161 + });
  1162 + },
  1163 +
  1164 +
  1165 + //-- 等待获取定位系统 --
  1166 + wait_for_store_config: function() {
  1167 + var th = this;
  1168 + var t_time = setInterval(function() {
  1169 + if (th.data.bconfig == null) false;
  1170 + var e = th.data.bconfig;
  1171 + if (e.is_sort_storage) {
  1172 + wx.getLocation({
  1173 + type: 'wgs84',
  1174 + success: function(res) {
  1175 + th.data.lat = res.latitude;
  1176 + th.data.lon = res.longitude;
  1177 + th.data.is_get_local_ok = 1;
  1178 + },
  1179 + fail: function(res) {
  1180 + if (res.errCode == 2) {
  1181 + th.setData({
  1182 + is_gps: 0
  1183 + });
  1184 + if (th.data.is_gps == 0) {
  1185 + getApp().confirmBox("请开启GPS定位", null, 10000, !1);
  1186 + }
  1187 +
  1188 + } else {
  1189 + th.setData({
  1190 + is_gps: "3"
  1191 + });
  1192 + }
  1193 +
  1194 + th.data.is_get_local_ok = 1;
  1195 + }
  1196 + })
  1197 + } else {
  1198 + th.data.is_get_local_ok = 1;
  1199 + }
  1200 + clearInterval(t_time);
  1201 + }, 500)
  1202 + },
  1203 +
  1204 +
  1205 + //---------拿出门店分类和门店------------
  1206 + get_sto(e) {
  1207 + var th = this,that=this;
  1208 + var timer_get = setInterval(function() {
  1209 + if (th.data.is_get_local_ok == 0) return false;
  1210 + var dd = null,
  1211 + i = getApp().request;
  1212 + var g_distr_type = th.data.goods.distr_type;
  1213 + if (g_distr_type != 0) {
  1214 + dd = {
  1215 + store_id: o.stoid,
  1216 + distr_type: g_distr_type,
  1217 + isstop: 0,
  1218 + pageSize: 2000
  1219 + }
  1220 + } else {
  1221 + dd = {
  1222 + store_id: o.stoid,
  1223 + isstop: 0,
  1224 + pageSize: 2000
  1225 + }
  1226 + }
  1227 + //如果有距离的话
  1228 + if (th.data.lat != null) {
  1229 + dd.lat = th.data.lat;
  1230 + dd.lon = th.data.lon;
  1231 + }
  1232 + clearInterval(timer_get);
  1233 +
  1234 + if(th.data.def_pick_store && g_distr_type!=0 && th.data.def_pick_store.distr_type!=0 && th.data.def_pick_store.distr_type!=g_distr_type ){
  1235 + th.setData({def_pick_store:null});
  1236 + }
  1237 +
  1238 + //----------获取门店----------------
  1239 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  1240 + data: dd,
  1241 + }).then(res => {
  1242 + var e = res;
  1243 + if (e.data.code == 0) {
  1244 +
  1245 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  1246 + if(dd.lat && !th.data.def_pick_store && th.data.bconfig.is_sort_storage){
  1247 + th.setData({
  1248 + def_pick_store:e.data.data.pageData[0],
  1249 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  1250 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  1251 + sto_sele_distr: e.data.data.pageData[0].distr_type
  1252 + });
  1253 + th.data.fir_def_store=e.data.data.pageData[0];
  1254 + }
  1255 +
  1256 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位 --
  1257 + if (th.data.def_pick_store && (th.data.def_pick_store.distr_type==0 || th.data.def_pick_store.distr_type==g_distr_type )){
  1258 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  1259 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  1260 + e.data.data.pageData.splice(k, 1); //删除
  1261 + break;
  1262 + }
  1263 + }
  1264 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  1265 + }
  1266 +
  1267 +
  1268 + th.setData({all_pick_list:e.data.data.pageData});
  1269 +
  1270 +
  1271 + setTimeout(function(){
  1272 + th.deal_pickup(e); //--普通门店排版--
  1273 + },800)
  1274 +
  1275 + }
  1276 + })
  1277 + }, 200)
  1278 +
  1279 + },
  1280 +
  1281 + //------------处理门店,拼团活动只有线上库存---------------
  1282 + deal_pickup(e){
  1283 + var th=this;
  1284 + var g_distr_type=th.data.goods.distr_type;
  1285 + //单总量超出5个的时候
  1286 + if (e.data.data.total > 5) {
  1287 + getApp().request.get("/api/weshop/storagecategory/page", {
  1288 + data: {
  1289 + store_id: o.stoid,
  1290 + is_show: 1,
  1291 + pageSize: 1000
  1292 + },
  1293 + success: function(ee) {
  1294 + if (ee.data.code == 0) {
  1295 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  1296 + var def_arr = new Array();
  1297 + var ishas = 0;
  1298 + //-- 开始就看5个门店 --
  1299 + for (var k = 0; k < 5; k++) {
  1300 + if (k == e.data.data.pageData.length) break;
  1301 + def_arr.push(e.data.data.pageData[k]);
  1302 + }
  1303 +
  1304 + th.setData({
  1305 + def_pickpu_list: def_arr,
  1306 + pickpu_list: ee.data.data.pageData
  1307 + });
  1308 + var sto_cate = ee.data.data.pageData;
  1309 + var sto_arr = e.data.data.pageData;
  1310 + var newarr = new Array();
  1311 + var qita = new Array();
  1312 +
  1313 + //----要进行门店分组--------
  1314 + for (var i = 0; i < sto_arr.length; i++) {
  1315 + //找一下这个门店有没有在分类数组内
  1316 + var find2 = 0,
  1317 + find2name = "";
  1318 + for (var m = 0; m < sto_cate.length; m++) {
  1319 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  1320 + find2 = sto_cate[m].cat_id;
  1321 + find2name = sto_cate[m].cat_name;
  1322 + break;
  1323 + }
  1324 + }
  1325 +
  1326 + if (newarr.length > 0) {
  1327 + var find = 0;
  1328 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  1329 + if (find2 != 0) {
  1330 + for (var ii = 0; ii < newarr.length; ii++) {
  1331 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  1332 + newarr[ii].s_arr.push(sto_arr[i]);
  1333 + find = 1;
  1334 + break;
  1335 + }
  1336 + }
  1337 + if (find == 0) {
  1338 + var arr0 = new Array();
  1339 + arr0.push(sto_arr[i]);
  1340 + var item = {
  1341 + cat_id: find2,
  1342 + name: find2name,
  1343 + s_arr: arr0
  1344 + };
  1345 + newarr.push(item);
  1346 + }
  1347 + } else {
  1348 + qita.push(sto_arr[i]);
  1349 + }
  1350 + } else {
  1351 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  1352 + if (find2 != 0) {
  1353 + var arr0 = new Array();
  1354 + arr0.push(sto_arr[i]);
  1355 + var item = {
  1356 + cat_id: find2,
  1357 + name: find2name,
  1358 + s_arr: arr0
  1359 + };
  1360 + newarr.push(item);
  1361 + } else {
  1362 + qita.push(sto_arr[i]);
  1363 + }
  1364 + }
  1365 + }
  1366 +
  1367 + //----安排其他的分类-----
  1368 + if (qita.length > 0) {
  1369 + var item = {
  1370 + cat_id: -1,
  1371 + name: "其他",
  1372 + s_arr: qita
  1373 + };
  1374 + newarr.push(item);
  1375 + }
  1376 + th.setData({
  1377 + is_show_sto_cat: 1,
  1378 + all_sto: newarr
  1379 + });
  1380 +
  1381 + } else {
  1382 + th.setData({
  1383 + is_show_sto_cat: -1,
  1384 + only_pk: e.data.data.pageData
  1385 + });
  1386 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  1387 + if (!th.data.def_pick_store) {
  1388 + th.setData({def_pick_store:e.data.data.pageData[0]})
  1389 + }
  1390 + }
  1391 + } else {
  1392 + th.setData({
  1393 + is_show_sto_cat: -1,
  1394 + only_pk: e.data.data.pageData
  1395 + });
  1396 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  1397 + if (!th.data.def_pick_store) {
  1398 + th.setData({def_pick_store:e.data.data.pageData[0]})
  1399 + }
  1400 +
  1401 + }
  1402 + }
  1403 + });
  1404 + } else {
  1405 + th.setData({
  1406 + is_show_sto_cat: 0,
  1407 + only_pk: e.data.data.pageData
  1408 + });
  1409 + //-----如果没有默认门店,要取第一个门店作为默认店------
  1410 + if (!th.data.def_pick_store && th.data.bconfig.is_sort_storage) {
  1411 + th.setData({
  1412 + def_pick_store:e.data.data.pageData[0],
  1413 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  1414 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  1415 + sto_sele_distr: e.data.data.pageData[0].distr_type
  1416 + })
  1417 + }
  1418 + }
  1419 + },
  1420 + //---选择分类门店---
  1421 + choice_sort_store: function(e) {
  1422 + var index = e.currentTarget.dataset.index;
  1423 + var region_name = e.currentTarget.dataset.region;
  1424 + var item = this.data.all_sto[index];
  1425 + this.setData({
  1426 + region_name: region_name,
  1427 + sort_store: 0,
  1428 + choice_sort_store: 1,
  1429 + sec_sto: item,
  1430 + sec_pick_index: 0
1066 1431 });
1067 1432 },
  1433 +
  1434 + choose_for_store_fir: function(e) {
  1435 + var index_c = e.currentTarget.dataset.ind;
  1436 + var th=this;
  1437 + th.setData({
  1438 + fir_pick_index: index_c
  1439 + })
  1440 + },
  1441 +
  1442 + //---点击二级之后的选择---
  1443 + choose_for_store: function(e) {
  1444 + var index_c = e.currentTarget.dataset.ind;
  1445 + var th=this;
  1446 + th.setData({
  1447 + sec_pick_index: index_c,
  1448 + fir_pick_index: index_c
  1449 + })
  1450 +
  1451 + },
  1452 +
  1453 + //确定def_pick为选择的门店
  1454 + sure_pick: function(e) {
  1455 + var th = this;
  1456 + var item = null;
  1457 +
  1458 + if (th.data.choice_sort_store == 0) {
  1459 + var index = th.data.fir_pick_index;
  1460 + if (th.data.is_show_sto_cat == 1) {
  1461 + item = th.data.def_pickpu_list[index];
  1462 + } else {
  1463 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1464 + }
  1465 +
  1466 + } else {
  1467 + var index = th.data.sec_pick_index;
  1468 + item = th.data.sec_sto.s_arr[index];
  1469 + }
  1470 +
  1471 +
  1472 + th.setData({
  1473 + def_pick_store: item,
  1474 + sto_sele_name: item.pickup_name,
  1475 + sto_sele_id: item.pickup_id,
  1476 + sto_sele_distr: item.distr_type,
  1477 + store: 0,
  1478 + choice_sort_store: 0,
  1479 + fir_pick_index: 0
  1480 + });
  1481 +
  1482 +
  1483 + th.setData({
  1484 + yijian: 1, //打开拼团购买界面
  1485 + store: 0, //关闭门店
  1486 + choice_sort_store: 0, //关闭门店2级
  1487 + sort_store: 0, //关闭门店2级
  1488 + });
  1489 +
  1490 +
  1491 + },
  1492 +
  1493 +
  1494 +
  1495 + //把选择的门店设置成默认的门店def_pick
  1496 + set_def_pick: function(e) {
  1497 + var th = this;
  1498 + var item = null;
  1499 + if (th.data.choice_sort_store == 0) {
  1500 + var index = th.data.fir_pick_index;
  1501 + if (th.data.is_show_sto_cat == 1) {
  1502 + item = th.data.def_pickpu_list[index];
  1503 + } else {
  1504 + item = th.data.only_pk[index]; //当没有门店分类的时候
  1505 + }
  1506 + } else {
  1507 + var index = th.data.sec_pick_index;
  1508 + item = th.data.sec_sto.s_arr[index];
  1509 + }
  1510 +
  1511 +
  1512 + var store_id = o.stoid;
  1513 + var user_id = getApp().globalData.user_id;
  1514 + var def_pickup_id = item.pickup_id;
  1515 +
  1516 + getApp().request.put('/api/weshop/users/update', {
  1517 + data: {
  1518 + user_id,
  1519 + def_pickup_id
  1520 + },
  1521 + success: function(res) {
  1522 + if (res.data.code == 0) {
  1523 + if (th.data.choice_sort_store == 0) th.setData({
  1524 + fir_pick_index: 0
  1525 + });
  1526 + getApp().globalData.pk_store = item;
  1527 + } else {
  1528 + getApp().my_warnning("设置默认门店地址失败",0,th)
  1529 + }
  1530 +
  1531 + }
  1532 + });
  1533 +
  1534 + th.setData({
  1535 + def_pick_store: item,
  1536 + sto_sele_name: item.pickup_name,
  1537 + sto_sele_id: item.pickup_id,
  1538 + sto_sele_distr: item.distr_type,
  1539 + store: 0,
  1540 + choice_sort_store: 0
  1541 + });
  1542 +
  1543 + //4就是拼团
  1544 + th.setData({
  1545 + yijian: 1, //打开拼团购买界面
  1546 + store: 0, //关闭门店
  1547 + choice_sort_store: 0, //关闭门店2级
  1548 + sort_store: 0, //关闭门店2级
  1549 + });
  1550 +
  1551 + },
  1552 +
  1553 +
  1554 + //-- 关闭选择门店 --
  1555 + close_popup: function(e) {
  1556 + var th=this;
  1557 + this.setData({
  1558 + store: 0,
  1559 + choice_sort_store: 0,
  1560 + sort_store: 0,
  1561 + fir_pick_index:0,
  1562 + sec_pick_index:0,
  1563 + yijian: 1, //打开拼团购买界面
  1564 + })
  1565 +
  1566 + },
  1567 +
  1568 +
  1569 +
  1570 +
1068 1571  
1069 1572 })
1070 1573 \ No newline at end of file
... ...
pages/team/team_show/team_show.wxml
... ... @@ -196,92 +196,55 @@
196 196 <icon bindtap="closeSpecModal" class="modal-close" color="gray" size="22" type="cancel"></icon>
197 197 <!-- 商品名称 -->
198 198 <view class="spec-goods">
199   - <image class="wh100 spec-img xc-distance-bottom" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image>
  199 + <image class="wh100 spec-img xc-distance-bottom" src="{{image}}" binderror="pop_err_img" data-errorimg="data.original_img"></image>
200 200 <view class="spec-goods-info">
201   - <view class="spec-goods-name ellipsis-1">{{sele_g.goods_name}}商品名称</view>
202   -
203   - <view class="flex ai_end xc-val-money {{sele_g[card_field]}}">
204   - <!-- <view class="spec-goods-price" wx:if="{{is_normal==1}}"> -->
  201 + <view class="spec-goods-name ellipsis-1">{{goods.goods_name}}商品名称</view>
  202 + <view class="flex ai_end xc-val-money">
205 203 <view class="spec-goods-price">
206   - <!-- 如果是等级会员,且有等级价 -->
207   - <!-- <block wx:if="{{card_field && sele_g[card_field]>0}}"> -->
208   - <block>
209   - ¥ {{sele_g[card_field]}}1.00
210   - </block>
211   - <!-- <block wx:else>
212   - ¥ {{sele_g.shop_price}}
213   - </block> -->
214   - </view>
215   - <!-- <view class="spec-goods-price">¥ {{prom_price}}2.00</view> -->
216   - </view>
217   -
218   - <!-- <block wx:if="{{is_normal==1}}"> -->
219   - <block>
220   - <view class="flex">
221   - <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}5</view>
222   - <view class="spec-goods-stock">可售:{{sele_g.store_count}}4</view>
  204 + <span class='t1'>¥</span><text class='t2'>{{teamlist.kttype==3?teamlist.yf_price:teamlist.price}}</text>
223 205 </view>
224   - </block>
225   -
226   - <!-- <block wx:if="{{is_normal==0}}">
227   - <view class="flex">
228   - <view class="spec-goods-stock" wx:if="{{prom_st>0}}">已售:{{prom_act.buy_num}}</view>
229   - <view class="spec-goods-stock" wx:else>已售:{{prom_act.buy_num}}</view>
230   - <view class="spec-goods-stock">可售:{{prom_act.goods_num-prom_act.buy_num}}</view>
231   - </view>
232   - </block> -->
  206 + </view>
  207 + <view class="flex">
  208 + <view class="spec-goods-stock">已售:{{teamlist.buy_num}}</view>
  209 + <view class="spec-goods-stock">可售:{{teamlist.goods_num-teamlist.buy_num}}</view>
  210 + </view>
233 211 </view>
234 212 </view>
235 213  
236 214 <view style="clear: both"></view>
237 215 <view style="margin-top: 20rpx">
238 216 <view class="flex-space-between address ai_end xc-width ">
239   - <!-- <view class="flex ai_end" wx:if="{{def_pick_store}}"> -->
240   - <view class="flex ai_end">
241   - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}美得得</text>
242   - <!-- <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}"> -->
243   - <view class="distance fs24 xc-ash">
244   - 距离:400m
245   - <!-- {{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} -->
  217 +
  218 + <view class="flex ai_end" wx:if="{{def_pick_store}}">
  219 + <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
  220 +
  221 + <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
  222 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
246 223 </view>
247 224 </view>
248   -
249   - <!-- 没有门店的时候 -->
250   - <!-- <view class="flex" bindtap="choice_store" wx:else>
  225 + <view class="red-co fs28" bindtap="choice_store" wx:if="{{def_pick_store}}">
  226 + 更多门店
  227 + <text class="right-arrow"></text>
  228 + </view>
  229 + <view class="flex" bindtap="choice_store" wx:else>
251 230 <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
252 231 <view class="fs28 xc-ash-9f">选择门店</view>
253   - </view> -->
  232 + </view>
254 233  
255   - <view class="red-co fs28" bindtap="choice_store">
256   - 更多门店
257   - <text class="right-arrow"></text>
258   - </view>
259   - </view>
260   - <!-- <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store}}">地址:5{{def_pick_store.fulladdress}}</view> -->
261   - <view class="fs24 xc-ash-9f xc-distance-top">地址:泉州市
262   - <!-- {{def_pick_store.fulladdress}} -->
  234 +
263 235 </view>
  236 + <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store}}">地址:5{{def_pick_store.fulladdress}}</view>
  237 +
264 238 </view>
265   - <!----商品的属性项目---->
  239 + <!-- 商品的属性项目 -->
266 240 <view>
267 241 <view hidden="{{ismend==1}}" class="spec-name">商品属性</view>
268   - <!-- <block wx:if="{{is_normal==0}}"> -->
269 242 <block>
270 243 <view hidden="{{ismend==1}}" class="flex">
271   - <!-- <view class="spec_bt act {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}"
272   - wx:key="sku_g">{{item.gg}}规格1
273   - </view> -->
274   - <view class="spec_bt act {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}'>{{item.gg}}规格1
  244 + <view class="spec_bt act" >{{goods.gg}}
275 245 </view>
276 246 </view>
277 247 </block>
278   - <!-- <block wx:else>
279   - <view hidden="{{ismend==1}}" class="flex">
280   - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}"
281   - wx:key="sku_g">{{item.gg}}
282   - </view>
283   - </view>
284   - </block> -->
285 248 <view class="clear"></view>
286 249 </view>
287 250  
... ... @@ -289,9 +252,9 @@
289 252 <view class="b_num" hidden="{{ismend==1}}" style="margin-top: 20rpx">
290 253 <view>购买数量</view>
291 254 <view class="count">
292   - <view bindtap="subCartNum" class="sub">-</view>
293   - <input bindblur="inputCartNum" class="xc-val-fream" type="number" value="1">1</input>
294   - <view bindtap="addCartNum" class="add">+</view>
  255 + <view class='{{minusStatus}}' bindtap="bindMinus" class="sub">-</view>
  256 + <input bindblur="bindManual" class="xc-val-fream" type="number" value="1">1</input>
  257 + <view bindtap="bindPlus" class="add">+</view>
295 258 </view>
296 259 </view>
297 260  
... ... @@ -301,7 +264,7 @@
301 264 </view>
302 265  
303 266 <view class="pt_qd">
304   - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view>
  267 + <view bindtap="go_pay" class="spec-cart-btn spec-buy w100" data-action="buy">确定</view>
305 268 </view>
306 269  
307 270 </view>
... ... @@ -310,78 +273,129 @@
310 273 </view>
311 274 </view>
312 275  
313   -
314   -
315   -
316   -
317   -
318 276 <!-- 选择门店的弹框,1.1版最新的 -->
319   -<view hidden="{{showStore}}">
320   -
321   - <view class="mongolia-layer" bindtap="close_popup"></view>
322   - <view class="popup-frame">
323   - <block wx:if="{{selectStore===0}}">
324   - <!-- <block> -->
325   - <!-- 头部 标题 -->
326   - <view class="popup-top flex-space-between">
327   - <text class="fs32 nearby_store">附近的门店</text>
328   - <view class="t-r flex-equality" style="flex-direction:column;">
329   - <view class="lh1">
330   - <icon bindtap="close_popup" class="" color="black" size="22" type="cancel"></icon>
331   - </view>
332   - <view class="lh1" bindtap="more_store" style="">
333   - <text class="fs26 red-co">更多门店</text>
334   - <!-- <text class="fs26 red-co" wx:if="{{is_show_sto_cat}}">{{0==0?'更多门店':'返回'}}</text> -->
335   - <view class="bg_rights"></view>
336   - </view>
337   - </view>
338   - </view>
339   -
340   - <!-- 门店列表,最外层的门店列表,一开始 -->
341   - <view class="store-list">
342   - <view class="store_choose flex" bindtap="choose_for_store">
343   - <view class="store flex-vertical">
344   -
345   - <!-- <block>
346   - <view class="circle white xc-hook fs20 red-b">Г</view>
347   - </block> -->
348   - <block>
349   - <view class="circle xc-hooks"></view>
350   - </block>
351   -
352   - <view class="address-frame xc-ash">
353   - <view class="flex-vertical-between butttem5">
354   - <view class="flex xc-ash">
355   - <view class="fs28 xc-black3 address_name">9998{{item.pickup_name}}</view>
356   - </view>
357   - <view>
358   - <view class="distance fs24 address-val">
359   - 距离:1234</view>
360   - </view>
361   - </view>
362   - <view class="fs24 xc-ash-9f">地址:9996</view>
363   - </view>
364   - </view>
365   - </view>
366   - </view>
  277 +<block wx:if="{{store==1}}">
  278 + <view class="mongolia-layer" bindtap="close_popup"></view>
  279 + <view class="popup-frame">
  280 + <block wx:if="{{sort_store==0}}">
  281 + <!-- 头部 标题 -->
  282 + <view class="popup-top flex-space-between">
  283 + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
  284 + <view>
  285 + <view>
  286 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  287 + </view>
  288 + <view class="felx choose_more" bindtap="more_store">
  289 + <text class="fs26 red-co" wx:if="{{is_show_sto_cat}}">{{choice_sort_store==0?'更多门店':'返回'}}</text>
  290 + <view class="bg_rights" wx:if="{{is_show_sto_cat}}"></view>
  291 + </view>
  292 + </view>
  293 + </view>
  294 + <!-- 门店列表,最外层的门店列表,一开始 -->
  295 + <view class="store-list">
  296 + <!--如果还没有点击更多门店的时候 -->
  297 + <block wx:if="{{choice_sort_store==0}}">
  298 + <!-- 需要for循环 -->
  299 + <block wx:if="{{is_show_sto_cat==1}}">
  300 + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  301 + <view class="store flex-vertical">
  302 + <!-- 需要点击事件 -->
  303 + <block wx:if="{{index==fir_pick_index}}">
  304 + <view class="circle white xc-hook fs20 red-b">Г</view>
  305 + </block>
  306 + <block wx:else>
  307 + <view class="circle xc-hooks"></view>
  308 + </block>
  309 + <view class="address-frame xc-ash">
  310 + <view class="flex-vertical-between butttem5">
  311 + <view class="flex xc-ash">
  312 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  313 + </view>
  314 + <view>
  315 + <view class="distance fs24 address-val"wx:if="{{item.distance!=null}}">
  316 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}</view>
  317 + </view>
  318 + </view>
  319 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  320 + </view>
  321 + </view>
  322 + </view>
  323 + </block>
  324 + <block wx:else>
  325 + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  326 + <view class="store flex-vertical">
  327 + <!-- 需要点击事件 -->
  328 + <block wx:if="{{index==fir_pick_index}}" >
  329 + <view class="circle white xc-hook fs20 red-b">Г</view>
  330 + </block>
  331 + <block wx:else>
  332 + <view class="circle xc-hooks"></view>
  333 + </block>
  334 +
  335 + <view class="address-frame xc-ash">
  336 + <view class="flex-vertical-between ">
  337 + <view class="flex xc-ash">
  338 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  339 + </view>
  340 + <view>
  341 + <view class="distance fs24 address-val"
  342 + wx:if="{{item.distance!=null}}">距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  343 + </view>
  344 + </view>
  345 + </view>
  346 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  347 + </view>
  348 + </view>
  349 + </view>
  350 + </block>
  351 + </block>
  352 + <block wx:else> <!-- 如果是点击选择门店分类后显示分类下的门店 -->
  353 + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store">
  354 + <view class="store flex-vertical">
  355 + <!-- 需要点击事件 -->
  356 + <block wx:if="{{index==sec_pick_index}}">
  357 + <view class="circle white xc-hook fs20 red-b">Г</view>
  358 + </block>
  359 + <block wx:else>
  360 + <view class="circle xc-hooks"></view>
  361 + </block>
  362 +
  363 + <view class="address-frame xc-ash">
  364 + <view class="flex-vertical-between ">
  365 + <view class="flex xc-ash">
  366 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  367 + </view>
  368 + <view>
  369 + <view class="distance fs24 address-val"wx:if="{{item.distance!=null}}">
  370 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}</view>
  371 + </view>
  372 + </view>
  373 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  374 + </view>
  375 + </view>
  376 + </view>
  377 + </block>
367 378  
368   - <!-- 门店列表底部 -->
369   - <view class="store-bottom-frame">
370   - <view class="store-bottom flex-vertical-between">
371   - <view class="determine red-b fs28 white t-c" bindtap="sure_pick" data-openindstore="{{open_ind_store}}">确定</view>
372   - <view class="default t-c fs28" bindtap="set_def_pick" data-openindstore="{{open_ind_store}}">设为默认</view>
373   - </view>
374   - </view>
  379 + </view>
375 380  
376   - </block>
  381 + <!-- 门店列表底部 -->
  382 + <view class="store-bottom-frame">
  383 + <view class="store-bottom flex-vertical-between">
  384 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick"
  385 + data-openindstore="{{open_ind_store}}">确定</view>
  386 + <view class="default t-c fs28" bindtap="set_def_pick"data-openindstore="{{open_ind_store}}">设为默认</view>
  387 + </view>
  388 + </view>
  389 +
  390 + </block>
377 391  
378 392  
379   - <block wx:else>
  393 + <block wx:else>
380 394 <view class="popup-top flex-space-between">
381   - <text class="fs32 nearby_store">门店分类选择</text>
  395 + <text class="fs32 nearby_store">门店分类选择</text>
382 396 <view>
383 397 <view>
384   - <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  398 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
385 399 </view>
386 400 <view class="felx choose_mores" bindtap="returns">
387 401 <text class="fs26 red-co">返回</text>
... ... @@ -390,21 +404,19 @@
390 404 </view>
391 405 <view class="sort_store_list">
392 406  
393   - <view class="sort-store-frame" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}">
  407 + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}">
394 408 <view class="sort-store flex-vertical-between" >
395   - <!-- <view class="fs30" di>{{item.name}}</view> -->
396   - <view class="fs30" di>泉州</view>
  409 + <view class="fs30" di>{{item.name}}</view>
397 410 <view class="black_rights-frame">
398 411 <view class="black_rights"></view>
399 412 </view>
400 413 </view>
401 414 </view>
  415 +
402 416 </view>
403 417 </block>
404   - </view>
405   -</view>
406   -
407   -
  418 + </view>
  419 +</block>
408 420  
409 421  
410 422  
... ...
pages/team/team_show/team_show.wxss
... ... @@ -2041,9 +2041,15 @@ page {
2041 2041 height: 25rpx;
2042 2042 }
2043 2043  
  2044 +.choose_more{
  2045 + margin-top: 40rpx;
  2046 + margin-right: 20rpx;
  2047 +
  2048 +}
2044 2049 .choose_mores{
2045 2050 margin-top: 30rpx;
2046 2051 margin-right: 15rpx;
  2052 +
2047 2053 }
2048 2054  
2049 2055 .bg_rights{
... ...