toDoList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view class="pagesCons">
  3. <!-- 自定义标题 -->
  4. <u-navbar title-color="#fff" back-icon-size="30" back-icon-color="#fff" :border-bottom="false" :background="background" id="navbar">
  5. <view class="slot-wrap">
  6. <view class="left-icon">待办单</view>
  7. <view class="right-icon" @click="intoAddPage">
  8. <u-icon name="plus-circle" color="#fff" size="32"></u-icon>新增
  9. </view>
  10. </view>
  11. </u-navbar>
  12. <view class="tab-body">
  13. <view>
  14. <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
  15. swiperWidth="750"></u-tabs-swiper>
  16. </view>
  17. <view class="all-filter" v-show="current==2">
  18. <u-dropdown>
  19. <u-dropdown-item v-model="createTimeSort" title="发起时间" :options="createTimeSortList"></u-dropdown-item>
  20. <u-dropdown-item v-model="handleTimeSort" title="处理时间" :options="handleTimeSortList"></u-dropdown-item>
  21. </u-dropdown>
  22. <!-- <u-row>
  23. <text>发起时间</text>
  24. <view class="filter-icon">
  25. <u-icon @click="changeSort(0)" name="arrow-up-fill" :color="(sortIndex===0)?'#2979ff':'#888888'" size="24"></u-icon>
  26. <u-icon @click="changeSort(1)" name="arrow-down-fill" :color="(sortIndex===1)?'#2979ff':'#888888'" size="24"></u-icon>
  27. </view>
  28. </u-row>
  29. <u-row>
  30. <text>处理时间</text>
  31. <view class="filter-icon">
  32. <u-icon @click="changeSort(2)" name="arrow-up-fill" :color="(sortIndex===2)?'#2979ff':'#888888'" size="24"></u-icon>
  33. <u-icon @click="changeSort(3)" name="arrow-down-fill" :color="(sortIndex===3)?'#2979ff':'#888888'" size="24"></u-icon>
  34. </view>
  35. </u-row> -->
  36. <view class="filter" @click="showSearch=true">
  37. <text>筛选</text>
  38. <u-icon name="shaixuan" custom-prefix="xd-icon" size="32" color="#888888"></u-icon>
  39. </view>
  40. </view>
  41. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  42. <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
  43. <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
  44. <view
  45. class="check-order-list"
  46. v-if="index==current"
  47. v-for="(item,sindex) in list"
  48. :key="item.id"
  49. @click="viewRow(item)"
  50. >
  51. <view class="check-row">
  52. <view class="ellipsis-one">{{item.storeName}}</view>
  53. <view class="createDate">{{item.createDate}}</view>
  54. </view>
  55. <view class="check-row">
  56. <view class="ellipsis-one">
  57. {{item.clsName}}
  58. </view>
  59. <view class="text-right">
  60. <text>{{item.putUserName}}</text>
  61. </view>
  62. <view class="icon-xian" >
  63. <u-icon name="icon-xian-11" custom-prefix="xd-icon" size="30" color="#888888"></u-icon>
  64. </view>
  65. </view>
  66. <view class="check-row">
  67. <view>
  68. {{item.sourceType}}
  69. </view>
  70. <view class="text-right">
  71. <text class="mark">
  72. 抄送
  73. </text>
  74. <view :class="['status',clsStatus(item.status)]">{{item.status}}</view>
  75. </view>
  76. </view>
  77. </view>
  78. <u-empty :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  79. <view v-if="index==current" style="padding: 20upx;">
  80. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  81. </view>
  82. </scroll-view>
  83. </swiper-item>
  84. </swiper>
  85. </view>
  86. <!-- 待办单查询弹框 -->
  87. <search-modal :visible="showSearch" @openPicke="openPicker" @refresh="refresh" @close="showSearch=false"></search-modal>
  88. </view>
  89. </template>
  90. <script>
  91. import { getBackLogList } from '@/api/backLog.js'
  92. import { getLookUpDatas, listLookUp } from '@/api/data'
  93. import searchModal from './searchModal.vue'
  94. export default {
  95. components: {
  96. searchModal
  97. },
  98. data() {
  99. return {
  100. showSearch: false, // 是否显示搜索弹框
  101. searchParams: null, // 全部查询数据参数
  102. status: 'loadmore',
  103. noDataText: '暂无数据',
  104. background: {
  105. // 渐变色
  106. backgroundImage: 'linear-gradient(45deg, rgb(85, 170, 255), rgb(21, 102, 223))'
  107. },
  108. tabList: [
  109. {
  110. dispName: '发给我的',
  111. typeId: 3,
  112. queryLabel: 'TO_ME' // tab参数
  113. },
  114. {
  115. dispName: '我创建的',
  116. typeId: 1,
  117. queryLabel: 'FROM_ME' // tab参数
  118. },
  119. {
  120. dispName: '全部',
  121. typeId: 2,
  122. queryLabel: 'ALL' // tab参数
  123. },
  124. ],
  125. current: 0,
  126. swiperCurrent: 0,
  127. pageNo: 1,
  128. pageSize: 10,
  129. list: [],
  130. total: 0,
  131. action:'swiperChange', // 操作类型,上划分页,或左右滑动
  132. sortField: 'create_time', // 全部 排序字段 默认按发起时间
  133. sortOrder: 'desc', // 全部 排序字段 默认按发起时间降序
  134. createTimeSort: 'desc',
  135. handleTimeSort: null,
  136. createTimeSortList: [
  137. {
  138. label: '默认排序',
  139. value: ''
  140. },
  141. {
  142. label: '升序',
  143. value: 'asc'
  144. },
  145. {
  146. label: '降序',
  147. value: 'desc'
  148. },
  149. ],
  150. handleTimeSortList: [
  151. {
  152. label: '默认排序',
  153. value: ''
  154. },
  155. {
  156. label: '升序',
  157. value: 'asc'
  158. },
  159. {
  160. label: '降序',
  161. value: 'desc'
  162. },
  163. ],
  164. sortList: [ // 排序列表
  165. {
  166. sortField: 'create_time',
  167. sortOrder: 'asc'
  168. },
  169. {
  170. sortField: 'create_time',
  171. sortOrder: 'desc'
  172. },
  173. {
  174. sortField: 'handle_time',
  175. sortOrder: 'asc'
  176. },
  177. {
  178. sortField: 'handle_time',
  179. sortOrder: 'desc'
  180. }
  181. ],
  182. sortIndex: 1, // 排序下标 默认按发起时间降序
  183. }
  184. },
  185. onLoad() {
  186. this.getRow()
  187. },
  188. methods:{
  189. // tabs通知swiper切换
  190. tabsChange(index) {
  191. this.swiperCurrent = index;
  192. },
  193. swiperChange(event){
  194. this.action = 'swiperChange'
  195. this.status = 'loading'
  196. },
  197. // swiper-item左右移动,通知tabs的滑块跟随移动
  198. transition(e) {
  199. let dx = e.detail.dx;
  200. this.$refs.uTabs.setDx(dx);
  201. },
  202. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  203. // swiper滑动结束,分别设置tabs和swiper的状态
  204. animationfinish(e) {
  205. let current = e.detail.current;
  206. let isCurtab = this.current == current
  207. if(this.status!="nomore"){
  208. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
  209. if(loadData){
  210. this.$refs.uTabs.setFinishCurrent(current);
  211. this.swiperCurrent = current;
  212. this.current = current;
  213. this.resetPage();
  214. }
  215. }
  216. },
  217. // 全部 排序
  218. changeSort (index) {
  219. this.sortIndex = this.sortIndex === index ? null : index
  220. },
  221. // scroll-view到底部加载更多
  222. onreachBottom() {
  223. this.action = 'onreachBottom'
  224. if(this.list.length < this.total){
  225. this.pageNo += 1
  226. this.getRow()
  227. }else{
  228. this.status = "nomore"
  229. }
  230. },
  231. // 查询列表
  232. getRow (pageNo) {
  233. let _this = this
  234. if (pageNo) {
  235. this.pageNo = pageNo
  236. }
  237. let params = {
  238. pageNo: this.pageNo,
  239. pageSize: this.pageSize,
  240. queryLabel: this.tabList[this.current].queryLabel, // tab分类
  241. status: '', // 状态(pending 待整改 check_pending待审核 finished 整改完成 expired 已过期)
  242. sourceType: '', // 问题来源(远程巡店 VIDEO_INSPECTION /现场巡店 SPOT_INSPECTION/点检 POINT_INSPECTION /手动创建 MANUAL)
  243. putUserName: '', // 巡店人
  244. storeName: '', // 门店名称
  245. createTime: '', // 发起时间
  246. sortField: '', // 排序字段 create_time 发起时间 handle_time 处理时间
  247. sortOrder: '' // asc 升序 desc 降序
  248. }
  249. if (params.queryLabel == 'ALL') {
  250. params.sortField = this.sortIndex === null ? '' :this.sortList[this.sortIndex].sortField
  251. params.sortOrder = this.sortIndex === null ? '' :this.sortList[this.sortIndex].sortOrder
  252. }
  253. this.status = "loading"
  254. getBackLogList(params).then(res => {
  255. if (res.code == 200 || res.status == 204 || res.status == 200) {
  256. if(_this.pageNo>1){
  257. _this.list = _this.list.concat(res.data.list || [])
  258. }else{
  259. _this.list = res.data.list || []
  260. }
  261. _this.total = res.data.count || 0
  262. } else {
  263. _this.list = []
  264. _this.total = 0
  265. _this.noDataText = res.message
  266. }
  267. _this.status = "loadmore"
  268. })
  269. },
  270. resetPage(){
  271. this.status = 'loading';
  272. // 上划分页
  273. if(this.action == 'onreachBottom'){
  274. this.getRow();
  275. }
  276. // 左右切换tab
  277. if(this.action == 'swiperChange'){
  278. this.list = [];
  279. this.getRow(1);
  280. }
  281. },
  282. // 查询刷新
  283. refresh(params){
  284. console.log(params,'1111111111')
  285. this.searchParams = params
  286. this.getRow(1)
  287. },
  288. // 新增页
  289. intoAddPage() {
  290. uni.navigateTo({
  291. url: "/pages/toDoList/addBacklog"
  292. })
  293. },
  294. // 详细页
  295. viewRow(item){
  296. // 已完成的
  297. uni.navigateTo({
  298. url: "/pages/toDoList/backlogDetail?id="+item.id
  299. })
  300. },
  301. // 状态颜色处理
  302. clsStatus(status){
  303. if(status == '待审核'){
  304. return 'dsh'
  305. }
  306. if(status == '待整改'){
  307. return 'dzg'
  308. }
  309. if(status == '整改完成'){
  310. return 'ywc'
  311. }
  312. if(status == '已过期'){
  313. return 'ygq'
  314. }
  315. }
  316. }
  317. }
  318. </script>
  319. <style lang="scss" scoped>
  320. page{
  321. height: 100%;
  322. }
  323. /* 自定义导航栏样式 */
  324. .slot-wrap {
  325. display: flex;
  326. align-items: center;
  327. /* 如果您想让slot内容占满整个导航栏的宽度 */
  328. flex: 1;
  329. /* 如果您想让slot内容与导航栏左右有空隙 */
  330. padding: 0 30rpx 0 0;
  331. color: #fff;
  332. font-size: 28upx;
  333. .left-icon{
  334. flex-grow: 1;
  335. font-size: 32upx;
  336. }
  337. .right-icon{
  338. padding-left:50upx;
  339. }
  340. .uni-icons{
  341. margin-right: 10upx;
  342. }
  343. }
  344. .text-right {
  345. text-align: right;
  346. }
  347. .pagesCons{
  348. height: 100%;
  349. display: flex;
  350. flex-direction: column;
  351. .tab-body{
  352. flex: 1;
  353. display: flex;
  354. flex-direction: column;
  355. .check-list{
  356. flex: 1;
  357. overflow-y: scroll;
  358. .swiper-item{
  359. width: 100%;
  360. height: 100%;
  361. overflow: hidden;
  362. .scroll-view {
  363. width: 100%;
  364. height: 100%;
  365. overflow: auto;
  366. }
  367. }
  368. }
  369. // 全部筛选
  370. .all-filter{
  371. width: 100%;
  372. height: 100upx;
  373. display: flex;
  374. align-items: center;
  375. justify-content: space-around;
  376. box-shadow: 1px 1px 3px #EEEEEE;
  377. .filter-icon{
  378. display: flex;
  379. flex-direction: column;
  380. margin-left: 10upx;
  381. }
  382. .filter{
  383. width: 30%;
  384. text-align: center;
  385. }
  386. }
  387. // 列表样式
  388. .check-order-list{
  389. background: #ffffff;
  390. padding: 10upx 20upx;
  391. margin: 25upx;
  392. border-radius: 6upx;
  393. box-shadow: 1px 1px 3px #EEEEEE;
  394. .check-row{
  395. display: flex;
  396. align-items: center;
  397. padding: 20upx 10upx;
  398. font-size: 28upx;
  399. .icon-xian{
  400. text-align: right;
  401. width: 40upx;
  402. }
  403. &:first-child{
  404. border-bottom: 1px dashed #F8F8F8;
  405. .createDate{
  406. // color: #666;
  407. font-size: 26upx;
  408. margin-left: 10upx;
  409. }
  410. }
  411. &:last-child{
  412. border-top: 1px dashed #F8F8F8;
  413. }
  414. > view{
  415. &:first-child{
  416. flex: 1;
  417. }
  418. }
  419. // 抄送标记
  420. .mark {
  421. color: #00C1DE;
  422. padding: 6upx;
  423. font-size: 24upx;
  424. border: 1px solid #00C1DE;
  425. border-radius: 6upx;
  426. margin-right: 10upx;
  427. }
  428. // 状态
  429. .status {
  430. display: inline-block;
  431. width: 150upx;
  432. }
  433. .dsh{
  434. color: red;
  435. }
  436. .dzg{
  437. color: #007AFF;
  438. }
  439. .ygq {
  440. color: #999;
  441. }
  442. .ywc {
  443. color: #10c71e;
  444. }
  445. }
  446. }
  447. }
  448. }
  449. </style>