shopSearch.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. <template>
  2. <view class="search-container">
  3. <uni-nav-bar fixed :statusBar="true" backgroundColor="#fff" :border="false" rightWidth="0" leftWidth="0">
  4. <view class="page-search">
  5. <view class="scs-headr-search">
  6. <view class="search-input" style="background-color: #F5F6FA;">
  7. <uni-icons @click="handleSearch" type="search" size="24" color="#999999"></uni-icons>
  8. <input class="input-value" type="text" v-model="keyword" placeholder="输入关键字搜索"
  9. confirm-type="search" @confirm="handleSearch" />
  10. </view>
  11. <text class="search-cancel" v-if="keyword.trim().length" @tap="keyword = ''; handleSearch()">取消</text>
  12. </view>
  13. </view>
  14. </uni-nav-bar>
  15. <scroll-view v-if="orderList.length" class="order-list" scroll-y @scrolltolower="loadMore" lower-threshold="100">
  16. <view style="padding: 0 16px 5px 16px ;">
  17. <view v-for="(order, index) in orderList" :key="index" class="order-item">
  18. <view class="order-header">
  19. <view class="order-platform">
  20. <image :src="typeImg[order.platform]" class="platform-icon" mode="aspectFit" />
  21. <text class="order-time">{{ order.orderTime }}</text>
  22. </view>
  23. <view class="order-status" :class="`status-${order.statusClass}`">{{ statusMapKey[order.status] }}</view>
  24. </view>
  25. <view class="order-goods">
  26. <image :src="order.imageUrl" class="goods-image" mode="aspectFill" />
  27. <view class="goods-info">
  28. <text class="goods-title">{{ order.productName }}</text>
  29. <view class="goods-price">
  30. <view class="estimate-earning">
  31. <text class="label ">预估收益</text>
  32. <text class="value">{{ order.estimatedCommission }}</text>
  33. </view>
  34. <view class="payment-amount">
  35. <text class="payment-title">付款金额</text>
  36. <text class="value">{{ order.orderAmount }}</text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 订单详情 -->
  42. <view class="order-detail">
  43. <view class="detail-item">
  44. <text class="detail-title">{{ platMapKey[order.platform] }}</text>
  45. </view>
  46. <view class="detail-item">
  47. <text class="label">订单号</text>
  48. <view class="value">
  49. <text>{{ order.platformOrderId }}</text>
  50. <text class="copy-btn" @click="copyOrderId(order.platformOrderId)">复制</text>
  51. </view>
  52. </view>
  53. <view class="detail-item">
  54. <text class="label">确认收货时间</text>
  55. <text class="value">{{ order.receiptTime }}</text>
  56. </view>
  57. <view class="detail-item">
  58. <text class="label">收益结算时间</text>
  59. <text class="value">{{ order.settleTime }}</text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <template v-if="orderList.length > 20">
  65. <!-- 加载更多提示 -->
  66. <view class="load-more" v-if="isLoading">
  67. <text>加载中...</text>
  68. </view>
  69. <view class="load-more" v-else-if="orderList.length >= total">
  70. <text>没有更多了</text>
  71. </view>
  72. </template>
  73. </scroll-view>
  74. <u-empty mode="data" style="padding-top: 350rpx;" v-else></u-empty>
  75. </view>
  76. </template>
  77. <script>
  78. import { getOrderList } from '@/api/makeMoney.js'
  79. export default {
  80. data() {
  81. return {
  82. typeImg: {
  83. jd: '/static/image/points/icon_jd@2x.png',
  84. pdd: '/static/image/points/icon_pdd@2x.png',
  85. douyin: '/static/image/points/icon_tiktok@2x.png',
  86. taobao: '/static/image/points/icon_taobao@2x.png',
  87. },
  88. keyword: '',
  89. platMapKey: {
  90. jd: '京东自营',
  91. pdd: '拼多多自营',
  92. douyin: '抖音商城',
  93. taobao: '淘宝自营',
  94. },
  95. statusMapKey: {
  96. '0': '待结算',
  97. '1': '已结算',
  98. '2': '已失效',
  99. '3': '已收货',
  100. },
  101. orderList: [],
  102. currentPage: 1,
  103. pageSize: 20,
  104. total: 0,
  105. isLoading: false,
  106. }
  107. },
  108. methods: {
  109. handleSearch() {
  110. this.currentPage = 1
  111. this.getOrderList()
  112. },
  113. // 复制订单号
  114. copyOrderId(orderId) {
  115. uni.setClipboardData({
  116. data: orderId,
  117. success: function () {
  118. uni.showToast({
  119. title: '复制成功',
  120. icon: 'success'
  121. })
  122. }
  123. })
  124. },
  125. async getOrderList() {
  126. this.isLoading = true
  127. uni.showLoading({ mask: true })
  128. const params = {
  129. platformOrderId: this.keyword.trim(),
  130. status: '',
  131. platform: '',
  132. page: this.currentPage,
  133. pageSize: this.pageSize,
  134. }
  135. const { code, data } = await getOrderList(params)
  136. setTimeout(() => {
  137. this.isLoading = false
  138. uni.hideLoading()
  139. }, 100)
  140. if (code == 200) {
  141. if (this.currentPage == 1) {
  142. this.orderList = data.list || []
  143. } else {
  144. this.orderList = this.orderList.concat(data.list || [])
  145. }
  146. this.total = data.total || 0
  147. }
  148. },
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .search-container {
  154. width: 100%;
  155. height: 100%;
  156. background-color: #F7F8FA;
  157. display: flex;
  158. flex-direction: column;
  159. }
  160. .page-search {
  161. display: flex;
  162. flex-direction: column;
  163. align-items: center;
  164. justify-content: center;
  165. width: 100%;
  166. }
  167. .search-cancel {
  168. font-size: 28rpx;
  169. font-weight: 400;
  170. color: #323233;
  171. }
  172. // 搜索栏
  173. .scs-headr-search {
  174. height: 72rpx;
  175. width: 100%;
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. font-size: 32rpx;
  180. color: $uni-text-color;
  181. background-color: transparent;
  182. gap: 0 28rpx;
  183. box-sizing: border-box;
  184. .search_title {
  185. width: 176rpx;
  186. height: 44rpx;
  187. }
  188. .search-input {
  189. flex: 1;
  190. height: 72rpx;
  191. background: #ffffff;
  192. border-radius: 36rpx;
  193. display: flex;
  194. align-items: center;
  195. padding: 0 8rpx 0 24rpx;
  196. color: #999999;
  197. box-sizing: border-box;
  198. .icon-search {
  199. width: 28rpx;
  200. height: 28rpx;
  201. margin-right: 20rpx;
  202. margin-top: 4rpx;
  203. }
  204. .input-value {
  205. height: 60rpx;
  206. line-height: 60rpx;
  207. flex: 1;
  208. }
  209. }
  210. }
  211. /* 订单列表 */
  212. .order-list {
  213. flex: 1;
  214. overflow: auto;
  215. height: calc(100vh - 200px);
  216. }
  217. /* 订单项 */
  218. .order-item {
  219. background-color: #ffffff;
  220. border-radius: 8px;
  221. margin-top: 12px;
  222. overflow: hidden;
  223. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  224. &:last-child {
  225. margin-bottom: 20rpx;
  226. }
  227. }
  228. /* 订单头部 */
  229. .order-header {
  230. display: flex;
  231. justify-content: space-between;
  232. align-items: center;
  233. padding: 12px 16px;
  234. border-bottom: 1px solid #f0f0f0;
  235. }
  236. .order-platform {
  237. display: flex;
  238. align-items: center;
  239. }
  240. .platform-icon {
  241. width: 20px;
  242. height: 20px;
  243. margin-right: 8px;
  244. }
  245. .order-time {
  246. font-size: 12px;
  247. color: #999999;
  248. }
  249. .order-status {
  250. font-size: 12px;
  251. font-weight: 500;
  252. color: #999999;
  253. }
  254. .status-1 {
  255. color: #52c41a;
  256. }
  257. .status-3 {
  258. color: #52c41a;
  259. }
  260. /* 商品信息 */
  261. .order-goods {
  262. display: flex;
  263. padding: 12px 16px;
  264. border-bottom: 1px solid #f0f0f0;
  265. }
  266. .goods-image {
  267. width: 80px;
  268. height: 80px;
  269. border-radius: 4px;
  270. margin-right: 12px;
  271. background-color: #f5f5f5;
  272. }
  273. .goods-info {
  274. flex: 1;
  275. display: flex;
  276. flex-direction: column;
  277. justify-content: space-between;
  278. }
  279. .goods-title {
  280. font-weight: 500;
  281. font-size: 14px;
  282. color: #222222;
  283. line-height: 20px;
  284. margin-bottom: 8px;
  285. overflow: hidden;
  286. text-overflow: ellipsis;
  287. display: -webkit-box;
  288. -webkit-line-clamp: 2;
  289. -webkit-box-orient: vertical;
  290. }
  291. .goods-price {
  292. display: flex;
  293. justify-content: space-between;
  294. align-items: center;
  295. }
  296. .estimate-earning {
  297. color: #FF5C03;
  298. font-weight: 400;
  299. font-size: 12px;
  300. }
  301. .payment-amount {
  302. display: flex;
  303. align-items: center;
  304. .payment-title {
  305. font-weight: 400;
  306. font-size: 12px;
  307. color: #222222;
  308. }
  309. }
  310. .payment-amount .label {
  311. font-weight: 400;
  312. font-size: 12px;
  313. color: #666666;
  314. }
  315. .estimate-earning .value {
  316. font-size: 14px;
  317. color: #FF5C03;
  318. font-weight: 500;
  319. }
  320. .payment-amount .value {
  321. font-size: 14px;
  322. color: #333333;
  323. font-weight: 500;
  324. }
  325. /* 订单详情 */
  326. .order-detail {
  327. padding: 12px 16px;
  328. }
  329. .detail-item {
  330. display: flex;
  331. justify-content: space-between;
  332. align-items: center;
  333. margin-bottom: 8px;
  334. font-size: 12px;
  335. .detail-title {
  336. color: #FF5C03;
  337. }
  338. }
  339. .detail-item:last-child {
  340. margin-bottom: 0;
  341. }
  342. .detail-item .label {
  343. color: #444444;
  344. }
  345. .detail-item .value {
  346. color: #666666;
  347. display: flex;
  348. align-items: center;
  349. }
  350. .copy-btn {
  351. color: #222222;
  352. margin-left: 8px;
  353. }
  354. </style>