order.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <!-- 分销 - 订单明细 -->
  2. <template>
  3. <s-layout title="分销订单" :class="state.scrollTop ? 'order-warp' : ''" navbar="inner">
  4. <view
  5. class="header-box"
  6. :style="[
  7. {
  8. marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
  9. paddingTop: Number(statusBarHeight + 108) + 'rpx',
  10. },
  11. ]"
  12. >
  13. <!-- 团队数据总览 -->
  14. <view class="team-data-box ss-flex ss-col-center ss-row-between" style="width: 100%">
  15. <view class="data-card" style="width: 100%">
  16. <view class="total-item" style="width: 100%">
  17. <view class="item-title" style="text-align: center">累计推广订单(单)</view>
  18. <view class="total-num" style="text-align: center">
  19. {{ state.totals }}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- tab -->
  26. <su-sticky bgColor="#fff">
  27. <su-tabs
  28. :list="tabMaps"
  29. :scrollable="false"
  30. :current="state.currentTab"
  31. @change="onTabsChange"
  32. >
  33. </su-tabs>
  34. </su-sticky>
  35. <!-- 订单 -->
  36. <view class="order-box">
  37. <view class="order-item" v-for="item in state.pagination.list" :key="item">
  38. <view class="order-header">
  39. <view class="no-box ss-flex ss-col-center ss-row-between">
  40. <text class="order-code">订单编号:{{ item.bizId }}</text>
  41. <text class="order-state">
  42. {{ item.status === 0 ? '待结算' : item.status === 1 ? '已结算' : '已取消' }}
  43. ( 佣金 {{ fen2yuan(item.price) }} 元 )
  44. </text>
  45. </view>
  46. <view class="order-from ss-flex ss-col-center ss-row-between">
  47. <view class="from-user ss-flex ss-col-center">
  48. <text>{{ item.title }}</text>
  49. </view>
  50. <view class="order-time">
  51. {{ sheep.$helper.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 数据为空 -->
  57. <s-empty v-if="state.pagination.total === 0" icon="/static/order-empty.png" text="暂无订单" />
  58. <!-- 加载更多 -->
  59. <uni-load-more
  60. v-if="state.pagination.total > 0"
  61. :status="state.loadStatus"
  62. :content-text="{
  63. contentdown: '上拉加载更多',
  64. }"
  65. @tap="loadMore"
  66. />
  67. </view>
  68. </s-layout>
  69. </template>
  70. <script setup>
  71. import sheep from '@/sheep';
  72. import { onLoad, onReachBottom } from '@dcloudio/uni-app';
  73. import { reactive } from 'vue';
  74. import _ from 'lodash-es';
  75. import { onPageScroll } from '@dcloudio/uni-app';
  76. import { resetPagination } from '@/sheep/util';
  77. import BrokerageApi from '@/sheep/api/trade/brokerage';
  78. import { fen2yuan } from '../../sheep/hooks/useGoods';
  79. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  80. const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
  81. onPageScroll((e) => {
  82. state.scrollTop = e.scrollTop <= 100;
  83. });
  84. const state = reactive({
  85. totals: 0, // 累计推广订单(单)
  86. scrollTop: false,
  87. currentTab: 0,
  88. loadStatus: '',
  89. pagination: {
  90. list: [],
  91. total: 0,
  92. pageNo: 1,
  93. pageSize: 8,
  94. },
  95. });
  96. const tabMaps = [
  97. {
  98. name: '全部',
  99. value: 'all',
  100. },
  101. {
  102. name: '待结算',
  103. value: '0', // 待结算
  104. },
  105. {
  106. name: '已结算',
  107. value: '1', // 已结算
  108. },
  109. ];
  110. // 切换选项卡
  111. function onTabsChange(e) {
  112. resetPagination(state.pagination);
  113. state.currentTab = e.index;
  114. getOrderList();
  115. }
  116. // 获取订单列表
  117. async function getOrderList() {
  118. state.loadStatus = 'loading';
  119. let { code, data } = await BrokerageApi.getBrokerageRecordPage({
  120. pageSize: state.pagination.pageSize,
  121. pageNo: state.pagination.pageNo,
  122. bizType: 1, // 获得推广佣金
  123. status: state.currentTab > 0 ? state.currentTab : undefined,
  124. });
  125. if (code !== 0) {
  126. return;
  127. }
  128. state.pagination.list = _.concat(state.pagination.list, data.list);
  129. state.pagination.total = data.total;
  130. state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
  131. if (state.currentTab === 0) {
  132. state.totals = data.total;
  133. }
  134. }
  135. onLoad(() => {
  136. getOrderList();
  137. });
  138. // 加载更多
  139. function loadMore() {
  140. if (state.loadStatus === 'noMore') {
  141. return;
  142. }
  143. state.pagination.pageNo++;
  144. getOrderList();
  145. }
  146. // 上拉加载更多
  147. onReachBottom(() => {
  148. loadMore();
  149. });
  150. </script>
  151. <style lang="scss" scoped>
  152. .header-box {
  153. box-sizing: border-box;
  154. padding: 0 20rpx 20rpx 20rpx;
  155. width: 750rpx;
  156. background: v-bind(headerBg) no-repeat,
  157. linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  158. background-size: 750rpx 100%;
  159. // 团队信息总览
  160. .team-data-box {
  161. .data-card {
  162. width: 305rpx;
  163. background: #ffffff;
  164. border-radius: 20rpx;
  165. padding: 20rpx;
  166. .total-item {
  167. margin-bottom: 30rpx;
  168. .item-title {
  169. font-size: 24rpx;
  170. font-weight: 500;
  171. color: #999999;
  172. line-height: normal;
  173. margin-bottom: 20rpx;
  174. }
  175. .total-num {
  176. font-size: 38rpx;
  177. font-weight: 500;
  178. color: #333333;
  179. font-family: OPPOSANS;
  180. }
  181. }
  182. .category-num {
  183. font-size: 26rpx;
  184. font-weight: 500;
  185. color: #333333;
  186. font-family: OPPOSANS;
  187. }
  188. }
  189. }
  190. // 直推
  191. .direct-box {
  192. margin-top: 20rpx;
  193. .direct-item {
  194. width: 340rpx;
  195. background: #ffffff;
  196. border-radius: 20rpx;
  197. padding: 20rpx;
  198. box-sizing: border-box;
  199. .item-title {
  200. font-size: 22rpx;
  201. font-weight: 500;
  202. color: #999999;
  203. margin-bottom: 6rpx;
  204. }
  205. .item-value {
  206. font-size: 38rpx;
  207. font-weight: 500;
  208. color: #333333;
  209. font-family: OPPOSANS;
  210. }
  211. }
  212. }
  213. }
  214. // 订单
  215. .order-box {
  216. .order-item {
  217. background: #ffffff;
  218. border-radius: 10rpx;
  219. margin: 20rpx;
  220. .order-footer {
  221. padding: 20rpx;
  222. font-size: 24rpx;
  223. color: #999;
  224. }
  225. .order-header {
  226. .no-box {
  227. padding: 20rpx;
  228. .order-code {
  229. font-size: 26rpx;
  230. font-weight: 500;
  231. color: #333333;
  232. }
  233. .order-state {
  234. font-size: 26rpx;
  235. font-weight: 500;
  236. color: var(--ui-BG-Main);
  237. }
  238. }
  239. .order-from {
  240. padding: 20rpx;
  241. .from-user {
  242. font-size: 24rpx;
  243. font-weight: 400;
  244. color: #666666;
  245. .user-avatar {
  246. width: 26rpx;
  247. height: 26rpx;
  248. border-radius: 50%;
  249. margin-right: 8rpx;
  250. }
  251. .user-name {
  252. font-size: 24rpx;
  253. font-weight: 400;
  254. color: #999999;
  255. }
  256. }
  257. .order-time {
  258. font-size: 24rpx;
  259. font-weight: 400;
  260. color: #999999;
  261. }
  262. }
  263. }
  264. .commission-box {
  265. .name {
  266. font-size: 24rpx;
  267. font-weight: 400;
  268. color: #999999;
  269. }
  270. }
  271. .commission-num {
  272. font-size: 30rpx;
  273. font-weight: 500;
  274. color: $red;
  275. font-family: OPPOSANS;
  276. &::before {
  277. content: '¥';
  278. font-size: 22rpx;
  279. }
  280. }
  281. .order-status {
  282. line-height: 30rpx;
  283. padding: 0 10rpx;
  284. border-radius: 30rpx;
  285. margin-left: 20rpx;
  286. font-size: 24rpx;
  287. color: var(--ui-BG-Main);
  288. }
  289. }
  290. }
  291. </style>