Commit b72764c4 by 胡锦波

1. 发票抬头添加

2. fix
parent 499d0ffd
......@@ -11949,9 +11949,9 @@
"dev": true
},
"teammix-frame-element-vue": {
"version": "0.1.119",
"resolved": "http://npm.job.qinqinxiaobao.com/teammix-frame-element-vue/-/teammix-frame-element-vue-0.1.119.tgz",
"integrity": "sha512-LCuVNtWhDu7HU5F8o/kK1GDoqjbxJeFgvK0OONVCnoCMvrA8FQJCsva9oKrRoxNNlDrgXtNxgjMOVmTVUw+Szw==",
"version": "0.1.126",
"resolved": "http://npm.job.qinqinxiaobao.com/teammix-frame-element-vue/-/teammix-frame-element-vue-0.1.126.tgz",
"integrity": "sha512-7xiYWhOmGPzlILRfyFG14Xt+dKvebJV4q1gI+8ZXuPiuixX50+Nt0lRe9v7bKo1dtwuF/NcBhniUsKkj1d+VmA==",
"requires": {
"bankcardinfo": "^2.0.6",
"vue": "^2.6.11",
......
......@@ -14,7 +14,7 @@
"element-ui": "^2.15.7",
"lodash": "^4.17.21",
"oidc-client": "^1.11.5",
"teammix-frame-element-vue": "^0.1.119",
"teammix-frame-element-vue": "^0.1.126",
"uniplat-sdk": "^0.1.350-private",
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
......
......@@ -110,7 +110,7 @@ export const enum ApplyOperateType {
Reject = 'reject',
}
export const enum InvoiceType4Comapny {
export const enum InvoiceType4Company {
CORP = 'CORP',
PERSONAL = 'PERSONAL'
}
......@@ -120,9 +120,9 @@ export const enum InvoiceType4Person {
SMALL = 'SMALL'
}
export const InvoiceType4ComapnyMap = new Map<InvoiceType4Comapny, string>([
[InvoiceType4Comapny.CORP, '企业'],
[InvoiceType4Comapny.PERSONAL, '个人'],
export const InvoiceType4CompanyMap = new Map<InvoiceType4Company, string>([
[InvoiceType4Company.CORP, '企业'],
[InvoiceType4Company.PERSONAL, '个人'],
]);
export const InvoiceType4PersonMap = new Map<InvoiceType4Person, string>([
......@@ -140,7 +140,7 @@ export interface InvoiceListItem {
no: string;
oid: string;
phone: string;
taxpayerNature: InvoiceType4Comapny;
taxpayerNature: InvoiceType4Company;
type: InvoiceType4Person;
}
......@@ -166,6 +166,24 @@ class SdkService extends SdkCoreService {
const oid = EnterpriseHost.getOid();
return this.get<InvoiceListItem[]>(`/system/org/${oid}/invoice_title/list`);
}
public checkIdCanDelete(id: number) {
const oid = EnterpriseHost.getOid();
return this.post<{ errcode: string }>(`/general/project/welfare_v2/service/company_api/comInvoiceTitle_check_delete`, {
id: id,
oid: oid
});
}
public createInvoiceTitle(params: { [key: string]: any }) {
const oid = EnterpriseHost.getOid();
return this.post(`/system/org/${oid}/invoice_title/create`, params);
}
updateInvoiceTitle(id: string, params: { [key: string]: any }) {
const oid = EnterpriseHost.getOid();
return this.post(`/system/org/${oid}/invoice_title/${id}/update`, params);
}
}
const sdkService = new SdkService();
......
import { popupService } from "@/apppackage/element-upgrades/popup";
import { Component, Model, Watch, Vue } from "vue-property-decorator";
@Component({ components: {} })
export default class DepartmentActor extends Vue {
@Model('update')
protected value!: boolean;
protected readonly dialogWidth = 540 + 'px';
protected animationValue = false;
protected commit() {
popupService.noop();
}
protected close() {
this.$emit('update', false);
this.onClosing();
}
protected onClosing() {
popupService.noop();
setTimeout(() => {
this.animationValue = false;
}, 500);
}
@Watch("value")
private onValueChanged() {
if (this.value) {
this.onOpen();
this.animationValue = true;
}
}
protected onOpen() {
popupService.noop();
}
}
<template>
<transition name="el-drawer-fade">
<div class="com-drawer-container" v-if="remove">
<i class="drawer-close el-icon-close" @click="close"></i>
<input style="position: absolute; left: -1000px" type="text" />
<div class="drawer-title">
<slot name="header">
<div v-if="back" class="drawer-back" @click="goBack">
<i class="el-icon-arrow-left"></i>
返回
</div>
{{ title }}
</slot>
</div>
<el-scrollbar
class="scrolling-container"
:class="{ 'inner-hidden': !scroll }"
>
<div class="main-container" v-loading="loading">
<slot></slot>
</div>
</el-scrollbar>
<div class="footer" v-if="!readonly">
<slot name="footer">
<hrs-button @click="close">取消</hrs-button>
<hrs-button @click="confirm" type="primary">{{
confirmText
}}</hrs-button>
</slot>
</div>
</div>
</transition>
</template>
<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
@Component({ components: {} })
export default class DrawerContent extends Vue {
@Prop({ default: "默认标题" })
private title!: string;
@Prop()
private back!: boolean;
@Prop()
private loading!: boolean;
@Prop({ default: false })
private look!: boolean;
@Prop({ default: "确认" })
private confirmText!: string;
@Prop({ default: true })
private scroll!: boolean;
@Prop({ default: true })
private remove!: boolean;
@Prop()
private readonly!: boolean;
private goBack() {
this.$emit("back");
}
private confirm() {
this.$emit("confirm");
}
private close() {
this.$emit("close");
}
}
</script>
<style lang="less">
@import "~@/css/variables.less";
.com-drawer-container {
min-width: 500px;
display: flex;
flex-direction: column;
height: 100%;
color: @benefits-primary-header;
.header{
color: #666;
}
.main-container {
flex: 1;
overflow: auto;
padding: 0 50px;
.el-date-editor {
width: 100%;
}
}
.footer {
flex-shrink: 0;
display: flex;
justify-content: center;
align-items: center;
border-top: 1px solid #f0f0f0;
padding: 15px 0;
.el-button + .el-button{
margin-left: 20px;
}
}
}
.com-drawer-container {
position: relative;
.drawer-close {
position: absolute;
right: 20px;
top: 20px;
font-size: 20px;
color: #000;
cursor: pointer;
z-index: 1;
}
.drawer-title {
width: 100%;
margin-top: 32px;
margin-bottom: 30px;
text-align: center;
font-size: 18px;
font-weight: 400;
color: @benefits-primary-header;
line-height: 24px;
position: relative;
.drawer-back {
font-size: 14px;
color: #999999;
line-height: 24px;
position: absolute;
left: 30px;
cursor: pointer;
user-select: none;
}
}
.form-item {
margin-bottom: 30px;
.form-label {
font-size: 14px;
color: @benefits-primary-header;
line-height: 24px;
margin-bottom: 10px;
.sub-title{
color: @benefits-label;
}
}
textarea {
height: 195px;
}
}
.scrolling-container {
height: 100%;
> .el-scrollbar__wrap {
overflow-x: hidden;
}
&.inner-hidden {
> .el-scrollbar__wrap {
> .el-scrollbar__view {
max-height: 100%;
height: 100%;
.main-container {
overflow: hidden;
max-height: 100%;
height: 100%;
}
}
}
}
}
&,
.drawer-component-inner-content {
.drawer-content-item {
width: 100%;
margin-bottom: 30px;
.item-label {
font-size: 14px;
color: #999999;
line-height: 24px;
margin-bottom: 10px;
}
}
}
}
.com-drawer-container {
.com-max-input {
width: 100%;
}
.com-date-input {
width: 361px;
}
.com-bigger-input {
width: 365px;
}
.com-smaller-input {
width: 238px;
}
.com-number-input {
width: 217px;
}
.com-mini-input {
width: 117px;
}
.com-button {
background: #fafafa !important;
border: 1px solid #fafafa !important;
&:hover {
color: @mainColor !important;
background: #ffffff !important;
border: 1px solid @mainColor !important;
}
}
.mr19 {
margin-right: 19px;
}
}
</style>
......@@ -40,6 +40,7 @@
private headerOption: TeammixEnterpriseSelectorOption | null = null;
mounted() {
UserController.tryLogin();
this.buildPublicHeader();
}
......@@ -66,6 +67,7 @@
selectedEnterpriseId: comid,
onlyShowOwner: true,
autoSelectEnterprise4One: true,
isSkipRealNameVertify: true,
offset: 64,
disableMoreService: true,
onEnterpriseChanged: this.onEnterpriseChanged as any,
......
......@@ -90,19 +90,12 @@
>通过</mg-button
>
<mg-button
class="table-operation"
@click="onReject(scope.row.id)"
v-if="scope.row.status === 0"
>拒绝</mg-button
>
<span v-if="scope.row.status === 1">
已通过
<!-- <i class="el-icon-info"></i> -->
</span>
<span v-if="scope.row.status === -1">
已拒绝
<!-- <i class="el-icon-info"></i> -->
</span>
<span v-if="scope.row.status === 1"> 已通过 </span>
<span v-if="scope.row.status === -1"> 已拒绝 </span>
</template>
</el-table-column>
</el-table>
......
<template>
<el-dialog :visible.sync="value" :modal="false" :width="dialogWidth">
<div class="content" v-loading="loading">
<div class="header">
添加发票抬头
<div class="close-icon" @click="close"></div>
</div>
<div
class="item d-flex align-items-center"
:class="[
{ hidden: item.hidden },
{ [item.className]: type !== 'detail' },
{ readonly: type === 'detail' },
]"
v-for="(item, index) in formData"
:key="`f-${index}`"
>
<div class="label flex-none">
<i v-if="item.require" class="text-orange">*</i>
{{ item.label }}
</div>
<div class="item-value flex-fill">
<el-input
v-if="type !== 'detail' && item.type === 'text'"
v-model.trim="formData[index].value"
:placeholder="item.placeholder"
></el-input>
<el-switch
v-else-if="type != 'detail' && item.type === 'switch'"
v-model="formData[index].value"
active-color="#077AEC"
inactive-color="#ddd"
>
</el-switch>
<template
v-else-if="type != 'detail' && item.type === 'radio'"
>
<el-radio
v-model="formData[index].value"
label="GENERAL"
>
一般纳税人
</el-radio>
<el-radio v-model="formData[index].value" label="SMALL">
小规模纳税人
</el-radio>
</template>
<div v-else class="readonly-content">
{{
formDataDisplay(
formData[index].value,
formData[index].key
)
}}
</div>
</div>
</div>
<div class="item btn-content">
<el-button @click="close">取消</el-button>
<el-button
type="primary"
v-if="type == 'detail'"
@click="goOpenEdit"
>
编辑
</el-button>
<el-button type="primary" v-if="type == 'add'" @click="goAdd">
保存
</el-button>
<el-button type="primary" v-if="type == 'edit'" @click="goEdit">
提交
</el-button>
</div>
</div>
</el-dialog>
</template>
<script lang="ts">
import { Component, Prop } from "vue-property-decorator";
import DepartmentActor from "@/views/components/department-actor/department-actor";
import { popupService } from "@/apppackage/element-upgrades/popup";
import { InvoiceType4Company, sdkService } from "@/api/sdk-service";
export const enum DialogType {
Add = "add",
Edit = "edit",
Detail = "detail",
}
@Component({ components: { DepartmentActor } })
export default class DialogInvoiceTitleDetail extends DepartmentActor {
@Prop({ default: DialogType.Add })
private type!: DialogType;
@Prop({ default: {} })
private defaultData!: { [key: string]: any };
private loading = false;
private typeV2: { [key: string]: string } = {
GENERAL: "一般纳税人",
SMALL: "小规模纳税人",
};
private formData = [
{
key: "name",
label: "名称",
value: "",
type: "text",
placeholder: "请填写发票名称",
require: true,
},
{
key: "taxpayerNature",
label: "纳税人性质",
value: "",
type: "radio",
placeholder: "",
className: "mt30 mb30",
},
{
key: "phone",
label: "电话号码",
value: "",
type: "text",
placeholder: "请填写电话号码或手机号",
require: true,
},
{
key: "no",
label: "税号",
value: "",
type: "text",
noRequire: true,
placeholder: "请填写税号",
},
{
key: "bankName",
label: "开户银行",
value: "",
type: "text",
noRequire: true,
placeholder: "请填写开户银行",
},
{
key: "bankAccount",
label: "银行账号",
value: "",
type: "text",
noRequire: true,
placeholder: "请填写银行账号",
},
{
key: "address",
label: "单位地址",
value: "",
type: "text",
noRequire: true,
placeholder: "请填写单位地址",
},
{
key: "default",
label: "设为默认",
value: false,
type: "switch",
hiddenIcon: true,
placeholder: "",
className: "mt30",
},
];
protected onOpen() {
this.handleDefaultData();
}
private handleDefaultData() {
this.formData.forEach((i) => {
if (i.key === "type") {
return;
}
if (this.defaultData[i.key]) {
i.value = this.defaultData[i.key];
} else {
if (i.key === "default") {
i.value = false;
} else {
i.value = "";
}
}
});
}
private confirm() {
if (!this.validator()) {
return false;
}
const params = {
type:
this.type === "edit"
? this.defaultData && this.defaultData.type
: InvoiceType4Company.CORP,
};
this.formData.forEach((i) => {
if (i.key === "type") {
return;
}
if (i.key === "default") {
if (i.value === "") {
return Object.assign(params, {
[i.key]: true,
});
}
}
Object.assign(params, {
[i.key]: i.value,
});
});
return params;
}
private validator() {
for (const item of this.formData) {
if (
!item.value &&
!item.noRequire &&
item.type !== "switch" &&
item.type !== "radio"
) {
return this.onError(`${item.label}不能为空`);
}
if (!item.value && item.type === "radio" && item.require) {
return this.onError(`${item.label}不能为空`);
}
}
return true;
}
private goAdd() {
const params = this.confirm();
if (!params) {
return;
}
this.loading = true;
sdkService
.createInvoiceTitle(params)
.then(this.handlerResult)
.catch((err) => {
this.onError(err.msg);
})
.finally(() => {
this.loading = false;
});
}
goEdit() {
const params = this.confirm();
if (!params) {
return;
}
this.loading = true;
sdkService
.updateInvoiceTitle(this.defaultData.id, params)
.then(this.handlerResult)
.catch((err) => {
this.onError(err.msg);
})
.finally(() => {
this.loading = false;
});
}
private handlerResult() {
const msg = this.type === "add" ? "添加成功" : "修改成功";
popupService.toast.success(msg);
this.$emit("confirm", this.type);
this.close();
}
private onError(msg: string) {
return popupService.toast.error(msg);
}
private goOpenEdit() {
this.$emit("updateType", DialogType.Edit);
}
private formDataDisplay(value: string, type: string) {
if (type === "taxpayerNature" && this.typeV2[value]) {
return this.typeV2[value];
}
if (type === "default") {
return value ? "是" : "否";
}
return value || "暂无";
}
protected onClosing() {
if (this.type === "edit") {
this.handleDefaultData();
this.$emit("updateType", "detail");
return;
}
setTimeout(() => {
this.formData.forEach((x) => {
if (x.key === "default") {
x.value = false;
} else {
x.value = "";
}
});
}, 500);
}
}
</script>
<style lang="less" scoped>
@import "~@/css/variables.less";
.content {
width: 100%;
min-height: 320px;
padding: 38px 30px 30px 30px;
position: relative;
.header {
font-size: 18px;
color: #333333;
line-height: 25px;
padding-bottom: 10px;
border-bottom: 1px solid #f1f1f1;
}
.close-icon {
position: absolute;
width: 16px;
height: 16px;
top: 20px;
right: 20px;
// background-image: url("~@/assets/images/close.svg");
background-size: 16px 16px;
background-repeat: no-repeat;
cursor: pointer;
}
.tabs {
text-align: center;
margin: 30px 0;
margin-top: -10px;
.el-radio-group {
width: 350px;
.el-radio-button {
width: 175px;
}
}
}
.item {
display: flex;
align-items: center;
justify-content: center;
margin: 20px auto;
font-size: 14px;
&.mt30 {
margin-top: 30px;
}
&.mb30 {
margin-bottom: 30px;
}
&.readonly {
margin: 16px auto;
.label {
line-height: 20px;
}
&:first-child {
margin-top: 25px;
}
}
&.hidden {
display: none;
}
&:last-child {
margin-bottom: 0;
}
.label {
width: 106px;
text-align: right;
padding-right: 24px;
font-size: 14px;
color: #888;
line-height: 20px;
&.require {
position: relative;
&::before {
position: absolute;
content: "*";
left: -10px;
top: 50%;
transform: translateY(-30%);
color: #fe3b30;
line-height: 14px;
}
}
}
/deep/ .el-input {
width: 100%;
height: 38px;
background: #ffffff;
input {
border: 1px solid #dddddd;
border-radius: 4px;
color: #333333;
width: 100%;
height: 40px;
&:focus {
border-color: #409eff;
}
}
}
}
}
.text-orange {
color: #ff7f00;
}
.btn-content {
margin-top: 48px !important;
.el-button {
width: 96px;
height: 32px;
line-height: 0;
margin-left: 20px;
}
}
.readonly-content {
line-height: 20px;
}
</style>
......@@ -4,7 +4,7 @@
<div class="title">
发票抬头 <span class="total">({{ total }})</span>
</div>
<mg-button type="primary">添加发票抬头</mg-button>
<mg-button type="primary" @click="goAdd">添加发票抬头</mg-button>
</div>
<div class="table-container">
<el-table
......@@ -15,7 +15,7 @@
stripe
class="hrs-table"
>
<el-table-column label="名称" align="center">
<el-table-column label="名称" align="left">
<template slot-scope="scope">
<span v-if="scope.row.name">{{ scope.row.name }}</span>
<span v-else>-</span>
......@@ -30,84 +30,96 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="类型" align="center">
<el-table-column label="纳税人性质" align="center">
<template slot-scope="scope">
<span v-if="scope.row.type">{{
formatType(scope.row.type)
<span v-if="scope.row.taxpayerNature">{{
formatTypeV2(scope.row.taxpayerNature)
}}</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="纳税人性质" align="center">
<el-table-column label="是否默认" align="center" width="160px">
<template slot-scope="scope">
<span v-if="scope.row.taxpayerNature">{{
formatTypeV2(scope.row.taxpayerNature)
}}</span>
<span v-else>-</span>
<span>{{ scope.row.default ? "是" : "否" }}</span>
</template>
</el-table-column>
<el-table-column prop="active" label="操作" align="center">
<el-table-column
prop="active"
label="操作"
align="center"
width="160px"
>
<template slot-scope="scope">
<div class="operated">
<mg-button
<span class="operated">
<el-button
type="text"
class="primary detail"
class="primary"
size="small"
@click="showData(scope.row, 'detail')"
>
<span class="text-blue"> 详情 </span>
</mg-button>
<mg-button
<span> 详情 </span>
</el-button>
<el-button
type="text"
class="primary edit"
size="small"
@click="showData(scope.row, 'edit')"
class="cancel"
@click="goDelete(scope.row.id)"
>
编辑
</mg-button>
<mg-button
type="text"
size="small"
class="cancel delete"
@click="goDelete(scope.row.id, scope.row.oid)"
>
<span class="text-orange"> 删除 </span>
</mg-button>
</div>
<span> 删除 </span>
</el-button>
</span>
</template>
</el-table-column>
</el-table>
<el-pagination
class="pagination-content hrs-pager"
layout="prev, pager, next"
:current-page="page"
:page-size="pageSize"
:total="total"
:hide-on-single-page="true"
@current-change="changePages"
></el-pagination>
</div>
<DialogInvoiceTitleDetail
v-model="isShowDetail"
@confirm="onConfirm"
@close="onClose"
@updateType="updateType"
:type="alertType"
:defaultData="defaultData"
></DialogInvoiceTitleDetail>
</div>
</template>
<script lang="ts">
import {
InvoiceListItem,
InvoiceType4Comapny,
InvoiceType4ComapnyMap,
InvoiceType4Company,
InvoiceType4CompanyMap,
InvoiceType4Person,
InvoiceType4PersonMap,
sdkService,
} from "@/api/sdk-service";
import { popupService } from "@/apppackage/element-upgrades/popup";
import { Component, Vue } from "vue-property-decorator";
import DialogInvoiceTitleDetail, {
DialogType,
} from "./dialog-invoice-title-detail.vue";
@Component({ components: {} })
@Component({ components: { DialogInvoiceTitleDetail } })
export default class InvoiceTitles extends Vue {
private total = 0;
private tableData: InvoiceListItem[] = [];
private alertType = DialogType.Detail;
private isShowDetail = false;
private defaultData: InvoiceListItem | { [key: string]: any } = {};
private type: any = {
CORP: "企业",
PERSONAL: "个人",
};
private typeV2: any = {
GENERAL: "一般纳税人",
SMALL: "小规模纳税人",
};
private page = 1;
private pageSize = 10;
private total = 0;
created() {
this.getList();
......@@ -120,20 +132,81 @@
});
}
private formatType(type: InvoiceType4Comapny) {
return InvoiceType4ComapnyMap.get(type);
changePages(index: number) {
this.page = index;
this.getList();
}
private formatType(type: InvoiceType4Company) {
return InvoiceType4CompanyMap.get(type);
}
private formatTypeV2(type: InvoiceType4Person) {
return InvoiceType4PersonMap.get(type);
}
private showData() {
return "";
private goAdd() {
this.alertType = DialogType.Add;
this.defaultData = {};
this.isShowDetail = true;
}
private showData(data: InvoiceListItem, type: DialogType) {
this.alertType = type;
this.defaultData = data;
this.isShowDetail = true;
}
private goDelete(id: number) {
this.$notice({
currentTitle: "提示",
message: "是否永久删除当前发票抬头?",
confirmText: "确定",
cancelText: "取消",
confirm: () => {
this.onDelete(id);
},
});
}
private onDelete(id: number) {
sdkService
.checkIdCanDelete(id)
.then((res: any) => {
if ([101, "101"].includes(res.errcode)) {
this.$notice({
currentTitle: "提示",
message:
"当前发票已被福利宝业务设为发票抬头,不能删除!",
confirmText: "确定",
confirm: () => {
this.onDelete(id);
},
});
}
popupService.toast.success("删除成功");
this.getList();
})
.catch((err) => {
popupService.toast.error(err.msg);
});
}
private onConfirm(type: DialogType) {
if (type === "add") {
this.page = 1;
}
this.defaultData = {};
this.getList();
}
private onClose() {
this.isShowDetail = false;
this.defaultData = {};
}
private goDelete() {
return "";
private updateType(type: DialogType) {
this.alertType = type;
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment