index.vue 8.5 KB

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