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