Commit 5f2d20d7f7d9a52b90282354dced884c10ced537
1 parent
eea49b42
OA单的优化
Showing
27 changed files
with
2197 additions
and
1712 deletions
components/diy_goodsGroup/diy_goodsGroup.js
| @@ -421,7 +421,7 @@ Component({ | @@ -421,7 +421,7 @@ Component({ | ||
| 421 | 421 | ||
| 422 | 422 | ||
| 423 | this.data.currentPage = 1; | 423 | this.data.currentPage = 1; |
| 424 | - this.setData({ goods_array: [], total: null, title_index: title_idx }); | 424 | + this.setData({ goods_array: [], total: null, title_index: title_idx,is_get: 0 }); |
| 425 | //初始化 | 425 | //初始化 |
| 426 | this.init(this.data.classstyle_id, this.data.wgroup); | 426 | this.init(this.data.classstyle_id, this.data.wgroup); |
| 427 | setTimeout(function () { wx.hideLoading(); }, 1000) | 427 | setTimeout(function () { wx.hideLoading(); }, 1000) |
components/diy_goodsGroup/diy_goodsGroup.wxml
| @@ -45,16 +45,22 @@ | @@ -45,16 +45,22 @@ | ||
| 45 | </block> | 45 | </block> |
| 46 | 46 | ||
| 47 | <block wx:if="{{object.goodicon==3}}"> | 47 | <block wx:if="{{object.goodicon==3}}"> |
| 48 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | 48 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 49 | + class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | ||
| 49 | </block> | 50 | </block> |
| 50 | <block wx:if="{{object.goodicon==1}}"> | 51 | <block wx:if="{{object.goodicon==1}}"> |
| 51 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | 52 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 53 | + class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | ||
| 52 | </block> | 54 | </block> |
| 53 | <block wx:if="{{object.goodicon==2}}"> | 55 | <block wx:if="{{object.goodicon==2}}"> |
| 54 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 55 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2}}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 56 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 57 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4}}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | 56 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 57 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 58 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 59 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2}}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 60 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 61 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 62 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 63 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4}}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | ||
| 58 | </block> | 64 | </block> |
| 59 | </view> | 65 | </view> |
| 60 | <view class='zs_center'> | 66 | <view class='zs_center'> |
| @@ -95,7 +101,7 @@ | @@ -95,7 +101,7 @@ | ||
| 95 | </view> | 101 | </view> |
| 96 | </view> | 102 | </view> |
| 97 | </block> | 103 | </block> |
| 98 | - <blocK wx:else> | 104 | + <block wx:else> |
| 99 | <view class="money flex"> | 105 | <view class="money flex"> |
| 100 | <!-- 办卡价 --> | 106 | <!-- 办卡价 --> |
| 101 | <view class="flex xc-wc"> | 107 | <view class="flex xc-wc"> |
| @@ -110,7 +116,7 @@ | @@ -110,7 +116,7 @@ | ||
| 110 | <view class="fs22">{{item.market_price}}</view> | 116 | <view class="fs22">{{item.market_price}}</view> |
| 111 | </view> | 117 | </view> |
| 112 | </view> | 118 | </view> |
| 113 | - </blocK> | 119 | + </block> |
| 114 | </block> | 120 | </block> |
| 115 | <block wx:else> | 121 | <block wx:else> |
| 116 | <!-- 如果商品有设置等级价大于0的 --> | 122 | <!-- 如果商品有设置等级价大于0的 --> |
| @@ -161,7 +167,7 @@ | @@ -161,7 +167,7 @@ | ||
| 161 | 167 | ||
| 162 | <block wx:else> | 168 | <block wx:else> |
| 163 | <view class='wz_red'>¥{{item.shop_price}}</view> | 169 | <view class='wz_red'>¥{{item.shop_price}}</view> |
| 164 | - <view wx:if="{{is_retail_price}}"class='del'>¥{{item.market_price}}</view> | 170 | + <view wx:if="{{is_retail_price}}" class='del'>¥{{item.market_price}}</view> |
| 165 | </block> | 171 | </block> |
| 166 | 172 | ||
| 167 | </block> | 173 | </block> |
| @@ -214,16 +220,21 @@ | @@ -214,16 +220,21 @@ | ||
| 214 | </block> | 220 | </block> |
| 215 | 221 | ||
| 216 | <block wx:if="{{object.goodicon==3}}"> | 222 | <block wx:if="{{object.goodicon==3}}"> |
| 217 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | 223 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 224 | + class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | ||
| 218 | </block> | 225 | </block> |
| 219 | <block wx:if="{{object.goodicon==1}}"> | 226 | <block wx:if="{{object.goodicon==1}}"> |
| 220 | <image class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | 227 | <image class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> |
| 221 | </block> | 228 | </block> |
| 222 | <block wx:if="{{object.goodicon==2}}"> | 229 | <block wx:if="{{object.goodicon==2}}"> |
| 223 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 224 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 225 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 226 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | 230 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 231 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 232 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 233 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 234 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 235 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 236 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 237 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | ||
| 227 | </block> | 238 | </block> |
| 228 | </view> | 239 | </view> |
| 229 | 240 | ||
| @@ -264,7 +275,7 @@ | @@ -264,7 +275,7 @@ | ||
| 264 | </view> | 275 | </view> |
| 265 | </view> | 276 | </view> |
| 266 | </block> | 277 | </block> |
| 267 | - <blocK wx:else> | 278 | + <block wx:else> |
| 268 | <view class="money flex"> | 279 | <view class="money flex"> |
| 269 | <!-- 办卡价 --> | 280 | <!-- 办卡价 --> |
| 270 | <view class="flex xc-wc"> | 281 | <view class="flex xc-wc"> |
| @@ -279,7 +290,7 @@ | @@ -279,7 +290,7 @@ | ||
| 279 | <view class="fs22">{{item.market_price}}</view> | 290 | <view class="fs22">{{item.market_price}}</view> |
| 280 | </view> | 291 | </view> |
| 281 | </view> | 292 | </view> |
| 282 | - </blocK> | 293 | + </block> |
| 283 | </block> | 294 | </block> |
| 284 | <block wx:else> | 295 | <block wx:else> |
| 285 | <!-- 如果商品有设置等级价大于0的 --> | 296 | <!-- 如果商品有设置等级价大于0的 --> |
| @@ -383,16 +394,22 @@ | @@ -383,16 +394,22 @@ | ||
| 383 | </block> | 394 | </block> |
| 384 | 395 | ||
| 385 | <block wx:if="{{object.goodicon==3}}"> | 396 | <block wx:if="{{object.goodicon==3}}"> |
| 386 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | 397 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 398 | + class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | ||
| 387 | </block> | 399 | </block> |
| 388 | <block wx:if="{{object.goodicon==1}}"> | 400 | <block wx:if="{{object.goodicon==1}}"> |
| 389 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | 401 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 402 | + class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | ||
| 390 | </block> | 403 | </block> |
| 391 | <block wx:if="{{object.goodicon==2}}"> | 404 | <block wx:if="{{object.goodicon==2}}"> |
| 392 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 393 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 394 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 395 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | 405 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 406 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 407 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 408 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 409 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 410 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 411 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 412 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | ||
| 396 | </block> | 413 | </block> |
| 397 | </view> | 414 | </view> |
| 398 | <view class='zs_center_3l'> | 415 | <view class='zs_center_3l'> |
| @@ -433,7 +450,7 @@ | @@ -433,7 +450,7 @@ | ||
| 433 | </view> | 450 | </view> |
| 434 | </view> | 451 | </view> |
| 435 | </block> | 452 | </block> |
| 436 | - <blocK wx:else> | 453 | + <block wx:else> |
| 437 | <view class="money flex"> | 454 | <view class="money flex"> |
| 438 | <!-- 办卡价 --> | 455 | <!-- 办卡价 --> |
| 439 | <view class="flex xc-wc"> | 456 | <view class="flex xc-wc"> |
| @@ -448,7 +465,7 @@ | @@ -448,7 +465,7 @@ | ||
| 448 | <view class="fs22">{{item.market_price}}</view> | 465 | <view class="fs22">{{item.market_price}}</view> |
| 449 | </view> | 466 | </view> |
| 450 | </view> | 467 | </view> |
| 451 | - </blocK> | 468 | + </block> |
| 452 | </block> | 469 | </block> |
| 453 | <block wx:else> | 470 | <block wx:else> |
| 454 | <!-- 如果商品有设置等级价大于0的 --> | 471 | <!-- 如果商品有设置等级价大于0的 --> |
| @@ -555,16 +572,22 @@ | @@ -555,16 +572,22 @@ | ||
| 555 | </block> | 572 | </block> |
| 556 | 573 | ||
| 557 | <block wx:if="{{object.goodicon==3}}"> | 574 | <block wx:if="{{object.goodicon==3}}"> |
| 558 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | 575 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 576 | + class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | ||
| 559 | </block> | 577 | </block> |
| 560 | <block wx:if="{{object.goodicon==1}}"> | 578 | <block wx:if="{{object.goodicon==1}}"> |
| 561 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | 579 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 580 | + class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | ||
| 562 | </block> | 581 | </block> |
| 563 | <block wx:if="{{object.goodicon==2}}"> | 582 | <block wx:if="{{object.goodicon==2}}"> |
| 564 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 565 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 566 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 567 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | 583 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 584 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 585 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 586 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 587 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 588 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 589 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 590 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | ||
| 568 | </block> | 591 | </block> |
| 569 | </view> | 592 | </view> |
| 570 | <view class='zs_center_x'> | 593 | <view class='zs_center_x'> |
| @@ -606,7 +629,7 @@ | @@ -606,7 +629,7 @@ | ||
| 606 | </view> | 629 | </view> |
| 607 | </view> | 630 | </view> |
| 608 | </block> | 631 | </block> |
| 609 | - <blocK wx:else> | 632 | + <block wx:else> |
| 610 | <view class="money flex"> | 633 | <view class="money flex"> |
| 611 | <!-- 办卡价 --> | 634 | <!-- 办卡价 --> |
| 612 | <view class="flex xc-wc"> | 635 | <view class="flex xc-wc"> |
| @@ -621,7 +644,7 @@ | @@ -621,7 +644,7 @@ | ||
| 621 | <view class="fs22">{{item.market_price}}</view> | 644 | <view class="fs22">{{item.market_price}}</view> |
| 622 | </view> | 645 | </view> |
| 623 | </view> | 646 | </view> |
| 624 | - </blocK> | 647 | + </block> |
| 625 | </block> | 648 | </block> |
| 626 | <block wx:else> | 649 | <block wx:else> |
| 627 | <!-- 如果商品有设置等级价大于0的 --> | 650 | <!-- 如果商品有设置等级价大于0的 --> |
| @@ -747,16 +770,22 @@ | @@ -747,16 +770,22 @@ | ||
| 747 | 770 | ||
| 748 | 771 | ||
| 749 | <block wx:if="{{object.goodicon==3}}"> | 772 | <block wx:if="{{object.goodicon==3}}"> |
| 750 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | 773 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 774 | + class='{{g_filter.get_class(object.column,object.position)}}' src='{{object.customicon}}'></image> | ||
| 751 | </block> | 775 | </block> |
| 752 | <block wx:if="{{object.goodicon==1}}"> | 776 | <block wx:if="{{object.goodicon==1}}"> |
| 753 | - <image class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | 777 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 778 | + class='{{g_filter.get_class(object.column,object.position)}}' src=''></image> | ||
| 754 | </block> | 779 | </block> |
| 755 | <block wx:if="{{object.goodicon==2}}"> | 780 | <block wx:if="{{object.goodicon==2}}"> |
| 756 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 757 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 758 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 759 | - <image class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | 781 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" |
| 782 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==1}}" src='{{imghost}}/miniapp/images/Recommend.png'></image> | ||
| 783 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 784 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==2 }}" src='{{imghost}}/miniapp/images/hot.png'></image> | ||
| 785 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 786 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==3}}" src='{{imghost}}/miniapp/images/new.png'></image> | ||
| 787 | + <image style="width: {{object.icon_width*1.2}}rpx;height: {{object.icon_width*1.2}}rpx" | ||
| 788 | + class='{{g_filter.get_class(object.column,object.position)}}' wx:if="{{object.styleicon==4 }}" src='{{imghost}}/miniapp/images/Promotion.png'></image> | ||
| 760 | </block> | 789 | </block> |
| 761 | 790 | ||
| 762 | </view> | 791 | </view> |
| @@ -799,7 +828,7 @@ | @@ -799,7 +828,7 @@ | ||
| 799 | </view> | 828 | </view> |
| 800 | </view> | 829 | </view> |
| 801 | </block> | 830 | </block> |
| 802 | - <blocK wx:else> | 831 | + <block wx:else> |
| 803 | <view class="money flex"> | 832 | <view class="money flex"> |
| 804 | <!-- 办卡价 --> | 833 | <!-- 办卡价 --> |
| 805 | <view class="flex xc-wc"> | 834 | <view class="flex xc-wc"> |
| @@ -814,7 +843,7 @@ | @@ -814,7 +843,7 @@ | ||
| 814 | <view class="fs22">{{aitem.market_price}}</view> | 843 | <view class="fs22">{{aitem.market_price}}</view> |
| 815 | </view> | 844 | </view> |
| 816 | </view> | 845 | </view> |
| 817 | - </blocK> | 846 | + </block> |
| 818 | </block> | 847 | </block> |
| 819 | <block wx:else> | 848 | <block wx:else> |
| 820 | <!-- 如果商品有设置等级价大于0的 --> | 849 | <!-- 如果商品有设置等级价大于0的 --> |
components/diy_store_select/diy_store_select.js
| @@ -146,7 +146,7 @@ Component({ | @@ -146,7 +146,7 @@ Component({ | ||
| 146 | if (th.data.is_show_sto_cat == 1) { | 146 | if (th.data.is_show_sto_cat == 1) { |
| 147 | item = th.data.def_pickpu_list[index]; | 147 | item = th.data.def_pickpu_list[index]; |
| 148 | } else { | 148 | } else { |
| 149 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 149 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | //如果是跳转到门店分类里面的时候 | 152 | //如果是跳转到门店分类里面的时候 |
| @@ -155,6 +155,10 @@ Component({ | @@ -155,6 +155,10 @@ Component({ | ||
| 155 | item = th.data.sec_sto.s_arr[index]; | 155 | item = th.data.sec_sto.s_arr[index]; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | + if(!item){ | ||
| 159 | + return false; | ||
| 160 | + } | ||
| 161 | + | ||
| 158 | //--回调函数的用法-- | 162 | //--回调函数的用法-- |
| 159 | th.setData({ | 163 | th.setData({ |
| 160 | top_store: item, | 164 | top_store: item, |
packageA/pages/goodsInfo/goodsInfo.js
| @@ -2649,7 +2649,7 @@ Page({ | @@ -2649,7 +2649,7 @@ Page({ | ||
| 2649 | if (th.data.is_show_sto_cat == 1) { | 2649 | if (th.data.is_show_sto_cat == 1) { |
| 2650 | item = th.data.def_pickpu_list[index]; | 2650 | item = th.data.def_pickpu_list[index]; |
| 2651 | } else { | 2651 | } else { |
| 2652 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 2652 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 2653 | } | 2653 | } |
| 2654 | 2654 | ||
| 2655 | } else { | 2655 | } else { |
| @@ -2657,6 +2657,9 @@ Page({ | @@ -2657,6 +2657,9 @@ Page({ | ||
| 2657 | item = th.data.sec_sto.s_arr[index]; | 2657 | item = th.data.sec_sto.s_arr[index]; |
| 2658 | } | 2658 | } |
| 2659 | 2659 | ||
| 2660 | + if(!item) return false; | ||
| 2661 | + | ||
| 2662 | + | ||
| 2660 | var ser_card=this.data.data; | 2663 | var ser_card=this.data.data; |
| 2661 | //判断门店的配送方式是不是匹配 | 2664 | //判断门店的配送方式是不是匹配 |
| 2662 | if(ser_card.storageId!=null && ser_card.storageId!="" && ser_card.storageId.indexOf(item.keyid)==-1){ | 2665 | if(ser_card.storageId!=null && ser_card.storageId!="" && ser_card.storageId.indexOf(item.keyid)==-1){ |
| @@ -2728,12 +2731,14 @@ Page({ | @@ -2728,12 +2731,14 @@ Page({ | ||
| 2728 | if (th.data.is_show_sto_cat == 1) { | 2731 | if (th.data.is_show_sto_cat == 1) { |
| 2729 | item = th.data.def_pickpu_list[index]; | 2732 | item = th.data.def_pickpu_list[index]; |
| 2730 | } else { | 2733 | } else { |
| 2731 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 2734 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 2732 | } | 2735 | } |
| 2733 | } else { | 2736 | } else { |
| 2734 | var index = th.data.sec_pick_index; | 2737 | var index = th.data.sec_pick_index; |
| 2735 | item = th.data.sec_sto.s_arr[index]; | 2738 | item = th.data.sec_sto.s_arr[index]; |
| 2736 | } | 2739 | } |
| 2740 | + | ||
| 2741 | + if(!item) return false; | ||
| 2737 | 2742 | ||
| 2738 | //判断门店的配送方式是不是匹配 | 2743 | //判断门店的配送方式是不是匹配 |
| 2739 | var ser_card=this.data.data; | 2744 | var ser_card=this.data.data; |
| @@ -3842,7 +3847,7 @@ Page({ | @@ -3842,7 +3847,7 @@ Page({ | ||
| 3842 | 3847 | ||
| 3843 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 3848 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); |
| 3844 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 3849 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 3845 | - this.setData({ | 3850 | + th.setData({ |
| 3846 | sto_sele_name: "" | 3851 | sto_sele_name: "" |
| 3847 | }); | 3852 | }); |
| 3848 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 3853 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
packageA/pages/profile/profile.js
| 1 | function e(e, a, r) { | 1 | function e(e, a, r) { |
| 2 | - return a in e ? Object.defineProperty(e, a, { | ||
| 3 | - value: r, | ||
| 4 | - enumerable: !0, | ||
| 5 | - configurable: !0, | ||
| 6 | - writable: !0 | ||
| 7 | - }) : e[a] = r, e; | 2 | + return a in e ? Object.defineProperty(e, a, { |
| 3 | + value: r, | ||
| 4 | + enumerable: !0, | ||
| 5 | + configurable: !0, | ||
| 6 | + writable: !0 | ||
| 7 | + }) : e[a] = r, e; | ||
| 8 | } | 8 | } |
| 9 | + | ||
| 9 | const app = getApp(); | 10 | const app = getApp(); |
| 10 | let self = null; | 11 | let self = null; |
| 11 | 12 | ||
| 12 | var a = getApp(), | 13 | var a = getApp(), |
| 13 | - r = a.globalData.setting, | ||
| 14 | - t = a.request, | ||
| 15 | - s = require("../../../utils/common.js"), | ||
| 16 | - util = require("../../../utils/util.js"), | ||
| 17 | - ut = util, | ||
| 18 | - d = getApp().globalData; | 14 | + r = a.globalData.setting, |
| 15 | + t = a.request, | ||
| 16 | + s = require("../../../utils/common.js"), | ||
| 17 | + util = require("../../../utils/util.js"), | ||
| 18 | + ut = util, | ||
| 19 | + d = getApp().globalData; | ||
| 19 | 20 | ||
| 20 | var timestamp = Date.parse(new Date()); | 21 | var timestamp = Date.parse(new Date()); |
| 21 | var date = new Date(timestamp); | 22 | var date = new Date(timestamp); |
| @@ -26,896 +27,928 @@ var date = new Date(timestamp); | @@ -26,896 +27,928 @@ var date = new Date(timestamp); | ||
| 26 | var regeneratorRuntime = require('../../../utils/runtime.js'); | 27 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
| 27 | 28 | ||
| 28 | Page({ | 29 | Page({ |
| 29 | - data: { | ||
| 30 | - phone: "", | ||
| 31 | - url: r.url, | ||
| 32 | - resourceUrl: r.resourceUrl, | ||
| 33 | - iurl: r.imghost, | ||
| 34 | - defaultAvatar: r.resourceUrl + "/static/images/user68.jpg", | ||
| 35 | - user: null, | ||
| 36 | - tc_hide: true, | ||
| 37 | - stoname: "请选择", | ||
| 38 | - checkDate: false, | ||
| 39 | - datet: "", | ||
| 40 | - year: date.getFullYear(), | ||
| 41 | - store: 0, | ||
| 42 | - all_sto: "", | ||
| 43 | - region_name: "", | ||
| 44 | - def_pick_store: "", | ||
| 45 | - sort_store: 0, //门店分类 | ||
| 46 | - sec_sto: "", | ||
| 47 | - more_store: 0, //选择门店 | ||
| 48 | - choice_sort_store: 0, //选择分类门店 | ||
| 49 | - more_store: 0, //选择门店 | ||
| 50 | - lat: null, //维度 | ||
| 51 | - lon: null, //经度 | ||
| 52 | - fir_pick_index: 0, | ||
| 53 | - sec_pick_index: 0, | ||
| 54 | - is_gps: 1, | ||
| 55 | - lon: 0, | ||
| 56 | - only_pk: 0, | ||
| 57 | - open_ind_store: 0, //哪里打开的门店列表的控制属性 | ||
| 58 | - ispwhid: 1, //是否隐藏密码显示 | ||
| 59 | - isstcsp: 0, //是否启用密码消费 | ||
| 60 | - isGender: 0, //什么性别 | ||
| 61 | - iscalendar: 0, //是否是农历 | ||
| 62 | - consumption: "", //消费密码 | ||
| 63 | - identity_card: "", //身份证值 | ||
| 64 | - address: "", //地址 | ||
| 65 | - openid: "", //openid | ||
| 66 | - pulscardname: "", //PLUS会员的卡 | ||
| 67 | - gradename: "", //会员权益的卡 | ||
| 68 | - isBool: "", | ||
| 69 | - sto_sele_id: "", //所属门店id | ||
| 70 | - is_zy: 0, //是否执行onshow | ||
| 71 | - is_lable_set: "", //是否启用我的兴趣标签 | ||
| 72 | - check_label: [], //我选择的兴趣标签 | ||
| 73 | - fir_guide_id:null, //存储会员详情接口出来的美导ID | ||
| 74 | - isLunar: 0, | ||
| 75 | - lat: null, //维度 | ||
| 76 | - lon: null, //经度 | ||
| 77 | - loading:0, | ||
| 78 | - | ||
| 79 | - }, | ||
| 80 | - //通过路径跳转到其他页面 | ||
| 81 | - goto: function(e) { | ||
| 82 | - var url = e.currentTarget.dataset.url; | ||
| 83 | - getApp().goto(url); | ||
| 84 | - }, | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - //查找会员选择的兴趣标签 | ||
| 88 | - query_checklabels: function() { | ||
| 89 | - var th = this; | ||
| 90 | - var url = "/api/weshop/marketing/holiday/vip/interest/label/get"; | ||
| 91 | - var interest_lables = th.data.interest_lables; //兴趣标签 | ||
| 92 | - getApp().request.promiseGet(url, { | ||
| 93 | - data: { | ||
| 94 | - userId: d.user_id, | ||
| 95 | - storeId: r.stoid | ||
| 96 | - } | ||
| 97 | - }).then(res => { | ||
| 98 | - if (res.data.code == 0) { | ||
| 99 | - var data = res.data.data; | ||
| 100 | - var VipLabel = th.data.check_label; //通过id标签找到已选择的标签 | ||
| 101 | - var dateList = data.VipLabel.split(","); | ||
| 102 | - for (var i in dateList) { | ||
| 103 | - if (dateList[i] != "") { | ||
| 104 | - VipLabel.push(dateList[i]); | ||
| 105 | - } | 30 | + data: { |
| 31 | + phone: "", | ||
| 32 | + url: r.url, | ||
| 33 | + resourceUrl: r.resourceUrl, | ||
| 34 | + iurl: r.imghost, | ||
| 35 | + defaultAvatar: r.resourceUrl + "/static/images/user68.jpg", | ||
| 36 | + user: null, | ||
| 37 | + tc_hide: true, | ||
| 38 | + stoname: "请选择", | ||
| 39 | + checkDate: false, | ||
| 40 | + datet: "", | ||
| 41 | + year: date.getFullYear(), | ||
| 42 | + store: 0, | ||
| 43 | + all_sto: "", | ||
| 44 | + region_name: "", | ||
| 45 | + def_pick_store: "", | ||
| 46 | + sort_store: 0, //门店分类 | ||
| 47 | + sec_sto: "", | ||
| 48 | + more_store: 0, //选择门店 | ||
| 49 | + choice_sort_store: 0, //选择分类门店 | ||
| 50 | + more_store: 0, //选择门店 | ||
| 51 | + lat: null, //维度 | ||
| 52 | + lon: null, //经度 | ||
| 53 | + fir_pick_index: 0, | ||
| 54 | + sec_pick_index: 0, | ||
| 55 | + is_gps: 1, | ||
| 56 | + lon: 0, | ||
| 57 | + only_pk: 0, | ||
| 58 | + open_ind_store: 0, //哪里打开的门店列表的控制属性 | ||
| 59 | + ispwhid: 1, //是否隐藏密码显示 | ||
| 60 | + isstcsp: 0, //是否启用密码消费 | ||
| 61 | + isGender: 0, //什么性别 | ||
| 62 | + iscalendar: 0, //是否是农历 | ||
| 63 | + consumption: "", //消费密码 | ||
| 64 | + identity_card: "", //身份证值 | ||
| 65 | + address: "", //地址 | ||
| 66 | + openid: "", //openid | ||
| 67 | + pulscardname: "", //PLUS会员的卡 | ||
| 68 | + gradename: "", //会员权益的卡 | ||
| 69 | + isBool: "", | ||
| 70 | + sto_sele_id: "", //所属门店id | ||
| 71 | + is_zy: 0, //是否执行onshow | ||
| 72 | + is_lable_set: "", //是否启用我的兴趣标签 | ||
| 73 | + check_label: [], //我选择的兴趣标签 | ||
| 74 | + fir_guide_id: null, //存储会员详情接口出来的美导ID | ||
| 75 | + isLunar: 0, | ||
| 76 | + lat: null, //维度 | ||
| 77 | + lon: null, //经度 | ||
| 78 | + loading: 0, | ||
| 79 | + | ||
| 80 | + }, | ||
| 81 | + //通过路径跳转到其他页面 | ||
| 82 | + goto: function (e) { | ||
| 83 | + var url = e.currentTarget.dataset.url; | ||
| 84 | + getApp().goto(url); | ||
| 85 | + }, | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + //查找会员选择的兴趣标签 | ||
| 89 | + query_checklabels: function () { | ||
| 90 | + var th = this; | ||
| 91 | + var url = "/api/weshop/marketing/holiday/vip/interest/label/get"; | ||
| 92 | + var interest_lables = th.data.interest_lables; //兴趣标签 | ||
| 93 | + getApp().request.promiseGet(url, { | ||
| 94 | + data: { | ||
| 95 | + userId: d.user_id, | ||
| 96 | + storeId: r.stoid | ||
| 97 | + } | ||
| 98 | + }).then(res => { | ||
| 99 | + if (res.data.code == 0) { | ||
| 100 | + var data = res.data.data; | ||
| 101 | + var VipLabel = th.data.check_label; //通过id标签找到已选择的标签 | ||
| 102 | + var dateList = data.VipLabel.split(","); | ||
| 103 | + for (var i in dateList) { | ||
| 104 | + if (dateList[i] != "") { | ||
| 105 | + VipLabel.push(dateList[i]); | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + th.setData({ | ||
| 109 | + check_label: VipLabel | ||
| 110 | + }) | ||
| 111 | + } else { | ||
| 112 | + getApp().my_warnning("系统繁忙,请稍后再试", 0, th); | ||
| 113 | + } | ||
| 114 | + }) | ||
| 115 | + }, | ||
| 116 | + | ||
| 117 | + | ||
| 118 | + //出生日期是否是农历 | ||
| 119 | + iscalendar: function () { | ||
| 120 | + | ||
| 121 | + if (this.data.user.birthday) return false; | ||
| 122 | + var th = this; | ||
| 123 | + var iscalendar = th.data.iscalendar; | ||
| 124 | + if (iscalendar == 0) { | ||
| 125 | + th.setData({ | ||
| 126 | + iscalendar: 1 | ||
| 127 | + }) | ||
| 128 | + } else { | ||
| 129 | + th.setData({ | ||
| 130 | + iscalendar: 0 | ||
| 131 | + }) | ||
| 132 | + } | ||
| 133 | + }, | ||
| 134 | + | ||
| 135 | + | ||
| 136 | + checkDate: function () { | ||
| 137 | + var th = this; | ||
| 138 | + if (th.data.checkDate) { | ||
| 139 | + th.setData({ | ||
| 140 | + checkDate: false | ||
| 141 | + }) | ||
| 142 | + } else { | ||
| 143 | + th.setData({ | ||
| 144 | + checkDate: true | ||
| 145 | + }) | ||
| 146 | + } | ||
| 147 | + }, | ||
| 148 | + | ||
| 149 | + //---点击二级之后的选择--- | ||
| 150 | + choose_for_store: function (e) { | ||
| 151 | + var index_c = e.currentTarget.dataset.ind; | ||
| 152 | + | ||
| 153 | + this.setData({ | ||
| 154 | + sec_pick_index: index_c, | ||
| 155 | + fir_pick_index: index_c | ||
| 156 | + }) | ||
| 157 | + }, | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + //确定def_pick为选择的门店 | ||
| 161 | + sure_pick: function (e) { | ||
| 162 | + var th = this; | ||
| 163 | + var item = null; | ||
| 164 | + var openindstore = th.data.open_ind_store; | ||
| 165 | + if (th.data.choice_sort_store == 0) { | ||
| 166 | + var index = th.data.fir_pick_index; | ||
| 167 | + if (th.data.is_show_sto_cat == 1) { | ||
| 168 | + item = th.data.def_pickpu_list[index]; | ||
| 169 | + } else { | ||
| 170 | + item =th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + } else { | ||
| 174 | + var index = th.data.sec_pick_index; | ||
| 175 | + item = th.data.sec_sto.s_arr[index]; | ||
| 106 | } | 176 | } |
| 177 | + | ||
| 178 | + if (!item) return false; | ||
| 107 | th.setData({ | 179 | th.setData({ |
| 108 | - check_label: VipLabel | 180 | + def_pick_store: item, |
| 181 | + stoname: item.pickup_name, | ||
| 182 | + sto_sele_name: item.pickup_name, | ||
| 183 | + sto_sele_id: item.pickup_id, | ||
| 184 | + sto_sele_distr: item.distr_type, | ||
| 185 | + store: 0, | ||
| 186 | + choice_sort_store: 0, | ||
| 187 | + fir_pick_index: 0 | ||
| 188 | + }); | ||
| 189 | + | ||
| 190 | + if (openindstore == 1) { | ||
| 191 | + th.setData({ | ||
| 192 | + openSpecModal: !0, | ||
| 193 | + openSpecModal_ind: openindstore, | ||
| 194 | + }); | ||
| 195 | + } else if (openindstore == 2) { | ||
| 196 | + th.setData({ | ||
| 197 | + openSpecModal: !0, | ||
| 198 | + openSpecModal_ind: openindstore, | ||
| 199 | + openSpecModal_pt: 1 | ||
| 200 | + }); | ||
| 201 | + } | ||
| 202 | + }, | ||
| 203 | + choose_for_store_fir: function (e) { | ||
| 204 | + var index_c = e.currentTarget.dataset.ind; | ||
| 205 | + this.setData({ | ||
| 206 | + fir_pick_index: index_c | ||
| 207 | + }) | ||
| 208 | + }, | ||
| 209 | + wait_for_store_config: function () { | ||
| 210 | + var th = this; | ||
| 211 | + wx.getLocation({ | ||
| 212 | + type: 'gcj02', | ||
| 213 | + success: function (res) { | ||
| 214 | + th.data.lat = res.latitude; | ||
| 215 | + th.data.lon = res.longitude; | ||
| 216 | + th.data.is_get_local_ok = 1; | ||
| 217 | + }, | ||
| 218 | + fail: function (res) { | ||
| 219 | + if (res.errCode == 2) { | ||
| 220 | + th.setData({ | ||
| 221 | + is_gps: 0 | ||
| 222 | + }); | ||
| 223 | + if (th.data.is_gps == 0) { | ||
| 224 | + getApp().confirmBox("请开启GPS定位", null, 10000, !1); | ||
| 225 | + } | ||
| 226 | + } else { | ||
| 227 | + th.setData({ | ||
| 228 | + is_gps: "3" | ||
| 229 | + }); | ||
| 230 | + } | ||
| 231 | + th.data.is_get_local_ok = 1; | ||
| 232 | + } | ||
| 109 | }) | 233 | }) |
| 110 | - } else { | ||
| 111 | - getApp().my_warnning("系统繁忙,请稍后再试", 0, th); | ||
| 112 | - } | ||
| 113 | - }) | ||
| 114 | - }, | ||
| 115 | - | ||
| 116 | - | ||
| 117 | - //出生日期是否是农历 | ||
| 118 | - iscalendar: function() { | ||
| 119 | - | ||
| 120 | - if(this.data.user.birthday) return false; | ||
| 121 | - var th = this; | ||
| 122 | - var iscalendar = th.data.iscalendar; | ||
| 123 | - if (iscalendar == 0) { | ||
| 124 | - th.setData({ | ||
| 125 | - iscalendar: 1 | ||
| 126 | - }) | ||
| 127 | - } else { | ||
| 128 | - th.setData({ | ||
| 129 | - iscalendar: 0 | ||
| 130 | - }) | ||
| 131 | - } | ||
| 132 | - }, | ||
| 133 | - | ||
| 134 | - | ||
| 135 | - checkDate: function() { | ||
| 136 | - var th = this; | ||
| 137 | - if (th.data.checkDate) { | ||
| 138 | - th.setData({ | ||
| 139 | - checkDate: false | ||
| 140 | - }) | ||
| 141 | - } else { | ||
| 142 | - th.setData({ | ||
| 143 | - checkDate: true | ||
| 144 | - }) | ||
| 145 | - } | ||
| 146 | - }, | ||
| 147 | - | ||
| 148 | - //---点击二级之后的选择--- | ||
| 149 | - choose_for_store: function(e) { | ||
| 150 | - var index_c = e.currentTarget.dataset.ind; | ||
| 151 | - | ||
| 152 | - this.setData({ | ||
| 153 | - sec_pick_index: index_c, | ||
| 154 | - fir_pick_index: index_c | ||
| 155 | - }) | ||
| 156 | - }, | ||
| 157 | - | ||
| 158 | - | ||
| 159 | - //确定def_pick为选择的门店 | ||
| 160 | - sure_pick: function(e) { | ||
| 161 | - var th = this; | ||
| 162 | - var item = null; | ||
| 163 | - var openindstore = th.data.open_ind_store; | ||
| 164 | - if (th.data.choice_sort_store == 0) { | ||
| 165 | - var index = th.data.fir_pick_index; | ||
| 166 | - if (th.data.is_show_sto_cat == 1) { | ||
| 167 | - item = th.data.def_pickpu_list[index]; | ||
| 168 | - } else { | ||
| 169 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - } else { | ||
| 173 | - var index = th.data.sec_pick_index; | ||
| 174 | - item = th.data.sec_sto.s_arr[index]; | ||
| 175 | - } | ||
| 176 | - | ||
| 177 | - if(!item) return false; | ||
| 178 | - th.setData({ | ||
| 179 | - def_pick_store: item, | ||
| 180 | - stoname: item.pickup_name, | ||
| 181 | - sto_sele_name: item.pickup_name, | ||
| 182 | - sto_sele_id: item.pickup_id, | ||
| 183 | - sto_sele_distr: item.distr_type, | ||
| 184 | - store: 0, | ||
| 185 | - choice_sort_store: 0, | ||
| 186 | - fir_pick_index: 0 | ||
| 187 | - }); | ||
| 188 | - | ||
| 189 | - if (openindstore == 1) { | ||
| 190 | - th.setData({ | ||
| 191 | - openSpecModal: !0, | ||
| 192 | - openSpecModal_ind: openindstore, | ||
| 193 | - }); | ||
| 194 | - } else if (openindstore == 2) { | ||
| 195 | - th.setData({ | ||
| 196 | - openSpecModal: !0, | ||
| 197 | - openSpecModal_ind: openindstore, | ||
| 198 | - openSpecModal_pt: 1 | ||
| 199 | - }); | ||
| 200 | - } | ||
| 201 | - }, | ||
| 202 | - choose_for_store_fir: function(e) { | ||
| 203 | - var index_c = e.currentTarget.dataset.ind; | ||
| 204 | - this.setData({ | ||
| 205 | - fir_pick_index: index_c | ||
| 206 | - }) | ||
| 207 | - }, | ||
| 208 | - wait_for_store_config: function() { | ||
| 209 | - var th = this; | ||
| 210 | - wx.getLocation({ | ||
| 211 | - type: 'gcj02', | ||
| 212 | - success: function(res) { | ||
| 213 | - th.data.lat = res.latitude; | ||
| 214 | - th.data.lon = res.longitude; | ||
| 215 | - th.data.is_get_local_ok = 1; | ||
| 216 | - }, | ||
| 217 | - fail: function(res) { | ||
| 218 | - if (res.errCode == 2) { | ||
| 219 | - th.setData({ | ||
| 220 | - is_gps: 0 | ||
| 221 | - }); | ||
| 222 | - if (th.data.is_gps == 0) { | ||
| 223 | - getApp().confirmBox("请开启GPS定位", null, 10000, !1); | ||
| 224 | - } | 234 | + }, |
| 235 | + onclickstore: function () { | ||
| 236 | + var th = this; | ||
| 237 | + if (th.data.store == 0) { | ||
| 238 | + th.setData({ | ||
| 239 | + store: 1 | ||
| 240 | + }) | ||
| 225 | } else { | 241 | } else { |
| 226 | - th.setData({ | ||
| 227 | - is_gps: "3" | ||
| 228 | - }); | 242 | + th.setData({ |
| 243 | + store: 0 | ||
| 244 | + }) | ||
| 245 | + } | ||
| 246 | + var dd = { | ||
| 247 | + store_id: r.stoid, | ||
| 248 | + isstop: 0, | ||
| 249 | + pageSize: 2000 | ||
| 229 | } | 250 | } |
| 230 | - th.data.is_get_local_ok = 1; | ||
| 231 | - } | ||
| 232 | - }) | ||
| 233 | - }, | ||
| 234 | - onclickstore: function() { | ||
| 235 | - var th = this; | ||
| 236 | - if (th.data.store == 0) { | ||
| 237 | - th.setData({ | ||
| 238 | - store: 1 | ||
| 239 | - }) | ||
| 240 | - } else { | ||
| 241 | - th.setData({ | ||
| 242 | - store: 0 | ||
| 243 | - }) | ||
| 244 | - } | ||
| 245 | - var dd = { | ||
| 246 | - store_id: r.stoid, | ||
| 247 | - isstop: 0, | ||
| 248 | - pageSize: 2000 | ||
| 249 | - } | ||
| 250 | - th.setData({ | ||
| 251 | - sort_store: 0 | ||
| 252 | - }); | ||
| 253 | - var i = getApp().request; | ||
| 254 | - //如果有距离的话 | ||
| 255 | - if (th.data.lat != null) { | ||
| 256 | - dd.lat = th.data.lat; | ||
| 257 | - dd.lon = th.data.lon; | ||
| 258 | - } | ||
| 259 | - //----------获取门店---------------- | ||
| 260 | - getApp().request.get("/api/weshop/pickup/list", { | ||
| 261 | - data: dd, | ||
| 262 | - success:function(res){ | ||
| 263 | - var e = res; | ||
| 264 | - if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length>0) { | ||
| 265 | - | ||
| 266 | - var ishas_cate=0; | ||
| 267 | - for(let i in e){ | ||
| 268 | - let item=e[i]; | ||
| 269 | - if(item.category_id>0) { | ||
| 270 | - ishas_cate=1;break; | ||
| 271 | - } | ||
| 272 | - } | ||
| 273 | - | ||
| 274 | - //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- | ||
| 275 | - if (th.data.def_pick_store) { | ||
| 276 | - for (var k = 0; k < e.data.data.pageData.length; k++) { | ||
| 277 | - if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | ||
| 278 | - e.data.data.pageData.splice(k, 1); //删除 | ||
| 279 | - break; | ||
| 280 | - } | ||
| 281 | - } | ||
| 282 | - e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | ||
| 283 | - } | ||
| 284 | - | ||
| 285 | - //单总量超出5个的时候 | ||
| 286 | - if (e.data.data.total > 10 && ishas_cate) { | ||
| 287 | - i.get("/api/weshop/storagecategory/page", { | ||
| 288 | - data: { | ||
| 289 | - store_id: r.stoid, | ||
| 290 | - pageSize: 1000, | ||
| 291 | - orderField:"sort", | ||
| 292 | - orderType:'asc', | ||
| 293 | - }, | ||
| 294 | - success: function(ee) { | ||
| 295 | - if (ee.data.code == 0) { | ||
| 296 | - | ||
| 297 | - var check_all_cate=0; | ||
| 298 | - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){ | ||
| 299 | - for(let i in ee.data.data.pageData){ | ||
| 300 | - let item=ee.data.data.pageData[i]; | ||
| 301 | - if(item.is_show==1){ | ||
| 302 | - check_all_cate=1;break | ||
| 303 | - } | ||
| 304 | - } | ||
| 305 | - } | ||
| 306 | - | ||
| 307 | - if (check_all_cate) { | ||
| 308 | - | ||
| 309 | - var sto_cate = ee.data.data.pageData; | ||
| 310 | - var sto_arr = e.data.data.pageData; | ||
| 311 | - var newarr = new Array(); | ||
| 312 | - var qita = new Array(); | ||
| 313 | - | ||
| 314 | - var is_del_pk=0; | ||
| 315 | - //----要进行门店分组-------- | ||
| 316 | - for (var i = 0; i < sto_arr.length; i++) { | ||
| 317 | - //找一下这个门店有没有在分类数组内 | ||
| 318 | - var find2 = 0,find2name = "",sort=0; | ||
| 319 | - is_del_pk=0; | ||
| 320 | - for (var m = 0; m < sto_cate.length; m++) { | ||
| 321 | - if (sto_arr[i].category_id == sto_cate[m].cat_id) { | ||
| 322 | - if(sto_cate[m].is_show!=1){ | ||
| 323 | - is_del_pk=1; sto_arr.splice(i,1); | ||
| 324 | - i--; | ||
| 325 | - }else { | ||
| 326 | - find2 = sto_cate[m].cat_id; | ||
| 327 | - find2name = sto_cate[m].cat_name; | ||
| 328 | - sort = sto_cate[m].sort; | ||
| 329 | - is_del_pk=0; | ||
| 330 | - } | ||
| 331 | - break; | ||
| 332 | - } | ||
| 333 | - } | ||
| 334 | - if(is_del_pk) continue; | ||
| 335 | - | ||
| 336 | - if (newarr.length > 0) { | ||
| 337 | - var find = 0; | ||
| 338 | - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | ||
| 339 | - if (find2 != 0) { | ||
| 340 | - for (var ii = 0; ii < newarr.length; ii++) { | ||
| 341 | - if (sto_arr[i].category_id == newarr[ii].cat_id) { | ||
| 342 | - newarr[ii].s_arr.push(sto_arr[i]); | ||
| 343 | - find = 1; | ||
| 344 | - break; | ||
| 345 | - } | ||
| 346 | - } | ||
| 347 | - if (find == 0) { | ||
| 348 | - var arr0 = new Array(); | ||
| 349 | - arr0.push(sto_arr[i]); | ||
| 350 | - var item = { | ||
| 351 | - cat_id: find2, | ||
| 352 | - name: find2name, | ||
| 353 | - sort:sort, | ||
| 354 | - s_arr: arr0 | ||
| 355 | - }; | ||
| 356 | - newarr.push(item); | ||
| 357 | - } | ||
| 358 | - } else { | ||
| 359 | - qita.push(sto_arr[i]); | ||
| 360 | - } | ||
| 361 | - } else { | ||
| 362 | - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | ||
| 363 | - if (find2 != 0) { | ||
| 364 | - var arr0 = new Array(); | ||
| 365 | - arr0.push(sto_arr[i]); | ||
| 366 | - var item = { | ||
| 367 | - cat_id: find2, | ||
| 368 | - name: find2name, | ||
| 369 | - sort:sort, | ||
| 370 | - s_arr: arr0 | ||
| 371 | - }; | ||
| 372 | - newarr.push(item); | ||
| 373 | - } else { | ||
| 374 | - qita.push(sto_arr[i]); | ||
| 375 | - } | ||
| 376 | - } | ||
| 377 | - } | ||
| 378 | - | ||
| 379 | - var def_arr = new Array(); | ||
| 380 | - //-- 开始就看10个门店 -- | ||
| 381 | - for (var k = 0; k < 10; k++) { | ||
| 382 | - if (k == e.data.data.pageData.length) break; | ||
| 383 | - def_arr.push(e.data.data.pageData[k]); | 251 | + th.setData({ |
| 252 | + sort_store: 0 | ||
| 253 | + }); | ||
| 254 | + var i = getApp().request; | ||
| 255 | + //如果有距离的话 | ||
| 256 | + if (th.data.lat != null) { | ||
| 257 | + dd.lat = th.data.lat; | ||
| 258 | + dd.lon = th.data.lon; | ||
| 259 | + } | ||
| 260 | + //----------获取门店---------------- | ||
| 261 | + getApp().request.get("/api/weshop/pickup/list", { | ||
| 262 | + data: dd, | ||
| 263 | + success: function (res) { | ||
| 264 | + var e = res; | ||
| 265 | + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) { | ||
| 266 | + | ||
| 267 | + var ishas_cate = 0; | ||
| 268 | + for (let i in e) { | ||
| 269 | + let item = e[i]; | ||
| 270 | + if (item.category_id > 0) { | ||
| 271 | + ishas_cate = 1; | ||
| 272 | + break; | ||
| 273 | + } | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- | ||
| 277 | + if (th.data.def_pick_store) { | ||
| 278 | + for (var k = 0; k < e.data.data.pageData.length; k++) { | ||
| 279 | + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) { | ||
| 280 | + e.data.data.pageData.splice(k, 1); //删除 | ||
| 281 | + break; | ||
| 384 | } | 282 | } |
| 283 | + } | ||
| 284 | + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加 | ||
| 285 | + } | ||
| 385 | 286 | ||
| 386 | - th.setData({ | ||
| 387 | - def_pickpu_list: def_arr, | ||
| 388 | - pickpu_list: ee.data.data.pageData | ||
| 389 | - }); | ||
| 390 | - | ||
| 391 | - //门店分类要排序下 | ||
| 392 | - function compare(property){ | ||
| 393 | - return function(a,b){ | ||
| 394 | - var value1 = a[property]; | ||
| 395 | - var value2 = b[property]; | ||
| 396 | - return value1 - value2; | 287 | + //单总量超出5个的时候 |
| 288 | + if (e.data.data.total > 10 && ishas_cate) { | ||
| 289 | + i.get("/api/weshop/storagecategory/page", { | ||
| 290 | + data: { | ||
| 291 | + store_id: r.stoid, | ||
| 292 | + pageSize: 1000, | ||
| 293 | + orderField: "sort", | ||
| 294 | + orderType: 'asc', | ||
| 295 | + }, | ||
| 296 | + success: function (ee) { | ||
| 297 | + if (ee.data.code == 0) { | ||
| 298 | + | ||
| 299 | + var check_all_cate = 0; | ||
| 300 | + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) { | ||
| 301 | + for (let i in ee.data.data.pageData) { | ||
| 302 | + let item = ee.data.data.pageData[i]; | ||
| 303 | + if (item.is_show == 1) { | ||
| 304 | + check_all_cate = 1; | ||
| 305 | + break | ||
| 306 | + } | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + if (check_all_cate) { | ||
| 311 | + | ||
| 312 | + var sto_cate = ee.data.data.pageData; | ||
| 313 | + var sto_arr = e.data.data.pageData; | ||
| 314 | + var newarr = new Array(); | ||
| 315 | + var qita = new Array(); | ||
| 316 | + | ||
| 317 | + var is_del_pk = 0; | ||
| 318 | + //----要进行门店分组-------- | ||
| 319 | + for (var i = 0; i < sto_arr.length; i++) { | ||
| 320 | + //找一下这个门店有没有在分类数组内 | ||
| 321 | + var find2 = 0, find2name = "", sort = 0; | ||
| 322 | + is_del_pk = 0; | ||
| 323 | + for (var m = 0; m < sto_cate.length; m++) { | ||
| 324 | + if (sto_arr[i].category_id == sto_cate[m].cat_id) { | ||
| 325 | + if (sto_cate[m].is_show != 1) { | ||
| 326 | + is_del_pk = 1; | ||
| 327 | + sto_arr.splice(i, 1); | ||
| 328 | + i--; | ||
| 329 | + } else { | ||
| 330 | + find2 = sto_cate[m].cat_id; | ||
| 331 | + find2name = sto_cate[m].cat_name; | ||
| 332 | + sort = sto_cate[m].sort; | ||
| 333 | + is_del_pk = 0; | ||
| 334 | + } | ||
| 335 | + break; | ||
| 336 | + } | ||
| 337 | + } | ||
| 338 | + if (is_del_pk) continue; | ||
| 339 | + | ||
| 340 | + if (newarr.length > 0) { | ||
| 341 | + var find = 0; | ||
| 342 | + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | ||
| 343 | + if (find2 != 0) { | ||
| 344 | + for (var ii = 0; ii < newarr.length; ii++) { | ||
| 345 | + if (sto_arr[i].category_id == newarr[ii].cat_id) { | ||
| 346 | + newarr[ii].s_arr.push(sto_arr[i]); | ||
| 347 | + find = 1; | ||
| 348 | + break; | ||
| 349 | + } | ||
| 350 | + } | ||
| 351 | + if (find == 0) { | ||
| 352 | + var arr0 = new Array(); | ||
| 353 | + arr0.push(sto_arr[i]); | ||
| 354 | + var item = { | ||
| 355 | + cat_id: find2, | ||
| 356 | + name: find2name, | ||
| 357 | + sort: sort, | ||
| 358 | + s_arr: arr0 | ||
| 359 | + }; | ||
| 360 | + newarr.push(item); | ||
| 361 | + } | ||
| 362 | + } else { | ||
| 363 | + qita.push(sto_arr[i]); | ||
| 364 | + } | ||
| 365 | + } else { | ||
| 366 | + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | ||
| 367 | + if (find2 != 0) { | ||
| 368 | + var arr0 = new Array(); | ||
| 369 | + arr0.push(sto_arr[i]); | ||
| 370 | + var item = { | ||
| 371 | + cat_id: find2, | ||
| 372 | + name: find2name, | ||
| 373 | + sort: sort, | ||
| 374 | + s_arr: arr0 | ||
| 375 | + }; | ||
| 376 | + newarr.push(item); | ||
| 377 | + } else { | ||
| 378 | + qita.push(sto_arr[i]); | ||
| 379 | + } | ||
| 380 | + } | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + var def_arr = new Array(); | ||
| 384 | + //-- 开始就看10个门店 -- | ||
| 385 | + for (var k = 0; k < 10; k++) { | ||
| 386 | + if (k == e.data.data.pageData.length) break; | ||
| 387 | + def_arr.push(e.data.data.pageData[k]); | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + th.setData({ | ||
| 391 | + def_pickpu_list: def_arr, | ||
| 392 | + pickpu_list: ee.data.data.pageData | ||
| 393 | + }); | ||
| 394 | + | ||
| 395 | + //门店分类要排序下 | ||
| 396 | + function compare(property) { | ||
| 397 | + return function (a, b) { | ||
| 398 | + var value1 = a[property]; | ||
| 399 | + var value2 = b[property]; | ||
| 400 | + return value1 - value2; | ||
| 401 | + } | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + if (newarr.length > 0) | ||
| 405 | + newarr.sort(compare("sort")); | ||
| 406 | + | ||
| 407 | + | ||
| 408 | + //----安排其他的分类----- | ||
| 409 | + if (qita.length > 0) { | ||
| 410 | + var item = { | ||
| 411 | + cat_id: -1, | ||
| 412 | + name: "其他", | ||
| 413 | + s_arr: qita | ||
| 414 | + }; | ||
| 415 | + newarr.push(item); | ||
| 416 | + } | ||
| 417 | + th.setData({ | ||
| 418 | + is_show_sto_cat: 1, | ||
| 419 | + all_sto: newarr | ||
| 420 | + }); | ||
| 421 | + | ||
| 422 | + } else { | ||
| 423 | + th.setData({ | ||
| 424 | + is_show_sto_cat: -1, | ||
| 425 | + only_pk: e.data.data.pageData | ||
| 426 | + }); | ||
| 427 | + } | ||
| 428 | + } else { | ||
| 429 | + th.setData({ | ||
| 430 | + is_show_sto_cat: -1, | ||
| 431 | + only_pk: e.data.data.pageData | ||
| 432 | + }); | ||
| 397 | } | 433 | } |
| 398 | } | 434 | } |
| 399 | - if(newarr.length>0) | ||
| 400 | - newarr.sort(compare("sort")); | ||
| 401 | - | ||
| 402 | - | ||
| 403 | - //----安排其他的分类----- | ||
| 404 | - if (qita.length > 0) { | ||
| 405 | - var item = { | ||
| 406 | - cat_id: -1, | ||
| 407 | - name: "其他", | ||
| 408 | - s_arr: qita | ||
| 409 | - }; | ||
| 410 | - newarr.push(item); | ||
| 411 | - } | ||
| 412 | - th.setData({ | ||
| 413 | - is_show_sto_cat: 1, | ||
| 414 | - all_sto: newarr | ||
| 415 | - }); | ||
| 416 | - | ||
| 417 | - } else { | ||
| 418 | - th.setData({ | ||
| 419 | - is_show_sto_cat: -1, | ||
| 420 | - only_pk: e.data.data.pageData | ||
| 421 | - }); | ||
| 422 | - } | ||
| 423 | - } else { | ||
| 424 | - th.setData({ | ||
| 425 | - is_show_sto_cat: -1, | ||
| 426 | - only_pk: e.data.data.pageData | ||
| 427 | - }); | ||
| 428 | - } | ||
| 429 | - } | ||
| 430 | - }); | ||
| 431 | - } else { | ||
| 432 | - th.setData({ | ||
| 433 | - is_show_sto_cat: 0, | ||
| 434 | - only_pk: e.data.data.pageData | ||
| 435 | - }); | ||
| 436 | - } | ||
| 437 | - } | ||
| 438 | - | ||
| 439 | - } | ||
| 440 | - }) | ||
| 441 | - | ||
| 442 | - }, | ||
| 443 | - | ||
| 444 | - //选择更多门店 | ||
| 445 | - more_store: function() { | ||
| 446 | - this.setData({ | ||
| 447 | - sort_store: 1 | ||
| 448 | - }); | ||
| 449 | - }, | ||
| 450 | - | ||
| 451 | - //---选择分类门店--- | ||
| 452 | - choice_sort_store: function(e) { | ||
| 453 | - var index = e.currentTarget.dataset.index; | ||
| 454 | - var region_name = e.currentTarget.dataset.region; | ||
| 455 | - var item = this.data.all_sto[index]; | ||
| 456 | - this.setData({ | ||
| 457 | - region_name: region_name, | ||
| 458 | - sort_store: 0, | ||
| 459 | - choice_sort_store: 1, | ||
| 460 | - sec_sto: item, | ||
| 461 | - sec_pick_index: 0 | ||
| 462 | - }); | ||
| 463 | - }, | ||
| 464 | - // 返回按钮 | ||
| 465 | - returns: function() { | ||
| 466 | - this.setData({ | ||
| 467 | - sort_store: 0, | ||
| 468 | - choice_sort_store: 0 | ||
| 469 | - }); | ||
| 470 | - }, | ||
| 471 | - | ||
| 472 | - | ||
| 473 | - //身份证号严格校验 | ||
| 474 | - IdentityIDCard: function(e) { | ||
| 475 | - var code = e.detail.value; | ||
| 476 | - //身份证号前两位代表区域 | ||
| 477 | - var city = { | ||
| 478 | - 11: "北京", | ||
| 479 | - 12: "天津", | ||
| 480 | - 13: "河北", | ||
| 481 | - 14: "山西", | ||
| 482 | - 15: "内蒙古", | ||
| 483 | - 21: "辽宁", | ||
| 484 | - 22: "吉林", | ||
| 485 | - 23: "黑龙江 ", | ||
| 486 | - 31: "上海", | ||
| 487 | - 32: "江苏", | ||
| 488 | - 33: "浙江", | ||
| 489 | - 34: "安徽", | ||
| 490 | - 35: "福建", | ||
| 491 | - 36: "江西", | ||
| 492 | - 37: "山东", | ||
| 493 | - 41: "河南", | ||
| 494 | - 42: "湖北 ", | ||
| 495 | - 43: "湖南", | ||
| 496 | - 44: "广东", | ||
| 497 | - 45: "广西", | ||
| 498 | - 46: "海南", | ||
| 499 | - 50: "重庆", | ||
| 500 | - 51: "四川", | ||
| 501 | - 52: "贵州", | ||
| 502 | - 53: "云南", | ||
| 503 | - 54: "西藏 ", | ||
| 504 | - 61: "陕西", | ||
| 505 | - 62: "甘肃", | ||
| 506 | - 63: "青海", | ||
| 507 | - 64: "宁夏", | ||
| 508 | - 65: "新疆", | ||
| 509 | - 71: "台湾", | ||
| 510 | - 81: "香港", | ||
| 511 | - 82: "澳门", | ||
| 512 | - 91: "国外 " | ||
| 513 | - }; | ||
| 514 | - //身份证格式正则表达式 | ||
| 515 | - var idCardReg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i; | ||
| 516 | - var errorMess = ""; //错误提示信息 | ||
| 517 | - var isPass = true; //身份证验证是否通过(true通过、false未通过) | ||
| 518 | - | ||
| 519 | - //如果身份证不满足格式正则表达式 | ||
| 520 | - if (!code || !idCardReg.test(code)) { | ||
| 521 | - errorMess = "您输入的身份证号格式有误!"; | ||
| 522 | - isPass = false; | ||
| 523 | - } | ||
| 524 | - | ||
| 525 | - //区域数组中不包含需验证的身份证前两位 | ||
| 526 | - else if (!city[code.substr(0, 2)]) { | ||
| 527 | - errorMess = "您输入的身份证号格式有误!"; | ||
| 528 | - isPass = false; | ||
| 529 | - } else { | ||
| 530 | - //18位身份证需要验证最后一位校验位 | ||
| 531 | - if (code.length == 18) { | ||
| 532 | - code = code.split(''); | ||
| 533 | - //∑(ai×Wi)(mod 11) | ||
| 534 | - //加权因子 | ||
| 535 | - var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; | ||
| 536 | - //校验位 | ||
| 537 | - var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]; | ||
| 538 | - var sum = 0; | ||
| 539 | - var ai = 0; | ||
| 540 | - var wi = 0; | ||
| 541 | - for (var i = 0; i < 17; i++) { | ||
| 542 | - ai = code[i]; | ||
| 543 | - wi = factor[i]; | ||
| 544 | - sum += ai * wi; | 435 | + }); |
| 436 | + } else { | ||
| 437 | + th.setData({ | ||
| 438 | + is_show_sto_cat: 0, | ||
| 439 | + only_pk: e.data.data.pageData | ||
| 440 | + }); | ||
| 441 | + } | ||
| 442 | + } | ||
| 443 | + | ||
| 444 | + } | ||
| 445 | + }) | ||
| 446 | + | ||
| 447 | + }, | ||
| 448 | + | ||
| 449 | + //选择更多门店 | ||
| 450 | + more_store: function () { | ||
| 451 | + this.setData({ | ||
| 452 | + sort_store: 1 | ||
| 453 | + }); | ||
| 454 | + }, | ||
| 455 | + | ||
| 456 | + //---选择分类门店--- | ||
| 457 | + choice_sort_store: function (e) { | ||
| 458 | + var index = e.currentTarget.dataset.index; | ||
| 459 | + var region_name = e.currentTarget.dataset.region; | ||
| 460 | + var item = this.data.all_sto[index]; | ||
| 461 | + this.setData({ | ||
| 462 | + region_name: region_name, | ||
| 463 | + sort_store: 0, | ||
| 464 | + choice_sort_store: 1, | ||
| 465 | + sec_sto: item, | ||
| 466 | + sec_pick_index: 0 | ||
| 467 | + }); | ||
| 468 | + }, | ||
| 469 | + // 返回按钮 | ||
| 470 | + returns: function () { | ||
| 471 | + this.setData({ | ||
| 472 | + sort_store: 0, | ||
| 473 | + choice_sort_store: 0 | ||
| 474 | + }); | ||
| 475 | + }, | ||
| 476 | + | ||
| 477 | + | ||
| 478 | + //身份证号严格校验 | ||
| 479 | + IdentityIDCard: function (e) { | ||
| 480 | + var code = e.detail.value; | ||
| 481 | + //身份证号前两位代表区域 | ||
| 482 | + var city = { | ||
| 483 | + 11: "北京", | ||
| 484 | + 12: "天津", | ||
| 485 | + 13: "河北", | ||
| 486 | + 14: "山西", | ||
| 487 | + 15: "内蒙古", | ||
| 488 | + 21: "辽宁", | ||
| 489 | + 22: "吉林", | ||
| 490 | + 23: "黑龙江 ", | ||
| 491 | + 31: "上海", | ||
| 492 | + 32: "江苏", | ||
| 493 | + 33: "浙江", | ||
| 494 | + 34: "安徽", | ||
| 495 | + 35: "福建", | ||
| 496 | + 36: "江西", | ||
| 497 | + 37: "山东", | ||
| 498 | + 41: "河南", | ||
| 499 | + 42: "湖北 ", | ||
| 500 | + 43: "湖南", | ||
| 501 | + 44: "广东", | ||
| 502 | + 45: "广西", | ||
| 503 | + 46: "海南", | ||
| 504 | + 50: "重庆", | ||
| 505 | + 51: "四川", | ||
| 506 | + 52: "贵州", | ||
| 507 | + 53: "云南", | ||
| 508 | + 54: "西藏 ", | ||
| 509 | + 61: "陕西", | ||
| 510 | + 62: "甘肃", | ||
| 511 | + 63: "青海", | ||
| 512 | + 64: "宁夏", | ||
| 513 | + 65: "新疆", | ||
| 514 | + 71: "台湾", | ||
| 515 | + 81: "香港", | ||
| 516 | + 82: "澳门", | ||
| 517 | + 91: "国外 " | ||
| 518 | + }; | ||
| 519 | + //身份证格式正则表达式 | ||
| 520 | + var idCardReg = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i; | ||
| 521 | + var errorMess = ""; //错误提示信息 | ||
| 522 | + var isPass = true; //身份证验证是否通过(true通过、false未通过) | ||
| 523 | + | ||
| 524 | + //如果身份证不满足格式正则表达式 | ||
| 525 | + if (!code || !idCardReg.test(code)) { | ||
| 526 | + errorMess = "您输入的身份证号格式有误!"; | ||
| 527 | + isPass = false; | ||
| 545 | } | 528 | } |
| 546 | - var last = parity[sum % 11]; | ||
| 547 | - if (parity[sum % 11] != code[17]) { | ||
| 548 | - errorMess = "您输入的身份证号不存在!"; | ||
| 549 | - isPass = false; | 529 | + |
| 530 | + //区域数组中不包含需验证的身份证前两位 | ||
| 531 | + else if (!city[code.substr(0, 2)]) { | ||
| 532 | + errorMess = "您输入的身份证号格式有误!"; | ||
| 533 | + isPass = false; | ||
| 534 | + } else { | ||
| 535 | + //18位身份证需要验证最后一位校验位 | ||
| 536 | + if (code.length == 18) { | ||
| 537 | + code = code.split(''); | ||
| 538 | + //∑(ai×Wi)(mod 11) | ||
| 539 | + //加权因子 | ||
| 540 | + var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; | ||
| 541 | + //校验位 | ||
| 542 | + var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2]; | ||
| 543 | + var sum = 0; | ||
| 544 | + var ai = 0; | ||
| 545 | + var wi = 0; | ||
| 546 | + for (var i = 0; i < 17; i++) { | ||
| 547 | + ai = code[i]; | ||
| 548 | + wi = factor[i]; | ||
| 549 | + sum += ai * wi; | ||
| 550 | + } | ||
| 551 | + var last = parity[sum % 11]; | ||
| 552 | + if (parity[sum % 11] != code[17]) { | ||
| 553 | + errorMess = "您输入的身份证号不存在!"; | ||
| 554 | + isPass = false; | ||
| 555 | + } | ||
| 556 | + } | ||
| 557 | + ; | ||
| 550 | } | 558 | } |
| 551 | - }; | ||
| 552 | - }; | ||
| 553 | - var returnParam = { | ||
| 554 | - 'errorMess': errorMess, | ||
| 555 | - 'isPass': isPass | ||
| 556 | - }; | ||
| 557 | - if (errorMess != "") { | ||
| 558 | - // wx.showModal({ | ||
| 559 | - // title: errorMess, | ||
| 560 | - // content: '', | ||
| 561 | - // showCancel: false, | ||
| 562 | - // confirmText: '确定', | ||
| 563 | - // confirmColor: '', | ||
| 564 | - // success: function(res) {}, | ||
| 565 | - // fail: function(res) {}, | ||
| 566 | - // complete: function(res) {}, | ||
| 567 | - // }) | ||
| 568 | - | ||
| 569 | - getApp().my_warnning(errorMess, 0, this); | ||
| 570 | - this.setData({ | ||
| 571 | - id: null, | ||
| 572 | - }); | ||
| 573 | - }; | ||
| 574 | - return returnParam; | ||
| 575 | - }, | ||
| 576 | - //------初始化加载---------- | ||
| 577 | - onLoad: function(t) { | ||
| 578 | - | ||
| 579 | - self = this; | ||
| 580 | - let url1 = '/api/weshop/storeconfig/get/'; | ||
| 581 | - let url3 = '/api/weshop/users/getErpvipidPickup'; | ||
| 582 | - url1 += r.stoid; | ||
| 583 | - | ||
| 584 | - var uu=getApp().globalData.zc_dd; | ||
| 585 | - if(uu){ | ||
| 586 | - this.setData({head_pic:uu.head_pic,nickname:uu.nickname}) | 559 | + ; |
| 560 | + var returnParam = { | ||
| 561 | + 'errorMess': errorMess, | ||
| 562 | + 'isPass': isPass | ||
| 563 | + }; | ||
| 564 | + if (errorMess != "") { | ||
| 565 | + // wx.showModal({ | ||
| 566 | + // title: errorMess, | ||
| 567 | + // content: '', | ||
| 568 | + // showCancel: false, | ||
| 569 | + // confirmText: '确定', | ||
| 570 | + // confirmColor: '', | ||
| 571 | + // success: function(res) {}, | ||
| 572 | + // fail: function(res) {}, | ||
| 573 | + // complete: function(res) {}, | ||
| 574 | + // }) | ||
| 575 | + | ||
| 576 | + getApp().my_warnning(errorMess, 0, this); | ||
| 577 | + this.setData({ | ||
| 578 | + id: null, | ||
| 579 | + }); | ||
| 587 | } | 580 | } |
| 581 | + ; | ||
| 582 | + return returnParam; | ||
| 583 | + }, | ||
| 584 | + //------初始化加载---------- | ||
| 585 | + onLoad: function (t) { | ||
| 588 | 586 | ||
| 589 | - if(getApp().globalData.first_leader){ | 587 | + self = this; |
| 588 | + let url1 = '/api/weshop/storeconfig/get/'; | ||
| 589 | + let url3 = '/api/weshop/users/getErpvipidPickup'; | ||
| 590 | + url1 += r.stoid; | ||
| 591 | + | ||
| 592 | + var uu = getApp().globalData.zc_dd; | ||
| 593 | + if (uu) { | ||
| 594 | + this.setData({head_pic: uu.head_pic, nickname: uu.nickname}) | ||
| 595 | + } | ||
| 596 | + | ||
| 597 | + if (getApp().globalData.first_leader) { | ||
| 590 | //--生成会员 -- | 598 | //--生成会员 -- |
| 591 | - getApp().promiseGet("/api/weshop/users/get/" + r.stoid + "/" + getApp().globalData.first_leader,{}).then(res=>{ | ||
| 592 | - if(res.data.code==0){ | 599 | + getApp().promiseGet("/api/weshop/users/get/" + r.stoid + "/" + getApp().globalData.first_leader, {}).then(res => { |
| 600 | + if (res.data.code == 0) { | ||
| 593 | //更新会员 | 601 | //更新会员 |
| 594 | self.setData({ | 602 | self.setData({ |
| 595 | - fir_user:res.data.data | 603 | + fir_user: res.data.data |
| 596 | }) | 604 | }) |
| 597 | } | 605 | } |
| 598 | }) | 606 | }) |
| 599 | } | 607 | } |
| 600 | 608 | ||
| 601 | - app.request.get(url1, { | ||
| 602 | - success:async function(res) { | ||
| 603 | - if(res.data.code == 0) { | ||
| 604 | - let reg_type = res.data.data.reg_type; | ||
| 605 | - let reg_info = res.data.data.reg_info; | ||
| 606 | - if(reg_type) { //reg_type为1才显示积分信息 | ||
| 607 | - if(reg_info) { | ||
| 608 | - reg_info = JSON.parse(reg_info); | ||
| 609 | - var user_id=0; | ||
| 610 | - | ||
| 611 | - //-- 获取会员信息 - | ||
| 612 | - await getApp().request.promiseGet("/api/weshop/users/page", {data:{ | ||
| 613 | - store_id:r.stoid,mobile:uu.mobile | ||
| 614 | - }}).then(res=>{ | ||
| 615 | - if(ut.ajax_ok(res)){ | ||
| 616 | - user_id=res.data.data.pageData[0].user_id; | ||
| 617 | - } | ||
| 618 | - }) | ||
| 619 | - | ||
| 620 | - if(reg_info.reginfo_coupon){ | ||
| 621 | - //判断有没有领过券 | ||
| 622 | - self.check_is_send_quan(reg_info.reginfo_coupon,user_id); | ||
| 623 | - } | ||
| 624 | - | ||
| 625 | - if(reg_info.reginfo_lb_id){ | 609 | + app.request.get(url1, { |
| 610 | + success: async function (res) { | ||
| 611 | + if (res.data.code == 0) { | ||
| 612 | + let reg_type = res.data.data.reg_type; | ||
| 613 | + let reg_info = res.data.data.reg_info; | ||
| 614 | + if (reg_type) { //reg_type为1才显示积分信息 | ||
| 615 | + if (reg_info) { | ||
| 616 | + reg_info = JSON.parse(reg_info); | ||
| 617 | + var user_id = 0; | ||
| 618 | + | ||
| 619 | + //-- 获取会员信息 - | ||
| 620 | + await getApp().request.promiseGet("/api/weshop/users/page", { | ||
| 621 | + data: { | ||
| 622 | + store_id: r.stoid, mobile: uu.mobile | ||
| 623 | + } | ||
| 624 | + }).then(res => { | ||
| 625 | + if (ut.ajax_ok(res)) { | ||
| 626 | + user_id = res.data.data.pageData[0].user_id; | ||
| 627 | + } | ||
| 628 | + }) | ||
| 629 | + | ||
| 630 | + if (reg_info.reginfo_coupon) { | ||
| 631 | + //判断有没有领过券 | ||
| 632 | + self.check_is_send_quan(reg_info.reginfo_coupon, user_id); | ||
| 633 | + } | ||
| 634 | + | ||
| 635 | + if (reg_info.reginfo_lb_id) { | ||
| 626 | //判断有没有领过礼包 | 636 | //判断有没有领过礼包 |
| 627 | - self.check_is_send_libao(reg_info.reginfo_lb_id,user_id); | 637 | + self.check_is_send_libao(reg_info.reginfo_lb_id, user_id); |
| 628 | } | 638 | } |
| 629 | 639 | ||
| 630 | - }; | ||
| 631 | - }; | ||
| 632 | - self.setData({ | ||
| 633 | - reg_type, | ||
| 634 | - reg_info, | ||
| 635 | - }); | ||
| 636 | - } | ||
| 637 | - }, | ||
| 638 | - }); | 640 | + } |
| 641 | + ; | ||
| 642 | + } | ||
| 643 | + ; | ||
| 644 | + self.setData({ | ||
| 645 | + reg_type, | ||
| 646 | + reg_info, | ||
| 647 | + }); | ||
| 648 | + } | ||
| 649 | + }, | ||
| 650 | + }); | ||
| 639 | 651 | ||
| 640 | 652 | ||
| 641 | //-- 获取线下会员的情况 -- | 653 | //-- 获取线下会员的情况 -- |
| 642 | - var req_data={ | ||
| 643 | - stoid:r.stoid, | ||
| 644 | - mobile:getApp().globalData.zc_dd.mobile | 654 | + var req_data = { |
| 655 | + stoid: r.stoid, | ||
| 656 | + mobile: getApp().globalData.zc_dd.mobile | ||
| 645 | }; | 657 | }; |
| 646 | - if(getApp().globalData.zc_dd.first_leader) | ||
| 647 | - req_data.first_leader=getApp().globalData.zc_dd.first_leader | 658 | + if (getApp().globalData.zc_dd.first_leader) |
| 659 | + req_data.first_leader = getApp().globalData.zc_dd.first_leader | ||
| 648 | 660 | ||
| 649 | wx.showLoading(); | 661 | wx.showLoading(); |
| 650 | - getApp().request.promiseGet(url3, {data:req_data}).then(res=>{ | ||
| 651 | - if(res.data.code==0){ | ||
| 652 | - var back_data=res.data.data; back_data=JSON.parse(back_data); | ||
| 653 | - var set_data={is_fx:0}; | ||
| 654 | - //-- 如果有包含会员的线下的信息 -- | ||
| 655 | - if(back_data && back_data.erpviplist){ | ||
| 656 | - //-- data.data就是门店的数据 -- | ||
| 657 | - if(back_data.data){ | ||
| 658 | - back_data.erpviplist.pickup_id=back_data.data.pickup_id; | ||
| 659 | - if(!back_data.erpviplist.pick) set_data.is_fx=1; | ||
| 660 | - set_data.stoname=back_data.data.pickup_name; | ||
| 661 | - set_data.sto_sele_id=back_data.data.pickup_id; | ||
| 662 | - } | ||
| 663 | - | ||
| 664 | - //-- 推荐人姓名 -- | ||
| 665 | - if(back_data.erpviplist.fromuser) { | ||
| 666 | - set_data.tjrname=back_data.erpviplist.fromuser; | ||
| 667 | - back_data.erpviplist.fromuser_id=back_data.erpviplist.fromuser; | ||
| 668 | - } | ||
| 669 | - //性别 | ||
| 670 | - if(back_data.erpviplist.sex) set_data.isGender=back_data.erpviplist.sex; | ||
| 671 | - //名称 | ||
| 672 | - if(back_data.erpviplist.vipname) set_data.name=back_data.erpviplist.vipname; | ||
| 673 | - //身份证 | ||
| 674 | - if(back_data.erpviplist.idcard) set_data.id=back_data.erpviplist.idcard; | ||
| 675 | - //地址 | ||
| 676 | - if(back_data.erpviplist.address) set_data.address=back_data.erpviplist.address; | ||
| 677 | - //生日 | ||
| 678 | - if(back_data.erpviplist.birthday) { | ||
| 679 | - set_data.datet=back_data.erpviplist.birthday; | ||
| 680 | - set_data.isLunar=back_data.erpviplist.islunar; | ||
| 681 | - } | ||
| 682 | - set_data.user=back_data.erpviplist; | ||
| 683 | - } | ||
| 684 | - | ||
| 685 | - //-- 新的会员 -- | ||
| 686 | - if(back_data && back_data.data && back_data.data.pickup_id && !set_data.sto_sele_id){ | ||
| 687 | - set_data.stoname=back_data.data.pickup_name; | ||
| 688 | - set_data.sto_sele_id=back_data.data.pickup_id; | ||
| 689 | - } | ||
| 690 | - | ||
| 691 | - self.setData(set_data); | ||
| 692 | - if(!self.data.sto_sele_id){ | ||
| 693 | - self.get_store_set(); | ||
| 694 | - } | ||
| 695 | - } | 662 | + getApp().request.promiseGet(url3, {data: req_data}).then(res => { |
| 663 | + if (res.data.code == 0) { | ||
| 664 | + var back_data = res.data.data; | ||
| 665 | + back_data = JSON.parse(back_data); | ||
| 666 | + var set_data = {is_fx: 0}; | ||
| 667 | + //-- 如果有包含会员的线下的信息 -- | ||
| 668 | + if (back_data && back_data.erpviplist) { | ||
| 669 | + //-- data.data就是门店的数据 -- | ||
| 670 | + if (back_data.data) { | ||
| 671 | + back_data.erpviplist.pickup_id = back_data.data.pickup_id; | ||
| 672 | + if (!back_data.erpviplist.pick) set_data.is_fx = 1; | ||
| 673 | + set_data.stoname = back_data.data.pickup_name; | ||
| 674 | + set_data.sto_sele_id = back_data.data.pickup_id; | ||
| 675 | + } | ||
| 676 | + | ||
| 677 | + //-- 推荐人姓名 -- | ||
| 678 | + if (back_data.erpviplist.fromuser) { | ||
| 679 | + set_data.tjrname = back_data.erpviplist.fromuser; | ||
| 680 | + back_data.erpviplist.fromuser_id = back_data.erpviplist.fromuser; | ||
| 681 | + } | ||
| 682 | + //性别 | ||
| 683 | + if (back_data.erpviplist.sex) set_data.isGender = back_data.erpviplist.sex; | ||
| 684 | + //名称 | ||
| 685 | + if (back_data.erpviplist.vipname) set_data.name = back_data.erpviplist.vipname; | ||
| 686 | + //身份证 | ||
| 687 | + if (back_data.erpviplist.idcard) set_data.id = back_data.erpviplist.idcard; | ||
| 688 | + //地址 | ||
| 689 | + if (back_data.erpviplist.address) set_data.address = back_data.erpviplist.address; | ||
| 690 | + //生日 | ||
| 691 | + if (back_data.erpviplist.birthday) { | ||
| 692 | + set_data.datet = back_data.erpviplist.birthday; | ||
| 693 | + set_data.isLunar = back_data.erpviplist.islunar; | ||
| 694 | + | ||
| 695 | + } else { | ||
| 696 | + //----获取系统参数----- | ||
| 697 | + getApp().getConfig2(function (e) { | ||
| 698 | + var json_d = JSON.parse(e.switch_list); | ||
| 699 | + if (json_d.is_brithday != 1) { | ||
| 700 | + self.setData({isLunar: 1}) | ||
| 701 | + } | ||
| 702 | + }, 1) | ||
| 703 | + } | ||
| 704 | + | ||
| 705 | + | ||
| 706 | + set_data.user = back_data.erpviplist; | ||
| 707 | + } | ||
| 708 | + | ||
| 709 | + //-- 新的会员 -- | ||
| 710 | + if (back_data && back_data.data && back_data.data.pickup_id && !set_data.sto_sele_id) { | ||
| 711 | + set_data.stoname = back_data.data.pickup_name; | ||
| 712 | + set_data.sto_sele_id = back_data.data.pickup_id; | ||
| 713 | + } | ||
| 714 | + | ||
| 715 | + self.setData(set_data); | ||
| 716 | + if (!self.data.sto_sele_id) { | ||
| 717 | + self.get_store_set(); | ||
| 718 | + } | ||
| 719 | + } else { | ||
| 720 | + //----获取系统参数----- | ||
| 721 | + getApp().getConfig2(function (e) { | ||
| 722 | + var json_d = JSON.parse(e.switch_list); | ||
| 723 | + if (json_d.is_brithday != 1) { | ||
| 724 | + self.setData({isLunar: 1}) | ||
| 725 | + } | ||
| 726 | + }, 1) | ||
| 727 | + } | ||
| 728 | + | ||
| 729 | + | ||
| 696 | wx.hideLoading(); | 730 | wx.hideLoading(); |
| 697 | - }) | ||
| 698 | - | ||
| 699 | - var is_back=t.is_back; | ||
| 700 | - if(is_back) this.data.is_back=1; | ||
| 701 | - | ||
| 702 | - }, | ||
| 703 | - | ||
| 704 | - onShow: function() { | ||
| 705 | - | ||
| 706 | - getApp().check_can_share(); | ||
| 707 | - | ||
| 708 | - if (this.data.is_zy) return false; | ||
| 709 | - | ||
| 710 | - //如果有传值进行跳转的话 | ||
| 711 | - var choice_guide=null; | ||
| 712 | - if(getApp().globalData.choice_guide){ | ||
| 713 | - choice_guide=JSON.parse(JSON.stringify(getApp().globalData.choice_guide)); | ||
| 714 | - getApp().globalData.choice_guide=null; | ||
| 715 | - } | ||
| 716 | - | ||
| 717 | - }, | ||
| 718 | - | ||
| 719 | - check_is_send_quan:function(cid,uid){ | ||
| 720 | - var self=this; | ||
| 721 | - let url2 = '/api/weshop/prom/coupon/get/'; | ||
| 722 | - //-- 如果没有会员信息的时候 -- | ||
| 723 | - if(!uid){ | ||
| 724 | - //获取优惠券 | ||
| 725 | - url2 += cid; | ||
| 726 | - app.request.get(url2, { | ||
| 727 | - success: function(r) { | ||
| 728 | - if(r.data.code == 0) { | ||
| 729 | - self.setData({ | ||
| 730 | - couponInfo: r.data.data.name, | ||
| 731 | - }); | ||
| 732 | - }; | ||
| 733 | - }, | ||
| 734 | - }); | ||
| 735 | - | ||
| 736 | - }else{ | ||
| 737 | - //看一下会员有没有领过注册的券 | ||
| 738 | - getApp().promiseGet("/api/weshop/couponList/page",{ | ||
| 739 | - data:{store_id:r.stoid,uid:uid,cid:cid} | ||
| 740 | - }).then(res=>{ | ||
| 741 | - var is_ling=0; | ||
| 742 | - if(res.data.code==0 && res.data.data && res.data.data.total>0){ | ||
| 743 | - is_ling=1; | ||
| 744 | - } | ||
| 745 | - | ||
| 746 | - //没有领过券,就显示 | ||
| 747 | - if(!is_ling){ | ||
| 748 | - //获取优惠券 | ||
| 749 | - url2 += cid; | ||
| 750 | - app.request.get(url2, { | ||
| 751 | - success: function(r) { | ||
| 752 | - if(r.data.code == 0) { | ||
| 753 | - console.log('000res==>', r.data.data.name); | ||
| 754 | - self.setData({ | ||
| 755 | - couponInfo: r.data.data.name, | ||
| 756 | - }); | ||
| 757 | - }; | ||
| 758 | - }, | ||
| 759 | - }); | ||
| 760 | - } | ||
| 761 | - | ||
| 762 | - }) | ||
| 763 | - } | ||
| 764 | - | ||
| 765 | - | ||
| 766 | - | ||
| 767 | - | ||
| 768 | - }, | ||
| 769 | - | ||
| 770 | - //-- 有没有送过礼包 -- | ||
| 771 | - check_is_send_libao:function(lbid,uid){ | ||
| 772 | - var self=this; | ||
| 773 | - let url2 = '/api/weshop/marketing/giftbag/get'; | ||
| 774 | - if(!uid){ | ||
| 775 | - //获取礼包 | ||
| 776 | - app.request.get(url2, { | ||
| 777 | - data:{storeId:r.stoid,giftBagId:lbid}, | ||
| 778 | - success: function(r) { | ||
| 779 | - if(r.data.code == 0) { | ||
| 780 | - console.log('000res==>', r.data.data.name); | ||
| 781 | - self.setData({ | ||
| 782 | - libao: r.data.data.lbTitle, | ||
| 783 | - }); | ||
| 784 | - } | ||
| 785 | - } | ||
| 786 | - }); | ||
| 787 | - | ||
| 788 | - }else{ | ||
| 789 | - //看一下会员有没有领过注册的券 | ||
| 790 | - getApp().promiseGet("/api/weshop/marketing/gift/getgiveone",{ | ||
| 791 | - data:{store_id:r.stoid,user_id:uid,lbid:lbid,act_type:7} | ||
| 792 | - }).then(res=>{ | ||
| 793 | - var is_ling=0; | ||
| 794 | - //-1就表示有领过 | ||
| 795 | - if(res.data.code==-1 ){ | ||
| 796 | - is_ling=1; | ||
| 797 | - } | ||
| 798 | - //没有领过礼包,就显示 | ||
| 799 | - if(!is_ling){ | ||
| 800 | - //获取礼包 | ||
| 801 | - app.request.get(url2, { | ||
| 802 | - data:{storeId:r.stoid,giftBagId:lbid}, | ||
| 803 | - success: function(r) { | ||
| 804 | - if(r.data.code == 0) { | ||
| 805 | - self.setData({ | ||
| 806 | - libao: r.data.data.lbTitle, | ||
| 807 | - }); | ||
| 808 | - } | ||
| 809 | - } | ||
| 810 | - }); | ||
| 811 | - } | ||
| 812 | - | ||
| 813 | - }) | ||
| 814 | - } | 731 | + }) |
| 732 | + | ||
| 733 | + var is_back = t.is_back; | ||
| 734 | + if (is_back) this.data.is_back = 1; | ||
| 735 | + | ||
| 736 | + | ||
| 737 | + }, | ||
| 738 | + | ||
| 739 | + onShow: function () { | ||
| 740 | + | ||
| 741 | + getApp().check_can_share(); | ||
| 742 | + | ||
| 743 | + if (this.data.is_zy) return false; | ||
| 744 | + | ||
| 745 | + //如果有传值进行跳转的话 | ||
| 746 | + var choice_guide = null; | ||
| 747 | + if (getApp().globalData.choice_guide) { | ||
| 748 | + choice_guide = JSON.parse(JSON.stringify(getApp().globalData.choice_guide)); | ||
| 749 | + getApp().globalData.choice_guide = null; | ||
| 750 | + } | ||
| 751 | + | ||
| 752 | + }, | ||
| 753 | + | ||
| 754 | + check_is_send_quan: function (cid, uid) { | ||
| 755 | + var self = this; | ||
| 756 | + let url2 = '/api/weshop/prom/coupon/get/'; | ||
| 757 | + //-- 如果没有会员信息的时候 -- | ||
| 758 | + if (!uid) { | ||
| 759 | + //获取优惠券 | ||
| 760 | + url2 += cid; | ||
| 761 | + app.request.get(url2, { | ||
| 762 | + success: function (r) { | ||
| 763 | + if (r.data.code == 0) { | ||
| 764 | + self.setData({ | ||
| 765 | + couponInfo: r.data.data.name, | ||
| 766 | + }); | ||
| 767 | + } | ||
| 768 | + ; | ||
| 769 | + }, | ||
| 770 | + }); | ||
| 771 | + | ||
| 772 | + } else { | ||
| 773 | + //看一下会员有没有领过注册的券 | ||
| 774 | + getApp().promiseGet("/api/weshop/couponList/page", { | ||
| 775 | + data: {store_id: r.stoid, uid: uid, cid: cid} | ||
| 776 | + }).then(res => { | ||
| 777 | + var is_ling = 0; | ||
| 778 | + if (res.data.code == 0 && res.data.data && res.data.data.total > 0) { | ||
| 779 | + is_ling = 1; | ||
| 780 | + } | ||
| 781 | + | ||
| 782 | + //没有领过券,就显示 | ||
| 783 | + if (!is_ling) { | ||
| 784 | + //获取优惠券 | ||
| 785 | + url2 += cid; | ||
| 786 | + app.request.get(url2, { | ||
| 787 | + success: function (r) { | ||
| 788 | + if (r.data.code == 0) { | ||
| 789 | + console.log('000res==>', r.data.data.name); | ||
| 790 | + self.setData({ | ||
| 791 | + couponInfo: r.data.data.name, | ||
| 792 | + }); | ||
| 793 | + } | ||
| 794 | + ; | ||
| 795 | + }, | ||
| 796 | + }); | ||
| 797 | + } | ||
| 798 | + | ||
| 799 | + }) | ||
| 800 | + } | ||
| 801 | + | ||
| 802 | + | ||
| 803 | + }, | ||
| 804 | + | ||
| 805 | + //-- 有没有送过礼包 -- | ||
| 806 | + check_is_send_libao: function (lbid, uid) { | ||
| 807 | + var self = this; | ||
| 808 | + let url2 = '/api/weshop/marketing/giftbag/get'; | ||
| 809 | + if (!uid) { | ||
| 810 | + //获取礼包 | ||
| 811 | + app.request.get(url2, { | ||
| 812 | + data: {storeId: r.stoid, giftBagId: lbid}, | ||
| 813 | + success: function (r) { | ||
| 814 | + if (r.data.code == 0) { | ||
| 815 | + console.log('000res==>', r.data.data.name); | ||
| 816 | + self.setData({ | ||
| 817 | + libao: r.data.data.lbTitle, | ||
| 818 | + }); | ||
| 819 | + } | ||
| 820 | + } | ||
| 821 | + }); | ||
| 822 | + | ||
| 823 | + } else { | ||
| 824 | + //看一下会员有没有领过注册的券 | ||
| 825 | + getApp().promiseGet("/api/weshop/marketing/gift/getgiveone", { | ||
| 826 | + data: {store_id: r.stoid, user_id: uid, lbid: lbid, act_type: 7} | ||
| 827 | + }).then(res => { | ||
| 828 | + var is_ling = 0; | ||
| 829 | + //-1就表示有领过 | ||
| 830 | + if (res.data.code == -1) { | ||
| 831 | + is_ling = 1; | ||
| 832 | + } | ||
| 833 | + //没有领过礼包,就显示 | ||
| 834 | + if (!is_ling) { | ||
| 835 | + //获取礼包 | ||
| 836 | + app.request.get(url2, { | ||
| 837 | + data: {storeId: r.stoid, giftBagId: lbid}, | ||
| 838 | + success: function (r) { | ||
| 839 | + if (r.data.code == 0) { | ||
| 840 | + self.setData({ | ||
| 841 | + libao: r.data.data.lbTitle, | ||
| 842 | + }); | ||
| 843 | + } | ||
| 844 | + } | ||
| 845 | + }); | ||
| 846 | + } | ||
| 847 | + | ||
| 848 | + }) | ||
| 849 | + } | ||
| 850 | + | ||
| 851 | + }, | ||
| 852 | + | ||
| 853 | + | ||
| 854 | + //------卡片的显示和关闭-------- | ||
| 855 | + show_tc: function () { | ||
| 856 | + if (!getApp().globalData.userInfo) return false; | ||
| 857 | + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | ||
| 858 | + var val = getApp().globalData.userInfo.mobile + "|" + ut.formatTime(); | ||
| 859 | + val = "^" + ut.base64_encode(val); | ||
| 860 | + | ||
| 861 | + qrcode('qrcode', val, 480, 480, this); | ||
| 862 | + | ||
| 863 | + this.setData({ | ||
| 864 | + tc_hide: false, | ||
| 865 | + }); | ||
| 866 | + }, | ||
| 867 | + hide_tc: function () { | ||
| 868 | + this.setData({ | ||
| 869 | + tc_hide: true, | ||
| 870 | + }); | ||
| 871 | + }, | ||
| 815 | 872 | ||
| 873 | + //地址 | ||
| 874 | + address: function (e) { | ||
| 875 | + var val = e.detail; | ||
| 876 | + this.setData({ | ||
| 877 | + address: val.value | ||
| 878 | + }); | ||
| 816 | }, | 879 | }, |
| 817 | 880 | ||
| 818 | 881 | ||
| 882 | + //点击确认修改信息 | ||
| 883 | + confirm_revision: function () { | ||
| 884 | + var th = this; | ||
| 885 | + var isstcsp = th.data.isstcsp; //是否启用消费密码 | ||
| 886 | + var phone = th.data.phone; //手机号码 | ||
| 887 | + if (phone == "" || phone == null) { | ||
| 888 | + getApp().my_warnning("手机不能为空", 0, th); | ||
| 889 | + return false; | ||
| 890 | + } | ||
| 891 | + var consumption = th.data.consumption; //消费密码 | ||
| 892 | + var isstcsp = th.data.isstcsp; | ||
| 893 | + if (isstcsp == 1) { | ||
| 894 | + | ||
| 895 | + if (consumption == null || consumption == "" || consumption == undefined) { | ||
| 896 | + getApp().my_warnning("消费密码不能为空", 0, th); | ||
| 897 | + return false; | ||
| 898 | + } | ||
| 899 | + if (consumption.length < 6) { | ||
| 900 | + getApp().my_warnning("消费密码不能小于6位", 0, th); | ||
| 901 | + return false; | ||
| 902 | + } | ||
| 903 | + } | ||
| 904 | + var sex = th.data.isGender; //性别 | ||
| 905 | + | ||
| 906 | + if (sex != "1" && sex != "2") { | ||
| 907 | + getApp().my_warnning("请选择性别", 0, th); | ||
| 908 | + return false; | ||
| 909 | + } | ||
| 910 | + var user_name = th.data.user.vipname; //用户姓名 | ||
| 911 | + if (user_name == "" || user_name == null) { | ||
| 912 | + getApp().my_warnning("请输入名字", 0, th); | ||
| 913 | + return false; | ||
| 914 | + } | ||
| 915 | + var identity_card = th.data.identity_card; //身份证 | ||
| 916 | + | ||
| 917 | + if (identity_card != null && identity_card != undefined && identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) { | ||
| 918 | + getApp().my_warnning("身份证号码错误", 0, th); | ||
| 919 | + return false; | ||
| 920 | + } | ||
| 921 | + var address = th.data.address; //地址 | ||
| 922 | + var sto_sele_id = th.data.sto_sele_id; | ||
| 923 | + var datas = { | ||
| 924 | + mobile: phone, //手机号码 | ||
| 925 | + store_id: r.stoid, | ||
| 926 | + user_id: getApp().globalData.user_id, | ||
| 927 | + vipnopwd: isstcsp, | ||
| 928 | + vippass: consumption, //消费密码 | ||
| 929 | + sex: sex, //性别 | ||
| 930 | + vipname: user_name, //昵称 | ||
| 931 | + idcard: identity_card, //身份证 | ||
| 932 | + address: address, //地址 | ||
| 933 | + pickup_id: sto_sele_id,//自提门店 所属门店 | ||
| 934 | + islunar: th.data.iscalendar, | ||
| 935 | + birthday: th.data.datet | ||
| 936 | + } | ||
| 937 | + //往上提交美导的ID | ||
| 938 | + if (th.data.fir_guide_id != th.data.user.staffId) { | ||
| 939 | + datas.staffId = th.data.user.staffId; | ||
| 940 | + } | ||
| 941 | + | ||
| 942 | + var post_data = {...getApp().globalData.zc_dd, ...datas} | ||
| 943 | + this.zu_ce(post_data); | ||
| 944 | + }, | ||
| 819 | 945 | ||
| 820 | 946 | ||
| 821 | - //------卡片的显示和关闭-------- | ||
| 822 | - show_tc: function() { | ||
| 823 | - if (!getApp().globalData.userInfo) return false; | ||
| 824 | - //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | ||
| 825 | - var val=getApp().globalData.userInfo.mobile+"|"+ut.formatTime(); | ||
| 826 | - val="^"+ut.base64_encode(val); | ||
| 827 | - | ||
| 828 | - qrcode('qrcode', val, 480, 480, this); | ||
| 829 | - | ||
| 830 | - this.setData({ | ||
| 831 | - tc_hide: false, | ||
| 832 | - }); | ||
| 833 | - }, | ||
| 834 | - hide_tc: function() { | ||
| 835 | - this.setData({ | ||
| 836 | - tc_hide: true, | ||
| 837 | - }); | ||
| 838 | - }, | ||
| 839 | - | ||
| 840 | - //地址 | ||
| 841 | - address: function(e) { | ||
| 842 | - var val = e.detail; | ||
| 843 | - this.setData({ | ||
| 844 | - address: val.value | ||
| 845 | - }); | ||
| 846 | - }, | ||
| 847 | - | ||
| 848 | - | ||
| 849 | - //点击确认修改信息 | ||
| 850 | - confirm_revision: function() { | ||
| 851 | - var th = this; | ||
| 852 | - var isstcsp = th.data.isstcsp; //是否启用消费密码 | ||
| 853 | - var phone = th.data.phone; //手机号码 | ||
| 854 | - if (phone == "" || phone == null) { | ||
| 855 | - getApp().my_warnning("手机不能为空", 0, th); | ||
| 856 | - return false; | ||
| 857 | - } | ||
| 858 | - var consumption = th.data.consumption; //消费密码 | ||
| 859 | - var isstcsp = th.data.isstcsp; | ||
| 860 | - if (isstcsp == 1) { | ||
| 861 | - | ||
| 862 | - if (consumption == null || consumption == "" || consumption == undefined) { | ||
| 863 | - getApp().my_warnning("消费密码不能为空", 0, th); | ||
| 864 | - return false; | ||
| 865 | - } | ||
| 866 | - if (consumption.length < 6) { | ||
| 867 | - getApp().my_warnning("消费密码不能小于6位", 0, th); | ||
| 868 | - return false; | ||
| 869 | - } | ||
| 870 | - } | ||
| 871 | - var sex = th.data.isGender; //性别 | ||
| 872 | - | ||
| 873 | - if (sex != "1" && sex != "2") { | ||
| 874 | - getApp().my_warnning("请选择性别", 0, th); | ||
| 875 | - return false; | ||
| 876 | - } | ||
| 877 | - var user_name = th.data.user.vipname; //用户姓名 | ||
| 878 | - if (user_name == "" || user_name == null) { | ||
| 879 | - getApp().my_warnning("请输入名字", 0, th); | ||
| 880 | - return false; | ||
| 881 | - } | ||
| 882 | - var identity_card = th.data.identity_card; //身份证 | ||
| 883 | - | ||
| 884 | - if (identity_card!=null && identity_card!=undefined && identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) { | ||
| 885 | - getApp().my_warnning("身份证号码错误", 0, th); | ||
| 886 | - return false; | ||
| 887 | - } | ||
| 888 | - var address = th.data.address; //地址 | ||
| 889 | - var sto_sele_id = th.data.sto_sele_id; | ||
| 890 | - var datas = { | ||
| 891 | - mobile: phone, //手机号码 | ||
| 892 | - store_id: r.stoid, | ||
| 893 | - user_id: getApp().globalData.user_id, | ||
| 894 | - vipnopwd: isstcsp, | ||
| 895 | - vippass: consumption, //消费密码 | ||
| 896 | - sex: sex, //性别 | ||
| 897 | - vipname: user_name, //昵称 | ||
| 898 | - idcard: identity_card, //身份证 | ||
| 899 | - address: address, //地址 | ||
| 900 | - pickup_id: sto_sele_id ,//自提门店 所属门店 | ||
| 901 | - islunar:th.data.iscalendar, | ||
| 902 | - birthday:th.data.datet | ||
| 903 | - } | ||
| 904 | - //往上提交美导的ID | ||
| 905 | - if(th.data.fir_guide_id!=th.data.user.staffId){ | ||
| 906 | - datas.staffId=th.data.user.staffId; | ||
| 907 | - } | ||
| 908 | - | ||
| 909 | - var post_data={ ...getApp().globalData.zc_dd, ...datas } | ||
| 910 | - this.zu_ce(post_data); | ||
| 911 | - }, | ||
| 912 | - | ||
| 913 | - | ||
| 914 | - zu_ce:function (dd) { | ||
| 915 | - var th=this; | 947 | + zu_ce: function (dd) { |
| 948 | + var th = this; | ||
| 916 | wx.showLoading({ | 949 | wx.showLoading({ |
| 917 | title: "处理中.", | 950 | title: "处理中.", |
| 918 | - mask:true | 951 | + mask: true |
| 919 | }) | 952 | }) |
| 920 | 953 | ||
| 921 | app.request.get("/api/weshop/users/thirdLogin", { | 954 | app.request.get("/api/weshop/users/thirdLogin", { |
| @@ -923,342 +956,340 @@ Page({ | @@ -923,342 +956,340 @@ Page({ | ||
| 923 | success: function (e) { | 956 | success: function (e) { |
| 924 | 957 | ||
| 925 | wx.hideLoading(); | 958 | wx.hideLoading(); |
| 926 | - th.setData({loading:0}) ; | 959 | + th.setData({loading: 0}); |
| 927 | 960 | ||
| 928 | if (e.data.code == 0) { | 961 | if (e.data.code == 0) { |
| 929 | app.globalData.user_id = e.data.data.user_id; | 962 | app.globalData.user_id = e.data.data.user_id; |
| 930 | } else { | 963 | } else { |
| 931 | - return app.showWarning("授权登入失败!"+e.data.msg); | 964 | + return app.showWarning("授权登入失败!" + e.data.msg); |
| 932 | } | 965 | } |
| 933 | - getApp().globalData.login_back=1; | ||
| 934 | - wx.setStorageSync("userinfo",e.data.data); | 966 | + getApp().globalData.login_back = 1; |
| 967 | + wx.setStorageSync("userinfo", e.data.data); | ||
| 935 | wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = s.getFullUrl(a.globalData.userInfo.head_pic); | 968 | wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = s.getFullUrl(a.globalData.userInfo.head_pic); |
| 936 | - wx.navigateBack({ delta: 1}) | 969 | + wx.navigateBack({delta: 1}) |
| 937 | 970 | ||
| 938 | }, | 971 | }, |
| 939 | failStatus: function (t) { | 972 | failStatus: function (t) { |
| 940 | wx.hideLoading(); | 973 | wx.hideLoading(); |
| 941 | - th.setData({loading:0}) ; | 974 | + th.setData({loading: 0}); |
| 942 | return app.my_warnning("授权登入失败,请稍后再试!", 0, that); | 975 | return app.my_warnning("授权登入失败,请稍后再试!", 0, that); |
| 943 | }, | 976 | }, |
| 944 | fail: function (t) { | 977 | fail: function (t) { |
| 945 | wx.hideLoading(); | 978 | wx.hideLoading(); |
| 946 | - th.setData({loading:0}) ; | 979 | + th.setData({loading: 0}); |
| 947 | return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; | 980 | return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; |
| 948 | } | 981 | } |
| 949 | }); | 982 | }); |
| 950 | }, | 983 | }, |
| 951 | 984 | ||
| 952 | - //选择地址 | ||
| 953 | - goto_address: function() { | ||
| 954 | - // this.setData({ is_zy: 1 }); | ||
| 955 | - }, | ||
| 956 | - | ||
| 957 | - //--点击分享事件--- | ||
| 958 | - onShareAppMessage: function(t) { | ||
| 959 | - getApp().globalData.no_clear=1 | ||
| 960 | - return o.share; | ||
| 961 | - }, | ||
| 962 | - | ||
| 963 | - //-- 跳转到获取导购的列表 -- | ||
| 964 | - go_get_guide:function () { | ||
| 965 | - this.check_click_ok(function(){ | ||
| 966 | - getApp().goto("/packageB/pages/user/choice_guide/choice_guide"); | ||
| 967 | - },1) | ||
| 968 | - }, | ||
| 969 | - | ||
| 970 | - //点击门店,导购的次数判断, type 1=导购 2=门店 | ||
| 971 | - check_click_ok:function(func,idx){ | ||
| 972 | - var th=this; | ||
| 973 | - var userId=getApp().globalData.user_id; | ||
| 974 | - getApp().request.get("/api/weshop/users/getGuideNum/"+r.stoid+"/"+userId+"/"+idx, { | ||
| 975 | - success: function(res) { | ||
| 976 | - if(res.data.code==0){ | ||
| 977 | - func(); | ||
| 978 | - }else{ | ||
| 979 | - getApp().my_warnning(res.data.msg, 0, th); | ||
| 980 | - } | ||
| 981 | - } | ||
| 982 | - }); | ||
| 983 | - }, | ||
| 984 | - | ||
| 985 | - //获取输入框内容 | ||
| 986 | - getInput(e) { | ||
| 987 | - return e.detail.value; | ||
| 988 | - }, | ||
| 989 | - | ||
| 990 | - verifyInput(e) { | ||
| 991 | - let value = e.detail.value; | ||
| 992 | - if (value == "" || value == null || value == undefined) { | ||
| 993 | - app.my_warnning("请输入", 0, this); | ||
| 994 | - } | ||
| 995 | - }, | ||
| 996 | - | ||
| 997 | - //获取推荐人 | ||
| 998 | - getReferee(e) { | ||
| 999 | - let referee = this.getInput(e); | ||
| 1000 | - this.data.referee = referee; | ||
| 1001 | - console.log(referee); | ||
| 1002 | - }, | ||
| 1003 | - | ||
| 1004 | - //获取姓名 | ||
| 1005 | - getName(e) { | ||
| 1006 | - let name = this.getInput(e); | ||
| 1007 | - this.data.name = name; | ||
| 1008 | - }, | ||
| 1009 | - | ||
| 1010 | - //获取性别 | ||
| 1011 | - getGender(e) { | ||
| 1012 | - let sex = e.currentTarget.dataset.sex; | ||
| 1013 | - this.setData({ | ||
| 1014 | - isGender: sex, | ||
| 1015 | - }); | ||
| 1016 | - }, | ||
| 1017 | - | ||
| 1018 | - //获取身份证 | ||
| 1019 | - getId(e) { | ||
| 1020 | - let id = this.getInput(e); | ||
| 1021 | - this.data.id = id; | ||
| 1022 | - }, | ||
| 1023 | - | ||
| 1024 | - //验证身份证号码 | ||
| 1025 | - // verifyId(e) { | ||
| 1026 | - // let id = this.data.id; | ||
| 1027 | - // if(id) { | ||
| 1028 | - // if (id != null && id != undefined && id != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(id))) { | ||
| 1029 | - // getApp().my_warnning("身份证号码无效!", 0, this); | ||
| 1030 | - // } | ||
| 1031 | - // }; | ||
| 1032 | - // }, | ||
| 1033 | - | ||
| 1034 | - //获取地址 | ||
| 1035 | - getAddress(e) { | ||
| 1036 | - let address = this.getInput(e); | ||
| 1037 | - this.data.address = address; | ||
| 1038 | - }, | ||
| 1039 | - | ||
| 1040 | - //获取生日 | ||
| 1041 | - bindChange: function(e) { | ||
| 1042 | - let strBirthday = e.detail.value; | ||
| 1043 | - let age = this.verifyBirthday(strBirthday); | ||
| 1044 | - | ||
| 1045 | - if(age <= 10) { | ||
| 1046 | - app.my_warnning("会员年龄不能小于10岁(含10岁)", 0, this); | ||
| 1047 | - } else if(age >= 70) { | ||
| 1048 | - app.my_warnning("会员年龄不能超过70岁(含70岁)", 0, this); | ||
| 1049 | - } else { | ||
| 1050 | - this.setData({ | ||
| 1051 | - datet: e.detail.value, | ||
| 1052 | - }); | ||
| 1053 | - } | ||
| 1054 | - | ||
| 1055 | - }, | ||
| 1056 | - | ||
| 1057 | - // 生日判断 | ||
| 1058 | - verifyBirthday(strBirthday) { | ||
| 1059 | - var returnAge; | ||
| 1060 | - var strBirthdayArr = strBirthday.split("-"); | ||
| 1061 | - var birthYear = strBirthdayArr[0]; | ||
| 1062 | - var birthMonth = strBirthdayArr[1]; | ||
| 1063 | - var birthDay = strBirthdayArr[2]; | ||
| 1064 | - | ||
| 1065 | - d = new Date(); | ||
| 1066 | - var nowYear = d.getFullYear(); | ||
| 1067 | - var nowMonth = d.getMonth() + 1; | ||
| 1068 | - var nowDay = d.getDate(); | ||
| 1069 | - | ||
| 1070 | - if(nowYear == birthYear){ | ||
| 1071 | - returnAge = 0;//同年 则为0岁 | ||
| 1072 | - } else { | ||
| 1073 | - var ageDiff = nowYear - birthYear ; //年之差 | ||
| 1074 | - if(ageDiff > 0){ | ||
| 1075 | - if(nowMonth == birthMonth) { | ||
| 1076 | - var dayDiff = nowDay - birthDay;//日之差 | ||
| 1077 | - if(dayDiff < 0) | ||
| 1078 | - { | ||
| 1079 | - returnAge = ageDiff - 1; | ||
| 1080 | - } | ||
| 1081 | - else | ||
| 1082 | - { | ||
| 1083 | - returnAge = ageDiff ; | ||
| 1084 | - } | ||
| 1085 | - } | ||
| 1086 | - else | ||
| 1087 | - { | ||
| 1088 | - var monthDiff = nowMonth - birthMonth;//月之差 | ||
| 1089 | - if(monthDiff < 0) | ||
| 1090 | - { | ||
| 1091 | - returnAge = ageDiff - 1; | ||
| 1092 | - } | ||
| 1093 | - else | ||
| 1094 | - { | ||
| 1095 | - returnAge = ageDiff ; | ||
| 1096 | - } | ||
| 1097 | - } | ||
| 1098 | - } | ||
| 1099 | - else | ||
| 1100 | - { | ||
| 1101 | - returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天 | ||
| 1102 | - } | ||
| 1103 | - } | ||
| 1104 | - return returnAge;//返回周岁年龄 | ||
| 1105 | - }, | ||
| 1106 | - | ||
| 1107 | - //是否为农历 | ||
| 1108 | - isLunar(e) { | ||
| 1109 | - let isLunar = null; | ||
| 1110 | - if(e.detail.value[0]) { | ||
| 1111 | - isLunar = 1; | ||
| 1112 | - } else { | ||
| 1113 | - isLunar = 0; | ||
| 1114 | - }; | ||
| 1115 | - this.data.isLunar = isLunar; | ||
| 1116 | - // console.log(isLunar); | ||
| 1117 | - }, | ||
| 1118 | - | ||
| 1119 | - // 是否同意协议 | ||
| 1120 | - isAgree(e) { | ||
| 1121 | - let isAgree = null; | ||
| 1122 | - if(e.detail.value[0]) { | ||
| 1123 | - isAgree = true; | ||
| 1124 | - } else { | ||
| 1125 | - isAgree = false; | ||
| 1126 | - }; | ||
| 1127 | - // this.data.isAgree = isAgree; | ||
| 1128 | - this.setData({ | ||
| 1129 | - isAgree, | ||
| 1130 | - }); | ||
| 1131 | - console.log(isAgree); | ||
| 1132 | - }, | ||
| 1133 | - | ||
| 1134 | - | ||
| 1135 | - //保存 | ||
| 1136 | - save: function() { | ||
| 1137 | - var th = this; | ||
| 1138 | - var sto_sele_id = this.data.sto_sele_id; | ||
| 1139 | - var user=app.globalData.userInfo; | ||
| 1140 | - | ||
| 1141 | - var data = { | ||
| 1142 | - store_id: r.stoid, | ||
| 1143 | - }; | ||
| 1144 | - | ||
| 1145 | - //-- 需要推荐人 -- | ||
| 1146 | - if(this.data.reg_info.introducer_state){ | ||
| 1147 | - | ||
| 1148 | - var tj= this.data.fir_user?this.data.fir_user.mobile:''; | ||
| 1149 | - if(!tj){ | ||
| 1150 | - tj=this.data.user['fromuser_id']?this.data.user['fromuser_id']:''; | 985 | + //选择地址 |
| 986 | + goto_address: function () { | ||
| 987 | + // this.setData({ is_zy: 1 }); | ||
| 988 | + }, | ||
| 989 | + | ||
| 990 | + //--点击分享事件--- | ||
| 991 | + onShareAppMessage: function (t) { | ||
| 992 | + getApp().globalData.no_clear = 1 | ||
| 993 | + return o.share; | ||
| 994 | + }, | ||
| 995 | + | ||
| 996 | + //-- 跳转到获取导购的列表 -- | ||
| 997 | + go_get_guide: function () { | ||
| 998 | + this.check_click_ok(function () { | ||
| 999 | + getApp().goto("/packageB/pages/user/choice_guide/choice_guide"); | ||
| 1000 | + }, 1) | ||
| 1001 | + }, | ||
| 1002 | + | ||
| 1003 | + //点击门店,导购的次数判断, type 1=导购 2=门店 | ||
| 1004 | + check_click_ok: function (func, idx) { | ||
| 1005 | + var th = this; | ||
| 1006 | + var userId = getApp().globalData.user_id; | ||
| 1007 | + getApp().request.get("/api/weshop/users/getGuideNum/" + r.stoid + "/" + userId + "/" + idx, { | ||
| 1008 | + success: function (res) { | ||
| 1009 | + if (res.data.code == 0) { | ||
| 1010 | + func(); | ||
| 1011 | + } else { | ||
| 1012 | + getApp().my_warnning(res.data.msg, 0, th); | ||
| 1151 | } | 1013 | } |
| 1014 | + } | ||
| 1015 | + }); | ||
| 1016 | + }, | ||
| 1017 | + | ||
| 1018 | + //获取输入框内容 | ||
| 1019 | + getInput(e) { | ||
| 1020 | + return e.detail.value; | ||
| 1021 | + }, | ||
| 1152 | 1022 | ||
| 1153 | - let tjrname = this.data.referee || tj; | ||
| 1154 | - if (tjrname == "" || tjrname == null) { | ||
| 1155 | - //app.my_warnning("请输入推荐人", 0, this); | ||
| 1156 | - //return false; | ||
| 1157 | - }; | ||
| 1158 | - if(tjrname) data.tjrname=tjrname; | ||
| 1159 | - } | ||
| 1160 | - | ||
| 1161 | - //-- 需要姓名 -- | ||
| 1162 | - if(this.data.reg_info.name_state){ | ||
| 1163 | - let vipname = this.data.name; | ||
| 1164 | - if (vipname == "" || vipname == null) { | ||
| 1165 | - app.my_warnning("请输入姓名", 0, this); | ||
| 1166 | - return false; | ||
| 1167 | - }; | ||
| 1168 | - data.vipname=vipname; | ||
| 1169 | - } | ||
| 1170 | - //需要性别 | ||
| 1171 | - if(this.data.reg_info.sex_state){ | ||
| 1172 | - let sex = this.data.isGender; | ||
| 1173 | - if (sex != "1" && sex != "2") { | ||
| 1174 | - app.my_warnning("请选择性别", 0, this); | ||
| 1175 | - return false; | ||
| 1176 | - }; | ||
| 1177 | - data.sex=sex; | ||
| 1178 | - } | ||
| 1179 | - //需要生日 | ||
| 1180 | - if(this.data.reg_info.birthday_state){ | ||
| 1181 | - let birthday = this.data.datet; | ||
| 1182 | - if (birthday == "" || birthday == null) { | ||
| 1183 | - app.my_warnning("请选择出生日期", 0, this); | ||
| 1184 | - return false; | ||
| 1185 | - }; | ||
| 1186 | - | ||
| 1187 | - data.birthday=birthday; | ||
| 1188 | - data.islunar=self.data.isLunar?1:0; | ||
| 1189 | - } | ||
| 1190 | - | ||
| 1191 | - //-- 需要身份证 -- | ||
| 1192 | - if(this.data.reg_info.idcard_state){ | ||
| 1193 | - let idcard = this.data.id; | ||
| 1194 | - if (idcard == "" || idcard == null) { | ||
| 1195 | - app.my_warnning("请输入身份证号码", 0, this); | ||
| 1196 | - return false; | ||
| 1197 | - }; | ||
| 1198 | - data.idcard=idcard; | ||
| 1199 | - } | ||
| 1200 | - //需要地址 | ||
| 1201 | - if(this.data.reg_info.address_state){ | ||
| 1202 | - let address = this.data.address; | ||
| 1203 | - if (address == "" || address == null) { | ||
| 1204 | - app.my_warnning("请输入地址", 0, this); | ||
| 1205 | - return false; | ||
| 1206 | - }; | ||
| 1207 | - data.address=address; | ||
| 1208 | - } | ||
| 1209 | - //需要门店 | ||
| 1210 | - if(this.data.reg_info.pick_state){ | ||
| 1211 | - let pickup_id = sto_sele_id; | ||
| 1212 | - if (pickup_id == "" || pickup_id == null) { | ||
| 1213 | - app.my_warnning("请输入门店", 0, this); | ||
| 1214 | - return false; | ||
| 1215 | - }; | ||
| 1216 | - data.pickup_id=sto_sele_id; | ||
| 1217 | - } | ||
| 1218 | - | ||
| 1219 | - let isAgree = this.data.isAgree; | ||
| 1220 | - if(!isAgree) { | ||
| 1221 | - app.my_warnning("请您先阅读和勾选指定的内容", 0, this); | ||
| 1222 | - return false; | ||
| 1223 | - }; | ||
| 1224 | - | ||
| 1225 | - | ||
| 1226 | - | ||
| 1227 | - | ||
| 1228 | - var post_data={ ...getApp().globalData.zc_dd, ...data }; | 1023 | + verifyInput(e) { |
| 1024 | + let value = e.detail.value; | ||
| 1025 | + if (value == "" || value == null || value == undefined) { | ||
| 1026 | + app.my_warnning("请输入", 0, this); | ||
| 1027 | + } | ||
| 1028 | + }, | ||
| 1029 | + | ||
| 1030 | + //获取推荐人 | ||
| 1031 | + getReferee(e) { | ||
| 1032 | + let referee = this.getInput(e); | ||
| 1033 | + this.data.referee = referee; | ||
| 1034 | + console.log(referee); | ||
| 1035 | + }, | ||
| 1036 | + | ||
| 1037 | + //获取姓名 | ||
| 1038 | + getName(e) { | ||
| 1039 | + let name = this.getInput(e); | ||
| 1040 | + this.data.name = name; | ||
| 1041 | + }, | ||
| 1042 | + | ||
| 1043 | + //获取性别 | ||
| 1044 | + getGender(e) { | ||
| 1045 | + let sex = e.currentTarget.dataset.sex; | ||
| 1046 | + this.setData({ | ||
| 1047 | + isGender: sex, | ||
| 1048 | + }); | ||
| 1049 | + }, | ||
| 1050 | + | ||
| 1051 | + //获取身份证 | ||
| 1052 | + getId(e) { | ||
| 1053 | + let id = this.getInput(e); | ||
| 1054 | + this.data.id = id; | ||
| 1055 | + }, | ||
| 1056 | + | ||
| 1057 | + //验证身份证号码 | ||
| 1058 | + // verifyId(e) { | ||
| 1059 | + // let id = this.data.id; | ||
| 1060 | + // if(id) { | ||
| 1061 | + // if (id != null && id != undefined && id != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(id))) { | ||
| 1062 | + // getApp().my_warnning("身份证号码无效!", 0, this); | ||
| 1063 | + // } | ||
| 1064 | + // }; | ||
| 1065 | + // }, | ||
| 1066 | + | ||
| 1067 | + //获取地址 | ||
| 1068 | + getAddress(e) { | ||
| 1069 | + let address = this.getInput(e); | ||
| 1070 | + this.data.address = address; | ||
| 1071 | + }, | ||
| 1072 | + | ||
| 1073 | + //获取生日 | ||
| 1074 | + bindChange: function (e) { | ||
| 1075 | + let strBirthday = e.detail.value; | ||
| 1076 | + let age = this.verifyBirthday(strBirthday); | ||
| 1077 | + | ||
| 1078 | + if (age <= 10) { | ||
| 1079 | + app.my_warnning("会员年龄不能小于10岁(含10岁)", 0, this); | ||
| 1080 | + } else if (age >= 70) { | ||
| 1081 | + app.my_warnning("会员年龄不能超过70岁(含70岁)", 0, this); | ||
| 1082 | + } else { | ||
| 1083 | + this.setData({ | ||
| 1084 | + datet: e.detail.value, | ||
| 1085 | + }); | ||
| 1086 | + } | ||
| 1087 | + | ||
| 1088 | + }, | ||
| 1089 | + | ||
| 1090 | + // 生日判断 | ||
| 1091 | + verifyBirthday(strBirthday) { | ||
| 1092 | + var returnAge; | ||
| 1093 | + var strBirthdayArr = strBirthday.split("-"); | ||
| 1094 | + var birthYear = strBirthdayArr[0]; | ||
| 1095 | + var birthMonth = strBirthdayArr[1]; | ||
| 1096 | + var birthDay = strBirthdayArr[2]; | ||
| 1097 | + | ||
| 1098 | + d = new Date(); | ||
| 1099 | + var nowYear = d.getFullYear(); | ||
| 1100 | + var nowMonth = d.getMonth() + 1; | ||
| 1101 | + var nowDay = d.getDate(); | ||
| 1102 | + | ||
| 1103 | + if (nowYear == birthYear) { | ||
| 1104 | + returnAge = 0;//同年 则为0岁 | ||
| 1105 | + } else { | ||
| 1106 | + var ageDiff = nowYear - birthYear; //年之差 | ||
| 1107 | + if (ageDiff > 0) { | ||
| 1108 | + if (nowMonth == birthMonth) { | ||
| 1109 | + var dayDiff = nowDay - birthDay;//日之差 | ||
| 1110 | + if (dayDiff < 0) { | ||
| 1111 | + returnAge = ageDiff - 1; | ||
| 1112 | + } else { | ||
| 1113 | + returnAge = ageDiff; | ||
| 1114 | + } | ||
| 1115 | + } else { | ||
| 1116 | + var monthDiff = nowMonth - birthMonth;//月之差 | ||
| 1117 | + if (monthDiff < 0) { | ||
| 1118 | + returnAge = ageDiff - 1; | ||
| 1119 | + } else { | ||
| 1120 | + returnAge = ageDiff; | ||
| 1121 | + } | ||
| 1122 | + } | ||
| 1123 | + } else { | ||
| 1124 | + returnAge = -1;//返回-1 表示出生日期输入错误 晚于今天 | ||
| 1125 | + } | ||
| 1126 | + } | ||
| 1127 | + return returnAge;//返回周岁年龄 | ||
| 1128 | + }, | ||
| 1129 | + | ||
| 1130 | + //是否为农历 | ||
| 1131 | + isLunar(e) { | ||
| 1132 | + let isLunar = null; | ||
| 1133 | + if (e.detail.value[0]) { | ||
| 1134 | + isLunar = 1; | ||
| 1135 | + } else { | ||
| 1136 | + isLunar = 0; | ||
| 1137 | + } | ||
| 1138 | + ; | ||
| 1139 | + this.data.isLunar = isLunar; | ||
| 1140 | + // console.log(isLunar); | ||
| 1141 | + }, | ||
| 1142 | + | ||
| 1143 | + // 是否同意协议 | ||
| 1144 | + isAgree(e) { | ||
| 1145 | + let isAgree = null; | ||
| 1146 | + if (e.detail.value[0]) { | ||
| 1147 | + isAgree = true; | ||
| 1148 | + } else { | ||
| 1149 | + isAgree = false; | ||
| 1150 | + } | ||
| 1151 | + ; | ||
| 1152 | + // this.data.isAgree = isAgree; | ||
| 1153 | + this.setData({ | ||
| 1154 | + isAgree, | ||
| 1155 | + }); | ||
| 1156 | + console.log(isAgree); | ||
| 1157 | + }, | ||
| 1158 | + | ||
| 1159 | + | ||
| 1160 | + //保存 | ||
| 1161 | + save: function () { | ||
| 1162 | + var th = this; | ||
| 1163 | + var sto_sele_id = this.data.sto_sele_id; | ||
| 1164 | + var user = app.globalData.userInfo; | ||
| 1165 | + | ||
| 1166 | + var data = { | ||
| 1167 | + store_id: r.stoid, | ||
| 1168 | + }; | ||
| 1169 | + | ||
| 1170 | + //-- 需要推荐人 -- | ||
| 1171 | + if (this.data.reg_info.introducer_state) { | ||
| 1172 | + | ||
| 1173 | + var tj = this.data.fir_user ? this.data.fir_user.mobile : ''; | ||
| 1174 | + if (!tj) { | ||
| 1175 | + tj = this.data.user['fromuser_id'] ? this.data.user['fromuser_id'] : ''; | ||
| 1176 | + } | ||
| 1177 | + | ||
| 1178 | + let tjrname = this.data.referee || tj; | ||
| 1179 | + if (tjrname == "" || tjrname == null) { | ||
| 1180 | + //app.my_warnning("请输入推荐人", 0, this); | ||
| 1181 | + //return false; | ||
| 1182 | + } | ||
| 1183 | + ; | ||
| 1184 | + if (tjrname) data.tjrname = tjrname; | ||
| 1185 | + } | ||
| 1186 | + | ||
| 1187 | + //-- 需要姓名 -- | ||
| 1188 | + if (this.data.reg_info.name_state) { | ||
| 1189 | + let vipname = this.data.name; | ||
| 1190 | + if (vipname == "" || vipname == null) { | ||
| 1191 | + app.my_warnning("请输入姓名", 0, this); | ||
| 1192 | + return false; | ||
| 1193 | + } | ||
| 1194 | + ; | ||
| 1195 | + data.vipname = vipname; | ||
| 1196 | + } | ||
| 1197 | + //需要性别 | ||
| 1198 | + if (this.data.reg_info.sex_state) { | ||
| 1199 | + let sex = this.data.isGender; | ||
| 1200 | + if (sex != "1" && sex != "2") { | ||
| 1201 | + app.my_warnning("请选择性别", 0, this); | ||
| 1202 | + return false; | ||
| 1203 | + } | ||
| 1204 | + ; | ||
| 1205 | + data.sex = sex; | ||
| 1206 | + } | ||
| 1207 | + //需要生日 | ||
| 1208 | + if (this.data.reg_info.birthday_state) { | ||
| 1209 | + let birthday = this.data.datet; | ||
| 1210 | + if (birthday == "" || birthday == null) { | ||
| 1211 | + app.my_warnning("请选择出生日期", 0, this); | ||
| 1212 | + return false; | ||
| 1213 | + } | ||
| 1214 | + ; | ||
| 1215 | + | ||
| 1216 | + data.birthday = birthday; | ||
| 1217 | + data.islunar = self.data.isLunar ? 1 : 0; | ||
| 1218 | + } | ||
| 1219 | + | ||
| 1220 | + //-- 需要身份证 -- | ||
| 1221 | + if (this.data.reg_info.idcard_state) { | ||
| 1222 | + let idcard = this.data.id; | ||
| 1223 | + if (idcard == "" || idcard == null) { | ||
| 1224 | + app.my_warnning("请输入身份证号码", 0, this); | ||
| 1225 | + return false; | ||
| 1226 | + } | ||
| 1227 | + ; | ||
| 1228 | + data.idcard = idcard; | ||
| 1229 | + } | ||
| 1230 | + //需要地址 | ||
| 1231 | + if (this.data.reg_info.address_state) { | ||
| 1232 | + let address = this.data.address; | ||
| 1233 | + if (address == "" || address == null) { | ||
| 1234 | + app.my_warnning("请输入地址", 0, this); | ||
| 1235 | + return false; | ||
| 1236 | + } | ||
| 1237 | + ; | ||
| 1238 | + data.address = address; | ||
| 1239 | + } | ||
| 1240 | + //需要门店 | ||
| 1241 | + if (this.data.reg_info.pick_state) { | ||
| 1242 | + let pickup_id = sto_sele_id; | ||
| 1243 | + if (pickup_id == "" || pickup_id == null) { | ||
| 1244 | + app.my_warnning("请输入门店", 0, this); | ||
| 1245 | + return false; | ||
| 1246 | + } | ||
| 1247 | + ; | ||
| 1248 | + data.pickup_id = sto_sele_id; | ||
| 1249 | + } | ||
| 1250 | + | ||
| 1251 | + let isAgree = this.data.isAgree; | ||
| 1252 | + if (!isAgree) { | ||
| 1253 | + app.my_warnning("请您先阅读和勾选指定的内容", 0, this); | ||
| 1254 | + return false; | ||
| 1255 | + } | ||
| 1256 | + ; | ||
| 1257 | + | ||
| 1258 | + | ||
| 1259 | + var post_data = {...getApp().globalData.zc_dd, ...data}; | ||
| 1229 | 1260 | ||
| 1230 | delete post_data.sessionKey; | 1261 | delete post_data.sessionKey; |
| 1231 | delete post_data.encryptedData; | 1262 | delete post_data.encryptedData; |
| 1232 | delete post_data.iv; | 1263 | delete post_data.iv; |
| 1233 | 1264 | ||
| 1234 | 1265 | ||
| 1235 | - if(th.data.loading) return false; | ||
| 1236 | - th.setData({loading:1}) ; | 1266 | + if (th.data.loading) return false; |
| 1267 | + th.setData({loading: 1}); | ||
| 1237 | 1268 | ||
| 1238 | this.zu_ce(post_data); | 1269 | this.zu_ce(post_data); |
| 1239 | - | ||
| 1240 | 1270 | ||
| 1241 | - }, | 1271 | + |
| 1272 | + }, | ||
| 1242 | 1273 | ||
| 1243 | 1274 | ||
| 1244 | - get_store_set:function () { | ||
| 1245 | - var th=this; | 1275 | + get_store_set: function () { |
| 1276 | + var th = this; | ||
| 1246 | //如果是扫码进来的 | 1277 | //如果是扫码进来的 |
| 1247 | - if(getApp().globalData.store_number){ | 1278 | + if (getApp().globalData.store_number) { |
| 1248 | var dd = { | 1279 | var dd = { |
| 1249 | store_id: r.stoid, | 1280 | store_id: r.stoid, |
| 1250 | isstop: 0, | 1281 | isstop: 0, |
| 1251 | pageSize: 1, | 1282 | pageSize: 1, |
| 1252 | - page:1, | ||
| 1253 | - pickup_no:getApp().globalData.store_number | 1283 | + page: 1, |
| 1284 | + pickup_no: getApp().globalData.store_number | ||
| 1254 | }; | 1285 | }; |
| 1255 | 1286 | ||
| 1256 | //获取扫码的门店 | 1287 | //获取扫码的门店 |
| 1257 | getApp().request.promiseGet("/api/weshop/pickup/list", { | 1288 | getApp().request.promiseGet("/api/weshop/pickup/list", { |
| 1258 | data: dd, | 1289 | data: dd, |
| 1259 | }).then(res => { | 1290 | }).then(res => { |
| 1260 | - if(ut.ajax_ok(res)){ | ||
| 1261 | - var top_store=res.data.data.pageData[0]; | 1291 | + if (ut.ajax_ok(res)) { |
| 1292 | + var top_store = res.data.data.pageData[0]; | ||
| 1262 | th.setData({ | 1293 | th.setData({ |
| 1263 | stoname: top_store.pickup_name, | 1294 | stoname: top_store.pickup_name, |
| 1264 | sto_sele_name: top_store.pickup_name, | 1295 | sto_sele_name: top_store.pickup_name, |
| @@ -1268,16 +1299,16 @@ Page({ | @@ -1268,16 +1299,16 @@ Page({ | ||
| 1268 | } | 1299 | } |
| 1269 | }) | 1300 | }) |
| 1270 | 1301 | ||
| 1271 | - }else{ | 1302 | + } else { |
| 1272 | wx.getLocation({ | 1303 | wx.getLocation({ |
| 1273 | type: 'gcj02', | 1304 | type: 'gcj02', |
| 1274 | - success: function(res) { | 1305 | + success: function (res) { |
| 1275 | th.data.lat = res.latitude; | 1306 | th.data.lat = res.latitude; |
| 1276 | th.data.lon = res.longitude; | 1307 | th.data.lon = res.longitude; |
| 1277 | th.set_fir_store_to_def(); | 1308 | th.set_fir_store_to_def(); |
| 1278 | }, | 1309 | }, |
| 1279 | - fail: function(res) { | ||
| 1280 | - if(res.errCode == 2) { | 1310 | + fail: function (res) { |
| 1311 | + if (res.errCode == 2) { | ||
| 1281 | getApp().confirmBox("请开启GPS定位", null, 25000, !1); | 1312 | getApp().confirmBox("请开启GPS定位", null, 25000, !1); |
| 1282 | } | 1313 | } |
| 1283 | } | 1314 | } |
| @@ -1287,28 +1318,28 @@ Page({ | @@ -1287,28 +1318,28 @@ Page({ | ||
| 1287 | 1318 | ||
| 1288 | 1319 | ||
| 1289 | //-- 设置最近的店为默认的店,一开始加载的时候 -- | 1320 | //-- 设置最近的店为默认的店,一开始加载的时候 -- |
| 1290 | - set_fir_store_to_def(){ | ||
| 1291 | - var th=this; | 1321 | + set_fir_store_to_def() { |
| 1322 | + var th = this; | ||
| 1292 | var dd = { | 1323 | var dd = { |
| 1293 | store_id: r.stoid, | 1324 | store_id: r.stoid, |
| 1294 | isstop: 0, | 1325 | isstop: 0, |
| 1295 | pageSize: 1, | 1326 | pageSize: 1, |
| 1296 | - page:1, | 1327 | + page: 1, |
| 1297 | }; | 1328 | }; |
| 1298 | dd.lat = th.data.lat; | 1329 | dd.lat = th.data.lat; |
| 1299 | dd.lon = th.data.lon; | 1330 | dd.lon = th.data.lon; |
| 1300 | 1331 | ||
| 1301 | - var top_store=getApp().globalData.pk_store; | ||
| 1302 | - if(top_store){ | ||
| 1303 | - dd.pickup_id=top_store.pickup_id; | 1332 | + var top_store = getApp().globalData.pk_store; |
| 1333 | + if (top_store) { | ||
| 1334 | + dd.pickup_id = top_store.pickup_id; | ||
| 1304 | } | 1335 | } |
| 1305 | 1336 | ||
| 1306 | //----------获取门店,最近的门店---------------- | 1337 | //----------获取门店,最近的门店---------------- |
| 1307 | getApp().request.promiseGet("/api/weshop/pickup/list", { | 1338 | getApp().request.promiseGet("/api/weshop/pickup/list", { |
| 1308 | data: dd, | 1339 | data: dd, |
| 1309 | }).then(res => { | 1340 | }).then(res => { |
| 1310 | - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ | ||
| 1311 | - var top_store=res.data.data.pageData[0]; | 1341 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { |
| 1342 | + var top_store = res.data.data.pageData[0]; | ||
| 1312 | th.setData({ | 1343 | th.setData({ |
| 1313 | stoname: top_store.pickup_name, | 1344 | stoname: top_store.pickup_name, |
| 1314 | sto_sele_name: top_store.pickup_name, | 1345 | sto_sele_name: top_store.pickup_name, |
| @@ -1318,10 +1349,6 @@ Page({ | @@ -1318,10 +1349,6 @@ Page({ | ||
| 1318 | } | 1349 | } |
| 1319 | }) | 1350 | }) |
| 1320 | }, | 1351 | }, |
| 1321 | - | ||
| 1322 | - | ||
| 1323 | - | ||
| 1324 | - | ||
| 1325 | 1352 | ||
| 1326 | 1353 | ||
| 1327 | }); | 1354 | }); |
| 1328 | \ No newline at end of file | 1355 | \ No newline at end of file |
packageA/pages/prom_list/prom_list.js
| @@ -268,9 +268,10 @@ Page({ | @@ -268,9 +268,10 @@ Page({ | ||
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | if (!ee.data.collocationList) { | 270 | if (!ee.data.collocationList) { |
| 271 | + var user_id=getApp().globalData.user_id || 0; | ||
| 271 | /*---获取活动的重表---*/ | 272 | /*---获取活动的重表---*/ |
| 272 | //调用接口判断订单优惠, | 273 | //调用接口判断订单优惠, |
| 273 | - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + ee.data.gid + "/2"+"/"+getApp().globalData.user_id, {}).then(res => { | 274 | + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + ee.data.gid + "/2"+"/"+user_id, {}).then(res => { |
| 274 | if (res.data.code == 0) { | 275 | if (res.data.code == 0) { |
| 275 | var r_data = res.data.data; | 276 | var r_data = res.data.data; |
| 276 | 277 | ||
| @@ -1455,13 +1456,16 @@ Page({ | @@ -1455,13 +1456,16 @@ Page({ | ||
| 1455 | if (th.data.is_show_sto_cat == 1) { | 1456 | if (th.data.is_show_sto_cat == 1) { |
| 1456 | item = th.data.def_pickpu_list[index]; | 1457 | item = th.data.def_pickpu_list[index]; |
| 1457 | } else { | 1458 | } else { |
| 1458 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1459 | + item =th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1459 | } | 1460 | } |
| 1460 | 1461 | ||
| 1461 | } else { | 1462 | } else { |
| 1462 | var index = th.data.sec_pick_index; | 1463 | var index = th.data.sec_pick_index; |
| 1463 | item = th.data.sec_sto.s_arr[index]; | 1464 | item = th.data.sec_sto.s_arr[index]; |
| 1464 | } | 1465 | } |
| 1466 | + | ||
| 1467 | + if(!item) return false; | ||
| 1468 | + | ||
| 1465 | 1469 | ||
| 1466 | //--回调函数的用法-- | 1470 | //--回调函数的用法-- |
| 1467 | th.check_the_pick(item,function(){ | 1471 | th.check_the_pick(item,function(){ |
| @@ -1522,12 +1526,14 @@ Page({ | @@ -1522,12 +1526,14 @@ Page({ | ||
| 1522 | if (th.data.is_show_sto_cat == 1) { | 1526 | if (th.data.is_show_sto_cat == 1) { |
| 1523 | item = th.data.def_pickpu_list[index]; | 1527 | item = th.data.def_pickpu_list[index]; |
| 1524 | } else { | 1528 | } else { |
| 1525 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1529 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1526 | } | 1530 | } |
| 1527 | } else { | 1531 | } else { |
| 1528 | var index = th.data.sec_pick_index; | 1532 | var index = th.data.sec_pick_index; |
| 1529 | item = th.data.sec_sto.s_arr[index]; | 1533 | item = th.data.sec_sto.s_arr[index]; |
| 1530 | } | 1534 | } |
| 1535 | + | ||
| 1536 | + if(!item) return false; | ||
| 1531 | 1537 | ||
| 1532 | //先设置之前,要判断是不是有库存 | 1538 | //先设置之前,要判断是不是有库存 |
| 1533 | th.check_the_pick(item,function(){ | 1539 | th.check_the_pick(item,function(){ |
packageB/pages/zuhegou/index/index.js
| @@ -1123,7 +1123,7 @@ Page({ | @@ -1123,7 +1123,7 @@ Page({ | ||
| 1123 | return s.my_warnning("商品数量不能为0", 0, th); | 1123 | return s.my_warnning("商品数量不能为0", 0, th); |
| 1124 | } | 1124 | } |
| 1125 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1125 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1126 | - this.setData({ | 1126 | + th.setData({ |
| 1127 | sto_sele_name: "" | 1127 | sto_sele_name: "" |
| 1128 | }); | 1128 | }); |
| 1129 | if (th.data.sto_sele_name == "") { | 1129 | if (th.data.sto_sele_name == "") { |
| @@ -1680,13 +1680,15 @@ Page({ | @@ -1680,13 +1680,15 @@ Page({ | ||
| 1680 | if (th.data.is_show_sto_cat == 1) { | 1680 | if (th.data.is_show_sto_cat == 1) { |
| 1681 | item = th.data.def_pickpu_list[index]; | 1681 | item = th.data.def_pickpu_list[index]; |
| 1682 | } else { | 1682 | } else { |
| 1683 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1683 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1684 | } | 1684 | } |
| 1685 | } else { | 1685 | } else { |
| 1686 | var index = th.data.sec_pick_index; | 1686 | var index = th.data.sec_pick_index; |
| 1687 | item = th.data.sec_sto.s_arr[index]; | 1687 | item = th.data.sec_sto.s_arr[index]; |
| 1688 | } | 1688 | } |
| 1689 | 1689 | ||
| 1690 | + if(!item) return false; | ||
| 1691 | + | ||
| 1690 | //判断门店的配送方式是不是匹配 | 1692 | //判断门店的配送方式是不是匹配 |
| 1691 | var g_distr_type = 0; | 1693 | var g_distr_type = 0; |
| 1692 | if (th.data.sele_g) | 1694 | if (th.data.sele_g) |
| @@ -1749,12 +1751,14 @@ Page({ | @@ -1749,12 +1751,14 @@ Page({ | ||
| 1749 | if (th.data.is_show_sto_cat == 1) { | 1751 | if (th.data.is_show_sto_cat == 1) { |
| 1750 | item = th.data.def_pickpu_list[index]; | 1752 | item = th.data.def_pickpu_list[index]; |
| 1751 | } else { | 1753 | } else { |
| 1752 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1754 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1753 | } | 1755 | } |
| 1754 | } else { | 1756 | } else { |
| 1755 | var index = th.data.sec_pick_index; | 1757 | var index = th.data.sec_pick_index; |
| 1756 | item = th.data.sec_sto.s_arr[index]; | 1758 | item = th.data.sec_sto.s_arr[index]; |
| 1757 | } | 1759 | } |
| 1760 | + if(!item) return false; | ||
| 1761 | + | ||
| 1758 | 1762 | ||
| 1759 | //判断门店的配送方式是不是匹配 | 1763 | //判断门店的配送方式是不是匹配 |
| 1760 | var g_distr_type = th.data.sele_g.distr_type; | 1764 | var g_distr_type = th.data.sele_g.distr_type; |
packageB/pages/zuhegou/preindex/index.js
| @@ -992,7 +992,7 @@ Page({ | @@ -992,7 +992,7 @@ Page({ | ||
| 992 | return s.my_warnning("商品数量不能为0", 0, th); | 992 | return s.my_warnning("商品数量不能为0", 0, th); |
| 993 | } | 993 | } |
| 994 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 994 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 995 | - this.setData({ | 995 | + th.setData({ |
| 996 | sto_sele_name: "" | 996 | sto_sele_name: "" |
| 997 | }); | 997 | }); |
| 998 | if (th.data.sto_sele_name == "") { | 998 | if (th.data.sto_sele_name == "") { |
| @@ -1548,13 +1548,15 @@ Page({ | @@ -1548,13 +1548,15 @@ Page({ | ||
| 1548 | if (th.data.is_show_sto_cat == 1) { | 1548 | if (th.data.is_show_sto_cat == 1) { |
| 1549 | item = th.data.def_pickpu_list[index]; | 1549 | item = th.data.def_pickpu_list[index]; |
| 1550 | } else { | 1550 | } else { |
| 1551 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1551 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1552 | } | 1552 | } |
| 1553 | } else { | 1553 | } else { |
| 1554 | var index = th.data.sec_pick_index; | 1554 | var index = th.data.sec_pick_index; |
| 1555 | item = th.data.sec_sto.s_arr[index]; | 1555 | item = th.data.sec_sto.s_arr[index]; |
| 1556 | } | 1556 | } |
| 1557 | 1557 | ||
| 1558 | + if(!item) return false; | ||
| 1559 | + | ||
| 1558 | //判断门店的配送方式是不是匹配 | 1560 | //判断门店的配送方式是不是匹配 |
| 1559 | var g_distr_type = 0; | 1561 | var g_distr_type = 0; |
| 1560 | if (th.data.sele_g) | 1562 | if (th.data.sele_g) |
| @@ -1609,13 +1611,15 @@ Page({ | @@ -1609,13 +1611,15 @@ Page({ | ||
| 1609 | if (th.data.is_show_sto_cat == 1) { | 1611 | if (th.data.is_show_sto_cat == 1) { |
| 1610 | item = th.data.def_pickpu_list[index]; | 1612 | item = th.data.def_pickpu_list[index]; |
| 1611 | } else { | 1613 | } else { |
| 1612 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1614 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1613 | } | 1615 | } |
| 1614 | } else { | 1616 | } else { |
| 1615 | var index = th.data.sec_pick_index; | 1617 | var index = th.data.sec_pick_index; |
| 1616 | item = th.data.sec_sto.s_arr[index]; | 1618 | item = th.data.sec_sto.s_arr[index]; |
| 1617 | } | 1619 | } |
| 1618 | 1620 | ||
| 1621 | + if(!item) return false; | ||
| 1622 | + | ||
| 1619 | //判断门店的配送方式是不是匹配 | 1623 | //判断门店的配送方式是不是匹配 |
| 1620 | var g_distr_type = th.data.sele_g.distr_type; | 1624 | var g_distr_type = th.data.sele_g.distr_type; |
| 1621 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { | 1625 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
| @@ -1389,7 +1389,7 @@ Page({ | @@ -1389,7 +1389,7 @@ Page({ | ||
| 1389 | 1389 | ||
| 1390 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 1390 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); |
| 1391 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1391 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1392 | - this.setData({ | 1392 | + th.setData({ |
| 1393 | sto_sele_name: "" | 1393 | sto_sele_name: "" |
| 1394 | }); | 1394 | }); |
| 1395 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 1395 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -1493,7 +1493,7 @@ Page({ | @@ -1493,7 +1493,7 @@ Page({ | ||
| 1493 | 1493 | ||
| 1494 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 1494 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); |
| 1495 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1495 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1496 | - this.setData({ | 1496 | + th.setData({ |
| 1497 | sto_sele_name: "" | 1497 | sto_sele_name: "" |
| 1498 | }); | 1498 | }); |
| 1499 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 1499 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -4162,7 +4162,7 @@ Page({ | @@ -4162,7 +4162,7 @@ Page({ | ||
| 4162 | // } | 4162 | // } |
| 4163 | 4163 | ||
| 4164 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 4164 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 4165 | - this.setData({ | 4165 | + th.setData({ |
| 4166 | sto_sele_name: "" | 4166 | sto_sele_name: "" |
| 4167 | }); | 4167 | }); |
| 4168 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 4168 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -5742,7 +5742,7 @@ Page({ | @@ -5742,7 +5742,7 @@ Page({ | ||
| 5742 | if (th.data.is_show_sto_cat == 1) { | 5742 | if (th.data.is_show_sto_cat == 1) { |
| 5743 | item = th.data.def_pickpu_list[index]; | 5743 | item = th.data.def_pickpu_list[index]; |
| 5744 | } else { | 5744 | } else { |
| 5745 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 5745 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 5746 | } | 5746 | } |
| 5747 | 5747 | ||
| 5748 | } else { | 5748 | } else { |
| @@ -5750,6 +5750,8 @@ Page({ | @@ -5750,6 +5750,8 @@ Page({ | ||
| 5750 | item = th.data.sec_sto.s_arr[index]; | 5750 | item = th.data.sec_sto.s_arr[index]; |
| 5751 | } | 5751 | } |
| 5752 | 5752 | ||
| 5753 | + if(!item) return false; | ||
| 5754 | + | ||
| 5753 | if (!th.data.sele_g) return false; | 5755 | if (!th.data.sele_g) return false; |
| 5754 | //判断门店的配送方式是不是匹配 | 5756 | //判断门店的配送方式是不是匹配 |
| 5755 | var g_distr_type = th.data.sele_g.distr_type; | 5757 | var g_distr_type = th.data.sele_g.distr_type; |
| @@ -5826,13 +5828,15 @@ Page({ | @@ -5826,13 +5828,15 @@ Page({ | ||
| 5826 | if (th.data.is_show_sto_cat == 1) { | 5828 | if (th.data.is_show_sto_cat == 1) { |
| 5827 | item = th.data.def_pickpu_list[index]; | 5829 | item = th.data.def_pickpu_list[index]; |
| 5828 | } else { | 5830 | } else { |
| 5829 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 5831 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 5830 | } | 5832 | } |
| 5831 | } else { | 5833 | } else { |
| 5832 | var index = th.data.sec_pick_index; | 5834 | var index = th.data.sec_pick_index; |
| 5833 | item = th.data.sec_sto.s_arr[index]; | 5835 | item = th.data.sec_sto.s_arr[index]; |
| 5834 | } | 5836 | } |
| 5835 | 5837 | ||
| 5838 | + if(!item) return false; | ||
| 5839 | + | ||
| 5836 | //判断门店的配送方式是不是匹配 | 5840 | //判断门店的配送方式是不是匹配 |
| 5837 | var g_distr_type = th.data.sele_g.distr_type; | 5841 | var g_distr_type = th.data.sele_g.distr_type; |
| 5838 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { | 5842 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { |
packageC/pages/presell/goodsInfo/goodsInfo.js
| @@ -1019,7 +1019,7 @@ Page({ | @@ -1019,7 +1019,7 @@ Page({ | ||
| 1019 | 1019 | ||
| 1020 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 1020 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); |
| 1021 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1021 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1022 | - this.setData({ | 1022 | + th.setData({ |
| 1023 | sto_sele_name: "" | 1023 | sto_sele_name: "" |
| 1024 | }); | 1024 | }); |
| 1025 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 1025 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -4265,7 +4265,7 @@ Page({ | @@ -4265,7 +4265,7 @@ Page({ | ||
| 4265 | if (th.data.is_show_sto_cat == 1) { | 4265 | if (th.data.is_show_sto_cat == 1) { |
| 4266 | item = th.data.def_pickpu_list[index]; | 4266 | item = th.data.def_pickpu_list[index]; |
| 4267 | } else { | 4267 | } else { |
| 4268 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 4268 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 4269 | } | 4269 | } |
| 4270 | 4270 | ||
| 4271 | } else { | 4271 | } else { |
| @@ -4273,6 +4273,8 @@ Page({ | @@ -4273,6 +4273,8 @@ Page({ | ||
| 4273 | item = th.data.sec_sto.s_arr[index]; | 4273 | item = th.data.sec_sto.s_arr[index]; |
| 4274 | } | 4274 | } |
| 4275 | 4275 | ||
| 4276 | + if(!item) return false; | ||
| 4277 | + | ||
| 4276 | if (!th.data.sele_g) return false; | 4278 | if (!th.data.sele_g) return false; |
| 4277 | //判断门店的配送方式是不是匹配 | 4279 | //判断门店的配送方式是不是匹配 |
| 4278 | var g_distr_type = th.data.sele_g.distr_type; | 4280 | var g_distr_type = th.data.sele_g.distr_type; |
| @@ -4346,13 +4348,15 @@ Page({ | @@ -4346,13 +4348,15 @@ Page({ | ||
| 4346 | if (th.data.is_show_sto_cat == 1) { | 4348 | if (th.data.is_show_sto_cat == 1) { |
| 4347 | item = th.data.def_pickpu_list[index]; | 4349 | item = th.data.def_pickpu_list[index]; |
| 4348 | } else { | 4350 | } else { |
| 4349 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 4351 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 4350 | } | 4352 | } |
| 4351 | } else { | 4353 | } else { |
| 4352 | var index = th.data.sec_pick_index; | 4354 | var index = th.data.sec_pick_index; |
| 4353 | item = th.data.sec_sto.s_arr[index]; | 4355 | item = th.data.sec_sto.s_arr[index]; |
| 4354 | } | 4356 | } |
| 4355 | 4357 | ||
| 4358 | + if(!item) return false; | ||
| 4359 | + | ||
| 4356 | //判断门店的配送方式是不是匹配 | 4360 | //判断门店的配送方式是不是匹配 |
| 4357 | var g_distr_type = th.data.sele_g.distr_type; | 4361 | var g_distr_type = th.data.sele_g.distr_type; |
| 4358 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { | 4362 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { |
packageC/pages/presell/list/list.wxml
| @@ -40,12 +40,14 @@ | @@ -40,12 +40,14 @@ | ||
| 40 | <view class="flex-vertical rel total" style="background-color: {{item.type == 0 ? '#059de5' : item.type == 1 ? '#ffe3e2' : ''}};"> | 40 | <view class="flex-vertical rel total" style="background-color: {{item.type == 0 ? '#059de5' : item.type == 1 ? '#ffe3e2' : ''}};"> |
| 41 | <view wx:if="{{item.type == 1}}" class="t-c abs xc-fill" style="background: #e4374d;width: calc({{filters.toFix(100-(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||100}} * 1%);"></view> | 41 | <view wx:if="{{item.type == 1}}" class="t-c abs xc-fill" style="background: #e4374d;width: calc({{filters.toFix(100-(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||100}} * 1%);"></view> |
| 42 | <text wx:if="{{item.type == 1}}" class="fs20 white abs xc-fill-text">剩余{{filters.toFix(100-(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||100}}%</text> | 42 | <text wx:if="{{item.type == 1}}" class="fs20 white abs xc-fill-text">剩余{{filters.toFix(100-(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||100}}%</text> |
| 43 | - <text wx:else class="fs20 white abs xc-fill-text">已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)||0}}%</text> | 43 | + <text wx:else class="fs20 white abs xc-fill-text">已预售0</text> |
| 44 | </view> | 44 | </view> |
| 45 | 45 | ||
| 46 | </view> | 46 | </view> |
| 47 | - <view class=" ml10 fs20">库存还剩{{item.presell_sumqty+item.virtual_qty}}件</view> | 47 | + <view wx:if="{{item.type == 1}}" class=" ml10 fs20">库存还剩{{item.presell_sumqty-item.buy_goodnum}}件</view> |
| 48 | + <view wx:else class=" ml10 fs20">库存还剩{{item.presell_sumqty+item.virtual_qty}}件</view> | ||
| 48 | </view> | 49 | </view> |
| 50 | + | ||
| 49 | 51 | ||
| 50 | <view class="goods-num"> | 52 | <view class="goods-num"> |
| 51 | <view> | 53 | <view> |
packageC/pages/presell/pregoodsInfo/goodsInfo.js
| @@ -1006,7 +1006,7 @@ Page({ | @@ -1006,7 +1006,7 @@ Page({ | ||
| 1006 | 1006 | ||
| 1007 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 1007 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); |
| 1008 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1008 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1009 | - this.setData({ | 1009 | + th.setData({ |
| 1010 | sto_sele_name: "" | 1010 | sto_sele_name: "" |
| 1011 | }); | 1011 | }); |
| 1012 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 1012 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -3423,7 +3423,7 @@ Page({ | @@ -3423,7 +3423,7 @@ Page({ | ||
| 3423 | if (th.data.is_show_sto_cat == 1) { | 3423 | if (th.data.is_show_sto_cat == 1) { |
| 3424 | item = th.data.def_pickpu_list[index]; | 3424 | item = th.data.def_pickpu_list[index]; |
| 3425 | } else { | 3425 | } else { |
| 3426 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 3426 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 3427 | } | 3427 | } |
| 3428 | 3428 | ||
| 3429 | } else { | 3429 | } else { |
| @@ -3431,6 +3431,8 @@ Page({ | @@ -3431,6 +3431,8 @@ Page({ | ||
| 3431 | item = th.data.sec_sto.s_arr[index]; | 3431 | item = th.data.sec_sto.s_arr[index]; |
| 3432 | } | 3432 | } |
| 3433 | 3433 | ||
| 3434 | + if(!item) return false; | ||
| 3435 | + | ||
| 3434 | if (!th.data.sele_g) return false; | 3436 | if (!th.data.sele_g) return false; |
| 3435 | //判断门店的配送方式是不是匹配 | 3437 | //判断门店的配送方式是不是匹配 |
| 3436 | var g_distr_type = th.data.sele_g.distr_type; | 3438 | var g_distr_type = th.data.sele_g.distr_type; |
| @@ -3504,13 +3506,15 @@ Page({ | @@ -3504,13 +3506,15 @@ Page({ | ||
| 3504 | if (th.data.is_show_sto_cat == 1) { | 3506 | if (th.data.is_show_sto_cat == 1) { |
| 3505 | item = th.data.def_pickpu_list[index]; | 3507 | item = th.data.def_pickpu_list[index]; |
| 3506 | } else { | 3508 | } else { |
| 3507 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 3509 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 3508 | } | 3510 | } |
| 3509 | } else { | 3511 | } else { |
| 3510 | var index = th.data.sec_pick_index; | 3512 | var index = th.data.sec_pick_index; |
| 3511 | item = th.data.sec_sto.s_arr[index]; | 3513 | item = th.data.sec_sto.s_arr[index]; |
| 3512 | } | 3514 | } |
| 3513 | 3515 | ||
| 3516 | + if(!item) return false; | ||
| 3517 | + | ||
| 3514 | //判断门店的配送方式是不是匹配 | 3518 | //判断门店的配送方式是不是匹配 |
| 3515 | var g_distr_type = th.data.sele_g.distr_type; | 3519 | var g_distr_type = th.data.sele_g.distr_type; |
| 3516 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { | 3520 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { |
pages/cart/cart/cart.js
| @@ -95,6 +95,7 @@ Page({ | @@ -95,6 +95,7 @@ Page({ | ||
| 95 | freight_free:e.freight_free, | 95 | freight_free:e.freight_free, |
| 96 | weight_free:e.weight_free, | 96 | weight_free:e.weight_free, |
| 97 | sales_rules:e.sales_rules, | 97 | sales_rules:e.sales_rules, |
| 98 | + appoint_pick_keyid:json_d.appoint_pick_keyid | ||
| 98 | }); | 99 | }); |
| 99 | getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=6",{}).then(res=>{ | 100 | getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=6",{}).then(res=>{ |
| 100 | //未购买 | 101 | //未购买 |
| @@ -2137,7 +2138,7 @@ Page({ | @@ -2137,7 +2138,7 @@ Page({ | ||
| 2137 | 2138 | ||
| 2138 | function normal_check(store_count, goodsinfo, wareIds) { | 2139 | function normal_check(store_count, goodsinfo, wareIds) { |
| 2139 | //--- 看一下是不是线下库存 --- | 2140 | //--- 看一下是不是线下库存 --- |
| 2140 | - if (th.data.sales_rules == 2 && !goodsinfo.whsle_id) { | 2141 | + if (th.data.sales_rules >= 2 && !goodsinfo.whsle_id) { |
| 2141 | th.check_down_line(t, pitem, item, wareIds); | 2142 | th.check_down_line(t, pitem, item, wareIds); |
| 2142 | } else { | 2143 | } else { |
| 2143 | if (t.goods_num > store_count) { | 2144 | if (t.goods_num > store_count) { |
| @@ -2717,6 +2718,17 @@ Page({ | @@ -2717,6 +2718,17 @@ Page({ | ||
| 2717 | var goodsinfo = this.data.requestData[pitem].goods[item]; | 2718 | var goodsinfo = this.data.requestData[pitem].goods[item]; |
| 2718 | var lock = 0, | 2719 | var lock = 0, |
| 2719 | pick_no, plist; | 2720 | pick_no, plist; |
| 2721 | + | ||
| 2722 | + var lock_rq={ | ||
| 2723 | + store_id: os.stoid, wareId: t.goods_id, | ||
| 2724 | + storageId: goodsinfo.pick_id, pageSize: 1000 | ||
| 2725 | + } | ||
| 2726 | + | ||
| 2727 | + if(this.data.sales_rules==3){ | ||
| 2728 | + lock_rq.appoint_pick_keyid=this.data.appoint_pick_keyid; | ||
| 2729 | + delete lock_rq.storageId | ||
| 2730 | + } | ||
| 2731 | + | ||
| 2720 | //先读取门店的lock | 2732 | //先读取门店的lock |
| 2721 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | 2733 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| 2722 | data: { | 2734 | data: { |
| @@ -2731,21 +2743,33 @@ Page({ | @@ -2731,21 +2743,33 @@ Page({ | ||
| 2731 | lock += res.data.data.pageData[i].outQty; | 2743 | lock += res.data.data.pageData[i].outQty; |
| 2732 | } | 2744 | } |
| 2733 | }) | 2745 | }) |
| 2734 | - //先获取门店的编号 | ||
| 2735 | - await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + goodsinfo.pick_id, { | ||
| 2736 | - data: { | ||
| 2737 | - storeId: os.stoid, | ||
| 2738 | - goodsId: t.goods_id, | ||
| 2739 | - pickupId: goodsinfo.pick_id | ||
| 2740 | - } | ||
| 2741 | - }).then(res => { | ||
| 2742 | - if (res.data.code == 0) { | ||
| 2743 | - pick_no = res.data.data.pickup_no; | ||
| 2744 | - } | ||
| 2745 | - }) | 2746 | + |
| 2747 | + | ||
| 2748 | + | ||
| 2749 | + if(this.data.sales_rules==2) { | ||
| 2750 | + //先获取门店的编号 | ||
| 2751 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + goodsinfo.pick_id, { | ||
| 2752 | + data: { | ||
| 2753 | + storeId: os.stoid, | ||
| 2754 | + goodsId: t.goods_id, | ||
| 2755 | + pickupId: goodsinfo.pick_id | ||
| 2756 | + } | ||
| 2757 | + }).then(res => { | ||
| 2758 | + if (res.data.code == 0) { | ||
| 2759 | + pick_no = res.data.data.pickup_no; | ||
| 2760 | + } | ||
| 2761 | + }) | ||
| 2762 | + } | ||
| 2763 | + | ||
| 2764 | + var sto_rq={storageNos:pick_no,wareIds:encodeURIComponent(erpwareid),storeId:os.stoid}; | ||
| 2765 | + | ||
| 2766 | + if(this.data.sales_rules==3){ | ||
| 2767 | + sto_rq.storageIds=this.data.appoint_pick_keyid; | ||
| 2768 | + delete sto_rq.storageNos | ||
| 2769 | + } | ||
| 2746 | //读取线下的门店库存 | 2770 | //读取线下的门店库存 |
| 2747 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | 2771 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ |
| 2748 | - data:{storageNos:pick_no,wareIds:encodeURIComponent(erpwareid),storeId:os.stoid} | 2772 | + data:sto_rq |
| 2749 | }).then(res=>{ | 2773 | }).then(res=>{ |
| 2750 | if(ut.ajax_ok(res)){ | 2774 | if(ut.ajax_ok(res)){ |
| 2751 | plist=res.data.data.pageData[0]; | 2775 | plist=res.data.data.pageData[0]; |
| @@ -2897,7 +2921,7 @@ Page({ | @@ -2897,7 +2921,7 @@ Page({ | ||
| 2897 | ab = 1; | 2921 | ab = 1; |
| 2898 | //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- | 2922 | //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- |
| 2899 | if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || | 2923 | if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || |
| 2900 | - i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { | 2924 | + i_arr[j].need_downlow_num) && th.data.sales_rules >= 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { |
| 2901 | //--获取商品的线下商品ID-- | 2925 | //--获取商品的线下商品ID-- |
| 2902 | var gd = null; | 2926 | var gd = null; |
| 2903 | await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { | 2927 | await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => { |
| @@ -3035,7 +3059,7 @@ Page({ | @@ -3035,7 +3059,7 @@ Page({ | ||
| 3035 | } | 3059 | } |
| 3036 | } | 3060 | } |
| 3037 | 3061 | ||
| 3038 | - if (th.data.sales_rules != 2) { | 3062 | + if (th.data.sales_rules == 1) { |
| 3039 | if (num > val.store_count) { | 3063 | if (num > val.store_count) { |
| 3040 | isok = 0; | 3064 | isok = 0; |
| 3041 | gname = val.goods_name; | 3065 | gname = val.goods_name; |
pages/cart/cart2/cart2.js
| @@ -219,7 +219,7 @@ Page({ | @@ -219,7 +219,7 @@ Page({ | ||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | 221 | ||
| 222 | - th.data.prom_goods_map = {}; | 222 | + //th.data.prom_goods_map = {}; |
| 223 | th.data.is_summit_ing = 0; | 223 | th.data.is_summit_ing = 0; |
| 224 | //更换地址回来要重新调用计算价钱的接口 | 224 | //更换地址回来要重新调用计算价钱的接口 |
| 225 | if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { | 225 | if (!th.data.user_addr || th.data.user_addr.address_id != ie.address_id) { |
| @@ -263,6 +263,7 @@ Page({ | @@ -263,6 +263,7 @@ Page({ | ||
| 263 | rank_switch: json_d.rank_switch, | 263 | rank_switch: json_d.rank_switch, |
| 264 | is_default_logistics: is_default_logistics, | 264 | is_default_logistics: is_default_logistics, |
| 265 | is_same_city: is_same_city, | 265 | is_same_city: is_same_city, |
| 266 | + appoint_pick_keyid:json_d.appoint_pick_keyid | ||
| 266 | }); | 267 | }); |
| 267 | 268 | ||
| 268 | var rank_switch = json_d.rank_switch; | 269 | var rank_switch = json_d.rank_switch; |
| @@ -395,8 +396,10 @@ Page({ | @@ -395,8 +396,10 @@ Page({ | ||
| 395 | //to.get_allsto(function (e) { | 396 | //to.get_allsto(function (e) { |
| 396 | //th.setData({ allsto: e }); | 397 | //th.setData({ allsto: e }); |
| 397 | //-------获取购物车已经选择的商品-------- | 398 | //-------获取购物车已经选择的商品-------- |
| 398 | - if(!th.data.old_cartlist) | 399 | + if(!th.data.old_cartlist){ |
| 400 | + th.data.prom_goods_map = {}; | ||
| 399 | th.get_cart(); | 401 | th.get_cart(); |
| 402 | + } | ||
| 400 | else{ | 403 | else{ |
| 401 | th.calculatePrice(); | 404 | th.calculatePrice(); |
| 402 | } | 405 | } |
| @@ -3028,6 +3031,39 @@ Page({ | @@ -3028,6 +3031,39 @@ Page({ | ||
| 3028 | }) | 3031 | }) |
| 3029 | }, | 3032 | }, |
| 3030 | 3033 | ||
| 3034 | + | ||
| 3035 | + //分配代发商品 | ||
| 3036 | + add_df_goods(good,df_goods,whsle_id,room_id){ | ||
| 3037 | + var df_price = parseFloat(good.goods_num * good.goods_price); | ||
| 3038 | + | ||
| 3039 | + var index=df_goods.findIndex(function (e){ | ||
| 3040 | + return e.whsle_id==whsle_id | ||
| 3041 | + }) | ||
| 3042 | + if(index>-1){ | ||
| 3043 | + df_goods[index].df_price+=df_price; | ||
| 3044 | + df_goods[index].df_goods.push(good); | ||
| 3045 | + | ||
| 3046 | + if(room_id){ | ||
| 3047 | + if(!df_goods[index].df_room_ids) | ||
| 3048 | + df_goods[index].df_room_ids=""; | ||
| 3049 | + df_goods[index].df_room_ids+=room_id+","; | ||
| 3050 | + | ||
| 3051 | + } | ||
| 3052 | + | ||
| 3053 | + }else{ | ||
| 3054 | + var e={ | ||
| 3055 | + whsle_id:whsle_id, | ||
| 3056 | + df_price:df_price, | ||
| 3057 | + df_goods:[] | ||
| 3058 | + } | ||
| 3059 | + if(room_id) e.df_room_ids=room_id+',' | ||
| 3060 | + | ||
| 3061 | + e.df_goods.push(good); | ||
| 3062 | + df_goods.push(e); | ||
| 3063 | + } | ||
| 3064 | + | ||
| 3065 | + }, | ||
| 3066 | + | ||
| 3031 | //--------------------提交订单----------------------- | 3067 | //--------------------提交订单----------------------- |
| 3032 | async submit_func() { | 3068 | async submit_func() { |
| 3033 | 3069 | ||
| @@ -3171,6 +3207,7 @@ Page({ | @@ -3171,6 +3207,7 @@ Page({ | ||
| 3171 | 3207 | ||
| 3172 | if(th.data.bn_goods.whsle_id){ | 3208 | if(th.data.bn_goods.whsle_id){ |
| 3173 | item.is_whsle=1; | 3209 | item.is_whsle=1; |
| 3210 | + item.whsle_id=th.data.bn_goods.whsle_id; | ||
| 3174 | goods.is_whsle_goods=1; | 3211 | goods.is_whsle_goods=1; |
| 3175 | } | 3212 | } |
| 3176 | 3213 | ||
| @@ -3207,10 +3244,8 @@ Page({ | @@ -3207,10 +3244,8 @@ Page({ | ||
| 3207 | } | 3244 | } |
| 3208 | 3245 | ||
| 3209 | 3246 | ||
| 3210 | - | ||
| 3211 | - | ||
| 3212 | //如果不立即购买或者秒杀,如果是线下库存购买的时候 | 3247 | //如果不立即购买或者秒杀,如果是线下库存购买的时候 |
| 3213 | - if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules == 2 && !th.data.bn_goods.whsle_id) { | 3248 | + if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id) { |
| 3214 | var isok = 1; | 3249 | var isok = 1; |
| 3215 | await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { | 3250 | await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { |
| 3216 | isok = res; | 3251 | isok = res; |
| @@ -3327,7 +3362,7 @@ Page({ | @@ -3327,7 +3362,7 @@ Page({ | ||
| 3327 | return false; | 3362 | return false; |
| 3328 | } | 3363 | } |
| 3329 | 3364 | ||
| 3330 | - var order_prom_list_cart = th.data.order_prom_list_cart;; | 3365 | + var order_prom_list_cart = th.data.order_prom_list_cart; |
| 3331 | 3366 | ||
| 3332 | //--组装推送数据-- | 3367 | //--组装推送数据-- |
| 3333 | for (var i = 0; i < order_prom_list_cart.length; i++) { | 3368 | for (var i = 0; i < order_prom_list_cart.length; i++) { |
| @@ -3464,6 +3499,9 @@ Page({ | @@ -3464,6 +3499,9 @@ Page({ | ||
| 3464 | var df_price = 0; | 3499 | var df_price = 0; |
| 3465 | var df_room_ids = ""; | 3500 | var df_room_ids = ""; |
| 3466 | 3501 | ||
| 3502 | + | ||
| 3503 | + var check_map={}; | ||
| 3504 | + | ||
| 3467 | //-------------让商品添加到商品列表-------------------- | 3505 | //-------------让商品添加到商品列表-------------------- |
| 3468 | for (var k = 0; k < t_item.goods.length; k++) { | 3506 | for (var k = 0; k < t_item.goods.length; k++) { |
| 3469 | 3507 | ||
| @@ -3528,8 +3566,17 @@ Page({ | @@ -3528,8 +3566,17 @@ Page({ | ||
| 3528 | goods.prom_id = 0; | 3566 | goods.prom_id = 0; |
| 3529 | } | 3567 | } |
| 3530 | 3568 | ||
| 3569 | + var txt=goods.prom_id+','+goods.prom_type+','+goods.goods_id+','+goods.is_gift; | ||
| 3570 | + //--赠品的时候,阶梯促销会右重复的情况 -- | ||
| 3571 | + if(check_map[txt] && goods.prom_type!=10){ | ||
| 3572 | + getApp().confirmBox(goods.goods_name + "计算金额错误,请重新刷新"); | ||
| 3573 | + return false; | ||
| 3574 | + }else{ | ||
| 3575 | + check_map[txt]=1; | ||
| 3576 | + } | ||
| 3577 | + | ||
| 3531 | //如果不立即购买或者秒杀,如果是线下库存购买的时候 | 3578 | //如果不立即购买或者秒杀,如果是线下库存购买的时候 |
| 3532 | - if (goods.prom_type == 0 && th.data.sales_rules == 2) { | 3579 | + if (goods.prom_type == 0 && th.data.sales_rules >= 2) { |
| 3533 | var isok = 1; | 3580 | var isok = 1; |
| 3534 | await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { | 3581 | await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { |
| 3535 | isok = res; | 3582 | isok = res; |
| @@ -3570,14 +3617,17 @@ Page({ | @@ -3570,14 +3617,17 @@ Page({ | ||
| 3570 | if (g_item.whsle_id && t_item.goods.length>1) { | 3617 | if (g_item.whsle_id && t_item.goods.length>1) { |
| 3571 | df_price += parseFloat(g_item.goods_num * g_item.goods_price); | 3618 | df_price += parseFloat(g_item.goods_num * g_item.goods_price); |
| 3572 | goods.is_whsle_goods = 1; | 3619 | goods.is_whsle_goods = 1; |
| 3573 | - df_goods.push(goods); | ||
| 3574 | - df_room_ids += g_item.room_id + ","; | 3620 | + th.add_df_goods(goods,df_goods,g_item.whsle_id, g_item.room_id); |
| 3621 | + | ||
| 3622 | + //df_goods.push(goods); | ||
| 3623 | + // df_room_ids += g_item.room_id + ","; | ||
| 3575 | } else { | 3624 | } else { |
| 3576 | 3625 | ||
| 3577 | //-- 如果只有一件的时候,商品又是代发商品,订单的状态要改成代发订单 -- | 3626 | //-- 如果只有一件的时候,商品又是代发商品,订单的状态要改成代发订单 -- |
| 3578 | if(g_item.whsle_id){ | 3627 | if(g_item.whsle_id){ |
| 3579 | goods.is_whsle_goods=1; | 3628 | goods.is_whsle_goods=1; |
| 3580 | item.is_whsle=1; | 3629 | item.is_whsle=1; |
| 3630 | + item.whsle_id=g_item.whsle_id | ||
| 3581 | } | 3631 | } |
| 3582 | 3632 | ||
| 3583 | item.order_goods.push(goods); | 3633 | item.order_goods.push(goods); |
| @@ -3590,58 +3640,75 @@ Page({ | @@ -3590,58 +3640,75 @@ Page({ | ||
| 3590 | } | 3640 | } |
| 3591 | 3641 | ||
| 3592 | 3642 | ||
| 3643 | + | ||
| 3644 | + | ||
| 3593 | //如果房间号不为空的时候 | 3645 | //如果房间号不为空的时候 |
| 3594 | if (room_ids != "") item.room_ids = ut.sub_last(room_ids); | 3646 | if (room_ids != "") item.room_ids = ut.sub_last(room_ids); |
| 3595 | 3647 | ||
| 3596 | //处理代发商品的拆分 | 3648 | //处理代发商品的拆分 |
| 3597 | - if(df_goods.length>0 && item.order_goods.length>0 ){ | ||
| 3598 | - var df_item=JSON.parse(JSON.stringify(item)); | 3649 | + if(df_goods.length>0){ |
| 3650 | + | ||
| 3651 | + | ||
| 3652 | + | ||
| 3599 | item.goods_price= parseFloat(item.goods_price-df_price).toFixed(2); | 3653 | item.goods_price= parseFloat(item.goods_price-df_price).toFixed(2); |
| 3600 | item.total_amount= parseFloat(item.total_amount-df_price).toFixed(2); | 3654 | item.total_amount= parseFloat(item.total_amount-df_price).toFixed(2); |
| 3601 | 3655 | ||
| 3602 | - df_item.is_whsle=1; | ||
| 3603 | - df_item.is_discount_amount=0; | ||
| 3604 | - df_item.goods_price=df_price; | ||
| 3605 | - df_item.total_amount=df_price; | ||
| 3606 | - df_item.shipping_price=0; //没有运费 | ||
| 3607 | - if(df_item.order_prom_list) df_item.order_prom_list={}; | ||
| 3608 | - if(df_item.coupon_price) delete(df_item.coupon_price); | ||
| 3609 | - if(df_item.coupon_no) delete(df_item.coupon_no); | ||
| 3610 | - | ||
| 3611 | - //看一下是用余额比较多,还是用钱比较多 | ||
| 3612 | - if(item.order_amount>item.user_money){ | ||
| 3613 | - if(item.order_amount>df_price){ | ||
| 3614 | - item.order_amount=parseFloat(item.order_amount-df_price).toFixed(2); | ||
| 3615 | - df_item.order_amount=df_price.toFixed(2); | 3656 | + for (let j = 0; j < df_goods.length; j++) { |
| 3657 | + | ||
| 3658 | + var df_item=JSON.parse(JSON.stringify(item)); | ||
| 3659 | + | ||
| 3660 | + var ddff_item=df_goods[j]; | ||
| 3661 | + | ||
| 3662 | + df_item.is_whsle=1; | ||
| 3663 | + df_item.whsle_id=ddff_item.whsle_id; | ||
| 3664 | + df_item.is_discount_amount=0; | ||
| 3665 | + df_item.goods_price=ddff_item.df_price; | ||
| 3666 | + df_item.total_amount=ddff_item.df_price; | ||
| 3667 | + df_item.shipping_price=0; //没有运费 | ||
| 3668 | + if(df_item.order_prom_list) df_item.order_prom_list={}; | ||
| 3669 | + if(df_item.coupon_price) delete(df_item.coupon_price); | ||
| 3670 | + if(df_item.coupon_no) delete(df_item.coupon_no); | ||
| 3671 | + | ||
| 3672 | + //看一下是用余额比较多,还是用钱比较多 | ||
| 3673 | + if(item.order_amount>item.user_money){ | ||
| 3674 | + if(item.order_amount>ddff_item.df_price){ | ||
| 3675 | + item.order_amount=parseFloat(item.order_amount-ddff_item.df_price).toFixed(2); | ||
| 3676 | + df_item.order_amount=ddff_item.df_price.toFixed(2); | ||
| 3616 | }else { | 3677 | }else { |
| 3617 | - var more_p=parseFloat(df_price-item.order_amount).toFixed(2); | 3678 | + var more_p=parseFloat(ddff_item.df_price-item.order_amount).toFixed(2); |
| 3618 | item.order_amount=0; | 3679 | item.order_amount=0; |
| 3619 | item.user_money=parseFloat(item.user_money-more_p).toFixed(2); | 3680 | item.user_money=parseFloat(item.user_money-more_p).toFixed(2); |
| 3620 | df_item.user_money=more_p; | 3681 | df_item.user_money=more_p; |
| 3621 | } | 3682 | } |
| 3622 | - }else{ | ||
| 3623 | - if(item.user_money>df_price){ | ||
| 3624 | - item.user_money=parseFloat(item.user_money-df_price).toFixed(2); | ||
| 3625 | - df_item.user_money=df_price.toFixed(2); | ||
| 3626 | - }else { | ||
| 3627 | - var more_p=parseFloat(df_price-item.user_money).toFixed(2); | ||
| 3628 | - item.user_money=0; | ||
| 3629 | - item.order_amount=parseFloat(item.user_money-more_p).toFixed(2); | ||
| 3630 | - df_item.order_amount=more_p; | 3683 | + }else{ |
| 3631 | 3684 | ||
| 3685 | + if(item.user_money>ddff_item.df_price){ | ||
| 3686 | + item.user_money=parseFloat(item.user_money-ddff_item.df_price).toFixed(2); | ||
| 3687 | + df_item.user_money=ddff_item.df_price.toFixed(2); | ||
| 3688 | + }else { | ||
| 3689 | + var more_p=parseFloat(ddff_item.df_price-item.user_money).toFixed(2); | ||
| 3690 | + item.user_money=0; | ||
| 3691 | + item.order_amount=parseFloat(item.user_money-more_p).toFixed(2); | ||
| 3692 | + df_item.order_amount=more_p; | ||
| 3693 | + | ||
| 3694 | + } | ||
| 3632 | } | 3695 | } |
| 3696 | + | ||
| 3697 | + if (ddff_item.df_room_ids) | ||
| 3698 | + df_item.room_ids = ut.sub_last(ddff_item.df_room_ids); | ||
| 3699 | + df_item.order_goods=ddff_item.df_goods; | ||
| 3700 | + pdata.push(df_item); | ||
| 3633 | } | 3701 | } |
| 3634 | 3702 | ||
| 3635 | - if (df_room_ids != "") df_item.room_ids = ut.sub_last(df_room_ids); | ||
| 3636 | - df_item.order_goods=df_goods; | ||
| 3637 | - pdata.push(df_item); | 3703 | + |
| 3638 | } | 3704 | } |
| 3639 | //如果只有代发商品的时候 | 3705 | //如果只有代发商品的时候 |
| 3640 | - if(df_goods.length>0 && item.order_goods.length<=0){ | ||
| 3641 | - item.order_goods=df_goods; | ||
| 3642 | - item.is_whsle=1; | 3706 | + if(item.order_goods.length>0){ |
| 3707 | + //item.order_goods=df_goods; | ||
| 3708 | + //item.is_whsle=1; | ||
| 3709 | + pdata.push(item); | ||
| 3643 | } | 3710 | } |
| 3644 | - pdata.push(item); | 3711 | + |
| 3645 | } | 3712 | } |
| 3646 | 3713 | ||
| 3647 | } | 3714 | } |
| @@ -3692,6 +3759,9 @@ Page({ | @@ -3692,6 +3759,9 @@ Page({ | ||
| 3692 | //},1000) | 3759 | //},1000) |
| 3693 | 3760 | ||
| 3694 | }, function () { | 3761 | }, function () { |
| 3762 | + | ||
| 3763 | + | ||
| 3764 | + return false; | ||
| 3695 | //支付失败 | 3765 | //支付失败 |
| 3696 | setTimeout(function () { | 3766 | setTimeout(function () { |
| 3697 | var cps = getCurrentPages(); | 3767 | var cps = getCurrentPages(); |
| @@ -3788,23 +3858,33 @@ Page({ | @@ -3788,23 +3858,33 @@ Page({ | ||
| 3788 | //---确认线下门店的数量足不足--- | 3858 | //---确认线下门店的数量足不足--- |
| 3789 | async check_store_num(goods_id, pick, goods_num, func) { | 3859 | async check_store_num(goods_id, pick, goods_num, func) { |
| 3790 | var lock = 0, pick_no, plist, erpwareid; | 3860 | var lock = 0, pick_no, plist, erpwareid; |
| 3861 | + | ||
| 3862 | + var lock_rq={ store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 }; | ||
| 3863 | + if(this.data.sales_rules==3){ | ||
| 3864 | + lock_rq.appoint_pick_keyid=this.data.appoint_pick_keyid; | ||
| 3865 | + delete lock_rq.storageId | ||
| 3866 | + } | ||
| 3791 | //先读取门店的lock | 3867 | //先读取门店的lock |
| 3792 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | 3868 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| 3793 | - data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 } | 3869 | + data: lock_rq |
| 3794 | }).then(res => { | 3870 | }).then(res => { |
| 3795 | if (res.data.code == 0 && res.data.data.total > 0) { | 3871 | if (res.data.code == 0 && res.data.data.total > 0) { |
| 3796 | for (var i in res.data.data.pageData) | 3872 | for (var i in res.data.data.pageData) |
| 3797 | lock += res.data.data.pageData[i].outQty; | 3873 | lock += res.data.data.pageData[i].outQty; |
| 3798 | } | 3874 | } |
| 3799 | }) | 3875 | }) |
| 3800 | - //先获取门店的编号 | ||
| 3801 | - await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { | ||
| 3802 | - data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | ||
| 3803 | - }).then(res => { | ||
| 3804 | - if (res.data.code == 0) { | ||
| 3805 | - pick_no = res.data.data.pickup_no; | ||
| 3806 | - } | ||
| 3807 | - }) | 3876 | + |
| 3877 | + if(this.data.sales_rules==2) { | ||
| 3878 | + //先获取门店的编号 | ||
| 3879 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, { | ||
| 3880 | + data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick} | ||
| 3881 | + }).then(res => { | ||
| 3882 | + if (res.data.code == 0) { | ||
| 3883 | + pick_no = res.data.data.pickup_no; | ||
| 3884 | + } | ||
| 3885 | + }) | ||
| 3886 | + } | ||
| 3887 | + | ||
| 3808 | //先获取商品的线下库存 | 3888 | //先获取商品的线下库存 |
| 3809 | await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { | 3889 | await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { |
| 3810 | data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } | 3890 | data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } |
| @@ -3813,14 +3893,23 @@ Page({ | @@ -3813,14 +3893,23 @@ Page({ | ||
| 3813 | erpwareid = res.data.data.erpwareid; | 3893 | erpwareid = res.data.data.erpwareid; |
| 3814 | } | 3894 | } |
| 3815 | }) | 3895 | }) |
| 3896 | + | ||
| 3897 | + | ||
| 3898 | + var sto_rq={ storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 }; | ||
| 3899 | + if(this.data.sales_rules==3){ | ||
| 3900 | + sto_rq.storageIds=this.data.appoint_pick_keyid; | ||
| 3901 | + delete sto_rq.storageNos | ||
| 3902 | + } | ||
| 3903 | + | ||
| 3816 | //读取线下的门店库存 | 3904 | //读取线下的门店库存 |
| 3817 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | 3905 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { |
| 3818 | - data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 } | 3906 | + data: sto_rq |
| 3819 | }).then(res => { | 3907 | }).then(res => { |
| 3820 | if (res.data.code == 0) { | 3908 | if (res.data.code == 0) { |
| 3821 | plist = res.data.data.pageData[0]; | 3909 | plist = res.data.data.pageData[0]; |
| 3822 | } | 3910 | } |
| 3823 | }) | 3911 | }) |
| 3912 | + | ||
| 3824 | var isok = 1; | 3913 | var isok = 1; |
| 3825 | if (goods_num > plist.CanOutQty - lock) { | 3914 | if (goods_num > plist.CanOutQty - lock) { |
| 3826 | isok = 0; | 3915 | isok = 0; |
| @@ -4562,8 +4651,11 @@ Page({ | @@ -4562,8 +4651,11 @@ Page({ | ||
| 4562 | 4651 | ||
| 4563 | //如果有限制使用优惠券,就要返回 | 4652 | //如果有限制使用优惠券,就要返回 |
| 4564 | if (gd.prom_type == 3) { | 4653 | if (gd.prom_type == 3) { |
| 4565 | - if (th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue; | ||
| 4566 | - th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele = 1; | 4654 | + |
| 4655 | + if(th.data.prom_goods_map && th.data.prom_goods_map[pickup_id] && th.data.prom_goods_map[pickup_id][gd.prom_id] ) { | ||
| 4656 | + if (th.data.prom_goods_map[pickup_id][gd.prom_id].is_xz_yh) continue; | ||
| 4657 | + th.data.prom_goods_map[pickup_id][gd.prom_id].coupon_sele = 1; | ||
| 4658 | + } | ||
| 4567 | } | 4659 | } |
| 4568 | var item_price = gd.goods_price * gd.goods_num; | 4660 | var item_price = gd.goods_price * gd.goods_num; |
| 4569 | var item_price2 = item_price; | 4661 | var item_price2 = item_price; |
| @@ -4865,7 +4957,16 @@ Page({ | @@ -4865,7 +4957,16 @@ Page({ | ||
| 4865 | 4957 | ||
| 4866 | if (map[pickid]) { | 4958 | if (map[pickid]) { |
| 4867 | if (map[pickid][item.prom_id]) { | 4959 | if (map[pickid][item.prom_id]) { |
| 4960 | + | ||
| 4868 | var ob = map[pickid][item.prom_id]; | 4961 | var ob = map[pickid][item.prom_id]; |
| 4962 | + //-- 避免同一件商品重复添加 -- | ||
| 4963 | + if(ob.goods && ob.goods.length){ | ||
| 4964 | + var fid=ob.goods.findIndex(function (e){ | ||
| 4965 | + e.goods_id==item.goods_id | ||
| 4966 | + }) | ||
| 4967 | + if(fid>-1) return false; | ||
| 4968 | + } | ||
| 4969 | + | ||
| 4869 | ob.price += item.goods_price * item.goods_num; | 4970 | ob.price += item.goods_price * item.goods_num; |
| 4870 | ob.goods_num += item.goods_num; | 4971 | ob.goods_num += item.goods_num; |
| 4871 | ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); | 4972 | ob.goods.push({ goods_id: item.goods_id, goods_price: item.goods_price, goods_num: item.goods_num }); |
pages/giftpack/buygiftpack/giftpackbuy.js
| @@ -537,7 +537,7 @@ Page({ | @@ -537,7 +537,7 @@ Page({ | ||
| 537 | if (th.data.is_show_sto_cat == 1) { | 537 | if (th.data.is_show_sto_cat == 1) { |
| 538 | item = th.data.def_pickpu_list[index]; | 538 | item = th.data.def_pickpu_list[index]; |
| 539 | } else { | 539 | } else { |
| 540 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 540 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | } else { | 543 | } else { |
| @@ -545,6 +545,8 @@ Page({ | @@ -545,6 +545,8 @@ Page({ | ||
| 545 | item = th.data.sec_sto.s_arr[index]; | 545 | item = th.data.sec_sto.s_arr[index]; |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | + if(!item) return false; | ||
| 549 | + | ||
| 548 | if (!th.data.sele_g) return false; | 550 | if (!th.data.sele_g) return false; |
| 549 | 551 | ||
| 550 | th.setData({ | 552 | th.setData({ |
| @@ -579,13 +581,15 @@ Page({ | @@ -579,13 +581,15 @@ Page({ | ||
| 579 | if (th.data.is_show_sto_cat == 1) { | 581 | if (th.data.is_show_sto_cat == 1) { |
| 580 | item = th.data.def_pickpu_list[index]; | 582 | item = th.data.def_pickpu_list[index]; |
| 581 | } else { | 583 | } else { |
| 582 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 584 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 583 | } | 585 | } |
| 584 | } else { | 586 | } else { |
| 585 | var index = th.data.sec_pick_index; | 587 | var index = th.data.sec_pick_index; |
| 586 | item = th.data.sec_sto.s_arr[index]; | 588 | item = th.data.sec_sto.s_arr[index]; |
| 587 | } | 589 | } |
| 588 | 590 | ||
| 591 | + if(!item) return false; | ||
| 592 | + | ||
| 589 | th.setData({ | 593 | th.setData({ |
| 590 | def_pick_store: item, | 594 | def_pick_store: item, |
| 591 | sto_sele_name: item.pickup_name, | 595 | sto_sele_name: item.pickup_name, |
pages/giftpack/buygiftpack/giftpackbuy.wxss
| @@ -116,7 +116,7 @@ page { | @@ -116,7 +116,7 @@ page { | ||
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | .content_ware_price { | 118 | .content_ware_price { |
| 119 | - font-size: 20rpx; | 119 | + font-size: 30rpx; |
| 120 | color: #b9b5b5; | 120 | color: #b9b5b5; |
| 121 | margin-top: 2rpx; | 121 | margin-top: 2rpx; |
| 122 | text-decoration: line-through; | 122 | text-decoration: line-through; |
pages/giftpack/giftpacklist/giftpacklist.js
| @@ -819,7 +819,7 @@ Page({ | @@ -819,7 +819,7 @@ Page({ | ||
| 819 | if (th.data.is_show_sto_cat == 1) { | 819 | if (th.data.is_show_sto_cat == 1) { |
| 820 | item = th.data.def_pickpu_list[index]; | 820 | item = th.data.def_pickpu_list[index]; |
| 821 | } else { | 821 | } else { |
| 822 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 822 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 823 | } | 823 | } |
| 824 | 824 | ||
| 825 | } else { | 825 | } else { |
| @@ -827,6 +827,8 @@ Page({ | @@ -827,6 +827,8 @@ Page({ | ||
| 827 | item = th.data.sec_sto.s_arr[index]; | 827 | item = th.data.sec_sto.s_arr[index]; |
| 828 | } | 828 | } |
| 829 | 829 | ||
| 830 | + if(!item) return false; | ||
| 831 | + | ||
| 830 | if (!th.data.sele_g) return false; | 832 | if (!th.data.sele_g) return false; |
| 831 | 833 | ||
| 832 | th.setData({ | 834 | th.setData({ |
| @@ -861,12 +863,15 @@ Page({ | @@ -861,12 +863,15 @@ Page({ | ||
| 861 | if (th.data.is_show_sto_cat == 1) { | 863 | if (th.data.is_show_sto_cat == 1) { |
| 862 | item = th.data.def_pickpu_list[index]; | 864 | item = th.data.def_pickpu_list[index]; |
| 863 | } else { | 865 | } else { |
| 864 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 866 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 865 | } | 867 | } |
| 866 | } else { | 868 | } else { |
| 867 | var index = th.data.sec_pick_index; | 869 | var index = th.data.sec_pick_index; |
| 868 | item = th.data.sec_sto.s_arr[index]; | 870 | item = th.data.sec_sto.s_arr[index]; |
| 869 | } | 871 | } |
| 872 | + | ||
| 873 | + if(!item) return false; | ||
| 874 | + | ||
| 870 | th.setData({ | 875 | th.setData({ |
| 871 | def_pick_store: item, | 876 | def_pick_store: item, |
| 872 | sto_sele_name: item.pickup_name, | 877 | sto_sele_name: item.pickup_name, |
pages/giftpack/mygiftpack/mygiftpack.wxss
| @@ -153,7 +153,7 @@ | @@ -153,7 +153,7 @@ | ||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | .content_ware_price { | 155 | .content_ware_price { |
| 156 | - font-size: 20rpx; | 156 | + font-size: 30rpx; |
| 157 | color: #b9b5b5; | 157 | color: #b9b5b5; |
| 158 | margin-top: 2rpx; | 158 | margin-top: 2rpx; |
| 159 | text-decoration: line-through; | 159 | text-decoration: line-through; |
pages/goods/categoryList/categoryList.js
| @@ -112,7 +112,13 @@ Page({ | @@ -112,7 +112,13 @@ Page({ | ||
| 112 | getApp().globalData.first_leader = first_leader; | 112 | getApp().globalData.first_leader = first_leader; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | - if (tt.type) this.data.type = parseInt(tt.type); | 115 | + //if (tt.type) this.data.type = parseInt(tt.type); |
| 116 | + //switchTab无法传参数 | ||
| 117 | + if(getApp().globalData.cat_type){ | ||
| 118 | + this.data.type = parseInt(getApp().globalData.cat_type); | ||
| 119 | + getApp().globalData.cat_type=0; | ||
| 120 | + } | ||
| 121 | + | ||
| 116 | that.get_brand(); | 122 | that.get_brand(); |
| 117 | 123 | ||
| 118 | clearInterval(that.data.timer); | 124 | clearInterval(that.data.timer); |
| @@ -1192,12 +1198,15 @@ Page({ | @@ -1192,12 +1198,15 @@ Page({ | ||
| 1192 | getPlusCardType: function (func) { | 1198 | getPlusCardType: function (func) { |
| 1193 | var storid = oo.stoid; | 1199 | var storid = oo.stoid; |
| 1194 | var th = this; | 1200 | var th = this; |
| 1201 | + var user = getApp().globalData.userInfo; | ||
| 1202 | + if(!user) return false; | ||
| 1203 | + | ||
| 1195 | getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { | 1204 | getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { |
| 1196 | var plusCard = res.data.data; | 1205 | var plusCard = res.data.data; |
| 1197 | var arr = [1219, 2089, 3031]; | 1206 | var arr = [1219, 2089, 3031]; |
| 1198 | var new_arr = new Array(); | 1207 | var new_arr = new Array(); |
| 1199 | var card_name_map = new Map(); | 1208 | var card_name_map = new Map(); |
| 1200 | - var user = getApp().globalData.userInfo; | 1209 | + |
| 1201 | for (var i = 0; i < plusCard.length; i++) { | 1210 | for (var i = 0; i < plusCard.length; i++) { |
| 1202 | if ((user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { | 1211 | if ((user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) { |
| 1203 | continue; | 1212 | continue; |
pages/goods/goodsInfo/buy_com_pop.wxml
| @@ -47,12 +47,13 @@ | @@ -47,12 +47,13 @@ | ||
| 47 | bindtap="choice_store">更多门店<text class="right-arrow"></text> | 47 | bindtap="choice_store">更多门店<text class="right-arrow"></text> |
| 48 | </view> | 48 | </view> |
| 49 | </view> | 49 | </view> |
| 50 | + | ||
| 50 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | 51 | <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> |
| 51 | <block wx:else> | 52 | <block wx:else> |
| 52 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | 53 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
| 53 | <block wx:else> | 54 | <block wx:else> |
| 54 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | 55 | <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> |
| 55 | - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | 56 | + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2}}"> |
| 56 | (库存不足) | 57 | (库存不足) |
| 57 | </view> | 58 | </view> |
| 58 | </block> | 59 | </block> |
pages/goods/goodsInfo/goodsInfo.js
| @@ -427,7 +427,9 @@ Page({ | @@ -427,7 +427,9 @@ Page({ | ||
| 427 | sys_switch: json_d, | 427 | sys_switch: json_d, |
| 428 | is_closecoupon: json_d.is_closecoupon, | 428 | is_closecoupon: json_d.is_closecoupon, |
| 429 | is_newsales_rules: json_d.is_newsales_rules, | 429 | is_newsales_rules: json_d.is_newsales_rules, |
| 430 | - is_retail_price: json_d.is_retail_price || 0 | 430 | + is_retail_price: json_d.is_retail_price || 0, |
| 431 | + appoint_pick_keyid:json_d.appoint_pick_keyid | ||
| 432 | + | ||
| 431 | }); | 433 | }); |
| 432 | ee.init(gid); | 434 | ee.init(gid); |
| 433 | //------几人评价------- | 435 | //------几人评价------- |
| @@ -471,9 +473,6 @@ Page({ | @@ -471,9 +473,6 @@ Page({ | ||
| 471 | ee.is_no_dis = 1; | 473 | ee.is_no_dis = 1; |
| 472 | } | 474 | } |
| 473 | 475 | ||
| 474 | - | ||
| 475 | - | ||
| 476 | - | ||
| 477 | var appd = getApp().globalData; | 476 | var appd = getApp().globalData; |
| 478 | var w_time = setInterval(function () { | 477 | var w_time = setInterval(function () { |
| 479 | if (that.data.is_get_local_ok == 0) return false; | 478 | if (that.data.is_get_local_ok == 0) return false; |
| @@ -538,55 +537,69 @@ Page({ | @@ -538,55 +537,69 @@ Page({ | ||
| 538 | var that = this, th = this; | 537 | var that = this, th = this; |
| 539 | getApp().getConfig2(function (e) { | 538 | getApp().getConfig2(function (e) { |
| 540 | var sales_rules = e.sales_rules; | 539 | var sales_rules = e.sales_rules; |
| 541 | - if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 && !th.data.sele_g.whsle_id ) { | 540 | + if (sales_rules >=2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 && !th.data.sele_g.whsle_id ) { |
| 542 | getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { | 541 | getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { |
| 543 | var lock = 0, plist = null; | 542 | var lock = 0, plist = null; |
| 544 | var gd = that.data.fir_goods; | 543 | var gd = that.data.fir_goods; |
| 545 | //先读取门店的lock,采用链式写法,少用await | 544 | //先读取门店的lock,采用链式写法,少用await |
| 546 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
| 547 | - data: { | ||
| 548 | - store_id: os.stoid, | ||
| 549 | - wareId: that.data.fir_goods.goods_id, | ||
| 550 | - storageId: ee.pickup_id, | ||
| 551 | - pageSize: 1000 | ||
| 552 | - } | ||
| 553 | - }).then(res => { | ||
| 554 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 555 | - for (var i in res.data.data.pageData) | ||
| 556 | - lock += res.data.data.pageData[i].outQty | ||
| 557 | - } | ||
| 558 | - //---通过接口获取门店的线下库存信息-- | ||
| 559 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
| 560 | - data: { | ||
| 561 | - storageNos: ee.pickup_no, | ||
| 562 | - wareIds: encodeURIComponent(th.data.data.erpwareid), | ||
| 563 | - storeId: os.stoid | ||
| 564 | - } | ||
| 565 | - }) | ||
| 566 | - }).then(res => { | ||
| 567 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 568 | - plist = res.data.data.pageData[0]; | ||
| 569 | - } else { | ||
| 570 | - wx.showToast({ | ||
| 571 | - title: '库存不足,请更换其他门店', | ||
| 572 | - icon: 'none', | ||
| 573 | - }); | ||
| 574 | - } | ||
| 575 | - | ||
| 576 | - if (plist && plist.CanOutQty - lock > 0) { | ||
| 577 | - ee.CanOutQty = plist.CanOutQty - lock; | ||
| 578 | - } else { | ||
| 579 | - ee.CanOutQty = 0; | ||
| 580 | - } | ||
| 581 | - //--给门店赋值线下库存-- | ||
| 582 | - that.data.fir_def_store = ee; | ||
| 583 | - that.setData({ | ||
| 584 | - def_pick_store: ee, | ||
| 585 | - sto_sele_name: ee.pickup_name, | ||
| 586 | - sto_sele_id: ee.pickup_id, | ||
| 587 | - sto_sele_distr: ee.distr_type | ||
| 588 | - }) | 545 | + // getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| 546 | + // data: { | ||
| 547 | + // store_id: os.stoid, | ||
| 548 | + // wareId: that.data.fir_goods.goods_id, | ||
| 549 | + // storageId: ee.pickup_id, | ||
| 550 | + // pageSize: 1000 | ||
| 551 | + // } | ||
| 552 | + // }).then(res => { | ||
| 553 | + // if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 554 | + // for (var i in res.data.data.pageData) | ||
| 555 | + // lock += res.data.data.pageData[i].outQty | ||
| 556 | + // } | ||
| 557 | + // //---通过接口获取门店的线下库存信息-- | ||
| 558 | + // return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
| 559 | + // data: { | ||
| 560 | + // storageNos: ee.pickup_no, | ||
| 561 | + // wareIds: encodeURIComponent(th.data.data.erpwareid), | ||
| 562 | + // storeId: os.stoid | ||
| 563 | + // } | ||
| 564 | + // }) | ||
| 565 | + // }).then(res => { | ||
| 566 | + // if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 567 | + // plist = res.data.data.pageData[0]; | ||
| 568 | + // } else { | ||
| 569 | + // wx.showToast({ | ||
| 570 | + // title: '库存不足,请更换其他门店', | ||
| 571 | + // icon: 'none', | ||
| 572 | + // }); | ||
| 573 | + // } | ||
| 574 | + // | ||
| 575 | + // if (plist && plist.CanOutQty - lock > 0) { | ||
| 576 | + // ee.CanOutQty = plist.CanOutQty - lock; | ||
| 577 | + // } else { | ||
| 578 | + // ee.CanOutQty = 0; | ||
| 579 | + // } | ||
| 580 | + // //--给门店赋值线下库存-- | ||
| 581 | + // that.data.fir_def_store = ee; | ||
| 582 | + // that.setData({ | ||
| 583 | + // def_pick_store: ee, | ||
| 584 | + // sto_sele_name: ee.pickup_name, | ||
| 585 | + // sto_sele_id: ee.pickup_id, | ||
| 586 | + // sto_sele_distr: ee.distr_type | ||
| 587 | + // }) | ||
| 588 | + // }) | ||
| 589 | + //最新的获取线下门店库存 | ||
| 590 | + th.check_CanOutQty(gd,ee,function (CanOutQty){ | ||
| 591 | + ee.CanOutQty = CanOutQty; | ||
| 592 | + //--给门店赋值线下库存-- | ||
| 593 | + that.data.fir_def_store = ee; | ||
| 594 | + that.setData({ | ||
| 595 | + def_pick_store: ee, | ||
| 596 | + sto_sele_name: ee.pickup_name, | ||
| 597 | + sto_sele_id: ee.pickup_id, | ||
| 598 | + sto_sele_distr: ee.distr_type | ||
| 599 | + }) | ||
| 589 | }) | 600 | }) |
| 601 | + | ||
| 602 | + | ||
| 590 | }) | 603 | }) |
| 591 | } else { | 604 | } else { |
| 592 | that.data.fir_def_store = ee; | 605 | that.data.fir_def_store = ee; |
| @@ -850,7 +863,13 @@ Page({ | @@ -850,7 +863,13 @@ Page({ | ||
| 850 | title: '商品已经到期下架', | 863 | title: '商品已经到期下架', |
| 851 | showCancel: !1, | 864 | showCancel: !1, |
| 852 | complete: function () { | 865 | complete: function () { |
| 853 | - wx.navigateBack(); | 866 | + |
| 867 | + let pages = getCurrentPages(); | ||
| 868 | + if(pages[pages.length - 2]){ | ||
| 869 | + wx.navigateBack(); | ||
| 870 | + }else{ | ||
| 871 | + getApp().goto('/pages/index/index/index') | ||
| 872 | + } | ||
| 854 | } | 873 | } |
| 855 | }); | 874 | }); |
| 856 | } | 875 | } |
| @@ -1248,7 +1267,7 @@ Page({ | @@ -1248,7 +1267,7 @@ Page({ | ||
| 1248 | 1267 | ||
| 1249 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 1268 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); |
| 1250 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1269 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1251 | - this.setData({ | 1270 | + th.setData({ |
| 1252 | sto_sele_name: "" | 1271 | sto_sele_name: "" |
| 1253 | }); | 1272 | }); |
| 1254 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 1273 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -1374,7 +1393,7 @@ Page({ | @@ -1374,7 +1393,7 @@ Page({ | ||
| 1374 | 1393 | ||
| 1375 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | 1394 | if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); |
| 1376 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 1395 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 1377 | - this.setData({ | 1396 | + th.setData({ |
| 1378 | sto_sele_name: "" | 1397 | sto_sele_name: "" |
| 1379 | }); | 1398 | }); |
| 1380 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 1399 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -1448,69 +1467,87 @@ Page({ | @@ -1448,69 +1467,87 @@ Page({ | ||
| 1448 | newd.is_pd_normal=1; | 1467 | newd.is_pd_normal=1; |
| 1449 | 1468 | ||
| 1450 | //---如果是线下门店销售的时候--- | 1469 | //---如果是线下门店销售的时候--- |
| 1451 | - if (th.data.sales_rules == 2) { | 1470 | + if (th.data.sales_rules>= 2) { |
| 1452 | var pick = th.get_pick_from_list(th.data.sto_sele_id) | 1471 | var pick = th.get_pick_from_list(th.data.sto_sele_id) |
| 1453 | //---通过接口获取门店的线下库存信息-- | 1472 | //---通过接口获取门店的线下库存信息-- |
| 1454 | - getApp().request.get("/api/weshop/goods/getWareStorages", { | ||
| 1455 | - data: { | ||
| 1456 | - storageNos: pick.pickup_no, | ||
| 1457 | - wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 1458 | - storeId: os.stoid | ||
| 1459 | - }, | ||
| 1460 | - success: function (res) { | ||
| 1461 | - if (res.data.code == 0) { | ||
| 1462 | - if (res.data.data.pageData.length > 0) { | ||
| 1463 | - var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
| 1464 | - if (CanOutQty < e.data.goodsInputNum) { | ||
| 1465 | - wx.showToast({ | ||
| 1466 | - title: '库存不足!', | ||
| 1467 | - icon: 'none', | ||
| 1468 | - }); | ||
| 1469 | - return false; | ||
| 1470 | - // return s.my_warnning("库存不足!", 0, th); | ||
| 1471 | - } | ||
| 1472 | - //在调一次接口,读取商品的预出库的数量,lock | ||
| 1473 | - getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
| 1474 | - data: { | ||
| 1475 | - store_id: os.stoid, | ||
| 1476 | - wareId: th.data.sele_g.goods_id, | ||
| 1477 | - storageId: pick.pickup_id, | ||
| 1478 | - pageSize: 1000 | ||
| 1479 | - }, | ||
| 1480 | - success: function (res_data) { | ||
| 1481 | - if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
| 1482 | - | ||
| 1483 | - var lock = 0; | ||
| 1484 | - for (var i in res_data.data.data.pageData) { | ||
| 1485 | - lock += res_data.data.data.pageData[i].outQty; | ||
| 1486 | - } | ||
| 1487 | - | ||
| 1488 | - if (CanOutQty <= lock) { | ||
| 1489 | - wx.showToast({ | ||
| 1490 | - title: '库存不足!', | ||
| 1491 | - icon: 'none', | ||
| 1492 | - }); | ||
| 1493 | - return false; | ||
| 1494 | - //return s.my_warnning("库存不足!", 0, th); | ||
| 1495 | - } | ||
| 1496 | - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
| 1497 | - } else { | ||
| 1498 | - th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1499 | - } | ||
| 1500 | - } | ||
| 1501 | - }) | ||
| 1502 | - } else { | ||
| 1503 | - wx.showToast({ | ||
| 1504 | - title: '库存不足!', | ||
| 1505 | - icon: 'none', | ||
| 1506 | - }); | ||
| 1507 | - return false; | ||
| 1508 | - // return s.my_warnning("库存不足!", 0, th); | ||
| 1509 | - } | ||
| 1510 | - | 1473 | + // getApp().request.get("/api/weshop/goods/getWareStorages", { |
| 1474 | + // data: { | ||
| 1475 | + // storageNos: pick.pickup_no, | ||
| 1476 | + // wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 1477 | + // storeId: os.stoid | ||
| 1478 | + // }, | ||
| 1479 | + // success: function (res) { | ||
| 1480 | + // if (res.data.code == 0) { | ||
| 1481 | + // if (res.data.data.pageData.length > 0) { | ||
| 1482 | + // var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
| 1483 | + // if (CanOutQty < e.data.goodsInputNum) { | ||
| 1484 | + // wx.showToast({ | ||
| 1485 | + // title: '库存不足!', | ||
| 1486 | + // icon: 'none', | ||
| 1487 | + // }); | ||
| 1488 | + // return false; | ||
| 1489 | + // // return s.my_warnning("库存不足!", 0, th); | ||
| 1490 | + // } | ||
| 1491 | + // //在调一次接口,读取商品的预出库的数量,lock | ||
| 1492 | + // getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
| 1493 | + // data: { | ||
| 1494 | + // store_id: os.stoid, | ||
| 1495 | + // wareId: th.data.sele_g.goods_id, | ||
| 1496 | + // storageId: pick.pickup_id, | ||
| 1497 | + // pageSize: 1000 | ||
| 1498 | + // }, | ||
| 1499 | + // success: function (res_data) { | ||
| 1500 | + // if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
| 1501 | + // | ||
| 1502 | + // var lock = 0; | ||
| 1503 | + // for (var i in res_data.data.data.pageData) { | ||
| 1504 | + // lock += res_data.data.data.pageData[i].outQty; | ||
| 1505 | + // } | ||
| 1506 | + // | ||
| 1507 | + // if (CanOutQty <= lock) { | ||
| 1508 | + // wx.showToast({ | ||
| 1509 | + // title: '库存不足!', | ||
| 1510 | + // icon: 'none', | ||
| 1511 | + // }); | ||
| 1512 | + // return false; | ||
| 1513 | + // //return s.my_warnning("库存不足!", 0, th); | ||
| 1514 | + // } | ||
| 1515 | + // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
| 1516 | + // } else { | ||
| 1517 | + // th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1518 | + // } | ||
| 1519 | + // } | ||
| 1520 | + // }) | ||
| 1521 | + // } else { | ||
| 1522 | + // wx.showToast({ | ||
| 1523 | + // title: '库存不足!', | ||
| 1524 | + // icon: 'none', | ||
| 1525 | + // }); | ||
| 1526 | + // return false; | ||
| 1527 | + // // return s.my_warnning("库存不足!", 0, th); | ||
| 1528 | + // } | ||
| 1529 | + // | ||
| 1530 | + // } | ||
| 1531 | + // } | ||
| 1532 | + // }) | ||
| 1533 | + th.check_CanOutQty(th.data.sele_g,pick,function (CanOutQty){ | ||
| 1534 | + if(CanOutQty){ | ||
| 1535 | + if (CanOutQty < e.data.goodsInputNum) { | ||
| 1536 | + wx.showToast({ | ||
| 1537 | + title: '库存不足!', | ||
| 1538 | + icon: 'none', | ||
| 1539 | + }); | ||
| 1540 | + return false; | ||
| 1511 | } | 1541 | } |
| 1542 | + | ||
| 1543 | + th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1544 | + }else{ | ||
| 1545 | + wx.showToast({title: '库存不足!',icon: 'none',}); | ||
| 1546 | + return false; | ||
| 1512 | } | 1547 | } |
| 1513 | }) | 1548 | }) |
| 1549 | + | ||
| 1550 | + | ||
| 1514 | } else { | 1551 | } else { |
| 1515 | if (o.store_count <= 0) { | 1552 | if (o.store_count <= 0) { |
| 1516 | wx.showToast({ | 1553 | wx.showToast({ |
| @@ -1588,64 +1625,83 @@ Page({ | @@ -1588,64 +1625,83 @@ Page({ | ||
| 1588 | return false; | 1625 | return false; |
| 1589 | } else { | 1626 | } else { |
| 1590 | //---如果是线下门店销售的时候--- | 1627 | //---如果是线下门店销售的时候--- |
| 1591 | - if (th.data.sales_rules == 2) { | 1628 | + if (th.data.sales_rules >= 2) { |
| 1592 | var pick = th.get_pick_from_list(th.data.sto_sele_id) | 1629 | var pick = th.get_pick_from_list(th.data.sto_sele_id) |
| 1593 | //---通过接口获取门店的线下库存信息-- | 1630 | //---通过接口获取门店的线下库存信息-- |
| 1594 | - getApp().request.get("/api/weshop/goods/getWareStorages", { | ||
| 1595 | - data: { | ||
| 1596 | - storageNos: pick.pickup_no, | ||
| 1597 | - wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 1598 | - storeId: os.stoid | ||
| 1599 | - }, | ||
| 1600 | - success: function (res) { | ||
| 1601 | - if (res.data.code == 0) { | ||
| 1602 | - if (res.data.data.pageData.length > 0) { | ||
| 1603 | - var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
| 1604 | - if (CanOutQty < e.data.goodsInputNum) { | ||
| 1605 | - wx.showToast({ | ||
| 1606 | - title: '库存不足!', | ||
| 1607 | - icon: 'none', | ||
| 1608 | - }); | ||
| 1609 | - return false; | ||
| 1610 | - //return s.my_warnning("库存不足!", 0, th); | ||
| 1611 | - } | ||
| 1612 | - //在调一次接口,读取商品的预出库的数量,lock | ||
| 1613 | - getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
| 1614 | - data: { | ||
| 1615 | - store_id: os.stoid, | ||
| 1616 | - wareId: th.data.sele_g.goods_id, | ||
| 1617 | - storageId: pick.pickup_id, | ||
| 1618 | - pageSize: 1000 | ||
| 1619 | - }, | ||
| 1620 | - success: function (res_data) { | ||
| 1621 | - if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
| 1622 | - | ||
| 1623 | - var lock = 0; | ||
| 1624 | - for (var i in res_data.data.data.pageData) { | ||
| 1625 | - lock += res_data.data.data.pageData[i].outQty; | ||
| 1626 | - } | ||
| 1627 | - | ||
| 1628 | - if (CanOutQty <= lock) { | ||
| 1629 | - wx.showToast({ | ||
| 1630 | - title: '库存不足!', | ||
| 1631 | - icon: 'none', | ||
| 1632 | - }); | ||
| 1633 | - return false; | ||
| 1634 | - //return s.my_warnning("库存不足!", 0, th); | ||
| 1635 | - } | ||
| 1636 | - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
| 1637 | - } else { | ||
| 1638 | - th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1639 | - } | ||
| 1640 | - } | ||
| 1641 | - }) | ||
| 1642 | - } else { | ||
| 1643 | - return s.my_warnning("库存不足!", 0, th); | ||
| 1644 | - } | 1631 | + // getApp().request.get("/api/weshop/goods/getWareStorages", { |
| 1632 | + // data: { | ||
| 1633 | + // storageNos: pick.pickup_no, | ||
| 1634 | + // wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 1635 | + // storeId: os.stoid | ||
| 1636 | + // }, | ||
| 1637 | + // success: function (res) { | ||
| 1638 | + // if (res.data.code == 0) { | ||
| 1639 | + // if (res.data.data.pageData.length > 0) { | ||
| 1640 | + // var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
| 1641 | + // if (CanOutQty < e.data.goodsInputNum) { | ||
| 1642 | + // wx.showToast({ | ||
| 1643 | + // title: '库存不足!', | ||
| 1644 | + // icon: 'none', | ||
| 1645 | + // }); | ||
| 1646 | + // return false; | ||
| 1647 | + // //return s.my_warnning("库存不足!", 0, th); | ||
| 1648 | + // } | ||
| 1649 | + // //在调一次接口,读取商品的预出库的数量,lock | ||
| 1650 | + // getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
| 1651 | + // data: { | ||
| 1652 | + // store_id: os.stoid, | ||
| 1653 | + // wareId: th.data.sele_g.goods_id, | ||
| 1654 | + // storageId: pick.pickup_id, | ||
| 1655 | + // pageSize: 1000 | ||
| 1656 | + // }, | ||
| 1657 | + // success: function (res_data) { | ||
| 1658 | + // if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
| 1659 | + // | ||
| 1660 | + // var lock = 0; | ||
| 1661 | + // for (var i in res_data.data.data.pageData) { | ||
| 1662 | + // lock += res_data.data.data.pageData[i].outQty; | ||
| 1663 | + // } | ||
| 1664 | + // | ||
| 1665 | + // if (CanOutQty <= lock) { | ||
| 1666 | + // wx.showToast({ | ||
| 1667 | + // title: '库存不足!', | ||
| 1668 | + // icon: 'none', | ||
| 1669 | + // }); | ||
| 1670 | + // return false; | ||
| 1671 | + // //return s.my_warnning("库存不足!", 0, th); | ||
| 1672 | + // } | ||
| 1673 | + // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
| 1674 | + // } else { | ||
| 1675 | + // th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1676 | + // } | ||
| 1677 | + // } | ||
| 1678 | + // }) | ||
| 1679 | + // } else { | ||
| 1680 | + // return s.my_warnning("库存不足!", 0, th); | ||
| 1681 | + // } | ||
| 1682 | + // | ||
| 1683 | + // } | ||
| 1684 | + // } | ||
| 1685 | + // }) | ||
| 1686 | + | ||
| 1687 | + th.check_CanOutQty(th.data.sele_g,pick,function (CanOutQty){ | ||
| 1688 | + if(CanOutQty){ | ||
| 1645 | 1689 | ||
| 1690 | + if (CanOutQty < e.data.goodsInputNum) { | ||
| 1691 | + wx.showToast({ | ||
| 1692 | + title: '库存不足!', | ||
| 1693 | + icon: 'none', | ||
| 1694 | + }); | ||
| 1695 | + return false; | ||
| 1646 | } | 1696 | } |
| 1697 | + | ||
| 1698 | + th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1699 | + }else{ | ||
| 1700 | + wx.showToast({title: '库存不足!',icon: 'none',}); | ||
| 1701 | + return false; | ||
| 1647 | } | 1702 | } |
| 1648 | }) | 1703 | }) |
| 1704 | + | ||
| 1649 | } else { | 1705 | } else { |
| 1650 | if (o.store_count <= 0) { | 1706 | if (o.store_count <= 0) { |
| 1651 | wx.showToast({ | 1707 | wx.showToast({ |
| @@ -1679,69 +1735,88 @@ Page({ | @@ -1679,69 +1735,88 @@ Page({ | ||
| 1679 | } | 1735 | } |
| 1680 | 1736 | ||
| 1681 | //---如果是线下门店销售的时候--- | 1737 | //---如果是线下门店销售的时候--- |
| 1682 | - if (th.data.sales_rules == 2 && !th.data.sele_g.whsle_id ) { | 1738 | + if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id ) { |
| 1683 | var pick = th.get_pick_from_list(th.data.sto_sele_id) | 1739 | var pick = th.get_pick_from_list(th.data.sto_sele_id) |
| 1684 | //---通过接口获取门店的线下库存信息-- | 1740 | //---通过接口获取门店的线下库存信息-- |
| 1685 | - getApp().request.get("/api/weshop/goods/getWareStorages", { | ||
| 1686 | - data: { | ||
| 1687 | - storageNos: pick.pickup_no, | ||
| 1688 | - wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 1689 | - storeId: os.stoid | ||
| 1690 | - }, | ||
| 1691 | - success: function (res) { | ||
| 1692 | - if (res.data.code == 0) { | ||
| 1693 | - if (res.data.data.pageData.length > 0) { | ||
| 1694 | - var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
| 1695 | - if (CanOutQty < e.data.goodsInputNum) { | ||
| 1696 | - wx.showToast({ | ||
| 1697 | - title: '库存不足!', | ||
| 1698 | - icon: 'none', | ||
| 1699 | - }); | ||
| 1700 | - return false; | ||
| 1701 | - //return s.my_warnning("库存不足!", 0, th); | ||
| 1702 | - } | ||
| 1703 | - //在调一次接口,读取商品的预出库的数量,lock | ||
| 1704 | - getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
| 1705 | - data: { | ||
| 1706 | - store_id: os.stoid, | ||
| 1707 | - wareId: th.data.sele_g.goods_id, | ||
| 1708 | - storageId: pick.pickup_id, | ||
| 1709 | - pageSize: 1000 | ||
| 1710 | - }, | ||
| 1711 | - success: function (res_data) { | ||
| 1712 | - if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
| 1713 | - | ||
| 1714 | - var lock = 0; | ||
| 1715 | - for (var i in res_data.data.data.pageData) { | ||
| 1716 | - lock += res_data.data.data.pageData[i].outQty; | ||
| 1717 | - } | ||
| 1718 | - | ||
| 1719 | - if (CanOutQty <= lock) { | ||
| 1720 | - wx.showToast({ | ||
| 1721 | - title: '库存不足!', | ||
| 1722 | - icon: 'none', | ||
| 1723 | - }); | ||
| 1724 | - return false; | ||
| 1725 | - //return s.my_warnning("库存不足!", 0, th); | ||
| 1726 | - } | ||
| 1727 | - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
| 1728 | - } else { | ||
| 1729 | - th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1730 | - } | ||
| 1731 | - } | ||
| 1732 | - }) | ||
| 1733 | - } else { | ||
| 1734 | - wx.showToast({ | ||
| 1735 | - title: '库存不足!', | ||
| 1736 | - icon: 'none', | ||
| 1737 | - }); | ||
| 1738 | - return false; | ||
| 1739 | - //return s.my_warnning("库存不足!", 0, th); | ||
| 1740 | - } | ||
| 1741 | - | 1741 | + // getApp().request.get("/api/weshop/goods/getWareStorages", { |
| 1742 | + // data: { | ||
| 1743 | + // storageNos: pick.pickup_no, | ||
| 1744 | + // wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 1745 | + // storeId: os.stoid | ||
| 1746 | + // }, | ||
| 1747 | + // success: function (res) { | ||
| 1748 | + // if (res.data.code == 0) { | ||
| 1749 | + // if (res.data.data.pageData.length > 0) { | ||
| 1750 | + // var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
| 1751 | + // if (CanOutQty < e.data.goodsInputNum) { | ||
| 1752 | + // wx.showToast({ | ||
| 1753 | + // title: '库存不足!', | ||
| 1754 | + // icon: 'none', | ||
| 1755 | + // }); | ||
| 1756 | + // return false; | ||
| 1757 | + // //return s.my_warnning("库存不足!", 0, th); | ||
| 1758 | + // } | ||
| 1759 | + // //在调一次接口,读取商品的预出库的数量,lock | ||
| 1760 | + // getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
| 1761 | + // data: { | ||
| 1762 | + // store_id: os.stoid, | ||
| 1763 | + // wareId: th.data.sele_g.goods_id, | ||
| 1764 | + // storageId: pick.pickup_id, | ||
| 1765 | + // pageSize: 1000 | ||
| 1766 | + // }, | ||
| 1767 | + // success: function (res_data) { | ||
| 1768 | + // if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
| 1769 | + // | ||
| 1770 | + // var lock = 0; | ||
| 1771 | + // for (var i in res_data.data.data.pageData) { | ||
| 1772 | + // lock += res_data.data.data.pageData[i].outQty; | ||
| 1773 | + // } | ||
| 1774 | + // | ||
| 1775 | + // if (CanOutQty <= lock) { | ||
| 1776 | + // wx.showToast({ | ||
| 1777 | + // title: '库存不足!', | ||
| 1778 | + // icon: 'none', | ||
| 1779 | + // }); | ||
| 1780 | + // return false; | ||
| 1781 | + // //return s.my_warnning("库存不足!", 0, th); | ||
| 1782 | + // } | ||
| 1783 | + // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
| 1784 | + // } else { | ||
| 1785 | + // th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1786 | + // } | ||
| 1787 | + // } | ||
| 1788 | + // }) | ||
| 1789 | + // } else { | ||
| 1790 | + // wx.showToast({ | ||
| 1791 | + // title: '库存不足!', | ||
| 1792 | + // icon: 'none', | ||
| 1793 | + // }); | ||
| 1794 | + // return false; | ||
| 1795 | + // //return s.my_warnning("库存不足!", 0, th); | ||
| 1796 | + // } | ||
| 1797 | + // | ||
| 1798 | + // } | ||
| 1799 | + // } | ||
| 1800 | + // }) | ||
| 1801 | + | ||
| 1802 | + th.check_CanOutQty(th.data.sele_g,pick,function (CanOutQty){ | ||
| 1803 | + if(CanOutQty){ | ||
| 1804 | + | ||
| 1805 | + if (CanOutQty < e.data.goodsInputNum) { | ||
| 1806 | + wx.showToast({ | ||
| 1807 | + title: '库存不足!', | ||
| 1808 | + icon: 'none', | ||
| 1809 | + }); | ||
| 1810 | + return false; | ||
| 1742 | } | 1811 | } |
| 1812 | + | ||
| 1813 | + th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
| 1814 | + }else{ | ||
| 1815 | + wx.showToast({title: '库存不足!',icon: 'none',}); | ||
| 1816 | + return false; | ||
| 1743 | } | 1817 | } |
| 1744 | }) | 1818 | }) |
| 1819 | + | ||
| 1745 | } else { | 1820 | } else { |
| 1746 | if (o.store_count <= 0) { | 1821 | if (o.store_count <= 0) { |
| 1747 | wx.showToast({ | 1822 | wx.showToast({ |
| @@ -2104,7 +2179,7 @@ Page({ | @@ -2104,7 +2179,7 @@ Page({ | ||
| 2104 | } | 2179 | } |
| 2105 | var e = th.data.sele_g.store_count; | 2180 | var e = th.data.sele_g.store_count; |
| 2106 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | 2181 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 |
| 2107 | - if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | 2182 | + if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { |
| 2108 | if (!th.data.def_pick_store) { | 2183 | if (!th.data.def_pick_store) { |
| 2109 | wx.showToast({ | 2184 | wx.showToast({ |
| 2110 | title: '请选择门店', | 2185 | title: '请选择门店', |
| @@ -2210,7 +2285,7 @@ Page({ | @@ -2210,7 +2285,7 @@ Page({ | ||
| 2210 | 2285 | ||
| 2211 | var e = th.data.sele_g.store_count; | 2286 | var e = th.data.sele_g.store_count; |
| 2212 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | 2287 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 |
| 2213 | - if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | 2288 | + if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { |
| 2214 | if (!th.data.def_pick_store) { | 2289 | if (!th.data.def_pick_store) { |
| 2215 | wx.showModal({title: '请选择门店',}); | 2290 | wx.showModal({title: '请选择门店',}); |
| 2216 | return false; | 2291 | return false; |
| @@ -2826,6 +2901,8 @@ Page({ | @@ -2826,6 +2901,8 @@ Page({ | ||
| 2826 | sku_g = this.data.sku_g_pt; | 2901 | sku_g = this.data.sku_g_pt; |
| 2827 | } | 2902 | } |
| 2828 | 2903 | ||
| 2904 | + that.data.change=1; | ||
| 2905 | + | ||
| 2829 | var item = null; | 2906 | var item = null; |
| 2830 | for (var i in sku_g) { | 2907 | for (var i in sku_g) { |
| 2831 | if (sku_g[i].goods_id == gid) { | 2908 | if (sku_g[i].goods_id == gid) { |
| @@ -2858,41 +2935,48 @@ Page({ | @@ -2858,41 +2935,48 @@ Page({ | ||
| 2858 | if(!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal); | 2935 | if(!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal); |
| 2859 | 2936 | ||
| 2860 | //默认门店要拿下门店库存 | 2937 | //默认门店要拿下门店库存 |
| 2861 | - if (that.data.sales_rules == 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id ) { | 2938 | + if (that.data.sales_rules >= 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id ) { |
| 2862 | var lock = 0, plist = null; | 2939 | var lock = 0, plist = null; |
| 2863 | //先读取门店的lock,采用链式写法,少用await | 2940 | //先读取门店的lock,采用链式写法,少用await |
| 2864 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
| 2865 | - data: { | ||
| 2866 | - store_id: os.stoid, | ||
| 2867 | - wareId: that.data.sele_g.goods_id, | ||
| 2868 | - storageId: that.data.def_pick_store.pickup_id, | ||
| 2869 | - pageSize: 1000 | ||
| 2870 | - } | ||
| 2871 | - }).then(res => { | ||
| 2872 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 2873 | - for (var i in res.data.data.pageData) | ||
| 2874 | - lock += res.data.data.pageData[i].outQty | ||
| 2875 | - } | ||
| 2876 | - //---通过接口获取门店的线下库存信息-- | ||
| 2877 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
| 2878 | - data: { | ||
| 2879 | - storageNos: that.data.def_pick_store.pickup_no, | ||
| 2880 | - wareIds: encodeURIComponent(that.data.sele_g.erpwareid), | ||
| 2881 | - storeId: os.stoid | ||
| 2882 | - } | ||
| 2883 | - }) | ||
| 2884 | - }).then(res => { | ||
| 2885 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 2886 | - plist = res.data.data.pageData[0]; | ||
| 2887 | - } | ||
| 2888 | - if (plist && plist.CanOutQty - lock > 0) { | ||
| 2889 | - that.data.def_pick_store.CanOutQty = plist.CanOutQty - lock; | ||
| 2890 | - } else { | ||
| 2891 | - that.data.def_pick_store.CanOutQty = 0; | ||
| 2892 | - } | 2941 | + // getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| 2942 | + // data: { | ||
| 2943 | + // store_id: os.stoid, | ||
| 2944 | + // wareId: that.data.sele_g.goods_id, | ||
| 2945 | + // storageId: that.data.def_pick_store.pickup_id, | ||
| 2946 | + // pageSize: 1000 | ||
| 2947 | + // } | ||
| 2948 | + // }).then(res => { | ||
| 2949 | + // if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 2950 | + // for (var i in res.data.data.pageData) | ||
| 2951 | + // lock += res.data.data.pageData[i].outQty | ||
| 2952 | + // } | ||
| 2953 | + // //---通过接口获取门店的线下库存信息-- | ||
| 2954 | + // return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
| 2955 | + // data: { | ||
| 2956 | + // storageNos: that.data.def_pick_store.pickup_no, | ||
| 2957 | + // wareIds: encodeURIComponent(that.data.sele_g.erpwareid), | ||
| 2958 | + // storeId: os.stoid | ||
| 2959 | + // } | ||
| 2960 | + // }) | ||
| 2961 | + // }).then(res => { | ||
| 2962 | + // if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 2963 | + // plist = res.data.data.pageData[0]; | ||
| 2964 | + // } | ||
| 2965 | + // if (plist && plist.CanOutQty - lock > 0) { | ||
| 2966 | + // that.data.def_pick_store.CanOutQty = plist.CanOutQty - lock; | ||
| 2967 | + // } else { | ||
| 2968 | + // that.data.def_pick_store.CanOutQty = 0; | ||
| 2969 | + // } | ||
| 2970 | + // //--给门店赋值线下库存-- | ||
| 2971 | + // that.setData({def_pick_store: that.data.def_pick_store}); | ||
| 2972 | + // }) | ||
| 2973 | + | ||
| 2974 | + that.check_CanOutQty(th.data.sele_g,that.data.def_pick_store,function (CanOutQty){ | ||
| 2975 | + that.data.def_pick_store.CanOutQty = CanOutQty; | ||
| 2893 | //--给门店赋值线下库存-- | 2976 | //--给门店赋值线下库存-- |
| 2894 | that.setData({def_pick_store: that.data.def_pick_store}); | 2977 | that.setData({def_pick_store: that.data.def_pick_store}); |
| 2895 | }) | 2978 | }) |
| 2979 | + | ||
| 2896 | } | 2980 | } |
| 2897 | this.sele_spec_chech_activity(); | 2981 | this.sele_spec_chech_activity(); |
| 2898 | }, | 2982 | }, |
| @@ -3086,7 +3170,7 @@ Page({ | @@ -3086,7 +3170,7 @@ Page({ | ||
| 3086 | th.setData({all_pick_list: e.data.data.pageData}); | 3170 | th.setData({all_pick_list: e.data.data.pageData}); |
| 3087 | 3171 | ||
| 3088 | //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- | 3172 | //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- |
| 3089 | - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { | 3173 | + if (th.data.sales_rules >= 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { |
| 3090 | setTimeout(function () { | 3174 | setTimeout(function () { |
| 3091 | th.deal_pickup_dline(e); | 3175 | th.deal_pickup_dline(e); |
| 3092 | }, 800) | 3176 | }, 800) |
| @@ -3322,86 +3406,141 @@ Page({ | @@ -3322,86 +3406,141 @@ Page({ | ||
| 3322 | 3406 | ||
| 3323 | var g_distr_type = th.data.sele_g.distr_type; | 3407 | var g_distr_type = th.data.sele_g.distr_type; |
| 3324 | var lock = []; | 3408 | var lock = []; |
| 3409 | + | ||
| 3410 | + var lock_rq={store_id: os.stoid, wareId: th.data.sele_g.goods_id, pageSize: 1000}; | ||
| 3411 | + | ||
| 3412 | + if(th.data.sales_rules==3){ | ||
| 3413 | + lock_rq.appoint_pick_keyid=th.data.appoint_pick_keyid; | ||
| 3414 | + } | ||
| 3415 | + | ||
| 3325 | //先读取门店的lock,采用链式写法,少用await | 3416 | //先读取门店的lock,采用链式写法,少用await |
| 3326 | getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | 3417 | getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| 3327 | - data: {store_id: os.stoid, wareId: th.data.sele_g.goods_id, pageSize: 1000} | 3418 | + data: lock_rq |
| 3328 | }).then(res => { | 3419 | }).then(res => { |
| 3329 | if (res.data.code == 0 && res.data.data.total > 0) { | 3420 | if (res.data.code == 0 && res.data.data.total > 0) { |
| 3330 | lock = res.data.data.pageData | 3421 | lock = res.data.data.pageData |
| 3331 | } | 3422 | } |
| 3423 | + var sto_rq={ | ||
| 3424 | + wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 3425 | + storeId: os.stoid, | ||
| 3426 | + pageSize: 2000 | ||
| 3427 | + } | ||
| 3428 | + | ||
| 3429 | + if(th.data.sales_rules==3){ | ||
| 3430 | + sto_rq.storageIds=th.data.appoint_pick_keyid; | ||
| 3431 | + }else{ | ||
| 3432 | + sto_rq.storageNos=pkno_str; | ||
| 3433 | + } | ||
| 3434 | + | ||
| 3332 | //---通过接口获取门店的线下库存信息-- | 3435 | //---通过接口获取门店的线下库存信息-- |
| 3333 | return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | 3436 | return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { |
| 3334 | - data: { | ||
| 3335 | - storageNos: pkno_str, | ||
| 3336 | - wareIds: encodeURIComponent(th.data.sele_g.erpwareid), | ||
| 3337 | - storeId: os.stoid, | ||
| 3338 | - pageSize: 2000 | ||
| 3339 | - } | 3437 | + data: sto_rq |
| 3340 | }) | 3438 | }) |
| 3341 | }).then(res => { | 3439 | }).then(res => { |
| 3342 | 3440 | ||
| 3343 | wx.hideLoading(); | 3441 | wx.hideLoading(); |
| 3344 | if (res.data.code == 0) { | 3442 | if (res.data.code == 0) { |
| 3345 | - if (res.data.data.pageData && res.data.data.pageData.length > 0) { | ||
| 3346 | - var plist = res.data.data.pageData; | ||
| 3347 | - var def_pick_store = th.data.def_pick_store; | ||
| 3348 | - //以原来的数组为外循环,保证距离的顺序 | ||
| 3349 | - for (var kk in o_plist) { | ||
| 3350 | - for (var ii in plist) { | ||
| 3351 | - //线下的门店小心 | ||
| 3352 | - var n_item = plist[ii]; | ||
| 3353 | - if (n_item.StorageNo == o_plist[kk].pickup_no) { | ||
| 3354 | - | ||
| 3355 | - //拿到锁库的数量 | ||
| 3356 | - var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock); | ||
| 3357 | - //可出库数大于预出库库存的数量,可以判断为有库存 | ||
| 3358 | - if (n_item.CanOutQty > lock_num) { | ||
| 3359 | - o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num; | 3443 | + |
| 3444 | + if (res.data.data.pageData && res.data.data.pageData.length > 0) { | ||
| 3445 | + | ||
| 3446 | + var plist = res.data.data.pageData; | ||
| 3447 | + if(th.data.sales_rules==3) { | ||
| 3448 | + var lock_num = 0; | ||
| 3449 | + var Qty = 0; | ||
| 3450 | + //-- 计算锁住的库存 -- | ||
| 3451 | + for (var i in lock) lock_num += lock[i].outQty; | ||
| 3452 | + Qty=plist[0].CanOutQty - lock_num; | ||
| 3453 | + | ||
| 3454 | + if(Qty>0) { | ||
| 3455 | + for (var kk in o_plist) { | ||
| 3456 | + o_plist[kk].CanOutQty = Qty; | ||
| 3360 | new_list.push(o_plist[kk]); | 3457 | new_list.push(o_plist[kk]); |
| 3361 | - //--如果找到默认门店,同时也应该判断配送方式对不对-- | ||
| 3362 | - if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { | ||
| 3363 | - th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num; | ||
| 3364 | - if (def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) | ||
| 3365 | - th.setData({def_pick_store: th.data.fir_def_store}) | ||
| 3366 | - is_find_def_store = 1; | 3458 | + } |
| 3459 | + if (th.data.fir_def_store && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { | ||
| 3460 | + th.data.fir_def_store.Qty; | ||
| 3461 | + if (def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) | ||
| 3462 | + th.setData({def_pick_store: th.data.fir_def_store}) | ||
| 3463 | + is_find_def_store = 1; | ||
| 3464 | + } | ||
| 3465 | + | ||
| 3466 | + }else{ | ||
| 3467 | + th.setData({all_sto: null, only_pk: null, def_pickpu_list: null}); | ||
| 3468 | + return false; | ||
| 3469 | + } | ||
| 3470 | + | ||
| 3471 | + }else { | ||
| 3472 | + | ||
| 3473 | + var def_pick_store = th.data.def_pick_store; | ||
| 3474 | + //以原来的数组为外循环,保证距离的顺序 | ||
| 3475 | + for (var kk in o_plist) { | ||
| 3476 | + for (var ii in plist) { | ||
| 3477 | + //线下的门店小心 | ||
| 3478 | + var n_item = plist[ii]; | ||
| 3479 | + if (n_item.StorageNo == o_plist[kk].pickup_no) { | ||
| 3480 | + | ||
| 3481 | + //拿到锁库的数量 | ||
| 3482 | + var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock); | ||
| 3483 | + //可出库数大于预出库库存的数量,可以判断为有库存 | ||
| 3484 | + if (n_item.CanOutQty > lock_num) { | ||
| 3485 | + o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num; | ||
| 3486 | + new_list.push(o_plist[kk]); | ||
| 3487 | + //--如果找到默认门店,同时也应该判断配送方式对不对-- | ||
| 3488 | + if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { | ||
| 3489 | + th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num; | ||
| 3490 | + if (def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) | ||
| 3491 | + th.setData({def_pick_store: th.data.fir_def_store}) | ||
| 3492 | + is_find_def_store = 1; | ||
| 3493 | + } | ||
| 3494 | + } | ||
| 3495 | + break; | ||
| 3367 | } | 3496 | } |
| 3368 | } | 3497 | } |
| 3369 | - break; | ||
| 3370 | } | 3498 | } |
| 3499 | + | ||
| 3371 | } | 3500 | } |
| 3372 | - } | ||
| 3373 | 3501 | ||
| 3374 | - //数据组装下 | ||
| 3375 | - var em = {}; | ||
| 3376 | - em.data = {}; | ||
| 3377 | - em.data.data = {}; | ||
| 3378 | - em.data.data.total = new_list.length; | ||
| 3379 | - em.data.data.pageData = new_list; | ||
| 3380 | - em.data.data.pageData = new_list; | ||
| 3381 | - | ||
| 3382 | - //--如果找到默认门店,同时也应该判断配送方式对不对-- | ||
| 3383 | - if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { | ||
| 3384 | - th.data.fir_def_store.CanOutQty = 0; | ||
| 3385 | - //--当选择的门店是客户默认的门店的时候-- | ||
| 3386 | - if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) { | ||
| 3387 | - th.setData({def_pick_store: th.data.fir_def_store}); | ||
| 3388 | - em.data.data.pageData.unshift(th.data.def_pick_store); | ||
| 3389 | - } else { | ||
| 3390 | - em.data.data.pageData.splice(1, 0, th.data.fir_def_store); | 3502 | + //数据组装下 |
| 3503 | + var em = {}; | ||
| 3504 | + em.data = {}; | ||
| 3505 | + em.data.data = {}; | ||
| 3506 | + em.data.data.total = new_list.length; | ||
| 3507 | + em.data.data.pageData = new_list; | ||
| 3508 | + | ||
| 3509 | + | ||
| 3510 | + //--如果找到默认门店,同时也应该判断配送方式对不对-- | ||
| 3511 | + if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id | ||
| 3512 | + && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { | ||
| 3513 | + th.data.fir_def_store.CanOutQty = 0; | ||
| 3514 | + //--当选择的门店是客户默认的门店的时候-- | ||
| 3515 | + if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) { | ||
| 3516 | + th.setData({def_pick_store: th.data.fir_def_store}); | ||
| 3517 | + em.data.data.pageData.unshift(th.data.def_pick_store); | ||
| 3518 | + } else { | ||
| 3519 | + em.data.data.pageData.splice(1, 0, th.data.fir_def_store); | ||
| 3520 | + } | ||
| 3521 | + } | ||
| 3522 | + | ||
| 3523 | + for (let j = 0; j < em.data.data.pageData.length; j++) { | ||
| 3524 | + var iu = em.data.data.pageData[j]; | ||
| 3525 | + if (iu.CanOutQty <= 0) iu.is_no_qyt = 1; | ||
| 3526 | + | ||
| 3391 | } | 3527 | } |
| 3528 | + | ||
| 3529 | + //---把数组组装进去--- | ||
| 3530 | + th.deal_pickup(em); | ||
| 3531 | + | ||
| 3532 | + } else { | ||
| 3533 | + th.setData({all_sto: null, only_pk: null, def_pickpu_list: null}) | ||
| 3392 | } | 3534 | } |
| 3393 | 3535 | ||
| 3394 | - //---把数组组装进去--- | ||
| 3395 | - th.deal_pickup(em); | ||
| 3396 | - } else { | ||
| 3397 | - th.setData({all_sto: null, only_pk: null, def_pickpu_list: null}) | ||
| 3398 | - } | ||
| 3399 | } else { | 3536 | } else { |
| 3400 | th.setData({all_sto: null, only_pk: null, def_pickpu_list: null}) | 3537 | th.setData({all_sto: null, only_pk: null, def_pickpu_list: null}) |
| 3401 | } | 3538 | } |
| 3402 | }) | 3539 | }) |
| 3403 | }, | 3540 | }, |
| 3404 | 3541 | ||
| 3542 | + | ||
| 3543 | + | ||
| 3405 | find_lock_num(pick_id, lock) { | 3544 | find_lock_num(pick_id, lock) { |
| 3406 | var lock_num = 0; | 3545 | var lock_num = 0; |
| 3407 | if (!lock) return 0; | 3546 | if (!lock) return 0; |
| @@ -4439,7 +4578,7 @@ Page({ | @@ -4439,7 +4578,7 @@ Page({ | ||
| 4439 | } | 4578 | } |
| 4440 | 4579 | ||
| 4441 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | 4580 | if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) |
| 4442 | - this.setData({ | 4581 | + th.setData({ |
| 4443 | sto_sele_name: "" | 4582 | sto_sele_name: "" |
| 4444 | }); | 4583 | }); |
| 4445 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | 4584 | if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); |
| @@ -5832,7 +5971,7 @@ Page({ | @@ -5832,7 +5971,7 @@ Page({ | ||
| 5832 | return false; | 5971 | return false; |
| 5833 | } | 5972 | } |
| 5834 | 5973 | ||
| 5835 | - if (!th.data.only_pk && !th.data.def_pickpu_list) { | 5974 | + if (!th.data.only_pk && !th.data.def_pickpu_list && !th.data.change) { |
| 5836 | // getApp().confirmBox("门店库存不足", null, 25000, !1); | 5975 | // getApp().confirmBox("门店库存不足", null, 25000, !1); |
| 5837 | wx.showToast({ | 5976 | wx.showToast({ |
| 5838 | title: '门店库存不足', | 5977 | title: '门店库存不足', |
| @@ -5840,6 +5979,7 @@ Page({ | @@ -5840,6 +5979,7 @@ Page({ | ||
| 5840 | }); | 5979 | }); |
| 5841 | return false; | 5980 | return false; |
| 5842 | } | 5981 | } |
| 5982 | + th.data.change=0; | ||
| 5843 | 5983 | ||
| 5844 | if (th.data.only_pk && !th.data.only_pk.length) { | 5984 | if (th.data.only_pk && !th.data.only_pk.length) { |
| 5845 | // getApp().confirmBox("门店库存不足", null, 25000, !1); | 5985 | // getApp().confirmBox("门店库存不足", null, 25000, !1); |
| @@ -6003,7 +6143,7 @@ Page({ | @@ -6003,7 +6143,7 @@ Page({ | ||
| 6003 | }, | 6143 | }, |
| 6004 | 6144 | ||
| 6005 | //如果开启线下库存,已经急速库存才会使用 | 6145 | //如果开启线下库存,已经急速库存才会使用 |
| 6006 | - async check_the_pick(item, func) { | 6146 | + check_the_pick(item, func) { |
| 6007 | var th = this; | 6147 | var th = this; |
| 6008 | var goodsinfo = th.data.sele_g; | 6148 | var goodsinfo = th.data.sele_g; |
| 6009 | var erpwareid = goodsinfo.erpwareid; | 6149 | var erpwareid = goodsinfo.erpwareid; |
| @@ -6011,45 +6151,83 @@ Page({ | @@ -6011,45 +6151,83 @@ Page({ | ||
| 6011 | var lock = 0; | 6151 | var lock = 0; |
| 6012 | 6152 | ||
| 6013 | //---如果是活动的时候,同时不是普通购买--- | 6153 | //---如果是活动的时候,同时不是普通购买--- |
| 6014 | - if (th.data.sele_g.whsle_id || (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) && !th.data.is_normal) { | 6154 | + if (th.data.sele_g.whsle_id || [1,2,4,6,8,9].indexOf(th.data.prom_type)>-1 && !th.data.is_normal) { |
| 6015 | func(); | 6155 | func(); |
| 6016 | return false; | 6156 | return false; |
| 6017 | } | 6157 | } |
| 6018 | 6158 | ||
| 6019 | - if (this.data.sales_rules != 2) { | 6159 | + if (this.data.sales_rules == 1) { |
| 6020 | func(); | 6160 | func(); |
| 6021 | } else { | 6161 | } else { |
| 6022 | - | ||
| 6023 | - //先读取门店的lock | ||
| 6024 | - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
| 6025 | - data: {store_id: os.stoid, wareId: goodsinfo.goods_id, storageId: item.pickup_id, pageSize: 1000} | ||
| 6026 | - }).then(res => { | ||
| 6027 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 6028 | - for (var i in res.data.data.pageData) | ||
| 6029 | - lock += res.data.data.pageData[i].outQty; | ||
| 6030 | - } | ||
| 6031 | - }) | ||
| 6032 | - //读取线下的门店库存 | ||
| 6033 | - await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
| 6034 | - data: {storageNos: item.pickup_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid} | ||
| 6035 | - }).then(res => { | ||
| 6036 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 6037 | - plist = res.data.data.pageData[0]; | 6162 | + // if (plist && plist.CanOutQty - lock > 0) { |
| 6163 | + // item.CanOutQty = plist.CanOutQty - lock; | ||
| 6164 | + // func(); | ||
| 6165 | + // return false; | ||
| 6166 | + // } | ||
| 6167 | + this.check_CanOutQty(goodsinfo,item,function (CanOutQty){ | ||
| 6168 | + | ||
| 6169 | + // let str = item.pickup_name + '库存不足!'; | ||
| 6170 | + if(!CanOutQty){ | ||
| 6171 | + wx.showToast({ | ||
| 6172 | + title: item.pickup_name + '库存不足!', | ||
| 6173 | + icon: 'none', | ||
| 6174 | + }); | ||
| 6175 | + return false; | ||
| 6038 | } | 6176 | } |
| 6039 | - }) | ||
| 6040 | - | ||
| 6041 | - if (plist && plist.CanOutQty - lock > 0) { | ||
| 6042 | - item.CanOutQty = plist.CanOutQty - lock; | 6177 | + item.CanOutQty=CanOutQty; |
| 6043 | func(); | 6178 | func(); |
| 6044 | - return false; | 6179 | + |
| 6180 | + }); | ||
| 6181 | + | ||
| 6182 | + } | ||
| 6183 | + }, | ||
| 6184 | + | ||
| 6185 | + //统一一下获取线下库存的函数 | ||
| 6186 | + async check_CanOutQty(goodsinfo,item,func){ | ||
| 6187 | + | ||
| 6188 | + var sales_rules= this.data.sales_rules; | ||
| 6189 | + | ||
| 6190 | + var lock_rq= {store_id: os.stoid, wareId: goodsinfo.goods_id, pageSize: 1000}; | ||
| 6191 | + if(sales_rules==2){ | ||
| 6192 | + lock_rq.storageId=item.pickup_id | ||
| 6193 | + }else{ | ||
| 6194 | + lock_rq.appoint_pick_keyid=encodeURIComponent(this.data.appoint_pick_keyid) | ||
| 6195 | + } | ||
| 6196 | + | ||
| 6197 | + var lock=0; | ||
| 6198 | + var CanOutQty=0; | ||
| 6199 | + var plist=null; | ||
| 6200 | + //先读取门店的lock | ||
| 6201 | + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
| 6202 | + data:lock_rq | ||
| 6203 | + }).then(res => { | ||
| 6204 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 6205 | + for (var i in res.data.data.pageData) | ||
| 6206 | + lock += res.data.data.pageData[i].outQty; | ||
| 6045 | } | 6207 | } |
| 6046 | - // let str = item.pickup_name + '库存不足!'; | ||
| 6047 | - wx.showToast({ | ||
| 6048 | - title: item.pickup_name + '库存不足!', | ||
| 6049 | - icon: 'none', | ||
| 6050 | - }); | 6208 | + }) |
| 6051 | 6209 | ||
| 6210 | + var sto_req= { wareIds: encodeURIComponent(goodsinfo.erpwareid), storeId: os.stoid} | ||
| 6211 | + if(sales_rules==2){ | ||
| 6212 | + sto_req.storageNos=item.pickup_no | ||
| 6213 | + }else{ | ||
| 6214 | + sto_req.storageIds=encodeURIComponent(this.data.appoint_pick_keyid) | ||
| 6052 | } | 6215 | } |
| 6216 | + //读取线下的门店库存 | ||
| 6217 | + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
| 6218 | + data:sto_req | ||
| 6219 | + }).then(res => { | ||
| 6220 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
| 6221 | + plist = res.data.data.pageData[0]; | ||
| 6222 | + } | ||
| 6223 | + }) | ||
| 6224 | + | ||
| 6225 | + if (plist && plist.CanOutQty - lock > 0) { | ||
| 6226 | + CanOutQty=plist.CanOutQty - lock; | ||
| 6227 | + } | ||
| 6228 | + | ||
| 6229 | + if(func) func(CanOutQty); | ||
| 6230 | + | ||
| 6053 | }, | 6231 | }, |
| 6054 | 6232 | ||
| 6055 | 6233 | ||
| @@ -6064,7 +6242,7 @@ Page({ | @@ -6064,7 +6242,7 @@ Page({ | ||
| 6064 | if (th.data.is_show_sto_cat == 1) { | 6242 | if (th.data.is_show_sto_cat == 1) { |
| 6065 | item = th.data.def_pickpu_list[index]; | 6243 | item = th.data.def_pickpu_list[index]; |
| 6066 | } else { | 6244 | } else { |
| 6067 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 6245 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 6068 | } | 6246 | } |
| 6069 | 6247 | ||
| 6070 | } else { | 6248 | } else { |
| @@ -6072,6 +6250,8 @@ Page({ | @@ -6072,6 +6250,8 @@ Page({ | ||
| 6072 | item = th.data.sec_sto.s_arr[index]; | 6250 | item = th.data.sec_sto.s_arr[index]; |
| 6073 | } | 6251 | } |
| 6074 | 6252 | ||
| 6253 | + if(!item) return false; | ||
| 6254 | + | ||
| 6075 | if (!th.data.sele_g) return false; | 6255 | if (!th.data.sele_g) return false; |
| 6076 | //判断门店的配送方式是不是匹配 | 6256 | //判断门店的配送方式是不是匹配 |
| 6077 | var g_distr_type = th.data.sele_g.distr_type; | 6257 | var g_distr_type = th.data.sele_g.distr_type; |
| @@ -6147,13 +6327,15 @@ Page({ | @@ -6147,13 +6327,15 @@ Page({ | ||
| 6147 | if (th.data.is_show_sto_cat == 1) { | 6327 | if (th.data.is_show_sto_cat == 1) { |
| 6148 | item = th.data.def_pickpu_list[index]; | 6328 | item = th.data.def_pickpu_list[index]; |
| 6149 | } else { | 6329 | } else { |
| 6150 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 6330 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 6151 | } | 6331 | } |
| 6152 | } else { | 6332 | } else { |
| 6153 | var index = th.data.sec_pick_index; | 6333 | var index = th.data.sec_pick_index; |
| 6154 | item = th.data.sec_sto.s_arr[index]; | 6334 | item = th.data.sec_sto.s_arr[index]; |
| 6155 | } | 6335 | } |
| 6156 | 6336 | ||
| 6337 | + if(!item) return false; | ||
| 6338 | + | ||
| 6157 | //判断门店的配送方式是不是匹配 | 6339 | //判断门店的配送方式是不是匹配 |
| 6158 | var g_distr_type = th.data.sele_g.distr_type; | 6340 | var g_distr_type = th.data.sele_g.distr_type; |
| 6159 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { | 6341 | if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) { |
pages/goods/goodsInfo/goodsInfo.wxml
| @@ -125,7 +125,7 @@ | @@ -125,7 +125,7 @@ | ||
| 125 | <view class="fs50 val">{{prom_price}}</view> | 125 | <view class="fs50 val">{{prom_price}}</view> |
| 126 | </view> | 126 | </view> |
| 127 | 127 | ||
| 128 | - <view wx:if="is_retail_price" class="word-line fs20 xc-qtunit-price">¥{{filters.toFix(data.market_price,2)}}</view> | 128 | + <view wx:if="is_retail_price" class="word-line fs20 xc-qtunit-price">零售价:¥{{filters.toFix(data.market_price,2)}}</view> |
| 129 | <view wx:else class="word-line fs20 xc-qtunit-price">¥{{filters.toFix(data.shop_price,2)}}</view> | 129 | <view wx:else class="word-line fs20 xc-qtunit-price">¥{{filters.toFix(data.shop_price,2)}}</view> |
| 130 | </view> | 130 | </view> |
| 131 | 131 | ||
| @@ -262,7 +262,7 @@ | @@ -262,7 +262,7 @@ | ||
| 262 | <text class="rel_txt" wx:if="{{!prom_integral && !prom_price}}">0积分</text> | 262 | <text class="rel_txt" wx:if="{{!prom_integral && !prom_price}}">0积分</text> |
| 263 | 263 | ||
| 264 | <text wx:if="{{is_retail_price}}" class="rel_txt fs22" decode="{{true}}" space="{{true}}" style="color: #999; text-decoration: line-through;"> | 264 | <text wx:if="{{is_retail_price}}" class="rel_txt fs22" decode="{{true}}" space="{{true}}" style="color: #999; text-decoration: line-through;"> |
| 265 | - ¥{{filters.toFix(data.market_price,2)}} | 265 | + 零售价:¥{{filters.toFix(data.market_price,2)}} |
| 266 | </text> | 266 | </text> |
| 267 | 267 | ||
| 268 | <text wx:else class="rel_txt fs22" decode="{{true}}" space="{{true}}" style="color: #999; text-decoration: line-through;"> | 268 | <text wx:else class="rel_txt fs22" decode="{{true}}" space="{{true}}" style="color: #999; text-decoration: line-through;"> |
| @@ -310,7 +310,7 @@ | @@ -310,7 +310,7 @@ | ||
| 310 | {{filters.toFix(data[card_field],2)}} | 310 | {{filters.toFix(data[card_field],2)}} |
| 311 | 311 | ||
| 312 | <view wx:if="{{is_retail_price}}" class='yj' style="top:35rpx"> | 312 | <view wx:if="{{is_retail_price}}" class='yj' style="top:35rpx"> |
| 313 | - <text>零售价:¥{{filters.toFix(data.market_price,2)}}</text> | 313 | + <text>零售价:¥{{filters.toFix(data.market_price,2)}}</text> |
| 314 | </view> | 314 | </view> |
| 315 | 315 | ||
| 316 | <view wx:else class='yj' style="top:35rpx"> | 316 | <view wx:else class='yj' style="top:35rpx"> |
| @@ -324,7 +324,7 @@ | @@ -324,7 +324,7 @@ | ||
| 324 | <text class="yuan">¥</text> | 324 | <text class="yuan">¥</text> |
| 325 | {{filters.toFix(data.shop_price,2)}} | 325 | {{filters.toFix(data.shop_price,2)}} |
| 326 | <view wx:if="{{is_retail_price}}" class='yj'> | 326 | <view wx:if="{{is_retail_price}}" class='yj'> |
| 327 | - <text>零售价:¥{{filters.toFix(data.market_price,2)}}</text> | 327 | + <text>零售价:¥{{filters.toFix(data.market_price,2)}}</text> |
| 328 | </view> | 328 | </view> |
| 329 | 329 | ||
| 330 | <view wx:else class='yj'> | 330 | <view wx:else class='yj'> |
| @@ -427,7 +427,7 @@ | @@ -427,7 +427,7 @@ | ||
| 427 | <text class="fs30">¥</text> | 427 | <text class="fs30">¥</text> |
| 428 | {{prom_price}} | 428 | {{prom_price}} |
| 429 | </view> | 429 | </view> |
| 430 | - <view wx:if="{{is_retail_price}}" class="word-line fs24">¥{{filters.toFix(data.market_price,2)}}</view> | 430 | + <view wx:if="{{is_retail_price}}" class="word-line fs24">零售价:¥{{filters.toFix(data.market_price,2)}}</view> |
| 431 | <view wx:else class="word-line fs24">¥{{filters.toFix(data.shop_price,2)}}</view> | 431 | <view wx:else class="word-line fs24">¥{{filters.toFix(data.shop_price,2)}}</view> |
| 432 | </view> | 432 | </view> |
| 433 | <!-- 这个是分享按钮 --> | 433 | <!-- 这个是分享按钮 --> |
| @@ -623,7 +623,7 @@ | @@ -623,7 +623,7 @@ | ||
| 623 | </block> | 623 | </block> |
| 624 | <!-- 许程 7.24暂时注释 --> | 624 | <!-- 许程 7.24暂时注释 --> |
| 625 | <view class="bdt16" wx:if="{{ prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && sele_g.is_xz_yh !=1}}"> | 625 | <view class="bdt16" wx:if="{{ prom_type!=1 && prom_act.kttype!=3&&prom_act.kttype!=2&&prom_act.kttype!=1 && is_closecoupon!=1 && sele_g.is_xz_yh !=1}}"> |
| 626 | - <view class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> | 626 | + <view data-coupon="1" bindtap="switchCoupon" class="cx-frame flex" style="position: relative" wx:if="{{fir_quan.length>0}}"> |
| 627 | <view class="cx-sizs fs30">领券</view> | 627 | <view class="cx-sizs fs30">领券</view> |
| 628 | <view class="flex ai_c f1 pdh20"> | 628 | <view class="flex ai_c f1 pdh20"> |
| 629 | <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="id"> | 629 | <view class="xc-coupon-fram" wx:for="{{fir_quan}}" wx:key="id"> |
| @@ -634,7 +634,7 @@ | @@ -634,7 +634,7 @@ | ||
| 634 | <view class="circle xc-circular xc-two"></view> | 634 | <view class="circle xc-circular xc-two"></view> |
| 635 | </view> | 635 | </view> |
| 636 | </view> | 636 | </view> |
| 637 | - <view data-coupon="1" bindtap="switchCoupon" class="cx-obtain-coupon wsize"> | 637 | + <view class="cx-obtain-coupon wsize"> |
| 638 | <text class="bg_jj"></text> | 638 | <text class="bg_jj"></text> |
| 639 | </view> | 639 | </view> |
| 640 | </view> | 640 | </view> |
| @@ -1062,7 +1062,7 @@ | @@ -1062,7 +1062,7 @@ | ||
| 1062 | <!-- 普通商品购买 --> | 1062 | <!-- 普通商品购买 --> |
| 1063 | <block wx:if="{{prom_type==0 || prom_type==3}}"> | 1063 | <block wx:if="{{prom_type==0 || prom_type==3}}"> |
| 1064 | <!-- 线上销售的时候,要判断库存量, 线下库存的时候不用判断 --> | 1064 | <!-- 线上销售的时候,要判断库存量, 线下库存的时候不用判断 --> |
| 1065 | - <block wx:if="{{(sele_g.store_count>0 && sales_rules==1) || sales_rules==2 }}"> | 1065 | + <block wx:if="{{(sele_g.store_count>0 && sales_rules==1) || sales_rules>=2 }}"> |
| 1066 | <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn">加入购物车</view> | 1066 | <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn">加入购物车</view> |
| 1067 | <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn">立即购买</view> | 1067 | <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn">立即购买</view> |
| 1068 | </block> | 1068 | </block> |
| @@ -1197,6 +1197,8 @@ | @@ -1197,6 +1197,8 @@ | ||
| 1197 | <view hidden="{{!openSpecModal}}"> | 1197 | <view hidden="{{!openSpecModal}}"> |
| 1198 | <view bindtap="closeSpecModal" class="cover-layer"></view> | 1198 | <view bindtap="closeSpecModal" class="cover-layer"></view> |
| 1199 | <view class="spec-model"> | 1199 | <view class="spec-model"> |
| 1200 | + | ||
| 1201 | + | ||
| 1200 | <view class="pding"> | 1202 | <view class="pding"> |
| 1201 | <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon> | 1203 | <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon> |
| 1202 | <view class="spec-goods"> | 1204 | <view class="spec-goods"> |
| @@ -1344,7 +1346,7 @@ | @@ -1344,7 +1346,7 @@ | ||
| 1344 | </block> | 1346 | </block> |
| 1345 | <block wx:else> | 1347 | <block wx:else> |
| 1346 | <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> | 1348 | <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> |
| 1347 | - <block wx:if="{{sales_rules==2 && prom_type==0 && !sele_g.whsle_id}}"> | 1349 | + <block wx:if="{{sales_rules>=2 && prom_type==0 && !sele_g.whsle_id}}"> |
| 1348 | <block wx:if="{{!def_pick_store.CanOutQty}}"> | 1350 | <block wx:if="{{!def_pick_store.CanOutQty}}"> |
| 1349 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | 1351 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> |
| 1350 | 库存不足 | 1352 | 库存不足 |
| @@ -1363,7 +1365,7 @@ | @@ -1363,7 +1365,7 @@ | ||
| 1363 | <block wx:else> | 1365 | <block wx:else> |
| 1364 | <block wx:if="{{sele_g.store_count<=0}}"> | 1366 | <block wx:if="{{sele_g.store_count<=0}}"> |
| 1365 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | 1367 | <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> |
| 1366 | - 库存不足5 | 1368 | + 库存不足 |
| 1367 | </view> | 1369 | </view> |
| 1368 | </block> | 1370 | </block> |
| 1369 | <block wx:else> | 1371 | <block wx:else> |
| @@ -1558,7 +1560,9 @@ | @@ -1558,7 +1560,9 @@ | ||
| 1558 | <view class="address-frame xc-ash"> | 1560 | <view class="address-frame xc-ash"> |
| 1559 | <view class="flex-vertical-between butttem5"> | 1561 | <view class="flex-vertical-between butttem5"> |
| 1560 | <view class="flex xc-ash"> | 1562 | <view class="flex xc-ash"> |
| 1561 | - <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> | 1563 | + <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
| 1564 | + <text class="c-red2" wx:if="{{item.is_no_qyt}}">(无货)</text> | ||
| 1565 | + </view> | ||
| 1562 | </view> | 1566 | </view> |
| 1563 | <view> | 1567 | <view> |
| 1564 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | 1568 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> |
| @@ -1584,7 +1588,9 @@ | @@ -1584,7 +1588,9 @@ | ||
| 1584 | <view class="address-frame xc-ash"> | 1588 | <view class="address-frame xc-ash"> |
| 1585 | <view class="flex-vertical-between "> | 1589 | <view class="flex-vertical-between "> |
| 1586 | <view class="flex xc-ash"> | 1590 | <view class="flex xc-ash"> |
| 1587 | - <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view> | 1591 | + <view class="fs30 xc-black3 address_name">{{item.pickup_name}} |
| 1592 | + <text class="c-red2" wx:if="{{item.is_no_qyt}}">(无货)</text> | ||
| 1593 | + </view> | ||
| 1588 | </view> | 1594 | </view> |
| 1589 | <view> | 1595 | <view> |
| 1590 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | 1596 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> |
| @@ -1612,7 +1618,9 @@ | @@ -1612,7 +1618,9 @@ | ||
| 1612 | <view class="address-frame xc-ash"> | 1618 | <view class="address-frame xc-ash"> |
| 1613 | <view class="flex-vertical-between "> | 1619 | <view class="flex-vertical-between "> |
| 1614 | <view class="flex xc-ash"> | 1620 | <view class="flex xc-ash"> |
| 1615 | - <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view> | 1621 | + <view class="fs28 xc-black3 address_name">{{item.pickup_name}} |
| 1622 | + <text class="c-red2" wx:if="{{item.is_no_qyt}}">(无货)</text> | ||
| 1623 | + </view> | ||
| 1616 | </view> | 1624 | </view> |
| 1617 | <view> | 1625 | <view> |
| 1618 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> | 1626 | <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}"> |
pages/team/team_show/team_show.js
| @@ -1448,7 +1448,7 @@ Page({ | @@ -1448,7 +1448,7 @@ Page({ | ||
| 1448 | if (th.data.is_show_sto_cat == 1) { | 1448 | if (th.data.is_show_sto_cat == 1) { |
| 1449 | item = th.data.def_pickpu_list[index]; | 1449 | item = th.data.def_pickpu_list[index]; |
| 1450 | } else { | 1450 | } else { |
| 1451 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1451 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1452 | } | 1452 | } |
| 1453 | 1453 | ||
| 1454 | } else { | 1454 | } else { |
| @@ -1490,12 +1490,14 @@ Page({ | @@ -1490,12 +1490,14 @@ Page({ | ||
| 1490 | if (th.data.is_show_sto_cat == 1) { | 1490 | if (th.data.is_show_sto_cat == 1) { |
| 1491 | item = th.data.def_pickpu_list[index]; | 1491 | item = th.data.def_pickpu_list[index]; |
| 1492 | } else { | 1492 | } else { |
| 1493 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 1493 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 1494 | } | 1494 | } |
| 1495 | } else { | 1495 | } else { |
| 1496 | var index = th.data.sec_pick_index; | 1496 | var index = th.data.sec_pick_index; |
| 1497 | item = th.data.sec_sto.s_arr[index]; | 1497 | item = th.data.sec_sto.s_arr[index]; |
| 1498 | } | 1498 | } |
| 1499 | + | ||
| 1500 | + if(!item) return false; | ||
| 1499 | 1501 | ||
| 1500 | 1502 | ||
| 1501 | var store_id = o.stoid; | 1503 | var store_id = o.stoid; |
pages/template/index.js
| @@ -122,9 +122,10 @@ Page({ | @@ -122,9 +122,10 @@ Page({ | ||
| 122 | 122 | ||
| 123 | 123 | ||
| 124 | onShareAppMessage:async function(e) { | 124 | onShareAppMessage:async function(e) { |
| 125 | + var th=this; | ||
| 125 | getApp().globalData.no_clear=1; | 126 | getApp().globalData.no_clear=1; |
| 126 | getApp().getConfig(await function(e){ | 127 | getApp().getConfig(await function(e){ |
| 127 | - this.setData({ | 128 | + th.setData({ |
| 128 | store_config:e | 129 | store_config:e |
| 129 | }) | 130 | }) |
| 130 | }.bind(this)) | 131 | }.bind(this)) |
| @@ -148,9 +149,11 @@ Page({ | @@ -148,9 +149,11 @@ Page({ | ||
| 148 | * 用户分享朋友圈 | 149 | * 用户分享朋友圈 |
| 149 | */ | 150 | */ |
| 150 | async onShareTimeline(){ | 151 | async onShareTimeline(){ |
| 152 | + | ||
| 153 | + var th=this; | ||
| 151 | getApp().globalData.no_clear=1; | 154 | getApp().globalData.no_clear=1; |
| 152 | getApp().getConfig(await function(e){ | 155 | getApp().getConfig(await function(e){ |
| 153 | - this.setData({ | 156 | + th.setData({ |
| 154 | store_config:e | 157 | store_config:e |
| 155 | }) | 158 | }) |
| 156 | }.bind(this)) | 159 | }.bind(this)) |
pages/user/order_detail/order_detail.js
| @@ -19,12 +19,13 @@ Page({ | @@ -19,12 +19,13 @@ Page({ | ||
| 19 | var r = void 0 !== e.isGoup && e.isGoup; | 19 | var r = void 0 !== e.isGoup && e.isGoup; |
| 20 | 20 | ||
| 21 | getApp().getConfig2(function (e) { | 21 | getApp().getConfig2(function (e) { |
| 22 | + | ||
| 22 | 23 | ||
| 23 | th.setData({conf: e,sales_rules:e.sales_rules, userInfo: getApp().globalData.userInfo}); | 24 | th.setData({conf: e,sales_rules:e.sales_rules, userInfo: getApp().globalData.userInfo}); |
| 24 | //--- 看后台是不是有开通等级卡 --- | 25 | //--- 看后台是不是有开通等级卡 --- |
| 25 | if(e.switch_list){ | 26 | if(e.switch_list){ |
| 26 | var s_list=JSON.parse(e.switch_list); | 27 | var s_list=JSON.parse(e.switch_list); |
| 27 | - th.setData({sys_switch: s_list}); | 28 | + th.setData({sys_switch: s_list,appoint_pick_keyid:s_list.appoint_pick_keyid}); |
| 28 | var is_open_offline=s_list.is_pricing_open; | 29 | var is_open_offline=s_list.is_pricing_open; |
| 29 | var user=getApp().globalData.userInfo; | 30 | var user=getApp().globalData.userInfo; |
| 30 | //如果后台有开启等级价的功能 | 31 | //如果后台有开启等级价的功能 |
| @@ -942,26 +943,42 @@ Page({ | @@ -942,26 +943,42 @@ Page({ | ||
| 942 | async check_down_line_next(gg,num,pick_id,func){ | 943 | async check_down_line_next(gg,num,pick_id,func){ |
| 943 | 944 | ||
| 944 | var lock=0,pick_no,plist; | 945 | var lock=0,pick_no,plist; |
| 946 | + var lock_rq={store_id:os.stoid,wareId:gg.goods_id,storageId:pick_id}; | ||
| 947 | + if(this.data.sales_rules==3){ | ||
| 948 | + log_rq.appoint_pick_keyid=this.data.appoint_pick_keyid; | ||
| 949 | + delete log_rq.storageId | ||
| 950 | + } | ||
| 951 | + | ||
| 945 | //先读取门店的lock | 952 | //先读取门店的lock |
| 946 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | 953 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ |
| 947 | - data:{store_id:os.stoid,wareId:gg.goods_id,storageId:pick_id} | 954 | + data:lock_rq |
| 948 | }).then(res=>{ | 955 | }).then(res=>{ |
| 949 | if(res.data.code==0 && res.data.data.total>0){ | 956 | if(res.data.code==0 && res.data.data.total>0){ |
| 950 | for(var i in res.data.data.pageData) | 957 | for(var i in res.data.data.pageData) |
| 951 | lock+=res.data.data.pageData[i].outQty; | 958 | lock+=res.data.data.pageData[i].outQty; |
| 952 | } | 959 | } |
| 953 | }) | 960 | }) |
| 954 | - //先获取门店的编号 | ||
| 955 | - await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ | ||
| 956 | - data:{storeId:os.stoid,goodsId:gg.goods_id,pickupId:pick_id} | ||
| 957 | - }).then(res=>{ | ||
| 958 | - if(res.data.code==0){ | ||
| 959 | - pick_no=res.data.data.pickup_no; | ||
| 960 | - } | ||
| 961 | - }) | 961 | + |
| 962 | + if(this.data.sales_rules==2) { | ||
| 963 | + //先获取门店的编号 | ||
| 964 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick_id, { | ||
| 965 | + data: {storeId: os.stoid, goodsId: gg.goods_id, pickupId: pick_id} | ||
| 966 | + }).then(res => { | ||
| 967 | + if (res.data.code == 0) { | ||
| 968 | + pick_no = res.data.data.pickup_no; | ||
| 969 | + } | ||
| 970 | + }) | ||
| 971 | + } | ||
| 972 | + | ||
| 973 | + var sto_rq={storageNos:pick_no,wareIds:encodeURIComponent(gg.erpwareid),storeId:os.stoid}; | ||
| 974 | + if(this.data.sales_rules==3){ | ||
| 975 | + sto_rq.storageIds=this.data.appoint_pick_keyid; | ||
| 976 | + delete sto_rq.storageNos | ||
| 977 | + } | ||
| 978 | + | ||
| 962 | //读取线下的门店库存 | 979 | //读取线下的门店库存 |
| 963 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | 980 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ |
| 964 | - data:{storageNos:pick_no,wareIds:encodeURIComponent(gg.erpwareid),storeId:os.stoid} | 981 | + data:sto_rq |
| 965 | }).then(res=>{ | 982 | }).then(res=>{ |
| 966 | if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ | 983 | if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ |
| 967 | plist=res.data.data.pageData[0]; | 984 | plist=res.data.data.pageData[0]; |
| @@ -1248,7 +1265,7 @@ Page({ | @@ -1248,7 +1265,7 @@ Page({ | ||
| 1248 | 1265 | ||
| 1249 | 1266 | ||
| 1250 | //判断是不是线下库存的购买, 是不是秒杀活动 | 1267 | //判断是不是线下库存的购买, 是不是秒杀活动 |
| 1251 | - if(th.data.sales_rules==2 && !prom && !good.whsle_id){ | 1268 | + if(th.data.sales_rules>=2 && !prom && !good.whsle_id){ |
| 1252 | 1269 | ||
| 1253 | //-- 看一下购物车上有多少商品 -- | 1270 | //-- 看一下购物车上有多少商品 -- |
| 1254 | var cart_num=0; | 1271 | var cart_num=0; |
| @@ -1273,9 +1290,17 @@ Page({ | @@ -1273,9 +1290,17 @@ Page({ | ||
| 1273 | var lock=0,plist=null; | 1290 | var lock=0,plist=null; |
| 1274 | 1291 | ||
| 1275 | if(b_item.prom_type!=7) { | 1292 | if(b_item.prom_type!=7) { |
| 1293 | + | ||
| 1294 | + | ||
| 1295 | + var lock_rq={store_id: os.stoid, wareId: good.goods_id, storageId: b_item.pickup_id, pageSize: 1000}; | ||
| 1296 | + if(th.data.sales_rules==3){ | ||
| 1297 | + lock_rq.appoint_pick_keyid=th.data.appoint_pick_keyid; | ||
| 1298 | + delete lock_rq.storageId; | ||
| 1299 | + } | ||
| 1300 | + | ||
| 1276 | //先读取门店的lock, | 1301 | //先读取门店的lock, |
| 1277 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | 1302 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| 1278 | - data: {store_id: os.stoid, wareId: good.goods_id, storageId: b_item.pickup_id, pageSize: 1000} | 1303 | + data:lock_rq |
| 1279 | }).then(res => { | 1304 | }).then(res => { |
| 1280 | if (res.data.code == 0 && res.data.data.total > 0) { | 1305 | if (res.data.code == 0 && res.data.data.total > 0) { |
| 1281 | for (var i in res.data.data.pageData) | 1306 | for (var i in res.data.data.pageData) |
| @@ -1283,13 +1308,15 @@ Page({ | @@ -1283,13 +1308,15 @@ Page({ | ||
| 1283 | } | 1308 | } |
| 1284 | }) | 1309 | }) |
| 1285 | 1310 | ||
| 1311 | + var sto_rq={storageNos: pickup.pickup_no,wareIds: encodeURIComponent(good.erpwareid),storeId: os.stoid }; | ||
| 1312 | + if(th.data.sales_rules==3){ | ||
| 1313 | + sto_rq.storageIds=th.data.appoint_pick_keyid; | ||
| 1314 | + delete sto_rq.storageNos; | ||
| 1315 | + } | ||
| 1316 | + | ||
| 1286 | //---通过接口获取门店的线下库存信息-- | 1317 | //---通过接口获取门店的线下库存信息-- |
| 1287 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | 1318 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { |
| 1288 | - data: { | ||
| 1289 | - storageNos: pickup.pickup_no, | ||
| 1290 | - wareIds: encodeURIComponent(good.erpwareid), | ||
| 1291 | - storeId: os.stoid | ||
| 1292 | - } | 1319 | + data: sto_rq |
| 1293 | }).then(res => { | 1320 | }).then(res => { |
| 1294 | if (res.data.code == 0 && res.data.data.total > 0) { | 1321 | if (res.data.code == 0 && res.data.data.total > 0) { |
| 1295 | plist = res.data.data.pageData[0]; | 1322 | plist = res.data.data.pageData[0]; |
pages/user/order_list/order_list.js
| @@ -110,10 +110,15 @@ Page({ | @@ -110,10 +110,15 @@ Page({ | ||
| 110 | var th=this; | 110 | var th=this; |
| 111 | //---查看会员的等级价--- | 111 | //---查看会员的等级价--- |
| 112 | getApp().getConfig2(function(e) { | 112 | getApp().getConfig2(function(e) { |
| 113 | - th.setData({conf: e,sales_rules:e.sales_rules }); | 113 | + |
| 114 | + | ||
| 115 | + | ||
| 116 | + th.setData({conf: e,sales_rules:e.sales_rules }); | ||
| 114 | //--- 看后台是不是有开通等级卡 --- | 117 | //--- 看后台是不是有开通等级卡 --- |
| 115 | if(e.switch_list){ | 118 | if(e.switch_list){ |
| 116 | var s_list=JSON.parse(e.switch_list); | 119 | var s_list=JSON.parse(e.switch_list); |
| 120 | + th.setData({appoint_pick_keyid:s_list.appoint_pick_keyid}) | ||
| 121 | + | ||
| 117 | var user=getApp().globalData.userInfo; | 122 | var user=getApp().globalData.userInfo; |
| 118 | var is_open_offline=s_list.is_pricing_open; | 123 | var is_open_offline=s_list.is_pricing_open; |
| 119 | //-- 如果后台有开启等级价的功能 -- | 124 | //-- 如果后台有开启等级价的功能 -- |
| @@ -964,7 +969,7 @@ Page({ | @@ -964,7 +969,7 @@ Page({ | ||
| 964 | } | 969 | } |
| 965 | 970 | ||
| 966 | //--如果是线下库存的时候-- | 971 | //--如果是线下库存的时候-- |
| 967 | - if (th.data.conf.sales_rules == 2 && !gg.whsle_id) { | 972 | + if (th.data.conf.sales_rules >= 2 && !gg.whsle_id) { |
| 968 | var ob = {}; | 973 | var ob = {}; |
| 969 | await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) { | 974 | await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) { |
| 970 | ob = obj; | 975 | ob = obj; |
| @@ -1173,26 +1178,41 @@ Page({ | @@ -1173,26 +1178,41 @@ Page({ | ||
| 1173 | async check_down_line_next(gg,num,pick_id,func){ | 1178 | async check_down_line_next(gg,num,pick_id,func){ |
| 1174 | 1179 | ||
| 1175 | var lock=0,pick_no,plist; | 1180 | var lock=0,pick_no,plist; |
| 1181 | + var log_rq={store_id:os.stoid,wareId:gg.goods_id,storageId:pick_id}; | ||
| 1182 | + if(this.data.sales_rules==3){ | ||
| 1183 | + log_rq.appoint_pick_keyid=this.data.appoint_pick_keyid; | ||
| 1184 | + delete log_rq.storageId | ||
| 1185 | + } | ||
| 1176 | //先读取门店的lock | 1186 | //先读取门店的lock |
| 1177 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | 1187 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ |
| 1178 | - data:{store_id:os.stoid,wareId:gg.goods_id,storageId:pick_id} | 1188 | + data:log_rq |
| 1179 | }).then(res=>{ | 1189 | }).then(res=>{ |
| 1180 | if(res.data.code==0 && res.data.data.total>0){ | 1190 | if(res.data.code==0 && res.data.data.total>0){ |
| 1181 | for(var i in res.data.data.pageData) | 1191 | for(var i in res.data.data.pageData) |
| 1182 | lock+=res.data.data.pageData[i].outQty; | 1192 | lock+=res.data.data.pageData[i].outQty; |
| 1183 | } | 1193 | } |
| 1184 | }) | 1194 | }) |
| 1185 | - //先获取门店的编号 | ||
| 1186 | - await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+pick_id,{ | ||
| 1187 | - data:{storeId:os.stoid,goodsId:gg.goods_id,pickupId:pick_id} | ||
| 1188 | - }).then(res=>{ | ||
| 1189 | - if(res.data.code==0){ | ||
| 1190 | - pick_no=res.data.data.pickup_no; | ||
| 1191 | - } | ||
| 1192 | - }) | 1195 | + |
| 1196 | + if(this.data.sales_rules==2) { | ||
| 1197 | + //先获取门店的编号 | ||
| 1198 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick_id, { | ||
| 1199 | + data: {storeId: os.stoid, goodsId: gg.goods_id, pickupId: pick_id} | ||
| 1200 | + }).then(res => { | ||
| 1201 | + if (res.data.code == 0) { | ||
| 1202 | + pick_no = res.data.data.pickup_no; | ||
| 1203 | + } | ||
| 1204 | + }) | ||
| 1205 | + } | ||
| 1206 | + | ||
| 1207 | + var sto_rq={storageNos:pick_no,wareIds:encodeURIComponent(gg.erpwareid),storeId:os.stoid}; | ||
| 1208 | + if(this.data.sales_rules==3){ | ||
| 1209 | + sto_rq.storageIds=this.data.appoint_pick_keyid; | ||
| 1210 | + delete sto_rq.storageNos | ||
| 1211 | + } | ||
| 1212 | + | ||
| 1193 | //读取线下的门店库存 | 1213 | //读取线下的门店库存 |
| 1194 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | 1214 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ |
| 1195 | - data:{storageNos:pick_no,wareIds:encodeURIComponent(gg.erpwareid),storeId:os.stoid} | 1215 | + data:sto_rq |
| 1196 | }).then(res=>{ | 1216 | }).then(res=>{ |
| 1197 | if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ | 1217 | if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){ |
| 1198 | plist=res.data.data.pageData[0]; | 1218 | plist=res.data.data.pageData[0]; |
| @@ -1212,8 +1232,7 @@ Page({ | @@ -1212,8 +1232,7 @@ Page({ | ||
| 1212 | } | 1232 | } |
| 1213 | func(ob) | 1233 | func(ob) |
| 1214 | }, | 1234 | }, |
| 1215 | - | ||
| 1216 | - | 1235 | + |
| 1217 | 1236 | ||
| 1218 | //------图片失败,默认图片--------- | 1237 | //------图片失败,默认图片--------- |
| 1219 | bind_bnerr: function(e) { | 1238 | bind_bnerr: function(e) { |
| @@ -1565,7 +1584,7 @@ Page({ | @@ -1565,7 +1584,7 @@ Page({ | ||
| 1565 | 1584 | ||
| 1566 | 1585 | ||
| 1567 | //判断是不是线下库存的购买, 是不是秒杀活动 | 1586 | //判断是不是线下库存的购买, 是不是秒杀活动 |
| 1568 | - if(th.data.sales_rules==2 && !prom && !good.whsle_id){ | 1587 | + if(th.data.sales_rules>=2 && !prom && !good.whsle_id){ |
| 1569 | 1588 | ||
| 1570 | //-- 看一下购物车上有多少商品 -- | 1589 | //-- 看一下购物车上有多少商品 -- |
| 1571 | var cart_num=0; | 1590 | var cart_num=0; |
| @@ -1590,9 +1609,15 @@ Page({ | @@ -1590,9 +1609,15 @@ Page({ | ||
| 1590 | var lock=0,plist=null; | 1609 | var lock=0,plist=null; |
| 1591 | 1610 | ||
| 1592 | if(b_item.prom_type!=7) { | 1611 | if(b_item.prom_type!=7) { |
| 1612 | + | ||
| 1613 | + var lock_rq= {store_id: os.stoid, wareId: good.goods_id, storageId: b_item.pickup_id, pageSize: 1000}; | ||
| 1614 | + if(th.data.sales_rules==3){ | ||
| 1615 | + lock_rq.appoint_pick_keyid=th.data.appoint_pick_keyid; | ||
| 1616 | + delete lock_rq.storageId; | ||
| 1617 | + } | ||
| 1593 | //先读取门店的lock, | 1618 | //先读取门店的lock, |
| 1594 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | 1619 | await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { |
| 1595 | - data: {store_id: os.stoid, wareId: good.goods_id, storageId: b_item.pickup_id, pageSize: 1000} | 1620 | + data: lock_rq |
| 1596 | }).then(res => { | 1621 | }).then(res => { |
| 1597 | if (res.data.code == 0 && res.data.data.total > 0) { | 1622 | if (res.data.code == 0 && res.data.data.total > 0) { |
| 1598 | for (var i in res.data.data.pageData) | 1623 | for (var i in res.data.data.pageData) |
| @@ -1600,13 +1625,14 @@ Page({ | @@ -1600,13 +1625,14 @@ Page({ | ||
| 1600 | } | 1625 | } |
| 1601 | }) | 1626 | }) |
| 1602 | 1627 | ||
| 1628 | + var sto_rq= { storageNos: pickup.pickup_no, wareIds: encodeURIComponent(good.erpwareid), storeId: os.stoid } | ||
| 1629 | + if(th.data.sales_rules==3){ | ||
| 1630 | + sto_rq.storageIds=th.data.appoint_pick_keyid; | ||
| 1631 | + delete sto_rq.storageNos; | ||
| 1632 | + } | ||
| 1603 | //---通过接口获取门店的线下库存信息-- | 1633 | //---通过接口获取门店的线下库存信息-- |
| 1604 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | 1634 | await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { |
| 1605 | - data: { | ||
| 1606 | - storageNos: pickup.pickup_no, | ||
| 1607 | - wareIds: encodeURIComponent(good.erpwareid), | ||
| 1608 | - storeId: os.stoid | ||
| 1609 | - } | 1635 | + data: sto_rq |
| 1610 | }).then(res => { | 1636 | }).then(res => { |
| 1611 | if (res.data.code == 0 && res.data.data.total > 0) { | 1637 | if (res.data.code == 0 && res.data.data.total > 0) { |
| 1612 | plist = res.data.data.pageData[0]; | 1638 | plist = res.data.data.pageData[0]; |
pages/user/userinfo/userinfo.js
| @@ -225,7 +225,7 @@ Page({ | @@ -225,7 +225,7 @@ Page({ | ||
| 225 | if (th.data.is_show_sto_cat == 1) { | 225 | if (th.data.is_show_sto_cat == 1) { |
| 226 | item = th.data.def_pickpu_list[index]; | 226 | item = th.data.def_pickpu_list[index]; |
| 227 | } else { | 227 | } else { |
| 228 | - item = th.data.only_pk[index]; //当没有门店分类的时候 | 228 | + item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候 |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | } else { | 231 | } else { |