earningsList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <view class="page">
  3. <!-- #ifdef H5-->
  4. <uni-nav-bar v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false"
  5. left-icon="left" title="收益记录" @clickLeft="back"/>
  6. <!-- #endif -->
  7. <mescroll-uni ref="mescrollRef" @init="mescrollInit" :height="height" :down="downOption" @down="downCallback"
  8. :up="upOption" @up="upCallback" @emptyclick="emptyClick">
  9. <view class="flex-col statistics">
  10. <view class="flex-row grid">
  11. <view class="flex-col gridItem">
  12. <view class="title flex-row justify-center">
  13. <text>累计奖励</text>
  14. </view>
  15. <view class="number flex-row justify-center">
  16. <text>{{withdrawStaticsData.totalIncome}}</text>
  17. </view>
  18. </view>
  19. <view class="flex-col gridItem leftBorder">
  20. <view class="title flex-row justify-center">
  21. <text>累计提现</text>
  22. </view>
  23. <view class="number flex-row justify-center">
  24. <text>{{withdrawStaticsData.totalWithdraw}}</text>
  25. </view>
  26. </view>
  27. <view class="flex-col gridItem leftBorder">
  28. <view class="title flex-row justify-center">
  29. <text>可提现</text>
  30. </view>
  31. <view class="number flex-row justify-center">
  32. <text>{{withdrawStaticsData.canWithdraw}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="flex-row justify-center">
  37. <view class="flex-row justify-center tixian" @click="navigateTo('/pages/withdraw/withdraw')">
  38. <text>去提现</text>
  39. <u-icon name="arrow-right" color="#000" size="14"></u-icon>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="bgColor">
  44. <view class="flex-row grid1">
  45. <view class="flex-col justify-evenly gridItem1">
  46. <view class="title flex-row justify-center">
  47. <text>累计拓客</text>
  48. </view>
  49. <view class="number1 flex-row justify-center">
  50. <text>{{expandAppTotalData.totalExpand}}</text>
  51. </view>
  52. </view>
  53. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  54. <view class="title flex-row justify-center">
  55. <text>用券人数</text>
  56. </view>
  57. <view class="number1 flex-row justify-center">
  58. <text>{{expandAppTotalData.useCouponTotal}}</text>
  59. </view>
  60. </view>
  61. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  62. <view class="title flex-row justify-center">
  63. <text>充值人数</text>
  64. </view>
  65. <view class="number1 flex-row justify-center">
  66. <text>{{expandAppTotalData.rechargeTotal}}</text>
  67. </view>
  68. </view>
  69. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  70. <view class="title flex-row justify-center">
  71. <text>消费次数累计</text>
  72. </view>
  73. <view class="number1 flex-row justify-center">
  74. <text>{{expandAppTotalData.consume}}</text>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="title-h1">
  79. <text>拓客数据(今日)</text>
  80. </view>
  81. <view class="flex-row grid1">
  82. <view class="flex-col justify-evenly gridItem1">
  83. <view class="title flex-row justify-center">
  84. <text>累计拓客</text>
  85. </view>
  86. <view class="number1 flex-row justify-center">
  87. <text>{{expandAppTodayData.totalExpand}}</text>
  88. </view>
  89. </view>
  90. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  91. <view class="title flex-row justify-center">
  92. <text>用券人数</text>
  93. </view>
  94. <view class="number1 flex-row justify-center">
  95. <text>{{expandAppTodayData.useCouponTotal}}</text>
  96. </view>
  97. </view>
  98. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  99. <view class="title flex-row justify-center">
  100. <text>充值人数</text>
  101. </view>
  102. <view class="number1 flex-row justify-center">
  103. <text>{{expandAppTodayData.rechargeTotal}}</text>
  104. </view>
  105. </view>
  106. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  107. <view class="title flex-row justify-center">
  108. <text>消费次数累计</text>
  109. </view>
  110. <view class="number1 flex-row justify-center">
  111. <text>{{expandAppTodayData.consume}}</text>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="title-h1">
  116. <text>间接拓客数据(今日)</text>
  117. </view>
  118. <view class="flex-row grid1">
  119. <view class="flex-col justify-evenly gridItem1">
  120. <view class="title flex-row justify-center">
  121. <text>累计拓客</text>
  122. </view>
  123. <view class="number1 flex-row justify-center">
  124. <text>{{expandAppIndirectData.totalExpand}}</text>
  125. </view>
  126. </view>
  127. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  128. <view class="title flex-row justify-center">
  129. <text>用券人数</text>
  130. </view>
  131. <view class="number1 flex-row justify-center">
  132. <text>{{expandAppIndirectData.useCouponTotal}}</text>
  133. </view>
  134. </view>
  135. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  136. <view class="title flex-row justify-center">
  137. <text>充值人数</text>
  138. </view>
  139. <view class="number1 flex-row justify-center">
  140. <text>{{expandAppIndirectData.rechargeTotal}}</text>
  141. </view>
  142. </view>
  143. <view class="flex-col justify-evenly gridItem1 leftBorder1">
  144. <view class="title flex-row justify-center">
  145. <text>消费次数累计</text>
  146. </view>
  147. <view class="number1 flex-row justify-center">
  148. <text>{{expandAppIndirectData.consume}}</text>
  149. </view>
  150. </view>
  151. </view>
  152. <view v-for="(key,index) in mapListCopy.keys()" :key="index">
  153. <view class="title-h1 flex-row" @click="clickKey(key)">
  154. <text>{{key}}</text>
  155. <u-icon name="arrow-down" color="#000" size="16" v-if="selectDate == key"></u-icon>
  156. <u-icon name="arrow-right" color="#000" size="16" v-else></u-icon>
  157. </view>
  158. <view class="listItem" v-if="selectDate == key" v-for="(item,index) in mapListCopy.get(key)">
  159. <view class="flex-row justify-between listItemMsg">
  160. <view class="memberNo">
  161. <text>会员编号:{{item.memberNo}}</text>
  162. </view>
  163. <view class="flex-row justify-between msg">
  164. <text>{{item.remake}}</text>
  165. <text>{{item.amount}}</text>
  166. </view>
  167. </view>
  168. <view class="time">
  169. <text>{{item.createTime}}</text>
  170. </view>
  171. </view>
  172. </view>
  173. </view>
  174. <!-- <view class="flex-row justify-center seeMore">-->
  175. <!-- <text>查看更多</text>-->
  176. <!-- </view>-->
  177. </mescroll-uni>
  178. <!--#ifdef H5-->
  179. <liu-drag-button v-if="$isWxBrowser()" @clickBtn="back">返回</liu-drag-button>
  180. <!--#endif-->
  181. </view>
  182. </template>
  183. <script>
  184. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  185. import MescrollMoreItemMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more-item.js"
  186. export default {
  187. mixins: [MescrollMixin, MescrollMoreItemMixin], // 注意此处还需使用MescrollMoreItemMixin (必须写在MescrollMixin后面)
  188. components: {},
  189. data() {
  190. return {
  191. mapList: new Map(),
  192. mapListCopy: new Map(),
  193. selectDate: '',
  194. height: '',
  195. withdrawStaticsData: {},
  196. expandAppTotalData: {},
  197. expandAppTodayData: {},
  198. expandAppIndirectData: {},
  199. downOption: {
  200. auto: true // 不自动加载 (mixin已处理第一个tab触发downCallback)
  201. },
  202. upOption: {
  203. auto: true, // 自动加载
  204. // page: {
  205. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  206. // size: 10 // 每页数据的数量
  207. // },
  208. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  209. empty: {
  210. icon: '/static/dataNull.png',
  211. tip: '暂无内容', // 提示
  212. // btnText: '去看看'
  213. },
  214. textNoMore: '没有更多了'
  215. },
  216. }
  217. },
  218. onLoad(e) {
  219. let sysInfo = uni.getSystemInfoSync()
  220. this.height = sysInfo.windowHeight - 70 + 'px' //除标题栏栏外的屏幕可用高度
  221. this.downCallback()
  222. },
  223. onShow() {
  224. this.withdrawStatics()
  225. this.expandAppTotal()
  226. this.expandAppToday()
  227. this.expandAppIndirect()
  228. },
  229. methods: {
  230. clickKey(key) {
  231. if (this.selectDate === key) {
  232. this.selectDate = ''
  233. } else {
  234. this.selectDate = key
  235. }
  236. },
  237. withdrawStatics() {
  238. this.$api.service.withdrawStatics().then(res => {
  239. this.withdrawStaticsData = res.data.data
  240. })
  241. },
  242. expandAppTotal() {
  243. this.$api.service.expandAppTotal().then(res => {
  244. this.expandAppTotalData = res.data.data
  245. })
  246. },
  247. expandAppToday() {
  248. this.$api.service.expandAppToday().then(res => {
  249. this.expandAppTodayData = res.data.data
  250. })
  251. },
  252. expandAppIndirect() {
  253. this.$api.service.expandAppIndirect().then(res => {
  254. this.expandAppIndirectData = res.data.data
  255. })
  256. },
  257. navigateTo(url) {
  258. uni.navigateTo({
  259. url: url
  260. })
  261. },
  262. back() {
  263. let pages = getCurrentPages()
  264. if (pages.length > 1) {
  265. uni.navigateBack({
  266. delta: 1,
  267. fail: err => {
  268. console.log(err)
  269. }
  270. })
  271. } else {
  272. uni.switchTab({
  273. url: '/pages/my/my'
  274. });
  275. }
  276. },
  277. /*下拉刷新的回调 */
  278. downCallback() {
  279. // 这里加载你想下拉刷新的数据, 比如刷新轮播数据
  280. // loadSwiper();
  281. // 下拉刷新的回调,默认重置上拉加载列表为第一页 (自动执行 page.num=1, 再触发upCallback方法 )
  282. this.mescroll.resetUpScroll()
  283. },
  284. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  285. upCallback(page) {
  286. //联网加载数据
  287. let httpData = {
  288. pageNum: page.num,
  289. pageSize: 100
  290. }
  291. this.$api.service.getRecord(httpData).then((res) => {
  292. //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
  293. this.mescroll.endSuccess(res.data.data.length, res.data.data.length === 100);
  294. //设置列表数据
  295. if (page.num === 1) this.mapList = new Map(); //如果是第一页需手动制空列表
  296. res.data.data.forEach(item => {
  297. let date = item.createTime.substring(0, 7)
  298. if (this.mapList.has(date)) {
  299. //键已存在
  300. this.mapList.get(date).push(item)
  301. } else {
  302. //键不存在
  303. this.mapList.set(date, [item])
  304. }
  305. })
  306. this.mapListCopy = new Map()
  307. this.mapListCopy = this.mapList
  308. if (page.num === 1) {
  309. const keys = Array.from(this.mapListCopy.keys());
  310. this.selectDate = keys[0];
  311. }
  312. console.log('++++++++++++++++++++++++', this.mapListCopy)
  313. }).catch((err) => {
  314. //联网失败, 结束加载
  315. this.mescroll.endErr();
  316. })
  317. },
  318. //点击空布局按钮的回调
  319. emptyClick() {
  320. uni.showToast({
  321. title: '点击了按钮,具体逻辑自行实现'
  322. })
  323. },
  324. }
  325. }
  326. </script>
  327. <style lang="scss" scoped>
  328. @import './index.rpx.css';
  329. </style>