index.vue 6.6 KB

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