index.vue 15 KB

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