logistics-detail.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="log_detail">
  3. <view class="info">
  4. <image src="/static/imgs/shop/log_bg.png"></image>
  5. <view>
  6. <view class="info_con">
  7. <view style="position:relative;">
  8. <image :src="img" style="flex-shrink: 0;"></image>
  9. </view>
  10. <view class="info_log">
  11. <view class="flexB">
  12. <text>{{ logList.express_company }}</text>
  13. <view class="edit_log flexC" @click="skipEdit">修改物流</view>
  14. </view>
  15. <text>
  16. <text>{{ logList.express_no }}</text>
  17. <text class="copy" @click="copy(logList.express_no)">复制</text>
  18. </text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="step" v-if="Number(express.State) > 0">
  24. <view class="step_con">
  25. <view>
  26. <view class="active" v-if="express.State == 1">
  27. <image src="/static/imgs/shop/step.png"></image>
  28. <view>已发货</view>
  29. </view>
  30. <view v-else>已发货</view>
  31. <view class="circle" :class="express.State == 1 ? 'circle_active' : ''"></view>
  32. </view>
  33. <view class="line"></view>
  34. <view>
  35. <view class="active" v-if="express.State == 2">
  36. <image src="/static/imgs/shop/step.png"></image>
  37. <view>运输中</view>
  38. </view>
  39. <view v-else>运输中</view>
  40. <view class="circle" :class="express.State == 2 ? 'circle_active' : ''"></view>
  41. </view>
  42. <view class="line"></view>
  43. <view>
  44. <view class="active" v-if="express.State == 3 || express.State == 4">
  45. <image src="/static/imgs/shop/step.png"></image>
  46. <view v-if="express.State == 4">问题件</view>
  47. <view v-else>已签收</view>
  48. </view>
  49. <view v-else>已签收</view>
  50. <view class="circle" :class="express.State == 3 || express.State == 4 ? 'circle_active' : ''">
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="log_con">
  56. <view v-for="item in log" :key="item.id">
  57. <view class="flexS">
  58. <view class="time flexCC">
  59. <view v-if="item.AcceptTime">{{ item.AcceptTime | sendTime }}</view>
  60. <text v-if="item.AcceptTime">{{ item.AcceptTime | sendDay }}</text>
  61. </view>
  62. <view class="log_info">{{ item.AcceptStation }}</view>
  63. </view>
  64. <view class="col_line"></view>
  65. </view>
  66. </view>
  67. <view class="noData" v-if="Number(express.State) == 0">
  68. <image src="../../static/imgs/default/no_record.png"></image>
  69. <view>暂无物流状态</view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import {
  75. handleClipboard
  76. } from '../../common/util/utils.js';
  77. import {
  78. getLogs
  79. } from '../../apis/shop.js';
  80. export default {
  81. data() {
  82. return {
  83. logList: [], //物流详情
  84. express: '', //物流进程
  85. noData: false, //是否显示暂无物流信息
  86. img: '',
  87. log: '', //物流进度
  88. order_no: '' //订单编号
  89. };
  90. },
  91. onLoad(ops) {
  92. this.img = ops.img;
  93. this.order_no = ops.order_no;
  94. this.getLogData(ops.order_no);
  95. },
  96. filters: {
  97. sendDay(times) {
  98. //截取字符串年月日
  99. var timearr = times
  100. .replace(' ', ':')
  101. .replace(/\:/g, '-')
  102. .split('-');
  103. var timestr = '' + timearr[0] + '-' + timearr[1] + '-' + timearr[2];
  104. return timestr;
  105. },
  106. sendTime(times) {
  107. //截取字符串时间
  108. var timearr = times
  109. .replace(' ', ':')
  110. .replace(/\:/g, '-')
  111. .split('-');
  112. var timestr = '' + timearr[3] + ':' + timearr[4] + '';
  113. return timestr;
  114. }
  115. },
  116. methods: {
  117. //修改物流信息
  118. skipEdit() {
  119. const {
  120. express_company,
  121. express_no,
  122. express_time,
  123. express_phone,
  124. express_code
  125. } = this.logList;
  126. let data = {
  127. express_company,
  128. express_no,
  129. express_time,
  130. order_no: this.order_no,
  131. img: this.img,
  132. express_phone,
  133. express_code,
  134. };
  135. uni.navigateTo({
  136. url: '../edit-logisitics/edit-logisitics?data=' + encodeURIComponent(JSON.stringify(data))
  137. });
  138. },
  139. getLogData(order_no) {
  140. getLogs({
  141. order_no
  142. }).then(res => {
  143. if (res.code == 200) {
  144. this.logList = res.data;
  145. this.express = res.data.express;
  146. let log = res.data.express.Traces;
  147. if (log) {
  148. this.log = log.reverse();
  149. }
  150. }
  151. });
  152. },
  153. /*复制单号*/
  154. copy(data) {
  155. handleClipboard(
  156. data,
  157. event,
  158. () => {
  159. uni.showToast({
  160. icon: 'none',
  161. title: '复制成功'
  162. });
  163. },
  164. () => {
  165. uni.showToast({
  166. icon: 'none',
  167. title: '复制失败'
  168. });
  169. }
  170. );
  171. }
  172. }
  173. };
  174. </script>
  175. <style lang="scss" scoped>
  176. .log_detail {
  177. width: 100%;
  178. min-height: 100%;
  179. background: #fff;
  180. padding-bottom: 120rpx;
  181. .info {
  182. width: 100%;
  183. height: 194rpx;
  184. position: relative;
  185. image {
  186. width: 100%;
  187. height: 100%;
  188. }
  189. >view {
  190. position: absolute;
  191. top: 0;
  192. left: 0;
  193. width: 100%;
  194. height: 194rpx;
  195. .info_con {
  196. display: flex;
  197. justify-content: flex-start;
  198. align-items: center;
  199. width: 690rpx;
  200. margin: 0 auto;
  201. height: 194rpx;
  202. image {
  203. width: 138rpx;
  204. height: 138rpx;
  205. border-radius: 8rpx;
  206. }
  207. .count {
  208. width: 138rpx;
  209. height: 40rpx;
  210. line-height: 40rpx;
  211. font-size: 28rpx;
  212. background-color: rgba(0, 0, 0, 0.7);
  213. color: #fff;
  214. text-align: center;
  215. position: absolute;
  216. bottom: 0;
  217. left: 0;
  218. border-radius: 0 0 8rpx 8rpx;
  219. }
  220. }
  221. .info_log {
  222. width: 100%;
  223. margin-left: 30rpx;
  224. view,
  225. text {
  226. color: #fff;
  227. font-size: 28rpx;
  228. }
  229. view {
  230. font-size: 32rpx;
  231. font-weight: bold;
  232. margin-bottom: 15rpx;
  233. }
  234. .copy {
  235. display: inline-block;
  236. width: 94rpx;
  237. text-align: center;
  238. height: 42rpx;
  239. border: 1rpx solid #fff;
  240. color: #fff;
  241. border-radius: 24rpx;
  242. margin-left: 15rpx;
  243. }
  244. .edit_log {
  245. width: 168rpx;
  246. height: 64rpx;
  247. background: #fce904;
  248. font-size: 28rpx;
  249. color: $base-color;
  250. border-radius: 32rpx;
  251. font-weight: normal;
  252. }
  253. }
  254. }
  255. }
  256. .step {
  257. width: 100%;
  258. height: 190rpx;
  259. box-sizing: border-box;
  260. border-bottom: 2rpx solid #e9e9e9;
  261. padding: 30rpx 0;
  262. .address {
  263. width: 634rpx;
  264. margin: 0 auto;
  265. }
  266. .step_con {
  267. width: 690rpx;
  268. margin: 0 auto;
  269. display: flex;
  270. justify-content: center;
  271. align-items: flex-end;
  272. image {
  273. width: 130rpx;
  274. height: 60rpx;
  275. }
  276. view {
  277. font-size: 24rpx;
  278. color: #999;
  279. display: flex;
  280. flex-direction: column;
  281. align-items: center;
  282. }
  283. .active {
  284. position: relative;
  285. view {
  286. position: absolute;
  287. top: 6rpx;
  288. left: 33rpx;
  289. color: #fff;
  290. }
  291. }
  292. text {
  293. font-size: 28rpx;
  294. }
  295. .circle {
  296. width: 20rpx;
  297. height: 20rpx;
  298. background: #e9e9e9;
  299. border-radius: 50%;
  300. margin: 12rpx 0;
  301. }
  302. .circle_active {
  303. background: $base-line-bg;
  304. }
  305. .line {
  306. width: 200rpx;
  307. height: 4rpx;
  308. margin-bottom: 19rpx;
  309. background-color: #e9e9e9;
  310. }
  311. }
  312. }
  313. .log_con {
  314. width: 690rpx;
  315. margin: 50rpx auto 100rpx;
  316. >view {
  317. margin-bottom: 30rpx;
  318. }
  319. >view:last-child {
  320. .col_line {
  321. display: none;
  322. }
  323. }
  324. >view:not(:first-child) {
  325. .log_info {
  326. color: #999;
  327. }
  328. }
  329. .time {
  330. width: 164rpx;
  331. flex-shrink: 0;
  332. margin-right: 24rpx;
  333. view {
  334. font-size: 28rpx;
  335. font-weight: bold;
  336. margin-bottom: 5rpx;
  337. }
  338. text {
  339. font-size: 28rpx;
  340. color: #999;
  341. }
  342. }
  343. .log_info {
  344. font-size: 28rpx;
  345. width: 90%;
  346. }
  347. .col_line {
  348. width: 2rpx;
  349. height: 50rpx;
  350. background-color: #e9e9e9;
  351. margin-left: 72rpx;
  352. }
  353. }
  354. .source {
  355. width: 100%;
  356. text-align: center;
  357. font-size: 28rpx;
  358. color: #999;
  359. padding: 50rpx 0;
  360. }
  361. }
  362. </style>