early.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view class="staff">
  3. <view class="search">
  4. <input class="uni-input" v-model="keyword" placeholder="请输入" />
  5. <view class="btn" @click="searchHistory()">搜索</view>
  6. </view>
  7. <scroll-view scroll-y="true" class="main" @scrolltolower="more()">
  8. <view class="list" v-for="(v,i) in aList" :key="i">
  9. <view class="li">
  10. <view class="left">
  11. 产品名称
  12. </view>
  13. <view class="right">
  14. {{v.name}}
  15. </view>
  16. </view>
  17. <view class="li">
  18. <view class="left">
  19. 瓶码
  20. </view>
  21. <view class="right">
  22. {{v.bottleId}}
  23. </view>
  24. </view>
  25. <view class="li">
  26. <view class="left">
  27. 箱码
  28. </view>
  29. <view class="right">
  30. {{v.boxId}}
  31. </view>
  32. </view>
  33. <view class="li">
  34. <view class="left">
  35. 配送单
  36. </view>
  37. <view class="right">
  38. {{v.sendId}}
  39. </view>
  40. </view>
  41. <view class="li">
  42. <view class="left">
  43. 配送日期
  44. </view>
  45. <view class="right">
  46. {{getTime(v.sendTime)}}
  47. </view>
  48. </view>
  49. <view class="li">
  50. <view class="left">
  51. 经销商
  52. </view>
  53. <view class="right">
  54. {{v.agencyName}}
  55. </view>
  56. </view>
  57. <view class="li">
  58. <view class="left">
  59. 经销商所在地
  60. </view>
  61. <view class="right">
  62. {{v.agencyRegion}}
  63. </view>
  64. </view>
  65. <view class="li">
  66. <view class="left">
  67. 上报地点
  68. </view>
  69. <view class="right">
  70. {{v.region}}
  71. </view>
  72. </view>
  73. <view class="li">
  74. <view class="left">
  75. 窜货说明
  76. </view>
  77. <view class="right">
  78. {{v.remark}}
  79. </view>
  80. </view>
  81. <view class="li">
  82. <view class="left">
  83. 上报时间
  84. </view>
  85. <view class="right">
  86. {{getTime(v.submitTime)}}
  87. </view>
  88. </view>
  89. <view class="li">
  90. <view class="left">
  91. 上报人
  92. </view>
  93. <view class="right button" @click="open">
  94. {{v.submit}}
  95. </view>
  96. </view>
  97. </view>
  98. <uni-load-more :status="status" :content-text="contentText" />
  99. </scroll-view>
  100. <view class="sum">
  101. 总计: {{sum}}个上报记录
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import {
  107. search
  108. } from '../../api/fleeing.js'
  109. import {
  110. mapState
  111. } from 'vuex'
  112. export default {
  113. props: ['date'],
  114. data() {
  115. return {
  116. keyword: '',
  117. aList: [], //展示的数据
  118. sum: '',
  119. contentText: {
  120. contentdown: '上拉加载更多',
  121. contentrefresh: '加载中',
  122. contentnomore: '没有更多'
  123. },
  124. pages: 1,
  125. status: 'more',
  126. };
  127. },
  128. watch: {
  129. date(v1, v2) {
  130. this.getData()
  131. }
  132. },
  133. computed: {
  134. ...mapState({
  135. submit: store => store.user.name
  136. })
  137. },
  138. mounted() {
  139. this.getData()
  140. },
  141. methods: {
  142. async getData() {
  143. uni.showLoading({
  144. title: '加载中'
  145. });
  146. let res = await search({
  147. conditions: this.keyword,
  148. submit: this.submit || '',
  149. submitTime: this.date,
  150. type: 0,
  151. num: 10,
  152. page: 1,
  153. accessToken: uni.getStorageSync('tokenInfo'),
  154. account: uni.getStorageSync('account')
  155. })
  156. uni.hideLoading();
  157. this.aList = [...this.aList, ...res.data.list]
  158. this.sum = res.data.count
  159. if(this.sum === this.aList.length){
  160. this.status = "noMore"
  161. }
  162. },
  163. // 获取时间
  164. getTime(time = new Date()) {
  165. let date = new Date(time);
  166. let year = date.getFullYear();
  167. let month = date.getMonth() + 1;
  168. let day = date.getDate();
  169. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  170. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  171. let timer = year + '年' + month + '月' + day + '日';
  172. return timer;
  173. },
  174. searchHistory() {
  175. this.getData()
  176. },
  177. // 上拉加载更多
  178. more() {
  179. if(this.status != "noMore"){
  180. this.status = 'loading'
  181. this.pages++;
  182. this.getData()
  183. }
  184. }
  185. },
  186. }
  187. </script>
  188. <style lang="scss">
  189. .staff {
  190. height: 100%;
  191. display: flex;
  192. flex-direction: column;
  193. justify-content: space-between;
  194. .search {
  195. height: 80rpx;
  196. display: flex;
  197. padding: 10rpx;
  198. border-bottom: 1rpx solid #dfdfdf;
  199. .uni-input {
  200. flex: 1;
  201. height: 100%;
  202. padding-left: 20rpx;
  203. }
  204. .btn {
  205. width: 20%;
  206. height: 100%;
  207. line-height: 80rpx;
  208. text-align: center;
  209. font-size: 30rpx;
  210. background-color: #f4f4f4;
  211. }
  212. }
  213. .main {
  214. height: calc(100% - 200rpx);
  215. padding: 0 20rpx;
  216. box-sizing: border-box;
  217. .list {
  218. border-bottom: 10rpx solid #dfdfdf;
  219. .li {
  220. display: flex;
  221. border-bottom: 1rpx solid #c5c5c5;
  222. padding: 20rpx 0;
  223. &:last-child {
  224. border-bottom: 0;
  225. }
  226. .left {
  227. width: 160rpx;
  228. }
  229. .right {
  230. flex: 1;
  231. color: #707070;
  232. text-align: right;
  233. }
  234. }
  235. }
  236. }
  237. .sum {
  238. height: 120rpx;
  239. line-height: 120rpx;
  240. text-align: center;
  241. color: #e40315;
  242. border-top: 10rpx solid #dfdfdf;
  243. }
  244. }
  245. </style>