index.vue 16 KB

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