DirectlySale.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <!-- 直属查询页 -->
  3. <div class="directly_sale">
  4. <!-- 筛选 todo: 这里 搜索框内容以及选择分类需要传递过来 -->
  5. <DirectlySaleHead :promoProfit="promoProfit" @onSearch="onSearch" />
  6. <!-- 直属查询表格 -->
  7. <DirectlySaleTable
  8. :pageIndex="pageIndex"
  9. :pageSize="pageSize"
  10. :totalPage="totalPage"
  11. :tableData="tableList"
  12. />
  13. <!-- 分页 -->
  14. <!-- <el-pagination
  15. v-if="tableList && tableList.length > 1"
  16. class="directly_page"
  17. layout="prev, pager, next, jumper"
  18. :total="totalPage * 10"
  19. :current-page="1"
  20. @current-change="pageChange"
  21. >
  22. </el-pagination> -->
  23. </div>
  24. </template>
  25. <script>
  26. import DirectlySaleHead from "@/views/Directly/DirectlySale/DirectlySaleHead/DirectlySaleHead";
  27. import DirectlySaleTable from "@/views/Directly/DirectlySale/DirectlySaleTable/DirectlySaleTable";
  28. export default {
  29. name: "DirectlySale",
  30. components: {
  31. DirectlySaleHead,
  32. DirectlySaleTable,
  33. },
  34. inject: ["checkCode"],
  35. data() {
  36. return {
  37. // 网络请求拿到的表格的数据
  38. tableList: [],
  39. pageSize: 15, // 一页大小
  40. pageIndex: 1, // 当前页
  41. totalPage: 1, // 总页数
  42. promoProfit: "", // 推广员总流水
  43. };
  44. },
  45. computed: {},
  46. watch: {},
  47. created() {},
  48. mounted() {
  49. // 推广员明细列表
  50. this.pageChange(1);
  51. // 推广员总流水
  52. this.onPromoProfit();
  53. },
  54. methods: {
  55. // 分页页码改变
  56. pageChange(currentPage) {
  57. const { pageSize } = this;
  58. this.onPromoUserList(currentPage, pageSize);
  59. },
  60. // 搜索
  61. onSearch(searchValue, currentInputValue) {
  62. console.log(
  63. searchValue,
  64. "searchValue",
  65. currentInputValue,
  66. "currentInputValue"
  67. );
  68. },
  69. // 销售总流水
  70. onPromoProfit() {
  71. this.$api.promoProfit().then((res) => {
  72. this.checkCode(res);
  73. const { code, data } = res.data;
  74. if (code) {
  75. return;
  76. }
  77. this.promoProfit = data;
  78. });
  79. },
  80. // 销售流水列表
  81. onPromoUserList(pageIndex, pageSize) {
  82. this.pageIndex = pageIndex;
  83. this.$api.promoUserList({ pageIndex, pageSize }).then((res) => {
  84. this.checkCode(res);
  85. const { code, data } = res.data;
  86. if (code) {
  87. return;
  88. }
  89. // 成功
  90. console.log(data, "data===");
  91. this.tableList = data;
  92. this.totalPage = Math.ceil(data.count / this.pageSize);
  93. });
  94. },
  95. },
  96. };
  97. </script>
  98. <style lang='less' scoped>
  99. .directly_sale {
  100. width: 98%;
  101. min-width: 1100px;
  102. margin: 0 auto;
  103. padding: 0 15px;
  104. box-sizing: border-box;
  105. .directly_page {
  106. margin-top: 20px;
  107. }
  108. }
  109. </style>