index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="75px"
  9. >
  10. <el-form-item label="门店名称" prop="siteName" label-width="90px">
  11. <el-input
  12. v-model="queryParams.siteName"
  13. placeholder="请输入门店名称"
  14. clearable
  15. size="small"
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="推广员姓名" prop="name" label-width="90px">
  20. <el-input
  21. v-model="queryParams.name"
  22. placeholder="请输入推广员姓名"
  23. clearable
  24. size="small"
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item label="手机号码" prop="mobile">
  29. <el-input
  30. v-model="queryParams.mobile"
  31. placeholder="请输入手机号码"
  32. clearable
  33. size="small"
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. <el-form-item label="下单时间">
  38. <el-date-picker @clear="handleQuery()" v-model="registeredTimeArr" type="datetimerange" size="small" value-format="timestamp" range-separator="至" start-placeholder="时间选择" end-placeholder="时间选择" @change="tardeTime">
  39. </el-date-picker>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  43. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  44. </el-form-item>
  45. </el-form>
  46. <el-row :gutter="10" class="mb8">
  47. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  48. </el-row>
  49. <el-table v-loading="loading" :data="list" @sort-change="sortChannelId">
  50. <!-- <el-table-column type="selection" width="55" /> -->
  51. <el-table-column label="推广员编号" sortable="custom" prop="channelId" min-width="110px"/>
  52. <el-table-column label="推广员姓名" show-overflow-tooltip prop="name" min-width="110px" >
  53. <template slot-scope="scope">
  54. <pre>{{scope.row.name}}</pre>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="手机号码" prop="mobile" min-width="120px"/>
  58. <el-table-column label="佣金比例" sortable="custom" prop="commRate" min-width="100px">
  59. <template slot-scope="{ row, column }">
  60. <span>{{row.commRate}}%</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="门店名称" prop="siteName" min-width="100px" />
  64. <el-table-column label="盲票销量" sortable="custom" prop="saleNum" min-width="100px"/>
  65. <el-table-column label="销售额" sortable="custom" prop="saleAmt" min-width="100px">
  66. <template slot-scope="{ row }">
  67. <div>{{ $numberFormat(row.saleAmt) }}</div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="佣金" sortable="custom" prop="commAmt" min-width="100px">
  71. <template slot-scope="{ row }">
  72. <div>{{ $numberFormat(row.commAmt) }}</div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="注册时间" prop="createdTime" min-width="160px">
  76. <template slot-scope="{ row }">
  77. {{ parseTime(row.createdTime) }}
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <pagination
  82. v-show="total>0"
  83. :total="total"
  84. :page.sync="pageParams.pageNum"
  85. :limit.sync="pageParams.pageSize"
  86. @pagination="getList"
  87. />
  88. </div>
  89. </template>
  90. <script>
  91. import { promotersList } from "@/api/admin/promoters";
  92. export default {
  93. name: "Promoters",
  94. components: {
  95. },
  96. data() {
  97. return {
  98. // 遮罩层
  99. loading: true,
  100. // 显示搜索条件
  101. showSearch: true,
  102. // 总条数
  103. total: 0,
  104. // 门店表格数据
  105. list: [],
  106. // 状态数据字典
  107. statusOptions: [],
  108. // 查询参数
  109. queryParams: {
  110. endDate: "",
  111. startDate: "",
  112. name: "",
  113. mobile: "",
  114. siteName: ""
  115. },
  116. pageParams: {
  117. pageNum: 1,
  118. pageSize: 10,
  119. orderByColumn: 't1.channelId',
  120. isAsc: 'desc',
  121. },
  122. // 注册时间
  123. registeredTimeArr: [],
  124. };
  125. },
  126. created() {
  127. this.getList();
  128. },
  129. methods: {
  130. /** 查询门店列表 */
  131. getList() {
  132. this.loading = true;
  133. promotersList('pageNum='+this.pageParams.pageNum + '&pageSize='+this.pageParams.pageSize+'&orderByColumn='+ this.pageParams.orderByColumn +'&isAsc='+ this.pageParams.isAsc +'&',this.queryParams).then(res => {
  134. this.loading = false;
  135. if(res.code === 0) {
  136. this.list = res.rows;
  137. this.total = res.total;
  138. }
  139. }).catch(res => {
  140. this.loading = false;
  141. });
  142. },
  143. // 切换排序
  144. sortChannelId(row){
  145. if (row){
  146. let prop = row.prop == 'channelId' || row.prop == 'commRate' ? ('t1.'+ row.prop) : row.prop;
  147. this.pageParams.orderByColumn = prop
  148. this.pageParams.isAsc = row.order=='ascending'?"asc":"desc";
  149. this.getList()
  150. }
  151. },
  152. // 岗位状态字典翻译
  153. statusFormat(row, column) {
  154. return this.selectDictLabel(this.statusOptions, row.status);
  155. },
  156. // 选择注册时间
  157. tardeTime(e) {
  158. if (e) {
  159. this.queryParams.startTime = e[0];
  160. this.queryParams.endTime = e[1];
  161. this.handleQuery();
  162. } else {
  163. this.queryParams.startTime = "";
  164. this.queryParams.endTime = "";
  165. this.handleQuery();
  166. }
  167. },
  168. /** 搜索按钮操作 */
  169. handleQuery() {
  170. this.pageParams.pageNum = 1;
  171. this.getList();
  172. },
  173. /** 重置按钮操作 */
  174. resetQuery() {
  175. this.registeredTimeArr = [];
  176. this.queryParams= {
  177. endDate: "",
  178. startDate: "",
  179. name: "",
  180. mobile: "",
  181. siteName: ""
  182. },
  183. this.resetForm("queryForm");
  184. this.handleQuery();
  185. },
  186. }
  187. };
  188. </script>