detail.vue 6.6 KB

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