From 71f2eb9359fb4e4d9caaf4fd07bcc2b50e7674ac Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 10 Feb 2023 15:45:19 +0800
Subject: [PATCH] 增加样品功能 增加一个规格为样品
---
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsService.java | 3 +
src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java | 2 +
src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html | 36 +++++++++++++-----
src/main/java/cc/mrbird/febs/mall/vo/AdminMailGoodsSkuDetailVo.java | 2 +
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html | 41 +++++++++++++-------
src/main/java/cc/mrbird/febs/mall/dto/MailGoodsSkuDto.java | 2 +
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java | 2 +
7 files changed, 64 insertions(+), 24 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java b/src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java
index 1d474b0..3622b08 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/AddMallGoodsSkuDto.java
@@ -27,4 +27,6 @@
//重量
private BigDecimal goodsWeight;
+ private String sample;
+
}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/MailGoodsSkuDto.java b/src/main/java/cc/mrbird/febs/mall/dto/MailGoodsSkuDto.java
index f333a2f..21c8fc6 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/MailGoodsSkuDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/MailGoodsSkuDto.java
@@ -35,4 +35,6 @@
//重量
private BigDecimal goodsWeight;
+ private String sample;
+
}
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java b/src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java
index d52c147..226b5d4 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java
@@ -40,4 +40,6 @@
private String styleName;
//重量
private BigDecimal goodsWeight;
+
+ private String sample;
}
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 9a89674..e46312b 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
@@ -212,6 +212,7 @@
mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
mallGoodsSku.setGoodsId(mallGoods.getId());
mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
+ mallGoodsSku.setSample(addMallGoodsSkuDto.getSample());
mallGoodsSkuMapper.insert(mallGoodsSku);
}
}
@@ -489,6 +490,7 @@
mallGoodsSku.setGoodsId(mallGoods.getId());
mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
+ mallGoodsSku.setSample(addMallGoodsSkuDto.getSample());
mallGoodsSkuMapper.updateById(mallGoodsSku);
} else {
//新增商品规格
@@ -504,6 +506,7 @@
mallGoodsSku.setCostPrice(addMallGoodsSkuDto.getCostPrice());
mallGoodsSku.setGoodsId(mallGoods.getId());
mallGoodsSku.setGoodsWeight(addMallGoodsSkuDto.getGoodsWeight());
+ mallGoodsSku.setSample(addMallGoodsSkuDto.getSample());
mallGoodsSkuMapper.insert(mallGoodsSku);
}
}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminMailGoodsSkuDetailVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminMailGoodsSkuDetailVo.java
index c360f71..7eb3409 100644
--- a/src/main/java/cc/mrbird/febs/mall/vo/AdminMailGoodsSkuDetailVo.java
+++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminMailGoodsSkuDetailVo.java
@@ -34,4 +34,6 @@
@ApiModelProperty(value = "现价")
private BigDecimal presentPrice;
+
+ private String sample;
}
diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
index 7c7b589..78817b4 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsAddNew.html
@@ -240,8 +240,17 @@
<input type="text" name="addMallGoodsSkuDtos" autocomplete="off" class="layui-input" id="attrName">
</div>
</div>
- <div class="layui-col-lg6">
- <button type="button" class="layui-btn layui-btn-normal layui-btn" id="test3" >添加</button>
+ <div class="layui-col-lg1">
+ <button type="button"
+ class="layui-btn layui-btn-normal layui-btn" id="test3">
+ 添加
+ </button>
+ </div>
+ <div class="layui-col-lg1">
+ <button type="button"
+ class="layui-btn layui-btn-normal layui-btn" id="test4">
+ 新增样品
+ </button>
</div>
</div>
@@ -406,15 +415,16 @@
,cols: [[ //表头
{type: 'checkbox'}
,{field: 'index', title: '序号', width:70}
- ,{field: 'styleName', title: '样式', edit:'text'}
- ,{field: 'skuName', title: '规格', edit:'text'}
- ,{field: 'goodsWeight', title: '重量', edit:'text'}
- ,{field: 'presentPrice', title: '现价', edit:'text'}
- ,{field: 'originalPrice', title: '原价', edit:'text'}
- ,{field: 'costPrice', title: '成本价', edit:'text'}
+ ,{field: 'styleName', title: '样式', edit:'text', width:200}
+ ,{field: 'skuName', title: '规格', edit:'text', width:200}
+ ,{field: 'sample', title:'样品', width:100}
+ ,{field: 'goodsWeight', title: '重量', edit:'text', width:100}
+ ,{field: 'presentPrice', title: '现价', edit:'text', width:100}
+ ,{field: 'originalPrice', title: '原价', edit:'text', width:100}
+ ,{field: 'costPrice', title: '成本价', edit:'text', width:100}
,{templet: '#tableImgUpload', title: '缩略图', width:150}
- ,{field: 'stock', title: '库存', edit:'text'}
- ,{field: 'skuVolume', title: '销量', edit:'text'}
+ ,{field: 'stock', title: '库存', edit:'text', width:100}
+ ,{field: 'skuVolume', title: '销量', edit:'text', width:100}
,{field: 'skuImage', title: '缩略图地址', hide:true}
]]
,data: []
@@ -519,6 +529,12 @@
addTableDate(data);
});
+ $('#test4').on('click', function () {
+ var data = {};
+ data.sample = "样品";
+ addTableDate(data);
+ });
+
function bindUpload(index) {
// 普通图片上传
upload.render({
diff --git a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
index 70576a0..393bbf6 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -269,10 +269,16 @@
class="layui-input" id="attrName">
</div>
</div>
- <div class="layui-col-lg6">
+ <div class="layui-col-lg3">
<button type="button"
class="layui-btn layui-btn-normal layui-btn" id="test3">
添加
+ </button>
+ </div>
+ <div class="layui-col-lg3">
+ <button type="button"
+ class="layui-btn layui-btn-normal layui-btn" id="test4">
+ 新增样品
</button>
</div>
</div>
@@ -439,19 +445,20 @@
, defaultToolbar: []
, cols: [[ //表头
{type: 'checkbox'}
- , {field: 'index', title: '序号', width: 70}
- , {field: 'styleName', title: '样式', edit: 'text'}
- , {field: 'skuName', title: '规格', edit: 'text'}
- , {field: 'goodsWeight', title: '重量', edit:'text'}
- , {field: 'presentPrice', title: '现价', edit: 'text'}
- , {field: 'originalPrice', title: '原价', edit: 'text'}
- , {field: 'costPrice', title: '成本价', edit: 'text'}
- , {templet: '#tableImgUpload', title: '缩略图', width: 150}
- , {field: 'stock', title: '库存', edit: 'text'}
- , {field: 'skuVolume', title: '销量', edit: 'text'}
- , {field: 'skuImage', title: '缩略图地址', hide: true}
- , {field: 'id', title: 'skuId', hide: true}
- , {field: 'styleId', title: 'styleId', hide: true}
+ ,{field: 'index', title: '序号', width: 70}
+ ,{field: 'styleName', title: '样式', edit:'text', width:200}
+ ,{field: 'skuName', title: '规格', edit:'text', width:200}
+ ,{field: 'sample', title:'样品', width:100}
+ ,{field: 'goodsWeight', title: '重量', edit:'text', width:100}
+ ,{field: 'presentPrice', title: '现价', edit:'text', width:100}
+ ,{field: 'originalPrice', title: '原价', edit:'text', width:100}
+ ,{field: 'costPrice', title: '成本价', edit:'text', width:100}
+ ,{templet: '#tableImgUpload', title: '缩略图', width:150}
+ ,{field: 'stock', title: '库存', edit:'text', width:100}
+ ,{field: 'skuVolume', title: '销量', edit:'text', width:100}
+ ,{field: 'skuImage', title: '缩略图地址', hide: true}
+ ,{field: 'id', title: 'skuId', hide: true}
+ ,{field: 'styleId', title: 'styleId', hide: true}
]]
, data: []
});
@@ -560,6 +567,12 @@
addTableDate(data);
});
+ $('#test4').on('click', function () {
+ var data = {};
+ data.sample = "样品";
+ addTableDate(data);
+ });
+
function bindUpload(index) {
// 普通图片上传
upload.render({
--
Gitblit v1.9.1