|
@@ -12,17 +12,17 @@
|
|
|
/>
|
|
|
<view class="invoice-form">
|
|
|
<u-form :model="form" :rules="rules" ref="uForm" label-width="150" label-align="right">
|
|
|
- <u-form-item label="抬头:">
|
|
|
+ <u-form-item label="抬头:" required>
|
|
|
<u-radio-group v-model="queryParams.invoHeadType" @change="invoTypeChange">
|
|
|
<u-radio :name="1">企业</u-radio>
|
|
|
<u-radio :name="2">个人</u-radio>
|
|
|
</u-radio-group>
|
|
|
</u-form-item>
|
|
|
- <u-form-item label="抬头名称:" prop="invoName">
|
|
|
+ <u-form-item label="抬头名称:" prop="invoName" required>
|
|
|
<u-input v-model="form.invoName" placeholder="请选择发票抬头" border disabled />
|
|
|
<u-icon slot="right" name="list-dot" size="40" color="#606266" @click="moreCompany" />
|
|
|
</u-form-item>
|
|
|
- <u-form-item label="税号:" prop="invoCode" v-if="queryParams.invoHeadType === 1">
|
|
|
+ <u-form-item label="税号:" prop="invoCode" required v-if="queryParams.invoHeadType === 1">
|
|
|
<u-input v-model="form.invoCode" placeholder="税号自动填充" border disabled />
|
|
|
</u-form-item>
|
|
|
<u-form-item label="更多内容:" prop="moreContentValue">
|
|
@@ -34,18 +34,6 @@
|
|
|
</view>
|
|
|
<view class="invoice-form margin-top">
|
|
|
<u-form :model="form" ref="uForm1" label-width="150" label-align="right">
|
|
|
- <!-- <u-form-item label="开户银行:" prop="openBank">
|
|
|
- <u-input v-model="form.openBank" placeholder="选填" border />
|
|
|
- </u-form-item>
|
|
|
- <u-form-item label="银行账号:" prop="numBank">
|
|
|
- <u-input v-model="form.numBank" placeholder="选填" border />
|
|
|
- </u-form-item>
|
|
|
- <u-form-item label="企业地址:" prop="mapCom">
|
|
|
- <u-input v-model="form.mapCom" placeholder="选填" border />
|
|
|
- </u-form-item>
|
|
|
- <u-form-item label="企业电话:" prop="phoneCom">
|
|
|
- <u-input v-model="form.phoneCom" placeholder="选填" border />
|
|
|
- </u-form-item> -->
|
|
|
<u-form-item label="电子邮箱:" prop="invoMail">
|
|
|
<u-input v-model="form.invoMail" placeholder="选填" border />
|
|
|
</u-form-item>
|
|
@@ -221,58 +209,51 @@ export default {
|
|
|
this.queryParams.invoHeadType = val;
|
|
|
this.getInvoiceHeaderSelect();
|
|
|
},
|
|
|
+ /**
|
|
|
+ * @description: 更多内容弹框确认
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
moreContentConfirm() {
|
|
|
this.moreContentPop.show = false;
|
|
|
- let moreContentTotal = 0;
|
|
|
- if (this.form.openBank) {
|
|
|
- moreContentTotal += 1;
|
|
|
- }
|
|
|
- if (this.form.numBank) {
|
|
|
- moreContentTotal += 1;
|
|
|
- }
|
|
|
- if (this.form.mapCom) {
|
|
|
- moreContentTotal += 1;
|
|
|
- }
|
|
|
- if (this.form.phoneCom) {
|
|
|
- moreContentTotal += 1;
|
|
|
- }
|
|
|
- if (moreContentTotal > 0) {
|
|
|
- this.moreContentPop.moreContentValue = `共4项 已填写${moreContentTotal}项`;
|
|
|
- } else {
|
|
|
- this.moreContentPop.moreContentValue = '';
|
|
|
- }
|
|
|
+ const { openBank, numBank, mapCom, phoneCom } = this.form;
|
|
|
+ const moreContentTotal = [openBank, numBank, mapCom, phoneCom].filter(Boolean).length;
|
|
|
+ this.moreContentPop.moreContentValue = moreContentTotal ? `共4项 已填写${moreContentTotal}项` : '';
|
|
|
},
|
|
|
submitForm() {
|
|
|
this.$refs.uForm.validate(async (valid) => {
|
|
|
- if (valid) {
|
|
|
- try {
|
|
|
- this.loading = true;
|
|
|
- const { invoHeadId, invoName, invoCode, invoMail, invoPhone, invoType, phoneCom, mapCom, openBank, numBank, orderIds } = this.form;
|
|
|
- const { code } = await this.$u.api.invoiceModuleApi.addInvoiceApi({
|
|
|
- invoHeadId,
|
|
|
- invoName,
|
|
|
- invoCode,
|
|
|
- invoMail,
|
|
|
- invoPhone,
|
|
|
- invoType,
|
|
|
- phoneCom,
|
|
|
- mapCom,
|
|
|
- openBank,
|
|
|
- numBank,
|
|
|
- orderIds
|
|
|
+ if (!valid) return;
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ uni.showLoading({
|
|
|
+ title: '提交中...'
|
|
|
+ });
|
|
|
+ const { invoHeadId, invoName, invoCode, invoMail, invoPhone, invoType, phoneCom, mapCom, openBank, numBank, orderIds } = this.form;
|
|
|
+ const { code } = await this.$u.api.invoiceModuleApi.addInvoiceApi({
|
|
|
+ invoHeadId,
|
|
|
+ invoName,
|
|
|
+ invoCode,
|
|
|
+ invoMail,
|
|
|
+ invoPhone,
|
|
|
+ invoType,
|
|
|
+ phoneCom,
|
|
|
+ mapCom,
|
|
|
+ openBank,
|
|
|
+ numBank,
|
|
|
+ orderIds
|
|
|
+ });
|
|
|
+ if (code === 200) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ title: '添加成功!',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1000,
|
|
|
+ url: '/pages/invoiceModule/invoiceSuccess/invoiceSuccess'
|
|
|
});
|
|
|
- if (code === 200) {
|
|
|
- this.loading = false;
|
|
|
- this.$refs.uToast.show({
|
|
|
- title: '添加成功!',
|
|
|
- type: 'success',
|
|
|
- duration: 2000,
|
|
|
- url: '/pages/invoiceModule/invoiceSuccess/invoiceSuccess'
|
|
|
- });
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- this.loading = false;
|
|
|
}
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ } finally {
|
|
|
+ uni.hideLoading();
|
|
|
+ this.loading = false;
|
|
|
}
|
|
|
});
|
|
|
}
|