label-list.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. </style>
  7. <div class="all">
  8. <div id="app" v-cloak>
  9. {{--<div class="vue-head"></div>--}}
  10. <div class="vue-main">
  11. <div class="vue-main-form">
  12. <div class="vue-main-title" style="margin-bottom:20px">
  13. <div class="vue-main-title-left"></div>
  14. <div class="vue-main-title-content" style="flex:0 0 120px">服务标签列表</div>
  15. <div class="vue-main-title-button">
  16. </div>
  17. </div>
  18. <el-table :data="list" style="width: 100%" v-loading="table_loading">
  19. <el-table-column prop="label_id" label="标签编号" align="center"></el-table-column>
  20. <el-table-column label="标签图标" align="center" prop="has_one_member">
  21. <template slot-scope="scope">
  22. <div v-if="scope.row.pic">
  23. <img :src="scope.row.pic" alt="" style="width:40px;height:40px;border-radius:50%">
  24. </div>
  25. </template>
  26. </el-table-column>
  27. <el-table-column prop="name" label="标签名称" max-width="100" align="center"></el-table-column>
  28. <el-table-column prop="status" label="标签状态" align="center">
  29. <template slot-scope="scope">
  30. <el-switch v-model="scope.row.status"
  31. @change="editEnable(scope.row.label_id, scope.row.status)"
  32. :active-value="1"
  33. :inactive-value="0">
  34. </el-switch>
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="操作" align="center">
  38. <template slot-scope="scope">
  39. <el-button type="primary" size="medium" @click="editLabel(scope.row.label_id)">编&nbsp;辑</el-button>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. </div>
  44. </div>
  45. <!-- 分页 -->
  46. {{--<div class="vue-page" v-if="total>0">--}}
  47. {{--<el-row>--}}
  48. {{--<el-col align="right">--}}
  49. {{--<el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"--}}
  50. {{--:page-size="per_page" :current-page="current_page" background--}}
  51. {{--></el-pagination>--}}
  52. {{--</el-col>--}}
  53. {{--</el-row>--}}
  54. {{--</div>--}}
  55. </div>
  56. </div>
  57. <script>
  58. var app = new Vue({
  59. el: "#app",
  60. delimiters: ['[[', ']]'],
  61. data() {
  62. return {
  63. list:[],
  64. loading: false,
  65. table_loading: false,
  66. //分页
  67. total: 0,
  68. per_page: 0,
  69. current_page: 0,
  70. rules: {},
  71. }
  72. },
  73. created() {
  74. },
  75. mounted() {
  76. let result = this.viewReturn();
  77. this.__initial(result);
  78. },
  79. methods: {
  80. //视图返回数据
  81. viewReturn() {
  82. return {!! $data?:'{}' !!};
  83. },
  84. //初始化页面数据,请求链接
  85. __initial(data) {
  86. if (data.label_list) {
  87. this.list = data.label_list;
  88. }
  89. console.log(data);
  90. },
  91. editLabel(label_id) {
  92. window.location.href = `{!! yzWebFullUrl('plugin.label.admin.set.edit') !!}`+`&id=`+label_id;
  93. },
  94. editEnable(label_id,status) {
  95. this.$http.post('{!! yzWebFullUrl('plugin.label.admin.set.edit-enable') !!}',{label_id:label_id,status:status}).then(function (response) {
  96. if (response.data.result) {
  97. this.$message({type: 'success',message: '设置成功!'});
  98. } else{
  99. this.$message({type: 'error',message: response.data.msg});
  100. }
  101. location.reload()
  102. },function (response) {
  103. this.$message({type: 'error',message: response.data.msg});
  104. })
  105. },
  106. },
  107. })
  108. </script>
  109. @endsection