spotChecking.vue 6.2 KB

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