logisticslist.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <div>
  3. <div class="content">
  4. <div class="tab">
  5. <div>
  6. <p @click="tab(1)" :class="[index == 1 ? 'active' : '']">外部件</p>
  7. <p @click="tab(2)" :class="[index == 2 ? 'active' : '']">内部件</p>
  8. </div>
  9. </div>
  10. <!-- 订单列表 -->
  11. <div class="batch_box" @scroll.passive="getScroll($event)"
  12. style=" height: calc(100vh - 40px);overflow-y: auto;">
  13. <van-pull-refresh v-model="refreshLoading" @refresh="onRefresh">
  14. <div class="jjlist" v-for="item in mailList">
  15. <div class="listinfo" @click="mailDetail(item)">
  16. <div class="list_top">
  17. <img src="../assets/images/ad_icon1.png" alt="">
  18. <div>
  19. <p>寄件号 {{ item.orderId }}</p>
  20. <p><span>收</span>收件人 {{ item.name }} {{ item.phone }}</p>
  21. <p>{{ item.province }} {{ item.city }} {{ item.county }}</p>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. <template v-if="!refreshLoading && mailList.length > 0">
  27. <div class="bottom_text" v-if="loading">
  28. 加载中...
  29. </div>
  30. <div class="bottom_text" v-else-if="noData">
  31. 已经到底啦...
  32. </div>
  33. </template>
  34. <template v-if="mailList.length === 0">
  35. <div class="bottom_text">数据为空!</div>
  36. </template>
  37. </van-pull-refresh>
  38. </div>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import { Toast, Dialog } from 'vant'
  44. import { getListByUser } from '../api/index'
  45. export default {
  46. data() {
  47. return {
  48. titlename: "我的寄件",
  49. expressType: '外部件',
  50. userId: '',
  51. mailList: [],
  52. index: 1,
  53. time: 1,
  54. value: "",
  55. timevalue: "请选择日期范围",
  56. showPicker: false,
  57. showPickertype: "year-month",
  58. minDate: new Date(2022, 0, 1),
  59. maxDate: new Date(),
  60. startTime: '',
  61. endTime: '',
  62. pageSize: {
  63. page: 1,
  64. limit: 10
  65. },
  66. refreshLoading: false, // 刷新loading
  67. noData: false, // 没有更多数据
  68. }
  69. },
  70. created: function () {
  71. this.isLogin();
  72. this.userId = localStorage.getItem("userId");
  73. this.getmailList();
  74. },
  75. methods: {
  76. // 刷新
  77. async onRefresh() {
  78. this.pageSize.page = 1;
  79. this.pageSize.limit = 10;
  80. this.refreshLoading = true;
  81. await this.getmailList(true)
  82. this.refreshLoading = false
  83. },
  84. // 滚动事件
  85. getScroll(event) {
  86. let scrollBottom =
  87. event.target.scrollHeight -
  88. event.target.scrollTop -
  89. event.target.clientHeight;
  90. // 距离底部20px以内 && 还有数据 && 没有正在加载中
  91. if (scrollBottom <= 20 && !this.noData && !this.loading) {
  92. this.pageSize.page += 1;
  93. this.getmailList();
  94. }
  95. },
  96. // 获取数据
  97. async getmailList(isClear) {
  98. this.loading = true
  99. Toast.loading({
  100. message: '加载中...',
  101. forbidClick: true,
  102. duration: 0
  103. });
  104. let parmas = {
  105. expressNo: this.value,
  106. startTime: this.startTime,
  107. endTime: this.endTime,
  108. type: this.index,
  109. }
  110. const res = await getListByUser({ ...this.pageSize, ...parmas })
  111. let expressListA = res.data
  112. Toast.clear()
  113. if (isClear) {
  114. this.mailList = expressListA
  115. } else {
  116. this.mailList.push(...expressListA)
  117. }
  118. this.loading = false
  119. if (this.pageSize.page * this.pageSize.limit >= res.count) {
  120. this.noData = true;
  121. } else {
  122. this.noData = false;
  123. }
  124. },
  125. //寄件详情
  126. mailDetail(item) {
  127. this.$router.push({ path: '/MailInfo', query: { mailDetail: item } })
  128. },
  129. //寄件查询
  130. tab(obj) {//外部件、内部件切换
  131. this.index = obj
  132. if (this.index == 1) {
  133. this.expressType = '外部件'
  134. }
  135. if (this.index == 2) {
  136. this.expressType = '内部件'
  137. }
  138. this.mailList = []
  139. this.pageSize = {
  140. page: 1,
  141. limit: 10
  142. }
  143. this.getmailList();
  144. },
  145. changetime(obj) {//选择按月份、按天数
  146. this.time = obj
  147. this.timevalue = "请选择"
  148. if (obj == 1) {//按月份时间选择器为年-月
  149. this.showPickertype = "year-month"
  150. }
  151. if (obj == 2) {//按天时间选择器为年-月-日
  152. this.showPickertype = "date"
  153. }
  154. },
  155. /* onConfirm(value){//时间确定
  156. let year,month,day
  157. let date=new Date(value)
  158. year=date.getFullYear()
  159. month=date.getMonth()+1>9?date.getMonth()+1:'0'+(date.getMonth()+1)
  160. if(this.time==1){
  161. this.timevalue=year+'-'+month
  162. }
  163. if(this.time==2){
  164. day=date.getDate()>9?date.getDate():'0'+date.getDate()
  165. this.timevalue=year+'-'+month+'-'+day
  166. }
  167. this.showPicker=false
  168. }, */
  169. onConfirm(values) {//时间确定
  170. const [start, end] = values;
  171. this.showPicker = false;
  172. this.startTime = this.formatDate(start);
  173. this.endTime = this.formatDate(end);
  174. this.timevalue = this.startTime + '~' + this.endTime;
  175. this.getmailList();
  176. },
  177. formatDate(date) {
  178. let year, month, day
  179. year = date.getFullYear()
  180. month = date.getMonth() + 1 > 9 ? date.getMonth() + 1 : '0' + (date.getMonth() + 1)
  181. day = date.getDate() > 9 ? date.getDate() : '0' + date.getDate()
  182. return (year + '-' + month + '-' + day)
  183. }
  184. },
  185. computed: {
  186. }
  187. }
  188. </script>
  189. <style lang="less" scoped="">
  190. .content {
  191. font-size: .3rem;
  192. //padding: .33rem;
  193. // padding: .33rem .33rem 1.2rem;
  194. /deep/.van-search {
  195. padding: 0px;
  196. margin-bottom: .3rem;
  197. .van-search__content {
  198. background: white;
  199. }
  200. }
  201. .tab {
  202. height: 40px;
  203. font-size: .36rem;
  204. color: #00c4b8;
  205. // padding-bottom: .3rem;
  206. background: white;
  207. div {
  208. display: flex;
  209. // border: .01rem solid #00c4b8;
  210. text-align: center;
  211. border-radius: .05rem;
  212. p {
  213. flex: 1;
  214. padding: .15rem 0rem;
  215. }
  216. p.active {
  217. background: #00c4b8;
  218. color: white;
  219. }
  220. }
  221. }
  222. .jjlist {
  223. font-size: .3rem;
  224. color: #999999;
  225. .listinfo {
  226. background: white;
  227. padding: .33rem .33rem .2rem;
  228. border-radius: .05rem;
  229. margin-bottom: .2rem;
  230. position: relative;
  231. .list_top {
  232. display: flex;
  233. justify-content: flex-start;
  234. align-items: center;
  235. img {
  236. margin: 0 0.2rem;
  237. width: .9rem;
  238. height: .9rem;
  239. }
  240. div {
  241. width: 4rem;
  242. margin-left: .2rem;
  243. display: inline-block;
  244. line-height: 150%;
  245. p:nth-of-type(1) {
  246. font-size: .3rem;
  247. font-weight: bold;
  248. color: #333;
  249. }
  250. p:nth-of-type(3) {
  251. font-size: .24rem;
  252. color: #333;
  253. span {
  254. width: .37rem;
  255. height: .37rem;
  256. color: white;
  257. border-radius: 50%;
  258. background: #cc9a09;
  259. display: inline-block;
  260. text-align: center;
  261. line-height: .37rem;
  262. margin-right: .1rem;
  263. }
  264. }
  265. p:nth-of-type(4) {
  266. font-size: .2rem;
  267. }
  268. }
  269. // }
  270. >p {
  271. font-size: .24rem;
  272. color: #f5693d;
  273. font-weight: bold;
  274. }
  275. }
  276. .list_bot {
  277. text-align: right;
  278. border-top: .01rem solid #ededed;
  279. padding-top: .2rem;
  280. p {
  281. display: inline-block;
  282. font-size: .24rem;
  283. padding: .16rem .4rem;
  284. border-radius: .05rem;
  285. }
  286. p:nth-of-type(1) {
  287. border: .01rem solid #263fbf;
  288. color: #263fbf;
  289. }
  290. p:nth-of-type(2) {
  291. border: .01rem solid #408cc7;
  292. color: #408cc7;
  293. }
  294. p:nth-of-type(3) {
  295. border: .01rem solid #d5a43c;
  296. color: #d5a43c;
  297. }
  298. p:nth-of-type(4) {
  299. border: .01rem solid #e24444;
  300. color: #e24444;
  301. }
  302. }
  303. .fast {
  304. background: url(../assets/images/status.png) no-repeat center;
  305. background-size: 100% 100%;
  306. color: white;
  307. position: absolute;
  308. bottom: 0px;
  309. right: 0px;
  310. width: 1rem;
  311. height: .4rem;
  312. text-align: center;
  313. line-height: .4rem;
  314. font-size: .2rem;
  315. }
  316. }
  317. }
  318. .change {
  319. color: #00c4b8;
  320. margin-bottom: .3rem;
  321. padding: 0rem .3rem;
  322. display: flex;
  323. justify-content: space-between;
  324. align-items: center;
  325. background: white;
  326. padding-bottom: .3rem;
  327. .datapicker {
  328. color: #9f9d9d;
  329. font-size: .3rem;
  330. p:after {
  331. content: "";
  332. display: inline-block;
  333. margin-left: .1rem;
  334. width: .15rem;
  335. height: .15rem;
  336. border-right: .05rem solid #9f9d9d;
  337. border-bottom: .05rem solid #9f9d9d;
  338. transform: rotate(45deg);
  339. position: relative;
  340. top: -.05rem;
  341. }
  342. }
  343. .time {
  344. width: 2rem;
  345. display: flex;
  346. border: .01rem solid #00c4b8;
  347. text-align: center;
  348. border-radius: .05rem;
  349. font-size: .26rem;
  350. p {
  351. flex: 1;
  352. padding: .1rem 0rem;
  353. }
  354. p.timeactive {
  355. background: #00c4b8;
  356. color: white;
  357. }
  358. }
  359. }
  360. .logistics {
  361. background: white;
  362. border-radius: .1rem;
  363. padding: .15rem;
  364. margin-bottom: .3rem;
  365. .logistics_top {
  366. display: flex;
  367. align-items: center;
  368. img {
  369. width: 12px;
  370. height: 14px;
  371. margin-left: .1rem;
  372. }
  373. }
  374. .logistics_center {
  375. padding: .3rem .6rem;
  376. display: flex;
  377. align-items: center;
  378. justify-content: space-between;
  379. font-size: .26rem;
  380. color: #9f9d9d;
  381. div:nth-of-type(1) {
  382. text-align: center;
  383. p:nth-of-type(1) {
  384. font-size: .36rem;
  385. font-weight: bold;
  386. color: #333;
  387. margin-bottom: .2rem;
  388. }
  389. }
  390. div:nth-of-type(2) {
  391. text-align: center;
  392. color: #333;
  393. font-weight: bold;
  394. }
  395. div:nth-of-type(3) {
  396. text-align: center;
  397. p:nth-of-type(1) {
  398. font-size: .36rem;
  399. font-weight: bold;
  400. color: #333;
  401. margin-bottom: .2rem;
  402. }
  403. }
  404. }
  405. .logistics_bottom {
  406. color: #9f9d9d;
  407. font-size: .26rem;
  408. p {
  409. padding-top: .1rem;
  410. }
  411. }
  412. }
  413. }
  414. .bottom_text {
  415. color: #969799;
  416. text-align: center;
  417. padding-top: 10px;
  418. }
  419. </style>