index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div>
  3. <Card :bordered="false" dis-hover class="ivu-mt">
  4. <Form
  5. ref="formValidate"
  6. :label-width="labelWidth"
  7. :label-position="labelPosition"
  8. class="tabform"
  9. @submit.native.prevent
  10. >
  11. <Row :gutter="24" type="flex">
  12. <Col :xl="5" :lg="8" :md="10" :sm="11" :xs="24" class="mr10">
  13. <FormItem label="昵称/ID:">
  14. <Input
  15. enter-button
  16. placeholder="请输入"
  17. element-id="nickname"
  18. v-model="formValidate.nickname"
  19. clearable
  20. />
  21. </FormItem>
  22. </Col>
  23. <Col :xl="6" :lg="12" :md="13" :sm="12" :xs="24">
  24. <FormItem label="佣金范围:" class="tab_data">
  25. <Input-number
  26. type="number"
  27. :min="0"
  28. enter-button
  29. placeholder="¥"
  30. element-id="price_min"
  31. class="mr10"
  32. v-model="formValidate.price_min"
  33. />
  34. <span class="mr10">一</span>
  35. <Input-number
  36. type="number"
  37. :min="0"
  38. enter-button
  39. placeholder="¥"
  40. element-id="price_max"
  41. v-model="formValidate.price_max"
  42. />
  43. </FormItem>
  44. </Col>
  45. <Col >
  46. <Button type="primary" icon="ios-search" @click="userSearchs">搜索</Button>
  47. <Button v-auth="['export-userCommission']" class="export" icon="ios-share-outline" @click="exports"
  48. >导出
  49. </Button>
  50. </Col>
  51. </Row>
  52. </Form>
  53. <Table
  54. ref="table"
  55. :columns="columns"
  56. :data="tabList"
  57. class="mt25"
  58. :loading="loading"
  59. no-data-text="暂无数据"
  60. no-filtered-data-text="暂无筛选结果"
  61. @on-sort-change="sortChanged"
  62. >
  63. <!-- <template slot-scope="{ row, index }" slot="action">
  64. <a @click="Info(row)">详情</a>
  65. </template> -->
  66. </Table>
  67. <div class="acea-row row-right page">
  68. <Page
  69. :total="total"
  70. :current="formValidate.page"
  71. show-elevator
  72. show-total
  73. :page-size="formValidate.limit"
  74. @on-change="pageChange"
  75. />
  76. </div>
  77. </Card>
  78. <commission-details ref="commission"></commission-details>
  79. </div>
  80. </template>
  81. <script>
  82. import { mapState } from 'vuex';
  83. import { commissionListApi, userCommissionApi } from '@/api/finance';
  84. import commissionDetails from './handle/commissionDetails';
  85. export default {
  86. name: 'commissionRecord',
  87. components: { commissionDetails },
  88. data() {
  89. return {
  90. total: 0,
  91. loading: false,
  92. tabList: [],
  93. formValidate: {
  94. nickname: '',
  95. price_max: '',
  96. price_min: '',
  97. excel: 0,
  98. page: 1, // 当前页
  99. limit: 20, // 每页显示条数
  100. },
  101. columns: [
  102. {
  103. title: '用户信息',
  104. key: 'nickname',
  105. minWidth: 150,
  106. },
  107. {
  108. title: '总佣金金额',
  109. key: 'sum_number',
  110. sortable: 'custom',
  111. minWidth: 120,
  112. },
  113. {
  114. title: '账户余额',
  115. key: 'now_money',
  116. minWidth: 100,
  117. },
  118. {
  119. title: '账户佣金',
  120. key: 'brokerage_price',
  121. sortable: 'custom',
  122. minWidth: 120,
  123. },
  124. {
  125. title: '提现到账佣金',
  126. key: 'extract_price',
  127. minWidth: 150,
  128. },
  129. // {
  130. // title: '操作',
  131. // slot: 'action',
  132. // fixed: 'right',
  133. // minWidth: 100
  134. // }
  135. ],
  136. };
  137. },
  138. computed: {
  139. ...mapState('media', ['isMobile']),
  140. labelWidth() {
  141. return this.isMobile ? undefined : 80;
  142. },
  143. labelPosition() {
  144. return this.isMobile ? 'top' : 'left';
  145. },
  146. },
  147. mounted() {
  148. this.getList();
  149. },
  150. methods: {
  151. // 列表
  152. getList() {
  153. this.loading = true;
  154. commissionListApi(this.formValidate)
  155. .then(async (res) => {
  156. let data = res.data;
  157. this.tabList = data.list;
  158. this.total = data.count;
  159. this.loading = false;
  160. })
  161. .catch((res) => {
  162. this.loading = false;
  163. this.$Message.error(res.msg);
  164. });
  165. },
  166. pageChange(index) {
  167. this.formValidate.page = index;
  168. this.getList();
  169. },
  170. // 搜索
  171. userSearchs() {
  172. this.formValidate.page = 1;
  173. this.getList();
  174. },
  175. // 导出
  176. exports() {
  177. let formValidate = this.formValidate;
  178. let data = {
  179. price_max: formValidate.price_max,
  180. price_min: formValidate.price_min,
  181. nickname: formValidate.nickname,
  182. };
  183. userCommissionApi(data)
  184. .then((res) => {
  185. location.href = res.data[0];
  186. })
  187. .catch((res) => {
  188. this.$Message.error(res.msg);
  189. });
  190. },
  191. // 详情
  192. Info(row) {
  193. this.$refs.commission.modals = true;
  194. this.$refs.commission.getDetails(row.uid);
  195. this.$refs.commission.getList(row.uid);
  196. },
  197. // 排序
  198. sortChanged(e) {
  199. if (e.key == 'sum_number') {
  200. delete this.formValidate.brokerage_price;
  201. } else {
  202. delete this.formValidate.sum_number;
  203. }
  204. this.formValidate[e.key] = e.order;
  205. this.getList();
  206. },
  207. },
  208. };
  209. </script>
  210. <style scoped lang="stylus">
  211. .lines {
  212. padding-top: 6px !important;
  213. }
  214. .tabform .export {
  215. margin-left: 10px;
  216. }
  217. .tab_data >>> .ivu-form-item-content {
  218. display: flex !important;
  219. }
  220. </style>