From 464e4daecee43bd4a84214fc8106dc92322cb3e3 Mon Sep 17 00:00:00 2001 From: taiyuan Date: Sat, 17 Apr 2021 10:03:05 +0800 Subject: [PATCH] 上下架商品修改和我的小店价格排序修改 --- app.wxss | 3 +++ packageA/pages/distribution/goods/goods.js | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------- packageA/pages/distribution/goods/goods.wxml | 8 ++++---- packageA/pages/distribution/shop/shop.js | 3 ++- 4 files changed, 84 insertions(+), 58 deletions(-) diff --git a/app.wxss b/app.wxss index cef3f5e..a0c24ef 100644 --- a/app.wxss +++ b/app.wxss @@ -16,6 +16,9 @@ .pdt20 { padding-top: 20rpx; } +.pdb0 { + padding-bottom: 0 !important; +} .pdb20 { padding-bottom: 20rpx; } diff --git a/packageA/pages/distribution/goods/goods.js b/packageA/pages/distribution/goods/goods.js index 21e4745..aa18b73 100644 --- a/packageA/pages/distribution/goods/goods.js +++ b/packageA/pages/distribution/goods/goods.js @@ -637,35 +637,45 @@ Page({ let checkedArr = this.data.checkedArr; let checkedList = this.handleValues(checkedArr); - app.request.promisePost('/api/weshop/users/distribut/UpGoods', { - is_json: true, - data: { - storeId: app.globalData.setting.stoid, - userId: app.globalData.user_id, - goods: checkedList, - searchtype: 2, - }, - }).then(function(res) { - if(res.data.code == 0) { - self.setData({ - isCheckAll: false, - }); - wx.showToast({ - title: '上架成功', - icon: 'success', - duration: 1000, - }); + if(checkedArr && checkedArr.length != 0 ) { + app.request.promisePost('/api/weshop/users/distribut/UpGoods', { + is_json: true, + data: { + storeId: app.globalData.setting.stoid, + userId: app.globalData.user_id, + goods: checkedList, + searchtype: 2, + }, + }).then(function(res) { + if(res.data.code == 0) { + self.setData({ + isCheckAll: false, + checkedArr: null, + }); + wx.showToast({ + title: '上架成功', + icon: 'success', + duration: 1000, + }); + + self.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery, false); + } else { + wx.showToast({ + title: '上架失败', + icon: 'success', + duration: 1000, + }); + } - self.getData(true, '/api/weshop/goods/page?is_mainshow=1&isonsale=1&dis_type=1', self.data.currentQuery, false); - } else { - wx.showToast({ - title: '上架失败', - icon: 'success', - duration: 1000, - }); - } - - }); + }); + } else { + wx.showToast({ + title: '请选择上架商品', + icon: 'none', + duration: 1000, + }); + }; + }, /** @@ -677,39 +687,51 @@ Page({ userId: app.globalData.user_id, }; let isCheckAll = this.data.isCheckAll; + let checkedArr = this.data.checkedArr; if(isCheckAll) { // console.log('全选啦~'); data.type = 1; } else { - let checkedArr = this.data.checkedArr; - let checkedList = this.handleValues(checkedArr); + // var checkedArr = this.data.checkedArr; + var checkedList = this.handleValues(checkedArr); data.goods = checkedList; }; - app.request.promisePost('/api/weshop/users/distribut/DownGoods', { - is_json: true, - data: data, - }).then(function(res) { - if(res.data.code == 0) { - self.setData({ - isCheckAll: false, - }); - wx.showToast({ - title: '下架成功', - icon: 'success', - duration: 1000, - }); - self.getData(true, '/api/weshop/goods/page?dis_type=1&searchtype=1', self.data.currentQuery, false); - } else { - wx.showToast({ - title: '下架失败', - icon: 'success', - duration: 1000, - }); - } - - }); + + if(checkedArr && checkedArr.length != 0) { + app.request.promisePost('/api/weshop/users/distribut/DownGoods', { + is_json: true, + data: data, + }).then(function(res) { + if(res.data.code == 0) { + self.setData({ + isCheckAll: false, + checkedArr: null, + }); + wx.showToast({ + title: '下架成功', + icon: 'success', + duration: 1000, + }); + self.getData(true, '/api/weshop/goods/page?dis_type=1&searchtype=1', self.data.currentQuery, false); + } else { + wx.showToast({ + title: '下架失败', + icon: 'success', + duration: 1000, + }); + } + + }); + } else { + wx.showToast({ + title: '请选择下架商品', + icon: 'none', + duration: 1000, + }); + }; + }, /** diff --git a/packageA/pages/distribution/goods/goods.wxml b/packageA/pages/distribution/goods/goods.wxml index 7fad048..07874bd 100644 --- a/packageA/pages/distribution/goods/goods.wxml +++ b/packageA/pages/distribution/goods/goods.wxml @@ -68,7 +68,7 @@ - + @@ -362,9 +362,9 @@ - + -