listview.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="content">
  3. <!-- 头部 -->
  4. <view class="example-body vertical-layout">
  5. <!-- 用户头像 -->
  6. <!-- <image :src="avatar" class="user" @click="userTo()">
  7. </image> -->
  8. <!-- <view style="width: 100%; height: 98rpx"></view> -->
  9. <view class="falseSearch">
  10. <u-search bgColor="#fff" hover-class="search" @search="getOrderBillsPlansList()"
  11. @confirm="getOrderBillsPlansList()" :showAction="false" placeholder="模糊检索装卸厂家品名"
  12. v-model="condition.orderNo">
  13. </u-search>
  14. <text class="search" hover-class="search-click" @click="getOrderBillsPlansList()">搜索</text>
  15. </view>
  16. </view>
  17. <!-- tab -->
  18. <view style="background-color: #3c9cff;">
  19. <u-tabs :list="tabs" lineColor="#fff" lineWidth="60" @change="change" :activeStyle="{
  20. width: '140rpx',
  21. height: '60rpx',
  22. color: '#fff',
  23. backgroundColor: '#3c9cff',
  24. borderRadius: '80rpx',
  25. lineHeight: '60rpx',
  26. textAlign: 'center'
  27. }" :inactiveStyle="{
  28. width: '140rpx',
  29. height: '60rpx',
  30. color: '#fff',
  31. backgroundColor: '#3c9cff',
  32. borderRadius: '80rpx',
  33. lineHeight: '60rpx',
  34. textAlign: 'center'
  35. }"></u-tabs>
  36. </view>
  37. <!-- 日期 -->
  38. <view style="position: sticky;top: 120rpx;">
  39. <view style="background-color: white">
  40. <uni-datetime-picker v-model="condition.range" @change="datetimePickerChange" type="daterange" />
  41. </view>
  42. </view>
  43. <view class="dataList">
  44. <!-- 列表 -->
  45. <view class="list" v-for="(item,index) in orderBillsPlansList" :key="index"
  46. @click="jumpDetails(item.orderNo, item.status)">
  47. <!-- 头部 -->
  48. <view class="head vertical-layout">
  49. <view class="no" style="font-size: 34rpx;">
  50. <view class="blueStick-blue"></view>
  51. <!-- 车号 -->
  52. <text class="odd">{{ item.carRegNo == null ? '' : item.carRegNo }}</text>
  53. </view>
  54. <view class="date"><!--
  55. <text class="true" v-if="item.status317 == 2">{{ item.billStatusName }}</text>
  56. <text class="yellow"
  57. v-if="item.status317 == 6 && (item.status376 == 0 || item.status376 == 2)">{{ item.billStatusName }}</text>
  58. <text class="false"
  59. v-if="item.status317 == 6 && item.status376 == 6">{{ item.billStatusName }}</text> -->
  60. <!-- <text class="true" v-if="condition.type == 'BD'">{{ item.billStatusName }}</text>
  61. <text class="yellow" v-if="condition.type == 'BX'">{{ item.billStatusName }}</text> -->
  62. <!-- <text style="color: #3c9cff;" v-if="item.billStatusName == '费用已提交'">{{ item.billStatusName }}</text>
  63. <text style="color: green;" v-if="item.billStatusName == '审核通过'">{{ item.billStatusName }}</text>
  64. <text style="color: #fa4434;" v-if="item.billStatusName == '审核驳回'">{{ item.billStatusName }}</text>
  65. <text style="color: #3c9cff;" v-if="item.billStatusName == '里程已提交'">{{ item.billStatusName }}</text>
  66. <text style="color: #fcbd71;" v-if="item.billStatusName == '里程待提交'">{{ item.billStatusName }}</text>
  67. <text style="color: #fcbd71;" v-if="item.billStatusName == '费用待提交'">{{ item.billStatusName }}</text> -->
  68. <text style="color: #55aaff;" v-if="item.billStatusName == '未装车'">{{ item.billStatusName }}</text>
  69. <text style="color: #fcbd71;" v-if="item.billStatusName == '未卸车'">{{ item.billStatusName }}</text>
  70. <text style="color: #3c9cff;" v-if="item.billStatusName == '已卸车'">{{ item.billStatusName }}</text>
  71. <text style="color: #3c9cff;" v-if="item.billStatusName == '已提交'">{{ item.billStatusName }}</text>
  72. <text style="color: green;" v-if="item.billStatusName == '已通过'">{{ item.billStatusName }}</text>
  73. <text style="color: #fa4434;" v-if="item.billStatusName == '已退回'">{{ item.billStatusName }}</text>
  74. <text style="color: #fcbd71;" v-if="item.billStatusName == '未提交'">{{ item.billStatusName }}</text>
  75. </view>
  76. </view>
  77. <view class="details">
  78. <view class="didian">
  79. <view class="text">
  80. <text>{{ item.loadAddr == null ? '' : item.loadAddr }}</text>
  81. </view>
  82. <view class="freight">
  83. <view class="goods">
  84. <text>{{ item.goodsCName == null ? '' : item.goodsCName }}</text>
  85. </view>
  86. <span class="icon iconfont"
  87. style="font-size: 100rpx; color: #fcbd71; height: 80rpx;">&#xe6fb;</span>
  88. <view class="rightqty" style="height: 50rpx;">
  89. <text>{{ item.rightqty == null ? '' : item.rightqty + "吨" }}</text>
  90. </view>
  91. </view>
  92. <view class="text">
  93. <text>{{ item.unLoadAddr == null ? '' : item.unLoadAddr }}</text>
  94. </view>
  95. </view>
  96. <view class="date-transact">
  97. <view class="date">
  98. <text>{{ item.billDate == null ? '' : item.billDate}}</text>
  99. </view>
  100. <view class="transact">
  101. <text>{{ item.transact == null ? '' : item.transact}}</text>
  102. </view>
  103. </view>
  104. <!-- <view class="data">
  105. <text class="key">装货品名</text>
  106. <text class="value">{{ item.goodsCName == null ? '' : item.goodsCName }}
  107. {{ item.rightqty == null ? '' : item.rightqty + "吨" }}</text>
  108. </view>
  109. <view class="data vertical-layout">
  110. <view class="a">
  111. <text class="key">派单日期</text>
  112. <text class="value">{{ item.billDate == null ? '' : item.billDate}}</text>
  113. </view>
  114. <view class="b">
  115. <text class="key">业务员</text>
  116. <text class="value">{{ item.transact == null ? '' : item.transact }}</text>
  117. </view>
  118. </view> -->
  119. </view>
  120. </view>
  121. </view>
  122. <!-- 加载页 -->
  123. <u-loading-page bg-color="rgba(0,0,0,0.5)" color="#fff" loadingColor="#fff" style="z-index: 999;" :loading="loadingPageLoading"></u-loading-page>
  124. </view>
  125. </template>
  126. <script>
  127. import {
  128. orderBillsPlansList
  129. } from "@/api/home"
  130. import storage from '@/utils/storage'
  131. import tab from "../plugins/tab"
  132. export default {
  133. data() {
  134. return {
  135. // 查询条件
  136. condition: {
  137. range: [],
  138. head: 1,
  139. tail: 9
  140. },
  141. // tabs
  142. tabs: [],
  143. // 数据
  144. orderBillsPlansList: [],
  145. show: false,
  146. // 加载页
  147. loadingPageLoading: true
  148. }
  149. },
  150. computed: {
  151. avatar() {
  152. return this.$store.state.user.avatar
  153. }
  154. },
  155. onLoad(option) {
  156. this.condition.type = option.type;
  157. if (option.type == 'BD') {
  158. uni.setNavigationBarTitle({
  159. title: '报单列表'
  160. });
  161. this.tabs = [{
  162. name: '未装车',
  163. }, {
  164. name: '未卸车'
  165. }, {
  166. name: '已卸车'
  167. }, {
  168. name: '已提交'
  169. }]
  170. this.condition.flowType = '未装车'
  171. } else if (option.type == 'BX'){
  172. uni.setNavigationBarTitle({
  173. title: '报销列表'
  174. });
  175. this.tabs = [{
  176. name: '未提交',
  177. }, {
  178. name: '已提交'
  179. }, {
  180. name: '已通过'
  181. }, {
  182. name: '已退回',
  183. badge: {
  184. value: null
  185. }
  186. }]
  187. this.condition.flowType = '未提交'
  188. }
  189. this.getCurrentMonthFirst();
  190. // this.getOrderBillsPlansList();
  191. },
  192. onShow() {
  193. this.orderBillsPlansList = []
  194. this.getOrderBillsPlansList();
  195. },
  196. onReachBottom() {
  197. this.condition.head += 9;
  198. this.condition.tail += 9;
  199. orderBillsPlansList(this.condition).then(res => {
  200. var next_data = res.data.orderBillsPlansList;
  201. if(res.data.numberOfReturns != null) {
  202. this.tabs.forEach(tab => {
  203. if(tab.name === '已退回') {
  204. tab.badge.value = res.data.numberOfReturns;
  205. }
  206. })
  207. }
  208. this.orderBillsPlansList = this.orderBillsPlansList.concat(next_data);
  209. })
  210. },
  211. methods: {
  212. datetimePickerChange(date) {
  213. this.condition.range = date
  214. this.getOrderBillsPlansList();
  215. },
  216. // 查询主页数据
  217. getOrderBillsPlansList(type) {
  218. this.loadingPageLoading = true
  219. this.condition.head = 1;
  220. this.condition.tail = 9;
  221. orderBillsPlansList(this.condition).then(res => {
  222. this.orderBillsPlansList = res.data.orderBillsPlansList;
  223. if(res.data.numberOfReturns != null) {
  224. this.tabs.forEach(tab => {
  225. if(tab.name === '已退回') {
  226. tab.badge.value = res.data.numberOfReturns;
  227. }
  228. })
  229. }
  230. this.loadingPageLoading = false
  231. })
  232. },
  233. // 跳转详情
  234. jumpDetails(orderNo, status) {
  235. if (this.condition.type == 'BD') {
  236. uni.navigateTo({
  237. url: 'particulars/index?orderNo=' + orderNo + '&status=' + status
  238. });
  239. } else if (this.condition.type == 'BX') {
  240. uni.navigateTo({
  241. url: '/pages/particulars/claimExpense/index?orderNo=' + orderNo + '&status=' + status
  242. });
  243. }
  244. },
  245. // 跳转用户信息
  246. userTo() {
  247. uni.navigateTo({
  248. url: 'mine/index'
  249. });
  250. },
  251. change(item) {
  252. this.condition.flowType = item.name
  253. this.getOrderBillsPlansList();
  254. },
  255. //获取当前月份第一天和最后一天
  256. getCurrentMonthFirst() {
  257. var date = new Date();
  258. var nowDate = new Date()
  259. var fullYear = nowDate.getFullYear();
  260. var month = nowDate.getMonth() + 1;
  261. var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
  262. date.setDate(1);
  263. var beginDate = date.toISOString().slice(0, 10);
  264. var endDate = this.getFullDate(new Date().setDate(endOfMonth));
  265. var date1 = new Date();
  266. var date2 = new Date(date1);
  267. //-30为30天前,+30可以获得30天后的日期
  268. date2.setDate(date1.getDate() - 30);
  269. //30天前(月份判断是否小于10,小于10的前面+0)
  270. var agoDay =
  271. `${date2.getFullYear()}-${date2.getMonth() + 1<10?`0${date2.getMonth() + 1}`:date2.getMonth() + 1}`;
  272. var date = date2.getDate() + "";
  273. if (date.length == 1) {
  274. date = 0 + date
  275. }
  276. agoDay += "-" + date
  277. this.condition.range.push(agoDay, endDate);
  278. },
  279. // 日期格式化
  280. getFullDate(targetDate) {
  281. var D, y, m, d;
  282. if (targetDate) {
  283. D = new Date(targetDate);
  284. y = D.getFullYear();
  285. m = D.getMonth() + 1;
  286. d = D.getDate();
  287. } else {
  288. y = fullYear;
  289. m = month;
  290. d = date;
  291. }
  292. m = m > 9 ? m : '0' + m;
  293. d = d > 9 ? d : '0' + d;
  294. return y + '-' + m + '-' + d;
  295. }
  296. },
  297. }
  298. </script>
  299. <style lang="scss">
  300. @import url("/font/iconfont.css");
  301. // 修改布局方向为纵向布局
  302. .vertical-layout {
  303. display: flex;
  304. }
  305. // 文字浅蓝色
  306. .colorBlue {
  307. color: #3c9cff;
  308. }
  309. .blueStick-blue {
  310. width: 10rpx;
  311. height: 100%;
  312. border-radius: 5rpx;
  313. background-color: #3c9cff;
  314. }
  315. .blueStick-red {
  316. width: 10rpx;
  317. height: 100%;
  318. border-radius: 5rpx;
  319. background-color: red;
  320. }
  321. .img {
  322. padding-left: 20rpx;
  323. max-width: 30rpx;
  324. }
  325. // 头部
  326. .example-body {
  327. box-sizing: border-box;
  328. width: 100%;
  329. height: 120rpx;
  330. position: -webkit-sticky;
  331. position: sticky;
  332. top: var(--window-top);
  333. z-index: 99;
  334. background-color: #3c9cff;
  335. padding-left: 40rpx;
  336. align-items: center;
  337. // 用户头像
  338. .user {
  339. width: 90rpx;
  340. height: 90rpx;
  341. border-radius: 45rpx;
  342. background-color: #c4c6c9;
  343. margin-right: 40rpx;
  344. }
  345. // 搜索框
  346. .falseSearch {
  347. height: 80rpx;
  348. border-radius: 35rpx;
  349. width: 680rpx;
  350. display: flex;
  351. background-color: #fff;
  352. align-content: center;
  353. align-items: center;
  354. color: #c4c6c9;
  355. // 搜索按钮
  356. .search {
  357. height: 100%;
  358. border-radius: 35rpx;
  359. color: #303133;
  360. text-align: center;
  361. line-height: 80rpx;
  362. padding: 0 40rpx;
  363. }
  364. .search-click {
  365. background-color: pink;
  366. }
  367. }
  368. }
  369. .dataList {
  370. box-sizing: border-box;
  371. padding-left: 10rpx;
  372. padding-right: 10rpx;
  373. .list {
  374. padding-top: 5rpx;
  375. border-radius: 20rpx;
  376. margin-top: 20rpx;
  377. background-color: white;
  378. padding-bottom: 15rpx;
  379. box-shadow: 1px 1px 2px 2px rgba(76, 76, 76, 0.1);
  380. .head {
  381. height: 50rpx;
  382. margin: 10rpx 20rpx 20rpx 20rpx;
  383. padding-top: 6rpx;
  384. padding-bottom: 6rpx;
  385. // margin-bottom: 20rpx;
  386. display: flex;
  387. align-items: center;
  388. justify-content: space-between;
  389. .no {
  390. height: 100%;
  391. display: flex;
  392. align-items: center;
  393. .odd {
  394. height: 100%;
  395. display: flex;
  396. align-items: center;
  397. padding-left: 15rpx;
  398. font-weight: 700;
  399. }
  400. }
  401. .date {
  402. font-weight: 600;
  403. .true {
  404. color: #fa4434;
  405. }
  406. .yellow {
  407. color: #3c9cff;
  408. }
  409. .false {
  410. color: green;
  411. }
  412. }
  413. }
  414. .details {
  415. color: #3d3e41;
  416. .didian {
  417. display: flex;
  418. justify-content: space-around;
  419. align-items: center;
  420. border-bottom: 2rpx solid #f2f2f0;
  421. .text {
  422. font-size: 36rpx;
  423. font-weight: 600;
  424. }
  425. .freight {
  426. display: flex;
  427. flex-direction: column;
  428. align-items: center;
  429. .goods {
  430. font-weight: 600;
  431. }
  432. .rightqty {
  433. font-weight: 600;
  434. }
  435. }
  436. }
  437. .date-transact {
  438. margin: 0 20rpx;
  439. line-height: 100rpx;
  440. font-size: 34rpx;
  441. font-weight: 600;
  442. // border-bottom: 2rpx solid #f2f2f0;
  443. display: flex;
  444. justify-content: space-between;
  445. }
  446. margin-right: 20rpx;
  447. margin-bottom: 10rpx;
  448. padding-bottom: 4rpx;
  449. margin-left: 20rpx;
  450. .left {
  451. // text-align: right;
  452. width: 35%;
  453. float: left;
  454. }
  455. .right {
  456. width: 50%;
  457. margin-left: 30%;
  458. }
  459. .right-two {
  460. // border-top: 4rpx solid #f0f0f0ff;\
  461. margin-top: 10rpx;
  462. padding-bottom: 10rpx;
  463. }
  464. .data-left {
  465. margin-right: 20rpx;
  466. display: inline-block;
  467. width: 50%;
  468. text-align: right;
  469. }
  470. .data-right {
  471. // width: 50%;
  472. }
  473. .data {
  474. margin-bottom: 10rpx;
  475. .key {
  476. color: #3c9cff;
  477. }
  478. .value {
  479. padding-left: 20rpx;
  480. }
  481. .a {
  482. width: 50%;
  483. }
  484. .b {
  485. width: 50%;
  486. }
  487. }
  488. }
  489. .primary {
  490. float: right;
  491. line-height: 40rpx;
  492. margin-top: 10rpx;
  493. margin-right: 10rpx;
  494. height: 40rpx;
  495. }
  496. }
  497. }
  498. </style>