优化
This commit is contained in:
+20
-15
@@ -117,7 +117,8 @@
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<view class="bottom-btns" v-if="!form.State || form.State === 0">
|
||||
<u-button size="medium" type="primary" :disabled="disabledBtn" @click="handleSave(0)">保存</u-button>
|
||||
<u-button v-if="form.Id" size="medium" type="primary" :disabled="disabledBtn" @click="handleSave(0,true)">保存</u-button>
|
||||
<u-button v-else size="medium" type="primary" :disabled="disabledBtn" @click="handleSave(0)">保存</u-button>
|
||||
<u-button v-if="form.Id" size="medium" type="success" :disabled="disabledBtn"
|
||||
@click="handleSave(1)">发货</u-button>
|
||||
</view>
|
||||
@@ -251,7 +252,7 @@
|
||||
// ===== 单位选择 =====
|
||||
const showUnitSelect = ref(false)
|
||||
const unitList = ref([])
|
||||
const selectedUnit = ref()
|
||||
const selectedUnit = ref({})
|
||||
|
||||
// ===== 包装列表 =====
|
||||
const BZList = ref([])
|
||||
@@ -283,9 +284,9 @@
|
||||
}
|
||||
|
||||
// ===== 单位选择确认 =====
|
||||
const handleUnitConfirm = () => {
|
||||
form.value.UnitId = selectedUnit.value.UnitId
|
||||
form.value.UnitName = selectedUnit.value.UnitName
|
||||
const handleUnitConfirm = (item) => {
|
||||
form.value.UnitId = item.UnitId
|
||||
form.value.UnitName = item.UnitName
|
||||
showUnitSelect.value = false
|
||||
}
|
||||
|
||||
@@ -487,7 +488,7 @@
|
||||
}
|
||||
|
||||
// ===== 保存 =====
|
||||
const handleSave = (type) => {
|
||||
const handleSave = (type, isSkip=false) => {
|
||||
if (!form.value.TrainNumber) {
|
||||
return uni.showToast({
|
||||
title: '请输入车次',
|
||||
@@ -560,7 +561,7 @@
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
saveTrainNumber(params)
|
||||
saveTrainNumber(params,true)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -571,25 +572,29 @@
|
||||
}
|
||||
|
||||
// 保存车次信息
|
||||
const saveTrainNumber = async (params) => {
|
||||
const saveTrainNumber = async (params,isSkip=false) => {
|
||||
try {
|
||||
disabledBtn.value = true
|
||||
const res = await reqSaveTrainNumber(params)
|
||||
if(isSkip){
|
||||
uni.showToast({
|
||||
title: params.State === 1 ? '发货成功' : '保存成功',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
return
|
||||
}
|
||||
if (res.code === 1) {
|
||||
// 更新表单状态
|
||||
form.value.Id = res.data?.id || form.value.Id
|
||||
form.value.Id = res.data?.id
|
||||
form.value.State = params.State
|
||||
|
||||
uni.showToast({
|
||||
title: params.State === 1 ? '发货成功' : '保存成功',
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}, 900)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg || '操作失败',
|
||||
|
||||
Reference in New Issue
Block a user