index.vue 15 KB

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