spotChecking.vue 5.6 KB

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