index.vue 8.1 KB

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