Commit 63902080 authored by Facius's avatar Facius

第三轮bug修复

parent 5d58647f
...@@ -72,7 +72,12 @@ ...@@ -72,7 +72,12 @@
}, },
noPartsImage() { noPartsImage() {
return process.uniEnv.qn_base_url + 'no_parts.png' return process.uniEnv.qn_base_url + 'no_parts.png'
}, },
selectedParts() {
return this.lists.filter((item) => {
return item.quantity > 0
})
}
}, },
mounted() { mounted() {
this.getWorkOrderParts() this.getWorkOrderParts()
...@@ -84,7 +89,7 @@ ...@@ -84,7 +89,7 @@
}, },
partsChange(val, index) { partsChange(val, index) {
this.$set(this.lists[index], 'quantity', val) this.$set(this.lists[index], 'quantity', val)
this.valueChange(JSON.stringify(this.lists)) this.valueChange(JSON.stringify(this.selectedParts))
}, },
valChange(val) { valChange(val) {
val.forEach(v => { val.forEach(v => {
...@@ -95,7 +100,7 @@ ...@@ -95,7 +100,7 @@
this.$set(this.lists, index, v) this.$set(this.lists, index, v)
} }
}) })
this.valueChange(JSON.stringify(this.lists)) this.valueChange(JSON.stringify(this.selectedParts))
}, },
toParts() { toParts() {
uni.navigateTo({ uni.navigateTo({
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<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"
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<view class="loading-view" v-if="!loaded"> <view class="loading-view" v-if="!loaded">
<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">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
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" />
...@@ -123,21 +123,21 @@ ...@@ -123,21 +123,21 @@
}, },
}, },
onLoad(e) { onLoad(e) {
getApp().trackPage('备件订单页') getApp().trackPage('备件订单页')
if (e && e.index) { if (e && e.index) {
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.needApplyList) { if (page.needRefresh) {
page.needApplyList = null page.needRefresh = null
this.currentIndex = 0 this.currentIndex = 0
this.reloadPartsList() this.reloadPartsList()
} }
}, },
methods: { methods: {
// tab栏切换 // tab栏切换
...@@ -149,9 +149,9 @@ ...@@ -149,9 +149,9 @@
// 页面数据:未入库 // 页面数据:未入库
getUnstockedList(status) { getUnstockedList(status) {
// 状态处理 // 状态处理
this.pageNumber += 1 this.pageNumber += 1
if (this.pageNumber == 1) { if (this.pageNumber == 1) {
this.loaded = false this.loaded = false
} }
var param = { var param = {
'pageSize': this.pageSize, 'pageSize': this.pageSize,
...@@ -161,21 +161,21 @@ ...@@ -161,21 +161,21 @@
param.status = status //不传值 全部;待签收 15;待发货 10;待审核 1;已取消 -1;已驳回 -2;已签收 20 param.status = status //不传值 全部;待签收 15;待发货 10;待审核 1;已取消 -1;已驳回 -2;已签收 20
} }
this.$u.api.applyList(param).then((res) => { this.$u.api.applyList(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
if (this.pageNumber == 1) { if (this.pageNumber == 1) {
this.partsList = [] this.partsList = []
} }
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
}); });
...@@ -202,23 +202,23 @@ ...@@ -202,23 +202,23 @@
}, },
handleClickCell(info) { handleClickCell(info) {
this.setPageInfo(info) this.setPageInfo(info)
uni.navigateTo({ uni.navigateTo({
url: 'pages/mine/warehouse/partsDetail' url: 'pages/mine/warehouse/partsDetail'
}) })
}, },
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({
...@@ -234,9 +234,9 @@ ...@@ -234,9 +234,9 @@
radioChange(e) { radioChange(e) {
this.selectedAll = !this.selectedAll 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() {
...@@ -247,9 +247,9 @@ ...@@ -247,9 +247,9 @@
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() {
...@@ -311,4 +311,4 @@ ...@@ -311,4 +311,4 @@
} }
} }
</style> </style>
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
var pages = getCurrentPages(); var pages = getCurrentPages();
if (pages.length >= 2) { if (pages.length >= 2) {
var page = pages[pages.length - 2]; var page = pages[pages.length - 2];
page.needApplyList = true page.needRefresh = true
uni.navigateBack() uni.navigateBack()
} }
} }
......
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
onShow() { onShow() {
let pages = getCurrentPages() let pages = getCurrentPages()
let page = pages[pages.length - 1] let page = pages[pages.length - 1]
if (page.needApplyList) { if (page.needRefresh) {
page.needApplyList = null page.needRefresh = null
this.getPartsList() this.getPartsList()
} }
}, },
......
...@@ -41,9 +41,9 @@ ...@@ -41,9 +41,9 @@
submitTxt="退件" :allChecked="subBarInfo.allChecked" :customStyle="customStyle" @select="allSelect" submitTxt="退件" :allChecked="subBarInfo.allChecked" :customStyle="customStyle" @select="allSelect"
@submit="$u.throttle(handleSubmit, 500)" /> @submit="$u.throttle(handleSubmit, 500)" />
</view> </view>
</template> </template>
<view class="fixed-button" v-show="!showBounce"> <view class="fixed-button" v-show="!showBounce">
<ApplyButton :type.sync="buttonType" @click="handleClickApply"/> <ApplyButton :type.sync="buttonType" @click="handleClickApply"/>
</view> </view>
</view> </view>
</template> </template>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
// AppliedCell, // AppliedCell,
NoOrder, NoOrder,
SubmitBar, SubmitBar,
SpareCell, SpareCell,
ApplyButton ApplyButton
}, },
data() { data() {
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
showBounce: false, showBounce: false,
keyword: '', keyword: '',
searchedKeyword: '', searchedKeyword: '',
selectedParts: [], selectedParts: [],
buttonType: 'expand' // 申请按钮宽 collapse': '80rpx', 'expand': '220rpx'' buttonType: 'expand' // 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
}; };
}, },
...@@ -127,7 +127,16 @@ ...@@ -127,7 +127,16 @@
getApp().trackPage('备件库页') getApp().trackPage('备件库页')
this.getReserveList() this.getReserveList()
}, },
onShow() {}, onShow() {
let pages = getCurrentPages();
let page = pages[pages.length - 1];
let needRefresh = page.needRefresh;
if (needRefresh) {
page.needRefresh = false
this.showBounce = false
this.getReserveList()
}
},
methods: { methods: {
getReserveList() { // 备件列表 getReserveList() { // 备件列表
this.loaded = false this.loaded = false
...@@ -142,7 +151,7 @@ ...@@ -142,7 +151,7 @@
this.partsList = [] this.partsList = []
let list = res.data || [] let list = res.data || []
for (var item of list) { for (var item of list) {
item.selected = false item.selected = false
this.partsList.push(item) this.partsList.push(item)
} }
...@@ -169,22 +178,22 @@ ...@@ -169,22 +178,22 @@
handleClickBounce() { handleClickBounce() {
this.showBounce = false this.showBounce = false
for (var item of this.partsList) { for (var item of this.partsList) {
item.selected = false item.selected = false
item.quantity = 0 item.quantity = 0
} }
}, },
allSelect(value) { allSelect(value) {
console.log(value) console.log(value)
for (var item of this.partsList) { for (var item of this.partsList) {
item.selected = value item.selected = value
item.quantity = value ? item.stock : 0 item.quantity = value ? item.stock : 0
} }
}, },
handleChange(value, index) { handleChange(value, index) {
this.partsList[index].selected = value this.partsList[index].selected = value
}, },
handleNumChange(value, index) { handleNumChange(value, index) {
this.partsList[index].quantity = value this.partsList[index].quantity = value
}, },
handleSubmit() { handleSubmit() {
const getSelected = (element) => { const getSelected = (element) => {
...@@ -195,14 +204,14 @@ ...@@ -195,14 +204,14 @@
this.$u.route({ this.$u.route({
url: 'pages/parts/returnParts', url: 'pages/parts/returnParts',
}) })
}, },
handleClickApply() { handleClickApply() {
uni.navigateTo({ uni.navigateTo({
url: 'pages/parts/application?applyType=1' url: 'pages/parts/application?applyType=1'
}) })
}, },
scroll() { scroll() {
this.buttonType = 'collapse' this.buttonType = 'collapse'
}, },
} }
}; };
...@@ -216,16 +225,16 @@ ...@@ -216,16 +225,16 @@
flex-direction: column; flex-direction: column;
.search-view { .search-view {
margin-bottom: 30rpx; margin-bottom: 30rpx;
margin-top: 10rpx; margin-top: 10rpx;
/deep/ .u-search .u-content { /deep/ .u-search .u-content {
padding-left: 40rpx; padding-left: 40rpx;
} }
/deep/ .u-search .u-input { /deep/ .u-search .u-input {
margin: 0 20rpx; margin: 0 20rpx;
} }
/deep/ .u-search .u-icon--right .u-iconfont { /deep/ .u-search .u-icon--right .u-iconfont {
font-size: 36rpx !important; font-size: 36rpx !important;
} }
} }
...@@ -277,11 +286,11 @@ ...@@ -277,11 +286,11 @@
position: absolute; position: absolute;
} }
} }
.fixed-button { .fixed-button {
position: fixed; position: fixed;
right: 20rpx; right: 20rpx;
bottom: 64rpx; bottom: 64rpx;
} }
} }
</style> </style>
...@@ -352,8 +352,8 @@ ...@@ -352,8 +352,8 @@
this.loadOrderDetail() this.loadOrderDetail()
this.loadOrderRecord() this.loadOrderRecord()
} }
if (page.needApplyList) { if (page.needRefresh) {
page.needApplyList = null page.needRefresh = null
this.getApplyList() this.getApplyList()
} }
}, },
......
...@@ -76,36 +76,19 @@ ...@@ -76,36 +76,19 @@
return process.uniEnv.qn_base_url + src return process.uniEnv.qn_base_url + src
}, },
goBack() { goBack() {
if(this.isParts){ var pages = getCurrentPages();
var pages = getCurrentPages(); if(pages.length >= 2) {
if(pages.length >= 2) { var prevPage = pages[pages.length - 2];
var prevPage = pages[pages.length - 2]; prevPage.needRefresh = true
prevPage.needApplyList = true }
} if(this.isParts){ // 添加备件
this.$u.route({type:'back'}) this.$u.route({type:'back'})
} }
if(this.isReturn){ if(this.isReturn){ // 退件
// uni.switchTab({
// url: '/pages/index/mine',
// complete: () => {
// this.$nextTick(()=>{
// uni.navigateTo({
// url: 'pages/mine/warehouse/return'
// });
// })
// }
// });
uni.redirectTo({ uni.redirectTo({
url: 'pages/mine/warehouse/return' url: 'pages/mine/warehouse/return'
}); });
// var pages = getCurrentPages();
// if(pages.length >= 4) {
// var prevPage = pages[pages.length - 4];
// this.$u.route({type:'back', delta: 3})
// prevPage.$vm.$u.route({url: 'pages/mine/warehouse/return'})
// } else {
// this.$u.route({type:'back'})
// }
} }
}, },
copyText(e) { copyText(e) {
......
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