spotChecking.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. this.$refs.uTabs.setFinishCurrent(current);
  112. this.swiperCurrent = current;
  113. this.current = current;
  114. if(this.status!="nomore"){
  115. this.resetPage();
  116. }
  117. },
  118. // scroll-view到底部加载更多
  119. onreachBottom() {
  120. this.action = 'onreachBottom'
  121. if (this.list.length < this.total) {
  122. this.pageNo += 1;
  123. } else {
  124. this.status = 'nomore';
  125. }
  126. },
  127. resetPage(){
  128. this.status = 'loading';
  129. // 上划分页
  130. if(this.action == 'onreachBottom'){
  131. this.getRow();
  132. }
  133. // 左右切换tab
  134. if(this.action == 'swiperChange'){
  135. this.list = [];
  136. this.getRow(1);
  137. }
  138. },
  139. // 查询列表
  140. getRow(pageNo) {
  141. let _this = this;
  142. if (pageNo) {
  143. this.pageNo = pageNo;
  144. }
  145. let params = {
  146. pageNo: this.pageNo,
  147. pageSize: this.pageSize,
  148. type: '点检任务', // 任务类型
  149. status: this.typeId=='1'?'':this.typeId // 任务状态
  150. };
  151. this.status = 'loading';
  152. getTaskList(params).then(res => {
  153. if (res.code == 200 || res.status == 204 || res.status == 200) {
  154. if (_this.pageNo > 1) {
  155. _this.list = _this.list.concat(res.data.list || []);
  156. } else {
  157. _this.list = res.data.list || [];
  158. }
  159. _this.total = res.data.count || 0;
  160. } else {
  161. _this.list = [];
  162. _this.total = 0;
  163. _this.noDataText = res.message;
  164. }
  165. _this.status = 'loadmore';
  166. });
  167. },
  168. //判断状态,待处理的跳转的开始点检页面,已完成的查看点检结果,已过期的不处理
  169. viewRow(item) {
  170. // 已完成的
  171. if(item.status == '已完成'){
  172. uni.navigateTo({
  173. url: '/pages/spotCheckCenter/spotCheckResult?id=' + item.id
  174. });
  175. }
  176. // 待处理,开始点检
  177. if(item.status == '待处理'){
  178. uni.navigateTo({
  179. url: '/pages/spotCheck/spotCheck?taskId=' + item.id + '&types=video&storeId='+item.storeId+'&storeName='+item.storeName
  180. });
  181. }
  182. },
  183. clsStatus(status){
  184. if(status == '待处理'){
  185. return 'dcl'
  186. }
  187. if(status == '进行中'){
  188. return 'jxz'
  189. }
  190. if(status == '已完成'){
  191. return 'ywc'
  192. }
  193. if(status == '已过期'){
  194. return 'ygq'
  195. }
  196. }
  197. }
  198. };
  199. </script>
  200. <style lang="scss">
  201. page {
  202. height: 100%;
  203. background: #F8F8F8;
  204. }
  205. .pagesCons {
  206. height: 100%;
  207. display: flex;
  208. flex-direction: column;
  209. .tab-body {
  210. .check-list {
  211. height: calc(100vh - 50px);
  212. }
  213. .check-order-list {
  214. background: #ffffff;
  215. padding: 10upx 20upx;
  216. margin: 25upx;
  217. border-radius: 6upx;
  218. box-shadow: 1px 1px 3px #eeeeee;
  219. .check-row {
  220. display: flex;
  221. align-items: center;
  222. padding: 20upx 10upx;
  223. font-size: 28upx;
  224. &:first-child {
  225. border-bottom: 1px dashed #f8f8f8;
  226. font-size: 26upx;
  227. }
  228. &:last-child {
  229. border-top: 1px dashed #f8f8f8;
  230. }
  231. > view {
  232. &:first-child {
  233. flex-grow: 1;
  234. }
  235. }
  236. .action {
  237. margin: 0 6rpx;
  238. padding: 0 20rpx;
  239. color: #fff;
  240. }
  241. .dcl {
  242. color: #f72525;
  243. }
  244. .jxz{
  245. color: #007AFF;
  246. }
  247. .ygq {
  248. color: #999;
  249. }
  250. .ywc {
  251. color: #10c71e;
  252. }
  253. .check-btns {
  254. width: '50%';
  255. display: flex;
  256. align-items: center;
  257. justify-content: flex-end;
  258. > view {
  259. margin-left: 35upx;
  260. font-size: 28upx;
  261. }
  262. }
  263. .u-tag {
  264. border-radius: 0;
  265. }
  266. .uni-icons {
  267. margin: 0 5upx;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. </style>