index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='commission-details'>
  4. <view class='search acea-row row-between-wrapper' v-if="recordType != 1 && recordType != 4">
  5. <view class='input'>
  6. <text class="iconfont icon-sousuo4"></text>
  7. <input placeholder='搜索用户名称' placeholder-class='placeholder' v-model="keyword" @confirm="submitForm"
  8. confirm-type='search' name="search"></input>
  9. </view>
  10. </view>
  11. <timeSlot @changeTime="changeTime"></timeSlot>
  12. <view class='sign-record'>
  13. <view class="top_num" v-if="recordType != 4 && recordList.length">
  14. 支出:¥{{expend || 0}} &nbsp;&nbsp;&nbsp; 收入:¥{{income || 0}}
  15. </view>
  16. <view class="box">
  17. <block v-for="(item,index) in recordList" :key="index" v-if="recordList.length>0">
  18. <view class='list'>
  19. <view class='item'>
  20. <!-- <view class='data'>{{item.time}}</view> -->
  21. <view class='listn'>
  22. <!-- <block v-for="(child,indexn) in item.child" :key="indexn"> -->
  23. <view class='itemn1 acea-row row-between-wrapper'>
  24. <view>
  25. <view class='name line1'>
  26. {{item.title}}
  27. <!-- <text class="status_badge success" v-if="recordType == 4 && item.status == 1">审核通过</text> -->
  28. <text class="status_badge default" v-if="recordType == 4 && item.status == 0">待审核</text>
  29. <text class="status_badge error" v-if="recordType == 4 && item.status == 2">未通过</text>
  30. <!-- 提现记录: 0 待审核 1 通过 2 未通过 -->
  31. </view>
  32. <view class="mark" v-if="recordType == 4 && item.mark && item.status !== 1">{{item.mark}}</view>
  33. <view>{{item.add_time}}</view>
  34. </view>
  35. <view class='num font-color' v-if="item.pm == 1">+{{item.number}}</view>
  36. <view class='num' v-else>-{{item.number}}</view>
  37. </view>
  38. <!-- </block> -->
  39. </view>
  40. </view>
  41. </view>
  42. </block>
  43. </view>
  44. <view class='loadingicon acea-row row-center-wrapper' v-if="recordList.length">
  45. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  46. </view>
  47. <view v-if="recordList.length < 1 && page > 1">
  48. <emptyPage title='暂无数据~'></emptyPage>
  49. </view>
  50. </view>
  51. </view>
  52. <home v-if="navigation"></home>
  53. <!-- #ifdef MP -->
  54. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  55. <!-- #endif -->
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. moneyList,
  61. getSpreadInfo
  62. } from '@/api/user.js';
  63. import {
  64. toLogin
  65. } from '@/libs/login.js';
  66. import {
  67. mapGetters
  68. } from "vuex";
  69. import emptyPage from '@/components/emptyPage.vue'
  70. import home from '@/components/home';
  71. import colors from '@/mixins/color.js';
  72. import timeSlot from '@/components/timeSlot/index.vue'
  73. export default {
  74. components: {
  75. emptyPage,
  76. home,
  77. timeSlot
  78. },
  79. mixins: [colors],
  80. data() {
  81. return {
  82. name: '',
  83. keyword: '',
  84. type: 0,
  85. page: 1,
  86. limit: 15,
  87. loading: false,
  88. loadend: false,
  89. loadTitle: '加载更多',
  90. recordList: [],
  91. recordType: 0,
  92. recordCount: 0,
  93. extractCount: 0,
  94. times: [],
  95. start: 0,
  96. stop: 0,
  97. income: '',
  98. expend: '',
  99. isShowAuth: false
  100. };
  101. },
  102. computed: mapGetters(['isLogin']),
  103. onLoad(options) {
  104. this.type = options.type;
  105. if (!this.isLogin) {
  106. //#ifndef MP
  107. toLogin();
  108. //#endif
  109. //#ifdef MP
  110. this.isShowAuth = true;
  111. //#endif
  112. }
  113. },
  114. onShow: function() {
  115. uni.removeStorageSync('form_type_cart');
  116. let type = this.type;
  117. if (type == 1) {
  118. uni.setNavigationBarTitle({
  119. title: "佣金记录"
  120. });
  121. this.name = '提现总额';
  122. this.recordType = 3;
  123. this.getRecordList();
  124. // this.getRecordListCount();
  125. } else if (type == 2) {
  126. uni.setNavigationBarTitle({
  127. title: "佣金记录"
  128. });
  129. this.name = '佣金明细';
  130. this.recordType = 3;
  131. this.getRecordList();
  132. // this.getRecordListCount();
  133. } else if (type == 4) {
  134. uni.setNavigationBarTitle({
  135. title: "提现记录"
  136. });
  137. this.name = '提现明细';
  138. this.recordType = 4;
  139. this.getRecordList();
  140. // this.getRecordListCount();
  141. } else {
  142. uni.showToast({
  143. title: '参数错误',
  144. icon: 'none',
  145. duration: 1000,
  146. mask: true,
  147. success: function(res) {
  148. setTimeout(function() {
  149. // #ifndef H5
  150. uni.navigateBack({
  151. delta: 1,
  152. });
  153. // #endif
  154. // #ifdef H5
  155. history.back();
  156. // #endif
  157. }, 1200)
  158. },
  159. });
  160. }
  161. },
  162. methods: {
  163. onLoadFun(){
  164. this.isShowAuth = false
  165. },
  166. // 授权关闭
  167. authColse: function(e) {
  168. this.isShowAuth = e
  169. },
  170. submitForm() {
  171. this.page = 1;
  172. this.limit = 20;
  173. this.loadend = false;
  174. this.status = false;
  175. this.$set(this, 'recordList', []);
  176. this.$set(this, 'times', []);
  177. this.getRecordList();
  178. },
  179. changeTime(time) {
  180. this.start = time.start
  181. this.stop = time.stop
  182. this.page = 1;
  183. // this.loading = false;
  184. this.loadend = false;
  185. this.$set(this, 'recordList', []);
  186. this.getRecordList();
  187. },
  188. getRecordList: function() {
  189. let that = this;
  190. let page = that.page;
  191. let limit = that.limit;
  192. let recordType = that.recordType;
  193. if (that.loading) return;
  194. if (that.loadend) return;
  195. that.loading = true;
  196. that.loadTitle = '';
  197. moneyList({
  198. keyword: this.keyword,
  199. start: this.start,
  200. stop: this.stop,
  201. page: page,
  202. limit: limit
  203. }, recordType).then(res => {
  204. this.expend = res.data.expend;
  205. this.income = res.data.income;
  206. // for (let i = 0; i < res.data.time.length; i++) {
  207. // // if (!this.times.includes(res.data.time[i])) {
  208. // this.times.push(res.data.time[i])
  209. // this.recordList.push({
  210. // time: res.data.time[i],
  211. // child: []
  212. // })
  213. // // }
  214. // }
  215. // // for (let x = 0; x < this.times.length; x++) {
  216. // for (let j = 0; j < res.data.list.length; j++) {
  217. // // if (this.times[x] === res.data.list[j].time_key) {
  218. // // }
  219. // this.recordList[j].child.push(res.data.list[j])
  220. // }
  221. // // }
  222. this.recordList = this.recordList.concat(res.data.list)
  223. let loadend = res.data.list.length < that.limit;
  224. that.loadend = loadend;
  225. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  226. that.page += 1;
  227. that.loading = false;
  228. }).catch(err => {
  229. that.loading = false;
  230. that.loadTitle = '加载更多';
  231. })
  232. },
  233. getRecordListCount: function() {
  234. let that = this;
  235. getSpreadInfo().then(res => {
  236. that.recordCount = res.data.commissionCount;
  237. that.extractCount = res.data.extractCount;
  238. });
  239. }
  240. },
  241. onReachBottom: function() {
  242. this.getRecordList();
  243. }
  244. }
  245. </script>
  246. <style scoped lang="scss">
  247. .commission-details .search {
  248. width: 100%;
  249. background-color: var(--view-theme);
  250. border-bottom: 1px solid #f2f2f2;
  251. height: 86rpx;
  252. padding: 0 30rpx;
  253. box-sizing: border-box;
  254. }
  255. .commission-details .search .input {
  256. width: 100%;
  257. height: 60rpx;
  258. border-radius: 50rpx;
  259. background-color: #f5f5f5;
  260. position: relative;
  261. }
  262. .commission-details .search .input input {
  263. height: 100%;
  264. font-size: 26rpx;
  265. width: 100%;
  266. padding-left: 60rpx;
  267. }
  268. .box {
  269. border-radius: 14rpx;
  270. margin: 0 30rpx;
  271. overflow: hidden;
  272. }
  273. .commission-details .search .input .placeholder {
  274. color: #bbb;
  275. }
  276. .commission-details .search .input .iconfont {
  277. position: absolute;
  278. left: 28rpx;
  279. color: #999;
  280. font-size: 28rpx;
  281. top: 50%;
  282. transform: translateY(-50%);
  283. }
  284. .sign-record {
  285. margin-top: 20rpx;
  286. }
  287. .commission-details .promoterHeader .headerCon .money {
  288. font-size: 36rpx;
  289. }
  290. .commission-details .promoterHeader .headerCon .money .num {
  291. font-family: 'Guildford Pro';
  292. }
  293. .top_num {
  294. padding: 10rpx 30rpx 30rpx 30rpx;
  295. font-size: 26rpx;
  296. color: #666;
  297. }
  298. .radius15 {
  299. border-radius: 14rpx 14rpx 0 0;
  300. }
  301. .sign-record .list .item .listn .itemn1{border-bottom:1rpx solid #eee;padding:22rpx 24rpx;}
  302. .sign-record .list .item .listn .itemn1 .name{width:390rpx;font-size:28rpx;color:#282828;margin-bottom:10rpx;}
  303. .sign-record .list .item .listn .itemn1 .num{font-size:36rpx;font-family: 'Guildford Pro';color:#16ac57;}
  304. .sign-record .list .item .listn .itemn1 .num.font-color{color:#e93323!important;}
  305. .mark{
  306. margin-bottom: 10rpx;
  307. }
  308. .status_badge{
  309. display: inline-block;
  310. height: 30rpx;
  311. border-radius: 4rpx;
  312. font-size: 20rpx;
  313. line-height: 30rpx;
  314. font-family: PingFangSC-Regular, PingFang SC;
  315. font-weight: 400;
  316. margin-left:12rpx;
  317. padding:0 6rpx 0;
  318. }
  319. .success{
  320. background: rgba(24, 144, 255, .1);
  321. color: #1890FF;
  322. }
  323. .default{
  324. background: #f5f5f5;
  325. color: #282828;;
  326. }
  327. .error{
  328. background: rgba(233, 51, 35, .1);
  329. color: #E93323;
  330. }
  331. </style>