From 71e821ab5e6b3014fac9b691d6957bcc09704b70 Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期三, 29 五月 2024 11:45:04 +0800
Subject: [PATCH] 修改定制封面逻辑
---
CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html | 215 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 188 insertions(+), 27 deletions(-)
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html
index fd70cd8..8a920fd 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html
@@ -61,6 +61,12 @@
</div>
</div>
<div class="layui-form-item">
+ <label for="areaId" class="layui-form-label ">鎵�灞炲湴鍖�</label>
+ <div class="layui-input-block layui-inline-4 address-class">
+ <input type="hidden" name="areaId" value="{{d.data.areaId || '' }}">
+ </div>
+ </div>
+ <div class="layui-form-item">
<label for="bn" class="layui-form-label layui-form-required">鍟嗗搧缂栫爜</label>
<div class="layui-input-inline layui-inline-6">
<input name="goods[bn]" id="bn" lay-verType="tips" lay-verify="required|verifybn" value="{{d.data.model.bn }}" class="layui-input" lay-reqText="璇疯緭鍏ュ晢鍝佺紪鐮�" placeholder="璇疯緭鍏ヤ笉瓒呰繃30涓瓧绗﹀唴瀹�" />
@@ -177,7 +183,7 @@
1銆侀�夋嫨瀵瑰簲鐨勩�愬晢鍝佺被鍨嬨�戯紝灏嗚繘鍏ュSKU璐у搧妯″紡銆傚悓鏃跺鏋滅被鍒湁鍙傛暟锛屼篃灏嗚繘琛屾樉绀鸿缃��<br/>
2銆佽缃SKU鍚庯紝鍟嗗搧鏈韩鐨勪环鏍煎彧鍋氬澶栧睍绀虹敤锛屽疄闄呬互杩涘叆鍟嗗搧璇︽儏閫夋嫨涓嶅悓璐у搧涓哄噯銆�<br/>
3銆佽揣鍝丼KU缁勫悎灞炴�у�煎彧鏀寔锛氫腑鏂囥�佽嫳鏂囥�佹暟瀛椼�佸ぇ鍐欑鍙凤紝灏忓啓绗﹀彿涓変釜锛�-銆�/銆�.锛夛級<br/>
- 4銆佽揣鍙峰繀椤讳负SN瀛楁瘝寮�澶�<br/>
+ 4銆佽揣鍝佺紪鐮佸繀椤讳负SN瀛楁瘝寮�澶�<br/>
5銆佸鏋滀笉璁剧疆鍗曡揣鍝侀噸閲忥紝灏嗛粯璁や娇鐢ㄥ晢鍝侀噸閲忎负1涓崟浣嶇殑閲嶉噺銆�
</blockquote>-->
@@ -303,19 +309,24 @@
<tr>
<th>榛樿璐у搧</th>
<th>鍥剧墖</th>
- <th>璐у彿</th>
+ <th>璐у搧缂栫爜</th>
<th>SKU</th>
<th>閲嶉噺(鍏�)</th>
- <th>璧犻�佺Н鍒�</th>
- <th>绉垎鏈�澶�<br />鍙姷閲戦</th>
- <th>搴撳瓨</th>
- <th><i class="required-color">*</i>閿�鍞环</th>
- <th>鎴愭湰浠�</th>
- <th>甯傚満浠�</th>
- <th>涓�绾ц繑鐜�</th>
- <th>浜岀骇杩旂幇</th>
- <th>涓夌骇杩旂幇</th>
+ <!-- <th>璧犻�佺Н鍒�</th>
+ <th>绉垎鏈�澶�<br />鍙姷閲戦</th> -->
+ <th>搴撳瓨鏁伴噺</th>
<th>鍐荤粨搴撳瓨</th>
+ <th style="width: 60px;">寤鸿闆跺敭浠�</th>
+ <th><i class="required-color">*</i>閿�鍞环</th>
+ <th>缁忛攢鍟嗕环</th>
+ <th>鎴愭湰浠�</th>
+
+ <th style="width: 60px;">鎺ㄥ箍缁忛攢鍟嗛噰璐繑鐜�</th>
+ <th>鎺ㄥ箍鐢ㄦ埛璐拱杩旂幇</th>
+ <th style="width: 80px;">鏄惁鏀寔瀹氬埗</th>
+ <!-- <th>浜岀骇杩旂幇</th>
+ <!-- <th>涓夌骇杩旂幇</th> --> -->
+
<th>鎿嶄綔</th>
</tr>
</thead>
@@ -347,7 +358,7 @@
</div>
</td>
<td>
- <input type="text" name="product[sn][]" value="{{item.sn}}" placeholder="璐у彿" class="layui-input layui-inline-3">
+ <input type="text" name="product[sn][]" value="{{item.sn}}" placeholder="璐у搧缂栫爜" class="layui-input layui-inline-3">
</td>
<td>
<input type="hidden" name="product[spesDesc][]" value="{{item.spesDesc}}" placeholder="SKU" class="layui-input">
@@ -356,36 +367,48 @@
<td>
<input type="number" name="product[weight][]" value="{{item.weight}}" placeholder="閲嶉噺" class="layui-input layui-inline-1">
</td>
- <td>
+ <!-- <td>
<input type="number" name="product[points][]" value="{{item.points}}" placeholder="绉垎" class="layui-input layui-inline-1">
- </td>
- <td>
+ </td> -->
+ <!-- <td>
<input type="text" name="product[pointsDeduction][]" value="{{item.pointsDeduction}}" placeholder="閲戦" class="layui-input layui-inline-1">
- </td>
+ </td> -->
<td class="have-add-td">
<input type="number" name="product[stock][]" value="{{item.stock}}" placeholder="搴撳瓨" class="layui-input layui-inline-1 goods-stock">
+ </td>
+ <td>
+ {{item.freezeStock}}
+ </td>
+ <td>
+ <input type="text" name="product[mktprice][]" value="{{item.mktprice}}" placeholder="寤鸿闆跺敭浠�" class="layui-input layui-inline-1">
</td>
<td>
<input type="text" name="product[price][]" value="{{item.price}}" placeholder="閿�鍞环" class="layui-input layui-inline-1">
</td>
<td>
+
+ <input type="text" name="product[distributionPrice][]" value="{{item.distributionPrice||'0'}}" placeholder="缁忛攢鍟嗕环" class="layui-input layui-inline-1">
+ </td>
+ <td>
<input type="text" name="product[costprice][]" value="{{item.costprice}}" placeholder="鎴愭湰浠�" class="layui-input layui-inline-1">
</td>
+
<td>
- <input type="text" name="product[mktprice][]" value="{{item.mktprice}}" placeholder="甯傚満浠�" class="layui-input layui-inline-1">
+ <input type="text" name="product[distributionCutMoney][]" value="{{item.distributionCutMoney||'0'}}" placeholder="鎺ㄥ箍缁忛攢鍟嗛噰璐繑鐜�" class="layui-input layui-inline-1">
</td>
<td>
- <input type="text" name="product[levelOne][]" value="{{item.levelOne}}" placeholder="涓�绾ц繑鐜�" class="layui-input layui-inline-1">
+ <input type="text" name="product[cutMoney][]" value="{{item.cutMoney||'0'}}" placeholder="鎺ㄥ箍鏅�氱敤鎴疯喘涔拌繑鐜�" class="layui-input layui-inline-1">
</td>
<td>
+ <input type="checkbox" name="product[isCustomizable][]" {{item.isCustomizable==true? 'checked':""}} value="{{item.isCustomizable||'false'}}" title="鏀寔|涓嶆敮鎸�" lay-skin="switch" lay-filter="isCustomizable" >
+ </td>
+ <!-- <td>
<input type="text" name="product[levelTwo][]" value="{{item.levelTwo}}" placeholder="浜岀骇杩旂幇" class="layui-input layui-inline-1">
</td>
<td>
<input type="text" name="product[levelThree][]" value="{{item.levelThree}}" placeholder="涓夌骇杩旂幇" class="layui-input layui-inline-1">
- </td>
- <td>
- {{item.freezeStock}}
- </td>
+ </td> -->
+
<td>
<a class="layui-btn layui-btn-danger layui-btn-xs del-class" lay-active="delTr">鍒犻櫎</a>
</td>
@@ -462,11 +485,11 @@
<div class="layui-input-inline">
<button type="button" class="layui-btn layui-btn-warm layui-btn-sm" lay-active="getGenerateSpecBtn"><i class="layui-icon layui-icon-export"></i>鐢熸垚SKU璐у搧鍒楄〃</button>
</div>
- <div class="layui-input-inline">
+ <!-- <div class="layui-input-inline">
<button type="button" class="aKeySetBtn layui-btn layui-btn-warm layui-btn-sm">
<i class="layui-icon layui-icon-set"></i>涓�閿缃�
</button>
- </div>
+ </div> -->
</div>
</div>
<div id="more_spec"></div>
@@ -560,7 +583,7 @@
</div>
</div>
<div class="layui-form-item">
- <label class="layui-form-label">甯傚満浠�</label>
+ <label class="layui-form-label">鎸囧闆跺敭浠�</label>
<div class="layui-input-inline layui-inline-2">
<input class="layui-input" id="oneKeySetMktPrice">
</div>
@@ -633,6 +656,8 @@
<input type="checkbox" name="skuAttrValue" value="{{item}}" title="{{item}}" lay-filter="skuAttrValue-filter">
{{# }); }}
</script>
+
+ <script src="/views/liao.js"></script>
<script>
var $;
@@ -758,6 +783,119 @@
var btn = $('#openSpecBtn');
$(btn).html("鍙栨秷SKU");
}
+ /*****************************************************************/
+ //鍦板尯閫夋嫨
+
+ var expensiveItems = d.data.categories.data.filter(function(item) {
+ return item.price > 100;
+ });
+ var areaid=0;
+ var arelist= d.data.model?.areaCode?.split(",");
+
+ if(Array.isArray(arelist))
+ {
+ var u= arelist[arelist.length - 1]
+ let num = Number(u);
+ if(!Number.isNaN(num))
+ {
+ areaid=num;
+ }
+ }
+
+
+ coreHelper.Post("Api/Tools/GetAreaCheckedList", { id: areaid}, function (data) {
+
+
+ var str = "";
+ $.each(data, function (i, n) {
+
+ str += "<select lay-ignore name='areaId_" + (i + 1) + "' dep='" + (i + 1) + "' class='select-address'>";
+ str += `<option value= ${(d.data.areaId??0)===0?" selected='selected'":''} >璇烽�夋嫨</option>`;
+ if(n.list.length>0)
+ { $.each(n.list, function (h, z) {
+ if (n.hasOwnProperty('info') && n.info?.id == z.id) {
+ str += "<option value='" + z.id + "' selected='selected'>" + z.name + "</option>";
+ } else {
+ str += "<option value='" + z.id + "' >" + z.name + "</option>";
+ }
+ });
+ }
+ else
+ {
+ $.each(n.thisList, function (h, z) {
+ if (n.hasOwnProperty('info') && n.info?.id == z.id) {
+ str += "<option value='" + z.id + "' selected='selected'>" + z.name + "</option>";
+ } else {
+ str += "<option value='" + z.id + "' >" + z.name + "</option>";
+ }
+ });
+ }
+ str += "</select>";
+ });
+ $("input[name='areaId']").after(str);
+ //浠ヤ笂鏁版嵁杈撳嚭瀹岋紝浠ヤ笅缁戝畾浜嬩欢
+ $.each(data, function (i, n) {
+
+ if (i < (data.length)) {
+ $("select[name='areaId_" + (i + 1) + "']").change(function () {
+ changeareaIdArea(i + 1, data.length);
+ });
+ }
+ });
+ });
+
+ function changeareaIdArea(i, max_i) {
+
+ //娓呴櫎鍚庨潰鑺傜偣
+ for (var x = i + 1; x <= 6; x++) { //鏈�澶�6灞傦紝瓒冲浜�
+ $("select[name='areaId_" + x + "']").remove();
+ }
+ var val = $("select[name='areaId_" + i + "']").val();
+ if (val != "") {
+ //鍙栧瓙鑺傜偣鏁版嵁锛岀劧鍚庢樉绀轰笅涓�绾�
+ coreHelper.Post("Api/Tools/GetAreaChildren", { id: val }, function (e) {
+ if (debug) { console.log(e); } //寮�鍚皟璇曡繑鍥炴暟鎹�
+
+ if (e.length > 0) {
+ var str = "";
+ str += "<select lay-ignore name='areaId_" + (i + 1) + "' dep='" + (i + 1) + "' class='select-address'>";
+ str += "<option value='' >璇烽�夋嫨</option>";
+ $.each(e, function (h, z) {
+ str += "<option value='" + z.id + "' >" + z.name + "</option>";
+ });
+ str += "</select>";
+ $("select[name='areaId_" + i + "']").after(str);
+ //浠ヤ笂鏁版嵁杈撳嚭瀹岋紝浠ヤ笅缁戝畾浜嬩欢
+ $("select[name='areaId_" + (i + 1) + "']").change(function () {
+ changeareaIdArea(i + 1, i + 2);
+ });
+
+ //濡傛灉鏈夎繑鍥炲�硷紝灏辫鏄庣渷甯傚尯娌℃湁閫夋嫨鍒版渶缁堣妭鐐�
+ if (1 == 1) {
+ $("input[name='areaId']").val("");
+ } else {
+ $("input[name='areaId']").val($("select[name='areaId_" + i + "']").val());
+ }
+ } else {
+ $("input[name='areaId']").val($("select[name='areaId_" + i + "']").val());
+ }
+ });
+ } else {
+ if (1 == 1) {
+ $("input[name='areaId']").val("");
+ } else {
+ //绗竴绾х殑鍏冪礌灏辩洿鎺ヨ祴鍊间负绌哄氨鏄簡
+ if (i == 1) {
+ $("input[name='areaId']").val("");
+ } else {
+ i--;
+ $("input[name='areaId']").val($("select[name='areaId_" + i + "']").val());
+ }
+
+ }
+ }
+ }
+ /*****************************************************************/
// 娓叉煋鍟嗗搧鍒嗙被
var insXmSelGoodsCategoryId = xmSelect.render({
@@ -943,7 +1081,12 @@
});
}
});
-
+ // 鐩戝惉寮�鍏冲垏鎹簨浠�
+ form.on('switch(isCustomizable)', function(data){
+ var elem = data.elem; // 褰撳墠寮�鍏冲厓绱�
+ elem.value=true;
+
+ });
//鍥鹃泦涓婁紶
$('#upBtnimageIds').click(function () {
cropperImg.cropImg({
@@ -1168,7 +1311,7 @@
form.verify({
money: [/((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/, '璇疯緭鍏ラ噾棰�'],
verifybn: [/^[\S]{0,30}$/, '鍟嗗搧缂栫爜鏈�澶у彧鍏佽杈撳叆30浣嶅瓧绗︼紝涓斾笉鑳藉嚭鐜扮┖鏍�'],
- verifysn: [/^[\S]{0,30}$/, '璐у彿鏈�澶у彧鍏佽杈撳叆30浣嶅瓧绗︼紝涓斾笉鑳藉嚭鐜扮┖鏍�'],
+ verifysn: [/^[\S]{0,30}$/, '璐у搧缂栫爜鏈�澶у彧鍏佽杈撳叆30浣嶅瓧绗︼紝涓斾笉鑳藉嚭鐜扮┖鏍�'],
verifyname: [/^.{0,200}$/, '鍟嗗搧鍚嶇О鏈�澶у彧鍏佽杈撳叆200浣嶅瓧绗�'],
verifybrief: [/^.{0,255}$/, '鍟嗗搧绠�浠嬫渶澶у彧鍏佽杈撳叆255浣嶅瓧绗︼紝涓斾笉鑳藉嚭鐜扮┖鏍�'],
verifyimageIds: [/^[\S]{0,255}$/, '榛樿鍥剧墖 鍥剧墖id鏈�澶у彧鍏佽杈撳叆255浣嶅瓧绗︼紝涓斾笉鑳藉嚭鐜扮┖鏍�'],
@@ -1817,6 +1960,18 @@
goods.stock = field['goods[stock]'];
goods.unit = field['goods[unit]'];
goods.weight = field['goods[weight]'];
+ goods.areaCode='';
+
+ if (isNumericString(field["areaId_1"])) {
+ goods.areaCode+=`${field["areaId_1"]}`;
+ if (isNumericString(field["areaId_2"]))
+ goods.areaCode+=`,${field["areaId_2"]}`;
+ if (isNumericString(field["areaId_3"]))
+ goods.areaCode+=`,${field["areaId_3"]}`;
+ } else {
+
+ }
+
goods.openSpec = parseInt(field.openSpec);
//澶氬弬鏁颁骇鍝佸簱鐢熸垚鍒楄〃闆嗗悎
var products = [];
@@ -1848,7 +2003,13 @@
productModel.levelThree = field['product[levelThree][' + i + ']'];
productModel.pointsDeduction = field['product[pointsDeduction][' + i + ']'];
productModel.points = field['product[points][' + i + ']'];
+ //娣诲姞 鐧惧垎鍏垫硶
+ productModel.isCustomizable = field['product[isCustomizable][' + i + ']'];
+ productModel.distributionPrice = field['product[distributionPrice][' + i + ']'];
+ productModel.distributionCutMoney = field['product[distributionCutMoney][' + i + ']'];
+ productModel.cutMoney = field['product[cutMoney][' + i + ']'];
products.push(productModel);
+
}
//浼氬憳浠锋牸妯″瀷
var gradePrice = [];
--
Gitblit v1.9.1