order-detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <view class="order-detail-page">
  3. <!-- 顶部状态栏 -->
  4. <view class="status-header">
  5. <view class="status-text" v-if="orderInfo.cancelStatus == 1">已取消</view>
  6. <view class="status-text" v-else-if="orderInfo.refundStatus == 3">交易关闭</view>
  7. <view class="status-text" v-else-if="orderInfo.refundStatus == 2">退款中</view>
  8. <view class="status-text" v-else>{{ statusText }}</view>
  9. <view class="status-desc" v-if="orderInfo.status == '2'">
  10. 订单编号:{{ orderInfo.orderId }}
  11. <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
  12. </view>
  13. <view class="status-desc" v-else-if="orderInfo.status == '3'">
  14. 订单编号:{{ orderInfo.orderId }}
  15. <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
  16. </view>
  17. <view class="status-desc-block" v-else-if="orderInfo.status == '8'">
  18. <view class="status-tip">还剩9天22时18分自动确认收货</view>
  19. <view class="status-desc-row">
  20. 订单编号:{{ orderInfo.orderId }}
  21. <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
  22. </view>
  23. </view>
  24. <view class="status-desc" v-else>
  25. 订单编号:{{ orderInfo.orderId }}
  26. <u-icon name="copy" size="28" @click="copyOrderNo" style="margin-left: 10rpx;"></u-icon>
  27. </view>
  28. </view>
  29. <!-- 地址信息 -->
  30. <view class="info-card address-card">
  31. <view class="icon-box">
  32. <u-icon name="map-fill" color="#ff0000" size="40"></u-icon>
  33. </view>
  34. <view class="address-content">
  35. <view class="user-info">
  36. <text class="name">{{ orderInfo.receiverName }}</text>
  37. <text class="mobile">{{ orderInfo.receiverMobile }}</text>
  38. </view>
  39. <view class="address-detail">{{ orderInfo.receiverAddress }}</view>
  40. </view>
  41. <u-icon name="arrow-right" color="#999" size="28"></u-icon>
  42. </view>
  43. <!-- 物流信息 (已发货/已完成/退款) -->
  44. <view class="info-card logistics-card"
  45. v-if="['8', '12', '10'].includes(String(orderInfo.status)) && orderInfo.waybillCode">
  46. <view class="icon-box">
  47. <u-icon name="car-fill" color="#38C148" size="40"></u-icon>
  48. </view>
  49. <view class="logistics-content" @click="viewLogistics">
  50. <view class="company-name">物流单号: {{ orderInfo.waybillCode }}</view>
  51. <view class="latest-trace">点击查看物流详情</view>
  52. </view>
  53. <u-icon name="arrow-right" color="#999" size="28"></u-icon>
  54. </view>
  55. <!-- 商品列表 -->
  56. <view class="info-card goods-card">
  57. <view class="goods-item" v-for="(goods, index) in orderInfo.detailVoList" :key="index">
  58. <image :src="goods.cover" mode="aspectFill" class="goods-cover"></image>
  59. <view class="goods-info">
  60. <view class="goods-title">{{ goods.bookName }}</view>
  61. <view class="goods-quality" v-if="goods.isbn">ISBN:{{ goods.isbn }}</view>
  62. <view class="price-box">
  63. <text class="price">¥{{ goods.price }}</text>
  64. <text class="num">x{{ goods.num }}</text>
  65. </view>
  66. </view>
  67. <!-- 商品级按钮,如退款 -->
  68. <view class="goods-action" v-if="['3', '8'].includes(String(orderInfo.status))">
  69. <u-button size="mini" shape="circle" plain
  70. custom-style="margin-left: 20rpx; height: 50rpx; line-height: 50rpx;">退款</u-button>
  71. </view>
  72. <view class="goods-action" v-if="['10'].includes(String(orderInfo.status))">
  73. <u-button size="mini" shape="circle" plain disabled
  74. custom-style="margin-left: 20rpx; height: 50rpx; line-height: 50rpx; background: #f5f5f5; color: #999; border: none;">退款成功</u-button>
  75. </view>
  76. </view>
  77. <!-- 价格明细 -->
  78. <view class="price-detail">
  79. <view class="row">
  80. <text>邮费</text>
  81. <text>¥ {{ orderInfo.expressMoney || '0.00' }}</text>
  82. </view>
  83. <view class="row">
  84. <text>商品金额</text>
  85. <text class="goods-total">¥{{ orderInfo.totalMoney }}</text>
  86. </view>
  87. <view class="row">
  88. <text>优惠金额</text>
  89. <text class="discount">-¥{{ orderInfo.discountMoney || '0.00' }}</text>
  90. </view>
  91. <view class="real-pay-row">
  92. <text>实付款 ({{ orderInfo.payType == 1 ? '余额支付' : '微信支付' }})</text>
  93. <text class="real-price">¥ {{ orderInfo.payMoney }}</text>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 订单时间信息 -->
  98. <view class="info-card time-card">
  99. <view class="row">
  100. <text class="label">下单时间</text>
  101. <text class="value">{{ orderInfo.createTime }}</text>
  102. </view>
  103. <view class="row" v-if="orderInfo.payTime">
  104. <text class="label">付款时间</text>
  105. <text class="value">{{ orderInfo.payTime }}</text>
  106. </view>
  107. <view class="row" v-if="orderInfo.deliveryTime">
  108. <text class="label">发货时间</text>
  109. <text class="value">{{ orderInfo.deliveryTime }}</text>
  110. </view>
  111. <view class="row" v-if="orderInfo.finishTime">
  112. <text class="label">完成时间</text>
  113. <text class="value">{{ orderInfo.finishTime }}</text>
  114. </view>
  115. </view>
  116. <!-- 底部操作栏 -->
  117. <view class="bottom-bar">
  118. <!-- 待付款 -->
  119. <template v-if="orderInfo.status == '2'">
  120. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  121. @click="handleAction('addToCart')">加入购物车</u-button>
  122. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  123. @click="handleAction('cancel')">取消订单</u-button>
  124. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  125. @click="handleAction('address')">修改地址</u-button>
  126. <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
  127. @click="handleAction('pay')">继续付款</u-button>
  128. </template>
  129. <!-- 待发货 -->
  130. <template v-else-if="orderInfo.status == '3'">
  131. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  132. @click="handleAction('addToCart')">加入购物</u-button>
  133. <u-button size="mini" shape="circle" type="warning" :custom-style="btnStyle"
  134. @click="handleAction('overtime')">超时发货</u-button>
  135. <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
  136. @click="handleAction('remind')">催发货</u-button>
  137. </template>
  138. <!-- 已发货 -->
  139. <template v-else-if="orderInfo.status == '8'">
  140. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  141. @click="handleAction('addToCart')">加入购物</u-button>
  142. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  143. @click="handleAction('complaint')">投诉</u-button>
  144. <u-button size="mini" shape="circle" type="primary" :custom-style="themeLightBtnStyle"
  145. @click="handleAction('priceMatch')">降价补差</u-button>
  146. <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
  147. @click="handleAction('confirm')">确认收货</u-button>
  148. </template>
  149. <!-- 交易关闭/已退款 -->
  150. <template v-else-if="orderInfo.status == '-1' || orderInfo.status == '10'">
  151. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  152. @click="handleAction('addToCart')">加入购物</u-button>
  153. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  154. @click="handleAction('complaint')">投诉</u-button>
  155. <u-button size="mini" shape="circle" :custom-style="themeBtnStyle"
  156. @click="handleAction('moneyWhere')">钱款去向</u-button>
  157. </template>
  158. <!-- 交易完成 -->
  159. <template v-else-if="orderInfo.status == '12'">
  160. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  161. @click="handleAction('addToCart')">加入购物</u-button>
  162. <u-button size="mini" shape="circle" plain :custom-style="btnStyle"
  163. @click="handleAction('complaint')">投诉</u-button>
  164. </template>
  165. </view>
  166. <!-- 占位符,防止底部按钮遮挡内容 -->
  167. <view style="height: 120rpx;"></view>
  168. </view>
  169. </template>
  170. <script>
  171. export default {
  172. data() {
  173. return {
  174. orderInfo: {
  175. status: '2',
  176. orderId: '',
  177. detailVoList: [],
  178. receiverName: '',
  179. receiverMobile: '',
  180. receiverAddress: '',
  181. expressMoney: 0,
  182. totalMoney: 0,
  183. discountMoney: 0,
  184. payMoney: 0,
  185. createTime: ''
  186. },
  187. btnStyle: {
  188. marginLeft: '20rpx',
  189. width: '160rpx',
  190. height: '60rpx',
  191. lineHeight: '60rpx',
  192. padding: '0'
  193. },
  194. themeBtnStyle: {
  195. marginLeft: '20rpx',
  196. width: '160rpx',
  197. height: '60rpx',
  198. lineHeight: '60rpx',
  199. padding: '0',
  200. backgroundColor: '#38C148',
  201. color: '#fff',
  202. border: 'none'
  203. },
  204. themeLightBtnStyle: {
  205. marginLeft: '20rpx',
  206. width: '160rpx',
  207. height: '60rpx',
  208. lineHeight: '60rpx',
  209. padding: '0',
  210. backgroundColor: '#5bc0de',
  211. color: '#fff',
  212. border: 'none'
  213. }
  214. };
  215. },
  216. computed: {
  217. statusText() {
  218. const map = {
  219. '1': '等待买家付款',
  220. '2': '等待卖家发货',
  221. '3': '已发货',
  222. '4': '交易完成',
  223. };
  224. return map[String(this.orderInfo.status)] || '未知状态';
  225. }
  226. },
  227. onLoad(options) {
  228. if (options.orderId) {
  229. this.loadOrderDetail(options.orderId);
  230. }
  231. },
  232. methods: {
  233. loadOrderDetail(orderId) {
  234. uni.$u.http.get('/token/shop/order/getOrderDetail', {
  235. orderId: orderId
  236. }).then((res) => {
  237. if (res.code === 200) {
  238. this.orderInfo = res.data;
  239. }
  240. });
  241. },
  242. copyOrderNo() {
  243. uni.setClipboardData({
  244. data: String(this.orderInfo.orderId),
  245. success: () => {
  246. uni.showToast({ title: '复制成功', icon: 'none' });
  247. }
  248. });
  249. },
  250. viewLogistics() {
  251. uni.navigateTo({
  252. url: `/pages-car/pages/logistics-detail?orderId=${this.orderInfo.orderId}`
  253. });
  254. },
  255. handleAction(type) {
  256. if (type === 'complaint') {
  257. uni.setStorageSync('tempComplaintOrder', this.orderInfo);
  258. uni.navigateTo({
  259. url: `/pages-car/pages/complaint?orderId=${this.orderInfo.orderId}`
  260. });
  261. return;
  262. }
  263. uni.showToast({ title: `点击了${type}`, icon: 'none' });
  264. }
  265. }
  266. };
  267. </script>
  268. <style lang="scss" scoped>
  269. .order-detail-page {
  270. min-height: 100vh;
  271. background-color: #F5F5F5;
  272. padding-bottom: 20rpx;
  273. .status-header {
  274. background-color: #d1f2d8; // Light green bg
  275. padding: 40rpx 30rpx;
  276. color: #333;
  277. .status-text {
  278. font-size: 36rpx;
  279. font-weight: bold;
  280. margin-bottom: 10rpx;
  281. }
  282. .status-desc {
  283. font-size: 26rpx;
  284. color: #666;
  285. display: flex;
  286. align-items: center;
  287. }
  288. .status-desc-block {
  289. font-size: 26rpx;
  290. color: #666;
  291. .status-tip {
  292. margin-bottom: 10rpx;
  293. }
  294. .status-desc-row {
  295. display: flex;
  296. align-items: center;
  297. }
  298. }
  299. }
  300. .info-card {
  301. background-color: #fff;
  302. margin: 20rpx;
  303. border-radius: 16rpx;
  304. padding: 30rpx;
  305. display: flex;
  306. &.address-card {
  307. align-items: center;
  308. .icon-box {
  309. margin-right: 20rpx;
  310. }
  311. .address-content {
  312. flex: 1;
  313. margin-right: 20rpx;
  314. .user-info {
  315. font-size: 30rpx;
  316. font-weight: 500;
  317. margin-bottom: 10rpx;
  318. .mobile {
  319. margin-left: 20rpx;
  320. }
  321. }
  322. .address-detail {
  323. font-size: 26rpx;
  324. color: #666;
  325. line-height: 1.4;
  326. }
  327. }
  328. }
  329. &.logistics-card {
  330. align-items: center;
  331. .icon-box {
  332. margin-right: 20rpx;
  333. }
  334. .logistics-content {
  335. flex: 1;
  336. margin-right: 20rpx;
  337. .company-name {
  338. font-size: 28rpx;
  339. color: #38C148;
  340. margin-bottom: 6rpx;
  341. }
  342. .latest-trace {
  343. font-size: 26rpx;
  344. color: #333;
  345. margin-bottom: 6rpx;
  346. display: -webkit-box;
  347. -webkit-box-orient: vertical;
  348. -webkit-line-clamp: 2;
  349. overflow: hidden;
  350. }
  351. .update-time {
  352. font-size: 24rpx;
  353. color: #999;
  354. }
  355. }
  356. }
  357. &.goods-card {
  358. display: block;
  359. .goods-item {
  360. display: flex;
  361. margin-bottom: 30rpx;
  362. .goods-cover {
  363. width: 120rpx;
  364. height: 120rpx;
  365. border-radius: 8rpx;
  366. margin-right: 20rpx;
  367. background-color: #eee;
  368. }
  369. .goods-info {
  370. flex: 1;
  371. .goods-title {
  372. font-size: 28rpx;
  373. color: #333;
  374. margin-bottom: 10rpx;
  375. }
  376. .goods-quality {
  377. font-size: 24rpx;
  378. color: #999;
  379. }
  380. .price-box {
  381. margin-top: 10rpx;
  382. display: flex;
  383. justify-content: space-between;
  384. .price {
  385. font-weight: 500;
  386. }
  387. .num {
  388. color: #999;
  389. }
  390. }
  391. }
  392. .goods-action {
  393. display: flex;
  394. align-items: center;
  395. }
  396. }
  397. .price-detail {
  398. border-top: 1rpx solid #eee;
  399. padding-top: 20rpx;
  400. .row {
  401. display: flex;
  402. justify-content: space-between;
  403. font-size: 26rpx;
  404. color: #666;
  405. margin-bottom: 10rpx;
  406. .goods-total {
  407. color: #38C148;
  408. }
  409. .discount {
  410. color: #38C148;
  411. }
  412. }
  413. .real-pay-row {
  414. display: flex;
  415. justify-content: space-between;
  416. font-size: 30rpx;
  417. font-weight: 500;
  418. margin-top: 20rpx;
  419. .real-price {
  420. color: #38C148;
  421. }
  422. }
  423. }
  424. }
  425. &.time-card {
  426. display: block;
  427. .row {
  428. display: flex;
  429. justify-content: space-between;
  430. font-size: 24rpx;
  431. color: #999;
  432. margin-bottom: 10rpx;
  433. &:last-child {
  434. margin-bottom: 0;
  435. }
  436. }
  437. }
  438. }
  439. .bottom-bar {
  440. position: fixed;
  441. bottom: 0;
  442. left: 0;
  443. right: 0;
  444. background-color: #fff;
  445. padding: 20rpx 30rpx;
  446. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  447. display: flex;
  448. justify-content: flex-end;
  449. align-items: center;
  450. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  451. }
  452. }
  453. </style>