Commit 4e7b7e95 by ym

add

1 parent e3060510
...@@ -52,10 +52,30 @@ const saveMerchant = params => { ...@@ -52,10 +52,30 @@ const saveMerchant = params => {
sign: true sign: true
}) })
} }
const findPermissionsByMerId = params => {
params.method = 'cn.com.glsx.merchants.merchant.findPermissionsByMerId'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
const findMenuFunTreeByMerId = params => {
params.method = 'cn.com.glsx.merchants.merchant.findMenuFunTreeByMerId'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
export default { export default {
findMerchantByPage, findMerchantByPage,
findAllDictData, findAllDictData,
getCarbrandTree, getCarbrandTree,
findMerchantDetail, findMerchantDetail,
saveMerchant saveMerchant,
findPermissionsByMerId,
findMenuFunTreeByMerId
} }
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="btn-unselect" :class="{ 'selectd-type': typeStatus }" @click="tabType"> <div disabled class="btn-unselect" :class="{ 'selectd-type': typeStatus }" @click="tabType">
<span class="select-type-title">{{ btnLabel }}</span <span class="select-type-title">{{ btnLabel }}</span
><i class="btn-icon" :class="{ 'el-icon-check': typeStatus }"></i> ><i class="btn-icon" :class="{ 'el-icon-check': typeStatus }"></i>
</div> </div>
...@@ -14,23 +14,33 @@ export default { ...@@ -14,23 +14,33 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
btnValue: {
type: Number,
default: 0,
},
typeStatus: { typeStatus: {
type: Boolean, type: Boolean,
default: false, default: false,
},
stopClick: {
type: Boolean,
default: false,
} }
}, },
data() { data() {
return { return {};
};
}, },
methods: { methods: {
tabType() { tabType() {
if(this.stopClick) {
return;
}
this.typeStatus = !this.typeStatus; this.typeStatus = !this.typeStatus;
this.$emit('getBtnStatus',this.typeStatus) this.$emit("getBtnStatus", this.typeStatus, this.btnValue);
},
}, },
}
}; };
</script> </script>
...@@ -42,6 +52,7 @@ export default { ...@@ -42,6 +52,7 @@ export default {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
margin-top: 6px; margin-top: 6px;
margin-right: 10px;
padding-right: 30px; padding-right: 30px;
cursor: pointer; cursor: pointer;
font-size: 0; font-size: 0;
......
...@@ -9,6 +9,12 @@ const staticRoutes = Object.freeze([{ ...@@ -9,6 +9,12 @@ const staticRoutes = Object.freeze([{
path: '/acount/addAccount', path: '/acount/addAccount',
meta: {}, meta: {},
component: resolve => require([`@/views/home/addAccount.vue`], resolve) component: resolve => require([`@/views/home/addAccount.vue`], resolve)
},
{
name: 'editAccount',
path: '/acount/editAccount',
meta: {},
component: resolve => require([`@/views/home/editAccount.vue`], resolve)
} }
]) ])
export default staticRoutes export default staticRoutes
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="scrm-main"> <div class="scrm-main">
<div v-show="!parentId">
<div class="account-header scrm-flex-between scrm-box-f">创建子商户/门店</div> <div class="account-header scrm-flex-between scrm-box-f">创建子商户/门店</div>
<div class="account-body scrm-box-f"> <div class="account-body scrm-box-f">
<div class="form-title">企业基本信息</div> <div class="form-title">企业基本信息</div>
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
<el-form-item label="商户简称"> <el-form-item label="商户简称">
<el-input <el-input
size="small" size="small"
v-model="accountAddForm.merchantName" v-model="accountAddForm.merchantAbbreviation"
placeholder="请输入商户简称" placeholder="请输入商户简称"
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -81,6 +82,7 @@ ...@@ -81,6 +82,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="联系电话" prop="merchantLegalPersonPhone"> <el-form-item label="联系电话" prop="merchantLegalPersonPhone">
<el-input <el-input
maxlength="11"
size="small" size="small"
v-model="accountAddForm.merchantLegalPersonPhone" v-model="accountAddForm.merchantLegalPersonPhone"
placeholder="请输入联系电话" placeholder="请输入联系电话"
...@@ -104,6 +106,7 @@ ...@@ -104,6 +106,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="驻店联系人"> <el-form-item label="驻店联系人">
<el-input <el-input
maxlength="11"
size="small" size="small"
v-model="accountAddForm.residentContact" v-model="accountAddForm.residentContact"
placeholder="请输入驻店联系人" placeholder="请输入驻店联系人"
...@@ -131,14 +134,26 @@ ...@@ -131,14 +134,26 @@
>{{ item.dictLabel }}</el-checkbox >{{ item.dictLabel }}</el-checkbox
> >
</el-checkbox-group> </el-checkbox-group>
<div class="scrm-flex-center" v-for="(item,index) in businessScopeCustomize" :key="index"> <div
class="scrm-flex-center"
v-for="(item, index) in businessScopeCustomize"
:key="index"
>
<el-input <el-input
size="small" size="small"
v-model="businessScopeCustomize[index].name" v-model="businessScopeCustomize[index].name"
placeholder="请自定义营业范围,建议不超过10个" placeholder="请自定义营业范围,建议不超过10个"
></el-input> ></el-input>
<i class="el-icon-circle-plus el-icon-btn" @click="addBusinessScope" v-if="index == businessScopeCustomize.length - 1"></i> <i
<i class="el-icon-remove el-icon-btn" @click="removeBusinessScope" v-else></i> class="el-icon-circle-plus el-icon-btn"
@click="addBusinessScope"
v-if="index == businessScopeCustomize.length - 1"
></i>
<i
class="el-icon-remove el-icon-btn"
@click="removeBusinessScope"
v-else
></i>
</div> </div>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -162,7 +177,20 @@ ...@@ -162,7 +177,20 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="主营品牌"> <el-form-item label="主营品牌">
<el-input size="small" v-model="accountAddForm.name"></el-input> <el-input size="small" v-model="filterText"></el-input>
<div class="brand-tree">
<el-tree
:data="brandData"
show-checkbox
default-expand-all
node-key="id"
ref="brandTree"
highlight-current
:props="defaultProps"
:filter-node-method="filterNode"
>
</el-tree>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -186,10 +214,11 @@ ...@@ -186,10 +214,11 @@
<div class="account-body scrm-box-f"> <div class="account-body scrm-box-f">
<div class="form-title">账户信息</div> <div class="form-title">账户信息</div>
<el-form <el-form
ref="form" ref="accountInfoForm"
:model="accountDetail" :model="accountInfoForm"
class="account-body-form" class="account-body-form"
label-width="120px" label-width="120px"
:rules="accountInfoRules"
> >
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
...@@ -223,20 +252,20 @@ ...@@ -223,20 +252,20 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="登录账户名"> <el-form-item label="登录账户名" prop="merchantLoginAccount">
<el-input <el-input
size="small" size="small"
v-model="accountAddForm.merchantLoginAccount" v-model="accountInfoForm.merchantLoginAccount"
placeholder="请输入登录账户名" placeholder="请输入登录账户名"
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="登录密码"> <el-form-item label="登录密码" prop="merchantLoginPassword">
<el-input <el-input
size="small" size="small"
type="password" type="password"
v-model="accountAddForm.merchantLoginPassword" v-model="accountInfoForm.merchantLoginPassword"
placeholder="请输入登录密码" placeholder="请输入登录密码"
></el-input> ></el-input>
</el-form-item> </el-form-item>
...@@ -245,13 +274,25 @@ ...@@ -245,13 +274,25 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="账户类型"> <el-form-item label="账户类型">
{{ accountAddForm.accountType }} <auto-button
<auto-button :btnLabel="typeLabel" :typeStatus="false" @getBtnStatus="getBtnStatus"></auto-button> v-for="(item, index) in accountDetail.accountTypes"
:key="index"
:btnLabel="item.accounttypeName"
:btnValue="item.accounttypeId"
@getBtnStatus="getBtnStatus"
></auto-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
</div> </div>
</div>
<select-product
v-show="parentId"
:parentId="parentId"
:pid="accountAddForm.parentId"
:accountlevel="accountDetail.merchantAccountLevel"
></select-product>
<div class="footer-panel"> <div class="footer-panel">
<el-button type="primary" @click="handleNext">下一步</el-button> <el-button type="primary" @click="handleNext">下一步</el-button>
<el-button type="primary">取消</el-button> <el-button type="primary">取消</el-button>
...@@ -268,25 +309,38 @@ ...@@ -268,25 +309,38 @@
<script> <script>
import mapView from "@/components/mapView/index"; import mapView from "@/components/mapView/index";
import autoButton from '@/components/auto-button/index' import autoButton from "@/components/auto-button/index";
import selectProduct from "./components/selectProduct";
export default { export default {
name: "index", name: "index",
components: { components: {
mapView, mapView,
autoButton autoButton,
selectProduct,
}, },
data() { data() {
return { return {
filterText: "",
brandData: [],
defaultProps: {
children: "children",
label: "label",
},
parentId: "1",
mapHeight: 400, mapHeight: 400,
typeLabel: "", typeLabel: "",
typeStatus: false, typeStatus: false,
loadingImg: false, loadingImg: false,
dialogMapVisible: false, dialogMapVisible: false,
businessScopeCustomize: [{name: ''}], businessScopeCustomize: [{ name: "" }],
accountAddForm: { accountAddForm: {
merchantType: "1", merchantType: "1",
businessScope: [], businessScope: [],
parentId: "",
isloginName: false,
}, },
accounttypeId: [],
accountInfoForm: {},
accountDetail: {}, accountDetail: {},
accountLevel: [], accountLevel: [],
accountType: [], accountType: [],
...@@ -298,15 +352,38 @@ export default { ...@@ -298,15 +352,38 @@ export default {
{ required: true, message: "请输入联系电话", trigger: "blur" }, { required: true, message: "请输入联系电话", trigger: "blur" },
], ],
}, },
accountInfoRules: {
merchantLoginAccount: [
{ required: true, message: "请输入登录账户名", trigger: "blur" },
],
merchantLoginPassword: [
{ required: true, message: "请输入登录账户名", trigger: "blur" },
],
},
}; };
}, },
watch: {
filterText(val) {
this.$refs.brandTree.filter(val);
},
},
methods: { methods: {
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
getAddress() { getAddress() {
this.dialogMapVisible = false; this.dialogMapVisible = false;
console.log(this.$refs.mapForm.address); this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
console.log(this.accountAddForm.merchantAddress);
}, },
getBtnStatus(status) { getBtnStatus(status, value) {
console.log(status) if (status) {
this.accounttypeId.push(value);
} else {
let idx = this.accounttypeId.findIndex((item) => item == value);
this.accounttypeId.splice(idx, 1);
}
}, },
upLoadImg(file) { upLoadImg(file) {
let fileName = file.name; let fileName = file.name;
...@@ -342,17 +419,38 @@ export default { ...@@ -342,17 +419,38 @@ export default {
}; };
} }
}, },
//下一步
handleNext() { handleNext() {
let params = this.accountAddForm; const pm1 = new Promise((resolve, reject) => {
this.$refs.baseForm.validate((valid) => {
if (valid) resolve();
});
});
const pm2 = new Promise((resolve, reject) => {
this.$refs.accountInfoForm.validate((valid) => {
if (valid) resolve();
});
});
let params = Object.assign({}, this.accountAddForm, this.accountInfoForm);
if (params.bussinessTime) { if (params.bussinessTime) {
params.bussinessBegintime = params.bussinessTime[0]; params.bussinessBegintime = params.bussinessTime[0];
params.bussinessEndtime = params.bussinessTime[1]; params.bussinessEndtime = params.bussinessTime[1];
} }
// if (params.businessScope) { if (params.businessScope) {
// params.businessScope = params.businessScope.join(","); params.businessScope = params.businessScope.join(",");
// } }
params.merchantBrand = this.$refs.brandTree.getCheckedKeys().join(",");
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0);
params.merchantAccountLevel = this.accountDetail.merchantAccountLevel;
let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name);
params.businessScopeCustomize = businessScopeCustomize.join(",");
params.accounttypeId = this.accounttypeId.join(",");
Promise.all([pm1, pm2]).then(() => {
this.$apis.store.saveMerchant(params).then((res) => { this.$apis.store.saveMerchant(params).then((res) => {
console.log(res); if (res) {
this.parentId = res;
}
});
}); });
}, },
findAllDictData(dictType) { findAllDictData(dictType) {
...@@ -378,19 +476,28 @@ export default { ...@@ -378,19 +476,28 @@ export default {
}); });
}, },
addBusinessScope() { addBusinessScope() {
this.businessScopeCustomize.push({name: ''}) this.businessScopeCustomize.push({ name: "" });
}, },
removeBusinessScope(index) { removeBusinessScope(index) {
this.businessScopeCustomize.splice(index,1) this.businessScopeCustomize.splice(index, 1);
}, },
async findMerchantDetail() { async findMerchantDetail() {
this.accountDetail = await this.$apis.store.findMerchantDetail({ id: "41352" }); this.accountDetail = await this.$apis.store.findMerchantDetail({
id: this.accountAddForm.parentId,
});
this.findAllDictData("account_type"); this.findAllDictData("account_type");
}, },
getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => {
this.brandData = res;
});
},
}, },
mounted() { mounted() {
this.accountAddForm.parentId = this.$route.query.id;
this.findMerchantDetail(); this.findMerchantDetail();
this.getCarbrandTree();
this.findAllDictData("account_level"); this.findAllDictData("account_level");
this.findAllDictData("business_scope"); this.findAllDictData("business_scope");
}, },
...@@ -436,6 +543,10 @@ export default { ...@@ -436,6 +543,10 @@ export default {
&-form { &-form {
width: 80%; width: 80%;
margin: 20px auto; margin: 20px auto;
.brand-tree {
height: 300px;
overflow-y: auto;
}
.el-icon-btn { .el-icon-btn {
color: #5850ff; color: #5850ff;
font-size: 16px; font-size: 16px;
...@@ -505,6 +616,7 @@ export default { ...@@ -505,6 +616,7 @@ export default {
bottom: 0px; bottom: 0px;
height: 64px; height: 64px;
background: #ffffff; background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1); box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="account-body scrm-box-f">
<div class="account-title">功能权限</div>
<el-tabs v-model="tabName" type="card">
<el-tab-pane
:label="item.accounttypeName"
:name="item.accounttypeId"
v-for="(item, index) in tabMenu"
:key="index"
></el-tab-pane>
</el-tabs>
<div
class="account-select-pro"
v-for="(item, index) in tabMenu"
:key="index"
v-show="tabName == item.accounttypeId"
>
<label>选择产品</label>
<el-checkbox-group v-model="item.productsArr" @change="selectPro(index)">
<el-checkbox
v-for="(itm, idx) in item.products"
:label="itm.productName"
:key="idx"
></el-checkbox>
</el-checkbox-group>
</div>
<div class="account-select-menu">请选择产品权限</div>
<div class="menu-box">
<div :key="index" v-for="(item, index) in tabMenu">
<div
class="menu-box-tab"
v-show="tabName == item.accounttypeId"
>
<div class="tab-item text-hide" v-for="(itm, idx) in item.productsArr" :key="idx">
{{ itm }}
</div>
</div>
<div v-if="item.products[0]" class="menu-box-tree" v-show="tabName == item.accounttypeId && item.productsArr.indexOf(item.accounttypeName) != -1">
<el-tree
:data="item.products[0].merchantProTreeResponses"
show-checkbox
default-expand-all
node-key="id"
ref="brandTree"
highlight-current
:props="defaultProps"
>
</el-tree>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "product",
props: {
parentId: {
type: Number,
},
pId: {
type: Number,
},
accountlevel: {
type: Number,
},
},
data() {
return {
tabMenu: [],
selectIndex: 0,
products: [],
productsArr: [],
tabName: "",
defaultProps: {
children: "children",
label: "label",
},
};
},
methods: {
selectPro() {},
findPermissionsByMerId() {
let params = {
accountlevel: 2,
parentId: 41513,
id: 41555,
};
this.$apis.store.findMenuFunTreeByMerId(params).then((res) => {
this.tabMenu = res.map((item) => {
return {
productsArr: [],
products: item.products,
accounttypeName: item.accounttypeName,
accounttypeId: item.accounttypeId,
};
});
this.tabName = this.tabMenu[0].accounttypeId;
});
},
},
mounted() {
this.findPermissionsByMerId();
},
};
</script>
<style scoped lang="scss">
.account-body {
padding: 20px;
.account-title {
font-size: 20px;
font-weight: 600;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
margin-bottom: 30px;
}
.account-select-pro {
padding-left: 30px;
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
display: flex;
flex-wrap: wrap;
label {
margin-right: 20px;
}
}
.account-select-menu {
font-size: 14px;
font-weight: 500;
color: #333333;
line-height: 20px;
margin-top: 20px;
}
.menu-box {
margin-top: 10px;
background: #f4f6fc;
border-radius: 4px;
padding: 10px;
.tab-item {
width: 180px;
background: #ffffff;
border-radius: 4px 0px 0px 0px;
border: 1px solid #f4f6fc;
font-size: 14px;
line-height: 14px;
font-weight: 400;
color: #322ad9;
text-align: center;
padding: 12px 0px;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div class="scrm-main">
<div class="account-body scrm-box-f">
<div class="form-title">修改账户信息</div>
<el-form
ref="accountInfoForm"
:model="accountInfoForm"
class="account-body-form"
label-width="120px"
:rules="accountInfoRules"
>
<el-row>
<el-col :span="12">
<el-form-item label="登录账户名" prop="merchantLoginAccount">
<el-input
readonly
size="small"
v-model="accountInfoForm.merchantLoginAccount"
placeholder="请输入登录账户名"
>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
size="small"
label="登录密码"
prop="merchantLoginPassword"
class="form-row"
>
<el-input
type="password"
v-model="accountInfoForm.merchantLoginPassword"
placeholder="请输入登录密码"
></el-input>
<el-button type="primary" class="form-btn">重置密码</el-button>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="账户类型">
<auto-button
v-for="(item, index) in accountTypes"
:key="index"
:btnLabel="item.accounttypeName"
:btnValue="item.accounttypeId"
typeStatus="true"
stopClick="true"
></auto-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="account-body scrm-box-f">
<div class="form-title">修改企业信息</div>
<el-form
ref="baseForm"
:model="accountAddForm"
class="account-body-form"
label-width="120px"
:rules="baseRules"
>
<el-row>
<el-col :span="12">
<el-form-item label="商户名称" prop="merchantName">
<el-input
size="small"
v-model="accountAddForm.merchantName"
placeholder="请输入商户名称"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商户简称">
<el-input
size="small"
v-model="accountAddForm.merchantAbbreviation"
placeholder="请输入商户简称"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商户类型" class="merchant-row">
<el-input
size="small"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入组织机构号码"
v-if="accountAddForm.merchantType == 2"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" :value="1"></el-option>
<el-option label="企业" :value="2"></el-option>
</el-select>
</el-input>
<el-input
size="small"
v-model="accountAddForm.merchantOrgcode"
placeholder="请输入正确的身份证号"
v-if="accountAddForm.merchantType == 1"
>
<el-select
v-model="accountAddForm.merchantType"
slot="prepend"
placeholder="请选择"
>
<el-option label="个人" :value="1"></el-option>
<el-option label="企业" :value="2"></el-option>
</el-select>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商户地址">
<el-input size="small" v-model="accountAddForm.merchantAddress">
<el-button slot="append" @click="dialogMapVisible = true"
>选择地址</el-button
>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="联系电话" prop="merchantLegalPersonPhone">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.merchantLegalPersonPhone"
placeholder="请输入联系电话"
></el-input>
<el-checkbox v-model="accountAddForm.isloginName"
>联系电话同时作为登录账户名</el-checkbox
>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系人">
<el-input
size="small"
v-model="accountAddForm.merchantLegalPerson"
placeholder="请输入联系人"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="驻店联系人">
<el-input
maxlength="11"
size="small"
v-model="accountAddForm.residentContact"
placeholder="请输入驻店联系人"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="驻店电话">
<el-input
size="small"
v-model="accountAddForm.residentPhone"
placeholder="请输入驻店电话"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业范围">
<el-checkbox-group v-model="accountAddForm.businessScope">
<el-checkbox
v-for="item in businessOption"
:label="item.dictValue"
:key="item"
>{{ item.dictLabel }}</el-checkbox
>
</el-checkbox-group>
<div
class="scrm-flex-center"
v-for="(item, index) in businessScopeCustomize"
:key="index"
>
<el-input
size="small"
v-model="businessScopeCustomize[index].name"
placeholder="请自定义营业范围,建议不超过10个"
></el-input>
<i
class="el-icon-circle-plus el-icon-btn"
@click="addBusinessScope"
v-if="index == businessScopeCustomize.length - 1"
></i>
<i
class="el-icon-remove el-icon-btn"
@click="removeBusinessScope"
v-else
></i>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="营业时间">
<el-time-picker
size="small"
value-format="HH:mm:ss"
is-range
v-model="accountAddForm.bussinessTime"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
></el-time-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="主营品牌">
<el-input size="small" v-model="filterText"></el-input>
<div class="brand-tree">
<el-tree
:data="brandData"
show-checkbox
default-expand-all
node-key="id"
ref="brandTree"
highlight-current
:props="defaultProps"
:filter-node-method="filterNode"
>
</el-tree>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="门店照片">
<div class="store-upload-list">
<template
v-if="
accountAddForm.merchantFileResponses &&
accountAddForm.merchantFileResponses.length > 0
"
>
<div
:key="index"
v-for="(item, index) in accountAddForm.merchantFileResponses"
class="store-border"
>
<img :src="item.fileUrl" />
<div class="uploader-del-icon">
<i class="el-icon-delete-solid" @click.stop="delImg(index)"></i>
</div>
</div>
</template>
<el-upload
action=""
class="image-uploader"
:show-file-list="false"
list-type="picture-card"
v-loading="loadingImg"
:before-upload="upLoadImg"
>
<i class="el-icon-plus"></i>
</el-upload>
</div>
<div class="tips">图片格式仅支持JPG,PNG格式,大小1M</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="footer-panel">
<el-button type="primary" @click="handleNext">确定</el-button>
<el-button type="primary">取消</el-button>
</div>
<el-dialog :visible.sync="dialogMapVisible" width="60%">
<map-view ref="mapForm" :mapHeight="mapHeight"></map-view>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogMapVisible = false">取 消</el-button>
<el-button type="primary" @click="getAddress">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import mapView from "@/components/mapView/index";
import autoButton from "@/components/auto-button/index";
export default {
name: "index",
components: {
mapView,
autoButton,
},
data() {
return {
activeName: "first",
filterText: "",
brandData: [],
defaultProps: {
children: "children",
label: "label",
},
parentId: "1",
mapHeight: 400,
typeStatus: false,
loadingImg: false,
dialogMapVisible: false,
businessScopeCustomize: [{ name: "" }],
accountAddForm: {
merchantType: 1,
businessScope: [],
parentId: "",
isloginName: false,
},
accounttypeId: [],
accountInfoForm: {
merchantLoginAccount: "",
merchantLoginPassword: "",
},
accountTypes: {},
accountLevel: [],
accountType: [],
businessOption: [],
accountValidityPeriod: [],
baseRules: {
merchantName: [{ required: true, message: "请输入商户名称", trigger: "blur" }],
merchantLegalPersonPhone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
],
},
accountInfoRules: {
merchantLoginAccount: [
{ required: true, message: "请输入登录账户名", trigger: "blur" },
],
merchantLoginPassword: [
{ required: true, message: "请输入登录账户名", trigger: "blur" },
],
},
};
},
watch: {
filterText(val) {
this.$refs.brandTree.filter(val);
},
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
getAddress() {
this.dialogMapVisible = false;
this.accountAddForm.merchantAddress = this.$refs.mapForm.address;
console.log(this.accountAddForm.merchantAddress);
},
getBtnStatus(status, value) {
if (status) {
this.accounttypeId.push(value);
} else {
let idx = this.accounttypeId.findIndex((item) => item == value);
this.accounttypeId.splice(idx, 1);
}
},
delImg(index) {
this.accountAddForm.merchantFileResponses.splice(index, 1);
},
upLoadImg(file) {
let fileName = file.name;
if (file.name.lastIndexOf(".") === -1) {
this.$message.info("路径不正确");
return false;
}
let AllImgExt = ".jpg|.jpeg|.gif|.bmp|.png|.swf";
let extName = file.name.substring(file.name.lastIndexOf(".")).toLowerCase();
if (AllImgExt.indexOf(extName + "|") === -1) {
this.$message.info("图片格式不正确");
return false;
}
// if (fileSize < 3145728) {
if (window.FileReader) {
let reader = new FileReader();
let self = this;
reader.readAsDataURL(file);
reader.onload = (img) => {
console.log(file);
let type = fileName.split(".")[1];
let imgUrl = img.target.result.split(",")[1];
self.loadingImg = true;
self.$apis.common
.pictureUpload({
file: `${type}@${imgUrl}`,
})
.then((res) => {
if (res) {
console.log(res);
}
});
};
}
},
//下一步
handleNext() {
const pm1 = new Promise((resolve, reject) => {
this.$refs.baseForm.validate((valid) => {
if (valid) resolve();
});
});
const pm2 = new Promise((resolve, reject) => {
this.$refs.accountInfoForm.validate((valid) => {
if (valid) resolve();
});
});
let params = Object.assign({}, this.accountAddForm, this.accountInfoForm);
if (params.bussinessTime) {
params.bussinessBegintime = params.bussinessTime[0];
params.bussinessEndtime = params.bussinessTime[1];
}
if (params.businessScope) {
params.businessScope = params.businessScope.join(",");
}
params.merchantBrand = this.$refs.brandTree.getCheckedKeys().join(",");
params.isloginName ? (params.isloginName = 1) : (params.isloginName = 0);
params.merchantAccountLevel = this.accountDetail.merchantAccountLevel;
let businessScopeCustomize = this.businessScopeCustomize.map((item) => item.name);
params.businessScopeCustomize = businessScopeCustomize.join(",");
params.accounttypeId = this.accounttypeId.join(",");
Promise.all([pm1, pm2]).then(() => {
this.$apis.store.saveMerchant(params).then((res) => {
if (res) {
this.parentId = res;
}
});
});
},
async findAllDictData() {
let accountLevel = this.$apis.store.findAllDictData({ dictType: "account_level" });
let accountType = this.$apis.store.findAllDictData({ dictType: "account_type" });
let businessOption = this.$apis.store.findAllDictData({
dictType: "business_scope",
});
await Promise.all([accountLevel, accountType, businessOption]).then((res) => {
[this.accountLevel, this.accountType, this.businessOption] = res;
});
this.findMerchantDetail();
},
addBusinessScope() {
this.businessScopeCustomize.push({ name: "" });
},
removeBusinessScope(index) {
this.businessScopeCustomize.splice(index, 1);
},
async findMerchantDetail() {
this.accountAddForm = await this.$apis.store.findMerchantDetail({
id: this.accountAddForm.parentId,
});
this.accountInfoForm.merchantLoginAccount = this.accountAddForm.merchantLoginAccount;
this.accountInfoForm.merchantLoginPassword = this.accountAddForm.merchantLoginPassword;
this.accountTypes = this.accountAddForm.accountTypes;
this.accountAddForm.businessScope = this.accountAddForm.businessScope
? this.accountAddForm.businessScope.split(",")
: [];
for (let i in this.accountAddForm.businessScope) {
this.accountAddForm.businessScope[i] = parseInt(
this.accountAddForm.businessScope[i]
);
}
this.accountAddForm.bussinessTime = [
this.accountAddForm.bussinessBegintime,
this.accountAddForm.bussinessEndtime,
];
let businessScopeCustomize = this.accountAddForm.businessScopeCustomize
? this.accountAddForm.businessScopeCustomize.split(",")
: [];
this.businessScopeCustomize = businessScopeCustomize.map((item) => {
return {
name: item,
};
});
},
getCarbrandTree() {
this.$apis.store.getCarbrandTree({}).then((res) => {
this.brandData = res;
});
},
},
mounted() {
this.accountAddForm.parentId = this.$route.query.id;
this.getCarbrandTree();
this.findAllDictData();
},
};
</script>
<style scoped lang="scss">
.account-header {
height: 78px;
box-sizing: border-box;
font-size: 20px;
font-weight: 500;
color: #333333;
line-height: 20px;
padding: 0px 20px;
}
.merchant-row {
/deep/ {
.el-form-item__content {
line-height: 1;
}
.el-select {
.el-input {
width: 110px;
}
}
}
}
.account-body {
margin-top: 20px;
&:nth-of-type(2) {
margin-bottom: 70px;
}
.form-title {
font-size: 16px;
font-weight: 500;
color: #333333;
line-height: 60px;
height: 60px;
border-bottom: 1px solid #d8d8d8;
padding-left: 20px;
}
&-form {
width: 80%;
margin: 20px auto;
.form-row {
/deep/ .el-form-item__content {
display: flex;
}
.form-btn {
margin-left: 10px;
}
}
.store-upload-list {
display: flex;
flex-wrap: wrap;
.store-border {
position: relative;
width: 120px;
height: 80px;
border-radius: 2px;
margin-right: 15px;
margin-bottom: 15px;
}
.uploader-del-icon {
position: absolute;
top: 0px;
right: 0px;
width: 30px;
height: 30px;
line-height: 30px;
background: rgba(0, 0, 0, 0.4);
border-radius: 0px 0px 0px 100px;
cursor: pointer;
}
.el-icon-delete-solid {
color: #c5c5c5;
font-size: 14px;
margin-left: 12px;
}
}
.image-uploader {
/deep/ .el-upload {
width: 120px;
height: 80px;
line-height: 80px;
}
}
.brand-tree {
height: 300px;
overflow-y: auto;
}
.el-icon-btn {
color: #5850ff;
font-size: 16px;
margin-left: 6px;
cursor: pointer;
}
.tips {
font-size: 14px;
font-weight: 400;
color: #999999;
line-height: 30px;
}
.btn-unselect {
display: inline-block;
cursor: pointer;
position: relative;
height: 30px;
line-height: 30px;
margin-top: 6px;
padding-right: 30px;
cursor: pointer;
font-size: 0;
-webkit-transition: 0.1s linear;
transition: 0.1s linear;
box-sizing: border-box;
&.selectd-type {
.select-type-title {
background: #5850ff;
}
}
.select-type-title {
display: inline-block;
padding: 0 16px;
height: 100%;
font-size: 14px;
border-radius: 2px 0 0 2px;
background-color: #d2d2d2;
color: #fff;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.btn-icon {
display: inline-block;
position: absolute;
right: 0;
top: 0;
width: 30px;
height: 28px;
line-height: 28px;
border: 1px solid #dcdfe6;
border-left: none;
border-radius: 2px 0px 0px 2px;
color: #5850ff;
font-size: 20px;
text-align: center;
}
}
}
}
.footer-panel {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
width: 100%;
bottom: 0px;
height: 64px;
background: #ffffff;
z-index: 999;
box-shadow: 0px -1px 1px 0px rgba(88, 80, 255, 0.1);
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -142,7 +142,9 @@ export default { ...@@ -142,7 +142,9 @@ export default {
methods: { methods: {
handleLook() {}, handleLook() {},
handleEdit() {}, handleEdit() {},
handleAdd() {}, handleAdd(scope) {
this.$router.push({path:'/acount/addAccount',query:{id:scope.id}})
},
findAllDictData(dictType) { findAllDictData(dictType) {
var params = { var params = {
dictType dictType
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!