index.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <div id="app" v-cloak>
  2. <el-card shadow="never" style="border:0;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div slot="header">
  4. <el-breadcrumb separator="/">
  5. <el-breadcrumb-item>
  6. 等级列表
  7. </el-breadcrumb-item>
  8. </el-breadcrumb>
  9. </div>
  10. <div class="table-body">
  11. <!-- 添加 -->
  12. <template>
  13. <el-button @click="addLevel" size="mini" type="success">添加等级</el-button>
  14. <!-- <el-button @click="toCondition" size="mini" type="warning">设置升级条件</el-button> -->
  15. </template>
  16. <!-- 订单信息 -->
  17. <template>
  18. <el-table ref="multipleTable" :data="list" @selection-change="handleSelectionChange">
  19. <!-- 空数据 -->
  20. <template slot="empty">
  21. <el-empty description="暂无等级"></el-empty>
  22. </template>
  23. <!-- 数据 -->
  24. <el-table-column type="selection"></el-table-column>
  25. <el-table-column prop="id" align="center" label="ID"></el-table-column>
  26. <el-table-column prop="name" align="center" label="等级权重">
  27. <template slot-scope="scope">
  28. 等级{{ scope.row.level }}
  29. </template>
  30. </el-table-column>
  31. <el-table-column prop="name" align="center" label="等级名称"></el-table-column>
  32. <el-table-column prop="name" align="center" label="一级佣金">
  33. <template slot-scope="scope">
  34. {{ scope.row.commission1_value }}
  35. <span v-if="scope.row.commission1_type == 1">%</span>
  36. <span v-if="scope.row.commission1_type == 2">元</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="name" align="center" label="二级佣金">
  40. <template slot-scope="scope">
  41. {{ scope.row.commission2_value }}
  42. <span v-if="scope.row.commission2_type == 1">%</span>
  43. <span v-if="scope.row.commission2_type == 2">元</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="name" align="center" label="启动状态">
  47. <template slot-scope="scope">
  48. <el-switch
  49. :active-value="1"
  50. :inactive-value="0"
  51. @change="handleSwitch(scope.row)"
  52. v-model="scope.row.status">
  53. </el-switch>
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="created_at" label="创建时间" align="center">
  57. <template slot-scope="scope">
  58. {{ scope.row.created_at|dateTimeFormat('Y-m-d H:i:s') }}
  59. </template>
  60. </el-table-column>
  61. <el-table-column align="center" label="标题">
  62. <template slot-scope="scope">
  63. <el-button :loading="btnLoading" type="text" @click.stop="editLevel(scope.row.id)">
  64. 编辑
  65. </el-button>
  66. <el-button :loading="btnLoading" type="text" @click.stop="delLevel(scope.row.id)">
  67. 删除
  68. </el-button>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </template>
  73. <!-- 分页 -->
  74. <el-row type="flex" class="page" justify="end" style="margin-top: 15px">
  75. <el-pagination
  76. @current-change="pagination"
  77. background
  78. layout="prev, pager, next"
  79. :page-count="pageCount"
  80. v-if="list"
  81. ></el-pagination>
  82. </el-row>
  83. </div>
  84. </el-card>
  85. </div>
  86. <script>
  87. const app = new Vue({
  88. el: '#app',
  89. data() {
  90. return {
  91. limit: 20,
  92. list: [],
  93. pageCount: 0,
  94. page: 1,
  95. currentPage: null,
  96. listLoading: false,
  97. btnLoading: false,
  98. dialogVisible: false,
  99. };
  100. },
  101. methods: {
  102. addLevel() {
  103. navigateTo({
  104. r: 'operation-center/level/edit'
  105. })
  106. },
  107. toCondition() {
  108. navigateTo({
  109. r: 'operation-center/level/condition'
  110. })
  111. },
  112. handleSelectionChange(val) {
  113. this.select_order = val
  114. },
  115. // 全选
  116. allSelect() {
  117. if (this.checked) {
  118. this.goods_list.forEach(function(item, index) {
  119. if (!item.storage) {
  120. item.is_select = true
  121. }
  122. })
  123. } else {
  124. this.goods_list.forEach(function(item, index) {
  125. item.is_select = false
  126. })
  127. }
  128. },
  129. //搜索
  130. onSubmit() {
  131. this.page = 1
  132. this.getPageList()
  133. },
  134. pagination(currentPage) {
  135. this.page = currentPage
  136. this.getPageList()
  137. },
  138. getPageList() {
  139. this.listLoading = true;
  140. let params = {
  141. r: 'operation-center/level/index',
  142. page: this.page,
  143. limit: this.limit
  144. }
  145. params = Object.assign(params, this.searchData)
  146. request({
  147. params: params,
  148. method: 'get',
  149. }).then(e => {
  150. if (e.data.code === 0) {
  151. this.list = e.data.data.list
  152. this.pageCount = e.data.data.page_count
  153. this.currentPage = e.data.data.current_page
  154. } else {
  155. this.$message.error(e.data.msg)
  156. }
  157. this.listLoading = false
  158. })
  159. },
  160. //重置
  161. resetForm() {
  162. this.searchData = {
  163. user_id : undefined,
  164. user_keyword : undefined,
  165. order_no : undefined,
  166. time : [],
  167. }
  168. },
  169. editLevel(id) {
  170. navigateTo({
  171. r: 'operation-center/level/edit',
  172. id: id,
  173. })
  174. },
  175. delLevel(id) {
  176. this.$confirm('确定删除吗?', '提示', {
  177. confirmButtonText: '确定',
  178. cancelButtonText: '取消',
  179. type: 'warning'
  180. }).then(() => {
  181. this.btnLoading = true
  182. request({
  183. params: {
  184. r: 'operation-center/level/del-level',
  185. id: id,
  186. },
  187. method: 'get',
  188. }).then(e => {
  189. if (e.data.code === 0) {
  190. this.getPageList()
  191. } else {
  192. this.$message.error(e.data.msg);
  193. }
  194. this.btnLoading = false
  195. })
  196. })
  197. },
  198. handleSwitch(row) {
  199. request({
  200. params: {
  201. r: 'operation-center/level/switch-status',
  202. id: row.id,
  203. status: row.status,
  204. },
  205. method: 'get',
  206. }).then(e => {
  207. if (e.data.code === 0) {
  208. }
  209. })
  210. },
  211. },
  212. mounted: function() {
  213. this.page = getQuery('page') ? getQuery('page') : 1
  214. this.limit = getQuery('limit') ? getQuery('limit') : 20
  215. this.getPageList()
  216. }
  217. });
  218. </script>
  219. <style>
  220. </style>