截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. {layout name="layout2" /}
  2. <link href="__PUBLIC__/static/lib/layui/layeditor/layedit.css" rel="stylesheet"/>
  3. <script src="__PUBLIC__/static/lib/layui/layeditor/index.js"></script>
  4. <script src="__PUBLIC__/static/lib/layui/layeditor/ace/ace.js"></script>
  5. <style>
  6. .layui-form-item .layui-form-label {
  7. width: 95px;
  8. }
  9. .layui-form-item .layui-input-inline {
  10. width: 240px;
  11. }
  12. .hide-div {
  13. display: none;
  14. }
  15. </style>
  16. <div class="layui-card layui-form" style="box-shadow:none;">
  17. <div class="layui-tab layui-tab-card" lay-filter="like-tabs">
  18. <ul class="layui-tab-title">
  19. <li lay-id="1" class="layui-this">基本信息</li>
  20. <li lay-id="2">商品详情</li>
  21. </ul>
  22. <div class="layui-tab-content">
  23. <input type="hidden" name="id" value="{$detail.id}">
  24. <input type="hidden" name="type" value="{$detail.type}">
  25. <!-- 1、基础设置 -->
  26. <div class="layui-tab-item layui-show">
  27. <!-- 兑换类型 -->
  28. <div class="layui-form-item">
  29. <label class="layui-form-label"><span style="color:red;">*</span>兑换类型:</label>
  30. <div class="layui-input-inline">
  31. <div class="layui-form-mid ">
  32. {if condition="$detail.type eq 1"}
  33. 商品
  34. {else/}
  35. 红包
  36. {/if}
  37. </div>
  38. </div>
  39. </div>
  40. <!-- 商家名称 -->
  41. <div class="layui-form-item">
  42. <label for="name" class="layui-form-label"><span style="color:red;">*</span>商品名称:</label>
  43. <div class="layui-input-inline">
  44. <input type="text" name="name" id="name" lay-verType="tips" value="{$detail.name}"
  45. autocomplete="off" class="layui-input" placeholder="请输入名称">
  46. </div>
  47. </div>
  48. <!-- 商品编号 -->
  49. <div class="layui-form-item code">
  50. <label for="name" class="layui-form-label">商品编号:</label>
  51. <div class="layui-input-inline">
  52. <input type="text" name="code" id="code" lay-verType="tips" value="{$detail.code|default=''}"
  53. autocomplete="off" class="layui-input" placeholder="请输入编号">
  54. </div>
  55. </div>
  56. <!-- 商品封面 -->
  57. <div class="layui-form-item">
  58. <label class="layui-form-label"><span style="color:red;">*</span>商品封面:</label>
  59. <div class="layui-input-block">
  60. <div class="like-upload-image">
  61. {if $detail.image}
  62. <div class="upload-image-div">
  63. <img src="{$detail.image}" alt="img">
  64. <input type="hidden" name="image" value="{$detail.image}">
  65. <div class="del-upload-btn">x</div>
  66. </div>
  67. <div class="upload-image-elem" style="display:none;"><a class="add-upload-image"> + 添加图片</a>
  68. </div>
  69. {else}
  70. <div class="upload-image-elem"><a class="add-upload-image"> + 添加图片</a></div>
  71. {/if}
  72. </div>
  73. <div class="layui-form-mid layui-word-aux">建议尺寸:800*800像素</div>
  74. </div>
  75. </div>
  76. <!-- 市场价 -->
  77. <div class="layui-form-item">
  78. <label for="market_price" class="layui-form-label">市场价:</label>
  79. <div class="layui-input-inline">
  80. <input type="number" name="market_price" id="market_price" lay-verType="tips" min="0"
  81. value="{$detail.market_price|default='0'}"
  82. autocomplete="off" class="layui-input" placeholder="请输入价格">
  83. </div>
  84. </div>
  85. <!-- 库存 -->
  86. <div class="layui-form-item">
  87. <label for="stock" class="layui-form-label"><span style="color:red;">*</span>发放库存:</label>
  88. <div class="layui-input-inline">
  89. <input type="number" name="stock" id="stock" lay-verType="tips" value="{$detail.stock}" min="0"
  90. onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
  91. autocomplete="off" class="layui-input" placeholder="请输入发放库存">
  92. </div>
  93. </div>
  94. <!-- 兑换方式 -->
  95. <div class="layui-form-item exchange_way">
  96. <label class="layui-form-label"><span style="color:red;">*</span>兑换方式:</label>
  97. <div class="layui-input-inline">
  98. <input type="radio" name="exchange_way" value="1" title="积分" lay-filter="exchange_way" {if
  99. condition="$detail.exchange_way eq 1" }checked{/if}>
  100. <input type="radio" name="exchange_way" value="2" title="积分+余额" lay-filter="exchange_way" {if
  101. condition="$detail.exchange_way eq 2" }checked{/if}>
  102. </div>
  103. </div>
  104. <!-- 兑换积分 -->
  105. <div class="layui-form-item">
  106. <label class="layui-form-label"><span style="color:red;">*</span>兑换积分:</label>
  107. <div class="layui-input-inline" style="margin-right: 0px;">
  108. <input type="number" name="need_integral" id="need_integral" autocomplete="off" min="1"
  109. value="{$detail.need_integral}" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
  110. placeholder="请输入积分" class="layui-input">
  111. </div>
  112. <span class="layui-form-mid">积分</span>
  113. <span class="layui-form-mid need_money hide-div">+</span>
  114. <div class="layui-input-inline need_money hide-div" style="margin-right: 0px;">
  115. <input type="number" name="need_money" id="need_money" autocomplete="off" placeholder="请输入金额" min="0"
  116. value="{$detail.need_money}" class="layui-input">
  117. </div>
  118. <div class="layui-input-inline">
  119. <span class="layui-form-mid need_money hide-div">元</span>
  120. </div>
  121. </div>
  122. <!-- 物流配送 -->
  123. <div class="layui-form-item delivery">
  124. <label class="layui-form-label"><span style="color:red;">*</span>物流配送:</label>
  125. <div class="layui-input-block">
  126. <input type="radio" name="delivery_way" value="1" title="快递" lay-filter="delivery_way" {if
  127. condition="$detail.delivery_way eq 1" }checked{/if}>
  128. <input type="radio" name="delivery_way" value="0" title="无需物流" lay-filter="delivery_way" {if
  129. condition="$detail.delivery_way eq 0" }checked{/if}>
  130. </div>
  131. <div class="layui-form-mid layui-word-aux ">修改后的配送状态仅对后面的订单生效,对前面已经付款的订单没影响,会按照订单当时的的设置来进行操作</div>
  132. </div>
  133. <!-- 快递运费 -->
  134. <div class="layui-form-item delivery express">
  135. <label class="layui-form-label"><span style="color:red;">*</span>快递运费:</label>
  136. <div class="layui-input-inline">
  137. <input type="radio" name="express_type" value="1" title="包邮" {if condition="$detail.express_type eq 1" }checked{/if}>
  138. </div>
  139. <div class="layui-form-item">
  140. <label class="layui-form-label"></label>
  141. <div class="layui-input-inline" style="margin-right: 0px;width: auto">
  142. <input type="radio" name="express_type" value="2" title="统一运费" {if condition="$detail.express_type eq 2" }checked{/if}>
  143. </div>
  144. <div class="layui-input-inline" style="width: 110px">
  145. <input type="number" name="express_money" class="layui-input" value="{$detail.express_money}" min="0">
  146. </div>
  147. <span class="layui-form-mid">元</span>
  148. </div>
  149. </div>
  150. <!-- 红包面值 -->
  151. <div class="layui-form-item balance hide-div">
  152. <label for="stock" class="layui-form-label"><span style="color:red;">*</span>红包面值:</label>
  153. <div class="layui-input-inline">
  154. <input type="number" name="balance" id="balance" lay-verType="tips" min="0"
  155. value="{$detail.balance|default=''}"
  156. autocomplete="off" class="layui-input">
  157. <div class="layui-form-mid layui-word-aux">兑换的红包会以余额的形式发放</div>
  158. </div>
  159. </div>
  160. <!-- 排序 -->
  161. <div class="layui-form-item">
  162. <label class="layui-form-label">排序:</label>
  163. <div class="layui-input-inline input-inline-width">
  164. <input type="number" name="sort" autocomplete="off" class="layui-input" min="0" value="{$detail.sort}">
  165. <label class="layui-form-mid layui-word-aux">默认值为0,数值越大越排前</label>
  166. </div>
  167. </div>
  168. <!-- 商品状态 -->
  169. <div class="layui-form-item">
  170. <label class="layui-form-label"><span style="color:red;">*</span>商品状态:</label>
  171. <div class="layui-input-inline">
  172. <input type="checkbox" name="status" lay-skin="switch" lay-text="上架|下架"
  173. {if condition="$detail.status eq 1" }checked{/if}>
  174. </div>
  175. </div>
  176. </div>
  177. <!-- 2、商品详情 -->
  178. <div class="layui-tab-item">
  179. <div class="layui-form-item">
  180. <label class="layui-form-label">商品详情:</label>
  181. <div class="layui-input-block">
  182. <textarea name="content" id="content" lay-verify="content">{$detail.content}</textarea>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. <div class="layui-form-item layui-hide">
  189. <input type="button" lay-submit lay-filter="addSubmit" id="addSubmit" value="确认">
  190. </div>
  191. </div>
  192. <script>
  193. layui.config({
  194. version: "{$front_version}",
  195. base: '/static/lib/'
  196. }).extend({
  197. likeedit: 'likeedit/likeedit'
  198. }).use(["form", "laydate", "layEditor"], function () {
  199. var $ = layui.$;
  200. var form = layui.form;
  201. var layEditor = layui.layEditor;
  202. var type = {$detail.type};
  203. var delivery_way = {$detail.delivery_way};
  204. if (type === 1) {
  205. typeGoods();
  206. } else {
  207. typeBalance();
  208. }
  209. deliveryWay(delivery_way);
  210. // 兑换类型为商品时
  211. function typeGoods() {
  212. $('.balance').hide();
  213. $('.code, .exchange_way, .need_integral, .delivery').show();
  214. let exchange_way = $('input[name="exchange_way"]:checked').val();
  215. exchange_way === '1' ? $('.need_money').hide() : $('.need_money').show();
  216. }
  217. // 兑换类型为红包时
  218. function typeBalance() {
  219. $('.balance').show();
  220. $('.code, .exchange_way, .need_integral, .need_money, .delivery').hide();
  221. }
  222. // 物流配送类型
  223. function deliveryWay(way) {
  224. (way === 1 && type === 1) ? $('.express').show() : $('.express').hide();
  225. }
  226. // 兑换方式 [积分, 积分+余额]
  227. form.on('radio(exchange_way)', function (data) {
  228. data.value === '1' ? $('.need_money').hide() : $('.need_money').show();
  229. })
  230. // 物流配送 [快递 无需物流]
  231. form.on('radio(delivery_way)', function (data) {
  232. data.value === '1' ? $('.express').show() : $('.express').hide();
  233. })
  234. // 富文本
  235. layEditor.set({
  236. uploadImage: {
  237. url: '{:url("file/lists")}?type=10'
  238. },
  239. })
  240. var ieditor = layEditor.build('content')
  241. form.verify({
  242. content: function(value) {
  243. return layEditor.sync(ieditor);
  244. }
  245. });
  246. like.delUpload();
  247. $(document).on("click", ".add-upload-image", function () {
  248. like.imageUpload({
  249. limit: 1,
  250. field: "image",
  251. that: $(this)
  252. });
  253. });
  254. })
  255. </script>