detail.vue 6.7 KB

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