orders_detail.vue 6.8 KB

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