Commit 464e4daecee43bd4a84214fc8106dc92322cb3e3

Authored by taiyuan
1 parent 03f7613b

上下架商品修改和我的小店价格排序修改

app.wxss
... ... @@ -16,6 +16,9 @@
16 16 .pdt20 {
17 17 padding-top: 20rpx;
18 18 }
  19 +.pdb0 {
  20 + padding-bottom: 0 !important;
  21 +}
19 22 .pdb20 {
20 23 padding-bottom: 20rpx;
21 24 }
... ...
packageA/pages/distribution/goods/goods.js
... ... @@ -637,35 +637,45 @@ Page({
637 637 let checkedArr = this.data.checkedArr;
638 638 let checkedList = this.handleValues(checkedArr);
639 639  
640   - app.request.promisePost('/api/weshop/users/distribut/UpGoods', {
641   - is_json: true,
642   - data: {
643   - storeId: app.globalData.setting.stoid,
644   - userId: app.globalData.user_id,
645   - goods: checkedList,
646   - searchtype: 2,
647   - },
648   - }).then(function(res) {
649   - if(res.data.code == 0) {
650   - self.setData({
651   - isCheckAll: false,
652   - });
653   - wx.showToast({
654   - title: '上架成功',
655   - icon: 'success',
656   - duration: 1000,
657   - });
  640 + if(checkedArr && checkedArr.length != 0 ) {
  641 + app.request.promisePost('/api/weshop/users/distribut/UpGoods', {
  642 + is_json: true,
  643 + data: {
  644 + storeId: app.globalData.setting.stoid,
  645 + userId: app.globalData.user_id,
  646 + goods: checkedList,
  647 + searchtype: 2,
  648 + },
  649 + }).then(function(res) {
  650 + if(res.data.code == 0) {
  651 + self.setData({
  652 + isCheckAll: false,
  653 + checkedArr: null,
  654 + });
  655 + wx.showToast({
  656 + title: '上架成功',
  657 + icon: 'success',
  658 + duration: 1000,
  659 + });
  660 +
  661 + self.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery, false);
  662 + } else {
  663 + wx.showToast({
  664 + title: '上架失败',
  665 + icon: 'success',
  666 + duration: 1000,
  667 + });
  668 + }
658 669  
659   - self.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery, false);
660   - } else {
661   - wx.showToast({
662   - title: '上架失败',
663   - icon: 'success',
664   - duration: 1000,
665   - });
666   - }
667   -
668   - });
  670 + });
  671 + } else {
  672 + wx.showToast({
  673 + title: '请选择上架商品',
  674 + icon: 'none',
  675 + duration: 1000,
  676 + });
  677 + };
  678 +
669 679 },
670 680  
671 681 /**
... ... @@ -677,39 +687,51 @@ Page({
677 687 userId: app.globalData.user_id,
678 688 };
679 689 let isCheckAll = this.data.isCheckAll;
  690 + let checkedArr = this.data.checkedArr;
680 691  
681 692 if(isCheckAll) {
682 693 // console.log('全选啦~');
683 694 data.type = 1;
684 695 } else {
685   - let checkedArr = this.data.checkedArr;
686   - let checkedList = this.handleValues(checkedArr);
  696 + // var checkedArr = this.data.checkedArr;
  697 + var checkedList = this.handleValues(checkedArr);
687 698 data.goods = checkedList;
688 699 };
689 700  
690   - app.request.promisePost('/api/weshop/users/distribut/DownGoods', {
691   - is_json: true,
692   - data: data,
693   - }).then(function(res) {
694   - if(res.data.code == 0) {
695   - self.setData({
696   - isCheckAll: false,
697   - });
698   - wx.showToast({
699   - title: '下架成功',
700   - icon: 'success',
701   - duration: 1000,
702   - });
703   - self.getData(true, '/api/weshop/goods/page?dis_type=1&searchtype=1', self.data.currentQuery, false);
704   - } else {
705   - wx.showToast({
706   - title: '下架失败',
707   - icon: 'success',
708   - duration: 1000,
709   - });
710   - }
711   -
712   - });
  701 +
  702 + if(checkedArr && checkedArr.length != 0) {
  703 + app.request.promisePost('/api/weshop/users/distribut/DownGoods', {
  704 + is_json: true,
  705 + data: data,
  706 + }).then(function(res) {
  707 + if(res.data.code == 0) {
  708 + self.setData({
  709 + isCheckAll: false,
  710 + checkedArr: null,
  711 + });
  712 + wx.showToast({
  713 + title: '下架成功',
  714 + icon: 'success',
  715 + duration: 1000,
  716 + });
  717 + self.getData(true, '/api/weshop/goods/page?dis_type=1&searchtype=1', self.data.currentQuery, false);
  718 + } else {
  719 + wx.showToast({
  720 + title: '下架失败',
  721 + icon: 'success',
  722 + duration: 1000,
  723 + });
  724 + }
  725 +
  726 + });
  727 + } else {
  728 + wx.showToast({
  729 + title: '请选择下架商品',
  730 + icon: 'none',
  731 + duration: 1000,
  732 + });
  733 + };
  734 +
713 735 },
714 736  
715 737 /**
... ...
packageA/pages/distribution/goods/goods.wxml
... ... @@ -68,7 +68,7 @@
68 68 </view>
69 69  
70 70  
71   - <view class="content">
  71 + <view class="content {{(options.index == 1 && currentTabIndex ==1) ? 'pdb0':''}}">
72 72 <checkbox-group class="fs26" wx:if="{{isShowRow}}" bindchange="checkboxChange">
73 73 <view class="item bg-white flex ai-center pd16" wx:for="{{list.pageData}}">
74 74 <!-- <label>
... ... @@ -219,7 +219,7 @@
219 219 <view class="pd20 fs26 flex jc_sb fdc f1">
220 220 <view class="ellipsis-2">{{item.goods_name}}</view>
221 221 <view class="flex ai-center pdt20">
222   - <checkbox value="{{item.goods_id}}" checked="{{item.checked}}" data-name="checkbox"/>
  222 + <checkbox value="{{item.goods_id}}" checked="{{item.checked}}" data-name="checkbox" wx:if="{{!(options.index == 1 && currentTabIndex ==1)}}"/>
223 223 <view>
224 224 <!-- 判断是否有活动价 -->
225 225 <block wx:if="{{item.prom_price>0 || item.prom_integral>0}}">
... ... @@ -362,9 +362,9 @@
362 362  
363 363  
364 364  
365   - <view class="bottomBar flex pd20 jc_sb fs26 ai-center">
  365 + <view class="bottomBar flex pd20 jc_sb fs26 ai-center" wx:if="{{!(options.index == 1 && currentTabIndex ==1)}}">
366 366 <!-- <view> -->
367   - <label class="flex ai-center" bindtap="clickCheckAll">
  367 + <label class="flex ai-center" bindtap="clickCheckAll" wx:if="{{!(options.index == 1 && currentTabIndex ==1)}}">
368 368 <checkbox checked="{{isCheckAll}}"/>全选
369 369 </label>
370 370 <!-- </view> -->
... ...
packageA/pages/distribution/shop/shop.js
... ... @@ -407,7 +407,8 @@ Page({
407 407 */
408 408 clickSort(e) {
409 409 let data = this.data.currentQuery;
410   - data.orderField = 'shop_price';
  410 + // data.orderField = 'shop_price';
  411 + data.orderField = 'prom_price';
411 412 if(data.page) {
412 413 delete data.page;
413 414 };
... ...