goods.blade.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', trans('商品详情'))
  4. <script type="text/javascript">
  5. window.type = "{{$goods['type']}}";
  6. window.virtual = "{{$goods['virtual']}}";
  7. $(function () {
  8. $(':radio[name=type]').click(function () {
  9. window.type = $("input[name='type']:checked").val();
  10. window.virtual = $("#virtual").val();
  11. if (window.type == '1') {
  12. $('#dispatch_info').show();
  13. } else {
  14. $('#dispatch_info').hide();
  15. }
  16. if (window.type == '3') {
  17. if ($('#virtual').val() == '0') {
  18. $('.choosetemp').show();
  19. }
  20. }
  21. })
  22. $("input[name='back']").click(function () {
  23. location.href = "{!! yzWebUrl('plugin.hotel.admin.goods.index') !!}";
  24. });
  25. })
  26. window.optionchanged = false;
  27. require(['bootstrap'], function () {
  28. $('#myTab a').click(function (e) {
  29. e.preventDefault();
  30. $(this).tab('show');
  31. })
  32. });
  33. require(['util'], function (u) {
  34. $('#cp').each(function () {
  35. u.clip(this, $(this).text());
  36. });
  37. })
  38. function formcheck() {
  39. window.type = $("input[name='goods[type]']:checked").val();
  40. window.virtual = $("#virtual").val();
  41. var reg = /(^[-+]?[1-9]\d*(\.\d{1,2})?$)|(^[-+]?[0]{1}(\.\d{1,2})?$)/; //金额字段验证,后两位小数
  42. var numerictype = /^(0|[1-9]\d*)$/; //整数验证
  43. var thumb = /\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/;
  44. var datetime = /(\d{2}|\d{4})(?:\-)?([0]{1}\d{1}|[1]{1}[0-2]{1})(?:\-)?([0-2]{1}\d{1}|[3]{1}[0-1]{1})(?:\s)?([0-1]{1}\d{1}|[2]{1}[0-3]{1})(?::)?([0-5]{1}\d{1})(?::)?([0-5]{1}\d{1})/;
  45. if ($(':input[name="goods[title]"]').val() == '') {
  46. $('#myTab a[href="#tab_basic"]').tab('show');
  47. Tip.focus("#goodsname", "请输入商品名称!");
  48. return false;
  49. }
  50. if ($(':input[name="goods[title]"]').val().length >= '40') {
  51. $('#myTab a[href="#tab_basic"]').tab('show');
  52. Tip.focus("#goodsname", "商品名称不能超过40个字符!");
  53. return false;
  54. }
  55. if ($(':input[name="category[parentid]"]').val() == 0) {
  56. $('#myTab a[href="#tab_basic"]').tab('show');
  57. Tip.focus(':input[name="category[parentid]"]', "请选择一级分类!");
  58. return false;
  59. }
  60. if ($(':input[name="category[childid]"]').val() == 0) {
  61. $('#myTab a[href="#tab_basic"]').tab('show');
  62. Tip.focus(':input[name="category[childid]"]', "请选择二级分类!");
  63. return false;
  64. }
  65. @if($shopset['cat_level'] == 3)
  66. if ($(':input[name="category[thirdid]"]').val() == 0) {
  67. $('#myTab a[href="#tab_basic"]').tab('show');
  68. Tip.focus(':input[name="category[thirdid]"]', "请选择三级分类!");
  69. return false;
  70. }
  71. @endif
  72. // if ($('#brand').val() == 0) {
  73. // $('#myTab a[href="#tab_basic"]').tab('show');
  74. // alert('请选择品牌');
  75. // return false;
  76. // }
  77. if ($(':input[name="goods[sku]"]').val() == '') {
  78. $('#myTab a[href="#tab_basic"]').tab('show');
  79. Tip.focus(':input[name="goods[sku]"]', "请输入商品单位!");
  80. return false;
  81. }
  82. @if (empty($id))
  83. if ($.trim($(':input[name="goods[thumb]"]').val()) == '') {
  84. $('#myTab a[href="#tab_basic"]').tab('show');
  85. Tip.focus(':input[name="goods[thumb]"]', '请上传缩略图.');
  86. return false;
  87. } else {
  88. if (!thumb.test($.trim($(':input[name="goods[thumb]"]').val()))) {
  89. $('#myTab a[href="#tab_basic"]').tab('show');
  90. Tip.focus(':input[name="goods[thumb]"]', '图片类型必须是.gif,jpeg,jpg,png中的一种.');
  91. return false;
  92. }
  93. }
  94. @endif
  95. // if ($.trim($(':input[name="goods[price]"]').val()) == '') {
  96. // $('#myTab a[href="#tab_basic"]').tab('show');
  97. // Tip.focus(':input[name="goods[price]"]', '请填写价格.');
  98. // return false;
  99. // } else {
  100. // if (!reg.test($(':input[name="goods[price]"]').val())) {
  101. // $('#myTab a[href="#tab_basic"]').tab('show');
  102. // Tip.focus(':input[name="goods[price]"]', '价格格式错误,最多两位小数.');
  103. // return false;
  104. // }
  105. // }
  106. // if ($.trim($(':input[name="goods[market_price]"]').val()) == '') {
  107. // $('#myTab a[href="#tab_basic"]').tab('show');
  108. // Tip.focus(':input[name="goods[market_price]"]', '请填写价格.');
  109. // return false;
  110. // } else {
  111. // if (!reg.test($(':input[name="goods[market_price]"]').val())) {
  112. // $('#myTab a[href="#tab_basic"]').tab('show');
  113. // Tip.focus(':input[name="goods[market_price]"]', '价格格式错误,最多两位小数.');
  114. // return false;
  115. // }
  116. // }
  117. // if ($.trim($(':input[name="goods[cost_price]"]').val()) == '') {
  118. // $('#myTab a[href="#tab_basic"]').tab('show');
  119. // Tip.focus(':input[name="goods[cost_price]"]', '请填写价格.');
  120. // return false;
  121. // } else {
  122. // if (!reg.test($(':input[name="goods[cost_price]"]').val())) {
  123. // $('#myTab a[href="#tab_basic"]').tab('show');
  124. // Tip.focus(':input[name="goods[cost_price]"]', '价格格式错误,最多两位小数.');
  125. // return false;
  126. // }
  127. // }
  128. if ($(':input[name="goods[stock]"]').val() == '') {
  129. $('#myTab a[href="#tab_basic"]').tab('show');
  130. Tip.focus(':input[name="goods[stock]"]', "请输入库存!");
  131. return false;
  132. } else {
  133. if (!numerictype.test($(':input[name="goods[stock]"]').val())) {
  134. $('#myTab a[href="#tab_basic"]').tab('show');
  135. Tip.focus(':input[name="goods[stock]"]', '库存格式错误,只能为非负整数.');
  136. return false;
  137. }
  138. }
  139. @section('widget_js')
  140. if (!numerictype.test($(':input[name="widgets[sale][max_point_deduct]"]').val()) && $(':input[name="widgets[sale][max_point_deduct]"]').val() != '') {
  141. $('#myTab a[href="#tab_sale"]').tab('show');
  142. Tip.focus(':input[name="widgets[sale][max_point_deduct]"]', '积分抵扣格式错误,只能为非负整数或空.');
  143. return false;
  144. }
  145. /*if ($(':input[name="widgets[sale][max_point_deduct]"]').val() == '') {
  146. $('#myTab a[href="#tab_sale"]').tab('show');
  147. Tip.focus(':input[name="widgets[sale][max_point_deduct]"]', "请输入积分抵扣!");
  148. return false;
  149. } else {
  150. if (!numerictype.test($(':input[name="widgets[sale][max_point_deduct]"]').val())) {
  151. $('#myTab a[href="#tab_sale"]').tab('show');
  152. Tip.focus(':input[name="widgets[sale][max_point_deduct]"]', '积分抵扣格式错误,只能为非负整数.');
  153. return false;
  154. }
  155. }*/
  156. /*if ($(':input[name="widgets[sale][max_balance_deduct]"]').val() == '') {
  157. $('#myTab a[href="#tab_sale"]').tab('show');
  158. Tip.focus(':input[name="widgets[sale][max_balance_deduct]"]', "请输入余额抵扣!");
  159. return false;
  160. } else {
  161. if (!reg.test($(':input[name="widgets[sale][max_balance_deduct]"]').val())) {
  162. $('#myTab a[href="#tab_sale"]').tab('show');
  163. Tip.focus(':input[name="widgets[sale][max_balance_deduct]"]', '余额抵扣格式错误,最多两位小数.');
  164. return false;
  165. }
  166. }*/
  167. if ($(':input[name="widgets[sale][ed_full]"]').val() != '' && !reg.test($(':input[name="widgets[sale][ed_full]"]').val())) {
  168. $('#myTab a[href="#tab_sale"]').tab('show');
  169. Tip.focus(':input[name="widgets[sale][ed_full]"]', '满额立减金额格式错误,最多两位小数.');
  170. return false;
  171. }
  172. if ($(':input[name="widgets[sale][ed_reduction]"]').val() != '' && !reg.test($(':input[name="widgets[sale][ed_reduction]"]').val())) {
  173. $('#myTab a[href="#tab_sale"]').tab('show');
  174. Tip.focus(':input[name="widgets[sale][ed_reduction]"]', '满额立减金额格式错误,最多两位小数.');
  175. return false;
  176. }
  177. if ($(':input[name="widgets[sale][ed_num]"]').val() == '') {
  178. // $('#myTab a[href="#tab_sale"]').tab('show');
  179. // Tip.focus(':input[name="widgets[sale][ed_num]"]', "请输入单品满件包邮!");
  180. // return false;
  181. } else {
  182. if (!numerictype.test($(':input[name="widgets[sale][ed_num]"]').val())) {
  183. $('#myTab a[href="#tab_sale"]').tab('show');
  184. Tip.focus(':input[name="widgets[sale][ed_num]"]', '单品满件包邮格式错误,只能为非负整数.');
  185. return false;
  186. }
  187. }
  188. if ($(':input[name="widgets[sale][ed_money]"]').val() == '') {
  189. // $('#myTab a[href="#tab_sale"]').tab('show');
  190. // Tip.focus(':input[name="widgets[sale][ed_money]"]', "请输入单品满额包邮!");
  191. // return false;
  192. } else {
  193. if (!reg.test($(':input[name="widgets[sale][ed_money]"]').val())) {
  194. $('#myTab a[href="#tab_sale"]').tab('show');
  195. Tip.focus(':input[name="widgets[sale][ed_money]"]', '单品满额包邮格式错误,最多两位小数.');
  196. return false;
  197. }
  198. }
  199. /*if ($(':input[name="widgets[sale][point]"]').val() == '') {
  200. $('#myTab a[href="#tab_sale"]').tab('show');
  201. Tip.focus(':input[name="widgets[sale][point]"]', "请输入赠送积分!");
  202. return false;
  203. } else {
  204. if (!numerictype.test($(':input[name="widgets[sale][point]"]').val())) {
  205. $('#myTab a[href="#tab_sale"]').tab('show');
  206. Tip.focus(':input[name="widgets[sale][point]"]', '赠送积分格式错误,只能为非负整数.');
  207. return false;
  208. }
  209. }*/
  210. /*if ($(':input[name="widgets[sale][bonus]"]').val() == '') {
  211. $('#myTab a[href="#tab_sale"]').tab('show');
  212. Tip.focus(':input[name="widgets[sale][bonus]"]', "请输入红包金额!");
  213. return false;
  214. } else {
  215. if (!reg.test($(':input[name="widgets[sale][bonus]"]').val())) {
  216. $('#myTab a[href="#tab_sale"]').tab('show');
  217. Tip.focus(':input[name="widgets[sale][bonus]"]', '红包金额格式错误,最多两位小数.');
  218. return false;
  219. }
  220. }*/
  221. if ($.trim($(':input[name="widgets[share][share_thumb]"]').val()) != '' && !thumb.test($.trim($(':input[name="widgets[share][share_thumb]"]').val()))) {
  222. $('#myTab a[href="#tab_share"]').tab('show');
  223. Tip.focus(':input[name="widgets[share][share_thumb]"]', '图片类型必须是.gif,jpeg,jpg,png中的一种.');
  224. return false;
  225. }
  226. if ($(':input[name="widgets[privilege][once_buy_limit]"]').val() == '') {
  227. $('#myTab a[href="#tab_privilege"]').tab('show');
  228. Tip.focus(':input[name="widgets[privilege][once_buy_limit]"]', "请输入每次限购数量!");
  229. return false;
  230. } else {
  231. if (!numerictype.test($(':input[name="widgets[privilege][once_buy_limit]"]').val())) {
  232. $('#myTab a[href="#tab_privilege"]').tab('show');
  233. Tip.focus(':input[name="widgets[privilege][once_buy_limit]"]', '每次限购数量格式错误,只能为非负整数.');
  234. return false;
  235. }
  236. }
  237. if ($(':input[name="widgets[privilege][total_buy_limit]"]').val() == '') {
  238. $('#myTab a[href="#tab_privilege"]').tab('show');
  239. Tip.focus(':input[name="widgets[privilege][total_buy_limit]"]', "请输入会员限购总数!");
  240. return false;
  241. } else {
  242. if (!numerictype.test($(':input[name="widgets[privilege][total_buy_limit]"]').val())) {
  243. $('#myTab a[href="#tab_privilege"]').tab('show');
  244. Tip.focus(':input[name="widgets[privilege][total_buy_limit]"]', '会员限购总数格式错误,只能为非负整数.');
  245. return false;
  246. }
  247. }
  248. /*if ($(':input[name="widgets[privilege][time_begin_limit]"]').val() == '') {
  249. $('#myTab a[href="#tab_privilege"]').tab('show');
  250. Tip.focus(':input[name="widgets[privilege][time_begin_limit]"]', "请输入限购起始时间!");
  251. return false;
  252. } else {
  253. if (!datetime.test($(':input[name="widgets[privilege][time_begin_limit]"]').val())) {
  254. $('#myTab a[href="#tab_privilege"]').tab('show');
  255. Tip.focus(':input[name="widgets[privilege][time_begin_limit]"]', '限购起始时间格式错误,只能0000-00-00 00:00:00格式.');
  256. return false;
  257. }
  258. }*/
  259. /*if ($(':input[name="widgets[privilege][time_end_limit]"]').val() == '') {
  260. $('#myTab a[href="#tab_privilege"]').tab('show');
  261. Tip.focus(':input[name="widgets[privilege][time_end_limit]"]', "请输入限购结束时间!");
  262. return false;
  263. } else {
  264. if (!datetime.test($(':input[name="widgets[privilege][time_end_limit]"]').val())) {
  265. $('#myTab a[href="#tab_privilege"]').tab('show');
  266. Tip.focus(':input[name="widgets[privilege][time_end_limit]"]', '限购结束时间格式错误,只能0000-00-00 00:00:00格式.');
  267. return false;
  268. }
  269. }*/
  270. if ($('.discounts_value').val()) {
  271. if (!reg.test($('.discounts_value').val())) {
  272. $('#myTab a[href="#tab_discount"]').tab('show');
  273. Tip.focus('.discounts_value', '折扣或固定金额数值格式错误,最多两位小数.');
  274. return false;
  275. }
  276. }
  277. // if ($(':input[name="widgets[single_return][return_rate]"]').val() == '') {
  278. // $('#myTab a[href="#tab_single_return"]').tab('show');
  279. // Tip.focus(':input[name="widgets[single_return][return_rate]"]', "请输返现比例!");
  280. // return false;
  281. // }
  282. @show
  283. if ($(':input[name="widgets[dispatch][dispatch_price]"]').val() == '') {
  284. $('#myTab a[href="#tab_dispatch"]').tab('show');
  285. Tip.focus(':input[name="widgets[dispatch][dispatch_price]"]', "请输入统一邮费金额!");
  286. return false;
  287. } else {
  288. if (!reg.test($(':input[name="widgets[dispatch][dispatch_price]"]').val())) {
  289. $('#myTab a[href="#tab_dispatch"]').tab('show');
  290. Tip.focus(':input[name="widgets[dispatch][dispatch_price]"]', '统一邮费金额数值格式错误,最多两位小数.');
  291. return false;
  292. }
  293. }
  294. if ($(':input[name="widgets[area_dividend][has_dividend]"]').get(0) != undefined && $(':input[name="widgets[area_dividend][has_dividend]"]').get(0).checked) {
  295. if ($(':input[name="widgets[area_dividend][has_dividend_price]"]').val() == '') {
  296. $('#myTab a[href="#tab_area_dividend"]').tab('show');
  297. Tip.focus(':input[name="widgets[area_dividend][has_dividend_price]"]', "独立分红金额!");
  298. return false;
  299. }
  300. }
  301. var full = true;
  302. if (window.type == '3') {
  303. if (window.virtual != '0') { //如果单规格,不能有规格
  304. if ($('#hasoption').get(0).checked) {
  305. $('#myTab a[href="#tab_option"]').tab('show');
  306. util.message('您的商品类型为:虚拟物品(卡密)的单规格形式,需要关闭商品规格!');
  307. return false;
  308. }
  309. }
  310. else {
  311. var has = false;
  312. $('.spec_item_virtual').each(function () {
  313. has = true;
  314. if ($(this).val() == '' || $(this).val() == '0') {
  315. $('#myTab a[href="#tab_option"]').tab('show');
  316. Tip.focus($(this).next(), '请选择虚拟物品模板!');
  317. full = false;
  318. return false;
  319. }
  320. });
  321. if (!has) {
  322. $('#myTab a[href="#tab_option"]').tab('show');
  323. util.message('您的商品类型为:虚拟物品(卡密)的多规格形式,请添加规格!');
  324. return false;
  325. }
  326. }
  327. }
  328. if (!full) {
  329. return false;
  330. }
  331. full = checkoption();
  332. if (!full) {
  333. return false;
  334. }
  335. if (optionchanged) {
  336. $('#myTab a[href="#tab_option"]').tab('show');
  337. alert('规格数据有变动,请重新点击 [刷新规格项目表] 按钮!');
  338. return false;
  339. }
  340. var discountway = $('input:radio[name=discountway]:checked').val();
  341. var discounttype = $('input:radio[name=discounttype]:checked').val();
  342. var returntype = $('input:radio[name=returntype]:checked').val();
  343. var marketprice = $('input:text[name=marketprice]').val();
  344. var isreturn = false;
  345. // Tip.focus("#goodsname", "请输入商品名称!");
  346. // return false;
  347. if (discountway == 1) {
  348. if (discounttype == 1) {
  349. $(".discounts").each(function () {
  350. if (parseFloat($(this).val()) <= 0 || parseFloat($(this).val()) >= 10) {
  351. $(this).val('');
  352. isreturn = true;
  353. alert('请输入正确折扣!');
  354. return false;
  355. }
  356. });
  357. } else {
  358. $(".discounts2").each(function () {
  359. if (parseFloat($(this).val()) <= 0 || parseFloat($(this).val()) >= 10) {
  360. $(this).val('');
  361. isreturn = true;
  362. alert('请输入正确折扣!');
  363. return false;
  364. }
  365. });
  366. }
  367. } else {
  368. if (discounttype == 1) {
  369. $(".discounts").each(function () {
  370. if (parseFloat($(this).val()) < 0 || parseFloat($(this).val()) >= parseFloat(marketprice)) {
  371. $(this).val('');
  372. isreturn = true;
  373. alert('请输入正确折扣金额!');
  374. return false;
  375. }
  376. });
  377. } else {
  378. $(".discounts2").each(function () {
  379. if (parseFloat($(this).val()) < 0 || parseFloat($(this).val()) >= parseFloat(marketprice)) {
  380. $(this).val('');
  381. isreturn = true;
  382. alert('请输入正确折扣金额!');
  383. return false;
  384. }
  385. });
  386. }
  387. }
  388. if (returntype == 1) {
  389. $(".returns").each(function () {
  390. if (parseFloat($(this).val()) < 0 || parseFloat($(this).val()) >= parseFloat(marketprice)) {
  391. $(this).val('');
  392. isreturn = true;
  393. alert('请输入正确返现金额!');
  394. return false;
  395. }
  396. });
  397. } else {
  398. $(".returns2").each(function () {
  399. if (parseFloat($(this).val()) < 0 || parseFloat($(this).val()) >= parseFloat(marketprice)) {
  400. $(this).val('');
  401. isreturn = true;
  402. alert('请输入正确返现金额!');
  403. return false;
  404. }
  405. });
  406. }
  407. if (isreturn) {
  408. return false;
  409. }
  410. return true;
  411. }
  412. function checkoption() {
  413. var full = true;
  414. if ($("#hasoption").get(0).checked) {
  415. $(".spec_title").each(function (i) {
  416. if ($(this).val() == '') {
  417. $('#myTab a[href="#tab_option"]').tab('show');
  418. Tip.focus(".spec_title:eq(" + i + ")", "请输入规格名称!", "top");
  419. full = false;
  420. return false;
  421. }
  422. });
  423. $(".spec_item_title").each(function (i) {
  424. if ($(this).val() == '') {
  425. $('#myTab a[href="#tab_option"]').tab('show');
  426. Tip.focus(".spec_item_title:eq(" + i + ")", "请输入规格项名称!", "top");
  427. full = false;
  428. return false;
  429. }
  430. });
  431. }
  432. if (!full) {
  433. return false;
  434. }
  435. return full;
  436. }
  437. </script>
  438. <script type="text/javascript">
  439. //鼠标划过显示商品链接二维码
  440. $('.umphp').hover(function () {
  441. var url = $(this).attr('data-url');
  442. var goodsid = $(this).attr('data-goodsid');
  443. $.post("{!! yzWebUrl('shop.goods') !!}"
  444. , {'op': 'goods_qrcode', id: goodsid, url: url}
  445. , function (qr) {
  446. if (qr.img) {
  447. var goodsqr = qr.img;
  448. var element = document.getElementById(goodsid);
  449. element.src = goodsqr;
  450. }
  451. }
  452. , "json"
  453. );
  454. $(this).addClass("selected");
  455. },
  456. function () {
  457. $(this).removeClass("selected");
  458. })
  459. function fastChange(id, type, value) {
  460. $.ajax({
  461. url: "{!! yzWebUrl('shop.goods') !!}",
  462. type: "post",
  463. data: {op: 'change', id: id, type: type, value: value},
  464. cache: false,
  465. success: function () {
  466. location.reload();
  467. }
  468. })
  469. }
  470. $(function () {
  471. $("form").keypress(function (e) {
  472. if (e.which == 13) {
  473. return false;
  474. }
  475. });
  476. $('.tdedit input').keydown(function (event) {
  477. if (event.keyCode == 13) {
  478. var group = $(this).closest('.input-group');
  479. var type = group.find('button').data('type');
  480. var goodsid = group.find('button').data('goodsid');
  481. var val = $.trim($(this).val());
  482. if (type == 'title' && val == '') {
  483. return;
  484. }
  485. group.prev().show().find('span').html(val);
  486. group.hide();
  487. fastChange(goodsid, type, val);
  488. }
  489. })
  490. $('.tdedit').mouseover(function () {
  491. $(this).find('.fa-pencil').show();
  492. }).mouseout(function () {
  493. $(this).find('.fa-pencil').hide();
  494. });
  495. $('.fa-edit-item').click(function () {
  496. var group = $(this).closest('span').hide().next();
  497. group.show().find('button').unbind('click').click(function () {
  498. var type = $(this).data('type');
  499. var goodsid = $(this).data('goodsid');
  500. var val = $.trim(group.find(':input').val());
  501. if (type == 'title' && val == '') {
  502. Tip.show(group.find(':input'), '请输入名称!');
  503. return;
  504. }
  505. group.prev().show().find('span').html(val);
  506. group.hide();
  507. fastChange(goodsid, type, val);
  508. });
  509. })
  510. })
  511. function setProperty(obj, id, type) {
  512. $(obj).html($(obj).html() + "...");
  513. $.post("{!! yzWebUrl('goods.goods.index') !!}"
  514. , {'op': 'setgoodsproperty', id: id, type: type, plugin: "", data: obj.getAttribute("data")}
  515. , function (d) {
  516. $(obj).html($(obj).html().replace("...", ""));
  517. if (type == 'type') {
  518. $(obj).html(d.data == '1' ? '实体物品' : '虚拟物品');
  519. }
  520. if (type == 'status') {
  521. $(obj).html(d.data == '1' ? '{{$lang['putaway']}}' : '{{$lang['soldout']}}');
  522. }
  523. $(obj).attr("data", d.data);
  524. if (d.result == 1) {
  525. $(obj).toggleClass("label-info text-pinfo");
  526. }
  527. }
  528. , "json"
  529. );
  530. }
  531. </script>
  532. <link rel="stylesheet" type="text/css" href="{{static_url('css/font-awesome.min.css')}}">
  533. <link href="{{static_url('yunshop/goods/goods.css')}}" media="all" rel="stylesheet" type="text/css"/>
  534. <div class="right-titpos">
  535. <ul class="add-snav">
  536. <li class="active"><a href="#">商品编辑</a></li>
  537. </ul>
  538. </div>
  539. {{--<div class="main rightlist">--}}
  540. <form id="goods-edit" action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
  541. <div class="panel-default panel-center">
  542. <!-- <div class="panel-heading">
  543. {if empty($goods['id'])}添加商品{else}编辑商品{/if}
  544. </div> -->
  545. <div class="top">
  546. <ul class="add-shopnav" id="myTab">
  547. <li class="active"><a href="#tab_basic">基本信息</a></li>
  548. <li><a href="#tab_des">{{$lang['shopdesc']}}</a></li>
  549. <li><a href="#tab_param">属性</a></li>
  550. {{--<li><a href="#tab_option">{{$lang['shopoption']}}</a></li>--}}
  551. <li><a href="#tab_dispatch">配送</a></li>
  552. @foreach(\app\common\modules\widget\Widget::current()->getItem('goods') as $key=>$value)
  553. @if ($key == 'tb_advertising')
  554. @continue
  555. @endif
  556. @if($key != 'tab_dispatch')
  557. <li><a href="#{{$key}}">{{$value['title']}}</a></li>
  558. @endif
  559. @endforeach
  560. </ul>
  561. </div>
  562. <div class="info">
  563. <div class="panel-body">
  564. <div class="tab-content">
  565. <div class="tab-pane active" id="tab_basic">@include('Yunshop\Hotel::admin.goods.tabs.basic')</div>
  566. <div class="tab-pane" id="tab_des">@include('Yunshop\Hotel::admin.goods.tabs.des')</div>
  567. <div class="tab-pane" id="tab_param">@include('Yunshop\Hotel::admin.goods.tabs.param')</div>
  568. {{--<div class="tab-pane" id="tab_option">@include('Yunshop\Hotel::admin.goods.tabs.option')</div>--}}
  569. <div class="tab-pane" id="tab_dispatch">
  570. {!! widget('Yunshop\Hotel\hotel\admin\widget\GoodsDispatchWidget', ['goods_id'=> $goods->id, 'hotel_id' => $hotel_id])!!}
  571. </div>
  572. @foreach(\app\common\modules\widget\Widget::current()->getItem('goods') as $key=>$value)
  573. @if($key != 'tab_dispatch')
  574. <div class="tab-pane"
  575. id="{{$key}}">{!! widget($value['class'], ['goods_id'=> $goods->id])!!}</div>
  576. @endif
  577. @endforeach
  578. </div>
  579. <div class="form-group col-sm-12 mrleft40 border-t">
  580. <input type="submit" name="submit" value="{{$lang['shopsubmit']}}" class="btn btn-success"
  581. onclick="return formcheck()"/>
  582. <input type="hidden" name="token" value="{{$var['token']}}"/>
  583. <input type="button" name="back" onclick='history.back()' style=''
  584. value="返回列表"
  585. class="btn btn-default back"/>
  586. </div>
  587. </div>
  588. </div>
  589. </div>
  590. </form>
  591. {{--</div>--}}
  592. @endsection('content')