spotChecking.vue 6.8 KB

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