feat: 【小程序】重复异常上报时,显示出上一次提交的数据

This commit is contained in:
苟川东 2025-05-27 16:18:27 +08:00
parent ff69e572d3
commit a4d60955d8

View File

@ -5,7 +5,7 @@
<view class="item input flex-sb line-after">
<view class="title flex-l">异常原因</view>
<view v-if="submitData.abnormal_id === 0" class="select-ctr flex-r">请选择异常原因</view>
<view v-else class="select-ctr flex-r select">{{typeList[typeListIndex].title}}</view>
<view v-else class="select-ctr flex-r select">{{ abnormalTitle }}</view>
</view>
</picker>
@ -18,7 +18,7 @@
</view>
<me-empty-space height="376"></me-empty-space>
<view class="bottom">
<me-button @click="submit()" text="立即上报" width="686rpx" icon-type="icon-arrow-up-line" margin-top="32rpx"></me-button>
<me-button @click="submit()" :text="submitText" width="686rpx" icon-type="icon-arrow-up-line" margin-top="32rpx"></me-button>
</view>
</view>
</template>
@ -28,7 +28,7 @@
import MeEmptySpace from "../../components/me-empty-space/me-empty-space.vue";
import MeButton from "../../components/me-button/me-button.vue";
import helpers from "../../utils/helpers";
import {ref, reactive} from 'vue'
import {ref, reactive, computed} from 'vue'
import {onLoad} from '@dcloudio/uni-app'
import api from "../../api/api";
import {throttle} from "../../utils/throttle";
@ -40,6 +40,23 @@ const bindPickerChange = (e) => {
const typeListIndex = ref(0)
const abnormalTitle = computed(() => {
if (submitData.abnormal_id === 0 || typeList.value === null) {
return ''
}
const match = typeList.value.find(item => item.id === submitData.abnormal_id)
return match ? match.title : ''
})
const submitText = computed(() => {
if (orderInfo.value === null) {
return '立即上报'
}
return '再次上报'
})
//
const submit = throttle(() => {
if (!validate()) {
@ -78,7 +95,18 @@ const submit = throttle(() => {
});
})
const orderInfo = ref(null)
const init = () => {
api.orderAbnormalInfo({order_id: orderId.value}).then(res => {
if (res.id !== undefined) {
orderInfo.value = res
submitData.abnormal_id = orderInfo.value.abnormal_id
submitData.detail = orderInfo.value.detail
}
helpers.delayHideLoading()
}).catch(() => {})
api.findExceptionTypeList().then(res => {
typeList.value = res
}).catch(() => {}).finally(() => {