commit message

This commit is contained in:
Chopper
2021-05-13 10:56:04 +08:00
commit ec3e958037
728 changed files with 132685 additions and 0 deletions

View File

@@ -0,0 +1,402 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="会员名称" prop="memberName">
<Input
type="text"
v-model="searchForm.memberName"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="店铺名称" prop="storeName">
<Input
type="text"
v-model="searchForm.storeName"
placeholder="请输入店铺名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="创建时间" prop="createTime">
<DatePicker v-model="selectDate" type="datetimerange" format="yyyy-MM-dd HH:mm:ss" clearable @on-change="selectDateRange" placeholder="选择起始时间" style="width: 200px"></DatePicker>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="padding-row">
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
</Card>
</Col>
</Row>
</div>
</template>
<script>
import {
getShopListData,
disableShop,
enableBrand,
shopAudit,
} from "@/api/shops";
import shopOperation from "./shopOperation";
export default {
name: "shop",
components: {
shopOperation,
},
data() {
return {
shopId: "",
modalFlag: false,
loading: true, // 表单加载状态
drop: false,
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "", // 终止时间
},
selectDate: null,
form: {
// 添加或编辑表单对象初始化数据
memberName: "",
storeName: "",
shopDisable: "",
id: "",
createTime: "",
},
// 表单验证规则
formValidate: {},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
title: "店铺名称",
key: "storeName",
minWidth: 120,
align: "left",
},
{
title: "会员名称",
key: "memberName",
align: "left",
minWidth: 120,
},
{
title: "店铺地址",
key: "storeAddressPath",
width: 300,
sortable: false,
},
{
title: "是否自营",
key: "selfOperated",
align: "left",
width: 120,
render: (h, params) => {
return h(
"Tag",
{
props: {
color: params.row.selfOperated ? "default" : "primary",
},
},
params.row.selfOperated == 0 ? "自营" : "非自营"
);
},
},
{
title: "创建时间",
key: "createTime",
align: "left",
width: 170,
sortable: false,
},
{
title: "操作",
key: "action",
width: 170,
align: "center",
fixed: "right",
render: (h, params) => {
let enableOrDisable = "";
if (params.row.storeDisable == "OPEN") {
enableOrDisable = h(
"Button",
{
props: {
size: "small",
type: "error"
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.disable(params.row);
},
},
},
"关闭"
);
} else if (params.row.storeDisable == "CLOSED") {
enableOrDisable = h(
"Button",
{
props: {
type: "success",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.enable(params.row);
},
},
},
"开启"
);
} else if (params.row.storeDisable == "APPLYING") {
return h("div", [
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.audit(params.row);
},
},
},
"审核"
),
h(
"Button",
{
props: {
type: "primary",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.edit(params.row);
},
},
},
"修改"
),
]);
}
return h("div", [
h(
"Button",
{
props: {
size: "small",
},
style: {
marginRight: "5px",
display: this.selectedShop ? "inline-block" : "none",
},
on: {
click: () => {
this.callback(params.row);
},
},
},
"选择"
),
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.edit(params.row);
},
},
},
"修改"
),
enableOrDisable,
]);
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
selectedShop: false, //用于是否选择店铺
};
},
methods: {
callbackShop() {
this.init();
},
// 回调给父级
callback(val) {
this.$emit("callback", val);
},
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
// 带多条件搜索参数获取表单数据 请自行修改接口
this.searchForm.storeDisable='APPLYING'
getShopListData(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
add() {
this.$router.push({ path: '/shop-operation'});
},
edit(v) {
this.$router.push({ path: '/shop-operation', query: { shopId: v.id } });
},
disable(v) {
this.$Modal.confirm({
title: "确认禁用",
content: "您确认要禁用店铺 " + v.storeName + " ?",
loading: true,
onOk: () => {
disableShop(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
audit(v) {
this.$Modal.confirm({
title: "审核店铺",
content: "您确认要审核通过店铺 " + v.storeName + " ?",
okText: "通过",
cancelText: "驳回",
loading: true,
onOk: () => {
shopAudit(v.id, 0).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
onCancel: () => {
shopAudit(v.id, 1).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
enable(v) {
this.$Modal.confirm({
title: "确认启用",
content: "您确认要启用店铺 " + v.storeName + " ?",
loading: true,
onOk: () => {
enableBrand(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>

View File

@@ -0,0 +1,126 @@
.head-title {
font-size: 18px;
color: rgba(0, 0, 0, 0.85);
font-weight: 400;
}
.detail-body{
margin-top: 17px;
overflow: hidden;
}
.head-info {
display: flex;
height: 130px;
background: #93b5e1;
padding: 12px;
border-radius: 4px;
align-items: center;
}
.ant-layout, .ant-layout * {
box-sizing: border-box;
}
.base-info {
background-color: #fff;
padding: 20px;
margin-bottom: 12px;
height: 250px;
}
.ant-col-md-6 {
display: block;
box-sizing: border-box;
width: 33%;
float: left;
margin-left: 20px;
}
.info-2{
float: left;
}
.ant-row {
position: relative;
height: auto;
margin-right: 0;
margin-left: 0;
zoom: 1;
display: block;
box-sizing: border-box;
}
.bottom-info {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 12px;
margin-top: 6px;
height: 36px;
background: #f5f5f5;
border-radius: 4px;
}
.ant-layout * {
box-sizing: border-box;
}
.name{
margin-left: 10px;
color: #fff;
font-size: 18px;
}
.phone{
margin-left: 20px;
font-size: 14px;
color: #fff;
}
.item {
display: flex;
align-items: flex-start;
line-height: 30px;
margin-bottom: 2px;
}
.label {
flex-basis: 95px;
//text-align: right;
color: rgba(0, 0, 0, 0.4);
flex-shrink: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.info {
font-weight: 500;
padding-left: 0;
margin-bottom: 0;
width: 100%;
}
.pointsTitle {
background-color: #fafafa;
padding: 15px 20px;
display: flex;
font-size: 16px;
line-height: 1.8;
flex-direction: row;
justify-content: space-around;
color: #333;
text-align: center;
margin-bottom: 16px;
.points-top-title{
font-size: 14px;
font-weight: 400;
color: rgba(0, 0, 0, 0.4);
line-height: 14px;
margin-bottom: 8px;
}
.points-top-text {
font-size: 16px;
font-weight: 500;
color: #93b5e1;
line-height: 16px;
}
}
.point-data{
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,489 @@
<template>
<div class="search">
<Row>
<Col>
<Card>
<Row @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="会员名称" prop="memberName">
<Input
type="text"
v-model="searchForm.memberName"
placeholder="请输入会员名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="店铺名称" prop="storeName">
<Input
type="text"
v-model="searchForm.storeName"
placeholder="请输入店铺名称"
clearable
style="width: 200px"
/>
</Form-item>
<Form-item label="店铺状态" prop="shopDisable">
<Select v-model="searchForm.shopDisable" clearable style="width: 200px">
<Option value="OPEN">开启中</Option>
<Option value="CLOSED">已关闭</Option>
<Option value="APPLY">申请中</Option>
<Option value="APPLYING">审核中</Option>
<Option value="REFUSED">审核拒绝</Option>
</Select>
</Form-item>
<Form-item label="创建时间" prop="createTime">
<DatePicker v-model="selectDate" type="datetimerange" format="yyyy-MM-dd HH:mm:ss" clearable @on-change="selectDateRange" placeholder="选择起始时间" style="width: 200px"></DatePicker>
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
</Form>
</Row>
<Row class="operation padding-row">
<Button @click="add" type="primary">添加</Button>
</Row>
<Row>
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table>
</Row>
<Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
</Card>
</Col>
</Row>
</div>
</template>
<script>
import {
getShopListData,
disableShop,
enableBrand,
shopAudit,
} from "@/api/shops";
import shopOperation from "./shopOperation";
export default {
name: "shop",
components: {
shopOperation,
},
data() {
return {
shopId: "",
modalFlag: false,
loading: true, // 表单加载状态
drop: false,
searchForm: {
// 搜索框初始化对象
pageNumber: 1, // 当前页数
pageSize: 10, // 页面大小
sort: "createTime", // 默认排序字段
order: "desc", // 默认排序方式
startDate: "", // 起始时间
endDate: "", // 终止时间
},
selectDate: null,
form: {
// 添加或编辑表单对象初始化数据
memberName: "",
storeName: "",
shopDisable: "",
id: "",
createTime: "",
},
// 表单验证规则
formValidate: {},
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
title: "店铺名称",
key: "storeName",
minWidth: 120,
align: "left",
},
{
title: "会员名称",
key: "memberName",
minWidth: 130,
tooltip: true
},
{
title: "店铺地址",
key: "storeAddressPath",
width: 300,
tooltip: true
},
{
title: "是否自营",
key: "selfOperated",
align: "left",
width: 120,
render: (h, params) => {
return h(
"Tag",
{
props: {
color: params.row.selfOperated ? "error" : "success",
},
},
params.row.selfOperated ? "自营" : "非自营"
);
},
},
{
title: "店铺状态",
key: "storeDisable",
align: "left",
width: 130,
render: (h, params) => {
if (params.row.storeDisable == "OPEN") {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "开启中",
},
}),
]);
} else if (params.row.storeDisable == "CLOSED") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "已关闭",
},
}),
]);
} else if (params.row.storeDisable == "APPLY") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "申请中",
},
}),
]);
} else if (params.row.storeDisable == "APPLYING") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "审核中",
},
}),
]);
} else if (params.row.storeDisable == "REFUSED") {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "审核拒绝",
},
}),
]);
}
},
},
{
title: "创建时间",
key: "createTime",
align: "left",
width: 170
},
{
title: "操作",
key: "action",
width: 200,
align: "center",
fixed: "right",
render: (h, params) => {
let enableOrDisable = "";
if (params.row.storeDisable == "OPEN") {
enableOrDisable = h(
"Button",
{
props: {
size: "small",
type: "error"
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.disable(params.row);
},
},
},
"关闭"
);
} else if (params.row.storeDisable == "CLOSED") {
enableOrDisable = h(
"Button",
{
props: {
type: "success",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.enable(params.row);
},
},
},
"开启"
);
} else if (params.row.storeDisable == "APPLYING") {
return h("div", [
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.audit(params.row);
},
},
},
"审核"
),
h(
"Button",
{
props: {
type: "primary",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.edit(params.row);
},
},
},
"修改"
),
]);
}
return h("div", [
h(
"Button",
{
props: {
size: "small",
},
style: {
marginRight: "5px",
display: this.selectedShop ? "inline-block" : "none",
},
on: {
click: () => {
this.callback(params.row);
},
},
},
"选择"
),
h(
"Button",
{
props: {
type: "info",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.detail(params.row);
},
},
},
"查看"
),
h(
"Button",
{
props: {
type: "info",
size: "small",
ghost:true
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.edit(params.row);
},
},
},
"修改"
),
enableOrDisable,
]);
},
},
],
data: [], // 表单数据
total: 0, // 表单数据总数
selectedShop: false, //用于是否选择店铺
};
},
methods: {
callbackShop() {
this.init();
},
// 回调给父级
callback(val) {
this.$emit("callback", val);
},
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
this.loading = true;
// 带多条件搜索参数获取表单数据 请自行修改接口
getShopListData(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
this.total = res.result.total;
}
});
this.total = this.data.length;
this.loading = false;
},
add() {
this.$router.push({ path: '/shop-operation'});
},
edit(v) {
this.$router.push({ path: '/shop-operation', query: { shopId: v.id } });
},
disable(v) {
this.$Modal.confirm({
title: "确认禁用",
content: "您确认要禁用店铺 " + v.storeName + " ?",
loading: true,
onOk: () => {
disableShop(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
//查看店铺详细
detail(row){
this.$router.push({ name: "shop-detail", query: { id: row.id } });
},
audit(v) {
this.$Modal.confirm({
title: "审核店铺",
content: "您确认要审核通过店铺 " + v.storeName + " ?",
okText: "通过",
cancelText: "驳回",
loading: true,
onOk: () => {
shopAudit(v.id, 0).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
onCancel: () => {
shopAudit(v.id, 1).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
enable(v) {
this.$Modal.confirm({
title: "确认启用",
content: "您确认要启用店铺 " + v.storeName + " ?",
loading: true,
onOk: () => {
enableBrand(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss">
// 建议引入通用样式 可删除下面样式代码
@import "@/styles/table-common.scss";
</style>

View File

@@ -0,0 +1,617 @@
<template>
<div>
<Card>
<Tabs v-model="tabName" :animated="false" style="overflow: visible">
<Form ref="shopForm" :model="shopForm" :label-width="130" label-position="right" :rules="shopValidate">
<TabPane label="基本信息" class="tab" name="base">
<Divider orientation="left">基本信息</Divider>
<!-- 遮罩层 -->
<div v-if="isRead" class="mask">只读不可修改</div>
<div>
<FormItem label="会员名称" required prop="memberName">
<div class="item">
<Input disabled v-model="shopForm.memberName" />
<Button @click="selectMember()" v-if="!$route.query.shopId">选择会员</Button>
</div>
</FormItem>
<FormItem label="店铺名称" prop="storeName">
<Input v-model="shopForm.storeName" clearable style="width: 350px" />
</FormItem>
<FormItem label="是否自营" prop="selfOperated">
<RadioGroup v-model="shopForm.selfOperated">
<Radio :key=0 :label=0>自营</Radio>
<Radio :key=1 :label=1>非自营</Radio>
</RadioGroup>
</FormItem>
<FormItem label="店铺经纬度" prop="shopCenter">
<Input v-model="shopForm.storeCenter" @on-focus="$refs.liliMap.showMap = true" clearable style="width: 350px" />
</FormItem>
<FormItem label="店铺所在地" prop="storeAddressPath">
<Input disabled v-model="shopForm.storeAddressPath" style="width: 350px" />
</FormItem>
<FormItem label="店铺详细地址" required prop="storeAddressDetail">
<Input v-model="shopForm.storeAddressDetail" clearable style="width: 350px" />
</FormItem>
<FormItem label="店铺logo" class="storeLogo">
<Avatar style="height: 100px;width: 100px" v-if="shopForm.storeLogo" shape="square" icon="ios-person" size="default" :src="shopForm.storeLogo" />
<div>
<Button @click="handleCLickImg('storeLogo')" type="primary">选择图片</Button>
</div>
</FormItem>
<FormItem label="店铺简介" prop="storeDesc" style="width: 350px">
<Input v-model="shopForm.storeDesc" type="textarea" :rows="4" clearable style="width: 400px" />
</FormItem>
<br>
<Divider orientation="left">退货收件地址</Divider>
<FormItem label="收件人姓名" prop="salesConsigneeName">
<Input v-model="shopForm.salesConsigneeName" clearable style="width: 350px" />
</FormItem>
<FormItem label="收件人手机" prop="salesConsigneeMobile">
<Input v-model="shopForm.salesConsigneeMobile" clearable maxlength="11" style="width: 350px" />
</FormItem>
<FormItem label="地址信息" prop="salesConsigneeAddressPath">
<Input v-model="shopForm.salesConsigneeAddressPath" disabled style="width: 305px" v-if="showRegion == false" />
<Button v-if="showRegion == false" @click="regionClick" :loading="submitLoading" type="primary" icon="ios-create-outline" style="margin-left: 8px">修改
</Button>
<region style="width: 350px" @selected="selectedConsigneeRegion" v-if="showRegion == true" />
</FormItem>
<FormItem label="详细地址" prop="salesConsigneeDetail">
<Input v-model="shopForm.salesConsigneeDetail" clearable style="width: 350px" />
</FormItem>
<Spin fix v-if="loading"></Spin>
</div>
</TabPane>
<TabPane label="入驻信息" class="tab" name="sms">
<!-- 遮罩层 -->
<div v-if="isRead" class="mask">只读不可修改</div>
<Divider orientation="left">公司信息</Divider>
<div>
<FormItem label="公司名称" required prop="companyName">
<Input v-model="shopForm.companyName" clearable style="width: 350px" />
</FormItem>
<FormItem label="公司电话" required prop="companyPhone">
<Input v-model="shopForm.companyPhone" clearable style="width: 350px" />
</FormItem>
<FormItem label="公司所在地" required>
<Input v-model="shopForm.companyAddressPath" disabled style="width: 260px" v-if="showRegion == false" />
<Button v-if="showRegion == false" @click="regionClick" :loading="submitLoading" type="primary" icon="ios-create-outline" style="margin-left: 8px">修改
</Button>
<region style="width: 350px" @selected="selectedRegion" v-if="showRegion == true" />
</FormItem>
<FormItem label="公司详细地址" required prop="companyAddress">
<Input v-model="shopForm.companyAddress" clearable style="width: 350px" />
</FormItem>
<FormItem label="员工总数" required prop="employeeNum">
<InputNumber style="width: 150px" :min="1" :max="9999999" v-model="shopForm.employeeNum">
</InputNumber>
</FormItem>
<FormItem label="注册资金" required prop="registeredCapital">
<InputNumber style="width: 150px" :min="1" :max="9999999" v-model="shopForm.registeredCapital">
</InputNumber>
<span style="margin-left: 10px"></span>
</FormItem>
<FormItem label="联系人姓名" required prop="linkName">
<Input v-model="shopForm.linkName" clearable style="width: 200px" />
</FormItem>
<FormItem label="联系人手机" required prop="linkPhone">
<Input v-model="shopForm.linkPhone" maxlength="11" clearable style="width: 200px" />
</FormItem>
<FormItem label="电子邮箱" required prop="companyEmail">
<Input v-model="shopForm.companyEmail" clearable style="width: 200px" />
</FormItem>
<Divider orientation="left">营业执照信息</Divider>
<FormItem label="营业执照号" required prop="licenseNum">
<Input v-model="shopForm.licenseNum" clearable style="width: 200px" />
</FormItem>
<FormItem label="法定经营范围" required prop="scope">
<Input v-model="shopForm.scope" clearable style="width: 200px" />
</FormItem>
<Divider orientation="left">法人信息</Divider>
<FormItem label="法人姓名" required prop="legalName">
<Input v-model="shopForm.legalName" clearable style="width: 200px" />
</FormItem>
<FormItem label="法人证件号" required prop="legalId">
<Input v-model="shopForm.legalId" clearable style="width: 200px" />
</FormItem>
<FormItem label="法人身份证照片" required ref="legalPhoto">
<Avatar style="height: 100px;width: 100px" v-if="shopForm.legalPhoto" shape="square" icon="ios-person" size="default" :src="shopForm.legalPhoto" />
<div>
<Button @click="handleCLickImg('legalPhoto')" type="primary">选择图片</Button>
</div>
</FormItem>
<Divider orientation="left">结算银行信息</Divider>
<FormItem label="银行开户名" required prop="settlementBankAccountName">
<Input v-model="shopForm.settlementBankAccountName" clearable style="width: 200px" />
</FormItem>
<FormItem label="银行账号" required prop="settlementBankAccountNum">
<Input v-model="shopForm.settlementBankAccountNum" clearable style="width: 200px" />
</FormItem>
<FormItem label="银行支行名称" required prop="settlementBankBranchName">
<Input v-model="shopForm.settlementBankBranchName" clearable style="width: 200px" />
</FormItem>
<FormItem label="支行联行号" required prop="settlementBankJointName">
<Input v-model="shopForm.settlementBankJointName" clearable style="width: 200px" />
</FormItem>
<FormItem label="许可证电子版" required>
<Avatar style="height: 100px;width: 100px" v-if="shopForm.licencePhoto" shape="square" icon="ios-person" size="default" :src="shopForm.licencePhoto" />
<div>
<Button @click="handleCLickImg('licencePhoto')" type="primary">选择图片</Button>
</div>
</FormItem>
<Spin fix v-if="loading"></Spin>
</div>
</TabPane>
<TabPane label="经营范围" class="tab" name="category">
<!-- 遮罩层 -->
<div v-if="isRead" class="mask">只读不可修改</div>
<FormItem label="经营类目" prop="goodsManagementCategory">
<div>
<Checkbox :indeterminate="indeterminate" :value="checkAll" @click.prevent.native="handleCheckAll">全选
</Checkbox>
</div>
<CheckboxGroup v-model="checkAllGroup" @on-change="checkAllGroupChange">
<Checkbox v-for="(item, i) in categories" :key="i + 1" :label="item.id">{{ item.name }}
</Checkbox>
</CheckboxGroup>
</FormItem>
</TabPane>
<TabPane label="配送信息" class="tab" name="distribution">
<!-- 遮罩层 -->
<FormItem label="达达编码" prop="ddCode">
<Input v-model="shopForm.ddCode" maxlength="20" clearable style="width: 200px" />
</FormItem>
</TabPane>
<TabPane label="结算信息" class="tab" name="settlement">
<FormItem label="结算周期">
<Tag v-for="item in settlementCycle" :key="item" :name="item" closable style="marrgin-left: 10px" @on-close="removesettlementCycle">{{ item }}
</Tag>
<InputNumber :max="28" :min="1" v-model="day" v-show="settlementShow"></InputNumber>
<Button type="default" @click="addsettlementCycle" size="small" v-if="addSettlementBtn" style="margin-left: 8px">添加结算周期
</Button>
<Button v-if="addSettlementConfirmBtn" type="default" @click="addsettlementCycleConfirm" size="small" style="margin-left: 8px">确认
</Button>
</FormItem>
</TabPane>
</Form>
</Tabs>
<div align="center">
<Button type="primary" @click="save" v-if="!isRead" style="width: 100px; margin-right: 5px">{{ shopId ? "修改" :
"保存" }}
</Button>
</div>
</Card>
<liliMap ref="liliMap" @getAddress="getAddress"></liliMap>
<Modal width="1200px" v-model="picModalFlag">
<ossManage @callback="callbackSelected" ref="ossManage" />
</Modal>
<Modal width="1200px" v-model="memberModalFlag">
<memberLayout @callback="callbackMember" class="selectedMember" ref="memberLayout" />
</Modal>
</div>
</template>
<script>
import memberLayout from "@/views/member/list/index";
import ossManage from "@/views/sys/oss-manage/ossManage";
import { getCategoryTree } from "@/api/goods";
import { shopDetail, shopAdd, shopEdit, getShopByMemberId } from "@/api/shops";
import * as filters from "@/utils/filters";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
import region from "@/views/lili-components/region";
import liliMap from "@/views/my-components/map/index";
export default {
name: "shop-operation",
components: {
uploadPicInput,
ossManage,
region,
memberLayout,
liliMap,
},
data() {
return {
shopId: this.$route.query.shopId,
isRead: false, //是否只读,只有在店铺通过审核才可修改
regionAddressFlag: true,
selectedFormBtnName: "", //点击图片绑定form
picModalFlag: false, //图片选择器
memberModalFlag: false, //商家账号
settlementShow: false, //是否展示结算日输入框
addSettlementConfirmBtn: false, //添加结算日确认按钮
addSettlementBtn: true, //添加结算日按钮
day: 0, //结算日
shopValidate: {
// 表单验证规则
memberName: [
{ required: true, message: "会员不能为空", trigger: "blur" },
],
storeName: [
{ required: true, message: "店铺名称不能为空", trigger: "blur" },
],
companyAddress: [
{ required: true, message: "公司地址不能为空", trigger: "blur" },
],
storeAddressDetail: [
{ required: true, message: "店铺详细地址不能为空", trigger: "blur" },
],
storeDesc: [
{ required: true, message: "店铺简介不能为空", trigger: "blur" },
],
storeCenter: [
{ required: true, message: "店铺经纬度不能为空", trigger: "change" },
],
companyName: [
{ required: true, message: "公司名称不能为空", trigger: "blur" },
],
companyPhone: [
{ required: true, message: "公司电话不能为空", trigger: "blur" },
],
employeeNum: [
{
required: true,
type: "number",
message: "员工总数不能为空",
trigger: "blur",
},
],
registeredCapital: [
{
required: true,
type: "number",
message: "注册资金不能为空",
trigger: "blur",
},
],
linkName: [
{ required: true, message: "联系人姓名不能为空", trigger: "blur" },
],
linkPhone: [
{ required: true, message: "联系人手机号不能为空", trigger: "blur" },
{
type: "string",
pattern: /^1[3|4|5|6|7|8][0-9]{9}$/,
message: "手机号格式出错",
trigger: "blur",
},
],
companyEmail: [
{ required: true, message: "邮箱不能为空", trigger: "blur" },
{ type: "email", message: "邮箱格式错误", trigger: "blur" },
],
licenseNum: [
{ required: true, message: "营业执照号不能为空", trigger: "blur" },
],
scope: [
{ required: true, message: "法定经营范围不能为空", trigger: "blur" },
],
legalName: [
{ required: true, message: "法人姓名不能为空", trigger: "blur" },
],
legalId: [
{ required: true, message: "法人证件号不能为空", trigger: "blur" },
],
settlementBankAccountName: [
{ required: true, message: "银行开户名不能为空", trigger: "blur" },
],
settlementBankAccountNum: [
{ required: true, message: "银行账号不能为空", trigger: "blur" },
],
settlementBankBranchName: [
{ required: true, message: "银行支行名称不能为空", trigger: "blur" },
],
settlementBankJointName: [
{ required: true, message: "支行联行号不能为空", trigger: "blur" },
],
salesConsigneeMobile: [
{
type: "string",
pattern: /^1[3|4|5|6|7|8][0-9]{9}$/,
message: "手机号格式出错",
trigger: "blur",
},
],
},
selectMemberList: [],
memberList: [],
indeterminate: true,
checkAll: false,
checkAllGroup: [],
showRegion: false,
submitLoading: false, // 添加或编辑提交状态
settlementCycle: [],
shopForm: {
settlementCycle: "",
selfOperated: 0,
memberName: "",
companyName: "",
addressPath: "",
addressIdPath: "",
companyAddress: "",
companyEmail: "",
employeeNum: 1,
registeredCapital: 1,
linkName: "",
linkPhone: "",
licenseNum: "",
scope: "",
licencePhoto: "",
legalName: "",
legalId: "",
legalPhoto: "",
companyPhone: "",
settlementBankAccountName: "",
settlementBankAccountNum: "",
settlementBankBranchName: "",
settlementBankJointName: "",
businesses: "",
storeName: "",
storeLogo: "",
storeDesc: "",
ddCode: "",
},
categories: [],
infoResult: "",
};
},
methods: {
// 选择会员的回调
callbackMember(val) {
if (val) {
//选择会员后需要检验此会员是否开过店铺
getShopByMemberId(val.id).then((res) => {
if (res.success) {
if (res.result != null) {
this.$Message.error("当前会员已经拥有店铺");
} else {
this.shopForm.memberId = val.id;
this.shopForm.memberName = val.username;
}
this.memberModalFlag = false;
}
});
}
},
//选择会员
selectMember() {
this.$refs["memberLayout"].selectedMember = true;
this.memberModalFlag = true;
},
//修改地址
regionClick() {
this.showRegion = true;
this.regionId = "";
},
//删除所选择的结算日
removesettlementCycle(event, name) {
this.settlementCycle = this.settlementCycle.filter((i) => i !== name);
},
//确认添加方法
addsettlementCycle() {
this.settlementShow = true;
this.addSettlementConfirmBtn = true;
this.addSettlementBtn = false;
},
//添加结算日
addsettlementCycleConfirm() {
console.warn(this.settlementCycle.includes(this.day + ""));
if (this.day !== null && !this.settlementCycle.includes(this.day + "")) {
this.settlementCycle.push(this.day);
}
this.addSettlementConfirmBtn = false;
this.addSettlementBtn = true;
this.settlementShow = false;
this.day = 1;
},
// 选择地址
selectedRegion(val) {
this.$set(this.shopForm, "companyAddressIdPath", val[0]);
this.$set(this.shopForm, "companyAddressPath", val[1]);
},
// 选中的地址
selectedConsigneeRegion(val) {
this.shopForm.salesConsigneeAddressPath = val[1];
this.shopForm.salesConsigneeAddressId = val[0];
},
handleCLickImg(val) {
this.$refs.ossManage.selectImage = true;
this.picModalFlag = true;
this.selectedFormBtnName = val;
},
callbackSelected(val) {
this.picModalFlag = false;
this.shopForm[this.selectedFormBtnName] = val.url;
},
init() {
this.getCategories();
if (this.shopId) {
this.getShopDetail();
}
},
filterMethod(value, option) {
if (value && option) {
return option.toUpperCase().indexOf(value.toUpperCase()) !== -1;
}
},
getShopDetail() {
shopDetail(this.shopId).then((res) => {
if (res.result) {
this.infoResult = res.result;
this.shopForm = res.result;
console.warn(this.shopForm);
this.checkAllGroup = this.shopForm.goodsManagementCategory.split(",");
if (this.shopForm.settlementCycle != "")
this.shopForm.settlementCycle.split(",").forEach((e) => {
this.settlementCycle.push(e);
});
}
});
},
save() {
this.$refs.shopForm.validate((valid) => {
//校验结算日是否已经确认完成
if (this.settlementShow) {
this.$Message.error("请确认当前所填结算日信息");
return;
}
if (valid) {
//校验经营类目
if (this.checkAllGroup == "") {
this.$Message.error("请选择店铺经营类目");
return;
}
//校验公司所在地
if (this.shopForm.companyAddressPath == "") {
this.$Message.error("请选择公司所在地");
return;
}
//处理结算日 去掉最后一个逗号存储
this.shopForm.goodsManagementCategory = this.checkAllGroup;
this.shopForm.settlementCycle = this.settlementCycle;
if (this.shopId) {
delete this.shopForm.memberId;
shopEdit(this.shopId, this.shopForm).then((res) => {
if (res.success) {
this.$Message.success("编辑成功");
this.$router.push({ name: "shopList" });
}
});
} else {
//添加店铺单独需要检验的参数
if (this.shopForm.memberName == "") {
this.$Message.error("请选择开店的会员");
return;
}
shopAdd(this.shopForm).then((resp) => {
if (resp.success) {
this.$Message.success("添加成功");
this.shopForm = {};
this.$router.push({ name: "shopList" });
}
});
}
}
});
},
//获取地址
getAddress(item) {
this.shopForm.storeCenter = item.position.lat + "," + item.position.lng;
this.$set(this.shopForm, "storeAddressPath", item.addr);
this.$set(this.shopForm, "storeAddressIdPath", item.addrId);
},
handleCheckAll() {
if (this.indeterminate) {
this.checkAll = false;
} else {
this.checkAll = !this.checkAll;
}
this.indeterminate = false;
if (this.checkAll) {
let checkAllDate = [];
this.categories.forEach((i) => checkAllDate.push(i.id));
this.checkAllGroup = checkAllDate;
} else {
this.checkAllGroup = [];
}
},
checkAllGroupChange(data) {
if (data.length === this.categories.length) {
this.indeterminate = false;
this.checkAll = true;
} else if (data.length > 0) {
this.indeterminate = true;
this.checkAll = false;
} else {
this.indeterminate = false;
this.checkAll = false;
}
},
getCategories() {
getCategoryTree().then((res) => {
if (res.success) {
this.categories = res.result;
}
});
},
},
created() {
this.init();
},
};
</script>
<style lang="scss" scoped>
.selectedMember {
width: 100%;
}
.mask {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(105, 105, 105, 0.1);
z-index: 9;
}
/deep/ .ivu-tabs-bar {
margin: 0;
}
.tab {
padding: 16px;
position: relative;
}
.categories-checkbox {
display: flex;
align-items: center;
}
.img {
margin-right: 10px;
width: 100px;
height: 100px;
}
.item {
width: 350px !important;
display: flex;
> * {
margin: 0 4px;
}
}
</style>