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()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date updatedAt; 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) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -439,6 +447,54 @@ public class Users extends BaseEntity
return updatedAt; 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 @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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="id" column="id" />
<result property="title" column="title" /> <result property="title" column="title" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
<result property="order" column="order" /> <result property="order" column="order_data" />
<result property="lat" column="lat" /> <result property="lat" column="lat" />
<result property="lng" column="lng" /> <result property="lng" column="lng" />
<result property="provinceId" column="province_id" /> <result property="provinceId" column="province_id" />
@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectDiyCityVo"> <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> </sql>
<select id="selectDiyCityList" parameterType="DiyCity" resultMap="DiyCityResult"> <select id="selectDiyCityList" parameterType="DiyCity" resultMap="DiyCityResult">
@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="title != null and title != ''"> and title = #{title}</if> <if test="title != null and title != ''"> and title = #{title}</if>
<if test="parentId != null "> and parent_id = #{parentId}</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="lat != null and lat != ''"> and lat = #{lat}</if>
<if test="lng != null and lng != ''"> and lng = #{lng}</if> <if test="lng != null and lng != ''"> and lng = #{lng}</if>
<if test="provinceId != null "> and province_id = #{provinceId}</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=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">title,</if> <if test="title != null and title != ''">title,</if>
<if test="parentId != null">parent_id,</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="lat != null">lat,</if>
<if test="lng != null">lng,</if> <if test="lng != null">lng,</if>
<if test="provinceId != null">province_id,</if> <if test="provinceId != null">province_id,</if>
@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="title != null and title != ''">title = #{title},</if> <if test="title != null and title != ''">title = #{title},</if>
<if test="parentId != null">parent_id = #{parentId},</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="lat != null">lat = #{lat},</if>
<if test="lng != null">lng = #{lng},</if> <if test="lng != null">lng = #{lng},</if>
<if test="provinceId != null">province_id = #{provinceId},</if> <if test="provinceId != null">province_id = #{provinceId},</if>

View File

@ -44,9 +44,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUsersList" parameterType="Users" resultMap="UsersResult"> <select id="selectUsersList" parameterType="Users" resultMap="UsersResult">
<include refid="selectUsersVo"/> <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="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</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="password != null and password != ''"> and password = #{password}</if>
<if test="rememberToken != null and rememberToken != ''"> and remember_token = #{rememberToken}</if> <if test="rememberToken != null and rememberToken != ''"> and remember_token = #{rememberToken}</if>
<if test="openid != null and openid != ''"> and openid = #{openid}</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="commission != null "> and commission = #{commission}</if>
<if test="totalComm != null "> and total_comm = #{totalComm}</if> <if test="totalComm != null "> and total_comm = #{totalComm}</if>
<if test="margin != null "> and margin = #{margin}</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="prohibitTime != null "> and prohibit_time = #{prohibitTime}</if>
<if test="prohibitTimeNum != null "> and prohibit_time_num = #{prohibitTimeNum}</if> <if test="prohibitTimeNum != null "> and prohibit_time_num = #{prohibitTimeNum}</if>
<if test="toa != null "> and toa = #{toa}</if> <if test="toa != null "> and toa = #{toa}</if>

View File

@ -130,49 +130,54 @@
v-hasPermi="['system:DiyCity:export']" v-hasPermi="['system:DiyCity:export']"
>导出</el-button> >导出</el-button>
</el-col> </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> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="DiyCityList" @selection-change="handleSelectionChange"> <el-tree
<el-table-column type="selection" width="55" align="center" /> :data="DiyCityList"
<el-table-column label="${comment}" align="center" prop="id" /> :props="defaultProps"
<el-table-column label="名称" align="center" prop="title" /> node-key="id"
<el-table-column label="父级ID" align="center" prop="parentId" /> ref="tree"
<el-table-column label="排序" align="center" prop="order" /> highlight-current
<el-table-column label="纬度" align="center" prop="lat" /> @node-click="handleNodeClick"
<el-table-column label="经度" align="center" prop="lng" /> :expand-on-click-node="false"
<el-table-column label="省id" align="center" prop="provinceId" /> >
<el-table-column label="市" align="center" prop="cityId" /> <span slot-scope="{ data }">
<el-table-column label="区" align="center" prop="districtId" /> {{ data.title }}
<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 <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(data)"
v-hasPermi="['system:DiyCity:edit']" v-hasPermi="['system:DiyCity:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(data)"
v-hasPermi="['system:DiyCity:remove']" v-hasPermi="['system:DiyCity:remove']"
>删除</el-button> >删除</el-button>
</template> </span>
</el-table-column> </el-tree>
</el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
@ -254,7 +259,40 @@ export default {
// //
total: 0, 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: "", title: "",
// //
@ -284,6 +322,10 @@ export default {
parentId: [ parentId: [
{ required: true, message: "父级ID不能为空", trigger: "blur" } { required: true, message: "父级ID不能为空", trigger: "blur" }
], ],
},
defaultProps: {
children: 'children',
label: 'title'
} }
} }
}, },
@ -389,6 +431,19 @@ export default {
this.download('system/DiyCity/export', { this.download('system/DiyCity/export', {
...this.queryParams ...this.queryParams
}, `DiyCity_${new Date().getTime()}.xlsx`) }, `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,197 +1,179 @@
<template> <template>
<div class="app-container"> <div class="sysseting-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-tabs v-model="activeTab">
<el-form-item label="名称" prop="name"> <el-tab-pane label="基本信息" name="base">
<el-input <el-form :model="baseForm" label-width="120px" class="tab-form">
v-model="queryParams.name" <el-form-item label="投诉电话">
placeholder="请输入名称" <el-input v-model="baseForm.phone" placeholder="请输入投诉电话" style="width: 300px" />
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item label="${comment}" prop="createdAt"> <el-form-item label="抢单开始时间">
<el-date-picker clearable <el-time-picker v-model="baseForm.startTime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="width: 150px" />
v-model="queryParams.createdAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="${comment}" prop="updatedAt"> <el-form-item label="抢单结束时间">
<el-date-picker clearable <el-time-picker v-model="baseForm.endTime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="width: 150px" />
v-model="queryParams.updatedAt" </el-form-item>
type="date" <el-form-item label="质保金扣除比例">
value-format="yyyy-MM-dd" <el-input-number v-model="baseForm.marginRate" :min="0" :max="100" />
placeholder="请选择${comment}"> <span style="margin-left: 8px">%</span>
</el-date-picker> </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-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" @click="saveAllConfig('1')">提交</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button @click="resetBase">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-tab-pane>
<el-row :gutter="10" class="mb8"> <el-tab-pane label="文本配置" name="text">
<el-col :span="1.5"> <el-form :model="textForm" label-width="120px" class="tab-form">
<el-button <el-form-item label="公司名称">
type="primary" <el-input v-model="textForm.company" placeholder="请输入公司名称" />
plain </el-form-item>
icon="el-icon-plus" <el-form-item label="简介">
size="mini" <el-input type="textarea" v-model="textForm.intro" :rows="4" placeholder="请输入公司简介" />
@click="handleAdd" </el-form-item>
v-hasPermi="['system:SiteConfig:add']" <el-form-item label="质保金说明">
>新增</el-button> <quill-editor v-model="textForm.marginDesc" :options="editorOptions" />
</el-col> </el-form-item>
<el-col :span="1.5"> <el-form-item>
<el-button <el-button type="primary" @click="saveAllConfig('2')">提交</el-button>
type="success" <el-button @click="resetText">重置</el-button>
plain </el-form-item>
icon="el-icon-edit" </el-form>
size="mini" </el-tab-pane>
:disabled="single" <el-tab-pane label="下单时间配置" name="orderTime">
@click="handleUpdate" <el-form label-width="120px" class="tab-form">
v-hasPermi="['system:SiteConfig:edit']" <el-form-item label="下单时间">
>修改</el-button> <div v-for="(item, idx) in orderTimes" :key="idx" style="display: flex; align-items: center; margin-bottom: 8px;">
</el-col> <el-time-picker
<el-col :span="1.5"> v-model="item.start"
<el-button placeholder="开始时间"
type="danger" format="HH:mm"
plain value-format="HH:mm"
icon="el-icon-delete" style="width: 130px; margin-right: 8px;"
size="mini" @change="updateTimeRange(idx)"
: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"
/> />
<span style="margin: 0 4px;">-</span>
<!-- 添加或修改系统配置对话框 --> <el-time-picker
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> v-model="item.end"
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> placeholder="结束时间"
<el-form-item label="名称" prop="name"> format="HH:mm"
<el-input v-model="form.name" placeholder="请输入名称" /> 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-form-item label="值" prop="value"> <el-form-item>
<el-input v-model="form.value" type="textarea" placeholder="请输入内容" /> <el-button type="primary" @click="saveAllConfig('3')">提交</el-button>
</el-form-item> <el-button @click="resetOrderTime">重置</el-button>
<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-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> </el-tab-pane>
<el-button type="primary" @click="submitForm"> </el-button> <el-tab-pane label="时间配置" name="time">
<el-button @click="cancel"> </el-button> <el-form :model="timeForm" label-width="120px" class="tab-form">
</div> <el-form-item label="每月提现时间">
</el-dialog> <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> </div>
</template> </template>
<script> <script>
import { listSiteConfig, getSiteConfig, delSiteConfig, addSiteConfig, updateSiteConfig } from "@/api/system/SiteConfig" 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 { export default {
name: "SiteConfig", name: 'SysSeting',
components: {
quillEditor
},
data() { data() {
return { return {
// //
loading: true, loading: true,
// activeTab: 'base',
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
SiteConfigList: [], SiteConfigList: [],
// config_one: {},
title: "", config_two: {},
// config_three: {},
open: false, config_four: {},
// total: 0, //
queryParams: { //
pageNum: 1, baseForm: {
pageSize: 10, phone: '',
name: null, startTime: '',
value: null, endTime: '',
createdAt: null, marginRate: 10,
updatedAt: null orderScore: 100,
hotwords: ['水电维修', '家电清洗', '灯具维修', '墙面翻新', '门窗家具', '疏通维修', '防水维修'],
qrUrl: ''
}, },
// //
form: {}, textForm: {
// company: '',
rules: { intro: '',
marginDesc: ''
},
//
orderTimes: [
],
//
timeForm: {
withdrawDays: ['8号', '18号', '28号'],
autoOrderMinutes: 10,
cancelOrderDays: 7
},
editorOptions: {
placeholder: '请输入质保金说明...'
} }
} }
}, },
@ -204,94 +186,211 @@ export default {
this.loading = true this.loading = true
listSiteConfig(this.queryParams).then(response => { listSiteConfig(this.queryParams).then(response => {
this.SiteConfigList = response.rows 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.total = response.total
this.loading = false this.loading = false
}) })
}, },
// //
cancel() { submitBase() {
this.open = false this.$message.success('提交成功(模拟)')
this.reset()
}, },
// resetBase() {
reset() { this.$refs.baseForm && this.$refs.baseForm.resetFields && this.$refs.baseForm.resetFields()
this.form = { },
id: null, handleQrChange(file) {
name: null, //
value: null, const reader = new FileReader()
createdAt: null, reader.onload = e => {
updatedAt: null this.baseForm.qrUrl = e.target.result
} }
this.resetForm("form") reader.readAsDataURL(file.raw)
}, },
/** 搜索按钮操作 */ beforeQrUpload(file) {
handleQuery() { const isImg = file.type.startsWith('image/')
this.queryParams.pageNum = 1 if (!isImg) {
this.getList() this.$message.error('只能上传图片格式')
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加系统配置"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getSiteConfig(id).then(response => {
this.form = response.data
this.open = true
this.title = "修改系统配置"
})
},
/** 提交按钮 */
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()
})
} }
return isImg
},
//
submitText() {
this.$message.success('提交成功(模拟)')
},
resetText() {
this.textForm = { company: '', intro: '', marginDesc: '' }
},
//
updateTimeRange(idx) {
const item = this.orderTimes[idx];
if (item.start && item.end && item.start >= item.end) {
this.$message.error('结束时间必须大于开始时间');
item.end = '';
} }
})
}, },
/** 删除按钮操作 */ addOrderTime() {
handleDelete(row) { this.orderTimes.push({ start: '', end: '', count: 99 });
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除系统配置编号为"' + ids + '"的数据项?').then(function() {
return delSiteConfig(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
}, },
/** 导出按钮操作 */ removeOrderTime(idx) {
handleExport() { this.orderTimes.splice(idx, 1)
this.download('system/SiteConfig/export', { },
...this.queryParams submitOrderTime() {
}, `SiteConfig_${new Date().getTime()}.xlsx`) //
const timeList = this.orderTimes.map(item => ({
time: `${item.start}-${item.end}`,
count: item.count
}));
// timeList
this.$message.success('提交成功(模拟)')
},
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> </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>