Add.cshtml 16 KB

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