list.blade.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. @extends('layouts.base')
  2. @section('title', '会员等级')
  3. @section('content')
  4. <link href="{{static_url('yunshop/css/total.css')}}" media="all" rel="stylesheet" type="text/css" />
  5. <style>
  6. .vue-title {
  7. display: flex;
  8. margin: 5px 0;
  9. line-height: 32px;
  10. font-size: 16px;
  11. color: #333;
  12. font-weight: 600;
  13. }
  14. .vue-title-left {
  15. width: 4px;
  16. height: 18px;
  17. margin-top: 6px;
  18. background: #29ba9c;
  19. display: inline-block;
  20. margin-right: 10px;
  21. }
  22. .vue-title-content {
  23. font-size: 14px;
  24. flex: 1;
  25. }
  26. .btnClass {
  27. font-size: 14px;
  28. width: 100px;
  29. height: 40px;
  30. line-height: 40px;
  31. text-align: center;
  32. border: 1px solid;
  33. border-radius: 10px;
  34. color: #29ba9c;
  35. border-color: #29ba9c;
  36. cursor: pointer;
  37. }
  38. .vue-title .el-link--inner {
  39. color: #29ba9c;
  40. }
  41. </style>
  42. <div class="all">
  43. <div id="app">
  44. <div class="total-head" style="padding-bottom:50px;">
  45. <div class="vue-title">
  46. <div class="vue-title-left"></div>
  47. <div class="vue-title-content">会员等级</div>
  48. <el-link class="btnClass" :underline="false" href="{{ yzWebUrl('member.member-level.form') }}">+添加新等级</el-link>
  49. </div>
  50. <el-table v-loading="loading" :data="tableList" style="width: 100%">
  51. <el-table-column label="等级权重" align="center">
  52. <template slot-scope="scope">
  53. <span style="margin-left: 10px">[[scope.row.level]]</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="等级名称" align="center">
  57. <template slot-scope="scope">
  58. <p>[[ scope.row.level_name ]]</p>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="升级条件" align="center">
  62. <template slot-scope="scope">
  63. <div v-if="level_type!==null && level_type !== 0">
  64. <div v-if="level_type == 1">
  65. <p v-if="scope.row.order_count!==null && scope.row.order_count>0">
  66. 订单数量满[ [[scope.row.order_count]] ]个
  67. </p>
  68. <p v-else>不自动升级</p>
  69. </div>
  70. <div v-else-if="level_type == 2">
  71. <p v-if="scope.row.goods_id">
  72. 购买商品[ID: [[scope.row.goods_id]] ] [[scope.row.goods!==null ? scope.row.goods.title : "" ]]升级
  73. </p>
  74. <p v-else>不自动升级</p>
  75. </div>
  76. <div v-else-if="level_type == 3">
  77. <p>
  78. 团队业绩满 [ [[scope.row.team_performance ? scope.row.team_performance : 0]] ] 元升级
  79. </p>
  80. </div>
  81. <div v-else-if="level_type == 4">
  82. <p>
  83. 余额一次性充值满[ [[scope.row.balance_recharge ? scope.row.balance_recharge : 0]] ]元升级
  84. </p>
  85. </div>
  86. </div>
  87. <div v-else>
  88. <p v-if="scope.row.order_money!==null && scope.row.order_money>0">
  89. 订单金额满[ [[scope.row.order_money]] ]元
  90. </p>
  91. <p v-else>不自动升级</p>
  92. </div>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="操作" align="center">
  96. <template slot-scope="scope">
  97. <!-- 更新 -->
  98. <el-link :underline='false' :href="'{{yzWebUrl('member.member-level.form', array('id' => ''))}}'+[[scope.row.id]]">
  99. <i class="el-icon-edit" style="font-size: 20px;cursor: pointer;margin-right: 10px;"></i>
  100. </el-link>
  101. <!-- 删除 -->
  102. <i class="el-icon-delete" @click="handleDelete(scope.$index, scope.row)" style="font-size: 20px;cursor: pointer;"></i>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. </div>
  107. <!-- 分页 -->
  108. <div v-if="tableList.length!==0" class="fixed total-floo">
  109. <div class="fixed_box">
  110. <el-pagination background style="text-align: right;" @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pagesize" layout="prev, pager, next, jumper" :total="total">
  111. </el-pagination>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <script>
  117. var vm = new Vue({
  118. el: "#app",
  119. delimiters: ['[[', ']]'],
  120. data() {
  121. return {
  122. tableData: [],
  123. tableList: [],
  124. //页码数
  125. currentPage: 1,
  126. //一页显示数据
  127. pagesize: 1,
  128. //总页数
  129. total: 1,
  130. //加载
  131. loading: false,
  132. level_type: null
  133. }
  134. },
  135. created() {
  136. //优化在不同设备固定定位挡住的现象设置父元素的内边距
  137. window.onload = function() {
  138. let all = document.querySelector(".all");
  139. let h = window.innerHeight * 0.04;
  140. all.style.paddingBottom = h + "px";
  141. }
  142. this.postLevel(1);
  143. },
  144. methods: {
  145. postLevel(page) {
  146. this.$http.post("{!!yzWebFullUrl('member.member-level.show')!!}", {
  147. page: page
  148. }).then(res => {
  149. if (res.status === 200) {
  150. // this.$message.success("请求列表成功")
  151. // this.loading = true;
  152. // setTimeout(() => {
  153. // this.loading = false;
  154. // }, 500)
  155. let {
  156. data: data,
  157. total: total,
  158. per_page: per,
  159. current_page: page
  160. } = res.body.data.levelList;
  161. console.log(res);
  162. console.log(data);
  163. if(data!==null && data.length!==0){
  164. //等级列表数据
  165. this.tableList = data;
  166. }else{
  167. this.tableList = [];
  168. }
  169. //总数
  170. this.total = total;
  171. //一页显示多少条数据
  172. this.pagesize = per;
  173. //当前页码
  174. this.currentPage = page
  175. //判断购买条件
  176. let {
  177. level_type
  178. } = res.body.data;
  179. this.level_type = Number(level_type);
  180. // console.log(this.level_type,84654);
  181. } else {
  182. this.$message.error(res.data.msg)
  183. }
  184. })
  185. },
  186. handleCurrentChange(page) {
  187. console.log(page);
  188. this.postLevel(page);
  189. },
  190. handleEdit(index, row) {
  191. console.log(index, row);
  192. },
  193. //删除当前会员等级
  194. handleDelete(index, row) {
  195. console.log(row.id);
  196. this.$confirm('确定删除当前等级?, 是否继续?', '提示', {
  197. confirmButtonText: '确定',
  198. cancelButtonText: '取消',
  199. type: 'warning'
  200. }).then(() => {
  201. console.log(row.id,99999);
  202. //点击确定的操作(调用接口)
  203. this.$http.post("{!!yzWebFullUrl('member.member-level.destroy')!!}", {
  204. id: row.id
  205. }).then(res => {
  206. if (res.data.result === 1) {
  207. this.loading = true;
  208. this.$message.success("删除成功")
  209. setTimeout(() => {
  210. this.loading = false;
  211. }, 300)
  212. this.postLevel(this.currentPage);
  213. // history.go(0);
  214. } else {
  215. this.$message.error("删除失败")
  216. }
  217. })
  218. })
  219. }
  220. }
  221. })
  222. </script>
  223. @endsection