index.vue 6.7 KB

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