yishou.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="phone-list-page phone-yishou-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">已售记录</text>
  6. </view>
  7. <view class="jiazheng-search-box">
  8. <uni-datetime-picker v-model="data.range" type="daterange" @change="onDateSelect" style="flex: 1" class="yishou-date-box"/>
  9. </view>
  10. <!-- 课程列表 -->
  11. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  12. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh" @scrolltolower="onScrolltolower"
  13. class="ys-kc-saixuan-view scroll-top-border">
  14. <uni-list class="admin-list-box">
  15. <uni-list-item v-for="item in data.list" class="admin-list-item-box">
  16. <template v-slot:body>
  17. <view class="kecheng-list-card">
  18. <img :src="item.pic">
  19. <view class="item-card-row yishou-item-card-row">
  20. <view class="ks-item-top">
  21. <view class="kc-name">{{item.name}}</view>
  22. </view>
  23. <view class="ks-totalTm kc-fenlei">
  24. <icon class="phone-user-icon" />购买人:{{item.realName}}
  25. </view>
  26. <view class="ks-totalTm kc-fenlei">
  27. <icon class="phone-tel-icon" />手机号:{{item.userName}}
  28. </view>
  29. <view class="ks-totalTm kc-totalTm time-row">
  30. <icon class="phone-time-icon" />{{item.createTime}}
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. </uni-list-item>
  36. <uni-load-more :status="data.state" @click="getMore(0)" :contentText="data.contentText"></uni-load-more>
  37. </uni-list>
  38. </scroll-view>
  39. <!-- 页面底端 -->
  40. <customTabbarClientVue></customTabbarClientVue>
  41. </view>
  42. </template>
  43. <script setup>
  44. import searchDialog from "@/pages/admin/banzheng/search.vue";
  45. import commonDialog from '@/components/dialog/commonDialog.vue';
  46. import customTabbarClientVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  47. import {
  48. reactive,
  49. ref
  50. } from "vue";
  51. import {
  52. onLoad
  53. } from "@dcloudio/uni-app"
  54. import {
  55. getKechengYishou,
  56. } from "@/api/yishou.js"
  57. const data = reactive({
  58. list: [], // 办证列表
  59. loading: false,
  60. page: 0,
  61. size: 10,
  62. state: 'more',
  63. contentText: {
  64. contentdown: '查看更多',
  65. contentrefresh: '加载中',
  66. contentnomore: '没有更多'
  67. },
  68. startDate: '',
  69. endDate: '',
  70. range: []
  71. })
  72. function onScrolltolower() {
  73. getMore()
  74. }
  75. function onDateSelect(dataD) {
  76. if (dataD) {
  77. data.startDate = dataD[0];
  78. data.endDate = dataD[1];
  79. } else {
  80. data.startDate = '';
  81. data.endDate = '';
  82. }
  83. data.page = 0;
  84. refreshData()
  85. }
  86. function goUpPage() {
  87. uni.redirectTo({
  88. url: '/pages/admin/ShouYe/shouye'
  89. })
  90. }
  91. function refreshData() {
  92. const opt = {
  93. endDate: data.endDate,
  94. startDate: data.startDate,
  95. page: 1,
  96. size: 10, // 固定查询10条
  97. }
  98. data.list = [];
  99. // 数学
  100. data.state = 'loading';
  101. data.page++;
  102. opt.page = data.page;
  103. getKechengYishou(opt).then(res => {
  104. data.list = data.list.concat(res.data.data);
  105. data.loading = false;
  106. if (res.data.total > data.list.length) {
  107. data.state = 'more';
  108. data.loading = false;
  109. } else {
  110. data.state = 'no-more';
  111. data.loading = false;
  112. }
  113. }).catch(err => {
  114. data.state = 'more';
  115. data.loading = false;
  116. })
  117. }
  118. function getMore() {
  119. const opt = {
  120. endDate: data.endDate,
  121. startDate: data.startDate,
  122. page: 1,
  123. size: 10, // 固定查询10条
  124. }
  125. if (data.state == 'no-more') return;
  126. data.state = 'loading';
  127. data.page++;
  128. opt.page = data.page;
  129. getKechengYishou(opt).then(res => {
  130. data.list = data.list.concat(res.data.data);
  131. data.loading = false;
  132. if (res.data.total > data.list.length) {
  133. data.state = 'more';
  134. data.loading = false;
  135. } else {
  136. data.state = 'no-more';
  137. data.loading = false;
  138. }
  139. }).catch(err => {
  140. data.state = 'more';
  141. data.loading = false;
  142. })
  143. }
  144. function onRefresh() {
  145. data.page = 0;
  146. data.list = [];
  147. data.loading = true;
  148. refreshData();
  149. }
  150. onLoad(() => {
  151. getMore()
  152. })
  153. </script>
  154. <style>
  155. </style>