Commit 374352b8 authored by Facius's avatar Facius

备件订单注释

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