order_item.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view class="order-item" @click="handleClick">
  3. <!-- 订单头部 -->
  4. <view class="order-header">
  5. <view class="order-info">
  6. <text class="order-number">{{ t("订单号") }}:{{ item.orderNo }}</text>
  7. <text class="order-time">{{ useGlobal().$format(item.indate) }}</text>
  8. </view>
  9. <view class="order-status">
  10. {{ item.status_txt }}
  11. </view>
  12. </view>
  13. <!-- 商品信息 -->
  14. <view class="product-section">
  15. <view class="product-list">
  16. <view
  17. v-for="(product, index) in item.goods"
  18. :key="index"
  19. class="product-item"
  20. >
  21. <view class="product-image">
  22. <image :src="product.pic_url" mode="aspectFill" />
  23. </view>
  24. <view class="product-info">
  25. <view class="product-name">{{ product.shopName }}</view>
  26. <view class="product-spec" v-if="product.sku_desc">{{
  27. product.sku_desc
  28. }}</view>
  29. <view class="product-price">
  30. <text class="price">{{ formatCurrency(product.price) }}</text>
  31. <text class="quantity">x{{ product.total }}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 订单金额 -->
  38. <view class="order-amount">
  39. <view class="shipping-fee" v-if="item.status == 300 && item.money">
  40. <text class="fee-label">{{ t("运费") }}:</text>
  41. <text class="fee-amount">{{ formatCurrency(item.money) }}</text>
  42. </view>
  43. </view>
  44. <!-- 操作按钮 -->
  45. <view class="order-actions" v-if="item.status == 300">
  46. <view class="action-btn" @click.stop="handleAction()">
  47. <trans _t="付款" />
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script setup>
  53. import { useGlobal, formatCurrency } from "@/utils";
  54. import { t } from "@/locale";
  55. const props = defineProps({
  56. item: {
  57. type: Object,
  58. required: true,
  59. },
  60. });
  61. const emit = defineEmits(["click", "action"]);
  62. const handleClick = () => {
  63. emit("click", props.item);
  64. };
  65. const handleAction = () => {
  66. emit("action", props.item);
  67. };
  68. </script>
  69. <style lang="less" scoped>
  70. @import url("@/style.less");
  71. .order-item {
  72. background: var(--light);
  73. border-radius: 16rpx;
  74. padding: 30rpx;
  75. margin-bottom: 20rpx;
  76. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
  77. .order-header {
  78. display: flex;
  79. justify-content: space-between;
  80. align-items: center;
  81. margin-bottom: 24rpx;
  82. padding-bottom: 20rpx;
  83. border-bottom: 1rpx solid var(--border);
  84. .order-info {
  85. display: flex;
  86. flex-direction: column;
  87. gap: 8rpx;
  88. .order-number {
  89. font-size: 28rpx;
  90. font-weight: bold;
  91. color: var(--black);
  92. }
  93. .order-time {
  94. font-size: 24rpx;
  95. color: var(--text-01);
  96. }
  97. }
  98. .order-status {
  99. font-size: 24rpx;
  100. font-weight: bold;
  101. padding: 8rpx 16rpx;
  102. border-radius: 20rpx;
  103. color: var(--success);
  104. background: rgba(76, 175, 80, 0.1);
  105. }
  106. }
  107. .product-section {
  108. margin-bottom: 24rpx;
  109. .product-list {
  110. display: flex;
  111. flex-direction: column;
  112. gap: 20rpx;
  113. .product-item {
  114. display: flex;
  115. gap: 20rpx;
  116. .product-image {
  117. width: 120rpx;
  118. height: 120rpx;
  119. border-radius: 12rpx;
  120. overflow: hidden;
  121. background: var(--bg);
  122. image {
  123. width: 100%;
  124. height: 100%;
  125. }
  126. }
  127. .product-info {
  128. flex: 1;
  129. display: flex;
  130. flex-direction: column;
  131. justify-content: space-between;
  132. .product-name {
  133. font-size: 28rpx;
  134. color: var(--black);
  135. line-height: 1.4;
  136. margin-bottom: 8rpx;
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. display: -webkit-box;
  140. -webkit-line-clamp: 2;
  141. -webkit-box-orient: vertical;
  142. }
  143. .product-spec {
  144. font-size: 24rpx;
  145. color: var(--text-01);
  146. margin-bottom: 8rpx;
  147. }
  148. .product-price {
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: center;
  152. .price {
  153. font-size: 28rpx;
  154. font-weight: bold;
  155. color: var(--primary);
  156. }
  157. .quantity {
  158. font-size: 24rpx;
  159. color: var(--text-01);
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. .order-amount {
  167. margin-bottom: 24rpx;
  168. padding-top: 20rpx;
  169. border-top: 1rpx solid var(--border);
  170. .amount-info {
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. .total-label {
  175. font-size: 24rpx;
  176. color: var(--text-01);
  177. }
  178. .total-amount {
  179. font-size: 32rpx;
  180. font-weight: bold;
  181. color: var(--black);
  182. }
  183. }
  184. .shipping-fee {
  185. display: flex;
  186. justify-content: space-between;
  187. align-items: center;
  188. padding: 8rpx 0;
  189. background: rgba(255, 193, 7, 0.1);
  190. border-radius: 8rpx;
  191. padding: 12rpx 16rpx;
  192. .fee-label {
  193. font-size: 24rpx;
  194. color: var(--warning);
  195. }
  196. .fee-amount {
  197. font-size: 26rpx;
  198. font-weight: bold;
  199. color: var(--warning);
  200. }
  201. }
  202. }
  203. .order-actions {
  204. display: flex;
  205. justify-content: flex-end;
  206. gap: 20rpx;
  207. padding-top: 20rpx;
  208. border-top: 1rpx solid var(--border);
  209. .action-btn {
  210. padding: 12rpx 24rpx;
  211. border-radius: 40rpx;
  212. font-size: 24rpx;
  213. font-weight: bold;
  214. text-align: center;
  215. min-width: 120rpx;
  216. background: var(--primary);
  217. color: var(--light);
  218. }
  219. }
  220. }
  221. </style>