index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <!-- 物流详情 -->
  2. <template>
  3. <view class="product-logistics-container">
  4. <JHeader title="产品物流信息" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  5. <view class="product-logistics_info">
  6. <view class="texts">快递商家:{{ orderDetail.info.name }}</view>
  7. <view class="texts">快递单号:{{ orderDetail.info.no }}</view>
  8. <view class="texts">快递备注:{{ orderDetail.info.remark }}</view>
  9. </view>
  10. <view class="product_logistics_List">
  11. <view class="timeline__item" v-for="(item, index) in orderDetail.list" :key="index">
  12. <view class="timeline__item-header">
  13. <view class="icon_body_content" :class="{ isOpen:item.isOpenDetail }" @click="openDetails($event, index)">
  14. <image class="timeline__arrow-icon" :aria-expanded="item.isOpenDetail" src="@/static/images/center/rightArrow.png"></image>
  15. </view>
  16. <!-- <button class="timeline__arrow" type="button" id="item1" aria-labelledby="item1-name" aria-controls="item1-ctrld" aria-haspopup="true" data-item="1">
  17. <svg class="timeline__arrow-icon">
  18. <use href="#arrow" />
  19. </svg>
  20. </button> -->
  21. <span class="timeline__dot"></span>
  22. <span id="item1-name" class="timeline__meta">
  23. <time class="timeline__date" datetime="1970-01-01">{{ new Date(Number(item.time)).toLocaleString() }}</time><br>
  24. <strong class="timeline__title">{{ item.source }}</strong>
  25. </span>
  26. </view>
  27. <view class="timeline__item-body" :class="{'timeline__item-body--expanded': item.isOpenDetail}" :id="`item${index + 1}-ctrld`" role="region" aria-labelledby="item1" aria-hidden="true">
  28. <view class="timeline__item-body-content">
  29. <p class="timeline__item-p">{{ item.message }}</p>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { getBanziDileveryOrderApi } from '../../../api/anotherTFInterface'
  38. import orderDetail from './index.json'
  39. export default {
  40. name: 'ProductLogistics',
  41. data() {
  42. return {
  43. // temps: {
  44. // '--hue': 223,
  45. // '--bg': rgb(227, 228, 232),
  46. // '--fg': rgb(23, 24, 28),
  47. // '--primary': rgb(13, 78, 242),
  48. // '--trans-dur': '0.3s',
  49. // '--trans-timing': 'cubic-bezier(0.65,0,0.35,1)',
  50. // },
  51. orderId: '',
  52. skuId: '',
  53. orderDetail: []
  54. }
  55. },
  56. onLoad(options) {
  57. this.orderId = options.orderId
  58. this.skuId = options.skuId
  59. getBanziDileveryOrderApi({
  60. orderId: this.orderId,
  61. skuId: this.skuId
  62. }).then(res => {
  63. this.orderDetail = res.data
  64. this.orderDetail.list = orderDetail.list.map((item, index) => {
  65. return {
  66. ...item,
  67. isOpenDetail: true
  68. }
  69. })
  70. }).catch(err => {
  71. this.orderDetail = orderDetail
  72. this.orderDetail.list = orderDetail.list.map((item, index) => {
  73. return {
  74. ...item,
  75. isOpenDetail: true
  76. }
  77. })
  78. uni.showToast({
  79. title: err,
  80. cion: 'none'
  81. });
  82. })
  83. },
  84. methods: {
  85. // 获取产品物流信息
  86. getProductLogisticsMsg() {
  87. getBanziDileveryOrderApi({
  88. orderId: this.orderId,
  89. skuId: this.skuId
  90. }).then((res) => {
  91. console.log(res)
  92. })
  93. },
  94. openDetails(ev, index) {
  95. const animOptions = {
  96. duration: 300,
  97. easing: "cubic-bezier(0.65,0,0.35,1)"
  98. };
  99. this.orderDetail.list[index].isOpenDetail = !this.orderDetail.list[index].isOpenDetail
  100. const ctrld = document.querySelector(`#item${index + 1}-ctrld`);
  101. const contentHeight = ctrld.firstElementChild?.offsetHeight;
  102. if (this.orderDetail.list[index].isOpenDetail) {
  103. this.animation = ctrld.animate([
  104. { height: "0px" },
  105. { height: `${contentHeight}px` }
  106. ],animOptions);
  107. }else {
  108. this.animation = ctrld.animate([
  109. { height: `${contentHeight}px` },
  110. { height: `${contentHeight}px` },
  111. { height: "0px" }
  112. ],animOptions);
  113. }
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. /* :root {
  120. --hue: 223;
  121. --bg: rgb(227, 228, 232);
  122. --fg: rgb(23, 24, 28);
  123. --primary: rgb(13, 78, 242);
  124. --trans-dur: 0.3s;
  125. --trans-timing: cubic-bezier(0.65,0,0.35,1);
  126. font-size: calc(16px + (24 - 16) * (100vw - 320px) / (2560 - 320));
  127. } */
  128. // 32倍
  129. .product-logistics-container {
  130. min-height: 100vh;
  131. box-sizing: border-box;
  132. }
  133. .product-logistics_info {
  134. box-sizing: border-box;
  135. padding: 30rpx;
  136. line-height: 48rpx;
  137. }
  138. .timeline {
  139. margin: auto;
  140. padding: 0 3rpx;
  141. width: 100%;
  142. max-width: 36rpx;
  143. }
  144. /* .timeline__arrow {
  145. margin-top: 10rpx;
  146. background-color: transparent;
  147. border-radius: 8rpx;
  148. cursor: pointer;
  149. flex-shrink: 0;
  150. margin-inline-end: 8rpx;
  151. outline: transparent;
  152. width: 40rpx;
  153. height: 40rpx;
  154. transition:
  155. background-color calc(var(--trans-dur) / 2) linear,
  156. color var(--trans-dur);
  157. -webkit-appearance: none;
  158. appearance: none;
  159. -webkit-tap-highlight-color: transparent;
  160. } */
  161. /* .timeline__arrow:focus-visible, */
  162. /* .timeline__arrow:hover {
  163. background-color: rgba(118, 125, 143, 0.4);
  164. } */
  165. .isOpen {
  166. background-color: rgb(115, 118, 140)
  167. }
  168. .icon_body_content {
  169. margin-right: 10rpx;
  170. transition:
  171. background-color calc(0.3s / 2) linear,
  172. color 0.3s;
  173. border-radius: 8rpx;
  174. box-sizing: border-box;
  175. /* padding: 10rpx; */
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. width: 60rpx;
  180. height: 60rpx;
  181. }
  182. .timeline__arrow-icon {
  183. /* margin-top: 10rpx; */
  184. display: block;
  185. /* margin-left: 5rpx; */
  186. pointer-events: none;
  187. /* transform: rotate(-90deg); */
  188. transition: transform 0.3s cubic-bezier(0.65,0,0.35,1);
  189. width: 50rpx;
  190. height: 40rpx;
  191. // width: 100%;
  192. // height: 100%;
  193. }
  194. .timeline__date {
  195. font-size: 26rpx;
  196. line-height: 2.4;
  197. }
  198. .timeline__dot {
  199. background-color: currentColor;
  200. border-radius: 50%;
  201. display: inline-block;
  202. flex-shrink: 0;
  203. margin: 20rpx 0;
  204. margin-inline-end: 32rpx;
  205. position: relative;
  206. width: 24rpx;
  207. height: 24rpx;
  208. }
  209. .timeline__item {
  210. position: relative;
  211. padding-bottom: 42rpx;
  212. }
  213. .timeline__item:not(:last-child):before {
  214. background-color: currentColor;
  215. content: "";
  216. display: block;
  217. position: absolute;
  218. top: 32rpx;
  219. left: 82rpx;
  220. width: 4rpx;
  221. height: 100%;
  222. transform: translateX(-50%);
  223. transition: 1.3s;
  224. }
  225. [dir="rtl"] .timeline__arrow-icon {
  226. transform: rotate(90deg);
  227. }
  228. [dir="rtl"] .timeline__item:not(:last-child):before {
  229. right: 72rpx;
  230. left: auto;
  231. transform: translateX(50%);
  232. }
  233. .timeline__item-header {
  234. display: flex;
  235. }
  236. .timeline__item-body {
  237. border-radius: 12rpx;
  238. overflow: hidden;
  239. margin-top: 16rpx;
  240. margin-inline-start: 128rpx;
  241. height: 0;
  242. }
  243. .timeline__item-body-content {
  244. word-break: break-all;
  245. white-space: Pre-line;
  246. background-color: rgba(115, 122, 140, 0.2);
  247. opacity: 0;
  248. padding: 12rpx 24rpx;
  249. visibility: hidden;
  250. transition:
  251. opacity 0.3s cubic-bezier(0.65,0,0.35,1),
  252. visibility 0.3s steps(1,end);
  253. transition:
  254. opacity 0.3s vcubic-bezier(0.65,0,0.35,1),
  255. visibility 0.3s steps(1,end);
  256. }
  257. .timeline__meta {
  258. flex: 1;
  259. /* width: 100%; */
  260. }
  261. .timeline__title {
  262. font-size: 48rpx;
  263. line-height: 1.333;
  264. }
  265. /* Expanded state */
  266. .timeline__item-body--expanded {
  267. height: auto;
  268. }
  269. .timeline__item-body--expanded .timeline__item-body-content {
  270. opacity: 1;
  271. visibility: visible;
  272. transition-delay: 0.3s, 0s;
  273. }
  274. .timeline__arrow-icon[aria-expanded="true"] {
  275. transform: rotate(90deg);
  276. }
  277. /* Dark theme */
  278. /* @media (prefers-color-scheme: dark) {
  279. :root {
  280. --bg: rgb(23, 24, 28);
  281. --fg: rgb(227, 228, 232);
  282. --primary: rgb(110, 149, 247);
  283. }
  284. } */
  285. .product_logistics_List{
  286. box-sizing: border-box;
  287. padding: 0rpx 30rpx;
  288. width: 100vw;
  289. height: auto;
  290. }
  291. </style>