index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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 && recordType!=5 && recordType!= 6">
  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" v-if="recordType!=5"></timeSlot>
  12. <view class='sign-record'>
  13. <view class="top_num" v-if="recordType != 4 && recordList.length && recordType!=5 && recordType!=6">
  14. 支出:¥{{expend || 0}} &nbsp;&nbsp;&nbsp; 收入:¥{{income || 0}}
  15. </view>
  16. <view class="top_num top_num_2" v-if="recordType == 5">
  17. 当前股权:{{staffInfo.shareholding}}
  18. <view class="tx" @click="navto('/pages/users/user_payment/index?is_gq=1')">
  19. 提现
  20. </view>
  21. </view>
  22. <view class="box">
  23. <block v-for="(item,index) in recordList" :key="index" v-if="recordList.length>0">
  24. <view class='list'>
  25. <view class='item'>
  26. <!-- <view class='data'>{{item.time}}</view> -->
  27. <view class='listn'>
  28. <!-- <block v-for="(child,indexn) in item.child" :key="indexn"> -->
  29. <view class='itemn1 acea-row row-between-wrapper'>
  30. <view>
  31. <view class='name line1'>
  32. <text v-if="recordType!=5 && recordType!=6">{{item.title}}</text>
  33. <text v-else>{{item.content}}</text>
  34. <!-- <text class="status_badge success" v-if="recordType == 4 && item.status == 1">审核通过</text> -->
  35. <text class="status_badge default" v-if="recordType == 4 && item.status == 0">待审核</text>
  36. <text class="status_badge error" v-if="recordType == 4 && item.status == 2">未通过</text>
  37. <!-- 提现记录: 0 待审核 1 通过 2 未通过 -->
  38. </view>
  39. <view class="mark" v-if="recordType == 4 && item.mark && item.status !== 1">{{item.mark}}</view>
  40. <view v-if="recordType!=5 && recordType!=6">{{item.add_time}}</view>
  41. <view v-else>{{item.create_time}}</view>
  42. </view>
  43. <template v-if="recordType!=5 && recordType!=6">
  44. <view class='num font-color' v-if="item.pm == 1">+{{item.number}}</view>
  45. <view class='num' v-else>-{{item.number}}</view>
  46. </template>
  47. <template v-if="recordType == 5">
  48. <view class='num font-color' v-if="item.pm == 1">+{{item.shareholding}}</view>
  49. <view class='num' v-else>-{{item.shareholding}}</view>
  50. </template>
  51. <template v-if="recordType == 6">
  52. <view class='num font-color' v-if="item.pm == 1">+{{item.performance}}</view>
  53. <view class='num' v-else>-{{item.performance}}</view>
  54. </template>
  55. </view>
  56. <!-- </block> -->
  57. </view>
  58. </view>
  59. </view>
  60. </block>
  61. </view>
  62. <view class='loadingicon acea-row row-center-wrapper' v-if="recordList.length">
  63. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  64. </view>
  65. <view v-if="recordList.length < 1 && page > 1">
  66. <emptyPage title='暂无数据~'></emptyPage>
  67. </view>
  68. </view>
  69. </view>
  70. <home v-if="navigation"></home>
  71. <!-- #ifdef MP -->
  72. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  73. <!-- #endif -->
  74. </view>
  75. </template>
  76. <script>
  77. import {
  78. moneyList,
  79. getSpreadInfo,
  80. getGqList,
  81. getStaffInfo,
  82. getUserInfo,
  83. getYjList
  84. } from '@/api/user.js';
  85. import {
  86. toLogin
  87. } from '@/libs/login.js';
  88. import {
  89. mapGetters
  90. } from "vuex";
  91. import emptyPage from '@/components/emptyPage.vue'
  92. import home from '@/components/home';
  93. import colors from '@/mixins/color.js';
  94. import timeSlot from '@/components/timeSlot/index.vue'
  95. export default {
  96. components: {
  97. emptyPage,
  98. home,
  99. timeSlot
  100. },
  101. mixins: [colors],
  102. data() {
  103. return {
  104. timer: '',
  105. userInfo: {},
  106. staffInfo: {},
  107. name: '',
  108. keyword: '',
  109. type: 0,
  110. page: 1,
  111. limit: 15,
  112. loading: false,
  113. loadend: false,
  114. loadTitle: '加载更多',
  115. recordList: [],
  116. recordType: 0,
  117. recordCount: 0,
  118. extractCount: 0,
  119. times: [],
  120. start: 0,
  121. stop: 0,
  122. income: '',
  123. expend: '',
  124. isShowAuth: false
  125. };
  126. },
  127. computed: mapGetters(['isLogin']),
  128. onLoad(options) {
  129. this.type = options.type;
  130. if (!this.isLogin) {
  131. toLogin();
  132. }
  133. },
  134. onShow: function() {
  135. uni.removeStorageSync('form_type_cart');
  136. let type = this.type;
  137. if (type == 1) {
  138. uni.setNavigationBarTitle({
  139. title: "佣金记录"
  140. });
  141. this.name = '提现总额';
  142. this.recordType = 3;
  143. this.getRecordList();
  144. // this.getRecordListCount();
  145. } else if (type == 2) {
  146. uni.setNavigationBarTitle({
  147. title: "佣金记录"
  148. });
  149. this.name = '佣金明细';
  150. this.recordType = 3;
  151. this.getRecordList();
  152. // this.getRecordListCount();
  153. } else if (type == 4) {
  154. uni.setNavigationBarTitle({
  155. title: "提现记录"
  156. });
  157. this.name = '提现明细';
  158. this.recordType = 4;
  159. this.getRecordList();
  160. // this.getRecordListCount();
  161. } else if(type == 5) {
  162. uni.setNavigationBarTitle({
  163. title: "股权记录"
  164. });
  165. this.recordType = 5;
  166. this.name = '股权明细';
  167. this.getStaffInfo()
  168. }else if(type == 6) {
  169. uni.setNavigationBarTitle({
  170. title: "业绩记录"
  171. });
  172. this.recordType = 6;
  173. this.name = '业绩明细';
  174. this.getStaffInfo()
  175. // this.getYjList()
  176. } else {
  177. uni.showToast({
  178. title: '参数错误',
  179. icon: 'none',
  180. duration: 1000,
  181. mask: true,
  182. success: function(res) {
  183. setTimeout(function() {
  184. // #ifndef H5
  185. uni.navigateBack({
  186. delta: 1,
  187. });
  188. // #endif
  189. // #ifdef H5
  190. history.back();
  191. // #endif
  192. }, 1200)
  193. },
  194. });
  195. }
  196. },
  197. methods: {
  198. getYjList(time,type) {
  199. let that = this;
  200. let page = that.page;
  201. let limit = that.limit;
  202. if(type = 're') {
  203. page = 1
  204. that.loading = false
  205. that.loadend = false
  206. this.recordList = []
  207. }
  208. if (that.loading) return;
  209. if (that.loadend) return;
  210. getYjList({
  211. page: page,
  212. limit: limit,
  213. create_time: that.timer,
  214. member_id: that.staffInfo.id
  215. }).then(res => {
  216. this.recordList = this.recordList.concat(res.data.list)
  217. let loadend = res.data.list.length < that.limit;
  218. that.loadend = loadend;
  219. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  220. that.page += 1;
  221. that.loading = false;
  222. }).catch(err => {
  223. that.loading = false;
  224. that.loadTitle = '加载更多';
  225. })
  226. },
  227. // 显示详细
  228. showDetail(item){
  229. uni.showModal({
  230. title: '详细说明',
  231. content: item.mark,
  232. showCancel: false,
  233. });
  234. },
  235. navto(url) {
  236. uni.navigateTo({
  237. url
  238. })
  239. },
  240. onLoadFun(){
  241. this.isShowAuth = false
  242. },
  243. // 授权关闭
  244. authColse: function(e) {
  245. this.isShowAuth = e
  246. },
  247. submitForm() {
  248. this.page = 1;
  249. this.limit = 20;
  250. this.loadend = false;
  251. this.status = false;
  252. this.$set(this, 'recordList', []);
  253. this.$set(this, 'times', []);
  254. this.getRecordList();
  255. },
  256. getTimeStr(timestamp) {
  257. let date;
  258. if(timestamp) {
  259. date = new Date(timestamp*1000);
  260. }else {
  261. date = new Date();
  262. }
  263. const year = date.getFullYear();
  264. const month = date.getMonth() + 1; // 月份从 0 开始,所以需要加 1
  265. const day = date.getDate();
  266. return year + '/' + (month>9?month: '0' + month) + '/' + (day>9?day: '0' + day)
  267. },
  268. changeTime(time) {
  269. console.log(time,'time')
  270. if(this.recordType == 6) {
  271. let times = ''
  272. if(time.start == 0 && time.stop == 0 ) {
  273. console.log('全部')
  274. this.timer = '2020/01/01-' + this.getTimeStr()
  275. }else {
  276. this.timer = this.getTimeStr(time.start) + '-' + this.getTimeStr(time.stop)
  277. }
  278. console.log(this.timer,'timer')
  279. this.getYjList()
  280. }else {
  281. this.start = time.start
  282. this.stop = time.stop
  283. this.page = 1;
  284. // this.loading = false;
  285. this.loadend = false;
  286. this.$set(this, 'recordList', []);
  287. this.getRecordList();
  288. }
  289. },
  290. getGqList() {
  291. let that = this;
  292. let page = that.page;
  293. let limit = that.limit;
  294. if (that.loading) return;
  295. if (that.loadend) return;
  296. getGqList({
  297. page: page,
  298. limit: limit,
  299. uid: that.userInfo.uid
  300. }).then(res => {
  301. this.recordList = this.recordList.concat(res.data.list)
  302. let loadend = res.data.list.length < that.limit;
  303. that.loadend = loadend;
  304. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  305. that.page += 1;
  306. that.loading = false;
  307. }).catch(err => {
  308. that.loading = false;
  309. that.loadTitle = '加载更多';
  310. })
  311. },
  312. getStaffInfo() {
  313. let that = this
  314. getUserInfo().then(res => {
  315. that.userInfo = res.data
  316. if(this.recordType == 5) {
  317. that.getGqList();
  318. }
  319. getStaffInfo({
  320. uid: res.data.uid
  321. }).then(ress => {
  322. that.staffInfo = ress.data.list[0]
  323. if(this.recordType == 6) {
  324. that.getYjList()
  325. }
  326. })
  327. })
  328. },
  329. getRecordList: function() {
  330. let that = this;
  331. let page = that.page;
  332. let limit = that.limit;
  333. let recordType = that.recordType;
  334. if (that.loading) return;
  335. if (that.loadend) return;
  336. that.loading = true;
  337. that.loadTitle = '';
  338. moneyList({
  339. keyword: this.keyword,
  340. start: this.start,
  341. stop: this.stop,
  342. page: page,
  343. limit: limit
  344. }, recordType).then(res => {
  345. this.expend = res.data.expend;
  346. this.income = res.data.income;
  347. // for (let i = 0; i < res.data.time.length; i++) {
  348. // // if (!this.times.includes(res.data.time[i])) {
  349. // this.times.push(res.data.time[i])
  350. // this.recordList.push({
  351. // time: res.data.time[i],
  352. // child: []
  353. // })
  354. // // }
  355. // }
  356. // // for (let x = 0; x < this.times.length; x++) {
  357. // for (let j = 0; j < res.data.list.length; j++) {
  358. // // if (this.times[x] === res.data.list[j].time_key) {
  359. // // }
  360. // this.recordList[j].child.push(res.data.list[j])
  361. // }
  362. // // }
  363. this.recordList = this.recordList.concat(res.data.list)
  364. let loadend = res.data.list.length < that.limit;
  365. that.loadend = loadend;
  366. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  367. that.page += 1;
  368. that.loading = false;
  369. }).catch(err => {
  370. that.loading = false;
  371. that.loadTitle = '加载更多';
  372. })
  373. },
  374. getRecordListCount: function() {
  375. let that = this;
  376. getSpreadInfo().then(res => {
  377. that.recordCount = res.data.commissionCount;
  378. that.extractCount = res.data.extractCount;
  379. });
  380. }
  381. },
  382. onReachBottom: function() {
  383. if(this.recordType == 5) {
  384. this.getGqList()
  385. }else if(this.recordType == 6){
  386. this.getYjList()
  387. }else {
  388. this.getRecordList();
  389. }
  390. }
  391. }
  392. </script>
  393. <style scoped lang="scss">
  394. .commission-details .search {
  395. width: 100%;
  396. background-color: var(--view-theme);
  397. border-bottom: 1px solid #f2f2f2;
  398. height: 86rpx;
  399. padding: 0 30rpx;
  400. box-sizing: border-box;
  401. }
  402. .commission-details .search .input {
  403. width: 100%;
  404. height: 60rpx;
  405. border-radius: 50rpx;
  406. background-color: #f5f5f5;
  407. position: relative;
  408. }
  409. .commission-details .search .input input {
  410. height: 100%;
  411. font-size: 26rpx;
  412. width: 100%;
  413. padding-left: 60rpx;
  414. }
  415. .box {
  416. border-radius: 14rpx;
  417. margin: 0 30rpx;
  418. overflow: hidden;
  419. }
  420. .commission-details .search .input .placeholder {
  421. color: #bbb;
  422. }
  423. .commission-details .search .input .iconfont {
  424. position: absolute;
  425. left: 28rpx;
  426. color: #999;
  427. font-size: 28rpx;
  428. top: 50%;
  429. transform: translateY(-50%);
  430. }
  431. .sign-record {
  432. margin-top: 20rpx;
  433. }
  434. .commission-details .promoterHeader .headerCon .money {
  435. font-size: 36rpx;
  436. }
  437. .commission-details .promoterHeader .headerCon .money .num {
  438. font-family: 'Guildford Pro';
  439. }
  440. .top_num {
  441. padding: 10rpx 30rpx 30rpx 30rpx;
  442. font-size: 26rpx;
  443. color: #666;
  444. }
  445. .top_num_2 {
  446. display: flex;
  447. justify-content: space-between;
  448. }
  449. .tx {
  450. padding: 5rpx 15rpx;
  451. background-color:#1890FF;
  452. color: #fff;
  453. border-radius: 10rpx;
  454. }
  455. .radius15 {
  456. border-radius: 14rpx 14rpx 0 0;
  457. }
  458. .sign-record .list .item .listn .itemn1{border-bottom:1rpx solid #eee;padding:22rpx 24rpx;}
  459. .sign-record .list .item .listn .itemn1 .name{width:390rpx;font-size:28rpx;color:#282828;margin-bottom:10rpx;}
  460. .sign-record .list .item .listn .itemn1 .num{font-size:36rpx;font-family: 'Guildford Pro';color:#16ac57;}
  461. .sign-record .list .item .listn .itemn1 .num.font-color{color:#e93323!important;}
  462. .mark{
  463. margin-bottom: 10rpx;
  464. }
  465. .status_badge{
  466. display: inline-block;
  467. height: 30rpx;
  468. border-radius: 4rpx;
  469. font-size: 20rpx;
  470. line-height: 30rpx;
  471. font-family: PingFangSC-Regular, PingFang SC;
  472. font-weight: 400;
  473. margin-left:12rpx;
  474. padding:0 6rpx 0;
  475. }
  476. .success{
  477. background: rgba(24, 144, 255, .1);
  478. color: #1890FF;
  479. }
  480. .default{
  481. background: #f5f5f5;
  482. color: #282828;;
  483. }
  484. .error{
  485. background: rgba(233, 51, 35, .1);
  486. color: #E93323;
  487. }
  488. </style>