detail.vue 7.4 KB

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