spotChecking.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="pagesCons">
  3. <view class="tab-body">
  4. <view><u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper></view>
  5. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  6. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, index) in tabList" :key="index">
  7. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  8. <view class="check-order-list" v-for="(item, index) in list" :key="item.id">
  9. <view class="check-row" @click="viewRow(item)">
  10. <view class="createDate">{{ item.createDate }}</view>
  11. <view :class="clsStatus(item.status)">{{ item.status }}</view>
  12. </view>
  13. <view class="check-row" @click="viewRow(item)">
  14. <view>
  15. <view style="font-size: 30upx;margin-bottom: 10upx;">{{ item.name }}</view>
  16. <view style="color: #666666;">{{ item.storeName }}</view>
  17. </view>
  18. <view>
  19. <text v-if="item.status=='待处理'" style="color: #007AFF;">开始点检</text>
  20. <text v-if="item.status=='已完成'" style="color: #007AFF;">查看结果</text>
  21. <u-icon v-if="item.status!='已过期'" name="icon-xian-11" custom-prefix="xd-icon" size="28" color="#888888"></u-icon>
  22. </view>
  23. </view>
  24. </view>
  25. <u-empty :text="noDataText" img-width="120" v-if="list.length == 0 && status != 'loading'" mode="list"></u-empty>
  26. <view style="padding: 20upx;"><u-loadmore v-if="total > pageSize || status == 'loading'" :status="status" /></view>
  27. </scroll-view>
  28. </swiper-item>
  29. </swiper>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import { getTaskList } from '@/api/task.js';
  35. import { getLookUpDatas, listLookUp } from '@/api/data';
  36. import { clzConfirm } from '@/libs/tools.js';
  37. export default {
  38. data() {
  39. return {
  40. status: 'loadmore',
  41. noDataText: '暂无数据',
  42. tabList: [
  43. {
  44. dispName: '全部',
  45. code: 1
  46. },
  47. {
  48. dispName: '待处理',
  49. code: 5
  50. },
  51. {
  52. dispName: '进行中',
  53. code: 4
  54. },
  55. {
  56. dispName: '已完成',
  57. code: 3
  58. },
  59. {
  60. dispName: '已过期',
  61. code: 2
  62. },
  63. ],
  64. typeId:'1',
  65. current: 0,
  66. swiperCurrent: 0,
  67. pageNo: 1,
  68. pageSize: 10,
  69. list: [],
  70. total: 0
  71. };
  72. },
  73. onLoad() {
  74. this.getRow();
  75. },
  76. methods: {
  77. message(title) {
  78. uni.showToast({
  79. icon: 'none',
  80. title: title
  81. });
  82. },
  83. // tabs通知swiper切换
  84. tabsChange(index) {
  85. this.swiperCurrent = index;
  86. },
  87. swiperChange(event) {
  88. console.log(event.detail);
  89. this.list = [];
  90. this.status = 'loading';
  91. },
  92. // swiper-item左右移动,通知tabs的滑块跟随移动
  93. transition(e) {
  94. let dx = e.detail.dx;
  95. this.$refs.uTabs.setDx(dx);
  96. },
  97. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  98. // swiper滑动结束,分别设置tabs和swiper的状态
  99. animationfinish(e) {
  100. let current = e.detail.current;
  101. if (current != this.current) {
  102. this.$refs.uTabs.setFinishCurrent(current);
  103. this.swiperCurrent = current;
  104. this.current = current;
  105. this.getRow();
  106. }
  107. },
  108. // scroll-view到底部加载更多
  109. onreachBottom() {
  110. console.log(this.list.length, this.total);
  111. if (this.list.length < this.total) {
  112. this.pageNo += 1;
  113. this.getRow();
  114. } else {
  115. this.status = 'nomore';
  116. }
  117. },
  118. // 查询列表
  119. getRow(pageNo) {
  120. let _this = this;
  121. if (pageNo) {
  122. this.pageNo = pageNo;
  123. }
  124. this.typeId = this.tabList[this.swiperCurrent].code
  125. let params = {
  126. pageNo: this.pageNo,
  127. pageSize: this.pageSize,
  128. type: '点检任务', // 任务类型
  129. status: this.typeId=='1'?'':this.typeId // 任务状态
  130. };
  131. this.status = 'loading';
  132. getTaskList(params).then(res => {
  133. if (res.code == 200 || res.status == 204 || res.status == 200) {
  134. if (_this.pageNo > 1) {
  135. _this.list = _this.list.concat(res.data.list || []);
  136. } else {
  137. _this.list = res.data.list || [];
  138. }
  139. _this.total = res.data.count || 0;
  140. } else {
  141. _this.list = [];
  142. _this.total = 0;
  143. _this.noDataText = res.message;
  144. }
  145. _this.status = 'loadmore';
  146. });
  147. },
  148. //判断状态,待处理的跳转的开始点检页面,已完成的查看点检结果,已过期的不处理
  149. viewRow(item) {
  150. // 已完成的
  151. if(item.status == '已完成'){
  152. uni.navigateTo({
  153. url: '/pages/spotCheckCenter/spotCheckResult?id=' + item.id
  154. });
  155. }
  156. // 待处理,开始点检
  157. if(item.status == '待处理'){
  158. }
  159. },
  160. clsStatus(status){
  161. if(status == '待处理'){
  162. return 'dcl'
  163. }
  164. if(status == '进行中'){
  165. return 'jxz'
  166. }
  167. if(status == '已完成'){
  168. return 'ywc'
  169. }
  170. if(status == '已过期'){
  171. return 'ygq'
  172. }
  173. }
  174. }
  175. };
  176. </script>
  177. <style lang="scss" scoped>
  178. page {
  179. height: 100%;
  180. }
  181. .pagesCons {
  182. height: 100%;
  183. display: flex;
  184. flex-direction: column;
  185. .tab-body {
  186. .check-list {
  187. height: calc(100vh - 50px);
  188. }
  189. .check-order-list {
  190. background: #ffffff;
  191. padding: 10upx 20upx;
  192. margin: 25upx;
  193. border-radius: 6upx;
  194. box-shadow: 1px 1px 3px #eeeeee;
  195. .check-row {
  196. display: flex;
  197. align-items: center;
  198. padding: 20upx 10upx;
  199. font-size: 28upx;
  200. &:first-child {
  201. border-bottom: 1px dashed #f8f8f8;
  202. font-size: 26upx;
  203. }
  204. &:last-child {
  205. border-top: 1px dashed #f8f8f8;
  206. }
  207. > view {
  208. &:first-child {
  209. flex-grow: 1;
  210. }
  211. }
  212. .action {
  213. margin: 0 6rpx;
  214. padding: 0 20rpx;
  215. color: #fff;
  216. }
  217. .dcl {
  218. color: #f72525;
  219. }
  220. .jxz{
  221. color: #007AFF;
  222. }
  223. .ygq {
  224. color: #999;
  225. }
  226. .ywc {
  227. color: #10c71e;
  228. }
  229. .check-btns {
  230. width: '50%';
  231. display: flex;
  232. align-items: center;
  233. justify-content: flex-end;
  234. > view {
  235. margin-left: 35upx;
  236. font-size: 28upx;
  237. }
  238. }
  239. .u-tag {
  240. border-radius: 0;
  241. }
  242. .uni-icons {
  243. margin: 0 5upx;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. </style>