listview.vue 13 KB

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