shopOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. <template>
  2. <view class="shop-order-page">
  3. <uni-nav-bar fixed :statusBar="true" backgroundColor="#fff" :border="false" rightWidth="80" leftWidth="80">
  4. <view class="page-title">省钱订单</view>
  5. <template v-slot:left>
  6. <uni-icons type="back" size="24" color="#333"></uni-icons>
  7. </template>
  8. <template v-slot:right>
  9. <uni-icons @click="handleSearch" type="search" size="24" color="#333"></uni-icons>
  10. </template>
  11. </uni-nav-bar>
  12. <!-- 平台选择tab -->
  13. <me-tabs :value="tabIndex" :tabs="platforms" nameKey="name" :height="88" @change="switchPlatform"
  14. :tab-width="134"></me-tabs>
  15. <!-- 订单状态tab -->
  16. <view class="status-tabs">
  17. <view v-for="(status, index) in statuses" :key="index" class="status-tab"
  18. :class="{ active: activeStatus === status.value }" @click="switchStatus(status.value)">
  19. {{ status.name }}
  20. </view>
  21. </view>
  22. <scroll-view class="order-list" v-if="orderList.length" scroll-y @scrolltolower="loadMore"
  23. lower-threshold="100">
  24. <view style="padding: 0 16px 5px 16px ;">
  25. <view v-for="(order, index) in orderList" :key="index" class="order-item">
  26. <view class="order-header">
  27. <view class="order-platform">
  28. <image :src="typeImg[order.platform]" class="platform-icon" mode="aspectFit" />
  29. <text class="order-time">{{ order.orderTime }}</text>
  30. </view>
  31. <view class="order-status" :class="`status-${order.statusClass}`">{{ statusMapKey[order.status]
  32. }}
  33. </view>
  34. </view>
  35. <view class="order-goods">
  36. <image :src="order.imageUrl" class="goods-image" mode="aspectFill" />
  37. <view class="goods-info">
  38. <text class="goods-title">{{ order.productName }}</text>
  39. <view class="goods-price">
  40. <view class="estimate-earning">
  41. <text class="label ">预估收益</text>
  42. <text class="value">¥{{ order.estimatedCommission }}</text>
  43. </view>
  44. <view class="payment-amount">
  45. <text class="payment-title">付款金额</text>
  46. <text class="value">¥{{ order.orderAmount }}</text>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 订单详情 -->
  52. <view class="order-detail">
  53. <view class="detail-item">
  54. <text class="detail-title">{{ platMapKey[order.platform] }}</text>
  55. </view>
  56. <view class="detail-item">
  57. <text class="label">订单号</text>
  58. <view class="value">
  59. <text>{{ order.platformOrderId }}</text>
  60. <text class="line"> | </text>
  61. <text class="copy-btn" @click="copyOrderId(order.platformOrderId)">复制</text>
  62. </view>
  63. </view>
  64. <view class="detail-item">
  65. <text class="label">确认收货时间</text>
  66. <text class="value">{{ order.receiptTime }}</text>
  67. </view>
  68. <view class="detail-item">
  69. <text class="label">收益结算时间</text>
  70. <text class="value">{{ order.settleTime }}</text>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <template v-if="orderList.length > 20">
  76. <!-- 加载更多提示 -->
  77. <view class="load-more" v-if="isLoading">
  78. <text>加载中...</text>
  79. </view>
  80. <view class="load-more" v-else-if="orderList.length >= total">
  81. <text>没有更多了</text>
  82. </view>
  83. </template>
  84. </scroll-view>
  85. <scs-no-data v-else />
  86. </view>
  87. </template>
  88. <script>
  89. import { getOrderList } from '@/api/makeMoney.js'
  90. export default {
  91. data() {
  92. return {
  93. typeImg: {
  94. jd: '/static/image/points/icon_jd@2x.png',
  95. pdd: '/static/image/points/icon_pdd@2x.png',
  96. douyin: '/static/image/points/icon_tiktok@2x.png',
  97. taobao: '/static/image/points/icon_taobao@2x.png',
  98. },
  99. keyword: '',
  100. platMapKey: {
  101. jd: '京东自营',
  102. pdd: '拼多多自营',
  103. douyin: '抖音商城',
  104. taobao: '淘宝自营',
  105. },
  106. statusMapKey: {
  107. '0': '待结算',
  108. '1': '已结算',
  109. '2': '已失效',
  110. '3': '已收货',
  111. },
  112. orderList: [],
  113. currentPage: 1,
  114. pageSize: 20,
  115. total: 0,
  116. isLoading: false,
  117. // 平台选择
  118. platforms: [
  119. { name: '全平台', value: '' },
  120. { name: '京东', value: 'jd' },
  121. { name: '拼多多', value: 'pdd' },
  122. { name: '抖音商城', value: 'douyin' },
  123. { name: '淘宝', value: 'taobao' }
  124. ],
  125. tabIndex: 0,
  126. // 订单状态
  127. statuses: [
  128. { name: '全部', value: '' },
  129. { name: '待结算', value: '0' },
  130. { name: '已结算', value: '1' },
  131. { name: '已失效', value: '2' },
  132. { name: '已收货', value: '3' },
  133. ],
  134. activeStatus: '',
  135. }
  136. },
  137. onLoad() {
  138. this.getOrderList()
  139. },
  140. methods: {
  141. loadMore() {
  142. console.log("more")
  143. if (this.isLoading) return
  144. if (this.orderList.length >= this.total) {
  145. return
  146. }
  147. this.currentPage++
  148. this.getOrderList()
  149. },
  150. async getOrderList() {
  151. this.isLoading = true
  152. uni.showLoading({ mask: true })
  153. const params = {
  154. platformOrderId: '',
  155. status: this.activeStatus,
  156. platform: this.platforms[this.tabIndex].value,
  157. page: this.currentPage,
  158. pageSize: this.pageSize,
  159. }
  160. const { code, data } = await getOrderList(params)
  161. setTimeout(() => {
  162. this.isLoading = false
  163. uni.hideLoading()
  164. }, 100)
  165. if (code == 200) {
  166. if (this.currentPage == 1) {
  167. this.orderList = data.list || []
  168. } else {
  169. this.orderList = this.orderList.concat(data.list || [])
  170. }
  171. this.total = data.total || 0
  172. }
  173. },
  174. // 返回上一页
  175. goBack() {
  176. uni.navigateBack()
  177. },
  178. handleSearch() {
  179. uni.navigateTo({
  180. url: '/pages/points/shopSearch'
  181. })
  182. },
  183. // 切换平台
  184. switchPlatform(platform) {
  185. this.tabIndex = platform
  186. this.currentPage = 1
  187. this.getOrderList()
  188. },
  189. // 切换订单状态
  190. switchStatus(status) {
  191. this.activeStatus = status
  192. this.currentPage = 1
  193. this.getOrderList()
  194. },
  195. // 复制订单号
  196. copyOrderId(orderId) {
  197. uni.setClipboardData({
  198. data: orderId,
  199. success: function () {
  200. uni.showToast({
  201. title: '复制成功',
  202. icon: 'success'
  203. })
  204. }
  205. })
  206. }
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. /* 页面容器 */
  212. .shop-order-page {
  213. background-color: #f5f5f5;
  214. height: 100%;
  215. width: 100%;
  216. display: flex;
  217. flex-direction: column;
  218. .page-title {
  219. line-height: 44px;
  220. text-align: center;
  221. width: 100%;
  222. font-family: PingFang SC, PingFang SC;
  223. font-weight: 600;
  224. font-size: 18px;
  225. color: #222222;
  226. }
  227. }
  228. ::v-deep .tabs-container {
  229. display: flex !important;
  230. align-items: center !important;
  231. justify-content: space-between !important;
  232. }
  233. .back-btn {
  234. width: 24px;
  235. height: 24px;
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. }
  240. .title {
  241. font-size: 16px;
  242. font-weight: 500;
  243. color: #333333;
  244. }
  245. .search-btn {
  246. width: 24px;
  247. height: 24px;
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. }
  252. /* 订单状态tab */
  253. .status-tabs {
  254. display: flex;
  255. justify-content: space-between;
  256. align-items: center;
  257. background-color: #ffffff;
  258. padding: 0 12px;
  259. border-bottom: 1px solid #eeeeee;
  260. white-space: nowrap;
  261. padding-top: 12rpx;
  262. }
  263. .status-tab {
  264. padding: 0 12px;
  265. height: 56rpx;
  266. background-color: #F7F8FA;
  267. line-height: 56rpx;
  268. border-radius: 28rpx;
  269. font-size: 14px;
  270. color: #666666;
  271. position: relative;
  272. font-weight: 400;
  273. margin: 12rpx 0;
  274. }
  275. .status-tab.active {
  276. border: 1px solid #FF5C03;
  277. font-weight: 500;
  278. color: #FF5C03;
  279. }
  280. .load-more {
  281. font-size: 14px;
  282. color: #999999;
  283. text-align: center;
  284. padding: 6px 0px;
  285. }
  286. /* 订单列表 */
  287. .order-list {
  288. flex: 1;
  289. overflow: auto;
  290. height: calc(100vh - 200px);
  291. }
  292. /* 订单项 */
  293. .order-item {
  294. background-color: #ffffff;
  295. border-radius: 8px;
  296. margin-top: 12px;
  297. overflow: hidden;
  298. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  299. &:last-child {
  300. margin-bottom: 20rpx;
  301. }
  302. }
  303. /* 订单头部 */
  304. .order-header {
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. padding: 12px 16px;
  309. position: relative;
  310. &::before {
  311. content: '';
  312. position: absolute;
  313. bottom: 0;
  314. left: 12px;
  315. right: 12px;
  316. width: calc(100% - 24px);
  317. height: 0.5px;
  318. background-color: #ECECEC;
  319. }
  320. }
  321. .order-platform {
  322. display: flex;
  323. align-items: center;
  324. }
  325. .platform-icon {
  326. width: 20px;
  327. height: 20px;
  328. margin-right: 8px;
  329. }
  330. .order-time {
  331. font-size: 12px;
  332. color: #999999;
  333. }
  334. .order-status {
  335. font-size: 12px;
  336. font-weight: 500;
  337. color: #999999;
  338. }
  339. .status-1 {
  340. color: #52c41a;
  341. }
  342. .status-3 {
  343. color: #52c41a;
  344. }
  345. /* 商品信息 */
  346. .order-goods {
  347. display: flex;
  348. padding: 12px 16px;
  349. position: relative;
  350. &::before {
  351. content: '';
  352. position: absolute;
  353. bottom: 0;
  354. left: 12px;
  355. right: 12px;
  356. width: calc(100% - 24px);
  357. height: 0.5px;
  358. background-color: #ECECEC;
  359. }
  360. }
  361. .goods-image {
  362. width: 80px;
  363. height: 80px;
  364. border-radius: 4px;
  365. margin-right: 12px;
  366. background-color: #f5f5f5;
  367. }
  368. .goods-info {
  369. flex: 1;
  370. display: flex;
  371. flex-direction: column;
  372. justify-content: space-between;
  373. }
  374. .goods-title {
  375. font-weight: 500;
  376. font-size: 14px;
  377. color: #222222;
  378. line-height: 20px;
  379. margin-bottom: 8px;
  380. overflow: hidden;
  381. text-overflow: ellipsis;
  382. display: -webkit-box;
  383. -webkit-line-clamp: 2;
  384. -webkit-box-orient: vertical;
  385. }
  386. .goods-price {
  387. display: flex;
  388. justify-content: space-between;
  389. align-items: center;
  390. }
  391. .estimate-earning {
  392. color: #FF5C03;
  393. font-weight: 400;
  394. font-size: 12px;
  395. .label {
  396. margin-right: 6px;
  397. }
  398. }
  399. .payment-amount {
  400. display: flex;
  401. align-items: center;
  402. .payment-title {
  403. font-weight: 400;
  404. font-size: 12px;
  405. color: #222222;
  406. margin-right: 6px;
  407. }
  408. }
  409. .payment-amount .label {
  410. font-weight: 400;
  411. font-size: 12px;
  412. color: #666666;
  413. }
  414. .estimate-earning .value {
  415. font-size: 14px;
  416. color: #FF5C03;
  417. font-weight: 500;
  418. }
  419. .payment-amount .value {
  420. font-size: 14px;
  421. color: #333333;
  422. font-weight: 500;
  423. }
  424. /* 订单详情 */
  425. .order-detail {
  426. padding: 12px 16px;
  427. }
  428. .detail-item {
  429. display: flex;
  430. justify-content: space-between;
  431. align-items: center;
  432. margin-bottom: 8px;
  433. font-size: 12px;
  434. .detail-title {
  435. color: #FF5C03;
  436. }
  437. .line {
  438. margin: 0 6px;
  439. color: #E9E9E9;
  440. }
  441. }
  442. .detail-item:last-child {
  443. margin-bottom: 0;
  444. }
  445. .detail-item .label {
  446. color: #444444;
  447. }
  448. .detail-item .value {
  449. color: #666666;
  450. display: flex;
  451. align-items: center;
  452. }
  453. .copy-btn {
  454. color: #222222;
  455. }
  456. </style>