common-logistics.vue 5.8 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)
  60. resolve(true)
  61. // ----------------------------------------------------------------------------
  62. // // H5环境下下载
  63. // const link = document.createElement('a')
  64. // link.href = url
  65. // link.download = `${filename}.${fileExtension}` // 设置下载文件名
  66. // document.body.appendChild(link)
  67. // link.click()
  68. // document.body.removeChild(link)
  69. // ----------------------------------------------------------------------------
  70. // // 提取文件名和类型
  71. // const filename = url.split('/').pop().split('?')[0] // 获取文件名
  72. // const fileExtension = filename.split('.').pop().toLowerCase() // 获取文件扩展名
  73. // // 判断当前平台
  74. // const platform = uni.getSystemInfoSync().platform
  75. // // 使用uni.downloadFile进行文件下载
  76. // uni.downloadFile({
  77. // url: url,
  78. // header: {
  79. // 'Content-Type': 'application/x-www-form-urlencoded'
  80. // },
  81. // success: res => {
  82. // if (res.statusCode === 200) {
  83. // // // H5环境下下载
  84. // // const link = document.createElement('a')
  85. // // link.href = res.tempFilePath
  86. // // link.download = `${filename}.${fileExtension}` // 设置下载文件名
  87. // // document.body.appendChild(link)
  88. // // link.click()
  89. // // document.body.removeChild(link)
  90. // } else {
  91. // reject('Download failed: ' + res.statusCode)
  92. // }
  93. // },
  94. // fail: err => {
  95. // reject('Download error: ' + err)
  96. // }
  97. // })
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. @import url('@/components/logistics/main.css');
  105. .common-logistics {
  106. height: auto;
  107. box-sizing: border-box;
  108. background: #ffffff;
  109. }
  110. .item-container {
  111. width: 100%;
  112. height: auto;
  113. display: flex;
  114. .item-container-left {
  115. width: 120rpx;
  116. max-width: 120rpx;
  117. }
  118. .item-container-center {
  119. width: 44rpx;
  120. height: auto;
  121. display: flex;
  122. flex-direction: column;
  123. .tag-container {
  124. width: 44rpx;
  125. height: 44rpx;
  126. image {
  127. width: 44rpx;
  128. height: 44rpx;
  129. border-radius: 50%;
  130. }
  131. .item-tag-container {
  132. width: 44rpx;
  133. height: 44rpx;
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. .item-tag {
  138. width: 14rpx;
  139. height: 14rpx;
  140. border-radius: 50%;
  141. }
  142. }
  143. }
  144. .line-container {
  145. flex: 1;
  146. box-sizing: border-box;
  147. width: 44rpx;
  148. height: 100%;
  149. min-height: 88rpx;
  150. padding-top: 8rpx;
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. .line {
  155. width: 2rpx;
  156. height: 100%;
  157. min-height: 80rpx;
  158. background-color: #dcdcdc;
  159. }
  160. }
  161. }
  162. .item-container-right {
  163. flex: 1;
  164. box-sizing: border-box;
  165. padding: 0 10rpx 12rpx 24rpx;
  166. .item-title {
  167. width: 100%;
  168. line-height: 44rpx;
  169. color: #333333;
  170. font-size: 28rpx;
  171. text {
  172. font-size: 24rpx;
  173. color: $sec-font;
  174. margin-left: 12rpx;
  175. font-weight: normal;
  176. }
  177. }
  178. .item-desc {
  179. margin-top: 10rpx;
  180. width: 100%;
  181. min-height: 30rpx;
  182. line-height: 32rpx;
  183. word-wrap: break-word;
  184. word-break: normal;
  185. }
  186. .item-time {
  187. margin-top: 12rpx;
  188. width: 100%;
  189. height: 34rpx;
  190. line-height: 34rpx;
  191. font-size: 24rpx;
  192. }
  193. }
  194. }
  195. .line-state {
  196. width: 20rpx;
  197. height: 20rpx;
  198. border-radius: 50%;
  199. }
  200. .take-space {
  201. width: 100%;
  202. height: 80rpx;
  203. }
  204. .text-1A1A1A {
  205. color: #1a1a1a;
  206. }
  207. .text-999999 {
  208. color: #999999;
  209. }
  210. .text-808080 {
  211. color: #808080;
  212. }
  213. </style>