From 01e86dd31e86e3f0eb0fbf6aca792e27b98f0a10 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Wed, 28 Oct 2020 11:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chooseLabelProduct.html | 62 +++++++++++++++++ .../chooseLabelProduct/chooseLabelProduct.js | 66 +++++++++++++++++++ .../deleteLabelProduct.html | 19 ++++++ .../deleteLabelProduct/deleteLabelProduct.js | 52 +++++++++++++++ .../recommendGoodsManage.html | 10 ++- .../recommendGoodsManage.js | 50 +++++++++++++- 6 files changed, 255 insertions(+), 4 deletions(-) create mode 100644 public/components/goods/chooseLabelProduct/chooseLabelProduct.html create mode 100644 public/components/goods/chooseLabelProduct/chooseLabelProduct.js create mode 100644 public/components/goods/deleteLabelProduct/deleteLabelProduct.html create mode 100644 public/components/goods/deleteLabelProduct/deleteLabelProduct.js diff --git a/public/components/goods/chooseLabelProduct/chooseLabelProduct.html b/public/components/goods/chooseLabelProduct/chooseLabelProduct.html new file mode 100644 index 000000000..2683d7a5b --- /dev/null +++ b/public/components/goods/chooseLabelProduct/chooseLabelProduct.html @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/public/components/goods/chooseLabelProduct/chooseLabelProduct.js b/public/components/goods/chooseLabelProduct/chooseLabelProduct.js new file mode 100644 index 000000000..c557e7acd --- /dev/null +++ b/public/components/goods/chooseLabelProduct/chooseLabelProduct.js @@ -0,0 +1,66 @@ +(function (vc) { + vc.extends({ + propTypes: { + emitChooseProduct: vc.propTypes.string, + emitLoadData: vc.propTypes.string + }, + data: { + chooseLabelProductInfo: { + products: [], + _currentProductName: '', + labelCd: '' + } + }, + _initMethod: function () { + }, + _initEvent: function () { + vc.on('chooseLabelProduct', 'openChooseProductModel', function (_param) { + $('#chooseLabelProductModel').modal('show'); + vc.component._refreshChooseProductInfo(); + $that.chooseLabelProductInfo.labelCd = _param.labelCd; + vc.component._loadAllProductInfo(1, 10, ''); + }); + }, + methods: { + _loadAllProductInfo: function (_page, _row, _name) { + var param = { + params: { + page: _page, + row: _row, + labelCd: $that.chooseLabelProductInfo.labelCd, + hasProduct: 'N' + } + }; + + //发送get请求 + vc.http.apiGet('/product/queryProductLabel', + param, + function (json) { + var _productInfo = JSON.parse(json); + vc.component.chooseLabelProductInfo.products = _productInfo.data; + }, function () { + console.log('请求失败处理'); + } + ); + }, + chooseLabelProduct: function (_product) { + if (_product.hasOwnProperty('name')) { + _product.productName = _product.name; + } + vc.emit($props.emitChooseProduct, 'chooseLabelProduct', _product); + vc.emit($props.emitLoadData, 'listProductData', { + productId: _product.productId + }); + $('#chooseLabelProductModel').modal('hide'); + }, + queryProducts: function () { + vc.component._loadAllProductInfo(1, 10, vc.component.chooseLabelProductInfo._currentProductName); + }, + _refreshChooseProductInfo: function () { + vc.component.chooseLabelProductInfo._currentProductName = ""; + vc.component.chooseLabelProductInfo.labelCd = ""; + } + } + + }); +})(window.vc); diff --git a/public/components/goods/deleteLabelProduct/deleteLabelProduct.html b/public/components/goods/deleteLabelProduct/deleteLabelProduct.html new file mode 100644 index 000000000..c71c066f3 --- /dev/null +++ b/public/components/goods/deleteLabelProduct/deleteLabelProduct.html @@ -0,0 +1,19 @@ + diff --git a/public/components/goods/deleteLabelProduct/deleteLabelProduct.js b/public/components/goods/deleteLabelProduct/deleteLabelProduct.js new file mode 100644 index 000000000..61dcca2c5 --- /dev/null +++ b/public/components/goods/deleteLabelProduct/deleteLabelProduct.js @@ -0,0 +1,52 @@ +(function(vc,vm){ + + vc.extends({ + data:{ + deleteLabelProductInfo:{ + + } + }, + _initMethod:function(){ + + }, + _initEvent:function(){ + vc.on('deleteLabelProduct','openDeleteLabelProductModal',function(_params){ + + vc.component.deleteLabelProductInfo = _params; + $('#deleteLabelProductModel').modal('show'); + + }); + }, + methods:{ + deleteLabelProduct:function(){ + vc.component.deleteLabelProductInfo.communityId=vc.getCurrentCommunity().communityId; + vc.http.apiPost( + '/product/deleteProductLabel', + JSON.stringify(vc.component.deleteLabelProductInfo), + { + emulateJSON:true + }, + function(json,res){ + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + let _json = JSON.parse(json); + if (_json.code == 0) { + //关闭model + $('#deleteLabelProductModel').modal('hide'); + vc.emit('recommendGoodsManage', 'listProduct',{}); + return ; + } + vc.toast(_json.msg); + }, + function(errInfo,error){ + console.log('请求失败处理'); + vc.toast(errInfo); + + }); + }, + closeDeleteLabelProductModel:function(){ + $('#deleteLabelProductModel').modal('hide'); + } + } + }); + +})(window.vc,window.vc.component); diff --git a/public/pages/goods/recommendGoodsManage/recommendGoodsManage.html b/public/pages/goods/recommendGoodsManage/recommendGoodsManage.html index 2250b66a3..5d6958cf3 100644 --- a/public/pages/goods/recommendGoodsManage/recommendGoodsManage.html +++ b/public/pages/goods/recommendGoodsManage/recommendGoodsManage.html @@ -43,6 +43,11 @@
推荐商品
+
+ +
@@ -68,7 +73,7 @@
+ v-on:click="openDeleteLabelProductModel(product)">删除
@@ -87,4 +92,7 @@
+ + + \ No newline at end of file diff --git a/public/pages/goods/recommendGoodsManage/recommendGoodsManage.js b/public/pages/goods/recommendGoodsManage/recommendGoodsManage.js index 91f857a74..1ba56e30b 100644 --- a/public/pages/goods/recommendGoodsManage/recommendGoodsManage.js +++ b/public/pages/goods/recommendGoodsManage/recommendGoodsManage.js @@ -16,7 +16,8 @@ prodName: '', productId: '', barCode: '', - labelCd:'8800012001' + labelCd: '8800012001', + hasProduct:'Y' } } }, @@ -25,6 +26,11 @@ }, _initEvent: function () { + + vc.on('recommendGoodsManage', 'chooseLabelProduct', function (_param) { + $that._saveProductLabel(_param); + }); + vc.on('recommendGoodsManage', 'listProduct', function (_param) { $that.recommendGoodsManageInfo.componentShow = 'recommendGoodsManage'; vc.component._listProducts(DEFAULT_PAGE, DEFAULT_ROWS); @@ -59,6 +65,38 @@ } ); }, + + _saveProductLabel: function (_product) { + let _date = { + productId: _product.productId, + storeId: _product.storeId, + labelCd: '8800012001' + }; + + vc.http.apiPost( + '/product/saveProductLabel', + JSON.stringify(_date), + { + emulateJSON: true + }, + function (json, res) { + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + let _json = JSON.parse(json); + if (_json.code == 0) { + //关闭model + vc.emit('recommendGoodsManage', 'listProduct', {}); + return; + } + vc.message(_json.msg); + + }, + function (errInfo, error) { + console.log('请求失败处理'); + + vc.message(errInfo); + + }); + }, _queryProductMethod: function () { vc.component._listProducts(DEFAULT_PAGE, DEFAULT_ROWS); @@ -69,9 +107,15 @@ } else { vc.component.recommendGoodsManageInfo.moreCondition = true; } + }, + openChooseLabelProductModel: function () { + vc.emit('chooseLabelProduct', 'openChooseProductModel', { + labelCd: '8800012001' + }); + }, + openDeleteLabelProductModel: function (_product) { + vc.emit('deleteLabelProduct','openDeleteLabelProductModal', _product); } - - } }); })(window.vc);