index.vue 17 KB

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