orders_detail.vue 7.9 KB

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