index.vue 17 KB

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