order.vue 7.8 KB

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