orderGroup.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <view class="content">
  3. <!-- <view class="navbar coupon">
  4. <view class="nav-item grenn" v-if="tabCurrentIndex == 0">
  5. 一级总业绩:
  6. <text>{{ one_price }}</text>
  7. </view>
  8. <view class="nav-item black" v-if="tabCurrentIndex == 1">
  9. 二级总业绩:
  10. <text>{{ two_price }}</text>
  11. </view>
  12. </view> -->
  13. <!-- <view class="navbar">
  14. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}:{{item.number}}人</view>
  15. </view> -->
  16. <view class="order">
  17. <view class="flex views_dates">
  18. <view class="flex" style="width: 40%;">
  19. <view class="uni-list">
  20. <view class="uni-list-cell">
  21. <view class="uni-list-cell-db">
  22. <picker mode="date" :value="startDate" start="2001-01" fields="month" @change="bindDateChange1">
  23. <view class="uni-input">{{startDate}}</view>
  24. </picker>
  25. </view>
  26. </view>
  27. </view>
  28. --
  29. <view class="uni-list">
  30. <view class="uni-list-cell">
  31. <view class="uni-list-cell-db">
  32. <picker mode="date" :value="endDate" start="2001-01" fields="month" @change="bindDateChange2">
  33. <view class="uni-input">{{endDate}}<text class="iconfont iconenter"></text></view>
  34. </picker>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="mony"><text style="font-size: 36rpx;">¥</text>{{ pinkNums || '0' }}</view>
  41. <view class="total">总金额</view>
  42. <view class="top-box">
  43. <view class="box">
  44. <view class="box-1">人头奖</view>
  45. <view class="box-2"><text class="symbool">¥</text>{{ peoNum || '0' }}</view>
  46. </view>
  47. <view class="box">
  48. <view class="box-1">分佣奖</view>
  49. <view class="box-2"><text class="symbool">¥</text>{{ num_fen || '0' }}</view>
  50. </view>
  51. </view>
  52. </view>
  53. <swiper :style="{ height: maxheight + 'px' }" class="swiper-box">
  54. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  55. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  56. <!-- 空白页 -->
  57. <empty v-if="tabItem.orderList.length === 0"></empty>
  58. <!-- 订单列表 -->
  59. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item">
  60. <view class="order-tpl">
  61. <view class="time">{{ item.time }}</view>
  62. <view class="count">本月累计拼团订单:{{ item.count }}单</view>
  63. </view>
  64. <view v-for="ls in item.child" class="title-list">
  65. <view class="title-box">
  66. <view class="flex">
  67. <view class="order_id">订单编号:{{ ls.order_id }}</view>
  68. <!-- 0:待发货;1:待收货;2:已收货;3:待评价 -->
  69. <!-- {{ ls.status == 0 ? '待付款' : ls.status == 1 ? '待发货' : ls.status == 2 ? '待收货' : ls.status == 3 ? '待评价' : ls.status == 4 ? '已完成' :'退款' }} -->
  70. <view class="status" v-if="ls.refund_status == 0">
  71. <view v-if="ls.paid == 1">{{ls.status == 0 ? '待发货' : ls.status == 1 ? '待收货' : ls.status == 2 ? '已收货' : '待评价'}}</view>
  72. <view v-else>未支付</view>
  73. </view>
  74. <view class="status" v-else>{{ls.refund_status == 1 ? '退款中' :'退款成功'}}</view>
  75. </view>
  76. <view class="flex_item order-list">
  77. <view class="title-avatar">
  78. <image :src="ls.avatar"></image>
  79. </view>
  80. <view class="order-info">
  81. <view class="flex">
  82. <view class="nickname">{{ ls.nickname }}</view>
  83. <view class="number">
  84. 返佣:
  85. <text>{{ ls.number }}</text>
  86. </view>
  87. </view>
  88. <view class="flex">
  89. <view>{{ ls.time }}</view>
  90. <view>订单金额:{{ ls.pay_price }}</view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  98. </scroll-view>
  99. </swiper-item>
  100. </swiper>
  101. </view>
  102. </template>
  103. <script>
  104. import { orderPink } from '@/api/team.js';
  105. import { mapState, mapMutations } from 'vuex';
  106. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  107. import empty from '@/components/empty';
  108. import {
  109. getTime
  110. } from '@/utils/rocessor.js';
  111. // 获取当前时间的秒数
  112. const time = Math.floor(new Date().getTime() / 1000);
  113. export default {
  114. components: {
  115. empty,
  116. uniLoadMore
  117. },
  118. filters: {
  119. lastTime: function(value) {
  120. const day = Math.floor((time - value) / 60 / 60 / 24);
  121. return day == 0 ? '今天登陆' : day + '天前登陆';
  122. }
  123. },
  124. onReady() {
  125. // 初始化获取页面宽度
  126. uni.createSelectorQuery()
  127. .select('.content')
  128. .fields({
  129. size: true
  130. },
  131. data => {
  132. console.log(data);
  133. // 保存头部高度
  134. this.maxheight = data.height - Math.floor((data.width / 750) * 340);
  135. console.log(this.maxheight);
  136. }
  137. )
  138. .exec();
  139. },
  140. data() {
  141. return {
  142. // 头部图高度
  143. maxheight: '',
  144. tabCurrentIndex: 0,
  145. navList: [{
  146. state: 0,
  147. text: '一级',
  148. loadingType: 'more',
  149. orderList: [],
  150. number: 0,
  151. page: 1, //当前页数
  152. limit: 10 //每次信息条数
  153. }],
  154. all: '',
  155. list: '',
  156. total: '',
  157. totalLevel: '',
  158. img: 'http://kaifa.crmeb.net/uploads/attach/2019/08/20190807/723adbdd4e49a0f9394dfc700ab5dba3.png',
  159. // one_price: '', //一级总金额
  160. // two_price: '', //二级总金额
  161. // total_pay_price: '',
  162. timelist: ['全部', '今天', '昨天', '最近7天', '最近30天', '本月', '本年'],
  163. typelist: ['全部', '一级订单', '二级订单'],
  164. startDate: '开始时间',
  165. endDate: '结束时间',
  166. start: '',
  167. end: '',
  168. val1: '',
  169. val2: '',
  170. timedata: '',
  171. dateDay: [], // 传的时间参数
  172. num_fen: '', // 分佣奖
  173. peoNum: '', // 人头奖
  174. pinkNums: '' // 总金额
  175. };
  176. },
  177. onLoad(options) {},
  178. onShow() {
  179. this.loadData();
  180. },
  181. methods: {
  182. //选择开始时间
  183. bindDateChange1: function(e) {
  184. console.log(11)
  185. let obj = this;
  186. let val = e.detail.value;
  187. obj.val1 = e.detail.value;
  188. // var reg = /-/g;
  189. obj.startDate = e.detail.value;
  190. console.log(obj.startDate,965)
  191. var formatDate1 = new Date(obj.val1);
  192. var formatDate2 = new Date(obj.timedata);
  193. console.log(obj.val1, obj.timedata, '开始时间不得大于现在时间');
  194. console.log(formatDate1, formatDate2, '开始时间不得大于现在时间');
  195. if (formatDate1 > formatDate2) {
  196. console.log(11);
  197. uni.showToast({
  198. title: '开始时间不得大于现在时间',
  199. duration: 2000,
  200. position: 'top',
  201. icon: 'none'
  202. });
  203. } else {
  204. console.log(22);
  205. }
  206. },
  207. //选择结束时间
  208. bindDateChange2: function(e) {
  209. console.log(11)
  210. let obj = this;
  211. if (obj.val1 == '') {
  212. uni.showToast({
  213. title: '请先选择开始时间',
  214. duration: 2000,
  215. position: 'top',
  216. icon: 'none'
  217. });
  218. } else {
  219. let val = e.detail.value;
  220. obj.val2 = e.detail.value;
  221. // var reg = /-/g;
  222. // obj.endDate = val.replace(reg, '\/');
  223. obj.endDate = e.detail.value
  224. console.log(obj.endDate, 22);
  225. var formatDate1 = new Date(obj.val1);
  226. var formatDate2 = new Date(obj.timedata);
  227. var formatDate3 = new Date(obj.val2);
  228. console.log(obj.val1, obj.val2, obj.timedata, '123');
  229. console.log(formatDate1, formatDate3, formatDate2, '456');
  230. let arr = []
  231. arr[0] = this.startDate;
  232. arr[1] = this.endDate;
  233. this.dateDay = arr.join(';')
  234. console.log(this.dateDay,664853)
  235. if (formatDate1 > formatDate2) {
  236. uni.showToast({
  237. title: '开始时间不得大于现在时间',
  238. duration: 2000,
  239. position: 'top',
  240. icon: 'none'
  241. });
  242. } else {
  243. if (formatDate3 < formatDate1) {
  244. // console.log(111)
  245. uni.showToast({
  246. title: '结束时间要大于开始时间',
  247. duration: 2000,
  248. position: 'top',
  249. icon: 'none'
  250. });
  251. }
  252. if (formatDate3 > formatDate2) {
  253. uni.showToast({
  254. title: '结束时间不得大于现在时间',
  255. duration: 2000,
  256. position: 'top',
  257. icon: 'none'
  258. });
  259. } else {
  260. let index = this.tabCurrentIndex;
  261. let navItem = this.navList[index];
  262. navItem.orderList = [];
  263. navItem.loadingType = 'more'
  264. this.loadData()
  265. }
  266. }
  267. }
  268. },
  269. //获取日期
  270. getDate() {
  271. let date = new Date();
  272. let dateYear = date.getFullYear(); //获取年
  273. let dateMonth = date.getMonth() + 1; //获取月
  274. let dateDate = date.getDate(); //获取当日
  275. this.timedata = dateYear + '-' + dateMonth + '-' + dateDate;
  276. },
  277. // 页面跳转
  278. navto(e) {
  279. uni.navigateTo({
  280. url: e
  281. });
  282. },
  283. //获取收入支出信息
  284. async loadData(source) {
  285. let obj = this;
  286. //这里是将订单挂载到tab列表下
  287. let index = this.tabCurrentIndex;
  288. let navItem = this.navList[index];
  289. let state = navItem.state;
  290. if (navItem.loadingType === 'noMore') {
  291. //防止重复加载
  292. return;
  293. }
  294. // if (source === 'tabChange' && navItem.loaded === true) {
  295. // //tab切换只有第一次需要加载数据
  296. // return;
  297. // }
  298. // if (navItem.loadingType === 'loading') {
  299. // //防止重复加载
  300. // return;
  301. // }
  302. // // 修改当前对象状态为加载中
  303. // navItem.loadingType = 'loading';
  304. orderPink({
  305. date: obj.dateDay
  306. })
  307. .then(({
  308. data
  309. }) => {
  310. // let arr = data.list.map(e => {
  311. // e.lastTimeString = getTime(e.lastTime);
  312. // return e;
  313. // });
  314. let arr = data.list;
  315. obj.pinkNums = data.prize_sum; // 总金额
  316. obj.peoNum = data.people_prize_sum; // 人头奖
  317. obj.num_fen = data.pink_prize_sum; // 分佣奖
  318. navItem.orderList = navItem.orderList.concat(data.list);
  319. console.log(navItem.orderList, 'navItem.orderList');
  320. navItem.loadingType = 'noMore';
  321. // navItem.page++;
  322. // if (navItem.limit == data.length) {
  323. // //判断是否还有数据, 有改为 more, 没有改为noMore
  324. // navItem.loadingType = 'more';
  325. // return;
  326. // } else {
  327. // //判断是否还有数据, 有改为 more, 没有改为noMore
  328. // navItem.loadingType = 'noMore';
  329. // }
  330. // this.$set(navItem, 'loaded', true);
  331. })
  332. .catch(e => {
  333. console.log(e);
  334. });
  335. },
  336. //swiper 切换
  337. changeTab(e) {
  338. this.tabCurrentIndex = e.target.current;
  339. this.loadData('tabChange');
  340. },
  341. //顶部tab点击
  342. tabClick(index) {
  343. this.tabCurrentIndex = index;
  344. }
  345. }
  346. };
  347. </script>
  348. <style lang="scss">
  349. page {
  350. background: #f8f8f8;
  351. height: 100%;
  352. }
  353. .content-money {
  354. padding-bottom: 30rpx;
  355. background: $page-color-base;
  356. .buttom-box {
  357. background-color: #ffffff;
  358. text-align: center;
  359. margin: 0 30rpx;
  360. padding: 30rpx 0;
  361. border-radius: $border-radius-sm;
  362. margin-top: -60rpx;
  363. .buttom {
  364. font-size: $font-lg;
  365. flex-grow: 1;
  366. .money {
  367. font-weight: bold;
  368. font-size: 32rpx;
  369. color: #db1935;
  370. }
  371. }
  372. .text {
  373. color: #666666;
  374. }
  375. .interval {
  376. width: 2rpx;
  377. height: 60rpx;
  378. background-color: #eeeeee;
  379. }
  380. .icon {
  381. height: 50rpx;
  382. width: 48rpx;
  383. margin: 0 auto;
  384. .icon-img {
  385. width: 100%;
  386. height: 100%;
  387. }
  388. }
  389. }
  390. }
  391. .money-box {
  392. background: #bc253a;
  393. height: 320rpx;
  394. color: #ffffff;
  395. text-align: center;
  396. font-size: 35rpx;
  397. padding-top: 60rpx;
  398. .money_img {
  399. width: 100%;
  400. height: 120rpx;
  401. text-align: center;
  402. padding-top: 50rpx;
  403. padding-bottom: 135rpx;
  404. image {
  405. width: 120rpx;
  406. height: 120rpx;
  407. border: 4rpx solid #fd5f6f;
  408. border-radius: 50%;
  409. }
  410. }
  411. .money_name {
  412. width: 100%;
  413. text-align: center;
  414. font-size: 40rpx;
  415. padding-bottom: 25rpx;
  416. }
  417. }
  418. .navbar {
  419. display: flex;
  420. height: 40px;
  421. padding: 0 5px;
  422. background: #fff;
  423. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  424. position: relative;
  425. z-index: 10;
  426. .nav-item {
  427. flex: 1;
  428. display: flex;
  429. justify-content: center;
  430. align-items: center;
  431. height: 100%;
  432. font-size: 15px;
  433. color: $font-color-dark;
  434. position: relative;
  435. &.current {
  436. color: $font-color;
  437. background-color: #dcdfe6;
  438. // color: #FC2A3F;
  439. // &:after {
  440. // content: '';
  441. // position: absolute;
  442. // left: 50%;
  443. // bottom: 0;
  444. // transform: translateX(-50%);
  445. // width: 44px;
  446. // height: 0;
  447. // border-bottom: 2px solid #FC2A3F;
  448. // }
  449. }
  450. }
  451. .grenn {
  452. background: #2fbd5b;
  453. }
  454. .black {
  455. background: #434343;
  456. }
  457. .grenn,
  458. .black {
  459. color: #ffffff;
  460. text-align: left;
  461. }
  462. }
  463. // 列表
  464. .order {
  465. background-color: $base-color;
  466. text-align: center;
  467. height: 340rpx;
  468. color: #ffffff;
  469. .mony {
  470. font-size: 45rpx;
  471. font-weight: bold;
  472. margin-bottom: 20rpx;
  473. }
  474. .total {
  475. font-size: 30rpx;
  476. font-weight: 500;
  477. }
  478. .top-box {
  479. display: flex;
  480. justify-content: center;
  481. margin-top: 20rpx;
  482. .box {
  483. flex: 1;
  484. .box-1 {
  485. font-size: 30rpx;
  486. margin-bottom: 10rpx;
  487. font-weight: 500;
  488. }
  489. .box-2 {
  490. font-size: 36rpx;
  491. font-weight: bold;
  492. }
  493. }
  494. }
  495. .symbool {
  496. font-size: 30rpx;
  497. }
  498. .views_dates {
  499. font-size: 24rpx;
  500. padding-top: 50rpx;
  501. padding-bottom: 40rpx;
  502. height: 0;
  503. text-align: right;
  504. justify-content: flex-end;
  505. min-height: auto;
  506. .uni-list {
  507. line-height: 1;
  508. }
  509. .uni-input {
  510. display: flex;
  511. align-items: center;
  512. }
  513. .iconenter {
  514. margin-bottom: 8rpx;
  515. }
  516. .clearance {
  517. border: 1px solid $border-color-light;
  518. margin: 0 15rpx;
  519. width: 5rpx;
  520. }
  521. }
  522. }
  523. .swiper-box {
  524. font-size: 28rpx;
  525. .order-item {
  526. line-height: 1.5;
  527. .order-tpl {
  528. padding: 25rpx 0rpx;
  529. padding-bottom: 15rpx !important;
  530. .count {
  531. color: #999999;
  532. }
  533. }
  534. .title-list {
  535. background-color: #ffffff;
  536. width: 100%;
  537. padding: 20rpx 30rpx;
  538. margin-top: 15rpx;
  539. .title-box {
  540. .order_id {
  541. color: #999999;
  542. padding-bottom: 15rpx;
  543. }
  544. .status {
  545. color: #F9273F;
  546. }
  547. .order-list {
  548. .title-avatar {
  549. width: 100rpx;
  550. height: 100rpx;
  551. margin-right: 25rpx;
  552. image {
  553. width: 100%;
  554. height: 100%;
  555. border-radius: 100%;
  556. }
  557. }
  558. .order-info {
  559. color: #999999;
  560. width: 80%;
  561. padding-left: 25rpx;
  562. .nickname {
  563. font-size: 32rpx;
  564. color: #333333;
  565. padding-bottom: 15rpx;
  566. width: 50%;
  567. }
  568. .number {
  569. text {
  570. color: #fa2740;
  571. }
  572. }
  573. }
  574. }
  575. }
  576. }
  577. .money {
  578. color: #db1935;
  579. font-size: $font-lg;
  580. }
  581. }
  582. }
  583. .list-scroll-content {
  584. height: 100%;
  585. padding: 0rpx 25rpx;
  586. }
  587. .content {
  588. height: 100%;
  589. .empty-content {
  590. background-color: #ffffff;
  591. }
  592. }
  593. </style>