Browse Source

‘修改页面逻辑’

master
Lj 4 weeks ago
parent
commit
0b314edca4
5 changed files with 119 additions and 95 deletions
  1. +2
    -2
      pages/component/home.vue
  2. +1
    -1
      pages/manager/inspect-result.vue
  3. +2
    -1
      pages/manager/order.vue
  4. +28
    -11
      pages/subcomponent/inspection-detail.vue
  5. +86
    -80
      pages/subcomponent/inspection-report.vue

+ 2
- 2
pages/component/home.vue View File

@ -328,7 +328,7 @@ export default {
this.$api('getRecentGoodsList', {}, res => {
if (res && res.code === 200 && Array.isArray(res.result) && res.result.length > 0) {
this.records = res.result.map(item => ({
id: item.id,
orderId: item.orderId,
image: item.image,
name: item.name,
phone: item.phone,
@ -347,7 +347,7 @@ export default {
},
goToInspectionReport(item) {
uni.navigateTo({
url: `/pages/subcomponent/inspection-report?id=${item.id}`
url: `/pages/subcomponent/inspection-report?orderId=${item.orderId}`
})
},
getFreeCityList() {


+ 1
- 1
pages/manager/inspect-result.vue View File

@ -475,7 +475,7 @@ export default {
const selectedReasonIds = []
this.reasonChecked.forEach((checked, index) => {
if (checked) {
selectedReasonIds.push(this.reasonOptions[index].id.toString())
selectedReasonIds.push(this.reasonOptions[index].reason.toString())
}
})


+ 2
- 1
pages/manager/order.vue View File

@ -244,7 +244,8 @@ export default {
this.isLoading = true
const params = {
pageNo: isLoadMore ? this.pageNo + 1 : 1,
pageSize: this.pageSize
pageSize: this.pageSize,
status: 0
}
console.log(params,'params')
if (this.userId) {


+ 28
- 11
pages/subcomponent/inspection-detail.vue View File

@ -30,7 +30,7 @@
</view>
<view v-for="(item, idx) in problemList" :key="idx" class="problem-block">
<view class="problem-index">{{(idx+1).toString().padStart(2, '0')}} / {{problemList.length.toString().padStart(2, '0')}}</view>
<view class="problem-title">{{testingInstructions || '质量问题'}}</view>
<view class="problem-title">{{item.title}}</view>
<view class="problem-divider"></view>
<view class="problem-label">质量问题实拍</view>
<view class="problem-images">
@ -70,7 +70,7 @@
<text class="timeline-time">{{testingTime}}</text>
</view>
<view class="problem-block">
<view class="problem-index">01 / {{qualifiedImages.length < 10 ? '0' + qualifiedImages.length : qualifiedImages.length}}</view>
<view class="problem-index">01 / {{qualifiedImages.length.toString().padStart(2, '0')}}</view>
<view class="problem-title">质检图片</view>
<view class="problem-divider"></view>
<view class="problem-images">
@ -103,7 +103,6 @@ export default {
return {
status: 'problem', // 'problem' or 'qualified'
testingStatus: '',
testingInstructions: '',
testingTime: '',
testingImages: [],
statusBarHeight: 0,
@ -155,24 +154,42 @@ export default {
if (options.testingStatus) {
this.testingStatus = options.testingStatus
}
// testingInstructions
let testingInstructionsArray = []
if (options.testingInstructions) {
this.testingInstructions = decodeURIComponent(options.testingInstructions)
const instructionsStr = decodeURIComponent(options.testingInstructions)
if (instructionsStr && instructionsStr.trim()) {
//
testingInstructionsArray = instructionsStr.split(',').filter(item => item.trim() !== '')
}
}
if (options.testingTime) {
this.testingTime = decodeURIComponent(options.testingTime)
}
if (options.testingImages) {
//
this.testingImages = decodeURIComponent(options.testingImages).split(',')
this.testingImages = decodeURIComponent(options.testingImages).split(',').filter(item => item.trim() !== '')
}
// status problemList/qualifiedImages
if (this.status === 'problem') {
this.problemList = [
{
title: this.testingInstructions || '质量问题',
images: this.testingImages
}
]
// testingInstructions
if (testingInstructionsArray.length > 0) {
this.problemList = testingInstructionsArray.map((instruction, index) => ({
title: instruction || '质量问题',
images: this.testingImages //
}))
} else {
//
this.problemList = [
{
title: '质量问题',
images: this.testingImages
}
]
}
} else if (this.status === 'qualified') {
this.qualifiedImages = this.testingImages
}


+ 86
- 80
pages/subcomponent/inspection-report.vue View File

@ -41,6 +41,7 @@
<text class="goods-unit">/</text>
<text class="goods-count">x{{item.count}}</text>
</view>
<view class="goods-total">{{item.total}}</view>
</view>
</view>
</view>
@ -63,45 +64,21 @@
<view class="goods-desc">{{item.desc}}</view>
<view class="goods-bottom-row">
<view class="goods-price-row problem-price-row">
<text class="goods-price">{{item.price}}</text>
<text class="goods-unit">/</text>
<!-- <text class="goods-price">{{item.price}}</text>
<text class="goods-unit">/</text> -->
<text class="goods-count">x{{item.count}}</text>
</view>
<!-- <view class="goods-total">{{item.total}}</view> -->
</view>
</view>
</view>
</view>
<view class="summary-row">
<text>件数<text class="highlight">{{problemCount}}</text> </text>
<text>结算金额<text class="highlight">{{problemAmount}}</text></text>
</view>
</view>
<view v-if="showUnrecyclable && unrecyclableList.length" class="inspection-card problem-card">
<view class="report-title">不可回收</view>
<view class="goods-list">
<view class="goods-item" v-for="(item, i) in unrecyclableList" :key="i">
<image class="goods-img" :src="item.img" mode="aspectFit" />
<view class="goods-info">
<view class="goods-row">
<view class="goods-name">{{item.name}}</view>
</view>
<view class="goods-desc">{{item.desc}}</view>
<view class="goods-bottom-row">
<view class="goods-price-row">
<text class="goods-price">{{item.price}}</text>
<text class="goods-unit">/</text>
<text class="goods-count">x{{item.count}}</text>
</view>
<view class="goods-total">0</view>
</view>
</view>
</view>
</view>
<view class="summary-row">
<text>件数<text class="highlight">{{unrecyclableCount}}</text> </text>
<text>结算金额<text class="highlight">0</text></text>
<text>结算金额<text class="highlight"> 0</text></text>
</view>
</view>
</view>
</view>
</template>
@ -119,11 +96,9 @@ export default {
featureTags: ['透明检', '专业验', '公正评', '逐件验'],
goodsList: [], //
problemList: [], //
unrecyclableList: [], //
reportData: null,
showQualified: false,
showProblem: false,
showUnrecyclable: false
showProblem: false
}
},
computed: {
@ -138,9 +113,6 @@ export default {
},
problemAmount() {
return this.problemList.reduce((sum, item) => sum + item.total, 0).toFixed(1)
},
unrecyclableCount() {
return this.unrecyclableList.reduce((sum, item) => sum + item.count, 0)
}
},
onLoad(options) {
@ -148,53 +120,80 @@ export default {
this.statusBarHeight = sysInfo.statusBarHeight
this.navBarHeight = 14
this.navBarTotalHeight = this.statusBarHeight + this.navBarHeight
// id goodsId id
const goodsId = options.id || options.goodsId
if (goodsId) {
this.fetchQualityReport(goodsId)
// orderId
const orderId = options.orderId
if (orderId) {
this.fetchQualityReport(orderId)
}
},
methods: {
async fetchQualityReport(goodsId) {
// this.$api
this.$api && this.$api('getQualityReport', { goodsId }, res => {
async fetchQualityReport(orderId) {
//
this.$api && this.$api('getOrderDetail', { orderId }, res => {
if (res && res.code === 200 && res.result) {
this.reportData = res.result
//
const status = Number(res.result.testingStatus)
// 0: 1: 2:
this.showQualified = status === 1 || status === 0 // 01
this.showProblem = status === 0 || status === 1 // 01
this.showUnrecyclable = status === 2
// /
if (status === 1) {
this.goodsList = [this.mapReportToGoods(res.result)]
this.problemList = []
this.unrecyclableList = []
} else if (status === 0) {
this.goodsList = []
this.problemList = [this.mapReportToGoods(res.result, true)]
this.unrecyclableList = []
} else if (status === 2) {
this.goodsList = []
this.problemList = []
this.unrecyclableList = [this.mapReportToGoods(res.result)]
}
//
this.parseOrderData(res.result)
}
})
},
mapReportToGoods(data, isProblem = false) {
parseOrderData(orderData) {
//
this.goodsList = []
this.problemList = []
// commonOrderList
if (orderData.commonOrderList && orderData.commonOrderList.length > 0) {
orderData.commonOrderList.forEach(mainOrder => {
//
if (mainOrder.commonOrderList && mainOrder.commonOrderList.length > 0) {
mainOrder.commonOrderList.forEach(subOrder => {
this.categorizeOrderItem(subOrder, mainOrder)
})
} else {
//
this.categorizeOrderItem(mainOrder)
}
})
}
//
this.showQualified = this.goodsList.length > 0
this.showProblem = this.problemList.length > 0
},
categorizeOrderItem(orderItem, parentOrder = null) {
const status = Number(orderItem.testingStatus)
const parentData = parentOrder || orderItem
// testingStatus 0-1-
if (status === 0) {
//
this.goodsList.push(this.mapOrderToGoods(orderItem, parentData))
} else if (status === 1) {
//
this.problemList.push(this.mapOrderToGoods(orderItem, parentData, true))
}
// testingStatus = 2 ()
},
mapOrderToGoods(orderItem, parentData, isProblem = false) {
return {
img: data.image,
name: data.title || '未知品类',
desc: data.details || '',
price: data.onePrice || 0,
count: data.num || 1,
total: (data.onePrice || 0) * (data.num || 1),
img: parentData.image || '/static/default-goods.png',
name: parentData.title || '未知品类',
desc: parentData.pinName ? `${parentData.pinName}` :'',
price: parentData.onePrice || 0,
count: orderItem.num || 1,
total: parentData.price,
detail: true,
problemDesc: isProblem ? (data.testingInstructions || '') : ''
testingInstructions: orderItem.testingInstructions || '',
testingImages: orderItem.testingImages || '',
testingTime: orderItem.testingTime || '',
problemDesc: isProblem ? (orderItem.testingInstructions || '') : ''
}
},
async onRefresh() {
//
await new Promise(resolve => setTimeout(resolve, 1000))
@ -204,15 +203,22 @@ export default {
uni.navigateBack()
},
goToInspectionDetail(status) {
//
const d = this.reportData || {}
uni.navigateTo({
url: `/pages/subcomponent/inspection-detail?status=${status}` +
`&testingStatus=${d.testingStatus || ''}` +
`&testingInstructions=${encodeURIComponent(d.testingInstructions || '')}` +
`&testingTime=${encodeURIComponent(d.testingTime || '')}` +
`&testingImages=${encodeURIComponent(d.testingImages || '')}`
})
//
let itemData = null
if (status === 'qualified' && this.goodsList.length > 0) {
itemData = this.goodsList[0]
} else if (status === 'problem' && this.problemList.length > 0) {
itemData = this.problemList[0]
}
if (itemData) {
uni.navigateTo({
url: `/pages/subcomponent/inspection-detail?status=${status}` +
`&testingInstructions=${encodeURIComponent(itemData.testingInstructions || '')}` +
`&testingTime=${encodeURIComponent(itemData.testingTime || '')}` +
`&testingImages=${encodeURIComponent(itemData.testingImages || '')}`
})
}
}
}
}
@ -359,7 +365,7 @@ export default {
border-radius: 32rpx;
box-shadow: 0 8rpx 32rpx rgba(60, 167, 250, 0.08);
padding: 40rpx 32rpx 32rpx 32rpx;
margin: -60rpx auto 0 auto;
margin: 24rpx auto 0 auto;
width: calc(100vw - 64rpx);
max-width: 700rpx;
display: flex;


Loading…
Cancel
Save