listview.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  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: '150rpx',
  21. height: '60rpx',
  22. color: '#fff',
  23. backgroundColor: '#3c9cff',
  24. borderRadius: '80rpx',
  25. lineHeight: '60rpx',
  26. textAlign: 'center'
  27. }" :inactiveStyle="{
  28. width: '150rpx',
  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. export default {
  132. data() {
  133. return {
  134. // 查询条件
  135. condition: {
  136. range: [],
  137. head: 1,
  138. tail: 9
  139. },
  140. // tabs
  141. tabs: [],
  142. // 数据
  143. orderBillsPlansList: [],
  144. show: false,
  145. // 加载页
  146. loadingPageLoading: true
  147. }
  148. },
  149. computed: {
  150. avatar() {
  151. return this.$store.state.user.avatar
  152. }
  153. },
  154. onLoad(option) {
  155. this.condition.type = option.type;
  156. if (option.type == 'BD') {
  157. uni.setNavigationBarTitle({
  158. title: '报单列表'
  159. });
  160. this.tabs = [{
  161. name: '未装车',
  162. }, {
  163. name: '未卸车'
  164. }, {
  165. name: '已卸车'
  166. }, {
  167. name: '已提交'
  168. }]
  169. this.condition.flowType = '未装车'
  170. } else if (option.type == 'BX'){
  171. uni.setNavigationBarTitle({
  172. title: '报销列表'
  173. });
  174. this.tabs = [{
  175. name: '未提交',
  176. }, {
  177. name: '已提交'
  178. }, {
  179. name: '已通过'
  180. }, {
  181. name: '已退回'
  182. }]
  183. this.condition.flowType = '未提交'
  184. }
  185. this.getCurrentMonthFirst();
  186. // this.getOrderBillsPlansList();
  187. },
  188. onShow() {
  189. this.orderBillsPlansList = []
  190. this.getOrderBillsPlansList();
  191. },
  192. onReachBottom() {
  193. this.condition.head += 9;
  194. this.condition.tail += 9;
  195. orderBillsPlansList(this.condition).then(res => {
  196. var next_data = res.data;
  197. this.orderBillsPlansList = this.orderBillsPlansList.concat(next_data);
  198. })
  199. },
  200. methods: {
  201. datetimePickerChange(date) {
  202. this.condition.range = date
  203. this.getOrderBillsPlansList();
  204. },
  205. // 查询主页数据
  206. getOrderBillsPlansList(type) {
  207. this.loadingPageLoading = true
  208. this.condition.head = 1;
  209. this.condition.tail = 9;
  210. orderBillsPlansList(this.condition).then(res => {
  211. this.orderBillsPlansList = res.data;
  212. this.loadingPageLoading = false
  213. })
  214. },
  215. // 跳转详情
  216. jumpDetails(orderNo, status) {
  217. if (this.condition.type == 'BD') {
  218. uni.navigateTo({
  219. url: 'particulars/index?orderNo=' + orderNo + '&status=' + status
  220. });
  221. } else if (this.condition.type == 'BX') {
  222. uni.navigateTo({
  223. url: '/pages/particulars/claimExpense/index?orderNo=' + orderNo + '&status=' + status
  224. });
  225. }
  226. },
  227. // 跳转用户信息
  228. userTo() {
  229. uni.navigateTo({
  230. url: 'mine/index'
  231. });
  232. },
  233. change(item) {
  234. this.condition.flowType = item.name
  235. this.getOrderBillsPlansList();
  236. },
  237. //获取当前月份第一天和最后一天
  238. getCurrentMonthFirst() {
  239. var date = new Date();
  240. var nowDate = new Date()
  241. var fullYear = nowDate.getFullYear();
  242. var month = nowDate.getMonth() + 1;
  243. var endOfMonth = new Date(fullYear, month, 0).getDate(); // 获取本月最后一天
  244. date.setDate(1);
  245. var beginDate = date.toISOString().slice(0, 10);
  246. var endDate = this.getFullDate(new Date().setDate(endOfMonth));
  247. var date1 = new Date();
  248. var date2 = new Date(date1);
  249. //-30为30天前,+30可以获得30天后的日期
  250. date2.setDate(date1.getDate() - 30);
  251. //30天前(月份判断是否小于10,小于10的前面+0)
  252. var agoDay =
  253. `${date2.getFullYear()}-${date2.getMonth() + 1<10?`0${date2.getMonth() + 1}`:date2.getMonth() + 1}`;
  254. var date = date2.getDate() + "";
  255. if (date.length == 1) {
  256. date = 0 + date
  257. }
  258. agoDay += "-" + date
  259. this.condition.range.push(agoDay, endDate);
  260. },
  261. // 日期格式化
  262. getFullDate(targetDate) {
  263. var D, y, m, d;
  264. if (targetDate) {
  265. D = new Date(targetDate);
  266. y = D.getFullYear();
  267. m = D.getMonth() + 1;
  268. d = D.getDate();
  269. } else {
  270. y = fullYear;
  271. m = month;
  272. d = date;
  273. }
  274. m = m > 9 ? m : '0' + m;
  275. d = d > 9 ? d : '0' + d;
  276. return y + '-' + m + '-' + d;
  277. }
  278. },
  279. }
  280. </script>
  281. <style lang="scss">
  282. @import url("/font/iconfont.css");
  283. // 修改布局方向为纵向布局
  284. .vertical-layout {
  285. display: flex;
  286. }
  287. // 文字浅蓝色
  288. .colorBlue {
  289. color: #3c9cff;
  290. }
  291. .blueStick-blue {
  292. width: 10rpx;
  293. height: 100%;
  294. border-radius: 5rpx;
  295. background-color: #3c9cff;
  296. }
  297. .blueStick-red {
  298. width: 10rpx;
  299. height: 100%;
  300. border-radius: 5rpx;
  301. background-color: red;
  302. }
  303. .img {
  304. padding-left: 20rpx;
  305. max-width: 30rpx;
  306. }
  307. // 头部
  308. .example-body {
  309. box-sizing: border-box;
  310. width: 100%;
  311. height: 120rpx;
  312. position: -webkit-sticky;
  313. position: sticky;
  314. top: var(--window-top);
  315. z-index: 99;
  316. background-color: #3c9cff;
  317. padding-left: 40rpx;
  318. align-items: center;
  319. // 用户头像
  320. .user {
  321. width: 90rpx;
  322. height: 90rpx;
  323. border-radius: 45rpx;
  324. background-color: #c4c6c9;
  325. margin-right: 40rpx;
  326. }
  327. // 搜索框
  328. .falseSearch {
  329. height: 80rpx;
  330. border-radius: 35rpx;
  331. width: 680rpx;
  332. display: flex;
  333. background-color: #fff;
  334. align-content: center;
  335. align-items: center;
  336. color: #c4c6c9;
  337. // 搜索按钮
  338. .search {
  339. height: 100%;
  340. border-radius: 35rpx;
  341. color: #303133;
  342. text-align: center;
  343. line-height: 80rpx;
  344. padding: 0 40rpx;
  345. }
  346. .search-click {
  347. background-color: pink;
  348. }
  349. }
  350. }
  351. .dataList {
  352. box-sizing: border-box;
  353. padding-left: 10rpx;
  354. padding-right: 10rpx;
  355. .list {
  356. padding-top: 5rpx;
  357. border-radius: 20rpx;
  358. margin-top: 20rpx;
  359. background-color: white;
  360. padding-bottom: 15rpx;
  361. box-shadow: 1px 1px 2px 2px rgba(76, 76, 76, 0.1);
  362. .head {
  363. height: 50rpx;
  364. margin: 10rpx 20rpx 20rpx 20rpx;
  365. padding-top: 6rpx;
  366. padding-bottom: 6rpx;
  367. // margin-bottom: 20rpx;
  368. display: flex;
  369. align-items: center;
  370. justify-content: space-between;
  371. .no {
  372. height: 100%;
  373. display: flex;
  374. align-items: center;
  375. .odd {
  376. height: 100%;
  377. display: flex;
  378. align-items: center;
  379. padding-left: 15rpx;
  380. font-weight: 700;
  381. }
  382. }
  383. .date {
  384. font-weight: 600;
  385. .true {
  386. color: #fa4434;
  387. }
  388. .yellow {
  389. color: #3c9cff;
  390. }
  391. .false {
  392. color: green;
  393. }
  394. }
  395. }
  396. .details {
  397. color: #3d3e41;
  398. .didian {
  399. display: flex;
  400. justify-content: space-around;
  401. align-items: center;
  402. border-bottom: 2rpx solid #f2f2f0;
  403. .text {
  404. font-size: 36rpx;
  405. font-weight: 600;
  406. }
  407. .freight {
  408. display: flex;
  409. flex-direction: column;
  410. align-items: center;
  411. .goods {
  412. font-weight: 600;
  413. }
  414. .rightqty {
  415. font-weight: 600;
  416. }
  417. }
  418. }
  419. .date-transact {
  420. margin: 0 20rpx;
  421. line-height: 100rpx;
  422. font-size: 34rpx;
  423. font-weight: 600;
  424. // border-bottom: 2rpx solid #f2f2f0;
  425. display: flex;
  426. justify-content: space-between;
  427. }
  428. margin-right: 20rpx;
  429. margin-bottom: 10rpx;
  430. padding-bottom: 4rpx;
  431. margin-left: 20rpx;
  432. .left {
  433. // text-align: right;
  434. width: 35%;
  435. float: left;
  436. }
  437. .right {
  438. width: 50%;
  439. margin-left: 30%;
  440. }
  441. .right-two {
  442. // border-top: 4rpx solid #f0f0f0ff;\
  443. margin-top: 10rpx;
  444. padding-bottom: 10rpx;
  445. }
  446. .data-left {
  447. margin-right: 20rpx;
  448. display: inline-block;
  449. width: 50%;
  450. text-align: right;
  451. }
  452. .data-right {
  453. // width: 50%;
  454. }
  455. .data {
  456. margin-bottom: 10rpx;
  457. .key {
  458. color: #3c9cff;
  459. }
  460. .value {
  461. padding-left: 20rpx;
  462. }
  463. .a {
  464. width: 50%;
  465. }
  466. .b {
  467. width: 50%;
  468. }
  469. }
  470. }
  471. .primary {
  472. float: right;
  473. line-height: 40rpx;
  474. margin-top: 10rpx;
  475. margin-right: 10rpx;
  476. height: 40rpx;
  477. }
  478. }
  479. }
  480. </style>