From 063e40d8f159f6d02a7ac421d8f3fb1c694d7aab Mon Sep 17 00:00:00 2001
From: liaoxujun@qq.com <liaoxujun@qq.com>
Date: 星期三, 06 三月 2024 08:49:42 +0800
Subject: [PATCH] no message

---
 CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html |  135 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 122 insertions(+), 13 deletions(-)

diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html
index a90f7d1..c140783 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/good/goods/create.html
@@ -61,6 +61,13 @@
                                 <div class="layui-form-mid layui-word-aux">
                                     <button href="javascript:void(0);" class="add-brand layui-btn layui-btn-normal layui-btn-xs">娣诲姞鍝佺墝</button>
                                 </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">
+                                    </div>
+                                </div>
                             </div>
 
                             <div class="layui-form-item">
@@ -278,7 +285,7 @@
                                                         <i class="layui-icon layui-icon-set"></i>纭畾
                                                     </button>
                                                 </div>
-                                                <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="oneKeySetLevelOne">
                                                 </div>
@@ -443,15 +450,15 @@
                 <th>璐у彿</th>
                 <th>SKU</th>
                 <th>閲嶉噺(鍏�)</th>
-                <th>璧犻�佺Н鍒�</th>
-                <th>绉垎鏈�澶�<br />鍙姷閲戦</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>浜岀骇杩旂幇</th>
+                <th>涓夌骇杩旂幇</th> -->
                 <th>鎿嶄綔</th>
             </tr>
         </thead>
@@ -492,12 +499,12 @@
                 <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>
@@ -511,14 +518,14 @@
                     <input type="text" name="product[mktprice][]" value="{{item.mktprice}}" 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[levelOne][]" value="{{item.levelOne}}" placeholder="缁忛攢鍟嗚繑鐜�" class="layui-input layui-inline-1">
                 </td>
-                <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> -->
                 <td>
                     <a class="layui-btn layui-btn-danger layui-btn-xs del-class" lay-active="delTr">鍒犻櫎</a>
                 </td>
@@ -623,6 +630,7 @@
         {{#  }); }}
     </select>
 </script>
+<script src="/views/liao.js"></script>
 <!--//涓�閿缃甋KU鍥剧墖鏃惰嚜鍔ㄧ敓鎴愰�変腑鐨凷KU-->
 <script id="imageSetMoreSku_tpl" type="text/html">
     {{# layui.each(d, function(index, item){  }}
@@ -702,7 +710,99 @@
                         'Authorization': Authorization
                     }
                 });
+                /*****************************************************************/
+                //鍦板尯閫夋嫨
+                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());
+                            }
+
+                        }
+                    }
+                }
+                coreHelper.Post("Api/Tools/GetAreaCheckedList", { id: 0 }, 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);
+                            });
+                        }
+                    });
+                });
+                 /*****************************************************************/
                 //鑾峰彇鍟嗗搧绫诲瀷
                 types = d.data.types;
                 // 娓叉煋鍟嗗搧鍒嗙被
@@ -1731,6 +1831,15 @@
                         goods.unit = field['goods[unit]'];
                         goods.weight = field['goods[weight]'];
                         goods.openSpec = parseInt(field.openSpec);
+                        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 {
+                           
+                          }
                         //澶氬弬鏁颁骇鍝佸簱鐢熸垚鍒楄〃闆嗗悎
                         var products = [];
                         var productsCount = parseInt(field['productsCount']);

--
Gitblit v1.9.1