disableAccountDialog.vue 2.9 KB
<!-- 禁用账号弹窗 -->
<template>
	<baseDialog :dialog-config="dialogConfig" :is-show.sync="visible" @handleClick="confirmDisable"
		:config="baseDialogConfig">
		<div class="disable-dialog-content">
			<div style="background: #f8f8f8; padding: 15px; border-radius: 4px; margin-bottom: 20px;">
				<div style="font-weight: bold; margin-bottom: 10px; color: #333; font-size: 14px;">基本信息</div>
				<el-row style="font-size: 14px; line-height: 28px;">
					<el-col :span="12">
						<span style="color: #666;">员工姓名:</span><span style="color: #333;">{{ staffName }}</span>
					</el-col>
					<el-col :span="12">
						<span style="color: #666;">适配业务:</span><span style="color: #333;">{{ formattedSceneLabel }}</span>
					</el-col>
				</el-row>
				<el-row style="font-size: 14px; line-height: 28px;">
					<el-col :span="24">
						<span style="color: #666;">园区店:</span><span style="color: #333;">{{ merchantName }}</span>
					</el-col>
				</el-row>
			</div>

			<div style="display: flex; align-items: flex-start;">
				<i class="el-icon-warning"
					style="color: #ff9900; font-size: 24px; margin-right: 12px; margin-top: 2px;"></i>
				<div>
					<div style="font-size: 16px; font-weight: bold; color: #333; margin-bottom: 8px;">确认禁用该员工的门店账号?</div>
					<div style="font-size: 14px; color: #999;">禁用后,该账号将无法登录业务端开展业务。</div>
				</div>
			</div>
		</div>
	</baseDialog>
</template>

<script>
import { disableAccountV2Api } from "@/api/resident";

export default {
	name: "DisableAccountDialog",
	props: {
		disableDialogVisible: {
			type: Boolean,
			default: false,
		},
		currentRow: {
			type: Object,
			default: () => null,
		},
		staffName: {
			type: String,
			default: "",
		},
		formattedSceneLabel: {
			type: String,
			default: "",
		}
	},
	data() {
		return {
			dialogConfig: {
				title: "禁用账号",
				width: "600px",
			},
		};
	},
	computed: {
		visible: {
			get() {
				return this.disableDialogVisible;
			},
			set(newVal) {
				this.$emit("dialogClose", { flag: newVal, attrName: "disableDialogVisible" });
			},
		},
		baseDialogConfig() {
			return {
				showClose: true,
				appendToBody: false, // 是否将自身插入至 body 元素,有嵌套的弹窗时一定要设置
				isShowFooter: true,
				cancel_name: "取 消",
				confirm_name: "禁用",
			}
		},
		merchantName() {
			return this.currentRow ? this.currentRow.yqMerchantName : '';
		}
	},
	methods: {
		confirmDisable() {
			if (!this.currentRow) return;
			const row = this.currentRow;
			disableAccountV2Api({ accountRecordId: row.accountRecordId }).then(() => {
				this.$message.success('账号已禁用');
				this.visible = false;
				this.$emit("refreshDetail");
			}).catch(() => {
				this.visible = false;
				this.$emit("disableFailed", row);
			});
		},
	},
};
</script>

<style scoped>
.disable-dialog-content {
	padding: 0 20px;
}
</style>