listview.vue 11 KB

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