2ca5a101c85ec8337022e5bee6d719b0.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <?php /*a:5:{s:75:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\setting\shipping_templates\add.php";i:1595820902;s:61:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\container.php";i:1595820902;s:62:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_head.php";i:1595820902;s:57:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\style.php";i:1595820902;s:64:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\public\frame_footer.php";i:1595820902;}*/ ?>
  2. <!DOCTYPE html>
  3. <html lang="zh-CN">
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <?php if(empty($is_layui) || (($is_layui instanceof \think\Collection || $is_layui instanceof \think\Paginator ) && $is_layui->isEmpty())): ?>
  8. <link href="/system/frame/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
  9. <?php endif; ?>
  10. <link href="/static/plug/layui/css/layui.css" rel="stylesheet">
  11. <link href="/system/css/layui-admin.css" rel="stylesheet">
  12. <link href="/system/frame/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
  13. <link href="/system/frame/css/animate.min.css" rel="stylesheet">
  14. <link href="/system/frame/css/style.min.css?v=3.0.0" rel="stylesheet">
  15. <script src="/system/frame/js/jquery.min.js"></script>
  16. <script src="/system/frame/js/bootstrap.min.js"></script>
  17. <script src="/static/plug/layui/layui.all.js"></script>
  18. <script>
  19. $eb = parent._mpApi;
  20. window.controlle="<?php echo strtolower(trim(preg_replace("/[A-Z]/", "_\\0", app('request')->controller()), "_"));?>";
  21. window.module="<?php echo app('http')->getName();?>";
  22. </script>
  23. <title></title>
  24. <!--<script type="text/javascript" src="/static/plug/basket.js"></script>-->
  25. <script type="text/javascript" src="/static/plug/requirejs/require.js"></script>
  26. <?php /* <script type="text/javascript" src="/static/plug/requirejs/require-basket-load.js"></script> */ ?>
  27. <script>
  28. var hostname = location.hostname;
  29. if(location.port) hostname += ':' + location.port;
  30. requirejs.config({
  31. map: {
  32. '*': {
  33. 'css': '/static/plug/requirejs/require-css.js'
  34. }
  35. },
  36. shim:{
  37. 'iview':{
  38. deps:['css!iviewcss']
  39. },
  40. 'layer':{
  41. deps:['css!layercss']
  42. }
  43. },
  44. baseUrl:'//'+hostname+'/',
  45. paths: {
  46. 'static':'static',
  47. 'system':'system',
  48. 'vue':'static/plug/vue/dist/vue.min',
  49. 'axios':'static/plug/axios.min',
  50. 'iview':'static/plug/iview/dist/iview.min',
  51. 'iviewcss':'static/plug/iview/dist/styles/iview',
  52. 'lodash':'static/plug/lodash',
  53. 'layer':'static/plug/layer/layer',
  54. 'layercss':'static/plug/layer/theme/default/layer',
  55. 'jquery':'static/plug/jquery/jquery.min',
  56. 'moment':'static/plug/moment',
  57. 'sweetalert':'static/plug/sweetalert2/sweetalert2.all.min',
  58. 'formCreate':'/static/plug/form-create/form-create.min',
  59. },
  60. basket: {
  61. excludes:['system/js/index','system/util/mpVueComponent','system/util/mpVuePackage']
  62. // excludes:['system/util/mpFormBuilder','system/js/index','system/util/mpVueComponent','system/util/mpVuePackage']
  63. }
  64. });
  65. </script>
  66. <script type="text/javascript" src="/system/util/mpFrame.js"></script>
  67. </head>
  68. <body class="gray-bg">
  69. <div class="wrapper wrapper-content">
  70. <style>
  71. .red {
  72. color: red;
  73. }
  74. </style>
  75. <div class="layui-fluid">
  76. <div class="layui-row layui-col-space15" id="app" v-cloak="">
  77. <div class="layui-col-md12">
  78. <div class="layui-card">
  79. <div class="layui-card-body">
  80. <form class="layui-form" @submit.stop>
  81. <div class="layui-form-item">
  82. <label class="layui-form-label">模板名称<i class="red">*</i></label>
  83. <div class="layui-input-block">
  84. <input type="text" name="name" v-model="formData.name" placeholder="请输入模板名称"
  85. class="layui-input" lay-verify="required">
  86. </div>
  87. </div>
  88. <div class="layui-form-item">
  89. <label class="layui-form-label">计费方式</label>
  90. <div class="layui-input-block">
  91. <input type="radio" name="type" v-model="formData.type"
  92. :checked="formData.type == 1 ? true : false" value="1" title="按件数"
  93. lay-filter="type">
  94. <input type="radio" name="type" v-model="formData.type"
  95. :checked="formData.type == 2 ? true : false" value="2" title="按重量"
  96. lay-filter="type">
  97. <input type="radio" name="type" v-model="formData.type"
  98. :checked="formData.type == 3 ? true : false" value="3" title="按体积"
  99. lay-filter="type">
  100. </div>
  101. </div>
  102. <div class="layui-form-item">
  103. <label class="layui-form-label">配送区域及运费</label>
  104. <div class="layui-input-block">
  105. <table class="layui-table">
  106. <colgroup>
  107. <col width="150">
  108. <col width="200">
  109. <col>
  110. </colgroup>
  111. <thead>
  112. <tr>
  113. <th>可配送区域<i class="red">*</i></th>
  114. <th v-if="formData.type == 1">首件<i class="red">*</i></th>
  115. <th v-else-if="formData.type == 2">首件重量(KG)<i class="red">*</i></th>
  116. <th v-else>首件体积(m³)<i class="red">*</i></th>
  117. <th>运费(元)<i class="red">*</i></th>
  118. <th v-if="formData.type == 1">续件<i class="red">*</i></th>
  119. <th v-else-if="formData.type == 2">续件重量(KG)<i class="red">*</i></th>
  120. <th v-else>续件体积(m³)<i class="red">*</i></th>
  121. <th>续费(元)<i class="red">*</i></th>
  122. <th>操作</th>
  123. </tr>
  124. </thead>
  125. <tbody id="region">
  126. <tr v-for="(item,index) in templateList">
  127. <td>
  128. <input type="text" class="layui-input" :value="item.regionName" readonly>
  129. </td>
  130. <td>
  131. <input type="number" v-model="item.first" class="layui-input"
  132. lay-verify="required">
  133. </td>
  134. <td>
  135. <input type="number" v-model="item.price" class="layui-input"
  136. lay-verify="required">
  137. </td>
  138. <td>
  139. <input type="number" v-model="item.continue" class="layui-input"
  140. lay-verify="required">
  141. </td>
  142. <td>
  143. <input type="number" v-model="item.continue_price" class="layui-input"
  144. lay-verify="required">
  145. </td>
  146. <td style="width:100px;" v-if="item.regionName != '默认全国' ">
  147. <!-- <button type="button" class="layui-btn layui-btn-sm layui-btn-info">修改</button>-->
  148. <button type="button" class="layui-btn layui-btn-sm layui-btn-danger"
  149. @click="del(1,index)">删除
  150. </button>
  151. </td>
  152. <td style="width:100px;" v-else></td>
  153. </tr>
  154. </tbody>
  155. </table>
  156. </div>
  157. </div>
  158. <div class="layui-form-item" style="margin-top: 10px">
  159. <div class="layui-input-block">
  160. <button class="layui-btn layui-btn-sm" @click="open(1)" type="button">
  161. 单独添加配送区域
  162. </button>
  163. </div>
  164. </div>
  165. <div class="layui-form-item">
  166. <label class="layui-form-label">指定包邮</label>
  167. <div class="layui-input-block">
  168. <input type="radio" name="appoint_check"
  169. :checked="formData.appoint_check == 1 ? true : false"
  170. v-model="formData.appoint_check" value="1" title="开启" lay-filter="appoint_check">
  171. <input type="radio" name="appoint_check"
  172. :checked="formData.appoint_check == 0 ? true : false"
  173. v-model="formData.appoint_check" value="0" title="关闭" lay-filter="appoint_check">
  174. </div>
  175. </div>
  176. <div v-show="formData.appoint_check == 1">
  177. <div class="layui-form-item">
  178. <label class="layui-form-label"></label>
  179. <div class="layui-input-block">
  180. <table class="layui-table">
  181. <colgroup>
  182. <col width="150">
  183. <col width="200">
  184. <col>
  185. </colgroup>
  186. <thead>
  187. <tr>
  188. <th>选择地区<i class="red">*</i></th>
  189. <th v-if="formData.type == 1">包邮件数<i class="red">*</i></th>
  190. <th v-else-if="formData.type == 2">包邮重量(KG)<i class="red">*</i></th>
  191. <th v-else>包邮体积(m³)<i class="red">*</i></th>
  192. <th>包邮金额(元)<i class="red">*</i></th>
  193. <th>操作</th>
  194. </tr>
  195. </thead>
  196. <tbody>
  197. <tr v-for="(item,index) in appointList">
  198. <td><input type="text" class="layui-input"
  199. :value="item.placeName"
  200. readonly></td>
  201. <td><input type="number" autocomplete="off" class="layui-input"
  202. v-model="item.a_num"></td>
  203. <td><input type="number" autocomplete="off" class="layui-input"
  204. v-model="item.a_price"></td>
  205. <td>
  206. <!-- <button type="button" class="layui-btn layui-btn-sm layui-btn-info">修改</button>-->
  207. <button type="button" class="layui-btn layui-btn-sm layui-btn-danger"
  208. @click="del(2,index)">删除
  209. </button>
  210. </td>
  211. </tr>
  212. <tr v-if="appointList.length <= 0">
  213. <td colspan="5" style="text-align: center;">暂无</td>
  214. </tr>
  215. </tbody>
  216. </table>
  217. </div>
  218. </div>
  219. <div class="layui-form-item" style="margin-top: 10px">
  220. <div class="layui-input-block">
  221. <button class="layui-btn layui-btn-sm" @click="open(2)" type="button">
  222. 单独指定包邮区域
  223. </button>
  224. </div>
  225. </div>
  226. </div>
  227. <div class="layui-form-item" style="margin-top: 10px">
  228. <label class="layui-form-label">排序</label>
  229. <div class="layui-input-block">
  230. <input type="number" name="sort" v-model="formData.sort" placeholder="请输入值越大越靠前"
  231. class="layui-input">
  232. </div>
  233. </div>
  234. <div class="layui-form-item" style="margin-top: 10px">
  235. <div class="layui-input-block">
  236. <button class="layui-btn" type="button" @click="handleSubmit">{{id ? '立即修改':'立即提交'}}
  237. </button>
  238. </div>
  239. </div>
  240. </form>
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246. <script src="/system/js/layuiList.js"></script>
  247. <script>
  248. var id = <?php echo htmlentities($id); ?>;
  249. require(['vue'], function (Vue) {
  250. new Vue({
  251. el: "#app",
  252. data: {
  253. selectCityList: [],
  254. selectTypeCityList: [],
  255. templateList: [
  256. {
  257. region: [
  258. {
  259. name: '默认全国',
  260. city_id: 0,
  261. }
  262. ],
  263. regionName: "默认全国",
  264. first: 0,
  265. price: 0,
  266. 'continue': 0,
  267. continue_price: 0,
  268. action: true,
  269. }
  270. ],
  271. appointList: [],
  272. id: id,
  273. formData: {
  274. type: 1,
  275. sort: 0,
  276. name: '',
  277. appoint_check: 0,
  278. },
  279. },
  280. watch: {
  281. 'formData.appoint_check': function (n) {
  282. console.log(n);
  283. }
  284. },
  285. methods: {
  286. getTemplateInfo: function () {
  287. if (!this.id) return;
  288. var that = this;
  289. layList.baseGet(layList.Url({a: 'edit', q: {id: this.id}}), function (res) {
  290. that.$set(that, 'appointList', res.data.appointList || []);
  291. that.$set(that, 'templateList', res.data.templateList || []);
  292. if (!that.templateList.length) {
  293. that.$set(that, 'templateList', [
  294. {
  295. region: [
  296. {
  297. name: '默认全国',
  298. city_id: 0,
  299. }
  300. ],
  301. regionName: "默认全国",
  302. first: 0,
  303. price: 0,
  304. 'continue': 0,
  305. continue_price: 0,
  306. action: true,
  307. }
  308. ]);
  309. } else {
  310. if (that.templateList[0].region === undefined) {
  311. that.$set(that.templateList[0], 'region', [{name: '默认全国', city_id: 0}]);
  312. that.$set(that.templateList[0], 'regionName', '默认全国');
  313. }
  314. }
  315. that.formData = res.data.formData;
  316. that.render();
  317. }, function (res) {
  318. return layList.msg(res.msg);
  319. })
  320. },
  321. del: function (type, index) {
  322. switch (type) {
  323. case 1:
  324. this.templateList.splice(index, 1);
  325. break;
  326. case 2:
  327. this.appointList.splice(index, 1);
  328. break;
  329. }
  330. },
  331. open: function (type, edit) {
  332. if (edit == undefined) edit = 0;
  333. switch (type) {
  334. case 1:
  335. this.createFrame('单独添加配送区域', layList.Url({a: 'city', p: {type: 1, isedit: edit}}));
  336. break;
  337. case 2:
  338. this.createFrame('单独指定包邮区域', layList.Url({a: 'city', p: {type: 2, isedit: edit}}));
  339. break;
  340. }
  341. },
  342. createFrame: function (title, src, opt) {
  343. opt === undefined && (opt = {});
  344. return layer.open({
  345. type: 2,
  346. title: title,
  347. area: [(opt.w || 1000) + 'px', (opt.h || 700) + 'px'],
  348. fixed: false, //不固定
  349. maxmin: true,
  350. moveOut: false,//true 可以拖出窗外 false 只能在窗内拖
  351. anim: 5,//出场动画 isOutAnim bool 关闭动画
  352. offset: 'auto',//['100px','100px'],//'auto',//初始位置 ['100px','100px'] t[ 上 左]
  353. shade: 0,//遮罩
  354. resize: true,//是否允许拉伸
  355. content: src,//内容
  356. move: '.layui-layer-title'
  357. });
  358. },
  359. render: function () {
  360. var that = this, radioRule = ['appoint_check', 'type'];
  361. that.$nextTick(function () {
  362. layList.form.render();
  363. radioRule.map(function (val) {
  364. layList.form.on('radio(' + val + ')', function (res) {
  365. that.formData[val] = res.value;
  366. });
  367. })
  368. })
  369. },
  370. selectCity: function (data, type) {
  371. var cityName = data.map(function (item) {
  372. return item.name;
  373. }).join(';');
  374. switch (type) {
  375. case 1:
  376. this.templateList.push({
  377. region: data,
  378. regionName: cityName,
  379. first: 0,
  380. price: 0,
  381. 'continue': 0,
  382. continue_price: 0
  383. });
  384. break;
  385. case 2:
  386. this.appointList.push({
  387. place: data,
  388. placeName: cityName,
  389. a_num: 0,
  390. a_price: 0
  391. });
  392. break;
  393. }
  394. },
  395. handleSubmit: function () {
  396. var that = this;
  397. for (var i = 0; i < that.templateList.length; i++) {
  398. if (!that.templateList[i].first) {
  399. return layList.msg('请填写首件数量');
  400. }
  401. if (that.templateList[i].continue <= 0) {
  402. return layList.msg('请填写续件数量');
  403. }
  404. }
  405. layList.basePost(layList.Url({a: 'save', p: {id: this.id}}), {
  406. appoint_info: that.appointList,
  407. region_info: that.templateList,
  408. sort: that.formData.sort,
  409. type: that.formData.type,
  410. name: that.formData.name,
  411. appoint: that.formData.appoint_check,
  412. }, function (res) {
  413. layList.msg(res.msg, function () {
  414. parent.layer.close(parent.layer.getFrameIndex(window.name));
  415. parent.$(".J_iframe:visible")[0].contentWindow.location.reload();
  416. });
  417. });
  418. }
  419. },
  420. mounted: function () {
  421. this.getTemplateInfo();
  422. if (!this.id) this.render();
  423. window.selectCity = this.selectCity;
  424. }
  425. })
  426. })
  427. </script>
  428. </div>
  429. </body>
  430. </html>