From 581d11ebf7a7713acaf881883971362d74e1bf45 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Sat, 24 Oct 2020 21:50:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=B9=B3=E5=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../addGroupBuyProduct/addGroupBuyProduct.js | 2 +- .../deleteGroupBuyProduct.html | 19 +++++++ .../deleteGroupBuyProduct.js | 52 +++++++++++++++++++ .../editGroupBuyProduct.html | 6 +-- .../editGroupBuyProduct.js | 37 ++++--------- .../groupBuyProductManage.html | 2 +- .../groupBuyProductManage.js | 2 +- 7 files changed, 87 insertions(+), 33 deletions(-) create mode 100644 public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.html create mode 100644 public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.js diff --git a/public/components/goods/addGroupBuyProduct/addGroupBuyProduct.js b/public/components/goods/addGroupBuyProduct/addGroupBuyProduct.js index 3a00ca38d..72a876ff0 100644 --- a/public/components/goods/addGroupBuyProduct/addGroupBuyProduct.js +++ b/public/components/goods/addGroupBuyProduct/addGroupBuyProduct.js @@ -151,7 +151,7 @@ }, _closeAddProduct: function () { $that.clearAddProductInfo(); - vc.emit('productManage', 'listProduct', {}); + vc.emit('groupBuyProductManage', 'listProduct', {}); }, _initAddGroupBuyProduct: function () { let $summernote = $('.summernote').summernote({ diff --git a/public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.html b/public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.html new file mode 100644 index 000000000..3889a7d8c --- /dev/null +++ b/public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.html @@ -0,0 +1,19 @@ + diff --git a/public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.js b/public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.js new file mode 100644 index 000000000..ecff451a0 --- /dev/null +++ b/public/components/goods/deleteGroupBuyProduct/deleteGroupBuyProduct.js @@ -0,0 +1,52 @@ +(function(vc,vm){ + + vc.extends({ + data:{ + deleteGroupBuyProductInfo:{ + + } + }, + _initMethod:function(){ + + }, + _initEvent:function(){ + vc.on('deleteGroupBuyProduct','openDeleteGroupBuyProductModal',function(_params){ + + vc.component.deleteGroupBuyProductInfo = _params; + $('#deleteGroupBuyProductModel').modal('show'); + + }); + }, + methods:{ + deleteGroupBuyProduct:function(){ + vc.component.deleteGroupBuyProductInfo.communityId=vc.getCurrentCommunity().communityId; + vc.http.apiPost( + '/groupBuy/deleteGroupBuyProduct', + JSON.stringify(vc.component.deleteGroupBuyProductInfo), + { + emulateJSON:true + }, + function(json,res){ + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + let _json = JSON.parse(json); + if (_json.code == 0) { + //关闭model + $('#deleteGroupBuyProductModel').modal('hide'); + vc.emit('groupBuyProductManage', 'listProduct', {}); + return ; + } + vc.message(_json.msg); + }, + function(errInfo,error){ + console.log('请求失败处理'); + vc.message(json); + + }); + }, + closeDeleteGroupBuyProductModel:function(){ + $('#deleteGroupBuyProductModel').modal('hide'); + } + } + }); + +})(window.vc,window.vc.component); diff --git a/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.html b/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.html index 82bc2338f..2ae5c6938 100644 --- a/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.html +++ b/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.html @@ -138,16 +138,14 @@
- + v-on:click="_closeEditProduct()">取消
- - \ No newline at end of file diff --git a/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.js b/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.js index dcefcb7eb..8c563c08f 100644 --- a/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.js +++ b/public/components/goods/editGroupBuyProduct/editGroupBuyProduct.js @@ -7,6 +7,7 @@ }, data: { editGroupBuyProductInfo: { + groupId: '', productId: '', groupProdName: '', prodName: '', @@ -26,24 +27,10 @@ vc.on('editGroupBuyProduct', 'openEditProductModal', function (_product) { //加载数据 - vc.copyObject(_product,$that.editGroupBuyProductInfo); + vc.copyObject(_product, $that.editGroupBuyProductInfo); $that._loadGroupProductInfo(_product); }); - vc.on('editGroupBuyProduct', 'chooseProduct', function (_product) { - vc.copyObject(_product, $that.editGroupBuyProductInfo); - $that.editGroupBuyProductInfo.groupProdDesc = _product.prodDesc; - $that.editGroupBuyProductInfo.groupProdName = _product.prodName; - $that._loadProductInfo(_product.productId); - }); - vc.on("editGroupBuyProduct", "notifyUploadCoverImage", function (_param) { - if (_param.length > 0) { - vc.component.editGroupBuyProductInfo.coverPhoto = _param[0]; - } else { - vc.component.editGroupBuyProductInfo.coverPhoto = ''; - } - - }); vc.on("editGroupBuyProduct", "notifyUploadCarouselFigureImage", function (_param) { vc.component.editGroupBuyProductInfo.carouselFigurePhoto = _param; }); @@ -113,14 +100,14 @@ ] }); }, - saveProductInfo: function () { + updateProductInfo: function () { if (!vc.component.editGroupBuyProductValidate()) { vc.toast(vc.validate.errInfo); return; } vc.http.apiPost( - '/groupBuy/saveGroupBuyProduct', + '/groupBuy/updateGroupBuyProduct', JSON.stringify(vc.component.editGroupBuyProductInfo), { emulateJSON: true @@ -140,8 +127,9 @@ }); }, - clearAddProductInfo: function () { + clearEditProductInfo: function () { vc.component.editGroupBuyProductInfo = { + groupId: '', productId: '', groupProdName: '', prodName: '', @@ -153,9 +141,9 @@ productSpecs: [] }; }, - _closeAddProduct: function () { - $that.clearAddProductInfo(); - vc.emit('productManage', 'listProduct', {}); + _closeEditProduct: function () { + $that.clearEditProductInfo(); + vc.emit('groupBuyProductManage', 'listProduct', {}); }, _initEditGroupBuyProduct: function () { let $summernote = $('.editSummernote').summernote({ @@ -218,9 +206,6 @@ }); }, - _openChooseProductModal: function () { - vc.emit('chooseProduct', 'openChooseProductModel', {}); - }, _loadGroupProductInfo: function (_product) { var param = { params: { @@ -237,11 +222,11 @@ let _productInfo = JSON.parse(json); let _product = _productInfo.data[0]; - $that.editGroupBuyProductInfo.productSpecs = _product.productSpecValues; + $that.editGroupBuyProductInfo.productSpecs = _product.groupBuyProductSpecs; $that.editGroupBuyProductInfo.content = _product.content; $(".editSummernote").summernote('code', _product.content); - let _productSpecValues = _product.productSpecValues; + let _productSpecValues = _product.groupBuyProductSpecs; _productSpecValues.forEach(item => { let _productSpecDetails = item.productSpecDetails; diff --git a/public/pages/goods/groupBuyProductManage/groupBuyProductManage.html b/public/pages/goods/groupBuyProductManage/groupBuyProductManage.html index d67fe1864..042a87a67 100644 --- a/public/pages/goods/groupBuyProductManage/groupBuyProductManage.html +++ b/public/pages/goods/groupBuyProductManage/groupBuyProductManage.html @@ -115,6 +115,6 @@
- + \ No newline at end of file diff --git a/public/pages/goods/groupBuyProductManage/groupBuyProductManage.js b/public/pages/goods/groupBuyProductManage/groupBuyProductManage.js index 0e1f9430b..0851753be 100644 --- a/public/pages/goods/groupBuyProductManage/groupBuyProductManage.js +++ b/public/pages/goods/groupBuyProductManage/groupBuyProductManage.js @@ -68,7 +68,7 @@ vc.emit('editGroupBuyProduct', 'openEditProductModal', _product); }, _openDeleteProductModel: function (_product) { - vc.emit('deleteProduct', 'openDeleteProductModal', _product); + vc.emit('deleteGroupBuyProduct','openDeleteGroupBuyProductModal', _product); }, _queryProductMethod: function () { vc.component._listProducts(DEFAULT_PAGE, DEFAULT_ROWS);