order.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <!-- 分销订单 -->
  2. <template>
  3. <view class="page_box commission-order-wrap">
  4. <view class="head_box">
  5. <!-- 标题栏 -->
  6. <shopro-navbar back-icon-color="#fff" :background="{}" :backTextStyle="{ color: '#fff', fontSize: '40rpx', fontWeight: '500' }" backText="分销订单"></shopro-navbar>
  7. <!-- 团队数据总览 -->
  8. <view class="team-data-box u-flex u-row-between">
  9. <view class="data-card">
  10. <view class="total-item">
  11. <view class="item-title">团队订单数量(单)</view>
  12. <view class="total-num">{{ agentInfo.child_order_count || 0 }}</view>
  13. </view>
  14. <view class="category-item u-flex">
  15. <view class="u-flex-1">
  16. <view class="item-title">一级订单</view>
  17. <view class="category-num">{{ agentInfo.child_order_count_1 || 0 }}</view>
  18. </view>
  19. <view class="u-flex-1">
  20. <view class="item-title">二级订单</view>
  21. <view class="category-num">{{ agentInfo.child_order_count_2 || 0 }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="data-card">
  26. <view class="total-item">
  27. <view class="item-title">团队订单金额(元)</view>
  28. <view class="total-num">{{ agentInfo.child_order_money || '0.00' }}</view>
  29. </view>
  30. <view class="category-item u-flex">
  31. <view class="u-flex-1">
  32. <view class="item-title">一级订单</view>
  33. <view class="category-num">{{ agentInfo.child_order_money_1 || '0.00' }}</view>
  34. </view>
  35. <view class="u-flex-1">
  36. <view class="item-title">二级订单</view>
  37. <view class="category-num">{{ agentInfo.child_order_money_2 || '0.00' }}</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 直推 -->
  43. <view class="direct-box u-flex u-row-between">
  44. <view class="direct-item">
  45. <view class="item-title">直推分销订单数量(单)</view>
  46. <view class="item-value">{{ agentInfo.order_count }}</view>
  47. </view>
  48. <view class="direct-item">
  49. <view class="item-title">直推分销订单金额(元)</view>
  50. <view class="item-value">{{ agentInfo.order_money }}</view>
  51. </view>
  52. </view>
  53. <!-- 筛选 -->
  54. <view class="">
  55. <!-- 日期筛选 -->
  56. <view class="filter-box u-flex u-row-between">
  57. <button class="u-reset-button date-btn u-flex u-col-center" @tap="showCalendar = true">
  58. {{ selDateText }}
  59. <text class="u-iconfont uicon-arrow-down-fill u-m-l-20" style="color:#e5e5e5 ; font-size: 34rpx;"></text>
  60. </button>
  61. <view class="">
  62. <view class="total-box">{{ stateMap[stateCurrent] }}¥{{ amount || '0.00' }}</view>
  63. </view>
  64. </view>
  65. <!-- 状态分类 -->
  66. <view class="u-flex nav-box">
  67. <view class="state-item u-flex-1" v-for="(state, index) in statusList" :key="state.value" @tap="onTab(state.value)">
  68. <text class="state-title" :class="{ 'title-active': stateCurrent === state.value }">{{ state.name }}</text>
  69. <text class="underline" :class="{ 'underline-active': stateCurrent === state.value }"></text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="content_box">
  75. <scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
  76. <!-- 订单列表 -->
  77. <view class="order-list" v-for="item in orderList" :key="item.id">
  78. <view class="order-head u-flex u-row-between">
  79. <text class="order-code">订单编号:{{ item.order.order_sn }}</text>
  80. <text class="order-state">{{ item.order.status_name }}</text>
  81. </view>
  82. <view class="order-from u-flex u-row-between">
  83. <view class="from-user u-flex">
  84. <text>下单人:</text>
  85. <image class="user-avatar" :src="item.buyer.avatar" mode=""></image>
  86. <text class="user-name">{{ item.buyer.nickname }}</text>
  87. </view>
  88. <view class="order-time">{{ $u.timeFormat(item.order.createtime, ' yyyy.mm.dd hh:MM ') }}</view>
  89. </view>
  90. <view class="goods-card u-flex" v-for="corder in item.commission_order" :key="corder.id">
  91. <view class="goods-img-box"><image class="goods-img" :src="corder.order_item.goods_image" mode=""></image></view>
  92. <view class="goods-info u-flex-col u-row-between">
  93. <view class="goods-title more-t">{{ corder.order_item.goods_title }}</view>
  94. <view class="goods-sku">数量: {{ corder.order_item.goods_num }};{{ corder.order_item.goods_sku_text || '' }}</view>
  95. <view class="total-box u-flex u-flex-1 u-row-between">
  96. <view class="goods-price">
  97. {{ corder.amount }}
  98. <text class="goods-state">{{ corder.commission_order_status_text }}</text>
  99. </view>
  100. <view class="u-flex" v-if="corder.reward">
  101. <text class="name">佣金</text>
  102. <text class="commission-num">{{ corder.reward.commission }}</text>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. <!-- 缺省页 -->
  109. <shopro-empty marginTop="100rpx" v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/no_order.png'" tipText="暂无订单"></shopro-empty>
  110. <!-- 更多 -->
  111. <u-loadmore v-if="orderList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
  112. </scroll-view>
  113. </view>
  114. <!-- 日期选择 -->
  115. <u-calendar
  116. v-model="showCalendar"
  117. safeAreaInsetBottom
  118. ref="uCalendar"
  119. mode="range"
  120. start-text="开始"
  121. end-text="结束"
  122. active-bg-color="#7063d2"
  123. active-color="#fff"
  124. range-bg-color="#e5e2ff"
  125. range-color="#7063d2"
  126. :customStyle="{ background: 'linear-gradient(90deg, #A36FFF, #5336FF)', boxShadow: '0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34)' }"
  127. @change="selDate"
  128. ></u-calendar>
  129. </view>
  130. </template>
  131. <script>
  132. import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
  133. export default {
  134. components: {},
  135. data() {
  136. return {
  137. backTextStyle: {
  138. color: '#fff',
  139. fontSize: '40rpx',
  140. fontWeight: '500'
  141. },
  142. stateCurrent: 'all', //默认
  143. stateMap: {
  144. all: '全部',
  145. // no: '不计入',
  146. yes: '已计入',
  147. back: '已退回',
  148. cancel: '已取消'
  149. },
  150. statusList: [
  151. {
  152. name: '全部',
  153. value: 'all'
  154. },
  155. // {
  156. // name: '不计入',
  157. // value: 'no'
  158. // },
  159. {
  160. name: '已计入',
  161. value: 'yes'
  162. },
  163. {
  164. name: '已退回',
  165. value: 'back'
  166. },
  167. {
  168. name: '已取消',
  169. value: 'cancel'
  170. }
  171. ],
  172. orderList: [], //分销订单
  173. loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
  174. currentPage: 1,
  175. lastPage: 1,
  176. isEmpty: false,
  177. //日期选择
  178. showCalendar: false,
  179. selDateText: '',
  180. propsDate: '', //日期参数
  181. amount: '' //收入
  182. };
  183. },
  184. computed: {
  185. ...mapGetters(['userInfo', 'agentInfo'])
  186. },
  187. onLoad() {
  188. this.getToday();
  189. this.getOrderList();
  190. },
  191. onPullDownRefresh() {
  192. this.orderList = [];
  193. this.currentPage = 1;
  194. this.lastPage = 1;
  195. this.getOrderList();
  196. },
  197. methods: {
  198. jump(path, parmas) {
  199. this.$Router.push({
  200. path: path,
  201. query: parmas
  202. });
  203. },
  204. // 今日
  205. getToday() {
  206. let now = new Date();
  207. this.selDateText = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
  208. let dateText = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
  209. this.propsDate = `${dateText}-${dateText}`;
  210. },
  211. // 选择日期
  212. selDate(e) {
  213. this.orderList = [];
  214. this.currentPage = 1;
  215. this.lastPage = 1;
  216. this.selDateText = `${e.startYear}.${e.startMonth}.${e.startDay}-${e.endYear}.${e.endMonth}.${e.endDay}`;
  217. let dateText = `${e.startYear}/${e.startMonth}/${e.startDay}-${e.endYear}/${e.endMonth}/${e.endDay}`;
  218. this.propsDate = dateText;
  219. this.getOrderList();
  220. this.$refs.uCalendar.init();
  221. },
  222. // 切换分类
  223. onTab(state) {
  224. if (this.stateCurrent !== state) {
  225. this.orderList = [];
  226. this.currentPage = 1;
  227. this.lastPage = 1;
  228. this.stateCurrent = state;
  229. this.getOrderList();
  230. }
  231. },
  232. // 分销订单
  233. getOrderList() {
  234. let that = this;
  235. that.loadStatus = 'loading';
  236. that.$http('commission.orderLog', {
  237. date: that.propsDate,
  238. type: that.stateCurrent,
  239. page: that.currentPage
  240. }).then(res => {
  241. uni.stopPullDownRefresh();
  242. if (res.code === 1) {
  243. that.orderList = [...that.orderList, ...res.data.orders.data];
  244. that.amount = res.data.amount;
  245. that.lastPage = res.data.orders.last_page;
  246. that.isEmpty = !that.orderList.length;
  247. that.loadStatus = that.currentPage < res.data.orders.last_page ? 'loadmore' : 'nomore';
  248. }
  249. });
  250. },
  251. // 加载更多
  252. loadMore() {
  253. if (this.currentPage < this.lastPage) {
  254. this.currentPage += 1;
  255. this.getOrderList();
  256. }
  257. }
  258. }
  259. };
  260. </script>
  261. <style lang="scss">
  262. // 直推
  263. .direct-box {
  264. margin: 20rpx;
  265. .direct-item {
  266. width: 341rpx;
  267. height: 117rpx;
  268. background: #ffffff;
  269. border-radius: 20rpx;
  270. padding: 20rpx;
  271. .item-title {
  272. font-size: 22rpx;
  273. font-weight: 500;
  274. color: #999999;
  275. margin-bottom: 6rpx;
  276. }
  277. .item-value {
  278. font-size: 38rpx;
  279. font-weight: 600;
  280. color: #333333;
  281. }
  282. }
  283. }
  284. // 团队信息总览
  285. .team-data-box {
  286. margin: 20rpx;
  287. .data-card {
  288. width: 340rpx;
  289. background: #ffffff;
  290. border-radius: 20rpx;
  291. padding: 20rpx;
  292. .item-title {
  293. font-size: 22rpx;
  294. font-weight: 500;
  295. color: #999999;
  296. line-height: 30rpx;
  297. margin-bottom: 10rpx;
  298. }
  299. .total-item {
  300. margin-bottom: 20rpx;
  301. }
  302. .total-num {
  303. font-size: 38rpx;
  304. font-weight: 600;
  305. color: #333333;
  306. }
  307. .category-num {
  308. font-size: 26rpx;
  309. font-weight: 600;
  310. color: #333333;
  311. }
  312. }
  313. }
  314. // 状态分类
  315. .head_box {
  316. width: 750rpx;
  317. background: url($IMG_URL+'/imgs/commission/card_bg.png') no-repeat;
  318. }
  319. // 表头
  320. .filter-box {
  321. height: 120rpx;
  322. padding: 0 30rpx;
  323. background-color: #f6f6f6;
  324. .date-btn {
  325. background-color: #fff;
  326. line-height: 54rpx;
  327. border-radius: 27rpx;
  328. padding: 0 20rpx;
  329. font-size: 24rpx;
  330. font-weight: 500;
  331. color: #666666;
  332. }
  333. .total-box {
  334. font-size: 24rpx;
  335. font-weight: 500;
  336. color: #666666;
  337. }
  338. }
  339. .nav-box {
  340. background-color: #fff;
  341. }
  342. .state-item {
  343. height: 100%;
  344. display: flex;
  345. flex-direction: column;
  346. align-items: center;
  347. justify-content: center;
  348. .state-title {
  349. color: #666;
  350. font-weight: 500;
  351. font-size: 28rpx;
  352. line-height: 90rpx;
  353. }
  354. .title-active {
  355. color: #333;
  356. }
  357. .underline {
  358. display: block;
  359. width: 68rpx;
  360. height: 4rpx;
  361. background: #fff;
  362. border-radius: 2rpx;
  363. }
  364. .underline-active {
  365. background: #5e49c3;
  366. display: block;
  367. width: 68rpx;
  368. height: 4rpx;
  369. border-radius: 2rpx;
  370. }
  371. }
  372. // 订单列表
  373. .order-list {
  374. background-color: #fff;
  375. margin-top: 20rpx;
  376. .order-head {
  377. padding: 20rpx;
  378. .order-code {
  379. font-size: 26rpx;
  380. font-weight: 400;
  381. color: #999999;
  382. }
  383. .order-state {
  384. font-size: 26rpx;
  385. font-weight: 500;
  386. color: #05c3a1;
  387. }
  388. }
  389. .order-from {
  390. background-color: #f9f9f9;
  391. padding: 20rpx;
  392. .from-user {
  393. font-size: 24rpx;
  394. font-weight: 400;
  395. color: #666666;
  396. .user-avatar {
  397. width: 26rpx;
  398. height: 26rpx;
  399. border-radius: 50%;
  400. margin-right: 8rpx;
  401. }
  402. .user-name {
  403. font-size: 24rpx;
  404. font-weight: 400;
  405. color: #999999;
  406. }
  407. }
  408. .order-time {
  409. font-size: 24rpx;
  410. font-weight: 400;
  411. color: #999999;
  412. }
  413. }
  414. .goods-card {
  415. padding: 30rpx 20rpx;
  416. // border-bottom: 1rpx solid #dfdfdf;
  417. .goods-img-box {
  418. margin-right: 30rpx;
  419. .goods-img {
  420. width: 160rpx;
  421. height: 160rpx;
  422. background-color: #ccc;
  423. }
  424. }
  425. .goods-info {
  426. height: 160rpx;
  427. width: 600rpx;
  428. align-items: flex-start;
  429. .goods-title {
  430. font-size: 28rpx;
  431. font-weight: 500;
  432. color: #333333;
  433. }
  434. .goods-sku {
  435. font-size: 24rpx;
  436. font-weight: 400;
  437. color: #666666;
  438. }
  439. .goods-price {
  440. font-size: 30rpx;
  441. font-weight: 500;
  442. color: #333333;
  443. .goods-state {
  444. line-height: 30rpx;
  445. padding: 0 10rpx;
  446. background: #f1eeff;
  447. border: 1rpx solid #603fff;
  448. border-radius: 30rpx;
  449. margin-left: 20rpx;
  450. font-size: 20rpx;
  451. color: #5e49c3;
  452. }
  453. &::before {
  454. content: '¥';
  455. font-size: 20rpx;
  456. }
  457. }
  458. .total-box {
  459. height: 80rpx;
  460. width: 100%;
  461. .num-price {
  462. font-size: 24rpx;
  463. font-weight: 400;
  464. color: #999999;
  465. }
  466. .name {
  467. font-size: 24rpx;
  468. font-weight: 400;
  469. color: #999999;
  470. }
  471. .commission-num {
  472. font-size: 30rpx;
  473. font-weight: 400;
  474. color: #eb2b3d;
  475. &::before {
  476. content: '¥';
  477. font-size: 22rpx;
  478. }
  479. }
  480. }
  481. }
  482. }
  483. }
  484. </style>