discount.blade.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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-discount.update-set', 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-discount.store') }}">
  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. return{
  56. form:{
  57. batch_list:[],
  58. },
  59. activeName:'2',
  60. loading: false,
  61. submit_loading: false,
  62. rules: {
  63. },
  64. }
  65. },
  66. methods: {
  67. delBatch(index,id){
  68. if(!id){
  69. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  70. this.form.batch_list.splice(index,1);
  71. this.$message({type: 'success',message: '删除成功!'});
  72. }).catch(() => {
  73. this.$message({type: 'info',message: '已取消删除'});
  74. });
  75. }
  76. else{
  77. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  78. this.table_loading=true;
  79. this.$http.post('{!! yzWebFullUrl('discount.batch-discount.delete-set') !!}',{id:id}).then(function (response) {
  80. console.log(response.data);
  81. if (response.data.result) {
  82. this.form.batch_list.splice(index,1);
  83. this.$message({type: 'success',message: '删除成功!'});
  84. }
  85. else{
  86. this.$message({type: 'error',message: response.data.msg});
  87. }
  88. this.table_loading=false;
  89. },function (response) {
  90. this.$message({type: 'error',message: response.data.msg});
  91. this.table_loading=false;
  92. }
  93. );
  94. }).catch(() => {
  95. this.$message({type: 'info',message: '已取消删除'});
  96. });
  97. }
  98. },
  99. handleClick(val) {
  100. console.log(val.name)
  101. if(val.name == 1) {
  102. window.location.href = `{!! yzWebFullUrl('discount.batch-discount.allSet') !!}`;
  103. }
  104. else if(val.name == 2) {
  105. window.location.href = `{!! yzWebFullUrl('discount.batch-discount.index') !!}`;
  106. }
  107. else if(val.name == 3) {
  108. window.location.href = `{!! yzWebFullUrl('discount.batch-dispatch.freight') !!}`;
  109. }
  110. },
  111. // settingBatch(index,id) {
  112. // console.log(index,id);
  113. // window.location.href='{!! yzWebFullUrl('discount.batch-discount.store') !!}';
  114. // },
  115. },
  116. created(){
  117. this.$http.get("{!! yzWebUrl('discount.batch-discount.get-set') !!}" ).then(response => {
  118. let batch_list=response.data.data
  119. for(let i=0;i<batch_list.length;i++){
  120. batch_list[i].new_name=[];
  121. for(let j=0;j<batch_list[i].category_ids.length;j++){
  122. batch_list[i].new_name[j] = "[ID:"+batch_list[i].category_ids[j].id+"][分类:"+batch_list[i].category_ids[j].name+"]";
  123. }
  124. batch_list[i].new_name = batch_list[i].new_name.join(",");
  125. }
  126. this.form.batch_list=batch_list
  127. }, response => {
  128. console.log(response);
  129. });
  130. }
  131. });
  132. </script>
  133. @endsection