feat: 异常支持重复上传

This commit is contained in:
苟川东 2025-04-28 16:28:07 +08:00
parent 0050d4989a
commit e1decb94cf

View File

@ -1,32 +1,23 @@
<template> <template>
<view class="ctr" v-if="orderInfo !== null"> <view class="ctr">
<view class="form-group"> <view class="form-group">
<template v-if="orderInfo.length === 0"> <picker @change="bindPickerChange" range-key="title" :range="typeList">
<picker @change="bindPickerChange" range-key="title" :range="typeList">
<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>
</picker>
</template>
<template v-else>
<view class="item input flex-sb line-after"> <view class="item input flex-sb line-after">
<view class="title flex-l">异常原因</view> <view class="title flex-l">异常原因</view>
<view class="select-ctr flex-r select">{{orderInfo.abnormal_title}}</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> </view>
</template> </picker>
<view class="textarea"> <view class="textarea">
<view class="title flex-l">异常说明</view> <view class="title flex-l">异常说明</view>
<view class="value"> <view class="value">
<textarea maxlength="200" v-if="orderInfo.length === 0" :disable-default-padding="true" class="input-textarea" v-model="submitData.detail" placeholder-class="placeholder-class" placeholder="请输入异常说明200字以内"/> <textarea maxlength="200" :disable-default-padding="true" class="input-textarea" v-model="submitData.detail" placeholder-class="placeholder-class" placeholder="请输入异常说明200字以内"/>
<textarea maxlength="200" v-else disabled="disabled" :disable-default-padding="true" class="input-textarea" v-model="orderInfo.detail" placeholder-class="placeholder-class" placeholder="请输入异常说明200字以内"/>
</view> </view>
</view> </view>
</view> </view>
<me-empty-space height="376"></me-empty-space> <me-empty-space height="376"></me-empty-space>
<view class="bottom" v-if="orderInfo.length === 0"> <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="立即上报" width="686rpx" icon-type="icon-arrow-up-line" margin-top="32rpx"></me-button>
</view> </view>
</view> </view>
@ -69,10 +60,17 @@ const submit = throttle(() => {
api.createOrderAbnormal(submitData).then(() => { api.createOrderAbnormal(submitData).then(() => {
helpers.delayHideLoading() helpers.delayHideLoading()
uni.showToast({ uni.showModal({
title: '完成上报', title: '提示信息',
icon: "success" showCancel: false,
}) content: '异常已上报',
success: function (res) {
if (res.confirm) {
uni.navigateBack();
}
}
});
init() init()
}).catch(() => {}) }).catch(() => {})
} }
@ -80,6 +78,14 @@ const submit = throttle(() => {
}); });
}) })
const init = () => {
api.findExceptionTypeList().then(res => {
typeList.value = res
}).catch(() => {}).finally(() => {
helpers.delayHideLoading()
})
}
const orderId = ref(null) const orderId = ref(null)
onLoad((params) => { onLoad((params) => {
orderId.value = params.order_id orderId.value = params.order_id
@ -89,25 +95,7 @@ onLoad((params) => {
init() init()
}) })
const orderInfo = ref(null)
const typeList = ref(null) const typeList = ref(null)
const init = () => {
api.orderAbnormalInfo({order_id: orderId.value}).then(res => {
orderInfo.value = res
if (orderInfo.value.id !== undefined) {
uni.setNavigationBarTitle({
title: '上报详情',
})
}
helpers.delayHideLoading()
}).catch(() => {})
api.findExceptionTypeList().then(res => {
typeList.value = res
}).catch(() => {})
}
// //
const submitData = reactive({ const submitData = reactive({