Commit 374352b8 authored by Facius's avatar Facius

备件订单注释

parent 3ea91751
......@@ -2,42 +2,51 @@
<!-- 备件订单 -->
<view class="ware-house">
<u-navbar back-icon-color="#333333" background="#FFFFFF" title="备件订单" titleColor="#333333"
:border-bottom="false" title-bold></u-navbar>
:border-bottom="false" title-bold></u-navbar>
<!-- 搜索 -->
<view class="search-view" @click.self="handleClickSearch">
<u-search :clearabled="false" disabled @custom="handleClickSearch" placeholder="请输入关键字"
:action-style="actionStyle" placeholder-color="#999999" color="#333333" bg-color="#FFFFFF" height="72"
search-icon-color="#999999">
</u-search>
</view>
</view>
<!-- 各个tab -->
<view class="u-tabs-box">
<u-tabs height="66" activeColor="#2272FF" bg-color="none" inactive-color="#999" bar-height="4"
bar-width="44" :offset="[0,0]" :list="list" count="total" :current="currentIndex" @change="change"
:is-scroll="false" font-size="28" bold></u-tabs>
</view>
</view>
<!-- 列表 -->
<view class="tab-view">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" @scroll="scroll"
:scroll-top="scrollTop" refresher-background="#F4F5F7"
@refresherrefresh="onRefresh" @refresherrestore="onRestore" enable-back-to-top>
@refresherrefresh="onRefresh" @refresherrestore="onRestore" enable-back-to-top>
<!-- 加载中 && 没有下拉:显示加载中 -->
<view class="loading-view" v-if="!loaded && _freshing">
<u-loading mode="flower"></u-loading>
</view>
</view>
<!-- 无数据 -->
<NoOrder v-else-if="noParts" imageName="wupeijianxinxi.png" text="当前暂无备件信息"
:customStyle="noPartsCustomStyle" />
<template v-else>
<template v-else>
<!-- 列表 -->
<view v-for="(item, index) in partsList" :key="item.id">
<AppliedCell @operate="handleOperate" :info="item" @action="handleClickCell" @express="handleClickExpress"></AppliedCell>
</view>
</view>
<!-- 底部加载状态 -->
<view class="load-more-view">
<u-loadmore v-show="(pageNumber == 1 && loaded) || pageNumber > 1" :status="loadStatus"
bgColor="#F4F5F7"></u-loadmore>
</view>
</template>
</scroll-view>
</view>
</view>
<!-- 悬浮申请按钮 -->
<view class="fixed-button">
<ApplyButton :type.sync="buttonType" @click="handleClickApply" />
</view>
</view>
<!-- 通用提示框 -->
<view>
<u-toast ref="uToast" />
</view>
......@@ -58,13 +67,12 @@
return {
pageNumber: 0,
pageSize: 10,
partsList: [],
currentIndex: 0,
loadStatus: 'loading',
loaded: false,
triggered: true,
_freshing: false,
selectedAll: false,
partsList: [], // 备件订单列表
currentIndex: 0, // 当前tab的index
loadStatus: 'loading', // 底部加载状态
loaded: false, // 页面加载
triggered: true, // true:下拉刷新
_freshing: false, // 防止下拉刷新重复触发
buttonType: 'expand' // 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
};
},
......@@ -93,28 +101,24 @@
// 'status': 20
// }
]
},
},
// 当下tab
currentTab() {
return this.list[this.currentIndex]
},
},
// 搜索图标
sousuoImage() {
return process.uniEnv.qn_base_url + 'sousuo.png'
},
},
// 无数据
noParts() {
return this.partsList.length == 0 && this.loaded
},
},
// 无数据页面样式
noPartsCustomStyle() {
return 'margin-top: 100rpx;background-color: #F4F5F7'
},
buttonStyle() {
return {
'background-color': '#2272FF',
'color': '#FFFFFF',
'font-size': '32rpx',
'height': '80rpx',
'width': '200rpx'
}
},
},
// 搜索控件右面'搜索'/'取消'按钮风格
actionStyle() {
return {
'font-size': '32rpx',
......@@ -125,16 +129,16 @@
},
onLoad(e) {
getApp().trackPage('备件订单页')
if (e && e.index) {
if (e && e.index) { // 跳转到第几个tab页
this.currentIndex = e.index
}
this._freshing = false;
this.reloadPartsList()
this.reloadPartsList() // 加载数据
},
onShow() {
onShow() {
let pages = getCurrentPages()
let page = pages[pages.length - 1]
if (page.needRefresh) {
if (page.needRefresh) { // 需要初始化页面
page.needRefresh = null
this.currentIndex = 0
this.reloadPartsList()
......@@ -168,19 +172,20 @@
}
let list = res.data || []
this.partsList.push(...list)
this.loadStatus = list.length < this.pageSize ? 'nomore' : 'loadmore'
this.loadStatus = list.length < this.pageSize ? 'nomore' : 'loadmore' // 底部加载状态
} else {
console.log(res.message)
}
this.$nextTick(()=>{
this.$nextTick(()=>{ // 页面刷新完之后更新下拉状态
if (this._freshing) {
this.triggered = false;
this._freshing = false;
}
})
this.loaded = true
this.loaded = true // 加载完成
});
},
},
// 点击了订单cell的按钮
handleOperate(partsId, operateType) {
this.$u.api[operateType](partsId).then(res => {
var type = 'error'
......@@ -201,58 +206,64 @@
})
})
},
// 点击了订单cell本身,跳转到详情
handleClickCell(info) {
this.setPageInfo(info)
uni.navigateTo({
url: 'pages/mine/warehouse/partsDetail'
})
},
},
// 点击了订单cell的物流号,跳转到物流页面
handleClickExpress(info) {
this.setPageInfo(info)
uni.navigateTo({
url: 'pages/mine/warehouse/express'
})
},
},
// 本页数据设置,用于其他页面访问本页数据
setPageInfo(info) {
var pages = getCurrentPages();
if (pages.length >= 1) {
var page = pages[pages.length - 1];
page.info = info
}
},
},
// 点击了悬浮申请按钮
handleClickApply() {
uni.navigateTo({
url: 'pages/parts/application?applyType=1'
})
},
},
// 点击了搜索,跳转到搜索页面
handleClickSearch() {
var pages = getCurrentPages();
uni.navigateTo({
url: 'pages/mine/warehouse/searchParts'
})
},
radioChange(e) {
this.selectedAll = !this.selectedAll
},
},
// 下拉刷新
onRefresh() {
if (this._freshing) return;
this._freshing = true;
this.reloadPartsList()
},
},
// 重置下拉状态
onRestore() {
this.triggered = 'restore'; // 需要重置
},
},
// 初始化加载
reloadPartsList() { // 第一页数据
this.pageNumber = 0
this.loadStatus = 'loading'
this.getUnstockedList(this.currentTab.status)
},
},
// 滚到底部
reachBottom(e) {
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.getUnstockedList(this.currentTab.status)
},
},
// 滚动触发悬浮按钮变为收起状态
scroll() {
this.buttonType = 'collapse'
},
......
......@@ -230,7 +230,7 @@
url: 'pages/parts/application?applyType=1'
})
},
// 滚动是悬浮按钮收起
// 滚动触发悬浮按钮变为收起状态
scroll() {
this.buttonType = 'collapse'
},
......
......@@ -95,32 +95,11 @@
this.labels = res.data || []
}
},
// 获取品牌
// 获取备件品牌
getBrandList(categoryId) {
this.$u.api.getBrandList({categoryId: categoryId}).then(res => {
if (res.code === 200) {
this.labels = res.data || []
// const data = res.data
// if (data.length > 0) {
// let item, index
// this.brand = data.map((v, i) => {
// if (id && parseInt(id) === v.brandId) {
// item = v
// index = i
// }
// v.label = v.brandName
// return v
// })
// if (item && index) {
// this.selectBrand(item, index)
// this.scrollId = `brand${item.brandId}`
// } else {
// this.brandId = this.brand[0].brandId
// this.lists = []
// this.getPartsList()
// }
// }
}
})
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment