spotChecking.vue 6.4 KB

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