Browse Source

2026.3.2新增

master
tianyi 3 months ago
parent
commit
c0d8d4d5b5
  1. 6
      src/api/app.js
  2. 1
      src/views/app/shop/addEdit.vue
  3. 142
      src/views/app/shop/addType.vue
  4. 0
      src/views/app/shop/dictManage.less
  5. 662
      src/views/app/shop/dictManage.vue
  6. 143
      src/views/app/shop/editDictType.vue
  7. 623
      src/views/app/shop/mernage.vue
  8. 35
      src/views/app/shop/shop.vue

6
src/api/app.js

@ -147,6 +147,12 @@ export const editLogiticsCompany = (params) => {
export const addLogisticsRoute = (params) => {
return postBodyRequest('/app/logisticsRoute/addLogisticsRoute', params)
}
//获取商品分类
export const goodsType = (params) => {
return postBodyRequest('/app/productCategory/list', params)
}
//编辑线路
export const updateLogisticsRoute = (params) => {
return postBodyRequest('/app/logisticsRoute/updateLogisticsRoute', params)

1
src/views/app/shop/addEdit.vue

@ -252,6 +252,7 @@ export default {
}
});
}
this.form.shopMangerId = this.form.shopOwnerId
if (this.type == "1") {
//
this.submitLoading = true;

142
src/views/app/shop/addType.vue

@ -0,0 +1,142 @@
<template>
<div>
<Modal
title="添加字典"
v-model="visible"
:mask-closable="false"
:width="500"
>
<Form
ref="form"
:model="form"
:label-width="85"
:rules="formValidate"
>
<FormItem label="字典名称" prop="title">
<Input v-model="form.title" />
</FormItem>
<FormItem label="字典类型" prop="type" class="block-tool">
<Tooltip
placement="right"
:max-width="220"
transfer
content="建议设置为英文名且需唯一 非开发人员谨慎修改"
>
<Input v-model="form.type" />
</Tooltip>
</FormItem>
<FormItem label="备注" prop="description">
<Input v-model="form.description" />
</FormItem>
<FormItem label="排序值" prop="sortOrder">
<Tooltip
trigger="hover"
placement="right"
content="值越小越靠前,支持小数"
>
<InputNumber
:max="1000"
:min="0"
v-model="form.sortOrder"
></InputNumber>
</Tooltip>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="visible = false">取消</Button>
<Button
type="primary"
:loading="submitLoading"
@click="submit"
>提交</Button
>
</div>
</Modal>
</div>
</template>
<script>
import { addDict } from "@/api/index";
export default {
name: "addDictType",
components: {},
props: {
value: {
type: Boolean,
default: false,
},
dataLength: {
type: Number
},
},
data() {
return {
visible: this.value,
submitLoading: false,
form: {
title: "",
type: "",
description: "",
sortOrder: 0,
},
formValidate: {
//
title: [{ required: true, message: "请输入", trigger: "blur" }],
type: [{ required: true, message: "请输入", trigger: "blur" }],
sortOrder: [
{
required: true,
type: "number",
message: "请输入排序值",
trigger: "blur",
},
],
},
};
},
methods: {
init() {},
submit() {
this.$refs.form.validate((valid) => {
if (valid) {
//
this.submitLoading = true;
addDict(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;
}
//
this.$refs.form.resetFields();
this.form.sortOrder = this.dataLength;
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>

0
src/views/app/shop/dictManage.less

662
src/views/app/shop/dictManage.vue

@ -0,0 +1,662 @@
<style lang="less">
@import "@/styles/tree&table-common.less";
@import "./dictManage.less";
</style>
<template>
<div class="search">
<Card>
<Row type="flex" justify="space-between">
<Col v-show="expand" span="5">
<Row class="operation">
<Button @click="handleAddDict" type="primary" icon="md-add">添加分类</Button>
<Dropdown @on-click="handleDropdown">
<Button>
更多操作
<Icon type="md-arrow-dropdown" />
</Button>
<DropdownMenu slot="list">
<DropdownItem name="editDict">编辑分类</DropdownItem>
<DropdownItem name="delDict">删除分类</DropdownItem>
<DropdownItem name="refreshDict">刷新</DropdownItem>
</DropdownMenu>
</Dropdown>
</Row>
<Alert show-icon>
当前选择
<span class="select-title">{{ editTitle }}</span>
<a class="select-clear" v-if="editTitle" @click="cancelEdit">取消选择</a>
</Alert>
<Input v-model="searchKey" suffix="ios-search" @on-change="search" placeholder="输入搜索分类" clearable />
<div style="position: relative">
<div class="tree-bar" :style="{ maxHeight: maxHeight }">
<Tree ref="tree" :data="treeData" @on-select-change="selectTree"></Tree>
</div>
<Spin size="large" fix v-if="treeLoading"></Spin>
</div>
</Col>
<div class="expand">
<Icon :type="expandIcon" size="16" class="icon" @click="changeExpand" />
</div>
<Col :span="span">
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="70">
<FormItem label="数据名称" prop="title">
<Input type="text" v-model="searchForm.title" placeholder="请输入" clearable
style="width: 200px" />
</FormItem>
<FormItem label="状态" prop="status">
<Select v-model="searchForm.status" placeholder="请选择" clearable style="width: 200px">
<Option value="0">正常</Option>
<Option value="-1">禁用</Option>
</Select>
</FormItem>
<FormItem style="margin-left: -35px" class="br">
<Button @click="handleSearch" type="primary" icon="ios-search">搜索</Button>
<Button @click="handleReset">重置</Button>
</FormItem>
</Form>
</Row>
<Row align="middle" justify="space-between" class="operation">
<div>
<Button @click="add" type="primary" icon="md-add">添加数据</Button>
<Button @click="delAll" icon="md-trash">批量删除</Button>
</div>
<div class="icons">
<Tooltip content="刷新" placement="top" transfer>
<Icon type="md-refresh" size="18" class="item" @click="getDataList" />
</Tooltip>
<Tooltip :content="openSearch ? '关闭搜索' : '开启搜索'" placement="top" transfer>
<Icon type="ios-search" size="18" class="item tip" @click="openSearch = !openSearch" />
</Tooltip>
<Tooltip :content="openTip ? '关闭提示' : '开启提示'" placement="top" transfer>
<Icon type="md-bulb" size="18" class="item tip" @click="openTip = !openTip" />
</Tooltip>
<Tooltip content="表格密度" placement="top" transfer>
<Dropdown @on-click="changeTableSize" trigger="click">
<Icon type="md-list" size="18" class="item" />
<DropdownMenu slot="list">
<DropdownItem :selected="tableSize == 'default'" name="default">默认</DropdownItem>
<DropdownItem :selected="tableSize == 'large'" name="large">宽松</DropdownItem>
<DropdownItem :selected="tableSize == 'small'" name="small">紧密</DropdownItem>
</DropdownMenu>
</Dropdown>
</Tooltip>
<Tooltip content="导出数据" placement="top" transfer>
<Icon type="md-download" size="18" class="item" @click="exportData" />
</Tooltip>
</div>
</Row>
<Alert show-icon v-show="openTip">
已选择
<span class="select-count">{{ selectList.length }}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
<Table :loading="loading" border :columns="columns" :data="data" :size="tableSize" sortable="custom"
@on-sort-change="changeSort" @on-selection-change="showSelect" ref="table"></Table>
<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>
</Col>
</Row>
</Card>
<addType :dataLength="dataLength" v-model="showAddDict" @on-submit="getAllDict" />
<editDictType :data="dictForm" v-model="showEditDict" @on-submit="editDictSuccess" />
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="500">
<Form ref="form" :model="form" :label-width="80" :rules="formValidate">
<FormItem label="名称" prop="title">
<Input v-model="form.title" />
</FormItem>
<FormItem label="数据值" prop="value">
<Input v-model="form.value" />
</FormItem>
<FormItem label="备注" prop="description">
<Input v-model="form.description" />
</FormItem>
<FormItem label="排序值" prop="sortOrder">
<Tooltip trigger="hover" placement="right" content="值越小越靠前,支持小数">
<InputNumber :max="1000" :min="0" v-model="form.sortOrder"></InputNumber>
</Tooltip>
</FormItem>
<FormItem label="是否启用" prop="status">
<i-switch size="large" v-model="form.status" :true-value="0" :false-value="-1">
<span slot="open">启用</span>
<span slot="close">禁用</span>
</i-switch>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="handelSubmit">提交</Button>
</div>
</Modal>
</div>
</template>
<script>
import {
goodsType,
deleteDict,
searchDict,
getAllDictDataList,
addDictData,
editDictData,
deleteData,
} from "@/api/index";
import addType from "./addType.vue";
import editDictType from "./editDictType.vue";
export default {
name: "dic-manage",
components: {
addType,
editDictType
},
data() {
return {
Visiable: false,
tableSize: "default",
dataLength: 0,
showAddDict: false,
dictForm: {},
showEditDict: false,
openSearch: true,
openTip: true,
treeLoading: false, //
maxHeight: "500px",
loading: false, //
editTitle: "", //
searchKey: "", //
expand: true,
span: 18,
expandIcon: "ios-arrow-back",
selectNode: {},
treeData: [], //
selectList: [], //
searchForm: {
// data
name: "",
status: "",
pageNumber: 1, //
pageSize: 10, //
sort: "sortOrder", //
order: "asc", //
},
modalType: 0, //
modalVisible: false, //
modalTitle: "", //
form: {
//
title: "",
value: "",
status: 0,
description: "",
sortOrder: 0,
},
formValidate: {
//
title: [{
required: true,
message: "请输入",
trigger: "blur"
}],
value: [{
required: true,
message: "请输入",
trigger: "blur"
}],
sortOrder: [{
required: true,
type: "number",
message: "请输入排序值",
trigger: "blur",
}, ],
},
columns: [
//
{
type: "selection",
width: 60,
align: "center",
},
{
type: "index",
width: 60,
align: "center",
},
{
title: "名称",
key: "title",
minWidth: 160,
sortable: true,
},
{
title: "数据值",
key: "value",
minWidth: 160,
sortable: true,
},
{
title: "备注",
key: "description",
width: 150,
sortable: true,
},
{
title: "排序值",
key: "sortOrder",
width: 100,
align: "center",
sortable: true,
sortType: "asc",
},
{
title: "状态",
key: "status",
align: "center",
width: 120,
render: (h, params) => {
let re = "";
if (params.row.status == 0) {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "启用",
},
}),
]);
} else if (params.row.status == -1) {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "禁用",
},
}),
]);
}
},
},
{
title: "创建时间",
key: "createTime",
width: 200,
sortable: true,
},
{
title: "操作",
key: "action",
width: 150,
align: "center",
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"a", {
on: {
click: () => {
this.edit(params.row);
},
},
},
"编辑"
),
h("Divider", {
props: {
type: "vertical",
},
}),
h(
"a", {
on: {
click: () => {
this.remove(params.row);
},
},
},
"删除"
),
]);
},
},
],
submitLoading: false, //
data: [], //
total: 0, //
};
},
methods: {
init() {
//
this.getGoodsType();
//
this.getDataList();
},
getGoodsType() {
this.treeLoading = true;
goodsType().then((res) => {
this.treeLoading = false;
if (res.success) {
this.treeData = res.result;
for(let i=0;i<this.treeData.length;i++){
this.treeData[i].title = this.treeData[i].categoryName
}
}
});
},
search() {
//
if (this.searchKey) {
this.treeLoading = true;
searchDict({
key: this.searchKey
}).then((res) => {
this.treeLoading = false;
if (res.success) {
this.treeData = res.result;
}
});
} else {
//
this.getAllDict();
}
},
selectTree(v) {
if (v.length > 0) {
// null""
for (let attr in v[0]) {
if (v[0][attr] == null) {
v[0][attr] = "";
}
}
let str = JSON.stringify(v[0]);
let data = JSON.parse(str);
this.selectNode = data;
this.dictForm = data;
this.editTitle = data.title + "(" + data.type + ")";
//
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
} else {
this.cancelEdit();
}
},
cancelEdit() {
let data = this.$refs.tree.getSelectedNodes()[0];
if (data) {
data.selected = false;
}
//
this.selectNode = {};
this.editTitle = "";
this.getDataList();
},
changeTableSize(v) {
this.tableSize = v;
},
exportData() {
this.$refs.table.exportCsv({
filename: "数据",
});
},
changeSelect(v) {
this.selectList = v;
},
changeExpand() {
this.expand = !this.expand;
if (this.expand) {
this.expandIcon = "ios-arrow-back";
this.span = 18;
} else {
this.expandIcon = "ios-arrow-forward";
this.span = 23;
}
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
getDataList() {
this.loading = true;
if (this.selectNode.id) {
this.searchForm.dictId = this.selectNode.id;
} else {
delete this.searchForm.dictId;
}
if (!this.searchForm.status) {
this.searchForm.status = "";
}
getAllDictDataList(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.content;
this.total = res.result.totalElements;
if (this.data.length == 0 && this.searchForm.pageNumber > 1) {
this.searchForm.pageNumber -= 1;
this.getDataList();
}
}
});
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
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();
},
showSelect(e) {
this.selectList = e;
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
refreshDict() {
this.getAllDict();
this.selectNode = {};
this.editTitle = "";
this.getDataList();
},
handleDropdown(name) {
if (name == "editDict") {
if (!this.selectNode.id) {
this.$Message.warning("您还未选择要编辑的字典");
return;
}
this.handleEditDict();
} else if (name == "delDict") {
this.delDict();
} else if (name == "refreshDict") {
this.refreshDict();
}
},
handleAddDict() {
this.dataLength = this.treeData.length + 1;
this.showAddDict = true;
},
handleEditDict() {
this.showEditDict = true;
},
editDictSuccess(v) {
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.dictForm = data;
this.editTitle = v.title + "(" + v.type + ")";
this.getAllDict();
},
delDict() {
if (!this.selectNode.id) {
this.$Message.warning("您还未选择要删除的字典");
return;
}
this.$Modal.confirm({
title: "确认删除",
loading: true,
content: "您确认要删除字典 " + this.selectNode.title + " 及其所有数据?",
onOk: () => {
//
deleteDict({
ids: this.selectNode.id
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.refreshDict();
}
});
},
});
},
getChildren(v){
this.Visiable = true;
console.log(v)
this.$nextTick(() => {
this.$refs.dialog.initRecharge(v);
});
},
add() {
if (!this.selectNode.id) {
this.$Message.warning("请先选择一个字典类别");
return;
}
this.modalType = 0;
this.modalTitle = "添加字典 " + this.editTitle + " 的数据";
this.$refs.form.resetFields();
this.form.sortOrder = this.data.length + 1;
this.modalVisible = true;
},
edit(v) {
this.modalType = 1;
if (this.editTitle) {
this.modalTitle = "编辑字典 " + this.editTitle + " 的数据";
} else {
this.modalTitle = "编辑字典数据";
}
this.$refs.form.resetFields();
// null""
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.form = data;
this.modalVisible = true;
},
handelSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.submitLoading = true;
if (this.modalType == 0) {
// id
delete this.form.id;
this.form.dictId = this.selectNode.id;
addDictData(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
this.modalVisible = false;
}
});
} else if (this.modalType == 1) {
//
editDictData(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
this.modalVisible = false;
}
});
}
}
});
},
remove(v) {
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除 " + v.title + " ?",
loading: true,
onOk: () => {
//
deleteData({
ids: v.id
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.clearSelectAll();
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
delAll() {
if (this.selectList.length <= 0) {
this.$Message.warning("您还未选择要删除的数据");
return;
}
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除所选的 " + this.selectList.length + " 条数据?",
loading: true,
onOk: () => {
let ids = "";
this.selectList.forEach(function(e) {
ids += e.id + ",";
});
ids = ids.substring(0, ids.length - 1);
//
deleteData({
ids: ids
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.clearSelectAll();
this.getDataList();
}
});
},
});
},
},
mounted() {
//
let height = document.documentElement.clientHeight;
this.maxHeight = Number(height - 287) + "px";
this.init();
},
};
</script>

143
src/views/app/shop/editDictType.vue

@ -0,0 +1,143 @@
<template>
<div>
<Modal
title="编辑字典"
v-model="visible"
:mask-closable="false"
:width="500"
>
<Form ref="form" :model="form" :label-width="85" :rules="formValidate">
<FormItem label="字典名称" prop="title">
<Input v-model="form.title" />
</FormItem>
<FormItem label="字典类型" prop="type" class="block-tool">
<Tooltip
placement="right"
:max-width="220"
transfer
content="建议设置为英文名且需唯一 非开发人员谨慎修改"
>
<Input v-model="form.type" />
</Tooltip>
</FormItem>
<FormItem label="备注" prop="description">
<Input v-model="form.description" />
</FormItem>
<FormItem label="排序值" prop="sortOrder">
<Tooltip
trigger="hover"
placement="right"
content="值越小越靠前,支持小数"
>
<InputNumber
:max="1000"
:min="0"
v-model="form.sortOrder"
></InputNumber>
</Tooltip>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="visible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="submit"
>提交</Button
>
</div>
</Modal>
</div>
</template>
<script>
import { editDict } from "@/api/index";
export default {
name: "addDictType",
components: {},
props: {
value: {
type: Boolean,
default: false,
},
data: {
type: Object,
},
},
data() {
return {
visible: this.value,
submitLoading: false,
form: {
title: "",
type: "",
description: "",
sortOrder: 0,
},
formValidate: {
//
title: [{ required: true, message: "请输入", trigger: "blur" }],
type: [{ required: true, message: "请输入", trigger: "blur" }],
sortOrder: [
{
required: true,
type: "number",
message: "请输入排序值",
trigger: "blur",
},
],
},
};
},
methods: {
init() {},
submit() {
this.$refs.form.validate((valid) => {
if (valid) {
//
this.submitLoading = true;
editDict(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.$emit("on-submit", this.form);
this.visible = false;
}
});
}
});
},
setCurrentValue(value) {
if (value === this.visible) {
return;
}
//
this.$refs.form.resetFields();
// null""
let v = this.data;
for (let attr in v) {
if (v[attr] == null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.form = data;
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>

623
src/views/app/shop/mernage.vue

@ -1,320 +1,329 @@
<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">
<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 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>
</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) {
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
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;
}
});
}
}
});
this.getRoleList();
},
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;
}
});
}
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();
},
};
},
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>
@import "@/styles/drawer-common.less";
</style>

35
src/views/app/shop/shop.vue

@ -116,12 +116,19 @@
</div>
</div>
</Drawer>
<Modal :title="商品列表" v-model="Visiable" :mask-closable="false" :scrollabele="true" :width="1800">
<goodsList ref="goodsPage" v-if="Visiable"></goodsList>
<div slot="footer" v-show=Visiable>
<Button type="text" @click="Visiable = false">关闭</Button>
</div>
</Modal>
<check-password ref="checkPass" @on-success="resetPass" />
<addEdit :data="form" :type="showType" v-model="showUser" @on-submit="getDataList" />
<mernage :data="form" ref="dialog" :type="showTypeMe" v-model="showmernage" @on-submit="getDataList" />
</div>
</template>
@ -153,6 +160,9 @@
import addEdit from "./addEdit.vue";
import mernage from "./mernage.vue";
import dict from "@/views/my-components/hiver/dict";
import goodsList from "./dictManage.vue";
import {
deleteShop,
disableShop,
@ -168,9 +178,11 @@
addEdit,
mernage,
dict,
goodsList
},
data() {
return {
Visiable:false,
tableSize: "default",
height: 510,
showUser: false,
@ -355,6 +367,21 @@
},
"删除"
),
h("Divider", {
props: {
type: "vertical",
},
}),
h(
"a", {
on: {
click: () => {
this.goodsList(params.row);
},
},
},
"新增商品"
),
]);
},
},
@ -646,6 +673,12 @@
this.showType = "2";
this.showUser = true;
},
goodsList(v){
this.Visiable = true;
// this.$nextTick(() => {
// this.$refs.dialog.initRecharge(v);
// });
},
edit(v) {
// null""
for (let attr in v) {

Loading…
Cancel
Save