截流自动化的商城平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. {layout name="layout1" /}
  2. <div class="wrapper">
  3. <div class="layui-card">
  4. <div class="layui-card-body">
  5. <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
  6. <div class="layui-colla-item">
  7. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  8. <div class="layui-colla-content layui-show">
  9. <p>*设置快递配送的运费模板。</p>
  10. <p>*需要开启快递发货的配送方式,运费模板才能生效。</p>
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. <div class="layui-tab layui-tab-card" lay-filter="tab-all">
  16. <ul class="layui-tab-title">
  17. <li data-type='express' class="layui-this">快递公司</li>
  18. <li data-type='express'>查询配置</li>
  19. </ul>
  20. <div class="layui-tab-content">
  21. <!--物流公司列表-->
  22. <div class="layui-tab-item layui-show">
  23. {include file="freight/express"/}
  24. </div>
  25. <!--查询配置-->
  26. <div class="layui-tab-item">
  27. {include file="freight/config"/}
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <script>
  34. layui.config({
  35. version:"{$front_version}",
  36. base: '/static/lib/'
  37. }).extend({
  38. likeedit: 'likeedit/likeedit'
  39. }).use(['table', 'form', 'element', 'likeedit'], function() {
  40. var form = layui.form
  41. ,$ = layui.$
  42. ,table = layui.table
  43. , element = layui.element
  44. , likeedit = layui.likeedit;
  45. //图片放大
  46. $(document).on('click', '.image-show', function () {
  47. var src = $(this).attr('src');
  48. like.showImg(src,600);
  49. });
  50. getLists('express');
  51. //切换列表
  52. element.on('tab(tab-all)', function (data) {
  53. form.render('select');
  54. var type = $(this).attr('data-type');
  55. getLists(type);
  56. });
  57. //监听搜索
  58. form.on('submit(express-search)', function (data) {
  59. var field = data.field;
  60. //执行重载
  61. table.reload('express-lists', {
  62. where: field
  63. });
  64. });
  65. //清空查询
  66. form.on('submit(express-clear-search)', function () {
  67. $('#express_name').val('');
  68. //刷新列表
  69. table.reload('express-lists', {
  70. where: []
  71. });
  72. });
  73. function getLists(type) {
  74. if (type == 'express') {
  75. table.render({
  76. elem: '#express-lists'
  77. , url: '{:url("express/lists")}'
  78. , cols: [[
  79. {field: 'name', title: '快递公司',align:'center'}
  80. , {field: 'icon', width: 150,title: '快递图标',templet:'#icon',align:'center'}
  81. , {field: 'website', title: '公司网址',align:'center'}
  82. , {field: 'code', title: '快递编码',align:'center'}
  83. , {field: 'code100', title: '快递100编码',align:'center'}
  84. , {field: 'codebird', title: '快递鸟编码',align:'center'}
  85. , {field: 'sort', title: '排序', align: 'center',sort: true, width: 100}
  86. , {title: '操作', width: 160, align: 'center', fixed: 'right', toolbar: '#express-operation'}
  87. ]]
  88. , page: true
  89. , text: {none: '暂无数据!'}
  90. , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
  91. return {
  92. "code": res.code,
  93. "msg": res.msg,
  94. "count": res.data.count, //解析数据长度
  95. "data": res.data.lists, //解析数据列表
  96. };
  97. }
  98. ,done: function(res, curr, count){
  99. // 解决操作栏因为内容过多换行问题
  100. $(".layui-table-main tr").each(function (index, val) {
  101. $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
  102. $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
  103. });
  104. }
  105. });
  106. }
  107. }
  108. // =========================================快递公司==================================================
  109. //新增快递公司
  110. var express_active = {
  111. add: function(){
  112. layer.open({
  113. type: 2
  114. ,title: '新增快递公司'
  115. ,content: '{:url("express/add")}'
  116. ,area: ['90%', '90%']
  117. ,btn: ['确定', '取消']
  118. ,yes: function(index, layero){
  119. var iframeWindow = window['layui-layer-iframe'+ index]
  120. ,submitID = 'express-submit'
  121. ,submit = layero.find('iframe').contents().find("#express-submit");
  122. //监听提交
  123. iframeWindow.layui.form.on('submit(express-submit)', function(data){
  124. var field = data.field;
  125. like.ajax({
  126. url:'{:url("express/add")}',
  127. data:field,
  128. type:"post",
  129. success:function(res)
  130. {
  131. if(res.code == 1)
  132. {
  133. layui.layer.msg(res.msg, {
  134. offset: '15px'
  135. , icon: 1
  136. , time: 1000
  137. });
  138. layer.close(index); //关闭弹层
  139. table.reload('express-lists'); //数据刷新
  140. }
  141. }
  142. });
  143. });
  144. submit.trigger('click');
  145. },
  146. })
  147. }
  148. };
  149. $('.layui-btn.layuiadmin-btn-express').on('click', function(){
  150. var type = $(this).data('type');
  151. express_active[type] ? express_active[type].call(this) : '';
  152. });
  153. //快递公司列表操作
  154. table.on('tool(express-lists)', function(obj){
  155. if(obj.event === 'del'){
  156. var id = obj.data.id;
  157. layer.confirm('确定删除此快递公司?', function(index){
  158. like.ajax({
  159. url:'{:url("express/del")}',
  160. data:{delData:id},
  161. type:"post",
  162. success:function(res)
  163. {
  164. if(res.code == 1)
  165. {
  166. layui.layer.msg(res.msg, {
  167. offset: '15px'
  168. , icon: 1
  169. , time: 1000
  170. });
  171. layer.close(index); //关闭弹层
  172. table.reload('express-lists'); //数据刷新
  173. obj.del();
  174. }
  175. }
  176. });
  177. layer.close(index);
  178. });
  179. }else if(obj.event === 'edit'){
  180. var id = obj.data.id;
  181. layer.open({
  182. type: 2
  183. ,title: '编辑快递公司信息'
  184. ,content: '{:url("express/edit")}?id='+id
  185. ,area: ['90%', '90%']
  186. ,btn: ['确定', '取消']
  187. ,yes: function(index, layero){
  188. var iframeWindow = window['layui-layer-iframe'+ index]
  189. ,submit = layero.find('iframe').contents().find('#express-submit-edit');
  190. //监听提交
  191. iframeWindow.layui.form.on('submit(express-submit-edit)', function(data){
  192. var field = data.field;
  193. like.ajax({
  194. url:'{:url("express/edit")}',
  195. data:field,
  196. type:"post",
  197. success:function(res)
  198. {
  199. console.log(res);
  200. if(res.code == 1)
  201. {
  202. console.log(1);
  203. layui.layer.msg(res.msg, {
  204. offset: '15px'
  205. , icon: 1
  206. , time: 1000
  207. });
  208. layer.close(index); //关闭弹层
  209. table.reload('express-lists'); //数据刷新
  210. }
  211. }
  212. });
  213. });
  214. submit.trigger('click');
  215. }
  216. })
  217. }
  218. });
  219. // ========================================查询配置==================================================
  220. form.on('radio(kd100)', function(data){
  221. if(data.value =='kd100'){
  222. $('#kd100_appkey').show();
  223. $('#kd100_customer').show();
  224. $('.kdniao').hide();
  225. $('#kdniao_appkey').hide();
  226. $('#kdniao_ebussinessid').hide();
  227. }
  228. });
  229. form.on('radio(kdniao)', function(data){
  230. if(data.value =='kdniao'){
  231. $('#kd100_appkey').hide();
  232. $('#kd100_customer').hide();
  233. $('.kdniao').show();
  234. $('#kdniao_appkey').show();
  235. $('#kdniao_ebussinessid').show();
  236. }
  237. });
  238. form.on('submit(query-submit)',function (data) {
  239. like.ajax({
  240. url: '{:url("express/setExpress")}'
  241. ,data: data.field
  242. ,type: 'post'
  243. ,success: function(res){
  244. layer.msg(res.msg, {
  245. offset: '15px'
  246. ,icon: 1
  247. ,time: 1500
  248. });
  249. }
  250. });
  251. });
  252. });
  253. </script>