You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
329 lines
8.1 KiB
329 lines
8.1 KiB
<template>
|
|
<div class="user-edit">
|
|
<!-- Drawer抽屉 -->
|
|
<Drawer :title="title" v-model="visible" width="720" draggable :mask-closable="type == '0'">
|
|
<div :style="{ maxHeight: maxHeight }" class="drawer-content">
|
|
|
|
|
|
<Form ref="form" :model="form" :rules="formValidate" label-position="top">
|
|
<Row :gutter="32">
|
|
<Col span="12">
|
|
<FormItem label="拼团平台抽佣(%)" prop="commissionRateMore">
|
|
<Input v-model="form.commissionRateMore" autocomplete="off" :maxlength="16" />
|
|
</FormItem>
|
|
</Col>
|
|
<Col span="12">
|
|
<FormItem label="单独购买抽佣(%)" prop="commissionRateOne">
|
|
<Input v-model="form.commissionRateOne" autocomplete="off" :maxlength="16" />
|
|
</FormItem>
|
|
</Col>
|
|
</Row>
|
|
<Row :gutter="32">
|
|
<Col span="12">
|
|
<FormItem label="营业开始时间" prop="businessHourBegin">
|
|
<DatePicker v-model="form.businessHourBegin" style="display: block" type="time"
|
|
format="HH:mm" transfer></DatePicker>
|
|
</FormItem>
|
|
</Col>
|
|
<Col span="12">
|
|
<FormItem label="营业结束时间" prop="businessHourEnd">
|
|
<DatePicker v-model="form.businessHourEnd" style="display: block" type="time" format="HH:mm"
|
|
transfer></DatePicker>
|
|
</FormItem>
|
|
</Col>
|
|
</Row>
|
|
<Row :gutter="32">
|
|
<Col span="12">
|
|
<FormItem label="营业状态" class="form-noheight">
|
|
<dict dict="status" v-model="form.status" transfer />
|
|
</FormItem>
|
|
</Col>
|
|
<Col span="12">
|
|
<FormItem label="经营品类" class="form-noheight">
|
|
<dict dict="shopType" v-model="form.type" transfer />
|
|
</FormItem>
|
|
</Col>
|
|
</Row>
|
|
<Row :gutter="32">
|
|
<Col span="12">
|
|
<FormItem label="是否支持配送" class="form-noheight">
|
|
<dict dict="yesorno" v-model="form.isDelivery" transfer />
|
|
</FormItem>
|
|
</Col>
|
|
<Col span="12">
|
|
<FormItem label="出餐时间" prop="cookingTime">
|
|
<Input v-model="form.cookingTime" autocomplete="off" :maxlength="16" />
|
|
</FormItem>
|
|
</Col>
|
|
</Row>
|
|
<Row :gutter="32">
|
|
<Col span="12">
|
|
<FormItem label="排名" prop="shoprank">
|
|
<Input v-model="form.shoprank" autocomplete="off" :maxlength="16" />
|
|
</FormItem>
|
|
</Col>
|
|
<Col span="12">
|
|
<FormItem label="是否价格锁定" class="form-noheight">
|
|
<dict dict="yesorno" v-model="form.isPriceLock" transfer />
|
|
</FormItem>
|
|
</Col>
|
|
</Row>
|
|
|
|
<Divider />
|
|
|
|
|
|
|
|
</Form>
|
|
</div>
|
|
<div class="drawer-footer br" v-show="type != '0'">
|
|
<Button type="primary" :loading="submitLoading" @click="submit1">提交</Button>
|
|
<Button @click="visible = false">取消</Button>
|
|
</div>
|
|
</Drawer>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getUsersByRoleName,
|
|
getDictDataByType
|
|
} from "@/api/index";
|
|
import {
|
|
validateUsername,
|
|
validateMobile,
|
|
validatePassword,
|
|
} from "@/libs/validate";
|
|
import shopAreaTreeChoose from "@/views/my-components/hiver/shopArea-tree-choose";
|
|
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input";
|
|
import SetPassword from "@/views/my-components/hiver/set-password";
|
|
import dict from "@/views/my-components/hiver/dict";
|
|
import {
|
|
addShopTakeway,
|
|
editShopTakeway,
|
|
getByShopId
|
|
} from "@/api/app";
|
|
export default {
|
|
name: "mernage",
|
|
components: {
|
|
shopAreaTreeChoose,
|
|
uploadPicInput,
|
|
SetPassword,
|
|
dict,
|
|
},
|
|
props: {
|
|
value: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
data: {
|
|
type: Object,
|
|
},
|
|
type: {
|
|
type: String,
|
|
default: "0",
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
roleList: [],
|
|
roleList2: [],
|
|
shopAreaList: [],
|
|
businessDistrictLevelList: [],
|
|
visible: this.value,
|
|
title: "",
|
|
passColor: "",
|
|
submitLoading: false,
|
|
maxHeight: 510,
|
|
form: {},
|
|
takeData: {},
|
|
isAdd: true,
|
|
formValidate: {
|
|
// 表单验证规则
|
|
username: [{
|
|
required: true,
|
|
message: "请输入登录账号",
|
|
trigger: "blur"
|
|
},
|
|
{
|
|
validator: validateUsername,
|
|
trigger: "blur"
|
|
},
|
|
],
|
|
nickname: [{
|
|
required: true,
|
|
message: "请输入用户名",
|
|
trigger: "blur"
|
|
}, ],
|
|
mobile: [{
|
|
required: true,
|
|
message: "请输入手机号",
|
|
trigger: "blur"
|
|
},
|
|
{
|
|
validator: validateMobile,
|
|
trigger: "blur"
|
|
},
|
|
],
|
|
password: [{
|
|
required: true,
|
|
message: "请输入密码",
|
|
trigger: "blur"
|
|
},
|
|
{
|
|
validator: validatePassword,
|
|
trigger: "blur"
|
|
},
|
|
],
|
|
email: [{
|
|
required: true,
|
|
message: "请输入邮箱地址"
|
|
},
|
|
{
|
|
type: "email",
|
|
message: "邮箱格式不正确"
|
|
},
|
|
],
|
|
},
|
|
};
|
|
},
|
|
methods: {
|
|
init(data) {
|
|
this.getRoleList();
|
|
getByShopId({
|
|
"shopId": data.id
|
|
}).then((res) => {
|
|
if (res.success) {
|
|
console.log("res", res);
|
|
if (res.result == null) {
|
|
this.form = {}
|
|
this.form.shopId = data.id
|
|
this.form.shopName = data.shopName
|
|
this.form.regionId = data.regionId
|
|
this.isAdd = true
|
|
} else {
|
|
this.isAdd = false
|
|
this.form = res.result
|
|
for (let i = 0; i < this.shopType.length; i++) {
|
|
if (this.shopType[i].title == this.form.type) {
|
|
this.form.type = this.shopType[i].value
|
|
}
|
|
}
|
|
this.$forceUpdate()
|
|
this.form.status = JSON.stringify(this.form.status)
|
|
this.form.isDelivery = JSON.stringify(this.form.isDelivery)
|
|
this.form.isPriceLock = JSON.stringify(this.form.isPriceLock)
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
},
|
|
getRoleList() {
|
|
getUsersByRoleName("ROLE_OWNER").then((res) => {
|
|
if (res.success) {
|
|
this.roleList = res.result;
|
|
}
|
|
});
|
|
getUsersByRoleName("ROLE_MANAGER").then((res) => {
|
|
if (res.success) {
|
|
this.roleList2 = res.result;
|
|
}
|
|
});
|
|
getDictDataByType("yesorno").then((res) => {
|
|
if (res.success) {
|
|
this.yesorno = res.result;
|
|
this.yesorno = res.result;
|
|
}
|
|
});
|
|
getDictDataByType("shopType").then((res) => {
|
|
if (res.success) {
|
|
this.shopType = res.result;
|
|
}
|
|
});
|
|
getDictDataByType("status").then((res) => {
|
|
if (res.success) {
|
|
this.status = res.result;
|
|
}
|
|
});
|
|
},
|
|
changePass(v, grade, strength) {
|
|
this.form.passStrength = strength;
|
|
},
|
|
submit1() {
|
|
// 处理商品分类的名称
|
|
if (this.form.type != '' && this.form.type != null) {
|
|
this.shopType.forEach(item => {
|
|
debugger;
|
|
if (this.form.type == item.value) {
|
|
this.form.type = item.value;
|
|
}
|
|
});
|
|
}
|
|
for (let i = 0; i < this.shopType.length; i++) {
|
|
if (this.shopType[i].value == this.form.type) {
|
|
this.form.type = this.shopType[i].title
|
|
}
|
|
}
|
|
if (this.isAdd) {
|
|
// 添加
|
|
this.submitLoading = true;
|
|
addShopTakeway(this.form).then((res) => {
|
|
this.submitLoading = false;
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.$emit("on-submit", true);
|
|
this.visible = false;
|
|
}
|
|
});
|
|
} else {
|
|
console.log("22222", this.isAdd)
|
|
// 编辑
|
|
delete this.form.updateTime
|
|
this.submitLoading = true;
|
|
editShopTakeway(this.form).then((res) => {
|
|
this.submitLoading = false;
|
|
if (res.success) {
|
|
this.$Message.success("操作成功");
|
|
this.$emit("on-submit", true);
|
|
this.visible = false;
|
|
}
|
|
});
|
|
}
|
|
},
|
|
setCurrentValue(value) {
|
|
if (value === this.visible) {
|
|
return;
|
|
}
|
|
if (this.type == "1") {
|
|
this.title = "管理店铺业务信息";
|
|
this.maxHeight =
|
|
Number(document.documentElement.clientHeight - 121) + "px";
|
|
} else if (this.type == "2") {
|
|
this.title = "管理店铺业务信息";
|
|
this.maxHeight =
|
|
Number(document.documentElement.clientHeight - 121) + "px";
|
|
} else {
|
|
this.title = "店铺详情";
|
|
this.maxHeight = "100%";
|
|
}
|
|
|
|
this.visible = value;
|
|
},
|
|
},
|
|
watch: {
|
|
value(val) {
|
|
this.setCurrentValue(val);
|
|
},
|
|
visible(value) {
|
|
this.$emit("input", value);
|
|
},
|
|
},
|
|
mounted() {
|
|
this.init();
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="less">
|
|
@import "@/styles/drawer-common.less";
|
|
</style>
|