freight.blade.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. <style>
  6. .el-tabs__item,.is-top{font-size:16px}
  7. .el-tabs__active-bar { height: 3px;}
  8. </style>
  9. <div class="all">
  10. <div id="app" v-cloak>
  11. <div class="vue-nav">
  12. <el-tabs v-model="activeName" @tab-click="handleClick">
  13. <el-tab-pane label="折扣全局设置" name="1"></el-tab-pane>
  14. <el-tab-pane label="折扣设置" name="2"></el-tab-pane>
  15. <el-tab-pane label="运费批量设置" name="3"></el-tab-pane>
  16. </el-tabs>
  17. </div>
  18. <div class="vue-main">
  19. <div class="vue-main-title">
  20. <div class="vue-main-title-left"></div>
  21. <div class="vue-main-title-content">折扣运费设置</div>
  22. </div>
  23. <div class="vue-main-form">
  24. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  25. <el-form-item label="" prop="batch_list">
  26. <template v-for="(item,index) in form.batch_list">
  27. <el-input :value="item.new_name" style="width:60%;padding:10px 0;" disabled></el-input>
  28. <a v-bind:href="'{{ yzWebUrl('discount.batch-dispatch.update-freight', array('id' => '')) }}'+[[form.batch_list[index].id]]">
  29. <el-button>编辑</el-button>
  30. </a>
  31. <el-button type="danger" icon="el-icon-close" @click="delBatch(index,form.batch_list[index].id)"></el-button>
  32. </template><br>
  33. <a href="{{ yzWebFullUrl('discount.batch-dispatch.freight-set') }}">
  34. <el-button type="primary">添加批量运费</el-button>
  35. </a>
  36. </el-form-item>
  37. </el-form>
  38. </div>
  39. </div>
  40. <!-- 分页 -->
  41. <!-- <div class="vue-page">
  42. <div class="vue-center">
  43. <el-button type="primary" @click="submitForm('form')">保存设置</el-button>
  44. <el-button @click="goBack">返回</el-button>
  45. </div>
  46. </div> -->
  47. <!--end-->
  48. </div>
  49. </div>
  50. <script>
  51. var vm = new Vue({
  52. el:"#app",
  53. delimiters: ['[[', ']]'],
  54. data() {
  55. // let batch_list = [
  56. // {
  57. // category_ids: [
  58. // {id: 20,name: "1.1"},
  59. // ],
  60. // // created_at: "2019-02-19 13:43:28",
  61. // // discount_method: 1,
  62. // id: 18,
  63. // // level_discount_type: 1,
  64. // new_name: "[ID:20][分类:1.1]",
  65. // // uniacid: 2
  66. // // updated_at: "2019-02-19 13:43:28",
  67. // }
  68. // ];
  69. return{
  70. form:{
  71. batch_list:[],
  72. },
  73. activeName:'3',
  74. loading: false,
  75. submit_loading: false,
  76. rules: {
  77. },
  78. }
  79. },
  80. methods: {
  81. delBatch(index,id){
  82. if(!id){
  83. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  84. this.form.batch_list.splice(index,1);
  85. this.$message({type: 'success',message: '删除成功111!'});
  86. }).catch(() => {
  87. this.$message({type: 'info',message: '已取消删除'});
  88. });
  89. }
  90. else{
  91. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  92. this.table_loading=true;
  93. this.$http.post('{!! yzWebFullUrl('discount.batch-dispatch.delete-freigh') !!}',{id:id}).then(function (response) {
  94. console.log(response.data);
  95. if (response.data.result) {
  96. this.form.batch_list.splice(index,1);
  97. this.$message({type: 'success',message: '删除成功!'});
  98. }
  99. else{
  100. this.$message({type: 'error',message: response.data.msg});
  101. }
  102. this.table_loading=false;
  103. },function (response) {
  104. this.$message({type: 'error',message: response.data.msg});
  105. this.table_loading=false;
  106. }
  107. );
  108. }).catch(() => {
  109. this.$message({type: 'info',message: '已取消删除'});
  110. });
  111. }
  112. },
  113. handleClick(val) {
  114. console.log(val.name)
  115. if(val.name == 1) {
  116. window.location.href = `{!! yzWebFullUrl('discount.batch-discount.allSet') !!}`;
  117. }
  118. else if(val.name == 2) {
  119. window.location.href = `{!! yzWebFullUrl('discount.batch-discount.index') !!}`;
  120. }
  121. else if(val.name == 3) {
  122. window.location.href = `{!! yzWebFullUrl('discount.batch-dispatch.freight') !!}`;
  123. }
  124. },
  125. // settingBatch(index,id) {
  126. // console.log(index,id);
  127. // window.location.href='{!! yzWebFullUrl('discount.batch-discount.store') !!}';
  128. // },
  129. },
  130. created(){
  131. this.$http.get("{!! yzWebUrl('discount.batch-dispatch.get-set') !!}" ).then(response => {
  132. let batch_list=response.data.data
  133. for(let i=0;i<batch_list.length;i++){
  134. batch_list[i].new_name=[];
  135. for(let j=0;j<batch_list[i].category_ids.length;j++){
  136. batch_list[i].new_name[j] = "[ID:"+batch_list[i].category_ids[j].id+"][分类:"+batch_list[i].category_ids[j].name+"]";
  137. }
  138. batch_list[i].new_name = batch_list[i].new_name.join(",");
  139. }
  140. this.form.batch_list=batch_list
  141. }, response => {
  142. console.log(response);
  143. });
  144. }
  145. });
  146. </script>
  147. @endsection