revocationDialog.vue 2.35 KB
<!-- 驳回 -->
<template>
    <d2-dialog :is-visible="visible"
               title="提示"
               @closeDialog="handleClose"
               @confirmDialog="handleAddConfirm">
        <div class="reject-dialog">
            <glsx-combi-form ref="formRef"
                             class="edit-form-container"
                             default-width="390px"
                             :form-data="editFormData"
                             :form-obj="infoForm"
                             :form-ref="rejectRef"
                             :form-rules="formRules"
                             label-width="112px">
            </glsx-combi-form>
        </div>
    </d2-dialog>
</template>

<script>
import { cancelDeduct, getScoreDetail } from "@api/point";

export default {
	name: "RejectDialog",

	props: {
		visible: {
			type: Boolean,
			default: false,
		},
		id: {
			type: Number,
			default: "",
		},
	},
	data() {
		return {
			infoForm: {
				remark: "",
			},
			dialogConfig: {
				title: "提示",
				width: "576px",
				height: "315px",
			},
			rejectRef: "rejectRef",
			formRules: {
				// remark: [{ required: true, message: "请输入撤销原因", trigger: "blur" }]
			},
			editFormData: [
				{
					label: "撤销原因",
					name: "remark",
					type: "input",
					maxlength: 20,
					inputType: "textarea",
					showLimit: true,
					rows: 4,
				},
			],
			baseData: {},
		};
	},
	computed: {
		isVisible: {
			get() {
				return this.visible;
			},
			set(newVal) {},
		},
	},

	mounted() {},

	methods: {
		handleAddConfirm() {
			this.$refs.formRef.$refs[this.rejectRef].validate(async (valid) => {
				if (valid) {
					let detailData = await getScoreDetail({ id: this.id });
					let params = {};
					params.remark = this.infoForm.remark;
					params.orderCode = detailData.orderCode;
					params.scoreId = this.id;
					cancelDeduct(params).then((res) => {
						console.log(res);
						if (res) {
							this.$emit("handleConfirm", false);
							this.notice.okTips("操作成功");
						}
					});
				}
			});
		},
		handleClose() {
			this.$emit("dialogClose", false);
		},
	},
};
</script>

  <style lang="scss" scoped>
.reject-dialog {
	margin: 21px 0 83px;

	::v-deep .el-textarea__inner {
		height: 70px;
	}
	::v-deep .el-input__count {
		right: 15px !important;
		bottom: 3px !important;
		font-size: 12px;
		color: #999999;
	}
}
</style>