|
@@ -10,7 +10,10 @@ const map = {
|
|
|
"10": "electronic", //电子普通发票
|
|
|
"20": "special_electronic", //电子专用发票
|
|
|
"01": "special", //普通专用发票
|
|
|
- "04": "normal" //普通发票
|
|
|
+ "04": "normal", //普通发票
|
|
|
+
|
|
|
+ "32": "fully_digitalized_normal_electronic",
|
|
|
+ "31": "fully_digitalized_special_electronic"
|
|
|
};
|
|
|
|
|
|
const invType = ref("");
|
|
@@ -40,7 +43,8 @@ const rules = reactive({
|
|
|
required: true,
|
|
|
message: "发票号码格式不正确",
|
|
|
trigger: "blur",
|
|
|
- validator(_, value) {
|
|
|
+ validator(rules, value) {
|
|
|
+ console.log(rules)
|
|
|
if (!value) {
|
|
|
return new Error("发票号码不能为空");
|
|
|
}
|
|
@@ -91,6 +95,7 @@ const formData = reactive({
|
|
|
inv_number: "",
|
|
|
open_date: null,
|
|
|
inv_subtotal: 0,
|
|
|
+ inv_total: 0,
|
|
|
check_code: ""
|
|
|
});
|
|
|
|
|
@@ -100,6 +105,7 @@ function handleSaveStatus() {
|
|
|
const {
|
|
|
input_type: _,
|
|
|
inv_subtotal,
|
|
|
+ inv_total,
|
|
|
check_code,
|
|
|
...otherParams
|
|
|
} = formData;
|
|
@@ -114,7 +120,8 @@ function handleSaveStatus() {
|
|
|
//线下开票
|
|
|
params = {
|
|
|
invNo: invNo.value,
|
|
|
- inv_subtotal: inv_subtotal.toFixed(2),
|
|
|
+ inv_subtotal: type === 'fully_digitalized_normal_electronic' || type === 'fully_digitalized_special_electronic' ? '' : inv_subtotal.toFixed(2),
|
|
|
+ inv_total: type === 'fully_digitalized_normal_electronic' || type === 'fully_digitalized_special_electronic' ? inv_total.toFixed(2) : '' ,
|
|
|
...(check_code ? { check_code } : {}),
|
|
|
...otherParams
|
|
|
};
|
|
@@ -146,8 +153,9 @@ function handleScanKeydown(evt: KeyboardEvent) {
|
|
|
}
|
|
|
|
|
|
const result = scanInputValue.value.split(",");
|
|
|
+ console.log(result)
|
|
|
|
|
|
- if (result.length !== 9) {
|
|
|
+ if (result.length !== 9 && result.length !== 8) {
|
|
|
ElMessage.error("扫码枪识别数据格式不正确,请重新扫描。");
|
|
|
return;
|
|
|
}
|
|
@@ -156,6 +164,7 @@ function handleScanKeydown(evt: KeyboardEvent) {
|
|
|
const [inv_code, inv_number, subtotal_amount, open_time, check_code] = chunks;
|
|
|
|
|
|
scanInvType.value = invoiceType;
|
|
|
+ console.log(invoiceType)
|
|
|
const year = open_time.slice(0, 4);
|
|
|
const month = open_time.slice(4, 6);
|
|
|
const day = open_time.slice(6);
|
|
@@ -163,7 +172,13 @@ function handleScanKeydown(evt: KeyboardEvent) {
|
|
|
formData.inv_code = inv_code;
|
|
|
formData.check_code = check_code;
|
|
|
formData.inv_number = inv_number;
|
|
|
- formData.inv_subtotal = Number(subtotal_amount);
|
|
|
+
|
|
|
+ if(invoiceType === '31' || invoiceType === '32'){
|
|
|
+ formData.inv_total = Number(subtotal_amount);
|
|
|
+ }else {
|
|
|
+ formData.inv_subtotal = Number(subtotal_amount);
|
|
|
+ }
|
|
|
+
|
|
|
formData.open_date = dayjs(`${year}-${month}-${day}`).format(
|
|
|
"YYYY-MM-DD HH:mm:ss"
|
|
|
);
|
|
@@ -187,6 +202,14 @@ watchEffect(() => {
|
|
|
scanInvType.value = source.scanValue;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // if(scanInvType.value === '32'){
|
|
|
+ // rules.inv_code[0].required = false
|
|
|
+ // rules.inv_subtotal[0].required = false
|
|
|
+ // rules.check_code[0].required = false
|
|
|
+ // }
|
|
|
+
|
|
|
+ console.log(scanInvType)
|
|
|
});
|
|
|
|
|
|
defineExpose({
|
|
@@ -259,7 +282,7 @@ defineExpose({
|
|
|
:disabled="disabled"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="发票代码" prop="inv_code">
|
|
|
+ <el-form-item label="发票代码" prop="inv_code" v-if="scanInvType !== '32' && scanInvType !== '31'">
|
|
|
<el-input
|
|
|
v-model="formData.inv_code"
|
|
|
placeholder="发票代码"
|
|
@@ -275,7 +298,7 @@ defineExpose({
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="税前金额" prop="inv_subtotal">
|
|
|
+ <el-form-item label="税前金额" prop="inv_subtotal" v-if="scanInvType !== '32' && scanInvType !== '31'">
|
|
|
<el-input-number
|
|
|
v-model="formData.inv_subtotal"
|
|
|
:precision="2"
|
|
@@ -286,7 +309,18 @@ defineExpose({
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="校验码" prop="check_code">
|
|
|
+ <el-form-item label="税后金额" prop="inv_total" v-else>
|
|
|
+ <el-input-number
|
|
|
+ v-model="formData.inv_total"
|
|
|
+ :precision="2"
|
|
|
+ style="width: 100%"
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ :disabled="disabled"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="校验码" prop="check_code" v-if="scanInvType !== '32' && scanInvType !== '31'">
|
|
|
<el-input
|
|
|
placeholde="请输入校验码"
|
|
|
v-model="formData.check_code"
|