goods.blade.php 28 KB

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