138 lines
3.8 KiB
Vue
138 lines
3.8 KiB
Vue
<template>
|
|
<el-dialog
|
|
model-value="BdialogUpdateVisible"
|
|
:title="dialogTitle"
|
|
width="30%"
|
|
@close="handleClose"
|
|
>
|
|
<el-form
|
|
ref="formRef"
|
|
:model="form"
|
|
label-width="100px"
|
|
>
|
|
<el-form-item label="门店头像" prop="businessAvatar">
|
|
<el-input v-model="form.businessAvatar" />
|
|
</el-form-item>
|
|
<el-form-item label="门店名" prop="businessName">
|
|
<el-input v-model="form.businessName" />
|
|
</el-form-item>
|
|
<el-form-item label="门店手机号" prop="businessPhone">
|
|
<el-input v-model="form.businessPhone" />
|
|
</el-form-item>
|
|
<el-form-item label="店铺详细地址" prop="address">
|
|
<el-input v-model="form.address" />
|
|
</el-form-item>
|
|
<el-form-item label="门店简介" prop="businessProfile">
|
|
<el-input v-model="form.businessProfile" />
|
|
</el-form-item>
|
|
<el-form-item label="商家相册" prop="businessImages">
|
|
<el-input v-model="form.businessImages" />
|
|
</el-form-item>
|
|
<el-form-item label="分类ID" prop="categoryId">
|
|
<el-input v-model="form.categoryId" />
|
|
</el-form-item>
|
|
<el-form-item label="店铺关联用户ID" prop="userId">
|
|
<el-input v-model="form.userId" />
|
|
</el-form-item>
|
|
<el-form-item label="状态" prop="state">
|
|
<el-input v-model="form.state" />
|
|
</el-form-item>
|
|
<el-form-item label="店铺状态" prop="storeStatus">
|
|
<el-input v-model="form.state" />
|
|
</el-form-item>
|
|
<el-form-item label="开始营业时间" prop="startBusiness">
|
|
<el-input v-model="form.startBusiness" />
|
|
</el-form-item>
|
|
<el-form-item label="结束营业时间" prop="endBusiness">
|
|
<el-input v-model="form.endBusiness" />
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
<template #footer>
|
|
<span class="dialog-footer">
|
|
<el-button @click="handleClose">取消</el-button>
|
|
<el-button type="primary" @click="handleConfirm">确认</el-button>
|
|
</span>
|
|
</template>
|
|
</el-dialog>
|
|
</template>
|
|
<script setup>
|
|
import {defineEmits, defineProps, ref, watch} from "vue";
|
|
import axios from "@/util/axios";
|
|
import {ElMessage} from "element-plus";
|
|
|
|
const props = defineProps({
|
|
bussinessId: {
|
|
type: String,
|
|
default: '',
|
|
required: true
|
|
},
|
|
dialogTitle: {
|
|
type: String,
|
|
default: '',
|
|
required: true
|
|
}
|
|
})
|
|
const form = ref({
|
|
id:"",
|
|
address: "",
|
|
userId: null,
|
|
businessAvatar: "",
|
|
businessImages: "",
|
|
businessName: "",
|
|
businessPhone: "",
|
|
businessProfile: "",
|
|
categoryId: null,
|
|
endBusiness: "",
|
|
state:null,
|
|
storeStatus: null,
|
|
startBusiness: ""
|
|
})
|
|
|
|
const formRef = ref(null);
|
|
const initFormData = async (id) => {
|
|
//console.log(id)
|
|
const res=await axios.post("business/list/page",{id: id})
|
|
form.value=res.data.data.records[0];
|
|
//console.log(res.data.data)
|
|
// console.log("bussinessId"+props.bussinessId)
|
|
}
|
|
watch(
|
|
() => props.bussinessId,
|
|
() => {
|
|
// console.log("id=" + props.businessId);
|
|
let id = props.bussinessId;
|
|
initFormData(id)
|
|
}
|
|
)
|
|
// 定义父组件事件
|
|
const emits = defineEmits(['update:modelValue', 'initBusinessList'])
|
|
const handleClose = () => {
|
|
console.log("xxx")
|
|
// 调用执行
|
|
|
|
emits('update:modelValue', false)
|
|
}
|
|
const handleConfirm = () => {
|
|
formRef.value.validate(async (valid) => {
|
|
if (valid) {
|
|
let result = await axios.post("business/update", form.value)
|
|
console.log(result.data.data)
|
|
let data = result.data;
|
|
if (data.code == 0) {
|
|
ElMessage.success("执行成功!");
|
|
formRef.value.resetFields();
|
|
emits("initBusinessList");
|
|
handleClose();
|
|
} else {
|
|
ElMessage.error(data.description);
|
|
}
|
|
} else {
|
|
console.log("fail")
|
|
return false
|
|
}
|
|
})
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
</style> |