index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <!-- 历史记录 -->
  2. <template>
  3. <view class="historicalRecords">
  4. <view class="picker-box-max">
  5. <view class="picker-box">
  6. <picker @change="subChange" :value="subIndex" :range="subList" :range-key="'subName'">
  7. <view class="picker-p" :class="queryParams.subId?'check-picker-p':''">{{queryParams.subId?queryParams.subName:'全部实验室'}}</view>
  8. </picker>
  9. </view>
  10. <view class="picker-box-2" @click="resetButton()">重置</view>
  11. </view>
  12. <view class="check-button-max-box">
  13. <view @click="checkButton('0')" :class="typeIndex == '0'?'check-p':''">已报备待回收</view>
  14. <view @click="checkButton('1')" :class="typeIndex == '1'?'check-p':''">已回收</view>
  15. <view @click="checkButton('2')" :class="typeIndex == '2'?'check-p':''">超期未回收</view>
  16. </view>
  17. <scroll-view scroll-y @scrolltolower="scrollGet" class="for-max-box">
  18. <view class="for-max-big-box" @click="goPage(item)"
  19. v-for="(item,index) in dataList" :key="index">
  20. <view class="for-title-p">报备单编号:{{item.reportNo}}</view>
  21. <view class="for-text-p">报备实验室:{{item.subName}}({{item.roomNum}})</view>
  22. <view class="for-text-p">上门回收日期:{{item.expectTime}}({{item.expectWeek}})</view>
  23. <view class="for-text-p">废物种类:{{item.typeNum}}</view>
  24. <view class="for-text-p">报备人:{{item.reportName}}</view>
  25. <view class="for-text-p">报备时间:{{item.reportTime}}</view>
  26. <view class="for-type-p" :class="item.status=='0'?'colorA':(item.status=='1'?'colorB':(item.status=='2'?'colorC':''))">{{item.status=='0'?'已报备待回收':(item.status=='1'?'已回收':(item.status=='2'?'超期未回收':''))}}</view>
  27. <!-- <view class="for-icon-p">》</view> -->
  28. <img class="for-icon-p" :src="imagesUrl('commonality/icon_04.png')">
  29. </view>
  30. <view class="get-null-box" v-if="getDataType">暂无更多数据</view>
  31. </scroll-view>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. parseTime
  37. } from '@/component/public.js'
  38. import {
  39. hwmsAppWasteOrderList,
  40. hwmsAppWasteOrderHistoryList,
  41. } from '@/pages_hazardousWasteRecycling/api/index.js'
  42. export default {
  43. data() {
  44. return {
  45. subIndex:'',
  46. subList:[],
  47. // 查询参数
  48. getDataType: false,
  49. queryParams: {
  50. page: 1,
  51. pageSize: 10,
  52. subId:null,
  53. subName:null,
  54. },
  55. total: 0,
  56. dataList: [],
  57. typeIndex:"0",
  58. }
  59. },
  60. onLoad(option) {
  61. },
  62. onShow() {
  63. this.hwmsAppWasteOrderList();
  64. this.getList();
  65. },
  66. mounted() {
  67. },
  68. methods: {
  69. resetButton(){
  70. this.$set(this.queryParams,'page', 1);
  71. this.$set(this.queryParams,'subId',null);
  72. this.$set(this.queryParams,'subName',null);
  73. this.$set(this, 'subIndex', '');
  74. this.$set(this, 'dataList', []);
  75. this.$set(this, 'getDataType', false);
  76. this.getList();
  77. },
  78. subChange(e){
  79. this.$set(this,'subIndex',e.detail.value);
  80. this.$set(this.queryParams,'subId',this.subList[e.detail.value].subId);
  81. this.$set(this.queryParams,'subName',this.subList[e.detail.value].subName);
  82. this.$set(this, 'getDataType', false);
  83. this.$set(this, 'dataList', []);
  84. this.$set(this.queryParams, 'page', 1);
  85. this.getList();
  86. },
  87. async hwmsAppWasteOrderList(){
  88. const {
  89. data
  90. } = await hwmsAppWasteOrderList();
  91. if (data.code == 200) {
  92. this.$set(this,'subList',data.data.subjectVos);
  93. }
  94. },
  95. //详情跳转
  96. goPage(item){
  97. uni.navigateTo({
  98. url: "/pages_hazardousWasteRecycling/views/historicalRecords/infoPage?id="+item.id,
  99. });
  100. },
  101. //选项切换
  102. checkButton(type){
  103. if(this.typeIndex != type){
  104. this.$set(this,'typeIndex',type);
  105. this.$set(this, 'getDataType', false);
  106. this.$set(this, 'dataList', []);
  107. this.$set(this.queryParams, 'page', 1);
  108. this.getList();
  109. }
  110. },
  111. //滚动加载事件
  112. scrollGet() {
  113. let self = this;
  114. if (self.total / self.queryParams.pageSize <= self.queryParams.page) {
  115. this.$set(this, 'getDataType', true);
  116. } else {
  117. this.queryParams.page += 1;
  118. this.$nextTick(() => {
  119. this.getList();
  120. })
  121. }
  122. },
  123. //获取列表
  124. async getList() {
  125. let self = this;
  126. let obj = JSON.parse(JSON.stringify(this.queryParams));
  127. obj.status = this.typeIndex;
  128. const {
  129. data
  130. } = await hwmsAppWasteOrderHistoryList(obj);
  131. if (data.code == 200) {
  132. for(let i=0;i<data.data.records.length;i++){
  133. data.data.records[i].reportTime = parseTime(data.data.records[i].reportTime, "{y}-{m}-{d} {h}:{i}:{s}");
  134. }
  135. if(self.queryParams.page == 1){
  136. this.$set(this, 'dataList', data.data.records);
  137. this.$set(this, 'total', data.data.total);
  138. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  139. this.$set(this, 'getDataType', true);
  140. }
  141. }else{
  142. this.$set(this, 'dataList', [...this.dataList, ...data.data.records]);
  143. this.$set(this, 'total', data.data.total);
  144. if (data.data.total / self.queryParams.pageSize <= self.queryParams.page) {
  145. this.$set(this, 'getDataType', true);
  146. }
  147. }
  148. }
  149. },
  150. },
  151. }
  152. </script>
  153. <style lang="stylus" scoped>
  154. .historicalRecords{
  155. height: 100%;
  156. display flex;
  157. flex-direction column;
  158. .get-null-box {
  159. height: 100rpx;
  160. line-height: 100rpx;
  161. color: #999;
  162. text-align center;
  163. }
  164. .picker-box-max{
  165. display: flex;
  166. }
  167. .picker-box-2{
  168. width:100rpx;
  169. border:1rpx solid #dedede;
  170. color:#999;
  171. text-align: center;
  172. line-height:60rpx;
  173. height:60rpx;
  174. margin-top: 20rpx;
  175. border-radius:10rpx;
  176. background-color: #fff;
  177. }
  178. .picker-box{
  179. height:60rpx;
  180. width:572rpx;
  181. margin:20rpx 25rpx;
  182. background-color: #fff
  183. border:1rpx solid #dedede;
  184. border-radius:10rpx;
  185. .picker-p{
  186. padding:0 20rpx;
  187. color:#666;
  188. line-height:60rpx;
  189. }
  190. .check-picker-p{
  191. }
  192. }
  193. .check-button-max-box{
  194. display: flex;
  195. border-radius:10rpx;
  196. border:1rpx solid #fff;
  197. line-height:58rpx;
  198. height:60rpx;
  199. width:700rpx;
  200. margin:0 25rpx 20rpx;
  201. overflow: hidden;
  202. view{
  203. flex:1;
  204. text-align: center;
  205. background-color: #fff;
  206. color:#0183FA;
  207. }
  208. .check-p{
  209. background-color: #0183FA;
  210. color:#fff;
  211. }
  212. }
  213. .for-max-box{
  214. flex: 1;
  215. overflow-y scroll;
  216. padding-bottom:60rpx;
  217. .for-max-big-box{
  218. margin:0 25rpx 25rpx;
  219. background-color: #fff;
  220. border-radius:10rpx;
  221. border:1rpx solid #dedede;
  222. padding:20rpx;
  223. position: relative;
  224. .for-title-p{
  225. font-size:30rpx;
  226. font-weight:700;
  227. line-height:50rpx;
  228. }
  229. .for-text-p{
  230. font-size:30rpx;
  231. line-height:50rpx;
  232. display:block;
  233. overflow:hidden;
  234. text-overflow:ellipsis;
  235. white-space:nowrap;
  236. }
  237. .for-type-p{
  238. position: absolute;
  239. bottom:76rpx;
  240. right:20rpx;
  241. }
  242. .for-icon-p{
  243. width:14rpx;
  244. height:32rpx;
  245. position: absolute;
  246. top:155rpx;
  247. right:20rpx;
  248. font-size:32rpx;
  249. color:#999;
  250. }
  251. .colorA{
  252. color:#0183FA;
  253. }
  254. .colorB{
  255. color:#00CD66;
  256. }
  257. .colorC{
  258. color:#FF6A6A;
  259. }
  260. }
  261. }
  262. }
  263. </style>