Edit.cshtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. @using MySystem.Models;
  2. @{ProductNormTemp editData = ViewBag.data as ProductNormTemp;}
  3. @{
  4. string RightInfo = ViewBag.RightInfo as string;
  5. string right = ViewBag.right as string;
  6. }
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <meta charset="utf-8">
  11. <title>商品规格模板(修改)</title>
  12. <meta name="renderer" content="webkit">
  13. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  15. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  16. <script src="/admin/js/jquery-1.10.1.min.js"></script>
  17. <script src="/admin/js/LAreaData2.js"></script>
  18. <script src="/admin/js/vue.min.js"></script>
  19. </head>
  20. <body>
  21. <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
  22. <input type="hidden" name="Id" value="@editData.Id" />
  23. <input type="hidden" id="TempJsonData" name="TempJsonData" value="@editData.TempJsonData" />
  24. <div class="layui-card">
  25. <div class="layui-card-body">
  26. <div class="layui-tab" lay-filter="mytabbar">
  27. <div class="layui-tab-content mt20" id="app">
  28. <div class="layui-tab-item layui-show">
  29. <div class="layui-form-item">
  30. <label class="layui-form-label">模板名称</label>
  31. <div class="layui-input-block">
  32. <input class="layui-input" type="text" id="Name" name="Name" value="@editData.Name" maxlength="50" autocomplete="off" placeholder="请输入模板名称">
  33. </div>
  34. </div>
  35. <div class="layui-form-item">
  36. <label class="layui-form-label">商品规格</label>
  37. <div class="layui-input-block">
  38. <div>
  39. <table width="100%" v-for="item,i in itemList">
  40. <thead>
  41. <tr style="height:30px; line-height:30px; background-color:#eee;">
  42. <th style="padding:10px;width:60px;">规格名:</th>
  43. <th style="padding:10px;">
  44. <input class="layui-input" style="width:150px;" type="text" maxlength="20" lay-verify="" autocomplete="off" placeholder="请输入规格名" v-model="item.name">
  45. </th>
  46. <th style="padding:10px;width:150px;">
  47. <input type="button" value="上移" v-on:click="toup(i)" />
  48. <input type="button" value="下移" v-on:click="todown(i)" />
  49. <input type="button" value="删除" v-on:click="del(i)" />
  50. </th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. <tr style="height:30px; line-height:30px;">
  55. <td style="padding:10px;width:60px;">规格值:</td>
  56. <td style="padding:10px;">
  57. <div style="float:left;width:150px;margin-right:5px;" v-for="subitem,j in item.vallist">
  58. <input class="layui-input" type="text" maxlength="20" lay-verify="" autocomplete="off" placeholder="请输入规格值" v-model="subitem.name">
  59. <input type="button" value="左移" v-on:click="toleftsub(item,j)" />
  60. <input type="button" value="右移" v-on:click="torightsub(item,j)" />
  61. <input type="button" value="删除" v-on:click="delsub(item,j)" />
  62. </div>
  63. </td>
  64. <td style="padding:10px;">
  65. <input type="button" class="layui-btn" value="增加" v-on:click="addsub(item)" />
  66. </td>
  67. </tr>
  68. </tbody>
  69. </table>
  70. </div>
  71. <table width="100%">
  72. <tr style="height:30px; line-height:30px;">
  73. <td style="padding:10px;">
  74. <input type="button" class="layui-btn" value="添加项" v-on:click="add" />
  75. </td>
  76. </tr>
  77. </table>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="layui-tab-item">
  82. <div class="layui-form-item">
  83. <label class="layui-form-label">网页标题</label>
  84. <div class="layui-input-block">
  85. <input class="layui-input" type="text" id="SeoTitle" name="SeoTitle" value="@editData.SeoTitle" maxlength="50" autocomplete="off" placeholder="请输入网页标题">
  86. </div>
  87. </div>
  88. <div class="layui-form-item">
  89. <label class="layui-form-label">网页关键字</label>
  90. <div class="layui-input-block">
  91. <input class="layui-input" type="text" id="SeoKeyword" name="SeoKeyword" value="@editData.SeoKeyword" maxlength="50" autocomplete="off" placeholder="请输入网页关键字">
  92. </div>
  93. </div>
  94. <div class="layui-form-item layui-form-text">
  95. <label class="layui-form-label">网页描述</label>
  96. <div class="layui-input-block">
  97. <textarea class="layui-textarea" name="SeoDescription" id="SeoDescription" placeholder="请输入网页描述">@editData.SeoDescription</textarea>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="layui-form-item layui-hide">
  104. <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit" value="确认">
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <script src="/layuiadmin/layui/layui.js"></script>
  110. <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
  111. <script src="/other/mybjq/kindeditor-min.js"></script>
  112. <script src="/other/mybjq/lang/zh_CN.js"></script>
  113. <script>//编辑器
  114. KindEditor.ready(function (K) {
  115. });
  116. var ids = "";
  117. function getChildren(obj) {
  118. $.each(obj, function (index, value) {
  119. var id = obj[index].id;
  120. ids += id + ",";
  121. var children = obj[index].children;
  122. if (children) {
  123. getChildren(children);
  124. }
  125. });
  126. }
  127. function AreasProvinceInit(tagId, areasVal, form, func) {
  128. for (var i = 0; i < provs_data.length; i++) {
  129. var sel = "";
  130. if (areasVal.indexOf(provs_data[i].text) > -1) {
  131. sel = " selected=selected";
  132. }
  133. $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' + provs_data[i].text + '</option>');
  134. }
  135. form.render();
  136. func();
  137. }
  138. function AreasProvinceSelected(tagId, areasVal, form, value, func) {
  139. $("#" + tagId + "City").html('<option value="">市</option>');
  140. var list = citys_data[value];
  141. for (var i = 0; i < list.length; i++) {
  142. var sel = "";
  143. if (areasVal.indexOf(list[i].text) > -1) {
  144. sel = " selected=selected";
  145. }
  146. $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
  147. }
  148. $("#" + tagId + "Area").html('<option value="">县/区</option>');
  149. form.render();
  150. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  151. func();
  152. }
  153. function AreasCitySelected(tagId, areasVal, form, value, func) {
  154. $("#" + tagId + "Area").html('<option value="">县/区</option>');
  155. var list = dists_data[value];
  156. for (var i = 0; i < list.length; i++) {
  157. var sel = "";
  158. if (areasVal.indexOf(list[i].text) > -1) {
  159. sel = " selected=selected";
  160. }
  161. $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
  162. }
  163. form.render();
  164. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  165. func();
  166. }
  167. function AreasAreaSelected(tagId, form) {
  168. form.render();
  169. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  170. }
  171. function movePrev(obj, tagId) {
  172. $(obj).parent().prev().insertAfter($(obj).parent());
  173. checkPics(tagId);
  174. }
  175. function moveNext(obj, tagId) {
  176. $(obj).parent().next().insertBefore($(obj).parent());
  177. checkPics(tagId);
  178. }
  179. function deletePic(obj, tagId) {
  180. $(obj).parent().remove();
  181. checkPics(tagId);
  182. }
  183. function checkPics(tagId) {
  184. var pics = "";
  185. var texts = "";
  186. $("#" + tagId + "Image div img").each(function (i) {
  187. pics += $(this).attr("src").replace(osshost, '') + "|";
  188. });
  189. $("#" + tagId + "Image div input").each(function (i) {
  190. texts += $(this).val() + "|";
  191. });
  192. if (pics == "") {
  193. $("#" + tagId).val("");
  194. } else {
  195. pics = pics.substring(0, pics.length - 1);
  196. texts = texts.substring(0, pics.length - 1);
  197. $("#" + tagId).val(pics + "#cut#" + texts);
  198. }
  199. }
  200. function checkBox(tagId) {
  201. var text = "";
  202. $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
  203. text += $(this).val() + ",";
  204. });
  205. $("#" + tagId).val(text);
  206. }
  207. function showBigPic(picpath) {
  208. parent.layer.open({
  209. type: 1,
  210. title: false,
  211. closeBtn: 0,
  212. shadeClose: true,
  213. area: ['auto', 'auto'],
  214. content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
  215. });
  216. }
  217. var app;
  218. var tree;
  219. layui.config({
  220. base: '/layuiadmin/' //静态资源所在路径
  221. }).extend({
  222. index: 'lib/index' //主入口模块
  223. }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
  224. var $ = layui.$
  225. , form = layui.form
  226. , element = layui.element
  227. , layer = layui.layer
  228. , layedit = layui.layedit
  229. , laydate = layui.laydate
  230. , croppers = layui.croppers
  231. , upload = layui.upload
  232. , transfer = layui.transfer
  233. , util = layui.util;
  234. tree = layui.tree;
  235. //Hash地址的定位
  236. var layid = location.hash.replace(/^#test=/, '');
  237. element.tabChange('test', layid);
  238. element.on('tab(test)', function (elem) {
  239. location.hash = 'test=' + $(this).attr('lay-id');
  240. });
  241. //日期
  242. //上传文件
  243. //穿梭框
  244. //TreeView,比如权限管理
  245. //省市区
  246. //加载vue
  247. app = new Vue({
  248. el: '#app',
  249. data() {
  250. return {
  251. itemList: @(Html.Raw(editData.TempJsonData)),
  252. };
  253. },
  254. mounted() {
  255. },
  256. methods: {
  257. add() {
  258. this.itemList.push({
  259. id: '0',
  260. name: '',
  261. vallist: [
  262. {
  263. id: '0',
  264. name: '',
  265. }
  266. ],
  267. });
  268. },
  269. toup(index) {
  270. if (index > 0) {
  271. var sub = this.itemList[index - 1];
  272. this.itemList[index - 1] = this.itemList[index];
  273. this.itemList[index] = sub;
  274. this.$forceUpdate();
  275. }
  276. },
  277. todown(index) {
  278. if (index < this.itemList.length-1) {
  279. var sub = this.itemList[index + 1];
  280. this.itemList[index + 1] = this.itemList[index];
  281. this.itemList[index] = sub;
  282. this.$forceUpdate();
  283. }
  284. },
  285. del(index) {
  286. if (this.itemList.length > 1) {
  287. this.itemList.splice(index, 1);
  288. }
  289. },
  290. addsub(item) {
  291. item.vallist.push({
  292. id: '0',
  293. name: '',
  294. });
  295. },
  296. toleftsub(item, index) {
  297. if (index > 0) {
  298. var sub = item.vallist[index - 1];
  299. item.vallist[index - 1] = item.vallist[index];
  300. item.vallist[index] = sub;
  301. this.$forceUpdate();
  302. }
  303. },
  304. torightsub(item, index) {
  305. if (index < item.vallist.length-1) {
  306. var sub = item.vallist[index + 1];
  307. item.vallist[index + 1] = item.vallist[index];
  308. item.vallist[index] = sub;
  309. this.$forceUpdate();
  310. }
  311. },
  312. delsub(item, index) {
  313. if (item.vallist.length > 1) {
  314. item.vallist.splice(index, 1);
  315. }
  316. },
  317. }
  318. });
  319. })
  320. </script>
  321. </body>
  322. </html>