202505261413

This commit is contained in:
张潘 2025-05-26 14:13:52 +08:00
parent 0a9592f7a2
commit e2ab03ffcc
5 changed files with 534 additions and 307 deletions

View File

@ -139,6 +139,14 @@ public class Users extends BaseEntity
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date updatedAt;
//-------------------------------------------------------------------------------------------
private BigDecimal totalCommMin;
private BigDecimal totalCommMax;
private BigDecimal marginMin;
private BigDecimal marginMax;
private BigDecimal commissionMin;
private BigDecimal commissionMax;
public void setId(Long id)
{
this.id = id;
@ -439,6 +447,54 @@ public class Users extends BaseEntity
return updatedAt;
}
public BigDecimal getCommissionMax() {
return commissionMax;
}
public void setCommissionMax(BigDecimal commissionMax) {
this.commissionMax = commissionMax;
}
public BigDecimal getCommissionMin() {
return commissionMin;
}
public void setCommissionMin(BigDecimal commissionMin) {
this.commissionMin = commissionMin;
}
public BigDecimal getMarginMax() {
return marginMax;
}
public void setMarginMax(BigDecimal marginMax) {
this.marginMax = marginMax;
}
public BigDecimal getMarginMin() {
return marginMin;
}
public void setMarginMin(BigDecimal marginMin) {
this.marginMin = marginMin;
}
public BigDecimal getTotalCommMax() {
return totalCommMax;
}
public void setTotalCommMax(BigDecimal totalCommMax) {
this.totalCommMax = totalCommMax;
}
public BigDecimal getTotalCommMin() {
return totalCommMin;
}
public void setTotalCommMin(BigDecimal totalCommMin) {
this.totalCommMin = totalCommMin;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" />
<result property="title" column="title" />
<result property="parentId" column="parent_id" />
<result property="order" column="order" />
<result property="order" column="order_data" />
<result property="lat" column="lat" />
<result property="lng" column="lng" />
<result property="provinceId" column="province_id" />
@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDiyCityVo">
select id, title, parent_id, order, lat, lng, province_id, city_id, district_id, created_at, updated_at from diy_city
select id, title, parent_id, order_data, lat, lng, province_id, city_id, district_id, created_at, updated_at from diy_city
</sql>
<select id="selectDiyCityList" parameterType="DiyCity" resultMap="DiyCityResult">
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="order != null "> and order = #{order}</if>
<if test="order != null "> and order_data = #{order}</if>
<if test="lat != null and lat != ''"> and lat = #{lat}</if>
<if test="lng != null and lng != ''"> and lng = #{lng}</if>
<if test="provinceId != null "> and province_id = #{provinceId}</if>
@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">title,</if>
<if test="parentId != null">parent_id,</if>
<if test="order != null">order,</if>
<if test="order != null">order_data,</if>
<if test="lat != null">lat,</if>
<if test="lng != null">lng,</if>
<if test="provinceId != null">province_id,</if>
@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="order != null">order = #{order},</if>
<if test="order != null">order_data = #{order},</if>
<if test="lat != null">lat = #{lat},</if>
<if test="lng != null">lng = #{lng},</if>
<if test="provinceId != null">province_id = #{provinceId},</if>

View File

@ -43,10 +43,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUsersList" parameterType="Users" resultMap="UsersResult">
<include refid="selectUsersVo"/>
<where>
<where>
<if test="totalCommMin != null and totalCommMax != null">
and total_comm BETWEEN #{totalCommMin} AND #{totalCommMax}
</if>
<if test="marginMin != null and marginMax != null">
and margin BETWEEN #{marginMin} AND #{marginMax}
</if>
<if test="commissionMin != null and commissionMax != null">
and commission BETWEEN #{commissionMin} AND #{commissionMax}
</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="jobNumber != null "> and job_number like concat('%', #{jobNumber}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
<if test="password != null and password != ''"> and password = #{password}</if>
<if test="rememberToken != null and rememberToken != ''"> and remember_token = #{rememberToken}</if>
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
@ -60,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="commission != null "> and commission = #{commission}</if>
<if test="totalComm != null "> and total_comm = #{totalComm}</if>
<if test="margin != null "> and margin = #{margin}</if>
<if test="jobNumber != null "> and job_number = #{jobNumber}</if>
<if test="prohibitTime != null "> and prohibit_time = #{prohibitTime}</if>
<if test="prohibitTimeNum != null "> and prohibit_time_num = #{prohibitTimeNum}</if>
<if test="toa != null "> and toa = #{toa}</if>

View File

@ -130,49 +130,54 @@
v-hasPermi="['system:DiyCity:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-expand"
size="mini"
@click="expandAll"
>展开</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-fold"
size="mini"
@click="collapseAll"
>收起</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="DiyCityList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="名称" align="center" prop="title" />
<el-table-column label="父级ID" align="center" prop="parentId" />
<el-table-column label="排序" align="center" prop="order" />
<el-table-column label="纬度" align="center" prop="lat" />
<el-table-column label="经度" align="center" prop="lng" />
<el-table-column label="省id" align="center" prop="provinceId" />
<el-table-column label="市" align="center" prop="cityId" />
<el-table-column label="区" align="center" prop="districtId" />
<el-table-column label="${comment}" align="center" prop="createdAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="${comment}" align="center" prop="updatedAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:DiyCity:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:DiyCity:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<el-tree
:data="DiyCityList"
:props="defaultProps"
node-key="id"
ref="tree"
highlight-current
@node-click="handleNodeClick"
:expand-on-click-node="false"
>
<span slot-scope="{ data }">
{{ data.title }}
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(data)"
v-hasPermi="['system:DiyCity:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(data)"
v-hasPermi="['system:DiyCity:remove']"
>删除</el-button>
</span>
</el-tree>
<pagination
v-show="total>0"
@ -254,7 +259,40 @@ export default {
//
total: 0,
//
DiyCityList: [],
DiyCityList: [
{
id: 1,
title: '西安市',
children: [
{ id: 5, title: '西咸新区' },
{ id: 2, title: '未央区' },
{ id: 7, title: '莲湖区' },
{ id: 10, title: '雁塔区' },
{ id: 11, title: '高新区' },
{ id: 12, title: '长安区' },
{ id: 13, title: '新城区' },
{ id: 14, title: '碑林区' },
{ id: 15, title: '灞桥区' },
{ id: 16, title: '临潼区' },
{ id: 17, title: '高陵区' }
]
},
{
id: 27,
title: '上海市',
children: []
},
{
id: 44,
title: '长沙市',
children: []
},
{
id: 52,
title: '合肥市',
children: []
}
],
//
title: "",
//
@ -284,6 +322,10 @@ export default {
parentId: [
{ required: true, message: "父级ID不能为空", trigger: "blur" }
],
},
defaultProps: {
children: 'children',
label: 'title'
}
}
},
@ -389,6 +431,19 @@ export default {
this.download('system/DiyCity/export', {
...this.queryParams
}, `DiyCity_${new Date().getTime()}.xlsx`)
},
expandAll() {
this.$refs.tree.store.nodesMap.forEach(node => {
this.$refs.tree.store.expandNode(node, true)
})
},
collapseAll() {
this.$refs.tree.store.nodesMap.forEach(node => {
this.$refs.tree.store.collapseNode(node, true)
})
},
handleNodeClick(data) {
console.log(data)
}
}
}

View File

@ -1,297 +1,396 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="${comment}" prop="createdAt">
<el-date-picker clearable
v-model="queryParams.createdAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="updatedAt">
<el-date-picker clearable
v-model="queryParams.updatedAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:SiteConfig:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:SiteConfig:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:SiteConfig:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:SiteConfig:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="SiteConfigList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="${comment}" align="center" prop="id" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="值" align="center" prop="value" />
<el-table-column label="${comment}" align="center" prop="createdAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="${comment}" align="center" prop="updatedAt" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:SiteConfig:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:SiteConfig:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改系统配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="值" prop="value">
<el-input v-model="form.value" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="${comment}" prop="createdAt">
<el-date-picker clearable
v-model="form.createdAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="updatedAt">
<el-date-picker clearable
v-model="form.updatedAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<div class="sysseting-container">
<el-tabs v-model="activeTab">
<el-tab-pane label="基本信息" name="base">
<el-form :model="baseForm" label-width="120px" class="tab-form">
<el-form-item label="投诉电话">
<el-input v-model="baseForm.phone" placeholder="请输入投诉电话" style="width: 300px" />
</el-form-item>
<el-form-item label="抢单开始时间">
<el-time-picker v-model="baseForm.startTime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="width: 150px" />
</el-form-item>
<el-form-item label="抢单结束时间">
<el-time-picker v-model="baseForm.endTime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="width: 150px" />
</el-form-item>
<el-form-item label="质保金扣除比例">
<el-input-number v-model="baseForm.marginRate" :min="0" :max="100" />
<span style="margin-left: 8px">%</span>
</el-form-item>
<el-form-item label="下单送积分">
<el-input v-model="baseForm.orderScore" style="width: 120px" />
<el-tooltip content="下单支付金额多少元赠送1积分不填则不赠送" placement="right">
<i class="el-icon-question" style="margin-left: 8px; color: #999" />
</el-tooltip>
</el-form-item>
<el-form-item label="搜索热词">
<el-select v-model="baseForm.hotwords" multiple filterable allow-create default-first-option placeholder="请输入热词" style="width: 600px">
<el-option v-for="item in baseForm.hotwords" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item label="客服二维码">
<el-upload
class="avatar-uploader"
action="#"
:show-file-list="false"
:on-change="handleQrChange"
:before-upload="beforeQrUpload"
>
<img v-if="baseForm.qrUrl" :src="baseForm.qrUrl" class="qr-img" />
<i v-else class="el-icon-plus avatar-uploader-icon" />
</el-upload>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveAllConfig('1')">提交</el-button>
<el-button @click="resetBase">重置</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="文本配置" name="text">
<el-form :model="textForm" label-width="120px" class="tab-form">
<el-form-item label="公司名称">
<el-input v-model="textForm.company" placeholder="请输入公司名称" />
</el-form-item>
<el-form-item label="简介">
<el-input type="textarea" v-model="textForm.intro" :rows="4" placeholder="请输入公司简介" />
</el-form-item>
<el-form-item label="质保金说明">
<quill-editor v-model="textForm.marginDesc" :options="editorOptions" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveAllConfig('2')">提交</el-button>
<el-button @click="resetText">重置</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="下单时间配置" name="orderTime">
<el-form label-width="120px" class="tab-form">
<el-form-item label="下单时间">
<div v-for="(item, idx) in orderTimes" :key="idx" style="display: flex; align-items: center; margin-bottom: 8px;">
<el-time-picker
v-model="item.start"
placeholder="开始时间"
format="HH:mm"
value-format="HH:mm"
style="width: 130px; margin-right: 8px;"
@change="updateTimeRange(idx)"
/>
<span style="margin: 0 4px;">-</span>
<el-time-picker
v-model="item.end"
placeholder="结束时间"
format="HH:mm"
value-format="HH:mm"
style="width: 130px; margin-right: 12px;"
@change="updateTimeRange(idx)"
/>
<el-input-number v-model="item.count" :min="0" style="width:25%; margin-right: 12px;" />
<el-button icon="el-icon-delete" type="danger" @click="removeOrderTime(idx)" circle />
</div>
<el-button type="primary" icon="el-icon-plus" @click="addOrderTime">新增</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveAllConfig('3')">提交</el-button>
<el-button @click="resetOrderTime">重置</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
<el-tab-pane label="时间配置" name="time">
<el-form :model="timeForm" label-width="120px" class="tab-form">
<el-form-item label="每月提现时间">
<el-select v-model="timeForm.withdrawDays" multiple placeholder="请选择日期" style="width: 300px">
<el-option v-for="d in 31" :key="d" :label="d + '号'" :value="d + '号'" />
</el-select>
</el-form-item>
<el-form-item label="定时接单时长">
<el-input-number v-model="timeForm.autoOrderMinutes" :min="1" style="width: 120px" />
<span style="margin-left: 8px">分钟</span>
<div class="el-form-item__tip">订单无人接单时多少分钟后自动重新派单单位分钟</div>
</el-form-item>
<el-form-item label="取消订单时长">
<el-input-number v-model="timeForm.cancelOrderDays" :min="1" style="width: 120px" />
<span style="margin-left: 8px"></span>
<div class="el-form-item__tip">师傅到达之后多久之后没有报工则取消订单单位</div>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveAllConfig('4')">提交</el-button>
<el-button @click="resetTime">重置</el-button>
</el-form-item>
</el-form>
</el-tab-pane>
</el-tabs>
<el-button type="primary" style="margin-top: 24px;" @click="saveAllConfig">保存全部配置</el-button>
</div>
</template>
<script>
import { listSiteConfig, getSiteConfig, delSiteConfig, addSiteConfig, updateSiteConfig } from "@/api/system/SiteConfig"
import { quillEditor } from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
export default {
name: "SiteConfig",
name: 'SysSeting',
components: {
quillEditor
},
data() {
return {
//
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
activeTab: 'base',
SiteConfigList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
value: null,
createdAt: null,
updatedAt: null
config_one: {},
config_two: {},
config_three: {},
config_four: {},
total: 0, //
//
baseForm: {
phone: '',
startTime: '',
endTime: '',
marginRate: 10,
orderScore: 100,
hotwords: ['水电维修', '家电清洗', '灯具维修', '墙面翻新', '门窗家具', '疏通维修', '防水维修'],
qrUrl: ''
},
//
form: {},
//
rules: {
//
textForm: {
company: '',
intro: '',
marginDesc: ''
},
//
orderTimes: [
],
//
timeForm: {
withdrawDays: ['8号', '18号', '28号'],
autoOrderMinutes: 10,
cancelOrderDays: 7
},
editorOptions: {
placeholder: '请输入质保金说明...'
}
}
},
created() {
this.getList()
},
this.getList()
},
methods: {
/** 查询系统配置列表 */
getList() {
/** 查询系统配置列表 */
getList() {
this.loading = true
listSiteConfig(this.queryParams).then(response => {
this.SiteConfigList = response.rows
// config_one
this.config_one=response.rows.find(item => item.name === 'config_one')
const configOneObj =JSON.parse(this.config_one.value)
if (configOneObj) {
this.baseForm = {
phone: configOneObj.phone || '',
startTime:configOneObj.loot_start || '',
endTime: configOneObj.loot_end || '',
marginRate: configOneObj.margin || 10,
orderScore: configOneObj.orderScore || 100,
hotwords: configOneObj.hot || [],
qrUrl: configOneObj.kf || '',
}
}
// config_two
this.config_two=response.rows.find(item => item.name === 'config_two')
const configTwoObj =JSON.parse(this.config_two.value)
if (configTwoObj) {
this.textForm = {
company: configTwoObj.name || '',
intro: configTwoObj.brief || '',
marginDesc: configTwoObj.money_explain || ''
}
}
// config_three
this.config_three=response.rows.find(item => item.name === 'config_three')
let _data=JSON.parse(this.config_three.value)
for(let key in _data.time){
const [start, end] =_data.time[key].key.split('-');
this.orderTimes.push({
start: start || '',
end: end || '',
count: _data.time[key].num || 99
})
}
// config_four
this.config_four=response.rows.find(item => item.name === 'config_four')
const configFourObj =JSON.parse(this.config_four.value)
if (configFourObj) {
this.timeForm = {
withdrawDays: configFourObj.time || [],
autoOrderMinutes: configFourObj.order_time || 10,
cancelOrderDays: configFourObj.remove_time || 7
}
}
this.total = response.total
this.loading = false
})
},
//
cancel() {
this.open = false
this.reset()
//
submitBase() {
this.$message.success('提交成功(模拟)')
},
//
reset() {
this.form = {
id: null,
name: null,
value: null,
createdAt: null,
updatedAt: null
resetBase() {
this.$refs.baseForm && this.$refs.baseForm.resetFields && this.$refs.baseForm.resetFields()
},
handleQrChange(file) {
//
const reader = new FileReader()
reader.onload = e => {
this.baseForm.qrUrl = e.target.result
}
this.resetForm("form")
reader.readAsDataURL(file.raw)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
beforeQrUpload(file) {
const isImg = file.type.startsWith('image/')
if (!isImg) {
this.$message.error('只能上传图片格式')
}
return isImg
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
//
submitText() {
this.$message.success('提交成功(模拟)')
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
resetText() {
this.textForm = { company: '', intro: '', marginDesc: '' }
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加系统配置"
//
updateTimeRange(idx) {
const item = this.orderTimes[idx];
if (item.start && item.end && item.start >= item.end) {
this.$message.error('结束时间必须大于开始时间');
item.end = '';
}
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getSiteConfig(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改系统配置"
})
addOrderTime() {
this.orderTimes.push({ start: '', end: '', count: 99 });
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateSiteConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addSiteConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
removeOrderTime(idx) {
this.orderTimes.splice(idx, 1)
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除系统配置编号为"' + ids + '"的数据项?').then(function() {
return delSiteConfig(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
submitOrderTime() {
//
const timeList = this.orderTimes.map(item => ({
time: `${item.start}-${item.end}`,
count: item.count
}));
// timeList
this.$message.success('提交成功(模拟)')
},
/** 导出按钮操作 */
handleExport() {
this.download('system/SiteConfig/export', {
...this.queryParams
}, `SiteConfig_${new Date().getTime()}.xlsx`)
resetOrderTime() {
this.orderTimes = [
]
},
//
submitTime() {
this.$message.success('提交成功(模拟)')
},
resetTime() {
this.timeForm = { withdrawDays: ['8号', '18号', '28号'], autoOrderMinutes: 10, cancelOrderDays: 7 }
},
async saveAllConfig(e) {
// 1. config_one
const config_one = {
phone: this.baseForm.phone,
loot_start: this.baseForm.startTime,
loot_end: this.baseForm.endTime,
margin: this.baseForm.marginRate,
orderScore: this.baseForm.orderScore,
hot: this.baseForm.hotwords,
kf: this.baseForm.qrUrl
};
// 2. config_two
const config_two = {
name: this.textForm.company,
brief: this.textForm.intro,
money_explain: this.textForm.marginDesc
};
// 3. config_three
const config_three = {
time: this.orderTimes.map(item => ({
key: `${item.start}-${item.end}`,
num: item.count
}))
};
// 4. config_four
const config_four = {
time: this.timeForm.withdrawDays,
order_time: this.timeForm.autoOrderMinutes,
remove_time: this.timeForm.cancelOrderDays
};
try {
if(e=='1'){
await updateSiteConfig({ name: 'config_one',id:this.config_one.id, value: JSON.stringify(config_one) });
}else if(e=='2'){
await updateSiteConfig({ name: 'config_two',id:this.config_two.id, value: JSON.stringify(config_two) });
}else if(e=='3'){
await updateSiteConfig({ name: 'config_three',id:this.config_three.id, value: JSON.stringify(config_three) });
}else if(e=='4'){
await updateSiteConfig({ name: 'config_four',id:this.config_four.id, value: JSON.stringify(config_four) });
}
this.$message.success('保存成功!');
this.getList();
} catch (e) {
this.$message.error('保存失败,请重试');
}
}
}
}
</script>
<style scoped>
.sysseting-container {
background: #fff;
padding: 24px;
min-height: 600px;
}
.tab-form {
max-width: 900px;
}
.qr-img {
width: 120px;
height: 120px;
border: 1px solid #eee;
display: block;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
width: 120px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
}
.avatar-uploader-icon {
font-size: 32px;
color: #8c939d;
}
</style>