order-detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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. <image src="/pages-mine/static/adderss.png" style="width: 40rpx; height: 40rpx"></image>
  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. <order-bottom-bar :orderInfo="orderInfo" @action="handleAction"></order-bottom-bar>
  118. <!-- 占位符,防止底部按钮遮挡内容 -->
  119. <view style="height: 120rpx;"></view>
  120. </view>
  121. </template>
  122. <script>
  123. import OrderBottomBar from '../components/order-bottom-bar.vue';
  124. export default {
  125. components: {
  126. OrderBottomBar
  127. },
  128. data() {
  129. return {
  130. orderInfo: {
  131. status: '2',
  132. orderId: '',
  133. detailVoList: [],
  134. receiverName: '',
  135. receiverMobile: '',
  136. receiverAddress: '',
  137. expressMoney: 0,
  138. totalMoney: 0,
  139. discountMoney: 0,
  140. payMoney: 0,
  141. createTime: ''
  142. }
  143. };
  144. },
  145. computed: {
  146. statusText() {
  147. const map = {
  148. '1': '等待买家付款',
  149. '2': '等待卖家发货',
  150. '3': '已发货',
  151. '4': '交易完成',
  152. };
  153. return map[String(this.orderInfo.status)] || '未知状态';
  154. }
  155. },
  156. onLoad(options) {
  157. if (options.orderId) {
  158. this.loadOrderDetail(options.orderId);
  159. }
  160. },
  161. methods: {
  162. loadOrderDetail(orderId) {
  163. uni.$u.http.get('/token/shop/order/getOrderDetail', {
  164. orderId: orderId
  165. }).then((res) => {
  166. if (res.code === 200) {
  167. this.orderInfo = res.data;
  168. }
  169. });
  170. },
  171. copyOrderNo() {
  172. uni.setClipboardData({
  173. data: String(this.orderInfo.orderId),
  174. success: () => {
  175. uni.showToast({ title: '复制成功', icon: 'none' });
  176. }
  177. });
  178. },
  179. viewLogistics() {
  180. uni.navigateTo({
  181. url: `/pages-car/pages/logistics-detail?orderId=${this.orderInfo.orderId}`
  182. });
  183. },
  184. handleAction(type) {
  185. if (type === 'complaint') {
  186. uni.setStorageSync('tempComplaintOrder', this.orderInfo);
  187. uni.navigateTo({
  188. url: `/pages-car/pages/complaint?orderId=${this.orderInfo.orderId}`
  189. });
  190. return;
  191. }
  192. uni.showToast({ title: `点击了${type}`, icon: 'none' });
  193. }
  194. }
  195. };
  196. </script>
  197. <style lang="scss" scoped>
  198. .order-detail-page {
  199. min-height: 100vh;
  200. background-color: #F5F5F5;
  201. padding-bottom: 20rpx;
  202. .status-header {
  203. background-color: #d1f2d8; // Light green bg
  204. padding: 40rpx 30rpx;
  205. color: #333;
  206. .status-text {
  207. font-size: 36rpx;
  208. font-weight: bold;
  209. margin-bottom: 10rpx;
  210. }
  211. .status-desc {
  212. font-size: 26rpx;
  213. color: #666;
  214. display: flex;
  215. align-items: center;
  216. }
  217. .status-desc-block {
  218. font-size: 26rpx;
  219. color: #666;
  220. .status-tip {
  221. margin-bottom: 10rpx;
  222. }
  223. .status-desc-row {
  224. display: flex;
  225. align-items: center;
  226. }
  227. }
  228. }
  229. .info-card {
  230. background-color: #fff;
  231. margin: 20rpx;
  232. border-radius: 16rpx;
  233. padding: 30rpx;
  234. display: flex;
  235. &.address-card {
  236. align-items: center;
  237. .icon-box {
  238. margin-right: 20rpx;
  239. }
  240. .address-content {
  241. flex: 1;
  242. margin-right: 20rpx;
  243. .user-info {
  244. font-size: 30rpx;
  245. font-weight: 500;
  246. margin-bottom: 10rpx;
  247. .mobile {
  248. margin-left: 20rpx;
  249. }
  250. }
  251. .address-detail {
  252. font-size: 26rpx;
  253. color: #666;
  254. line-height: 1.4;
  255. }
  256. }
  257. }
  258. &.logistics-card {
  259. align-items: center;
  260. .icon-box {
  261. margin-right: 20rpx;
  262. }
  263. .logistics-content {
  264. flex: 1;
  265. margin-right: 20rpx;
  266. .company-name {
  267. font-size: 28rpx;
  268. color: #38C148;
  269. margin-bottom: 6rpx;
  270. }
  271. .latest-trace {
  272. font-size: 26rpx;
  273. color: #333;
  274. margin-bottom: 6rpx;
  275. display: -webkit-box;
  276. -webkit-box-orient: vertical;
  277. -webkit-line-clamp: 2;
  278. overflow: hidden;
  279. }
  280. .update-time {
  281. font-size: 24rpx;
  282. color: #999;
  283. }
  284. }
  285. }
  286. &.goods-card {
  287. display: block;
  288. .goods-item {
  289. display: flex;
  290. margin-bottom: 30rpx;
  291. .goods-cover {
  292. width: 120rpx;
  293. height: 120rpx;
  294. border-radius: 8rpx;
  295. margin-right: 20rpx;
  296. background-color: #eee;
  297. }
  298. .goods-info {
  299. flex: 1;
  300. .goods-title {
  301. font-size: 28rpx;
  302. color: #333;
  303. margin-bottom: 10rpx;
  304. }
  305. .goods-quality {
  306. font-size: 24rpx;
  307. color: #999;
  308. }
  309. .price-box {
  310. margin-top: 10rpx;
  311. display: flex;
  312. justify-content: space-between;
  313. .price {
  314. font-weight: 500;
  315. }
  316. .num {
  317. color: #999;
  318. }
  319. }
  320. }
  321. .goods-action {
  322. display: flex;
  323. align-items: center;
  324. }
  325. }
  326. .price-detail {
  327. border-top: 1rpx solid #eee;
  328. padding-top: 20rpx;
  329. .row {
  330. display: flex;
  331. justify-content: space-between;
  332. font-size: 26rpx;
  333. color: #666;
  334. margin-bottom: 10rpx;
  335. .goods-total {
  336. color: #38C148;
  337. }
  338. .discount {
  339. color: #38C148;
  340. }
  341. }
  342. .real-pay-row {
  343. display: flex;
  344. justify-content: space-between;
  345. font-size: 30rpx;
  346. font-weight: 500;
  347. margin-top: 20rpx;
  348. .real-price {
  349. color: #38C148;
  350. }
  351. }
  352. }
  353. }
  354. &.time-card {
  355. display: block;
  356. .row {
  357. display: flex;
  358. justify-content: space-between;
  359. font-size: 24rpx;
  360. color: #999;
  361. margin-bottom: 10rpx;
  362. &:last-child {
  363. margin-bottom: 0;
  364. }
  365. }
  366. }
  367. }
  368. }
  369. </style>