From 29045b28aed633b6fc3a5d8644a444c9726b4e17 Mon Sep 17 00:00:00 2001 From: liaoxujun@qq.com <liaoxujun@qq.com> Date: 星期一, 04 三月 2024 09:12:30 +0800 Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/baifenbaishop --- CoreCms.Net.Web.Admin/wwwroot/views/good/goods/edit.html | 133 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 133 insertions(+), 0 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..189d0ab 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涓瓧绗﹀唴瀹�" /> @@ -634,6 +640,8 @@ {{# }); }} </script> + <script src="/views/liao.js"></script> + <script> var $; var debug = layui.setter.debug; @@ -758,6 +766,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({ @@ -1817,6 +1938,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 = []; -- Gitblit v1.9.1