listview.vue 13 KB

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