toDoList.vue 12 KB

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