1165 lines
28 KiB
Vue
1165 lines
28 KiB
Vue
|
<template>
|
|||
|
<div>
|
|||
|
<!-- 服务包列表 -->
|
|||
|
<div style="position: relative; display: inline-block; margin: 5px">
|
|||
|
<span>项目类型:</span>
|
|||
|
<el-select
|
|||
|
clearable
|
|||
|
v-model="type"
|
|||
|
style="width: 150px; margin-left: 10px">
|
|||
|
<el-option
|
|||
|
v-for="item in typeDictData"
|
|||
|
:key="item.id"
|
|||
|
:label="item.value"
|
|||
|
:value="item.code">
|
|||
|
</el-option>
|
|||
|
</el-select>
|
|||
|
</div>
|
|||
|
<div style="position: relative; display: inline-block">
|
|||
|
<span>城市:</span>
|
|||
|
<el-input
|
|||
|
style="width: 200px"
|
|||
|
placeholder="请输入城市"
|
|||
|
v-model="city"
|
|||
|
>
|
|||
|
</el-input>
|
|||
|
</div>
|
|||
|
<div style="position: relative; display: inline-block">
|
|||
|
<span>项目名称:</span>
|
|||
|
<el-input
|
|||
|
style="width: 200px"
|
|||
|
placeholder="请输入服务名称"
|
|||
|
v-model="title">
|
|||
|
</el-input>
|
|||
|
</div>
|
|||
|
<div style="position: relative; display: inline-block">
|
|||
|
<span>状态:</span>
|
|||
|
<el-select
|
|||
|
clearable
|
|||
|
v-model="status"
|
|||
|
style="width: 150px; margin-left: 10px">
|
|||
|
<el-option value="1" label="上线"></el-option>
|
|||
|
<el-option value="2" label="下线"></el-option>
|
|||
|
</el-select>
|
|||
|
</div>
|
|||
|
<el-button
|
|||
|
style="margin: 10px"
|
|||
|
size="mini"
|
|||
|
type="primary"
|
|||
|
icon="document"
|
|||
|
@click="handleSelect"
|
|||
|
>查询
|
|||
|
</el-button>
|
|||
|
<el-button
|
|||
|
style="margin: 10px"
|
|||
|
size="mini"
|
|||
|
type="primary"
|
|||
|
icon="document"
|
|||
|
@click="handleClear"
|
|||
|
>重置
|
|||
|
</el-button
|
|||
|
>
|
|||
|
<div style="text-align: right; display: inline-block">
|
|||
|
<el-button
|
|||
|
style="margin: 10px"
|
|||
|
size="mini"
|
|||
|
type="primary"
|
|||
|
icon="document"
|
|||
|
@click="handleEdit(0)"
|
|||
|
>添加
|
|||
|
</el-button>
|
|||
|
</div>
|
|||
|
<el-table v-loading="tableDataLoading" :data="tableData.list">
|
|||
|
<el-table-column
|
|||
|
prop="id"
|
|||
|
label="编号"
|
|||
|
width="80"
|
|||
|
fixed="left"
|
|||
|
>
|
|||
|
</el-table-column>
|
|||
|
<!-- <el-table-column-->
|
|||
|
<!-- prop="type"-->
|
|||
|
<!-- label="服务类型"-->
|
|||
|
<!-- fixed="left"-->
|
|||
|
<!-- width="150"-->
|
|||
|
<!-- >-->
|
|||
|
<!-- </el-table-column>-->
|
|||
|
<el-table-column label="服务类型" fixed="left" prop="type">
|
|||
|
<template slot-scope="scope">
|
|||
|
{{ showDictValue(scope.row.type, typeDictData) }}
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column
|
|||
|
prop="title"
|
|||
|
label="名称"
|
|||
|
fixed="left"
|
|||
|
width="150"
|
|||
|
>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column prop="packageImg" label="图片">
|
|||
|
<template slot-scope="scope">
|
|||
|
<img
|
|||
|
v-if="scope.row.packageImg && scope.row.packageImg != ''"
|
|||
|
:src="scope.row.packageImg"
|
|||
|
width="40"
|
|||
|
height="40"
|
|||
|
/>
|
|||
|
<span v-else>暂无图片</span>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column prop="contentImg" label="详情图" width="250">
|
|||
|
<template slot-scope="scope">
|
|||
|
<div
|
|||
|
v-for="(item, index) in scope.row.contentImg"
|
|||
|
:key="index"
|
|||
|
style="display: inline-block; margin: 3px"
|
|||
|
>
|
|||
|
<el-popover placement="top-start" title="" trigger="hover">
|
|||
|
<img
|
|||
|
style="width: 50px; height: 50px"
|
|||
|
:src="item"
|
|||
|
alt=""
|
|||
|
slot="reference"
|
|||
|
/>
|
|||
|
<img style="width: 300px; height: auto" :src="item" alt=""/>
|
|||
|
</el-popover>
|
|||
|
</div>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column prop="city" label="城市" width="100">
|
|||
|
<template slot-scope="scope">
|
|||
|
<span v-if="scope.row.city">{{ scope.row.city }}</span>
|
|||
|
<span v-else>不限</span>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column prop="oldPrice" label="原价"></el-table-column>
|
|||
|
<el-table-column prop="price" label="现价"></el-table-column>
|
|||
|
<el-table-column prop="labels" label="标签" width="150">
|
|||
|
</el-table-column>
|
|||
|
<el-table-column prop="sales" label="销量" width="150">
|
|||
|
<template slot-scope="scope">
|
|||
|
<span>{{ scope.row.sales }}</span>
|
|||
|
<el-button
|
|||
|
size="mini"
|
|||
|
type="primary"
|
|||
|
plain
|
|||
|
@click="showUpdateSalesView(scope.row)"
|
|||
|
style="margin: 5px"
|
|||
|
>修改
|
|||
|
</el-button
|
|||
|
>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column prop="sales" label="好评" width="150">
|
|||
|
<template slot-scope="scope">
|
|||
|
<span>{{ scope.row.esteemRate }}</span>
|
|||
|
<el-button
|
|||
|
size="mini"
|
|||
|
type="primary"
|
|||
|
plain
|
|||
|
@click="showUpdateEsteemRateView(scope.row)"
|
|||
|
style="margin: 5px"
|
|||
|
>修改
|
|||
|
</el-button
|
|||
|
>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column prop="addNum" label="加钟数"></el-table-column>
|
|||
|
<el-table-column prop="status" label="状态">
|
|||
|
<template slot-scope="scope">
|
|||
|
<el-switch
|
|||
|
v-model="scope.row.status"
|
|||
|
@change="changeStatus(scope.row.id, scope.row.status)"
|
|||
|
:active-value="openValue"
|
|||
|
:inactive-value="closeValue"
|
|||
|
active-color="#13ce66"
|
|||
|
inactive-color="#ff4949"
|
|||
|
>
|
|||
|
</el-switch>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
<el-table-column label="操作" prop="id" width="360" fixed="right">
|
|||
|
<template slot-scope="scope">
|
|||
|
<el-button
|
|||
|
size="mini"
|
|||
|
type="primary"
|
|||
|
style="margin: 5px"
|
|||
|
@click="handleEdit(scope.row)"
|
|||
|
>修改
|
|||
|
</el-button>
|
|||
|
<el-button
|
|||
|
size="mini"
|
|||
|
type="danger"
|
|||
|
style="margin: 5px"
|
|||
|
@click="handleDelete(scope.row)"
|
|||
|
>删除
|
|||
|
</el-button>
|
|||
|
</template>
|
|||
|
</el-table-column>
|
|||
|
</el-table>
|
|||
|
<div style="text-align: center; margin-top: 10px">
|
|||
|
<el-pagination
|
|||
|
@size-change="handleSizeChange"
|
|||
|
@current-change="handleCurrentChange"
|
|||
|
:page-sizes="[10, 20, 30, 40]"
|
|||
|
:page-size="limit"
|
|||
|
:current-page="page"
|
|||
|
layout="total,sizes, prev, pager, next,jumper"
|
|||
|
:total="tableData.totalCount"
|
|||
|
>
|
|||
|
</el-pagination>
|
|||
|
</div>
|
|||
|
|
|||
|
<!-- 修改销量 -->
|
|||
|
<el-dialog title="修改销量" :visible.sync="dialogFormVisibleSales" center>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>销量:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="sales"
|
|||
|
type="number"
|
|||
|
min="0"
|
|||
|
placeholder="请输入销量"
|
|||
|
>
|
|||
|
</el-input>
|
|||
|
</div>
|
|||
|
<div slot="footer" class="dialog-footer">
|
|||
|
<el-button @click="dialogFormVisibleSales = false">取 消</el-button>
|
|||
|
<el-button type="primary" @click="updateSales()">确 定</el-button>
|
|||
|
</div>
|
|||
|
</el-dialog>
|
|||
|
|
|||
|
<!-- 修改好评 -->
|
|||
|
<el-dialog title="修改好评" :visible.sync="dialogFormVisibleEsteemRate" center>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>好评%:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="esteemRate"
|
|||
|
type="number"
|
|||
|
min="0"
|
|||
|
placeholder="请输入好评率0-100,不要输入%"
|
|||
|
>
|
|||
|
</el-input>
|
|||
|
</div>
|
|||
|
<div slot="footer" class="dialog-footer">
|
|||
|
<el-button @click="dialogFormVisibleEsteemRate = false">取 消</el-button>
|
|||
|
<el-button type="primary" @click="updateEsteemRate()">确 定</el-button>
|
|||
|
</div>
|
|||
|
</el-dialog>
|
|||
|
|
|||
|
<!-- 添加、修改项目 -->
|
|||
|
<el-dialog :title="titles" :visible.sync="dialogFormVisible" center>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>类型:</span
|
|||
|
>
|
|||
|
<el-select clearable v-model="type" style="width: 50%">
|
|||
|
<el-option
|
|||
|
v-for="item in typeDictData"
|
|||
|
:key="item.id"
|
|||
|
:label="item.value"
|
|||
|
:value="item.code"
|
|||
|
>
|
|||
|
</el-option>
|
|||
|
</el-select
|
|||
|
>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>名称:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="title"
|
|||
|
type="text"
|
|||
|
placeholder="请输入服务包名称"
|
|||
|
>
|
|||
|
</el-input>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px; display: flex">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>图片:</span
|
|||
|
>
|
|||
|
<div
|
|||
|
style="
|
|||
|
width: 148px;
|
|||
|
height: 148px;
|
|||
|
border: 1px dashed #c0ccda;
|
|||
|
border-radius: 6px;
|
|||
|
text-align: center;
|
|||
|
line-height: 148px;
|
|||
|
"
|
|||
|
>
|
|||
|
<el-upload
|
|||
|
class="avatar-uploader"
|
|||
|
v-model="packageImg"
|
|||
|
:action="uploadUrl"
|
|||
|
:show-file-list="false"
|
|||
|
:on-success="handlePackageImgSuccess"
|
|||
|
:on-progress="onPackageImgProgress"
|
|||
|
>
|
|||
|
<img
|
|||
|
v-if="packageImg != ''"
|
|||
|
:src="packageImg"
|
|||
|
class="avatar"
|
|||
|
style="border-radius: 6px; width: 148px; height: 148px"
|
|||
|
/>
|
|||
|
<i v-else class="el-icon-plus avatar-uploader-icon iconss"></i>
|
|||
|
</el-upload>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px; display: flex">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>详情图:</span
|
|||
|
>
|
|||
|
<div class="imgs" v-for="(item, index) in contentImg" :key="index">
|
|||
|
<img width="100%" class="images" height="100%" :src="item" alt=""/>
|
|||
|
<span class="dels">
|
|||
|
<i class="el-icon-delete" @click="clearContentImg(index)"></i>
|
|||
|
</span>
|
|||
|
</div>
|
|||
|
<div class="imgs" style="width: 50%">
|
|||
|
<el-upload
|
|||
|
:action="uploadUrl"
|
|||
|
list-type="picture-card"
|
|||
|
:show-file-list="false"
|
|||
|
:on-success="handleContentImgSuccess"
|
|||
|
:on-progress="onContentImgProgress"
|
|||
|
>
|
|||
|
<el-progress
|
|||
|
v-if="contentImgPercentage > 0 && contentImgPercentage < 100"
|
|||
|
type="circle"
|
|||
|
:percentage="contentImgPercentage"
|
|||
|
></el-progress>
|
|||
|
<i v-else class="el-icon-plus"></i>
|
|||
|
</el-upload>
|
|||
|
</div>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>原价:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="oldPrice"
|
|||
|
onkeyup="value=value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
|
|||
|
type="number"
|
|||
|
min="0"
|
|||
|
placeholder="请输入原价"
|
|||
|
></el-input>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>现价:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="price"
|
|||
|
onkeyup="value=value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
|
|||
|
type="number"
|
|||
|
min="0"
|
|||
|
placeholder="请输入现价"
|
|||
|
></el-input>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>状态:</span
|
|||
|
>
|
|||
|
<el-radio-group v-model="status">
|
|||
|
<el-radio :label="1">上线</el-radio>
|
|||
|
<el-radio :label="2">下线</el-radio>
|
|||
|
</el-radio-group>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>城市:</span
|
|||
|
>
|
|||
|
<el-cascader
|
|||
|
style="width: 45%"
|
|||
|
size="large"
|
|||
|
:options="options"
|
|||
|
ref="cascaderAddr"
|
|||
|
v-model="storeAddress"
|
|||
|
:placeholder="storeAddre"
|
|||
|
@change="handleChangeCity"
|
|||
|
:value="storeAddre"
|
|||
|
>
|
|||
|
</el-cascader>
|
|||
|
<el-button
|
|||
|
type="info"
|
|||
|
class="tj"
|
|||
|
size="mini"
|
|||
|
icon="el-icon-delete"
|
|||
|
circle
|
|||
|
@click="handleDeleteCity"
|
|||
|
>
|
|||
|
</el-button>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>标签:</span
|
|||
|
>
|
|||
|
<span class="bqList" v-for="(item, index) in labelsArr" :key="index"
|
|||
|
>{{ item }}
|
|||
|
<span class="delss">
|
|||
|
<i class="el-icon-delete" @click="handleDeleteLabels(index)"></i>
|
|||
|
</span>
|
|||
|
</span>
|
|||
|
<el-input
|
|||
|
v-model="label"
|
|||
|
style="width: 200px"
|
|||
|
placeholder="请输入标签"
|
|||
|
></el-input>
|
|||
|
<el-button
|
|||
|
type="primary"
|
|||
|
class="tj"
|
|||
|
size="mini"
|
|||
|
icon="el-icon-edit"
|
|||
|
circle
|
|||
|
@click="handleAddLabels"
|
|||
|
>
|
|||
|
</el-button>
|
|||
|
</div>
|
|||
|
<!-- <div style="margin-bottom: 10px">-->
|
|||
|
<!-- <span style="width: 200px; display: inline-block; text-align: right"-->
|
|||
|
<!-- >简介:</span-->
|
|||
|
<!-- >-->
|
|||
|
<!-- <quill-editor-->
|
|||
|
<!-- ref="myTextEditor"-->
|
|||
|
<!-- v-model="content"-->
|
|||
|
<!-- :options="quillOption"-->
|
|||
|
<!-- style="-->
|
|||
|
<!-- padding-bottom: 50px;-->
|
|||
|
<!-- height: 300px;-->
|
|||
|
<!-- width: 72%;-->
|
|||
|
<!-- display: inline-table;-->
|
|||
|
<!-- margin-bottom: 60px;-->
|
|||
|
<!-- "-->
|
|||
|
<!-- >-->
|
|||
|
<!-- </quill-editor>-->
|
|||
|
<!-- </div>-->
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>简介:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="content"
|
|||
|
type="textarea"
|
|||
|
:rows="4"
|
|||
|
placeholder="请输入服务包简介"
|
|||
|
>
|
|||
|
</el-input>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>销量:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="sales"
|
|||
|
onkeyup="value=value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2')"
|
|||
|
type="number"
|
|||
|
min="0"
|
|||
|
placeholder="请输入销量"
|
|||
|
></el-input>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>好评率:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="esteemRate"
|
|||
|
onkeyup="value=value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2')"
|
|||
|
type="number"
|
|||
|
min="0"
|
|||
|
placeholder="请输入销量0-100"
|
|||
|
></el-input>
|
|||
|
</div>
|
|||
|
<div style="margin-bottom: 10px">
|
|||
|
<span style="width: 200px; display: inline-block; text-align: right"
|
|||
|
>加钟数:</span
|
|||
|
>
|
|||
|
<el-input
|
|||
|
style="width: 50%"
|
|||
|
v-model="addNum"
|
|||
|
onkeyup="value=value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2')"
|
|||
|
type="number"
|
|||
|
min="0"
|
|||
|
placeholder="请输入加钟次数"
|
|||
|
></el-input>
|
|||
|
</div>
|
|||
|
<div slot="footer" class="dialog-footer">
|
|||
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
|||
|
<el-button type="primary" @click="handleSubmit()">确 定</el-button>
|
|||
|
</div>
|
|||
|
</el-dialog>
|
|||
|
|
|||
|
</div>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
import {quillEditor} from "vue-quill-editor";
|
|||
|
import "quill/dist/quill.core.css";
|
|||
|
import "quill/dist/quill.snow.css";
|
|||
|
import "quill/dist/quill.bubble.css";
|
|||
|
import quillConfig from "./quill-config.js";
|
|||
|
import axios from "axios";
|
|||
|
import {jsonp} from "vue-jsonp";
|
|||
|
import {serverPaths} from '@/utils/enumData'
|
|||
|
import {
|
|||
|
provinceAndCityData,
|
|||
|
regionData,
|
|||
|
provinceAndCityDataPlus,
|
|||
|
regionDataPlus,
|
|||
|
CodeToText,
|
|||
|
TextToCode,
|
|||
|
} from "element-china-area-data";
|
|||
|
|
|||
|
export default {
|
|||
|
components: {
|
|||
|
quillEditor,
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
uploadUrl: serverPaths.uploadUrl,
|
|||
|
uploadWatermarkUrl: serverPaths.uploadWatermarkUrl,
|
|||
|
apiUrl:"",
|
|||
|
tableDataLoading: false,
|
|||
|
tableData: {},
|
|||
|
typeDictData: [],
|
|||
|
id: "",//编号
|
|||
|
title: "",//标题
|
|||
|
type: "",//服务类型
|
|||
|
oldPrice: "",//原价
|
|||
|
price: "",//现价
|
|||
|
packageImg: "",//图片
|
|||
|
content: "",//简介
|
|||
|
contentImg: [], //详情图
|
|||
|
status: "",//状态
|
|||
|
addNum: "",//加钟次数
|
|||
|
esteemRate: "",//好评率
|
|||
|
sales: "",//销量
|
|||
|
labels: "",//标签
|
|||
|
city: "",//城市
|
|||
|
createTime: "",//创建时间
|
|||
|
size: 10,
|
|||
|
page: 1,
|
|||
|
limit: 10,
|
|||
|
dialogFormVisibleSales: false,
|
|||
|
dialogFormVisibleEsteemRate: false,
|
|||
|
openValue: 1,
|
|||
|
closeValue: 2,
|
|||
|
dialogFormVisible: false,
|
|||
|
titles: "添加服务包",
|
|||
|
label:"",
|
|||
|
labelsArr: [], //标签集合
|
|||
|
storeAddress: [],
|
|||
|
storeAddre: "请选择城市",
|
|||
|
province: "", //省
|
|||
|
options: provinceAndCityData,
|
|||
|
packageImgPercentage:0,//封面图片上传进度
|
|||
|
contentImgPercentage:0,//详情图片上传进度
|
|||
|
quillOption: quillConfig,
|
|||
|
};
|
|||
|
},
|
|||
|
methods: {
|
|||
|
showDictValue(data, datas){
|
|||
|
const dictItem = datas.find(item => data === item.code);
|
|||
|
return dictItem ? dictItem.value : '';
|
|||
|
},
|
|||
|
// 服务包类型
|
|||
|
typeDictSelect() {
|
|||
|
this.$http({
|
|||
|
url: this.$http.adornUrl("sys/dict/selectDictList"),
|
|||
|
method: "get",
|
|||
|
params: this.$http.adornParams({
|
|||
|
type: "service_package",
|
|||
|
}),
|
|||
|
}).then(({data}) => {
|
|||
|
this.typeDictData = data.data;
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
// 获取服务包列表数据
|
|||
|
handleSelect() {
|
|||
|
this.tableDataLoading = true;
|
|||
|
this.$http({
|
|||
|
url: this.$http.adornUrl("massage/package/findPage"),
|
|||
|
method: "get",
|
|||
|
params: this.$http.adornParams({
|
|||
|
// data: this.$http.adornData({
|
|||
|
page: this.page,
|
|||
|
limit: this.limit,
|
|||
|
type: this.type,
|
|||
|
city: this.city,
|
|||
|
title: this.title,
|
|||
|
status: this.status
|
|||
|
}),
|
|||
|
}).then(({data}) => {
|
|||
|
if (data.code == 0) {
|
|||
|
this.tableDataLoading = false;
|
|||
|
let returnData = data.data;
|
|||
|
this.tableData = returnData;
|
|||
|
for (var i in this.tableData.list) {
|
|||
|
if (this.tableData.list[i].contentImg) {
|
|||
|
this.tableData.list[i].contentImg =
|
|||
|
this.tableData.list[i].contentImg.split(",");
|
|||
|
}
|
|||
|
}
|
|||
|
} else {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: data.msg,
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
// 重置
|
|||
|
handleClear() {
|
|||
|
this.type = "";
|
|||
|
this.city = "";
|
|||
|
this.title = "";
|
|||
|
this.status = "";
|
|||
|
this.page = 1;
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
|
|||
|
//分页
|
|||
|
handleSizeChange(val) {
|
|||
|
this.limit = val;
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
|
|||
|
//翻页
|
|||
|
handleCurrentChange(val) {
|
|||
|
this.page = val;
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
|
|||
|
// 修改销量
|
|||
|
showUpdateSalesView(row) {
|
|||
|
this.id = row.id;
|
|||
|
this.sales = row.sales;
|
|||
|
this.dialogFormVisibleSales = true;
|
|||
|
},
|
|||
|
|
|||
|
// 修改销量
|
|||
|
updateSales() {
|
|||
|
this.$http({
|
|||
|
url: this.$http.adornUrl("massage/package/updateSales"),
|
|||
|
method: "post",
|
|||
|
params: this.$http.adornParams({
|
|||
|
// data: this.$http.adornData({
|
|||
|
id: this.id,
|
|||
|
sales: this.sales,
|
|||
|
}),
|
|||
|
}).then(({data}) => {
|
|||
|
if (data.code == 0) {
|
|||
|
this.$message({
|
|||
|
message: "修改成功",
|
|||
|
type: "success",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
});
|
|||
|
this.dialogFormVisibleSales = false;
|
|||
|
} else {
|
|||
|
this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: "warning",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
},
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
// 修改好评
|
|||
|
showUpdateEsteemRateView(row) {
|
|||
|
this.id = row.id;
|
|||
|
this.esteemRate = row.esteemRate;
|
|||
|
this.dialogFormVisibleEsteemRate = true;
|
|||
|
},
|
|||
|
|
|||
|
// 修改好评
|
|||
|
updateEsteemRate() {
|
|||
|
this.$http({
|
|||
|
url: this.$http.adornUrl("massage/package/updateEsteemRate"),
|
|||
|
method: "post",
|
|||
|
params: this.$http.adornParams({
|
|||
|
// data: this.$http.adornData({
|
|||
|
id: this.id,
|
|||
|
esteemRate: this.esteemRate,
|
|||
|
}),
|
|||
|
}).then(({data}) => {
|
|||
|
if (data.code == 0) {
|
|||
|
this.$message({
|
|||
|
message: "修改成功",
|
|||
|
type: "success",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
});
|
|||
|
this.dialogFormVisibleEsteemRate = false;
|
|||
|
} else {
|
|||
|
this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: "warning",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
},
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
// 启用与否
|
|||
|
changeStatus(id, status) {
|
|||
|
this.$http({
|
|||
|
url: this.$http.adornUrl(`massage/package/updateStatus`),
|
|||
|
method: "post",
|
|||
|
params: this.$http.adornParams({
|
|||
|
// data: this.$http.adornData({
|
|||
|
id: id,
|
|||
|
status: status,
|
|||
|
}),
|
|||
|
}).then(({data}) => {
|
|||
|
this.$message({
|
|||
|
message: "操作成功",
|
|||
|
type: "success",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
// 删除服务包
|
|||
|
handleDelete(row) {
|
|||
|
this.$confirm(`确定删除此条信息?`, "提示", {
|
|||
|
confirmButtonText: "确定",
|
|||
|
cancelButtonText: "取消",
|
|||
|
type: "warning",
|
|||
|
})
|
|||
|
.then(() => {
|
|||
|
this.$http({
|
|||
|
url: this.$http.adornUrl("massage/package/delete"),
|
|||
|
method: "post",
|
|||
|
params: this.$http.adornParams({
|
|||
|
// data: this.$http.adornData({
|
|||
|
id: row.id,
|
|||
|
}),
|
|||
|
}).then(({data}) => {
|
|||
|
if (data.code == 0) {
|
|||
|
this.$message({
|
|||
|
message: "删除成功",
|
|||
|
type: "success",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
});
|
|||
|
} else {
|
|||
|
this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: "warning",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
},
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
})
|
|||
|
.catch(() => {
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
//封面图片上传
|
|||
|
handlePackageImgSuccess(file) {
|
|||
|
this.packageImg = file.data;
|
|||
|
},
|
|||
|
//封面图片上传
|
|||
|
onPackageImgProgress(event, file, fileList) {
|
|||
|
this.packageImgPercentage = parseInt(event.percent);
|
|||
|
},
|
|||
|
// 删除详情图片
|
|||
|
clearContentImg(index) {
|
|||
|
this.contentImg.splice(index, 1);
|
|||
|
},
|
|||
|
//上传详情图片
|
|||
|
handleContentImgSuccess(file, fileList) {
|
|||
|
this.contentImg.push(file.data);
|
|||
|
},
|
|||
|
//上传详情图片
|
|||
|
onContentImgProgress(event, file, fileList) {
|
|||
|
this.contentImgPercentage = parseInt(event.percent);
|
|||
|
},
|
|||
|
// 添加标签
|
|||
|
handleAddLabels() {
|
|||
|
if (this.label == "" || this.label == " ") {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请输入标签名",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
} else {
|
|||
|
this.labelsArr.push(this.label);
|
|||
|
this.label = "";
|
|||
|
}
|
|||
|
},
|
|||
|
// 删除标签
|
|||
|
handleDeleteLabels(index) {
|
|||
|
this.labelsArr.splice(index, 1);
|
|||
|
},
|
|||
|
// 添加服务包
|
|||
|
handleEdit(row) {
|
|||
|
console.log("row", row);
|
|||
|
if (row != 0) {
|
|||
|
this.titles = "修改服务包";
|
|||
|
this.id = row.id;
|
|||
|
this.title = row.title;
|
|||
|
this.type = row.type;
|
|||
|
this.oldPrice = row.oldPrice;
|
|||
|
this.price = row.price;
|
|||
|
this.packageImg = row.packageImg;
|
|||
|
this.content = row.content;
|
|||
|
this.contentImg = row.contentImg;
|
|||
|
this.status = row.status;
|
|||
|
this.addNum = row.addNum;
|
|||
|
this.esteemRate = row.esteemRate;
|
|||
|
this.sales = row.sales;
|
|||
|
this.labels = row.labels;
|
|||
|
this.city = row.city;
|
|||
|
this.createTime = row.createTime;
|
|||
|
if (row.city != "" && row.city != "不限") {
|
|||
|
this.city = row.city;
|
|||
|
this.storeAddre = this.city;
|
|||
|
} else {
|
|||
|
this.city = "";
|
|||
|
this.storeAddre = "请选择城市";
|
|||
|
}
|
|||
|
if (row.labels && row.labels !== "") {
|
|||
|
this.labelsArr = row.labels.split(",");
|
|||
|
} else {
|
|||
|
this.labelsArr = [];
|
|||
|
}
|
|||
|
} else {
|
|||
|
this.titles = "添加服务包";
|
|||
|
this.id = "";
|
|||
|
this.title = "";
|
|||
|
this.type = "";
|
|||
|
this.oldPrice = "0";
|
|||
|
this.price = "0";
|
|||
|
this.packageImg = "";
|
|||
|
this.content = "";
|
|||
|
this.contentImg = [];
|
|||
|
this.status = 1;
|
|||
|
this.addNum = "0";
|
|||
|
this.esteemRate = "0";
|
|||
|
this.sales = "0";
|
|||
|
this.labels = "";
|
|||
|
this.city = "";
|
|||
|
this.labelsArr = [];
|
|||
|
this.storeAddre = "请选择城市";
|
|||
|
}
|
|||
|
this.dialogFormVisible = true;
|
|||
|
},
|
|||
|
|
|||
|
// 提交修改、添加项目项目
|
|||
|
handleSubmit() {
|
|||
|
if (this.type == "") {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请选择类型",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.title == "") {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请输入服务包名称",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.packageImg == "") {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请上传封面图片",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.contentImg.length == 0) {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请上传详情图片",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.oldPrice === "") {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请输入原价",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.price === "") {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请输入现价",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.status === "") {
|
|||
|
this.$notify({
|
|||
|
title: "提示",
|
|||
|
duration: 1800,
|
|||
|
message: "请选择状态",
|
|||
|
type: "warning",
|
|||
|
});
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.city == "") {
|
|||
|
this.city = "不限";
|
|||
|
}
|
|||
|
if (this.titles == "添加服务包") {
|
|||
|
this.apiUrl = "massage/package/add";
|
|||
|
} else {
|
|||
|
this.apiUrl = "massage/package/modify";
|
|||
|
}
|
|||
|
this.$http({
|
|||
|
url: this.$http.adornUrl(this.apiUrl),
|
|||
|
method: "post",
|
|||
|
params: this.$http.adornParams({
|
|||
|
// data: this.$http.adornData({
|
|||
|
id: this.id,
|
|||
|
title: this.title,
|
|||
|
type: this.type,
|
|||
|
oldPrice: this.oldPrice,
|
|||
|
price: this.price,
|
|||
|
packageImg: this.packageImg,
|
|||
|
contentImg: this.contentImg.toString(),
|
|||
|
content: this.content,
|
|||
|
status: this.status,
|
|||
|
addNum: this.addNum,
|
|||
|
esteemRate: this.esteemRate,
|
|||
|
sales: this.sales,
|
|||
|
labels: this.labelsArr.toString(),
|
|||
|
city: this.city,
|
|||
|
}),
|
|||
|
}).then(({data}) => {
|
|||
|
if (data.code == 0) {
|
|||
|
this.dialogFormVisible = false;
|
|||
|
this.clearDatas();
|
|||
|
this.$message({
|
|||
|
message: "操作成功",
|
|||
|
type: "success",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
this.handleSelect();
|
|||
|
},
|
|||
|
});
|
|||
|
} else {
|
|||
|
this.$message({
|
|||
|
message: data.msg,
|
|||
|
type: "warning",
|
|||
|
duration: 1500,
|
|||
|
onClose: () => {
|
|||
|
},
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
// 获取省市区
|
|||
|
handleChangeCity(value) {
|
|||
|
value = this.$refs["cascaderAddr"].currentLabels;
|
|||
|
console.log("````````````value", value);
|
|||
|
this.province = value[0];
|
|||
|
this.city = value[1];
|
|||
|
if (this.city == "市辖区") {
|
|||
|
this.city = this.province;
|
|||
|
}
|
|||
|
this.storeAddre = this.province + "/" + this.city;
|
|||
|
this.storeAddress = value;
|
|||
|
},
|
|||
|
// 删除城市
|
|||
|
handleDeleteCity() {
|
|||
|
this.city = "";
|
|||
|
this.storeAddress = [];
|
|||
|
this.storeAddre = "请选择城市";
|
|||
|
},
|
|||
|
clearDatas(){
|
|||
|
this.apiUrl="";
|
|||
|
this.tableDataLoading= false;
|
|||
|
this.id= "";//编号
|
|||
|
this.title= "";//标题
|
|||
|
this.type= "";//服务类型
|
|||
|
this.oldPrice= "";//原价
|
|||
|
this.price= "";//现价
|
|||
|
this.packageImg= "";//图片
|
|||
|
this.content= "";//简介
|
|||
|
this.contentImg= []; //详情图
|
|||
|
this.status= "";//状态
|
|||
|
this.addNum= "";//加钟次数
|
|||
|
this.esteemRate= "";//好评率
|
|||
|
this.sales= "";//销量
|
|||
|
this.labels= "";//标签
|
|||
|
this.city= "";//城市
|
|||
|
this.createTime= "";//创建时间
|
|||
|
this.size= 10;
|
|||
|
this.page= 1;
|
|||
|
this.limit= 10;
|
|||
|
this.dialogFormVisibleSales= false;
|
|||
|
this.dialogFormVisibleEsteemRate= false;
|
|||
|
this.openValue= 1;
|
|||
|
this.closeValue= 2;
|
|||
|
this.dialogFormVisible= false;
|
|||
|
this.titles= "添加服务包";
|
|||
|
this.label="";
|
|||
|
this.labelsArr= []; //标签集合
|
|||
|
this.storeAddress= [];
|
|||
|
this.storeAddre= "请选择城市";
|
|||
|
this.province= ""; //省
|
|||
|
}
|
|||
|
},
|
|||
|
mounted() {
|
|||
|
this.handleSelect();
|
|||
|
this.typeDictSelect();
|
|||
|
},
|
|||
|
};
|
|||
|
</script>
|
|||
|
|
|||
|
<style>
|
|||
|
.customWidth {
|
|||
|
width: 80% !important;
|
|||
|
}
|
|||
|
.el-dialog--center {
|
|||
|
text-align: center;
|
|||
|
margin-top: 1vh !important;
|
|||
|
}
|
|||
|
|
|||
|
.el-tooltip__popper {
|
|||
|
width: 200px;
|
|||
|
padding: 10px;
|
|||
|
color: #000 !important;
|
|||
|
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.4);
|
|||
|
background-color: #fff !important;
|
|||
|
}
|
|||
|
|
|||
|
.adver_main.box a {
|
|||
|
display: flex;
|
|||
|
justify-content: center;
|
|||
|
height: 150px;
|
|||
|
line-height: 150px;
|
|||
|
text-decoration: none;
|
|||
|
}
|
|||
|
|
|||
|
.bannerManin span {
|
|||
|
display: inline-block;
|
|||
|
margin-left: 5px;
|
|||
|
}
|
|||
|
|
|||
|
.bannerManin img {
|
|||
|
width: 48px;
|
|||
|
height: 48px;
|
|||
|
border-radius: 50%;
|
|||
|
}
|
|||
|
|
|||
|
.bannerbtn a {
|
|||
|
flex: 1;
|
|||
|
text-align: center;
|
|||
|
color: #3e8ef7 !important;
|
|||
|
text-decoration: none;
|
|||
|
}
|
|||
|
|
|||
|
.imgs {
|
|||
|
position: relative;
|
|||
|
border-radius: 6px;
|
|||
|
width: 148px;
|
|||
|
height: 148px;
|
|||
|
margin-right: 10px;
|
|||
|
display: inline-block;
|
|||
|
}
|
|||
|
|
|||
|
.dels {
|
|||
|
position: absolute;
|
|||
|
top: 0;
|
|||
|
left: 0;
|
|||
|
display: none;
|
|||
|
}
|
|||
|
|
|||
|
.dels .el-icon-delete {
|
|||
|
line-height: 148px;
|
|||
|
padding-left: 58px;
|
|||
|
font-size: 25px;
|
|||
|
color: #fff;
|
|||
|
}
|
|||
|
|
|||
|
.imgs:hover .dels {
|
|||
|
width: 100%;
|
|||
|
height: 100%;
|
|||
|
background: #000;
|
|||
|
display: block;
|
|||
|
opacity: 0.5;
|
|||
|
}
|
|||
|
|
|||
|
.bqList {
|
|||
|
padding: 4px 14px;
|
|||
|
margin: 4px;
|
|||
|
border: 1px solid #efefef;
|
|||
|
font-size: 12px;
|
|||
|
color: #999;
|
|||
|
border-radius: 4px;
|
|||
|
margin-right: 15px;
|
|||
|
}
|
|||
|
|
|||
|
.delss {
|
|||
|
display: none;
|
|||
|
position: relative;
|
|||
|
}
|
|||
|
|
|||
|
.delss .el-icon-delete {
|
|||
|
position: absolute;
|
|||
|
top: 0;
|
|||
|
}
|
|||
|
|
|||
|
.bqList:hover .delss {
|
|||
|
display: initial;
|
|||
|
opacity: 0.5;
|
|||
|
}
|
|||
|
|
|||
|
.tj {
|
|||
|
padding: 6px !important;
|
|||
|
margin: 4px;
|
|||
|
font-size: 12px;
|
|||
|
border: 1px solid #ccc;
|
|||
|
border-radius: 4px;
|
|||
|
}
|
|||
|
</style>
|