代码更新
This commit is contained in:
@@ -60,12 +60,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
const emits = defineEmits(['update:show', 'confirm'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
@@ -83,7 +80,6 @@
|
||||
const form = reactive({
|
||||
note: ''
|
||||
})
|
||||
const emits = defineEmits(['update:show', 'confirm'])
|
||||
let model = ref(null)
|
||||
let modelShow = ref(props.show)
|
||||
let number = ref(0)
|
||||
@@ -101,7 +97,18 @@
|
||||
checked: false
|
||||
}])
|
||||
let timer = null
|
||||
|
||||
watch(() => props.show, (newval) => {
|
||||
modelShow.value = newval
|
||||
})
|
||||
watch(() => modelShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
if (newval) {
|
||||
open()
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
})
|
||||
|
||||
function parseIntNumber(val, isNow) {
|
||||
let newval = val * 1
|
||||
if (newval > props.data.num) {
|
||||
@@ -125,18 +132,7 @@
|
||||
function changeTagSel(item) {
|
||||
item.checked = !item.checked
|
||||
}
|
||||
watch(() => props.show, (newval) => {
|
||||
modelShow.value = newval
|
||||
})
|
||||
watch(() => modelShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
if (newval) {
|
||||
open()
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function toggleModelShow(show) {
|
||||
modelShow.value = show ? true : false
|
||||
}
|
||||
@@ -165,7 +161,10 @@
|
||||
})
|
||||
form.note = ''
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 确认退菜
|
||||
*/
|
||||
function confirm() {
|
||||
const selTag = tags.value.filter(item => item.checked).map(item => item.label).join(",")
|
||||
const note = selTag + (form.note.length > 0 ? "," + form.note : "");
|
||||
@@ -176,10 +175,17 @@
|
||||
if (!note) {
|
||||
return infoBox.showToast("请输入退菜原因");
|
||||
}
|
||||
emits('confirm', {
|
||||
note,
|
||||
num: number.value
|
||||
})
|
||||
let par = {
|
||||
orderId: props.data.orderId,
|
||||
refundAmount: number.value*props.data.unitPrice,
|
||||
refundReason: note,
|
||||
refundDetails: [{
|
||||
id: props.data.id,
|
||||
returnAmount: number.value*props.data.unitPrice,
|
||||
num: number.value,
|
||||
}],
|
||||
}
|
||||
emits('confirm', par)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user