index.vue 9.7 KB

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