截流自动化的商城平台
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.

add.html 12KB

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