common-logistics.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view class="bg-white">
  3. <view class="common-logistics">
  4. <view class="logistic-item" v-for="(item, index) in logisticsData" :key="index">
  5. <view class="total-wrap">
  6. <view class="item-container">
  7. <view class="item-container-center">
  8. <view class="tag-container">
  9. <view class="item-tag-container">
  10. <image
  11. class="item-tag"
  12. :src="
  13. index == 0
  14. ? '/static/mine/logistics/active-line-state.png'
  15. : '/static/mine/logistics/line-state.png'
  16. "
  17. mode="scaleToFill"
  18. ></image>
  19. </view>
  20. </view>
  21. <view class="line-container" v-if="index !== logisticsData.length - 1">
  22. <view class="line"></view>
  23. </view>
  24. </view>
  25. <view class="item-container-right">
  26. <view class="item-title text-dm text-bold" :class="index == 0 ? 'text-1A1A1A' : 'text-808080'"
  27. >{{ item.title }}<text>{{ item.time }}</text></view
  28. >
  29. <view class="item-desc text-dm" :class="index == 0 ? 'text-1A1A1A' : 'text-999999'">
  30. {{ item.content }}
  31. <text
  32. v-for="(url, index_) in (item.imgSrc || '').split(',').filter(u => u != '')"
  33. :key="index_"
  34. style="margin-left: 10px; color: blue"
  35. @click="downloadFile(url)"
  36. >{{ `附件${index_ + 1}` }}</text
  37. >
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. props: {
  49. logisticsData: {
  50. type: [Object, Array]
  51. }
  52. },
  53. filters: {},
  54. computed: {},
  55. methods: {
  56. downloadFile(url) {
  57. console.log(url)
  58. return new Promise((resolve, reject) => {
  59. window.open(url, '_blank')
  60. resolve(true)
  61. // 提取文件名和类型
  62. // const filename = url.split('/').pop().split('?')[0] // 获取文件名
  63. // const fileExtension = filename.split('.').pop().toLowerCase() // 获取文件扩展名
  64. // // H5环境下下载
  65. // const link = document.createElement('a')
  66. // link.href = url
  67. // link.download = `${filename}.${fileExtension}` // 设置下载文件名
  68. // document.body.appendChild(link)
  69. // link.click()
  70. // document.body.removeChild(link)
  71. // // 判断当前平台
  72. // const platform = uni.getSystemInfoSync().platform
  73. // // 使用uni.downloadFile进行文件下载
  74. // uni.downloadFile({
  75. // url: url,
  76. // header: {
  77. // 'Content-Type': 'application/x-www-form-urlencoded'
  78. // },
  79. // success: res => {
  80. // if (res.statusCode === 200) {
  81. // // H5环境下下载
  82. // const link = document.createElement('a')
  83. // link.href = res.tempFilePath
  84. // link.download = `${filename}.${fileExtension}` // 设置下载文件名
  85. // document.body.appendChild(link)
  86. // link.click()
  87. // document.body.removeChild(link)
  88. // } else {
  89. // reject('Download failed: ' + res.statusCode)
  90. // }
  91. // },
  92. // fail: err => {
  93. // reject('Download error: ' + err)
  94. // }
  95. // })
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. @import url('@/components/logistics/main.css');
  103. .common-logistics {
  104. height: auto;
  105. box-sizing: border-box;
  106. background: #ffffff;
  107. }
  108. .item-container {
  109. width: 100%;
  110. height: auto;
  111. display: flex;
  112. .item-container-left {
  113. width: 120rpx;
  114. max-width: 120rpx;
  115. }
  116. .item-container-center {
  117. width: 44rpx;
  118. height: auto;
  119. display: flex;
  120. flex-direction: column;
  121. .tag-container {
  122. width: 44rpx;
  123. height: 44rpx;
  124. image {
  125. width: 44rpx;
  126. height: 44rpx;
  127. border-radius: 50%;
  128. }
  129. .item-tag-container {
  130. width: 44rpx;
  131. height: 44rpx;
  132. display: flex;
  133. justify-content: center;
  134. align-items: center;
  135. .item-tag {
  136. width: 14rpx;
  137. height: 14rpx;
  138. border-radius: 50%;
  139. }
  140. }
  141. }
  142. .line-container {
  143. flex: 1;
  144. box-sizing: border-box;
  145. width: 44rpx;
  146. height: 100%;
  147. min-height: 88rpx;
  148. padding-top: 8rpx;
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. .line {
  153. width: 2rpx;
  154. height: 100%;
  155. min-height: 80rpx;
  156. background-color: #dcdcdc;
  157. }
  158. }
  159. }
  160. .item-container-right {
  161. flex: 1;
  162. box-sizing: border-box;
  163. padding: 0 10rpx 12rpx 24rpx;
  164. .item-title {
  165. width: 100%;
  166. line-height: 44rpx;
  167. color: #333333;
  168. font-size: 28rpx;
  169. text {
  170. font-size: 24rpx;
  171. color: $sec-font;
  172. margin-left: 12rpx;
  173. font-weight: normal;
  174. }
  175. }
  176. .item-desc {
  177. margin-top: 10rpx;
  178. width: 100%;
  179. min-height: 30rpx;
  180. line-height: 32rpx;
  181. word-wrap: break-word;
  182. word-break: normal;
  183. }
  184. .item-time {
  185. margin-top: 12rpx;
  186. width: 100%;
  187. height: 34rpx;
  188. line-height: 34rpx;
  189. font-size: 24rpx;
  190. }
  191. }
  192. }
  193. .line-state {
  194. width: 20rpx;
  195. height: 20rpx;
  196. border-radius: 50%;
  197. }
  198. .take-space {
  199. width: 100%;
  200. height: 80rpx;
  201. }
  202. .text-1A1A1A {
  203. color: #1a1a1a;
  204. }
  205. .text-999999 {
  206. color: #999999;
  207. }
  208. .text-808080 {
  209. color: #808080;
  210. }
  211. </style>