对接数据库,模拟第三方接入信息
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="header">
|
||||
<text class="back-link" @click="goBack">⬅ 返回</text>
|
||||
<text class="title">运单/轨迹查询 (运维排障)</text>
|
||||
</view>
|
||||
|
||||
@@ -87,27 +88,28 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
async doSearch() {
|
||||
if (!this.searchQuery) return
|
||||
uni.showLoading({ title: '查询中...' })
|
||||
|
||||
setTimeout(() => {
|
||||
this.hasSearched = true
|
||||
const tracking = mockService.getMockTracking(this.searchQuery)
|
||||
const orders = mockService.getMockOrders()
|
||||
const order = orders.find((o: MockOrder): boolean => o.tracking_no === this.searchQuery || o.order_no === this.searchQuery)
|
||||
this.hasSearched = true
|
||||
const tracking = await mockService.getMockTracking(this.searchQuery)
|
||||
const orders = await mockService.getMockOrders()
|
||||
const order = orders.find((o: MockOrder): boolean => o.tracking_no === this.searchQuery || o.order_no === this.searchQuery)
|
||||
|
||||
if (order != null) {
|
||||
this.waybillInfo = order
|
||||
this.events = tracking
|
||||
} else {
|
||||
this.waybillInfo = null
|
||||
this.events = []
|
||||
}
|
||||
|
||||
this.showRaw = new Array(this.events.length).fill(false)
|
||||
uni.hideLoading()
|
||||
}, 600)
|
||||
if (order != null) {
|
||||
this.waybillInfo = order
|
||||
this.events = tracking
|
||||
} else {
|
||||
this.waybillInfo = null
|
||||
this.events = []
|
||||
}
|
||||
|
||||
this.showRaw = new Array(this.events.length).fill(false)
|
||||
uni.hideLoading()
|
||||
},
|
||||
formatTime(time: string) : string {
|
||||
return time
|
||||
@@ -138,16 +140,19 @@
|
||||
}
|
||||
return (maps[code] != null) ? maps[code] : code
|
||||
},
|
||||
runScenario(type: string) {
|
||||
async runScenario(type: string) {
|
||||
if (this.waybillInfo == null) return
|
||||
uni.showModal({
|
||||
title: '确认模拟',
|
||||
content: `是否对 ${this.waybillInfo!.tracking_no} 运行【${type}】场景模拟?`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
mockService.runScenario(this.waybillInfo!.tracking_no, type)
|
||||
uni.showToast({ title: '已触发' })
|
||||
setTimeout(() => this.doSearch(), 1000)
|
||||
uni.showLoading({ title: '处理中...' })
|
||||
mockService.runScenario(this.waybillInfo!.tracking_no, type).then(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '已触发' })
|
||||
this.doSearch()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -163,8 +168,17 @@
|
||||
min-height: 100vh;
|
||||
}
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.back-link {
|
||||
font-size: 28rpx;
|
||||
color: #409eff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.title {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
|
||||
Reference in New Issue
Block a user