FinanceEdit.vue
5.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<template>
<template>
<BasicDrawer
@register="register"
v-bind="$attrs"
title="编辑"
width="30%"
:isDetail="true"
@ok="handleSubmit"
:showDetailBack="false"
okText="保存"
showFooter
:destroyOnClose="true"
>
<!-- <div>
<BasicForm @register="registerForm" />
</div> -->
<div style="font-size: 15px">包装费用实际金额¥</div>
<a-input
v-model:value="input1"
placeholder="请输入"
:disabled="status === 'LOCKED'"
auto-size
/>
<div style="margin: 16px 0"></div>
<div style="font-size: 15px">跟单评分</div>
<a-input
v-model:value="input2"
placeholder="请输入"
:disabled="status_score === 'LOCKED'"
auto-size
/>
<div style="margin: 16px 0"></div>
<div style="font-size: 15px">已发提成</div>
<a-input
v-model:value="input_issuedCommission"
placeholder="请输入"
:disabled="status_issuedCommission === 'LOCKED'"
auto-size
/>
<div style="margin: 16px 0"></div>
<!-- <template #titleToolbar> <a-button type="primary"> 申请编辑权限 </a-button></template> -->
<template #appendFooter>
<!-- <a-button type="primary" @click="onGoCheckDetail"> 申请权限</a-button> -->
</template>
</BasicDrawer>
</template>
</template>
<script lang="ts" setup>
import { BasicDrawer, useDrawerInner } from '@/components/Drawer';
import { BasicForm, FormSchema, useForm } from '@/components/Form';
import { defineComponent, ref, computed, unref, toRaw, reactive } from 'vue';
import { getPackageEdit } from '@/api/project/invoice';
import { useMessage } from '/@/hooks/web/useMessage';
import { ROLE } from './type.d';
const emit = defineEmits(['success']);
const role = computed(() => {
return user?.roleSmallVO?.code;
});
const schemas: FormSchema[] = [
// {
// field: 'totalPayAmount',
// component: 'InputNumber',
// labelWidth: 250,
// colProps: {
// span: 23,
// },
// label: '实际应收金额',
// },
{
field: 'actualPayedAmount1',
component: 'InputNumber',
labelWidth: 250,
colProps: {
span: 23,
},
componentProps: () => ({
disabled: status.value === 10,
}),
label: '实际应收金额1$',
},
{
field: 'actualPayedAmount2',
component: 'InputNumber',
labelWidth: 250,
colProps: {
span: 23,
},
componentProps: () => ({
disabled: status.value === 10,
}),
label: '实际应收金额2$',
},
{
field: 'actualPayedAmount3',
component: 'InputNumber',
labelWidth: 250,
colProps: {
span: 23,
},
componentProps: () => ({
disabled: status.value === 10,
}),
label: '实际应收金额3$',
},
{
field: 'otherAmount',
component: 'InputNumber',
labelWidth: 250,
colProps: {
span: 23,
},
componentProps: () => ({
disabled: status.value === 10,
}),
label: '其他费用金额$',
},
];
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
labelWidth: 120,
schemas,
layout: 'vertical',
showActionButtonGroup: false,
actionColOptions: {
span: 24,
},
});
const { createMessage } = useMessage();
const { error } = createMessage;
const update = ref();
const status = ref();
const status_score = ref();
const status_issuedCommission = ref();
const input1 = ref();
const input2 = ref();
const input_issuedCommission = ref();
const id = ref();
const loading = ref(false);
const [register, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
// 方式1
if (data.data.lockFields) {
status.value = data.data.lockFields?.packetActualRmbTotalPrice;
status_score.value = data.data.lockFields?.orderScore;
status_issuedCommission.value = data.data.lockFields?.issuedCommission;
}
id.value = data.data.orderId;
input1.value = data.data?.packetActualRmbTotalPrice;
input2.value = data.data?.orderScore;
input_issuedCommission.value = data.data?.issuedCommission;
resetFields();
setDrawerProps({ confirmLoading: false });
setFieldsValue({
...toRaw(data.data),
});
update.value = data;
});
//完成编辑
async function handleSubmit() {
if (loading.value) return;
loading.value = true;
setDrawerProps({ confirmLoading: true });
if (!input1.value) {
error('包装费用实际金额不能为空');
loading.value = false;
setDrawerProps({ confirmLoading: false });
} else {
try {
if (!input2.value && !input_issuedCommission.value) {
await getPackageEdit({
orderId: id.value,
packetActualRmbTotalPrice: input1.value,
});
} else {
await getPackageEdit({
orderId: id.value,
packetActualRmbTotalPrice: input1.value,
orderScore: Number(input2.value),
issuedCommission: Number(input_issuedCommission.value),
});
}
emit('success');
} finally {
loading.value = false;
setDrawerProps({ confirmLoading: false });
closeDrawer();
}
}
}
</script>