detail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <view>
  3. <view class="addr_item">
  4. <view class="contact_user" style="display: flex; justify-content: space-between; width: 100%">
  5. <view style="display: flex">
  6. <text class="contact_name">{{ order_datail.order_addr?.contact_name }}</text>
  7. <text class="contact_phone">{{ order_datail.order_addr?.contact_phone }}</text>
  8. </view>
  9. <view class="contact_shop text-ellipsis" style="width: 250rpx; text-align: end">
  10. <text v-if="order_datail.order_addr?.shop_type">({{ $CONSTANTS.SHOP_TYPES[order_datail.order_addr?.shop_type] }})&nbsp;</text>
  11. {{ order_datail.order_addr?.contact_shop }}
  12. </view>
  13. </view>
  14. <view class="contact_addr"
  15. >{{ order_datail.order_addr?.contact_province }} {{ order_datail.order_addr?.contact_city }} {{ order_datail.order_addr?.contact_area }} {{ order_datail.order_addr?.contact_addr }}</view
  16. >
  17. </view>
  18. <view class="car_list">
  19. <view class="business_name">{{ order_datail?.business_name }}</view>
  20. <view class="car_item" v-for="(item, index) in order_datail.order_items" :key="index">
  21. <view class="box_left">
  22. <image class="car_image" :src="item.product_thumb" mode=""></image>
  23. </view>
  24. <view class="box_center">
  25. <view class="car_name">{{ item.product_name }}</view>
  26. <view class="car_spec">{{ item.product_spec }}</view>
  27. <view v-if="item.promo_title" class="promo_title">{{ item.promo_title }}</view>
  28. <view class="car_price">
  29. <text class="price">¥{{ item.pay_total }}</text>
  30. </view>
  31. </view>
  32. <view class="box_right">
  33. <view class="buy_num_box">
  34. <view class="buy_num">共{{ item.buy_num }}件</view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="price_content">
  40. <view class="price_content_title">价格明细</view>
  41. <view class="price_content_item">
  42. <view>订单总价</view>
  43. <view>¥{{ order_datail?.price_total }}</view>
  44. </view>
  45. <view class="price_content_item">
  46. <view>优惠价格</view>
  47. <view>¥-{{ order_datail?.coupon_total }}</view>
  48. </view>
  49. <view class="price_content_item">
  50. <view>订单金额</view>
  51. <view>¥{{ order_datail?.pay_total }}</view>
  52. </view>
  53. <view class="price_content_title">更多订单信息</view>
  54. <view class="price_content_item">
  55. <view>订单编号</view>
  56. <view>{{ order_datail?.order_code }}</view>
  57. </view>
  58. <view class="price_content_item">
  59. <view>下单时间</view>
  60. <view>{{ order_datail?.insert_time }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. order_datail: {},
  70. };
  71. },
  72. onLoad(param) {
  73. this._getOrderDetail(param.order_id); // 获取并打印订单详情
  74. },
  75. methods: {
  76. _getOrderDetail(orderId) {
  77. this.$http
  78. .request("api/orders/get_detail", { id: orderId })
  79. .then((response) => {
  80. if (response.code == "success") {
  81. this.order_datail = response.data; // 打印订单详情
  82. }
  83. })
  84. .catch((error) => {
  85. uni.showToast({
  86. title: "获取订单详情失败",
  87. icon: "error",
  88. duration: 2000,
  89. });
  90. });
  91. },
  92. },
  93. };
  94. </script>
  95. <style lang="less" scoped>
  96. .addr_item {
  97. font-size: 24rpx;
  98. overflow: hidden;
  99. line-height: 40rpx;
  100. padding: 15rpx 10rpx;
  101. border-radius: 15rpx;
  102. padding-bottom: 0rpx;
  103. margin-bottom: 10rpx;
  104. background-color: #ffffff;
  105. .contact_user {
  106. font-size: 24rpx;
  107. line-height: 50rpx;
  108. .contact_name {
  109. font-size: 26rpx;
  110. font-weight: bold;
  111. margin-right: 16rpx;
  112. }
  113. .contact_shop {
  114. float: right;
  115. }
  116. }
  117. .contact_addr {
  118. font-size: 24rpx;
  119. line-height: 30rpx;
  120. padding: 10rpx 5rpx;
  121. border-bottom: 2rpx solid #dddddd;
  122. }
  123. }
  124. .car_list {
  125. display: block;
  126. overflow: hidden;
  127. margin: 0rpx auto;
  128. margin-top: 20rpx;
  129. background: #ffffff;
  130. padding-bottom: 210rpx;
  131. .business_name {
  132. padding: 8rpx 10rpx;
  133. border: 1px solid #f44336;
  134. font-size: 24rpx;
  135. z-index: 1;
  136. display: flex;
  137. align-items: center;
  138. }
  139. .car_item {
  140. height: 170rpx;
  141. display: block;
  142. overflow: hidden;
  143. margin: 0rpx auto;
  144. padding: 20rpx 35rpx;
  145. border-bottom: 2rpx solid #dddddd;
  146. .box_left {
  147. float: left;
  148. width: 140rpx;
  149. height: 190rpx;
  150. margin-top: 10rpx;
  151. .car_image {
  152. width: 140rpx;
  153. height: 140rpx;
  154. border-radius: 5rpx;
  155. }
  156. }
  157. .box_center {
  158. float: left;
  159. width: 300rpx;
  160. margin-left: 25rpx;
  161. .car_name {
  162. max-height: 70rpx;
  163. font-size: 30rpx;
  164. line-height: 40rpx;
  165. overflow: hidden;
  166. white-space: nowrap;
  167. /* 不换行 */
  168. overflow: hidden;
  169. /* 隐藏超出的内容 */
  170. text-overflow: ellipsis;
  171. /* 用省略号表示被隐藏的部分 */
  172. }
  173. .car_spec {
  174. color: #999999;
  175. font-size: 24rpx;
  176. line-height: 60rpx;
  177. max-height: 60rpx;
  178. overflow: hidden;
  179. }
  180. .promo_title {
  181. max-height: 80rpx;
  182. font-size: 20rpx;
  183. line-height: 40rpx;
  184. overflow: hidden;
  185. padding: 0rpx 0rpx;
  186. color: #dd524d;
  187. }
  188. .car_price {
  189. font-size: 30rpx;
  190. line-height: 60rpx;
  191. .price {
  192. color: red;
  193. }
  194. }
  195. }
  196. .box_right {
  197. float: right;
  198. width: 185rpx;
  199. .buy_num_box {
  200. float: right;
  201. color: #333333;
  202. overflow: hidden;
  203. font-size: 24rpx;
  204. margin-top: 130rpx;
  205. text-align: center;
  206. .buy_num {
  207. float: left;
  208. width: 100rpx;
  209. height: 30rpx;
  210. font-size: 24rpx;
  211. line-height: 30rpx;
  212. padding: 0rpx 0rpx;
  213. border-radius: 8rpx;
  214. }
  215. }
  216. }
  217. }
  218. .car_item:last-child {
  219. border-bottom: none;
  220. }
  221. }
  222. .price_content {
  223. background-color: #fff;
  224. position: fixed;
  225. bottom: var(--window-bottom);
  226. padding: 16rpx 26rpx;
  227. width: 100%;
  228. box-sizing: border-box;
  229. .price_content_title {
  230. font-weight: bold;
  231. margin-bottom: 20rpx;
  232. }
  233. .price_content_item {
  234. margin-bottom: 20rpx;
  235. display: flex;
  236. justify-content: space-between;
  237. align-items: center;
  238. font-size: 24rpx;
  239. }
  240. }
  241. </style>