index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
  4. <el-form-item label="用户手机号" prop="mobile">
  5. <el-input v-model="queryParams.mobile" maxlength="11" placeholder="请输入用户手机号" clearable size="small" @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="注册时间">
  8. <el-date-picker v-model="daterangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  9. </el-form-item>
  10. <!-- <el-form-item label="上级用户" prop="parentUserId">
  11. <el-select v-model="queryParams.parentUserId" placeholder="请选择" filterable clearable size="small" style="width: 240px">
  12. <el-option v-for="(v,i) in partnerList" :key="i" :label="v.username" :value="v.partnerId" />
  13. </el-select>
  14. </el-form-item> -->
  15. <el-form-item>
  16. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  17. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  18. </el-form-item>
  19. </el-form>
  20. <el-row :gutter="10" class="mb8">
  21. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  22. </el-row>
  23. <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
  24. <el-table-column type="index" width="55" label="序号" align="center">
  25. <template slot-scope="scope">
  26. <div>
  27. {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
  28. </div>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="会员ID" align="center" prop="id" />
  32. <el-table-column label="头像" align="center" prop="headPhoto">
  33. <template slot-scope="scope">
  34. <el-image v-if="scope.row.headPhoto" style="width: 50px; height: 50px" :src="scope.row.headPhoto" :preview-src-list="scope.row.headPhoto ? [scope.row.headPhoto] : []"></el-image>
  35. <div v-else>--</div>
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="昵称" align="center" prop="nickname" />
  39. <el-table-column label="手机号" prop="mobile" align="center" />
  40. <el-table-column label="订单数" prop="orderNum" align="center" />
  41. <el-table-column label="注册时间" align="center" prop="createDay" width="180">
  42. <template slot-scope="scope">
  43. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="上次登录时间" align="center" prop="lastLoginTime" width="180">
  47. <template slot-scope="scope">
  48. <span>{{ parseTime(scope.row.lastLoginTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  52. <template slot-scope="scope">
  53. <el-button size="mini" type="text" @click="goDetails(scope.row)">查看</el-button>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  58. </div>
  59. </template>
  60. <script>
  61. import { userPage } from "@/api/user.js";
  62. import { partnerRelationList } from "@/api/partner"
  63. export default {
  64. dicts: [],
  65. data () {
  66. return {
  67. //按钮loading
  68. buttonLoading: false,
  69. // 遮罩层
  70. loading: true,
  71. // 选中数组
  72. ids: [],
  73. // 非单个禁用
  74. single: true,
  75. // 非多个禁用
  76. multiple: true,
  77. // 显示搜索条件
  78. showSearch: true,
  79. // 总条数
  80. total: 0,
  81. // 测试单表表格数据
  82. list: [],
  83. // 弹出层标题
  84. title: "",
  85. // 是否显示弹出层
  86. open: false,
  87. // 创建时间时间范围
  88. daterangeCreateTime: [],
  89. // 查询参数
  90. queryParams: {
  91. pageNum: 1,
  92. pageSize: 10,
  93. name: undefined,
  94. status: undefined,
  95. locationCode: undefined,
  96. parentUserId: undefined
  97. },
  98. partnerList: []
  99. }
  100. },
  101. created () {
  102. if (this.$route.query.parentId) {
  103. this.queryParams.parentUserId = this.$route.query.parentId * 1
  104. }
  105. this.getList();
  106. // this.getPartnerList()
  107. },
  108. methods: {
  109. /** 查询测试单表列表 */
  110. getList () {
  111. this.loading = true;
  112. this.queryParams["createDayStart"] = undefined;
  113. this.queryParams["createDayEnd"] = undefined;
  114. if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
  115. this.queryParams["createDayStart"] = this.daterangeCreateTime[0];
  116. this.queryParams["createDayEnd"] = this.daterangeCreateTime[1];
  117. }
  118. userPage(this.queryParams).then(response => {
  119. this.list = response.rows;
  120. this.total = response.total;
  121. this.loading = false;
  122. });
  123. },
  124. getPartnerList () {
  125. partnerRelationList().then(res => {
  126. this.partnerList = res.data
  127. })
  128. },
  129. /** 搜索按钮操作 */
  130. handleQuery () {
  131. this.queryParams.pageNum = 1;
  132. this.getList();
  133. },
  134. /** 重置按钮操作 */
  135. resetQuery () {
  136. this.daterangeCreateTime = [];
  137. this.resetForm("queryForm");
  138. this.handleQuery();
  139. },
  140. // 多选框选中数据
  141. handleSelectionChange (selection) {
  142. this.ids = selection.map(item => item.adId)
  143. this.single = selection.length !== 1
  144. this.multiple = !selection.length
  145. },
  146. goDetails (row) {
  147. this.$router.push({
  148. path: "/user/details",
  149. query: {
  150. id: row.id
  151. }
  152. })
  153. },
  154. }
  155. }
  156. </script>
  157. <style lang='scss' scoped>
  158. </style>