index.vue 14 KB

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