| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <template>
- <view>
- <uni-nav-bar
- fixed="true"
- statusBar="true"
- left-icon="back"
- title="报修申请单"
- @clickLeft="back"
- >
- </uni-nav-bar>
- <template>
- <view class="tab-title">
- <view
- v-for="(item, index) in tabList"
- :key="index"
- class="tab-item"
- v-text="item.label"
- :class="index === pickTabIndex ? 'active' : ''"
- @click="changeChartsTab(index)"
- ></view>
- </view>
- <view class="tab-title__placeholder"></view>
- </template>
- <view>
- <OrderTask
- v-for="(item, index) in tabList"
- :key="index"
- v-show="index === pickTabIndex"
- :list="item.list"
- >
- </OrderTask>
- <view class="fixed add">
- <u-button class="button" type="primary" @click="jump">报修</u-button>
- </view>
- </view>
- <!-- <view class="" v-if="pickTabIndex == 1">
- <OrderTask v-for="(item,index) in tabList" :key="index" :type="pickTabIndex+1" v-show="index === pickTabIndex"
- :list="item.list"></OrderTask>
- </view> -->
- </view>
- </template>
- <script>
- import OrderTask from './OrderTask.vue'
- import { post, postJ } from '@/utils/api.js'
- let [page, size, isEnd] = [1, 10, true]
- export default {
- components: {
- OrderTask
- },
- data () {
- return {
- tabList: [
- {
- label: '待执行',
- value: '0',
- list: []
- },
- {
- label: '执行中',
- value: '1',
- list: []
- },
- {
- label: '已完成',
- value: '2',
- list: []
- }
- ],
- pickTabIndex: 0,
- worksheetList: []
- }
- },
- onShow () {
- this.getFirstList()
- },
- onReachBottom: function () {
- if (isEnd) {
- return
- }
- this.getMoreLists()
- },
- methods: {
- jump () {
- uni.navigateTo({
- url: '../repair/index'
- })
- },
- getFirstList: function () {
- page = 1
- isEnd = true
- this.getList()
- },
- getMoreLists: function () {
- //获取更多数据
- page++
- this.getList()
- },
- changeChartsTab (index) {
- this.pickTabIndex = index
- this.getFirstList()
- },
- getList () {
- uni.showLoading({
- title: '加载中'
- })
- let paging = this.URLSearchParams({
- page,
- size
- })
- //2 - 99 [已完成]
- let searchStatus = this.tabList[this.pickTabIndex].value
- postJ(this.apiUrl + `/repair/info/getPage?` + paging, {
- searchStatus: searchStatus
- })
- .then(res => {
- let data = res.data.records
- //let data = [{repairsCode:'asd',sourceCode:'sad',status:'2',id:'1'}]
- let pageTotal = res.data.pages
- if (page === 1) {
- this.tabList[this.pickTabIndex].list = data
- } else {
- data.forEach(element => {
- this.tabList[this.pickTabIndex].list.push(element)
- })
- }
- console.log(this.tabList)
- page < pageTotal ? (isEnd = false) : (isEnd = true)
- })
- .then(() => {
- uni.hideLoading()
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .tab-title {
- position: fixed;
- width: 100%;
- display: flex;
- justify-content: space-between;
- height: 82rpx;
- line-height: 82rpx;
- background-color: #ffffff;
- border-bottom: 1px solid #f2f2f2;
- z-index: 99;
- box-sizing: border-box;
- .tab-item {
- width: 50%;
- text-align: center;
- font-size: 32rpx;
- color: $uni-text-color-grey;
- }
- .tab-item.active {
- color: $j-primary-border-green;
- border-bottom: 1px solid $j-primary-border-green;
- }
- }
- .fixed {
- position: fixed;
- width: 100%;
- left: 0;
- }
- .add {
- bottom: 0;
- }
- .button {
- background-color: #157a2c;
- border: none;
- }
- </style>
|