list.blade.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. @extends('layouts.base')
  2. @section('会员分组')
  3. @section('content')
  4. <!-- 全局样式 -->
  5. <link href="{{static_url('yunshop/css/total.css')}}" media="all" rel="stylesheet" type="text/css" />
  6. <style scoped>
  7. .vue-title {
  8. display: flex;
  9. margin: 5px 0;
  10. line-height: 32px;
  11. font-size: 16px;
  12. color: #333;
  13. font-weight: 600;
  14. }
  15. .vue-title-left {
  16. width: 4px;
  17. height: 18px;
  18. margin-top: 6px;
  19. background: #29ba9c;
  20. display: inline-block;
  21. margin-right: 10px;
  22. }
  23. .vue-title-content {
  24. font-size: 14px;
  25. flex: 1;
  26. }
  27. .btnClass {
  28. font-size: 14px;
  29. width: 100px;
  30. height: 40px;
  31. line-height: 40px;
  32. text-align: center;
  33. border: 1px solid #29ba9c;
  34. border-radius: 10px;
  35. color: #29ba9c;
  36. cursor: pointer;
  37. }
  38. .vue-title .el-link--inner {
  39. color: #29ba9c;
  40. }
  41. .el-table {
  42. /* margin-left:55px; */
  43. }
  44. .cell {
  45. color: black;
  46. opacity: .9;
  47. font-size: 13px;
  48. font-family: inherit;
  49. text-align: center;
  50. }
  51. /* 小窗超出隐藏 */
  52. .el-table--scrollable-x .el-table__body-wrapper {
  53. overflow: hidden;
  54. }
  55. </style>
  56. <div class="all">
  57. <div id="app">
  58. <div class="total-head" style="padding-bottom:50px">
  59. <div class="vue-title">
  60. <div class="vue-title-left"></div>
  61. <div class="vue-title-content">会员分组</div>
  62. <el-link :underline="false" class="btnClass" href="{{ yzWebUrl('member.member-group.form') }}">+添加新分组</el-link>
  63. </div>
  64. <el-table v-loading="loading" :data="tableList" style="width: 100%">
  65. <el-table-column label="分组名称">
  66. <template slot-scope="scope">
  67. <span style="margin-left: 10px">[[scope.row.group_name]]</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="会员数">
  71. <template slot-scope="scope">
  72. <p>[[ scope.row.member.count ? scope.row.member.count : 0 ]]</p>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="操作">
  76. <template slot-scope="scope">
  77. <el-link :underline='false' :href="'{{yzWebUrl('member.member.index', array('search' => '5','groupid' => ''))}}'+[[scope.row.id]]">
  78. <i class="el-icon-s-custom" style="font-size: 20px;cursor: pointer;margin-right: 10px;"></i>
  79. </el-link>
  80. <el-link :underline='false' :href="'{{yzWebUrl('member.member-group.form', array('id' => ''))}}'+[[scope.row.id]]">
  81. <i class="el-icon-edit" style="font-size: 20px;cursor: pointer;margin-right: 10px;"></i>
  82. </el-link>
  83. <i class="el-icon-delete" @click="handleDelete(scope.$index, scope.row)" style="font-size: 20px;cursor: pointer;"></i>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <!-- <div style="margin-top:50px">
  88. <el-pagination layout="prev, pager, next,jumper" background style="text-align:center" :page-size="pagesize" :current-page="currentPage" :total="total" @current-change="handleCurrentChange">
  89. </el-pagination>
  90. </div> -->
  91. </div>
  92. <!-- 分页 -->
  93. <div class="fixed total-floo">
  94. <div class="fixed_box">
  95. <el-pagination background style="text-align: right;" @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pagesize" layout="prev, pager, next, jumper" :total="total">
  96. </el-pagination>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <script>
  102. var vm = new Vue({
  103. el: '#app',
  104. delimiters: ['[[', ']]'],
  105. data() {
  106. return {
  107. tableData: [{
  108. id: "1",
  109. groupName: '分组一',
  110. memberNum: '12',
  111. }, {
  112. id: "2",
  113. groupName: '分组二',
  114. memberNum: '12',
  115. }, {
  116. id: "3",
  117. groupName: '分组三',
  118. memberNum: '12',
  119. }, {
  120. id: "4",
  121. groupName: '分组四',
  122. memberNum: '12',
  123. }],
  124. tableList: [],
  125. //分页
  126. total: 1,
  127. pagesize: 1,
  128. currentPage: 1,
  129. loading: false
  130. }
  131. },
  132. created() {
  133. //优化在不同设备固定定位挡住的现象设置父元素的内边距
  134. window.onload = function() {
  135. let all = document.querySelector(".all");
  136. let h = window.innerHeight * 0.04;
  137. all.style.paddingBottom = h + "px";
  138. }
  139. this.postGroupData(1);
  140. },
  141. methods: {
  142. //列表数据请求
  143. postGroupData(page) {
  144. this.$http.post("{!!yzWebFullUrl('member.member-group.show')!!}", {
  145. page: page
  146. }).then(res => {
  147. if (res.status === 200) {
  148. // this.$message.success("列表请求成功")
  149. this.loading = true;
  150. setTimeout(() => {
  151. this.loading = false;
  152. }, 500)
  153. console.log(res);
  154. let {
  155. data: data,
  156. current_page: page,
  157. per_page: per,
  158. total: total,
  159. } = res.body.data.groupList;
  160. //数据列表
  161. this.tableList = data;
  162. //总页数
  163. this.total = total;
  164. //一页显示多少条数据
  165. this.pagesize = per;
  166. //当前页码
  167. this.currentPage = page;
  168. }
  169. })
  170. },
  171. //分组事件
  172. handleCurrentChange(page) {
  173. // console.log(page);
  174. this.postGroupData(page);
  175. },
  176. handleEdit(index, row) {
  177. console.log(index, row);
  178. },
  179. handleDelete(index, row) {
  180. // this.tableList = this.tableList.filter(item => row.id != item.id)
  181. console.log(index);
  182. console.log(row);
  183. this.$confirm('确定删除当前分组?, 是否继续?', '提示', {
  184. confirmButtonText: '确定',
  185. cancelButtonText: '取消',
  186. type: 'warning'
  187. }).then(() => {
  188. //点击确定的操作(调用接口)
  189. this.$http.post("{!!yzWebFullUrl('member.member-group.destroy')!!}", {
  190. group_id: row.id
  191. }).then(res => {
  192. if (res.status == 200) {
  193. this.$message.success("删除成功")
  194. this.postGroupData(this.currentPage);
  195. } else {
  196. this.$message.error("删除失败")
  197. }
  198. })
  199. })
  200. },
  201. }
  202. })
  203. </script>@endsection