dispatch-list.blade.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. @extends('layouts.base')
  2. @section('title', '配送模板管理')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
  5. <link rel="stylesheet" href="{{resource_get('plugins/yz-supply/assent/css/album1.css?time='.time())}}">
  6. <style>
  7. .edit-i{display:none;}
  8. .el-table_1_column_2:hover .edit-i{font-weight:900;padding:0;margin:0;display:inline-block;}
  9. </style>
  10. <div class="all">
  11. <div id="app" v-cloak>
  12. <div class="vue-head">
  13. <div class="top-title">
  14. <span :class="item.class" v-for="(item,index) in albumTopTitle" @click="skipUrl(item)" :key="index">[[item.name]]</span>
  15. </div>
  16. </div>
  17. <div class="vue-main">
  18. <div class="vue-main-title">
  19. <div class="vue-main-title-left"></div>
  20. <div class="vue-main-title-content">配送模板列表</div>
  21. <div class="vue-main-title-button">
  22. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新增配送模板</el-button>
  23. </div>
  24. </div>
  25. <div class="vue-search">
  26. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  27. <el-form-item label="" prop="">
  28. <el-select v-model="search_form.middleground_configuration_id" placeholder="请选择供应链" clearable remote filterable >
  29. <el-option v-for="item in middleground_configuration" :key="item.id" :label="item.title" :value="item.id"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-button type="primary" @click="cutMiddlegroundConfiguration">切换</el-button>
  33. </el-form>
  34. </div>
  35. <div class="vue-main-form">
  36. <el-table :data="list" style="width: 100%">
  37. <el-table-column prop="id" label="ID" align="center" width="90"></el-table-column>
  38. <el-table-column prop="name" label="配送方式名称" align="center"></el-table-column>
  39. <el-table-column prop="id" label="计费方式" align="center">
  40. <template slot-scope="scope">
  41. <div>
  42. [[scope.row.type==1?'按件计费':'按重量计费']]
  43. </div>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="refund_time" label="操作" align="center" width="250">
  47. <template slot-scope="scope">
  48. {{-- <el-link title="编辑模板" :underline="false" :href="'{{ yzWebUrl('plugin.yz-supply.admin.cloud.cloud-dispatch.edit', array('id' => '')) }}'+[[scope.row.id]]+','+[[search_form.middleground_configuration_id]]" style="width:50px;">--}}
  49. <el-link title="编辑模板" :underline="false" @click="edit(scope.row.id)" style="width:50px;">
  50. <i class="iconfont icon-ht_operation_edit"></i>
  51. </el-link>
  52. <el-link title="删除模板" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  53. <i class="iconfont icon-ht_operation_delete"></i>
  54. </el-link>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. </div>
  59. </div>
  60. <!-- 分页 -->
  61. <div class="vue-page" v-if="total>0">
  62. <el-row>
  63. <el-col align="right">
  64. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  65. :page-size="per_page" :current-page="current_page" background
  66. ></el-pagination>
  67. </el-col>
  68. </el-row>
  69. </div>
  70. </div>
  71. </div>
  72. <script>
  73. var app = new Vue({
  74. el: "#app",
  75. delimiters: ['[[', ']]'],
  76. name: 'test',
  77. data() {
  78. return {
  79. albumTopTitle: [
  80. {
  81. id: 1,
  82. name: "基础设置",
  83. class:"album-name-against",
  84. url:"{!! yzWebFullUrl('plugin.yz-supply.admin.cloud.cloud-set.index') !!}"
  85. },
  86. {
  87. id: 2,
  88. name: "分类匹配",
  89. class:"album-name-against",
  90. url:"{!! yzWebFullUrl('plugin.yz-supply.admin.cloud.cloud-category.index') !!}"
  91. },
  92. {
  93. id: 3,
  94. name: "运费模板",
  95. class:"album-name",
  96. url:"{!! yzWebFullUrl('plugin.yz-supply.admin.cloud.cloud-dispatch.index') !!}"
  97. },
  98. ],
  99. list:[],
  100. change_sort:'',
  101. middleground_configuration:[],
  102. search_form:{
  103. middleground_configuration_id:0,
  104. },
  105. rules: {},
  106. current_page:1,
  107. total:1,
  108. per_page:1,
  109. }
  110. },
  111. created() {
  112. },
  113. mounted() {
  114. this.getMiddlegroundConfiguration();
  115. },
  116. methods: {
  117. skipUrl(item){
  118. window.location.href = item.url
  119. },
  120. edit(id){
  121. window.location.href = "{!! yzWebUrl('plugin.yz-supply.admin.cloud.cloud-dispatch.edit') !!}&id="+id+"&middleground_configuration_id="+this.search_form.middleground_configuration_id
  122. },
  123. cutMiddlegroundConfiguration(){
  124. this.getData(1);
  125. },
  126. getMiddlegroundConfiguration(){
  127. this.$http.post('{!! yzWebFullUrl('plugin.yz-supply.admin.middleground-configuration.get-middleground-configurations') !!}').then(function (response) {
  128. if (response.data.result) {
  129. this.middleground_configuration = response.data.data;
  130. this.search_form.middleground_configuration_id = this.middleground_configuration[0].id;
  131. this.getData(1);
  132. } else {
  133. this.$message({message: response.data.msg, type: 'error'});
  134. }
  135. }, function (response) {
  136. this.$message({message: response.data.msg, type: 'error'});
  137. })
  138. },
  139. getData(page) {
  140. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  141. this.$http.post('{!! yzWebFullUrl('plugin.yz-supply.admin.cloud.cloud-dispatch.index') !!}',{page:page,middleground_configuration_id:this.search_form.middleground_configuration_id }).then(function(response) {
  142. if (response.data.result) {
  143. this.list = response.data.data.data;
  144. this.current_page=response.data.data.current_page;
  145. this.total=response.data.data.total;
  146. this.per_page=response.data.data.per_page;
  147. loading.close();
  148. } else {
  149. this.$message({
  150. message: response.data.msg,
  151. type: 'error'
  152. });
  153. }
  154. loading.close();
  155. }, function(response) {
  156. this.$message({
  157. message: response.data.msg,
  158. type: 'error'
  159. });
  160. loading.close();
  161. });
  162. },
  163. // 添加
  164. addModal() {
  165. let link = `{!! yzWebFullUrl('plugin.yz-supply.admin.cloud.cloud-dispatch.add') !!}`;
  166. console.log(link);
  167. window.location.href = link;
  168. },
  169. search(val) {
  170. this.getData(val);
  171. },
  172. del(id,index) {
  173. console.log(id,index)
  174. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  175. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  176. this.$http.post('{!! yzWebFullUrl('plugin.yz-supply.admin.cloud.cloud-dispatch.delete') !!}',{id:id,middleground_configuration_id:this.search_form.middleground_configuration_id}).then(function (response) {
  177. if (response.data.result) {
  178. this.list.splice(index,1);
  179. this.$message({type: 'success',message: '删除成功!'});
  180. }
  181. else{
  182. this.$message({type: 'error',message: response.data.msg});
  183. }
  184. loading.close();
  185. this.search(this.current_page)
  186. },function (response) {
  187. this.$message({type: 'error',message: response.data.msg});
  188. loading.close();
  189. }
  190. );
  191. }).catch(() => {
  192. this.$message({type: 'info',message: '已取消删除'});
  193. });
  194. },
  195. },
  196. })
  197. </script>
  198. @endsection