index.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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. <span>客户列表</span>
  5. </div>
  6. <div class="search-box">
  7. <!-- 搜索 -->
  8. <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
  9. <el-form-item label="会员ID">
  10. <el-input placeholder="请输入会员ID" v-model="searchForm.id"></el-input>
  11. </el-form-item>
  12. <el-form-item label="手机号码">
  13. <el-input placeholder="请输入手机号码" v-model="searchForm.mobile"></el-input>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button type="primary" @click="search">搜索</el-button>
  17. <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
  18. </el-form-item>
  19. </el-form>
  20. </div>
  21. <div class="table-body">
  22. <el-tabs>
  23. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
  24. <el-table-column prop="id" min-width="30" label="会员ID" align="center"></el-table-column>
  25. <el-table-column label="用户信息" align="center" width="180">
  26. <template slot-scope="scope">
  27. <com-image style="float: left;margin-right: 5px;" class="avatar_url" mode="aspectFill" :src="scope.row.avatar_url ? scope.row.avatar_url : '/resources/img/common/default-avatar.png'"></com-image>
  28. <div>{{scope.row.nickname}}<br/>{{scope.row.mobile}}</div>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="上级" align="center" width="180">
  32. <template slot-scope="scope">
  33. <div v-if="scope.row.parent_id">
  34. <com-image style="float: left;margin-right: 5px;" class="avatar_url" mode="aspectFill" :src="scope.row.parent ? scope.row.parent.avatar_url : '/resources/img/common/default-avatar.png'"></com-image>
  35. <div>{{scope.row.parent.id}}<br/>{{scope.row.parent.mobile}}</div>
  36. </div>
  37. <div v-else>
  38. 平台
  39. </div>
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="累计消费金额" min-width="50" align="center">
  43. <template slot-scope="scope">
  44. {{ total_pay_arr[scope.row.id] || 0 }}
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="团队人数" min-width="50" align="center">
  48. <template slot-scope="scope">
  49. {{ scope.row.userTeamStatistics.user_team_total || 0 }}
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="佣金" min-width="50" align="center">
  53. <template slot-scope="scope">
  54. {{ scope.row.userWallet.commission || 0 }}
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="待结算" min-width="50" align="center">
  58. <template slot-scope="scope">
  59. {{ Math.floor(frozen_money_arr[scope.row.id] * 100) / 100 || 0 }}
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="操作" align="center">
  63. <template slot-scope="scope">
  64. <el-button type="text" @click="handle('edit',scope.row)">查看详情</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <div style="text-align: right;margin: 20px 0;">
  69. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  70. </div>
  71. </el-tabs>
  72. </div>
  73. </el-card>
  74. </div>
  75. <script>
  76. const app = new Vue({
  77. el: '#app',
  78. data: {
  79. loading: false,
  80. delLoading: false,
  81. page: 1,
  82. pageCount: 0,
  83. list: [],
  84. total_pay_arr: {},
  85. frozen_money_arr: {},
  86. searchForm:{
  87. id:null,
  88. mobile:null,
  89. },
  90. },
  91. mounted() {
  92. this.getList();
  93. },
  94. computed: {
  95. show_clear_search_btn: function() {
  96. return this.searchForm.id != null ||
  97. this.searchForm.mobile != null;
  98. },
  99. },
  100. methods: {
  101. pagination(currentPage) {
  102. let self = this;
  103. self.page = currentPage;
  104. self.getList();
  105. },
  106. handle(type, data = null) {
  107. let id = data ? parseInt(data.id) : '';
  108. switch (type) {
  109. case 'edit':
  110. let params = {
  111. r: 'team-data/default/my-customer'
  112. };
  113. if (id) params = Object.assign(params, {
  114. user_id: id
  115. });
  116. navigateTo(params);
  117. break;
  118. }
  119. },
  120. send(url, params, callback = null) {
  121. let self = this;
  122. request({
  123. params: {
  124. r: url,
  125. },
  126. method: 'post',
  127. data: params
  128. }).then(e => {
  129. if (e.data.code == 0) {
  130. self.$message.success(e.data.msg);
  131. self.getList();
  132. } else {
  133. self.$message.error(e.data.msg);
  134. }
  135. }).catch(e => {
  136. console.log(e);
  137. });
  138. if(callback) return e.data;
  139. },
  140. search() {// 清空查询条件
  141. this.page = 1;
  142. this.getList(this.searchForm);
  143. },
  144. resetSearch() {// 清空查询条件
  145. this.searchForm = {
  146. id: null,
  147. mobile: null,
  148. };
  149. this.page = 1;
  150. this.getList();
  151. },
  152. getList(search = {}) {
  153. let self = this;
  154. self.loading = true;
  155. let basic_params = {
  156. r: 'team-data/default/index',
  157. page: self.page,
  158. };
  159. params = Object.assign(basic_params, search);
  160. request({
  161. params: params
  162. }).then(e => {
  163. this.loading = false;
  164. if (e.data.code == 0) {
  165. self.list = e.data.data.list.list;
  166. self.total_pay_arr = e.data.data.total_pay_arr;
  167. self.frozen_money_arr = e.data.data.frozen_money_arr;
  168. self.pageCount = e.data.data.list.page_count;
  169. } else {
  170. self.$message.error(e.data.msg);
  171. }
  172. }).catch(e => {
  173. self.loading = false;
  174. });
  175. },
  176. }
  177. });
  178. </script>
  179. <style>
  180. .el-tabs__header {
  181. font-size: 16px;
  182. }
  183. .table-body {
  184. padding: 20px;
  185. background-color: #fff;
  186. }
  187. .table-body .el-button {
  188. padding: 0 !important;
  189. border: 0;
  190. margin: 0 5px;
  191. }
  192. .input-item {
  193. width: 250px;
  194. margin: 0 0 20px;
  195. display: inline-block;
  196. }
  197. .input-item .el-input__inner {
  198. border-right: 0;
  199. }
  200. .input-item .el-input__inner:hover {
  201. border: 1px solid #dcdfe6;
  202. border-right: 0;
  203. outline: 0;
  204. }
  205. .input-item .el-input__inner:focus {
  206. border: 1px solid #dcdfe6;
  207. border-right: 0;
  208. outline: 0;
  209. }
  210. .input-item .el-input-group__append {
  211. background-color: #fff;
  212. border-left: 0;
  213. width: 10%;
  214. padding: 0;
  215. }
  216. .input-item .el-input-group__append .el-button {
  217. padding: 0;
  218. }
  219. .input-item .el-input-group__append .el-button {
  220. margin: 0;
  221. }
  222. .batch {
  223. margin: 0 0 20px;
  224. display: inline-block;
  225. }
  226. .batch .el-button {
  227. padding: 9px 15px !important;
  228. }
  229. .el-table th>.cell{
  230. color: #333;
  231. font-weight: bold;
  232. font-size: 14px;
  233. }
  234. .el-table__footer-wrapper, .el-table__header-wrapper{
  235. border-bottom: 1.4px solid #D6D6D6;
  236. }
  237. .search-box {
  238. padding: 10px 0 0 10px;
  239. background-color: #fff;
  240. margin-bottom: 10px;
  241. }
  242. </style>