From 45924fd6aefe68b6703120ee8018a202cb5a46a8 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 17 May 2022 17:26:59 +0800
Subject: [PATCH] fix goodsInfo edit
---
src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html | 90 ++++++++++++++++++++++++++++++--------------
1 files changed, 61 insertions(+), 29 deletions(-)
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 66094a8..72b08ec 100644
--- a/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
+++ b/src/main/resources/templates/febs/views/modules/goods/goodsUpdateNew.html
@@ -1,8 +1,8 @@
<div class="layui-fluid layui-anim febs-anim" id="febs-update" lay-title="编辑商品">
<div class="layui-row febs-container">
<div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-body febs-table-full">
+<!-- <div class="layui-card">-->
+<!-- <div class="layui-card-body febs-table-full">-->
<div class="layui-fluid" id="goods-update">
<form class="layui-form" action="" lay-filter="goods-update-form">
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
@@ -36,9 +36,10 @@
<div class="layui-col-lg6">
<label class="layui-form-label febs-form-item-require">商品分类:</label>
<div class="layui-input-block">
- <select name="categoryId" class="categary-addPeoduct">
- <option value="">请选择</option>
- </select>
+<!-- <select name="categoryId" class="categary-addPeoduct">-->
+<!-- <option value="">请选择</option>-->
+<!-- </select>-->
+ <div id="goods-category"></div>
</div>
</div>
</div>
@@ -245,8 +246,8 @@
</div>
</div>
- </div>
- </div>
+<!-- </div>-->
+<!-- </div>-->
</div>
</div>
<style>
@@ -277,7 +278,7 @@
</script>
<!-- 表格操作栏 end -->
<script data-th-inline="javascript">
- layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'dropdown', 'laydate', 'layedit', 'upload', 'element', 'table'], function () {
+ layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree', 'dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect'], function () {
var $ = layui.jquery,
febs = layui.febs,
layer = layui.layer,
@@ -300,6 +301,50 @@
});
formSelects.render();
+
+ layedit.set({ //设置图片接口
+ uploadImage: {
+ url: 'admin/goods/uploadFileBase64', //接口url
+ type: 'post',
+ }
+ });
+ //创建一个编辑器
+ var index = layedit.build('lay_edit', {
+ height: 300
+ });
+ //提交时把值同步到文本域中
+ form.verify({
+ //content富文本域中的lay-verify值
+ goodsDetails: function (value) {
+ return layedit.sync(index);
+ }
+ });
+
+ var category = xmSelect.render({
+ el: '#goods-category',
+ language: 'zn',
+ prop : {
+ value : 'id',
+ children : 'child'
+ },
+ radio: true,
+ clickClose: true,
+ tree: {
+ show: true,
+ //非严格模式
+ strict: false,
+ },
+ data: []
+ })
+
+ febs.get(ctx + 'admin/goodsCategory/categoryTree', null, function(res) {
+ category.update({
+ data : res.data,
+ autoRow: true,
+ });
+
+ initValue();
+ })
var tableSkuData = [];
var tableIns = table.render({
@@ -490,25 +535,6 @@
}
});
- initValue();
- layedit.set({ //设置图片接口
- uploadImage: {
- url: 'admin/goods/uploadFileBase64', //接口url
- type: 'post',
- }
- });
- //创建一个编辑器
- var index = layedit.build('lay_edit', {
- height: 300
- });
- //提交时把值同步到文本域中
- form.verify({
- //content富文本域中的lay-verify值
- goodsDetails: function (value) {
- return layedit.sync(index);
- }
- });
-
function initValue() {
var images = goodsInfo.images;
var thumbs = images.join(",");
@@ -531,6 +557,11 @@
"thumbs": thumbs
});
+ console.log(goodsInfo.categoryId);
+ var arr = [];
+ arr.push(goodsInfo.categoryId)
+ category.setValue(arr);
+
if (goodsInfo.isNormal == 2) {
$(".tc-set").show();
}
@@ -549,7 +580,7 @@
}
$('#demo2').append('<img src="' + goodsInfo.thumb + '" alt="" class="layui-upload-img" style="width: 100px">')
- layedit.setContent(index, "1234", false);
+ layedit.setContent(index, goodsInfo.goodsDetails, false);
tableSkuData = skus;
reloadTable(skus);
}
@@ -565,9 +596,10 @@
});
form.on('submit(goods-update-form-submit)', function (data) {
- console.log(tableSkuData);
+ data.field.goodsType=1;
data.field.mailGoodsSkuDto = tableSkuData;
data.field.delSkuId=delSku;
+ data.field.categoryId = category.getValue('valueStr');
$.ajax({
'url': ctx + 'admin/goods/updateMallGoods',
'type': 'post',
--
Gitblit v1.9.1