index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  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(this.type == 6){
  306. if(item.recharge){
  307. uni.showModal({
  308. title: '充值订单',
  309. content: `用户ID:${item.recharge.uid},充值${item.recharge.price}获得销售业绩`,
  310. showCancel: false,
  311. });
  312. }
  313. if(item.subscribe){
  314. const info = item.info[0];
  315. uni.showModal({
  316. title: '服务项目',
  317. content: `订单:${item.order_name},用户:${item.real_name},项目:${info.store_name},支付金额:${info.pay_price}`,
  318. showCancel: false,
  319. });
  320. }
  321. if(item.store){
  322. uni.showModal({
  323. title: '普通商品',
  324. content:`订单:${item.order_id},用户:${item.store.real_name},支付金额:${item.store.pay_price}获得销售业绩`,
  325. showCancel: false,
  326. });
  327. }
  328. }else{
  329. if (item.mark) {
  330. uni.showModal({
  331. title: '详细说明',
  332. content: item.mark,
  333. showCancel: false,
  334. });
  335. }else if(item.content){
  336. uni.showModal({
  337. title: '详细说明',
  338. content: item.content,
  339. showCancel: false,
  340. });
  341. }
  342. }
  343. },
  344. navto(url) {
  345. uni.navigateTo({
  346. url
  347. })
  348. },
  349. onLoadFun() {
  350. this.isShowAuth = false
  351. },
  352. // 授权关闭
  353. authColse: function(e) {
  354. this.isShowAuth = e
  355. },
  356. submitForm() {
  357. this.page = 1;
  358. this.limit = 20;
  359. this.loadend = false;
  360. this.status = false;
  361. this.$set(this, 'recordList', []);
  362. this.$set(this, 'times', []);
  363. this.getRecordList();
  364. },
  365. getTimeStr(timestamp) {
  366. let date;
  367. if (timestamp) {
  368. date = new Date(timestamp * 1000);
  369. } else {
  370. date = new Date();
  371. }
  372. const year = date.getFullYear();
  373. const month = date.getMonth() + 1; // 月份从 0 开始,所以需要加 1
  374. const day = date.getDate();
  375. return year + '/' + (month > 9 ? month : '0' + month) + '/' + (day > 9 ? day : '0' + day)
  376. },
  377. changeTime(time) {
  378. console.log(time, 'time')
  379. if (this.recordType == 6) {
  380. let times = ''
  381. if (time.start == 0 && time.stop == 0) {
  382. console.log('全部')
  383. this.timer = '2020/01/01-' + this.getTimeStr()
  384. } else {
  385. this.timer = this.getTimeStr(time.start) + '-' + this.getTimeStr(time.stop)
  386. }
  387. console.log(this.timer, 'timer')
  388. this.getYjList()
  389. } else {
  390. this.start = time.start
  391. this.stop = time.stop
  392. this.page = 1;
  393. // this.loading = false;
  394. this.loadend = false;
  395. this.$set(this, 'recordList', []);
  396. this.getRecordList();
  397. }
  398. },
  399. getGqList() {
  400. let that = this;
  401. let page = that.page;
  402. let limit = that.limit;
  403. if (that.loading) return;
  404. if (that.loadend) return;
  405. getGqList({
  406. page: page,
  407. limit: limit,
  408. uid: that.userInfo.uid
  409. }).then(res => {
  410. this.recordList = this.recordList.concat(res.data.list)
  411. let loadend = res.data.list.length < that.limit;
  412. that.loadend = loadend;
  413. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  414. that.page += 1;
  415. that.loading = false;
  416. }).catch(err => {
  417. that.loading = false;
  418. that.loadTitle = '加载更多';
  419. })
  420. },
  421. getStaffInfo() {
  422. let that = this
  423. getUserInfo().then(res => {
  424. that.userInfo = res.data
  425. if (this.recordType == 5) {
  426. that.getGqList();
  427. }
  428. getStaffInfo({
  429. uid: res.data.uid
  430. }).then(ress => {
  431. ress.data.list.forEach(item => {
  432. if(item.uid == res.data.uid) {
  433. that.staffInfo = item
  434. }
  435. })
  436. if (that.recordType == 6) {
  437. that.getYjList()
  438. }
  439. if(that.recordType == 7) {
  440. that.getJt('re',51)
  441. }
  442. })
  443. })
  444. },
  445. getRecordList: function() {
  446. let that = this;
  447. let page = that.page;
  448. let limit = that.limit;
  449. let recordType = that.recordType;
  450. if (that.loading) return;
  451. if (that.loadend) return;
  452. that.loading = true;
  453. that.loadTitle = '';
  454. moneyList({
  455. keyword: this.keyword,
  456. start: this.start,
  457. stop: this.stop,
  458. page: page,
  459. limit: limit
  460. }, recordType).then(res => {
  461. this.expend = res.data.expend;
  462. this.income = res.data.income;
  463. // for (let i = 0; i < res.data.time.length; i++) {
  464. // // if (!this.times.includes(res.data.time[i])) {
  465. // this.times.push(res.data.time[i])
  466. // this.recordList.push({
  467. // time: res.data.time[i],
  468. // child: []
  469. // })
  470. // // }
  471. // }
  472. // // for (let x = 0; x < this.times.length; x++) {
  473. // for (let j = 0; j < res.data.list.length; j++) {
  474. // // if (this.times[x] === res.data.list[j].time_key) {
  475. // // }
  476. // this.recordList[j].child.push(res.data.list[j])
  477. // }
  478. // // }
  479. this.recordList = this.recordList.concat(res.data.list)
  480. let loadend = res.data.list.length < that.limit;
  481. that.loadend = loadend;
  482. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  483. that.page += 1;
  484. that.loading = false;
  485. }).catch(err => {
  486. that.loading = false;
  487. that.loadTitle = '加载更多';
  488. })
  489. },
  490. getRecordListCount: function() {
  491. let that = this;
  492. getSpreadInfo().then(res => {
  493. that.recordCount = res.data.commissionCount;
  494. that.extractCount = res.data.extractCount;
  495. });
  496. }
  497. },
  498. onReachBottom: function() {
  499. if (this.recordType == 5) {
  500. this.getGqList()
  501. } else if (this.recordType == 6) {
  502. this.getYjList()
  503. } else {
  504. this.getRecordList();
  505. }
  506. }
  507. }
  508. </script>
  509. <style scoped lang="scss">
  510. .commission-details .search {
  511. width: 100%;
  512. background-color: var(--view-theme);
  513. border-bottom: 1px solid #f2f2f2;
  514. height: 86rpx;
  515. padding: 0 30rpx;
  516. box-sizing: border-box;
  517. }
  518. .commission-details .search .input {
  519. width: 100%;
  520. height: 60rpx;
  521. border-radius: 50rpx;
  522. background-color: #f5f5f5;
  523. position: relative;
  524. }
  525. .commission-details .search .input input {
  526. height: 100%;
  527. font-size: 26rpx;
  528. width: 100%;
  529. padding-left: 60rpx;
  530. }
  531. .box {
  532. border-radius: 14rpx;
  533. margin: 0 30rpx;
  534. overflow: hidden;
  535. }
  536. .commission-details .search .input .placeholder {
  537. color: #bbb;
  538. }
  539. .commission-details .search .input .iconfont {
  540. position: absolute;
  541. left: 28rpx;
  542. color: #999;
  543. font-size: 28rpx;
  544. top: 50%;
  545. transform: translateY(-50%);
  546. }
  547. .sign-record {
  548. margin-top: 20rpx;
  549. }
  550. .commission-details .promoterHeader .headerCon .money {
  551. font-size: 36rpx;
  552. }
  553. .commission-details .promoterHeader .headerCon .money .num {
  554. font-family: 'Guildford Pro';
  555. }
  556. .top_num {
  557. padding: 10rpx 30rpx 30rpx 30rpx;
  558. font-size: 26rpx;
  559. color: #666;
  560. }
  561. .top_num_2 {
  562. display: flex;
  563. justify-content: space-between;
  564. }
  565. .tx {
  566. padding: 5rpx 15rpx;
  567. background-color: #1890FF;
  568. color: #fff;
  569. border-radius: 10rpx;
  570. }
  571. .radius15 {
  572. border-radius: 14rpx 14rpx 0 0;
  573. }
  574. .sign-record .list .item .listn .itemn1 {
  575. border-bottom: 1rpx solid #eee;
  576. padding: 22rpx 24rpx;
  577. flex-wrap: nowrap;
  578. }
  579. .sign-record .list .item .listn .itemn1 .flex-g{
  580. flex-grow: 1;
  581. padding-right: 30rpx;
  582. }
  583. .sign-record .list .item .listn .itemn1 .name {
  584. font-size: 28rpx;
  585. color: #282828;
  586. margin-bottom: 10rpx;
  587. }
  588. .sign-record .list .item .listn .itemn1 .num {
  589. font-size: 36rpx;
  590. font-family: 'Guildford Pro';
  591. color: #16ac57;
  592. }
  593. .sign-record .list .item .listn .itemn1 .num.font-color {
  594. color: #e93323 !important;
  595. }
  596. .mark {
  597. margin-bottom: 10rpx;
  598. }
  599. .status_badge {
  600. display: inline-block;
  601. height: 30rpx;
  602. border-radius: 4rpx;
  603. font-size: 20rpx;
  604. line-height: 30rpx;
  605. font-family: PingFangSC-Regular, PingFang SC;
  606. font-weight: 400;
  607. margin-left: 12rpx;
  608. padding: 0 6rpx 0;
  609. }
  610. .success {
  611. background: rgba(24, 144, 255, .1);
  612. color: #1890FF;
  613. }
  614. .default {
  615. background: #f5f5f5;
  616. color: #282828;
  617. ;
  618. }
  619. .error {
  620. background: rgba(233, 51, 35, .1);
  621. color: #E93323;
  622. }
  623. .nav {
  624. display: flex;
  625. justify-content: space-evenly;
  626. .nav-item {
  627. width: 50%;
  628. line-height: 60rpx;
  629. text-align: center;
  630. color: #1890FF;
  631. border: 1px solid #1890FF;
  632. font-size: 28rpx;
  633. background-color: #fff;
  634. }
  635. .action {
  636. background-color: #1890FF;
  637. color: #fff;
  638. font-weight: bold;
  639. }
  640. }
  641. </style>