spotChecking.vue 6.3 KB

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