From 1f61b13ac9e766aea061d80148052036ddc4f682 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 11 Apr 2023 14:10:46 +0800
Subject: [PATCH] 后台修改

---
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java |    4 ++--
 src/main/resources/templates/febs/views/modules/score/goodsUpdate.html    |    2 ++
 src/main/resources/templates/febs/views/modules/score/goodsAdd.html       |    3 +++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
index 14dcdcf..e20bc4b 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java
@@ -335,13 +335,13 @@
         MallGoods mallGoods = mallGoodsMapper.selectById(mallGoodsUpdateDto.getId());
 
         // 若原来不为多规格或编辑后也不为多规格,则清空样式和规格
-        if (mallGoods.getIsSku() == 2 || mallGoodsUpdateDto.getIsSku() == 2) {
+        if (2 == mallGoodsUpdateDto.getIsSku()|| 2 == (mallGoods.getIsSku() == null ? 1 : mallGoods.getIsSku())) {
             mallGoodsSkuMapper.deleteByGoodsId(mallGoods.getId());
             mallGoodsStyleMapper.deleteByGoodsId(mallGoods.getId());
         }
 
         BeanUtil.copyProperties(mallGoodsUpdateDto, mallGoods);
-        if (mallGoods.getHasCarriage() == 2) {
+        if (2 == mallGoods.getHasCarriage()) {
             mallGoods.setCarriage(BigDecimal.ZERO);
         }
 
diff --git a/src/main/resources/templates/febs/views/modules/score/goodsAdd.html b/src/main/resources/templates/febs/views/modules/score/goodsAdd.html
index 9e5facf..d66b904 100644
--- a/src/main/resources/templates/febs/views/modules/score/goodsAdd.html
+++ b/src/main/resources/templates/febs/views/modules/score/goodsAdd.html
@@ -231,6 +231,9 @@
 
         form.on('submit(score-goods-add-form-submit)', function (data) {
             data.field.goodsType = 2;
+            data.field.isSku = 2;
+            data.field.hasCarriage = 2;
+            data.field.presentPrice = data.field.originalPrice;
             data.field.goodsDetails = editor.getHtml();
             $.ajax({
                 'url':ctx + 'admin/goods/addMallGoods',
diff --git a/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html b/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html
index 5b39b1f..ad02f7a 100644
--- a/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html
+++ b/src/main/resources/templates/febs/views/modules/score/goodsUpdate.html
@@ -275,6 +275,8 @@
 
         form.on('submit(score-goods-update-form-submit)', function (data) {
             data.field.goodsType = 2;
+            data.field.isSku = 1;
+            data.field.hasCarriage = 2;
             $.ajax({
                 'url':ctx + 'admin/goods/updateMallGoods',
                 'type':'post',

--
Gitblit v1.9.1