2023-3-15
This commit is contained in:
@@ -1269,7 +1269,7 @@ export const constantRouterMap = [{
|
|||||||
name: 'addCommunity',
|
name: 'addCommunity',
|
||||||
component: () => import('@/views/build/community/add'),
|
component: () => import('@/views/build/community/add'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '添加小区'
|
title: '添加取货点'
|
||||||
},
|
},
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
@@ -1278,7 +1278,7 @@ export const constantRouterMap = [{
|
|||||||
name: 'updateCommunity',
|
name: 'updateCommunity',
|
||||||
component: () => import('@/views/build/community/update'),
|
component: () => import('@/views/build/community/update'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '编辑小区'
|
title: '编辑取货点'
|
||||||
},
|
},
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
@@ -1560,7 +1560,7 @@ export const constantRouterMap = [{
|
|||||||
name: 'addWuyeCompany',
|
name: 'addWuyeCompany',
|
||||||
component: () => import('@/views/build/wuyeCompany/add'),
|
component: () => import('@/views/build/wuyeCompany/add'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '添加物业公司'
|
title: '添加社区'
|
||||||
},
|
},
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
@@ -1569,7 +1569,7 @@ export const constantRouterMap = [{
|
|||||||
name: 'updateWuyeCompany',
|
name: 'updateWuyeCompany',
|
||||||
component: () => import('@/views/build/wuyeCompany/update'),
|
component: () => import('@/views/build/wuyeCompany/update'),
|
||||||
meta: {
|
meta: {
|
||||||
title: '编辑物业公司'
|
title: '编辑社区'
|
||||||
},
|
},
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,34 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="form-container" shadow="never">
|
<el-card class="form-container" shadow="never">
|
||||||
<el-form :model="community" :rules="rules" ref="communityFrom" label-width="100px">
|
<el-form :model="community" :rules="rules" ref="communityFrom" label-width="130px">
|
||||||
|
|
||||||
<el-form-item label="社区名称:" prop="name">
|
<el-form-item label="社区名称:" >
|
||||||
<el-input v-model="community.name"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="社区户数:" prop="counts">
|
|
||||||
<el-input v-model="community.counts"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="社区地址:" prop="details">
|
|
||||||
<el-input v-model="community.details"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
|
<span>{{name}}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="取货点名称:" prop="name">
|
||||||
|
<el-input v-model="community.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="取货点电话:" prop="counts">
|
||||||
|
<el-input v-model="community.counts"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="取货点地址:" prop="details">
|
||||||
|
<el-input v-model="community.details"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<!--
|
||||||
<el-form-item label="地标:" prop="nearbyLandmarks">
|
<el-form-item label="地标:" prop="nearbyLandmarks">
|
||||||
<el-input v-model="community.nearbyLandmarks"></el-input>
|
<el-input v-model="community.nearbyLandmarks"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
-->
|
||||||
<el-form-item label="电话:" prop="phone">
|
<!-- <el-form-item label="电话:" prop="phone">
|
||||||
<el-input v-model="community.phone"></el-input>
|
<el-input v-model="community.phone"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="照片:" prop="pic">
|
<el-form-item label="照片:" prop="pic">
|
||||||
<single-upload v-model="community.pic"></single-upload>
|
<single-upload v-model="community.pic"></single-upload>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="地图:" prop="phone">
|
<!-- <el-form-item label="地图:" prop="phone">
|
||||||
|
|
||||||
<input v-model.number="center.lng" />
|
<input v-model.number="center.lng" />
|
||||||
<input v-model.number="center.lat" />
|
<input v-model.number="center.lat" />
|
||||||
<!--<label>关键词:<input v-model="keyword"></label>
|
<!--<label>关键词:<input v-model="keyword"></label>
|
||||||
<label>地区:<input v-model="location"></label>-->
|
<label>地区:<input v-model="location"></label>-->
|
||||||
|
<!--
|
||||||
<baidu-map ak="15BWmtGEGGkZ8lSPUGah30XZ6IGw57HE"
|
<baidu-map ak="15BWmtGEGGkZ8lSPUGah30XZ6IGw57HE"
|
||||||
class="map bm-view"
|
class="map bm-view"
|
||||||
|
|
||||||
@@ -45,184 +49,203 @@
|
|||||||
</bm-copyright>
|
</bm-copyright>
|
||||||
<bm-city-list anchor="BMAP_ANCHOR_TOP_LEFT" @changeAfter="changeAfters"></bm-city-list>
|
<bm-city-list anchor="BMAP_ANCHOR_TOP_LEFT" @changeAfter="changeAfters"></bm-city-list>
|
||||||
<bm-marker :position="center" :dragging="false" />
|
<bm-marker :position="center" :dragging="false" />
|
||||||
<!-- <bm-local-search :keyword="keyword" :auto-viewport="true" :location="location"></bm-local-search>-->
|
<bm-local-search :keyword="keyword" :auto-viewport="true" :location="location"></bm-local-search>
|
||||||
</baidu-map>
|
</baidu-map>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="onSubmit('communityFrom')">提交</el-button>
|
<el-button type="primary" @click="onSubmit('communityFrom')">提交</el-button>
|
||||||
<el-button v-if="!isEdit" @click="resetForm('communityFrom')">重置</el-button>
|
<el-button v-if="!isEdit" @click="resetForm('communityFrom')">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import BaiduMap from 'vue-baidu-map/components/map/Map.vue'
|
||||||
import BaiduMap from 'vue-baidu-map/components/map/Map.vue'
|
import BmLocalSearch from 'vue-baidu-map/components/search/LocalSearch';
|
||||||
import BmLocalSearch from 'vue-baidu-map/components/search/LocalSearch';
|
import BmCityList from 'vue-baidu-map/components/controls/CityList';
|
||||||
import BmCityList from 'vue-baidu-map/components/controls/CityList';
|
import BmCopyright from 'vue-baidu-map/components/controls/Copyright';
|
||||||
import BmCopyright from 'vue-baidu-map/components/controls/Copyright';
|
import BmView from 'vue-baidu-map/components/map/MapView';
|
||||||
import BmView from 'vue-baidu-map/components/map/MapView';
|
|
||||||
import BmMarker from 'vue-baidu-map/components/overlays/Marker'
|
import BmMarker from 'vue-baidu-map/components/overlays/Marker'
|
||||||
import {createCommunity, getCommunity, updateCommunity} from '@/api/build/community'
|
import {
|
||||||
import SingleUpload from '@/components/Upload/singleUpload'
|
createCommunity,
|
||||||
import {formatDate} from '@/utils/date';
|
getCommunity,
|
||||||
const defaultCommunity={
|
updateCommunity
|
||||||
name: ''
|
} from '@/api/build/community'
|
||||||
};
|
import SingleUpload from '@/components/Upload/singleUpload'
|
||||||
export default {
|
import {
|
||||||
name: 'CommunityDetail',
|
formatDate
|
||||||
components:{SingleUpload,BaiduMap,BmLocalSearch,BmCityList,BmView,BmCopyright,BmMarker},
|
} from '@/utils/date';
|
||||||
props: {
|
const defaultCommunity = {
|
||||||
isEdit: {
|
name: ''
|
||||||
type: Boolean,
|
};
|
||||||
default: false
|
export default {
|
||||||
}
|
name: 'CommunityDetail',
|
||||||
},
|
components: {
|
||||||
data() {
|
SingleUpload,
|
||||||
return {
|
BaiduMap,
|
||||||
community:Object.assign({}, defaultCommunity),
|
BmLocalSearch,
|
||||||
rules: {
|
BmCityList,
|
||||||
name: [
|
BmView,
|
||||||
{required: true, message: '请输入名称', trigger: 'blur'},
|
BmCopyright,
|
||||||
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
|
BmMarker
|
||||||
],
|
},
|
||||||
logo: [
|
props: {
|
||||||
{required: true, message: '请输入品牌logo', trigger: 'blur'}
|
isEdit: {
|
||||||
],
|
type: Boolean,
|
||||||
sort: [
|
default: false
|
||||||
{type: 'number', message: '排序必须为数字'}
|
}
|
||||||
],
|
},
|
||||||
},
|
data() {
|
||||||
location: '北京',
|
return {
|
||||||
keyword: '百度',
|
name: "",
|
||||||
center: {
|
community: Object.assign({}, defaultCommunity),
|
||||||
lng: 116.404,
|
rules: {
|
||||||
lat: 39.915
|
name: [{
|
||||||
},
|
required: true,
|
||||||
zoom: 15
|
message: '请输入取货点名称',
|
||||||
}
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
mounted (){
|
{
|
||||||
|
min: 2,
|
||||||
|
max: 140,
|
||||||
|
message: '长度在 2 到 140 个字符',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
location: '北京',
|
||||||
|
keyword: '百度',
|
||||||
|
center: {
|
||||||
|
lng: 116.404,
|
||||||
|
lat: 39.915
|
||||||
|
},
|
||||||
|
zoom: 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
// this.handleScroll()
|
// this.handleScroll()
|
||||||
// window.addEventListener('mousewheel',this.handleScroll,false)
|
// window.addEventListener('mousewheel',this.handleScroll,false)
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (this.isEdit) {
|
console.log("query>>>",this.$route.query)
|
||||||
getCommunity(this.$route.query.id).then(response => {
|
this.name = this.$route.query.cname
|
||||||
this.community = response.data;
|
|
||||||
if(this.community.latitude){
|
if (this.isEdit) {
|
||||||
this.center.lat=this.community.latitude;
|
getCommunity(this.$route.query.id).then(response => {
|
||||||
|
this.community = response.data;
|
||||||
|
if (this.community.latitude) {
|
||||||
|
this.center.lat = this.community.latitude;
|
||||||
}
|
}
|
||||||
if(this.community.longitude){
|
if (this.community.longitude) {
|
||||||
this.center.lng=this.community.longitude;
|
this.center.lng = this.community.longitude;
|
||||||
}
|
}
|
||||||
if(this.community.city){
|
if (this.community.city) {
|
||||||
this.location=this.community.city;
|
this.location = this.community.city;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
this.community = Object.assign({},defaultCommunity);
|
this.community = Object.assign({}, defaultCommunity);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
changeAfters(e){
|
changeAfters(e) {
|
||||||
console.log('123')
|
console.log('123')
|
||||||
console.log(e)
|
console.log(e)
|
||||||
},
|
},
|
||||||
handleScroll (e) {
|
handleScroll(e) {
|
||||||
//修复body高度为100%,百度地图鼠标滚轮滚动产生位移问题,以及全景鼠标hover后未显示全景信息问题
|
//修复body高度为100%,百度地图鼠标滚轮滚动产生位移问题,以及全景鼠标hover后未显示全景信息问题
|
||||||
document.body.scrollTop=0
|
document.body.scrollTop = 0
|
||||||
document.documentElement.scrollTop =0
|
document.documentElement.scrollTop = 0
|
||||||
},
|
},
|
||||||
syncCenterAndZoom (e) {
|
syncCenterAndZoom(e) {
|
||||||
|
|
||||||
const {lng, lat} = e.target.getCenter()
|
const {
|
||||||
this.center.lng = lng
|
lng,
|
||||||
this.center.lat = lat
|
lat
|
||||||
this.zoom = e.target.getZoom()
|
} = e.target.getCenter()
|
||||||
},
|
this.center.lng = lng
|
||||||
onSubmit(formName) {
|
this.center.lat = lat
|
||||||
this.$refs[formName].validate((valid) => {
|
this.zoom = e.target.getZoom()
|
||||||
if (valid) {
|
},
|
||||||
this.$confirm('是否提交数据', '提示', {
|
onSubmit(formName) {
|
||||||
confirmButtonText: '确定',
|
this.$refs[formName].validate((valid) => {
|
||||||
cancelButtonText: '取消',
|
if (valid) {
|
||||||
type: 'warning'
|
this.$confirm('是否提交数据', '提示', {
|
||||||
}).then(() => {
|
confirmButtonText: '确定',
|
||||||
this.community.companyId=this.$route.query.cid
|
cancelButtonText: '取消',
|
||||||
this.community.latitude=this.center.lat;
|
type: 'warning'
|
||||||
this.community.longitude=this.center.lng;
|
}).then(() => {
|
||||||
if (this.isEdit) {
|
this.community.companyId = this.$route.query.cid
|
||||||
updateCommunity(this.$route.query.id, this.community).then(response => {
|
this.community.latitude = this.center.lat;
|
||||||
if(response.code==200){
|
this.community.longitude = this.center.lng;
|
||||||
this.$refs[formName].resetFields();
|
if (this.isEdit) {
|
||||||
this.$message({
|
updateCommunity(this.$route.query.id, this.community).then(response => {
|
||||||
message: '修改成功',
|
if (response.code == 200) {
|
||||||
type: 'success',
|
this.$refs[formName].resetFields();
|
||||||
duration:1000
|
this.$message({
|
||||||
});
|
message: '修改成功',
|
||||||
this.$router.back();
|
type: 'success',
|
||||||
}else{
|
duration: 1000
|
||||||
this.$message({
|
});
|
||||||
message: response.msg,
|
this.$router.back();
|
||||||
type: 'error',
|
} else {
|
||||||
duration:1000
|
this.$message({
|
||||||
});
|
message: response.msg,
|
||||||
}
|
type: 'error',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
createCommunity(this.community).then(response => {
|
createCommunity(this.community).then(response => {
|
||||||
if(response.code==200){
|
if (response.code == 200) {
|
||||||
this.$refs[formName].resetFields();
|
this.$refs[formName].resetFields();
|
||||||
this.community = Object.assign({},defaultCommunity);
|
this.community = Object.assign({}, defaultCommunity);
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '提交成功',
|
message: '提交成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
duration:1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
this.$router.back();
|
this.$router.back();
|
||||||
}else{
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: response.msg,
|
message: response.msg,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
duration:1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '验证失败',
|
message: '验证失败',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
duration:1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetForm(formName) {
|
resetForm(formName) {
|
||||||
this.$refs[formName].resetFields();
|
this.$refs[formName].resetFields();
|
||||||
this.community = Object.assign({},defaultCommunity);
|
this.community = Object.assign({}, defaultCommunity);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.bm-view {
|
.bm-view {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card class="filter-container" shadow="never">
|
<el-card class="filter-container" shadow="never">
|
||||||
<div>
|
<div>
|
||||||
<i class="el-icon-search"></i>
|
<i class="el-icon-search"></i>
|
||||||
<span>筛选搜索</span>
|
<span>筛选搜索</span>
|
||||||
<el-button
|
<el-button style="float: right" @click="searchCommunityList()" type="primary" size="small">
|
||||||
style="float: right"
|
查询结果
|
||||||
@click="searchCommunityList()"
|
</el-button>
|
||||||
type="primary"
|
</div>
|
||||||
size="small">
|
<div style="margin-top: 15px">
|
||||||
查询结果
|
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
|
||||||
</el-button>
|
<el-form-item label="输入搜索:">
|
||||||
</div>
|
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="取货点名称/关键字"></el-input>
|
||||||
<div style="margin-top: 15px">
|
</el-form-item>
|
||||||
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
|
</el-form>
|
||||||
<el-form-item label="输入搜索:">
|
</div>
|
||||||
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
|
</el-card>
|
||||||
</el-form-item>
|
<el-card class="operate-container" shadow="never">
|
||||||
</el-form>
|
<i class="el-icon-tickets"></i>
|
||||||
</div>
|
<span>数据列表</span>
|
||||||
</el-card>
|
<span v-show="name"> - {{name}}</span>
|
||||||
<el-card class="operate-container" shadow="never">
|
|
||||||
<i class="el-icon-tickets"></i>
|
|
||||||
<span>数据列表</span>
|
|
||||||
<el-button v-if="cid>0"
|
|
||||||
class="btn-add" type="success" icon="el-icon-download"
|
|
||||||
@click="addCommunity()"
|
|
||||||
size="mini">
|
|
||||||
添加
|
|
||||||
</el-button>
|
|
||||||
|
|
||||||
<el-button @click="exportExcel" type="success" size="mini" icon="el-icon-download">导出</el-button>
|
<el-button v-if="cid>0" class="btn-add" type="success" icon="el-icon-download" @click="addCommunity()"
|
||||||
|
size="mini">
|
||||||
|
添加
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
<!-- <el-button @click="exportExcel" type="success" size="mini" icon="el-icon-download">导出</el-button>
|
||||||
|
|
||||||
<el-upload
|
<el-upload
|
||||||
style="display: inline"
|
style="display: inline"
|
||||||
@@ -40,65 +36,52 @@
|
|||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
:action="importExcel">
|
:action="importExcel">
|
||||||
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
|
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
|
||||||
</el-upload>
|
</el-upload> -->
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<el-table ref="communityTable"
|
<el-table ref="communityTable" :data="list" style="width: 100%" @selection-change="handleSelectionChange"
|
||||||
:data="list"
|
v-loading="listLoading" border>
|
||||||
style="width: 100%"
|
<el-table-column type="selection" width="60" align="center"></el-table-column>
|
||||||
@selection-change="handleSelectionChange"
|
|
||||||
v-loading="listLoading"
|
|
||||||
border>
|
|
||||||
<el-table-column type="selection" width="60" align="center"></el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="小区ID" align="center">
|
<el-table-column label="取货点ID" align="center" width="100">
|
||||||
<template slot-scope="scope">{{scope.row.id}}</template>
|
<template slot-scope="scope">{{scope.row.id}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="小区名称" align="center">
|
<el-table-column label="取货点名称" width="200" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.name}}</template>
|
<template slot-scope="scope">{{scope.row.name}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="电话" align="center">
|
<el-table-column label="取货点电话" width="160" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.phone}}</template>
|
<template slot-scope="scope">{{scope.row.phone}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="小区栋数" align="center">
|
<el-table-column label="取货点地址" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.counts}}</template>
|
<template slot-scope="scope">{{scope.row.address}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="小区地址" align="center">
|
|
||||||
<template slot-scope="scope">{{scope.row.address}}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="根据定位获取城市编码" align="center">
|
|
||||||
<template slot-scope="scope">{{scope.row.cityCode}}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="地标" align="center">
|
|
||||||
<template slot-scope="scope">{{scope.row.nearbyLandmarks}}</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="创建时间" align="center">
|
<el-table-column label="创建时间" width="200" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
|
<template slot-scope="scope">{{scope.row.createTime|formatCreateTime}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column label="状态" align="center">
|
<!-- <el-table-column label="状态" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
|
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
|
||||||
</el-table-column>-->
|
</el-table-column>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<el-table-column label="操作" width="250" align="center">
|
<el-table-column label="操作" width="250" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<!-- <el-button
|
<!-- <el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="getAttrList(scope.$index, scope.row)">添加楼
|
@click="getAttrList(scope.$index, scope.row)">添加楼
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<!-- <el-button
|
<!-- <el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="getAttrList1(scope.$index, scope.row)">添加缴费规则
|
@click="getAttrList1(scope.$index, scope.row)">添加缴费规则
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<!-- <el-button
|
<!-- <el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="getAttrList2(scope.$index, scope.row)">添加缴费记录
|
@click="getAttrList2(scope.$index, scope.row)">添加缴费记录
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<!-- <el-button
|
<!-- <el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="getAttrList3(scope.$index, scope.row)">添加通知
|
@click="getAttrList3(scope.$index, scope.row)">添加通知
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -106,241 +89,279 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="getAttrList4(scope.$index, scope.row)">添加轮播图
|
@click="getAttrList4(scope.$index, scope.row)">添加轮播图
|
||||||
</el-button> -->
|
</el-button> -->
|
||||||
<el-button
|
<el-button size="mini" @click="handleUpdate(scope.$index, scope.row)">编辑
|
||||||
size="mini"
|
</el-button>
|
||||||
@click="handleUpdate(scope.$index, scope.row)">编辑
|
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
</template>
|
||||||
size="mini"
|
</el-table-column>
|
||||||
type="danger"
|
</el-table>
|
||||||
@click="handleDelete(scope.$index, scope.row)">删除
|
</div>
|
||||||
</el-button>
|
<div class="batch-operate-container">
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</div>
|
|
||||||
<div class="batch-operate-container">
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination-container">
|
<div class="pagination-container">
|
||||||
<el-pagination
|
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||||
background
|
layout="total, sizes,prev, pager, next,jumper" :page-size="listQuery.pageSize" :page-sizes="[5,10,15]"
|
||||||
@size-change="handleSizeChange"
|
:current-page.sync="listQuery.pageNum" :total="total">
|
||||||
@current-change="handleCurrentChange"
|
</el-pagination>
|
||||||
layout="total, sizes,prev, pager, next,jumper"
|
</div>
|
||||||
:page-size="listQuery.pageSize"
|
</div>
|
||||||
:page-sizes="[5,10,15]"
|
|
||||||
:current-page.sync="listQuery.pageNum"
|
|
||||||
:total="total">
|
|
||||||
</el-pagination>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {fetchList, deleteCommunity,exportExcel} from '@/api/build/community'
|
import {
|
||||||
import {formatDate} from '@/utils/date';
|
fetchList,
|
||||||
export default {
|
deleteCommunity,
|
||||||
name: 'communityList',
|
exportExcel
|
||||||
data() {
|
} from '@/api/build/community'
|
||||||
|
import {
|
||||||
|
formatDate
|
||||||
|
} from '@/utils/date';
|
||||||
|
export default {
|
||||||
|
name: 'communityList',
|
||||||
|
data() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
importExcel: process.env.BASE_API+'/building/community/importExcel',
|
name: "",
|
||||||
uploadBtnIcon:'el-icon-upload2',
|
importExcel: process.env.BASE_API + '/building/community/importExcel',
|
||||||
enabledUploadBtn:true,
|
uploadBtnIcon: 'el-icon-upload2',
|
||||||
dialogVisible:false,
|
enabledUploadBtn: true,
|
||||||
btnText:'数据导入',
|
dialogVisible: false,
|
||||||
|
btnText: '数据导入',
|
||||||
|
|
||||||
cid:0,
|
cid: 0,
|
||||||
operates: [
|
operates: [{
|
||||||
{
|
label: "显示品牌",
|
||||||
label: "显示品牌",
|
value: "showCommunity"
|
||||||
value: "showCommunity"
|
},
|
||||||
},
|
{
|
||||||
{
|
label: "隐藏品牌",
|
||||||
label: "隐藏品牌",
|
value: "hideCommunity"
|
||||||
value: "hideCommunity"
|
}
|
||||||
}
|
],
|
||||||
],
|
operateType: null,
|
||||||
operateType: null,
|
listQuery: {
|
||||||
listQuery: {
|
keyword: null,
|
||||||
keyword: null,
|
pageNum: 1,
|
||||||
pageNum: 1,
|
pageSize: 10
|
||||||
pageSize: 10
|
},
|
||||||
},
|
list: null,
|
||||||
list: null,
|
total: null,
|
||||||
total: null,
|
listLoading: true,
|
||||||
listLoading: true,
|
multipleSelection: []
|
||||||
multipleSelection: []
|
}
|
||||||
}
|
},
|
||||||
},
|
created() {
|
||||||
created() {
|
this.getList();
|
||||||
this.getList();
|
},
|
||||||
},
|
filters: {
|
||||||
filters: {
|
formatCreateTime(time) {
|
||||||
formatCreateTime(time) {
|
let date = new Date(time);
|
||||||
let date = new Date(time);
|
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
|
||||||
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
|
},
|
||||||
},
|
|
||||||
|
|
||||||
formatStatus(value) {
|
formatStatus(value) {
|
||||||
if (value === 1) {
|
if (value === 1) {
|
||||||
return '申请';
|
return '申请';
|
||||||
} else if (value === 2) {
|
} else if (value === 2) {
|
||||||
return '审核失败';
|
return '审核失败';
|
||||||
} else if (value === 3) {
|
} else if (value === 3) {
|
||||||
return '审核成功';
|
return '审核成功';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSuccess(response,file,fileList){
|
onSuccess(response, file, fileList) {
|
||||||
this.enabledUploadBtn=true;
|
this.enabledUploadBtn = true;
|
||||||
this.uploadBtnIcon="el-icon-upload2";
|
this.uploadBtnIcon = "el-icon-upload2";
|
||||||
this.btnText='数据导入';
|
this.btnText = '数据导入';
|
||||||
alert("数据导入成功!");
|
alert("数据导入成功!");
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onError(err,file,fileList){
|
onError(err, file, fileList) {
|
||||||
this.enabledUploadBtn=true;
|
this.enabledUploadBtn = true;
|
||||||
this.uploadBtnIcon="el-icon-upload2";
|
this.uploadBtnIcon = "el-icon-upload2";
|
||||||
this.btnText='数据导入';
|
this.btnText = '数据导入';
|
||||||
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
|
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
|
||||||
},
|
},
|
||||||
beforeUpload(file){
|
beforeUpload(file) {
|
||||||
this.enabledUploadBtn=false;
|
this.enabledUploadBtn = false;
|
||||||
this.uploadBtnIcon="el-icon-loading";
|
this.uploadBtnIcon = "el-icon-loading";
|
||||||
this.btnText='正在导入';
|
this.btnText = '正在导入';
|
||||||
},
|
},
|
||||||
exportExcel(){
|
exportExcel() {
|
||||||
window.open(process.env.BASE_API+'/building/community/exportExcel')
|
window.open(process.env.BASE_API + '/building/community/exportExcel')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getAttrList(index, row) {
|
getAttrList(index, row) {
|
||||||
this.$router.push({path: '/build/floor',query:{cid:row.id,cname:row.name}})
|
this.$router.push({
|
||||||
},
|
path: '/build/floor',
|
||||||
getAttrList1(index, row) {
|
query: {
|
||||||
this.$router.push({path: '/build/typePrice',query:{cid:row.id,cname:row.name}})
|
cid: row.id,
|
||||||
},
|
cname: row.name
|
||||||
getAttrList2(index, row) {
|
}
|
||||||
this.$router.push({path: '/build/wuyePrice',query:{cid:row.id,cname:row.name}})
|
})
|
||||||
},
|
},
|
||||||
getAttrList3(index, row) {
|
getAttrList1(index, row) {
|
||||||
this.$router.push({path: '/build/notice',query:{cid:row.id,cname:row.name}})
|
this.$router.push({
|
||||||
},
|
path: '/build/typePrice',
|
||||||
getAttrList4(index, row) {
|
query: {
|
||||||
this.$router.push({path: '/build/adv',query:{cid:row.id,cname:row.name}})
|
cid: row.id,
|
||||||
},
|
cname: row.name
|
||||||
getList() {
|
}
|
||||||
this.listLoading = true;
|
})
|
||||||
this.cid=this.$route.query.cid;
|
},
|
||||||
|
getAttrList2(index, row) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/build/wuyePrice',
|
||||||
|
query: {
|
||||||
|
cid: row.id,
|
||||||
|
cname: row.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getAttrList3(index, row) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/build/notice',
|
||||||
|
query: {
|
||||||
|
cid: row.id,
|
||||||
|
cname: row.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getAttrList4(index, row) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/build/adv',
|
||||||
|
query: {
|
||||||
|
cid: row.id,
|
||||||
|
cname: row.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true;
|
||||||
|
console.log("query》》》》", this.$route.query);
|
||||||
|
this.cid = this.$route.query.cid;
|
||||||
|
this.name = this.$route.query.cname;
|
||||||
|
|
||||||
if (this.cid) {
|
if (this.cid) {
|
||||||
this.listQuery.companyId=this.cid;
|
this.listQuery.companyId = this.cid;
|
||||||
}
|
}
|
||||||
fetchList(this.listQuery).then(response => {
|
fetchList(this.listQuery).then(response => {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
this.list = response.data.records;
|
console.log("list》》》》", response.data.records);
|
||||||
this.total = response.data.total;
|
this.list = response.data.records;
|
||||||
this.totalPage = response.data.pages;
|
this.total = response.data.total;
|
||||||
this.pageSize = response.data.size;
|
this.totalPage = response.data.pages;
|
||||||
});
|
this.pageSize = response.data.size;
|
||||||
},
|
});
|
||||||
handleSelectionChange(val) {
|
},
|
||||||
this.multipleSelection = val;
|
handleSelectionChange(val) {
|
||||||
},
|
this.multipleSelection = val;
|
||||||
handleUpdate(index, row) {
|
},
|
||||||
this.$router.push({path: '/build/updateCommunity', query: {id: row.id}})
|
handleUpdate(index, row) {
|
||||||
},
|
this.$router.push({
|
||||||
handleDelete(index, row) {
|
path: '/build/updateCommunity',
|
||||||
this.$confirm('是否要删除该品牌', '提示', {
|
query: {
|
||||||
confirmButtonText: '确定',
|
id: row.id,
|
||||||
cancelButtonText: '取消',
|
cname:row.companyName
|
||||||
type: 'warning'
|
}
|
||||||
}).then(() => {
|
})
|
||||||
deleteCommunity(row.id).then(response => {
|
},
|
||||||
this.$message({
|
handleDelete(index, row) {
|
||||||
message: '删除成功',
|
this.$confirm('是否要删除该品牌', '提示', {
|
||||||
type: 'success',
|
confirmButtonText: '确定',
|
||||||
duration: 1000
|
cancelButtonText: '取消',
|
||||||
});
|
type: 'warning'
|
||||||
this.getList();
|
}).then(() => {
|
||||||
});
|
deleteCommunity(row.id).then(response => {
|
||||||
});
|
this.$message({
|
||||||
},
|
message: '删除成功',
|
||||||
getProductList(index, row) {
|
type: 'success',
|
||||||
console.log(index, row);
|
duration: 1000
|
||||||
},
|
});
|
||||||
getProductCommentList(index, row) {
|
this.getList();
|
||||||
console.log(index, row);
|
});
|
||||||
},
|
});
|
||||||
|
},
|
||||||
|
getProductList(index, row) {
|
||||||
|
console.log(index, row);
|
||||||
|
},
|
||||||
|
getProductCommentList(index, row) {
|
||||||
|
console.log(index, row);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.listQuery.pageNum = 1;
|
this.listQuery.pageNum = 1;
|
||||||
this.listQuery.pageSize = val;
|
this.listQuery.pageSize = val;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
this.listQuery.pageNum = val;
|
this.listQuery.pageNum = val;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
searchCommunityList() {
|
searchCommunityList() {
|
||||||
this.listQuery.pageNum = 1;
|
this.listQuery.pageNum = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
handleBatchOperate() {
|
handleBatchOperate() {
|
||||||
console.log(this.multipleSelection);
|
console.log(this.multipleSelection);
|
||||||
if (this.multipleSelection < 1) {
|
if (this.multipleSelection < 1) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请选择一条记录',
|
message: '请选择一条记录',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let showStatus = 0;
|
let showStatus = 0;
|
||||||
if (this.operateType === 'showCommunity') {
|
if (this.operateType === 'showCommunity') {
|
||||||
showStatus = 1;
|
showStatus = 1;
|
||||||
} else if (this.operateType === 'hideCommunity') {
|
} else if (this.operateType === 'hideCommunity') {
|
||||||
showStatus = 0;
|
showStatus = 0;
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请选择批量操作类型',
|
message: '请选择批量操作类型',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let ids = [];
|
let ids = [];
|
||||||
for (let i = 0; i < this.multipleSelection.length; i++) {
|
for (let i = 0; i < this.multipleSelection.length; i++) {
|
||||||
ids.push(this.multipleSelection[i].id);
|
ids.push(this.multipleSelection[i].id);
|
||||||
}
|
}
|
||||||
let data = new URLSearchParams();
|
let data = new URLSearchParams();
|
||||||
data.append("ids", ids);
|
data.append("ids", ids);
|
||||||
data.append("showStatus", showStatus);
|
data.append("showStatus", showStatus);
|
||||||
updateShowStatus(data).then(response => {
|
updateShowStatus(data).then(response => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '修改成功',
|
message: '修改成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addCommunity() {
|
addCommunity() {
|
||||||
this.$router.push({path: '/build/addCommunity',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
|
this.$router.push({
|
||||||
}
|
path: '/build/addCommunity',
|
||||||
}
|
query: {
|
||||||
}
|
cid: this.$route.query.cid,
|
||||||
|
cname: this.$route.query.cname
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<el-card class="form-container" shadow="never">
|
<el-card class="form-container" shadow="never">
|
||||||
<el-form :model="wuyeCompany" :rules="rules" ref="wuyeCompanyFrom" label-width="150px">
|
<el-form :model="wuyeCompany" :rules="rules" ref="wuyeCompanyFrom" label-width="150px">
|
||||||
|
|
||||||
<el-form-item label="名称:" prop="name">
|
<el-form-item label="社区名称:" prop="name">
|
||||||
<el-input v-model="wuyeCompany.name"></el-input>
|
<el-input v-model="wuyeCompany.name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="联系方式:" prop="phone">
|
<el-form-item label="联系方式:" prop="phone">
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
<el-radio :label="3">审核成功</el-radio>
|
<el-radio :label="3">审核成功</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>-->
|
</el-form-item>-->
|
||||||
<el-form-item label="照片:" prop="pic">
|
<el-form-item label="社区照片:" prop="pic">
|
||||||
<single-upload v-model="wuyeCompany.pic"></single-upload>
|
<single-upload v-model="wuyeCompany.pic"></single-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="位置:" prop="address">
|
<el-form-item label="社区位置:" prop="address">
|
||||||
<el-input v-model="wuyeCompany.address"></el-input>
|
<el-input v-model="wuyeCompany.address"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
wuyeCompany:Object.assign({}, defaultWuyeCompany),
|
wuyeCompany:Object.assign({}, defaultWuyeCompany),
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: '请输入品牌名称', trigger: 'blur'},
|
{required: true, message: '请输入社区名称', trigger: 'blur'},
|
||||||
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
|
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
logo: [
|
logo: [
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<div style="margin-top: 15px">
|
<div style="margin-top: 15px">
|
||||||
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
|
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
|
||||||
<el-form-item label="输入搜索:">
|
<el-form-item label="输入搜索:">
|
||||||
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
|
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="社区名称/关键字"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<el-table-column label="编号" align="center">
|
<el-table-column label="编号" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.id}}</template>
|
<template slot-scope="scope">{{scope.row.id}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="名称" align="center">
|
<el-table-column label="社区名称" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.name}}</template>
|
<template slot-scope="scope">{{scope.row.name}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="联系方式" align="center">
|
<el-table-column label="联系方式" align="center">
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
<!-- <el-table-column label="状态" align="center">
|
<!-- <el-table-column label="状态" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
|
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
|
||||||
</el-table-column>-->
|
</el-table-column>-->
|
||||||
<el-table-column label="照片" align="center">
|
<el-table-column label="社区照片" align="center">
|
||||||
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
|
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="位置" align="center">
|
<el-table-column label="社区位置" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.address}}</template>
|
<template slot-scope="scope">{{scope.row.address}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center">
|
<el-table-column label="创建时间" align="center">
|
||||||
|
|||||||
@@ -24,24 +24,24 @@
|
|||||||
<el-form-item label="排序:">
|
<el-form-item label="排序:">
|
||||||
<el-input v-model="productCate.sort"></el-input>
|
<el-input v-model="productCate.sort"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否显示:">
|
<!-- <el-form-item label="是否显示:">
|
||||||
<el-radio-group v-model="productCate.showStatus">
|
<el-radio-group v-model="productCate.showStatus">
|
||||||
<el-radio :label="1">是</el-radio>
|
<el-radio :label="1">是</el-radio>
|
||||||
<el-radio :label="0">否</el-radio>
|
<el-radio :label="0">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="是否显示在导航栏:">
|
<el-form-item label="是否显示在导航栏:">
|
||||||
<el-radio-group v-model="productCate.navStatus">
|
<el-radio-group v-model="productCate.navStatus">
|
||||||
<el-radio :label="1">是</el-radio>
|
<el-radio :label="1">是</el-radio>
|
||||||
<el-radio :label="0">否</el-radio>
|
<el-radio :label="0">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否显示在首页:">
|
<!-- <el-form-item label="是否显示在首页:">
|
||||||
<el-radio-group v-model="productCate.indexStatus">
|
<el-radio-group v-model="productCate.indexStatus">
|
||||||
<el-radio :label="1">是</el-radio>
|
<el-radio :label="1">是</el-radio>
|
||||||
<el-radio :label="0">否</el-radio>
|
<el-radio :label="0">否</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="分类图标:">
|
<el-form-item label="分类图标:">
|
||||||
<single-upload v-model="productCate.icon"></single-upload>
|
<single-upload v-model="productCate.icon"></single-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -87,8 +87,8 @@
|
|||||||
navStatus: 0,
|
navStatus: 0,
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
productUnit: '',
|
productUnit: '',
|
||||||
showStatus: 0,
|
showStatus: 1,
|
||||||
indexStatus:0,
|
indexStatus:1,
|
||||||
sort: 0,
|
sort: 0,
|
||||||
productAttributeIdList: []
|
productAttributeIdList: []
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,36 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card class="operate-container" shadow="never">
|
<el-card class="operate-container" shadow="never">
|
||||||
<i class="el-icon-tickets" style="margin-top: 5px"></i>
|
<i class="el-icon-tickets" style="margin-top: 5px"></i>
|
||||||
<span style="margin-top: 5px">数据列表</span>
|
<span style="margin-top: 5px">数据列表</span>
|
||||||
<el-button
|
<el-button class="btn-add" @click="handleAddProductCate()" size="mini">
|
||||||
class="btn-add"
|
添加
|
||||||
@click="handleAddProductCate()"
|
</el-button>
|
||||||
size="mini">
|
</el-card>
|
||||||
添加
|
<div class="table-container">
|
||||||
</el-button>
|
<el-table ref="productCateTable" style="width: 100%" :data="list" v-loading="listLoading" border>
|
||||||
</el-card>
|
<el-table-column label="编号" width="100" align="center">
|
||||||
<div class="table-container">
|
<template slot-scope="scope">{{scope.row.id}}</template>
|
||||||
<el-table ref="productCateTable"
|
</el-table-column>
|
||||||
style="width: 100%"
|
<el-table-column label="分类名称" align="center">
|
||||||
:data="list"
|
<template slot-scope="scope">{{scope.row.name}}</template>
|
||||||
v-loading="listLoading" border>
|
</el-table-column>
|
||||||
<el-table-column label="编号" width="100" align="center">
|
<el-table-column label="级别" width="100" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.id}}</template>
|
<template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="分类名称" align="center">
|
<el-table-column label="商品数量" width="100" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.name}}</template>
|
<template slot-scope="scope">{{scope.row.productCount }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="级别" width="100" align="center">
|
<el-table-column label="数量单位" width="100" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
|
<template slot-scope="scope">{{scope.row.productUnit }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="商品数量" width="100" align="center">
|
<!-- <el-table-column label="导航栏" width="100" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.productCount }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="数量单位" width="100" align="center">
|
|
||||||
<template slot-scope="scope">{{scope.row.productUnit }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="导航栏" width="100" align="center">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
@change="handleNavStatusChange(scope.$index, scope.row)"
|
@change="handleNavStatusChange(scope.$index, scope.row)"
|
||||||
@@ -39,18 +33,15 @@
|
|||||||
v-model="scope.row.navStatus">
|
v-model="scope.row.navStatus">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="是否显示" width="100" align="center">
|
<el-table-column label="是否显示" width="100" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch @change="handleShowStatusChange(scope.$index, scope.row)" :active-value="1"
|
||||||
@change="handleShowStatusChange(scope.$index, scope.row)"
|
:inactive-value="0" v-model="scope.row.showStatus">
|
||||||
:active-value="1"
|
</el-switch>
|
||||||
:inactive-value="0"
|
</template>
|
||||||
v-model="scope.row.showStatus">
|
</el-table-column>
|
||||||
</el-switch>
|
<!-- <el-table-column label="是否首页显示" width="100" align="center">
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="是否首页显示" width="100" align="center">
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
@change="handleIndexStatusChange(scope.$index, scope.row)"
|
@change="handleIndexStatusChange(scope.$index, scope.row)"
|
||||||
@@ -59,193 +50,196 @@
|
|||||||
v-model="scope.row.indexStatus">
|
v-model="scope.row.indexStatus">
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="排序" width="100" align="center">
|
<el-table-column label="排序" width="100" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.sort }}</template>
|
<template slot-scope="scope">{{scope.row.sort }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="设置" width="200" align="center">
|
<el-table-column label="设置" width="200" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button size="mini" :disabled="scope.row.level | disableNextLevel"
|
||||||
size="mini"
|
@click="handleShowNextLevel(scope.$index, scope.row)">查看下级
|
||||||
:disabled="scope.row.level | disableNextLevel"
|
</el-button>
|
||||||
@click="handleShowNextLevel(scope.$index, scope.row)">查看下级
|
<!-- <el-button
|
||||||
</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleTransferProduct(scope.$index, scope.row)">转移商品
|
@click="handleTransferProduct(scope.$index, scope.row)">转移商品
|
||||||
</el-button>
|
</el-button> -->
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="200" align="center">
|
<el-table-column label="操作" width="200" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button size="mini" @click="handleUpdate(scope.$index, scope.row)">编辑
|
||||||
size="mini"
|
</el-button>
|
||||||
@click="handleUpdate(scope.$index, scope.row)">编辑
|
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
</template>
|
||||||
size="mini"
|
</el-table-column>
|
||||||
type="danger"
|
</el-table>
|
||||||
@click="handleDelete(scope.$index, scope.row)">删除
|
</div>
|
||||||
</el-button>
|
<div class="pagination-container">
|
||||||
</template>
|
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||||
</el-table-column>
|
layout="total, sizes,prev, pager, next,jumper" :page-size="listQuery.pageSize" :page-sizes="[5,10,15]"
|
||||||
</el-table>
|
:current-page.sync="listQuery.pageNum" :total="total">
|
||||||
</div>
|
</el-pagination>
|
||||||
<div class="pagination-container">
|
</div>
|
||||||
<el-pagination
|
</div>
|
||||||
background
|
|
||||||
@size-change="handleSizeChange"
|
|
||||||
@current-change="handleCurrentChange"
|
|
||||||
layout="total, sizes,prev, pager, next,jumper"
|
|
||||||
:page-size="listQuery.pageSize"
|
|
||||||
:page-sizes="[5,10,15]"
|
|
||||||
:current-page.sync="listQuery.pageNum"
|
|
||||||
:total="total">
|
|
||||||
</el-pagination>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {fetchList,deleteProductCate,updateShowStatus,updateNavStatus,updateIndexStatus} from '@/api/productCate'
|
import {
|
||||||
|
fetchList,
|
||||||
|
deleteProductCate,
|
||||||
|
updateShowStatus,
|
||||||
|
updateNavStatus,
|
||||||
|
updateIndexStatus
|
||||||
|
} from '@/api/productCate'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "productCateList",
|
name: "productCateList",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: null,
|
list: null,
|
||||||
total: null,
|
total: null,
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
listQuery: {
|
listQuery: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 5
|
pageSize: 5
|
||||||
},
|
},
|
||||||
parentId: 0
|
parentId: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.resetParentId();
|
this.resetParentId();
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route(route) {
|
$route(route) {
|
||||||
this.resetParentId();
|
this.resetParentId();
|
||||||
this.getList();
|
this.getList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resetParentId(){
|
resetParentId() {
|
||||||
if (this.$route.query.parentId != null) {
|
if (this.$route.query.parentId != null) {
|
||||||
this.parentId = this.$route.query.parentId;
|
this.parentId = this.$route.query.parentId;
|
||||||
} else {
|
} else {
|
||||||
this.parentId = 0;
|
this.parentId = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleAddProductCate() {
|
handleAddProductCate() {
|
||||||
this.$router.push('/pms/addProductCate');
|
this.$router.push('/pms/addProductCate');
|
||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
fetchList(this.parentId, this.listQuery).then(response => {
|
fetchList(this.parentId, this.listQuery).then(response => {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
this.list = response.data.records;
|
this.list = response.data.records;
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.listQuery.pageNum = 1;
|
this.listQuery.pageNum = 1;
|
||||||
this.listQuery.pageSize = val;
|
this.listQuery.pageSize = val;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
this.listQuery.pageNum = val;
|
this.listQuery.pageNum = val;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
handleNavStatusChange(index, row) {
|
handleNavStatusChange(index, row) {
|
||||||
let data = new URLSearchParams();
|
let data = new URLSearchParams();
|
||||||
let ids=[];
|
let ids = [];
|
||||||
ids.push(row.id)
|
ids.push(row.id)
|
||||||
data.append('ids',ids);
|
data.append('ids', ids);
|
||||||
data.append('navStatus',row.navStatus);
|
data.append('navStatus', row.navStatus);
|
||||||
updateNavStatus(data).then(response=>{
|
updateNavStatus(data).then(response => {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '修改成功',
|
message: '修改成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleShowStatusChange(index, row) {
|
handleShowStatusChange(index, row) {
|
||||||
let data = new URLSearchParams();
|
let data = new URLSearchParams();
|
||||||
let ids=[];
|
let ids = [];
|
||||||
ids.push(row.id)
|
ids.push(row.id)
|
||||||
data.append('ids',ids);
|
data.append('ids', ids);
|
||||||
data.append('showStatus',row.showStatus);
|
data.append('showStatus', row.showStatus);
|
||||||
updateShowStatus(data).then(response=>{
|
updateShowStatus(data).then(response => {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '修改成功',
|
message: '修改成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleIndexStatusChange(index, row) {
|
handleIndexStatusChange(index, row) {
|
||||||
let data = new URLSearchParams();
|
let data = new URLSearchParams();
|
||||||
let ids=[];
|
let ids = [];
|
||||||
ids.push(row.id)
|
ids.push(row.id)
|
||||||
data.append('ids',ids);
|
data.append('ids', ids);
|
||||||
data.append('indexStatus',row.indexStatus);
|
data.append('indexStatus', row.indexStatus);
|
||||||
updateIndexStatus(data).then(response=>{
|
updateIndexStatus(data).then(response => {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '修改成功',
|
message: '修改成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleShowNextLevel(index, row) {
|
handleShowNextLevel(index, row) {
|
||||||
this.$router.push({path: '/pms/productCate', query: {parentId: row.id}})
|
this.$router.push({
|
||||||
},
|
path: '/pms/productCate',
|
||||||
handleTransferProduct(index, row) {
|
query: {
|
||||||
console.log('handleAddProductCate');
|
parentId: row.id
|
||||||
},
|
}
|
||||||
handleUpdate(index, row) {
|
})
|
||||||
this.$router.push({path:'/pms/updateProductCate',query:{id:row.id}});
|
},
|
||||||
},
|
handleTransferProduct(index, row) {
|
||||||
handleDelete(index, row) {
|
console.log('handleAddProductCate');
|
||||||
this.$confirm('是否要删除该品牌', '提示', {
|
},
|
||||||
confirmButtonText: '确定',
|
handleUpdate(index, row) {
|
||||||
cancelButtonText: '取消',
|
this.$router.push({
|
||||||
type: 'warning'
|
path: '/pms/updateProductCate',
|
||||||
}).then(() => {
|
query: {
|
||||||
deleteProductCate(row.id).then(response => {
|
id: row.id
|
||||||
this.$message({
|
}
|
||||||
message: '删除成功',
|
});
|
||||||
type: 'success',
|
},
|
||||||
duration: 1000
|
handleDelete(index, row) {
|
||||||
});
|
this.$confirm('是否要删除该品牌', '提示', {
|
||||||
this.getList();
|
confirmButtonText: '确定',
|
||||||
});
|
cancelButtonText: '取消',
|
||||||
});
|
type: 'warning'
|
||||||
}
|
}).then(() => {
|
||||||
},
|
deleteProductCate(row.id).then(response => {
|
||||||
filters: {
|
this.$message({
|
||||||
levelFilter(value) {
|
message: '删除成功',
|
||||||
if (value === 0) {
|
type: 'success',
|
||||||
return '一级';
|
duration: 1000
|
||||||
} else if (value === 1) {
|
});
|
||||||
return '二级';
|
this.getList();
|
||||||
}
|
});
|
||||||
},
|
});
|
||||||
disableNextLevel(value) {
|
}
|
||||||
if (value === 0) {
|
},
|
||||||
return false;
|
filters: {
|
||||||
} else {
|
levelFilter(value) {
|
||||||
return true;
|
if (value === 0) {
|
||||||
}
|
return '一级';
|
||||||
}
|
} else if (value === 1) {
|
||||||
}
|
return '二级';
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
disableNextLevel(value) {
|
||||||
|
if (value === 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -9,14 +9,15 @@
|
|||||||
<el-input v-model="homeAdvertise.name" class="input-width"></el-input>
|
<el-input v-model="homeAdvertise.name" class="input-width"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="广告位置:">
|
<el-form-item label="广告位置:">
|
||||||
<el-select v-model="homeAdvertise.type">
|
<!-- <el-select v-model="homeAdvertise.type">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="type in typeOptions"
|
v-for="type in typeOptions"
|
||||||
:key="type.value"
|
:key="type.value"
|
||||||
:label="type.label"
|
:label="type.label"
|
||||||
:value="type.value">
|
:value="type.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select> -->
|
||||||
|
<span>Android首页轮播</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开始时间:" prop="startTime">
|
<el-form-item label="开始时间:" prop="startTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@@ -84,7 +85,7 @@
|
|||||||
];
|
];
|
||||||
const defaultHomeAdvertise = {
|
const defaultHomeAdvertise = {
|
||||||
name: null,
|
name: null,
|
||||||
type: 1,
|
type: 2,
|
||||||
pic: null,
|
pic: null,
|
||||||
startTime: null,
|
startTime: null,
|
||||||
endTime: null,
|
endTime: null,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<el-form-item label="广告名称:">
|
<el-form-item label="广告名称:">
|
||||||
<el-input v-model="listQuery.name" class="input-width" placeholder="广告名称"></el-input>
|
<el-input v-model="listQuery.name" class="input-width" placeholder="广告名称"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="广告位置:">
|
<!-- <el-form-item label="广告位置:">
|
||||||
<el-select v-model="listQuery.type" placeholder="全部" clearable class="input-width">
|
<el-select v-model="listQuery.type" placeholder="全部" clearable class="input-width">
|
||||||
<el-option v-for="item in typeOptions"
|
<el-option v-for="item in typeOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
:value="item.value">
|
:value="item.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="到期时间:">
|
<el-form-item label="到期时间:">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
class="input-width"
|
class="input-width"
|
||||||
@@ -62,13 +62,13 @@
|
|||||||
<el-table-column label="广告名称" align="center">
|
<el-table-column label="广告名称" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.name}}</template>
|
<template slot-scope="scope">{{scope.row.name}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="广告位置" width="120" align="center">
|
<!-- <el-table-column label="广告位置" width="120" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.type | formatType}}</template>
|
<template slot-scope="scope">{{scope.row.type | formatType}}</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="广告图片" width="120" align="center">
|
<el-table-column label="广告图片" width="250" align="center">
|
||||||
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
|
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="时间" width="220" align="center">
|
<el-table-column label="时间" width="320" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<p>开始时间:{{scope.row.startTime | formatTime}}</p>
|
<p>开始时间:{{scope.row.startTime | formatTime}}</p>
|
||||||
<p>到期时间:{{scope.row.endTime | formatTime}}</p>
|
<p>到期时间:{{scope.row.endTime | formatTime}}</p>
|
||||||
@@ -84,13 +84,13 @@
|
|||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="点击次数" width="120" align="center">
|
<!-- <el-table-column label="点击次数" width="120" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.clickCount}}</template>
|
<template slot-scope="scope">{{scope.row.clickCount}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="生成订单" width="120" align="center">
|
<el-table-column label="生成订单" width="120" align="center">
|
||||||
<template slot-scope="scope">{{scope.row.orderCount}}</template>
|
<template slot-scope="scope">{{scope.row.orderCount}}</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="操作" width="120" align="center">
|
<el-table-column label="操作" width="180" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini"
|
<el-button size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@@ -1,403 +1,408 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="form-container" shadow="never">
|
<el-card class="form-container" shadow="never">
|
||||||
<el-form :model="coupon"
|
<el-form :model="coupon" :rules="rules" ref="couponFrom" label-width="150px" size="small">
|
||||||
:rules="rules"
|
<el-form-item label="优惠券类型:">
|
||||||
ref="couponFrom"
|
<span>全场赠券</span>
|
||||||
label-width="150px"
|
</el-form-item>
|
||||||
size="small">
|
<el-form-item label="优惠券名称:" prop="name">
|
||||||
<el-form-item label="优惠券类型:">
|
<el-input v-model="coupon.name" class="input-width"></el-input>
|
||||||
<el-select v-model="coupon.type">
|
</el-form-item>
|
||||||
<el-option v-for='type in typeOptions' :key='type.value' :label='type.label' :value='type.value'></el-option>
|
<el-form-item label="适用平台:">
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
<span>全平台</span>
|
||||||
<el-form-item label="优惠券名称:" prop="name">
|
</el-form-item>
|
||||||
<el-input v-model="coupon.name" class="input-width"></el-input>
|
<el-form-item label="总发行量:" prop="publishCount">
|
||||||
</el-form-item>
|
<el-input v-model.number="coupon.publishCount" placeholder="只能输入正整数" class="input-width"></el-input>
|
||||||
<el-form-item label="适用平台:">
|
</el-form-item>
|
||||||
<el-select v-model="coupon.platform">
|
<el-form-item label="面额:" prop="amount">
|
||||||
<el-option
|
<el-input v-model="coupon.amount" @keyup.native="coupon.amount = UpNumber(coupon.amount,2)"
|
||||||
v-for="item in platformOptions"
|
placeholder="面值只能是数值,限2位小数" class="input-width">
|
||||||
:key="item.value"
|
<template slot="append">元</template>
|
||||||
:label="item.label"
|
</el-input>
|
||||||
:value="item.value">
|
</el-form-item>
|
||||||
</el-option>
|
<el-form-item label="每人限领:">
|
||||||
</el-select>
|
<el-input v-model="coupon.perLimit" placeholder="只能输入正整数" class="input-width">
|
||||||
</el-form-item>
|
<template slot="append">张</template>
|
||||||
<el-form-item label="总发行量:" prop="publishCount">
|
</el-input>
|
||||||
<el-input v-model.number="coupon.publishCount" placeholder="只能输入正整数" class="input-width"></el-input>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item label="使用门槛:" prop="minPoint">
|
||||||
<el-form-item label="面额:" prop="amount">
|
<el-input v-model.number="coupon.minPoint" placeholder="只能输入正整数" class="input-width">
|
||||||
<el-input v-model="coupon.amount" @keyup.native="coupon.amount = UpNumber(coupon.amount,2)" placeholder="面值只能是数值,限2位小数" class="input-width">
|
<template slot="prepend">满</template>
|
||||||
<template slot="append">元</template>
|
<template slot="append">元可用</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="每人限领:">
|
<el-form-item label="有效期:" >
|
||||||
<el-input v-model="coupon.perLimit" placeholder="只能输入正整数" class="input-width">
|
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.startTime" style="width: 150px">
|
||||||
<template slot="append">张</template>
|
</el-date-picker>
|
||||||
</el-input>
|
<span style="margin-left: 20px;margin-right: 20px">至</span>
|
||||||
</el-form-item>
|
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.endTime" style="width: 150px">
|
||||||
<el-form-item label="使用门槛:" prop="minPoint">
|
</el-date-picker>
|
||||||
<el-input v-model.number="coupon.minPoint" placeholder="只能输入正整数" class="input-width">
|
</el-form-item>
|
||||||
<template slot="prepend">满</template>
|
<el-form-item label="可使用商品:">
|
||||||
<template slot="append">元可用</template>
|
<el-radio-group v-model="coupon.useType">
|
||||||
</el-input>
|
<el-radio-button :label="0">全场通用</el-radio-button>
|
||||||
</el-form-item>
|
<el-radio-button :label="1">指定分类</el-radio-button>
|
||||||
<el-form-item label="有效期:">
|
<el-radio-button :label="2">指定商品</el-radio-button>
|
||||||
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.startTime" style="width: 150px"></el-date-picker>
|
</el-radio-group>
|
||||||
<span style="margin-left: 20px;margin-right: 20px">至</span>
|
</el-form-item>
|
||||||
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.endTime" style="width: 150px"></el-date-picker>
|
<el-form-item v-show="coupon.useType===1">
|
||||||
</el-form-item>
|
<el-cascader clearable placeholder="请选择分类名称" v-model="selectProductCate" :options="productCateOptions">
|
||||||
<el-form-item label="可使用商品:">
|
</el-cascader>
|
||||||
<el-radio-group v-model="coupon.useType">
|
<el-button @click="handleAddProductCategoryRelation()">添加</el-button>
|
||||||
<el-radio-button :label="0">全场通用</el-radio-button>
|
<el-table ref="productCateRelationTable" :data="coupon.productCategoryRelationList"
|
||||||
<el-radio-button :label="1">指定分类</el-radio-button>
|
style="width: 100%;margin-top: 20px" border>
|
||||||
<el-radio-button :label="2">指定商品</el-radio-button>
|
<el-table-column label="分类名称" align="center">
|
||||||
</el-radio-group>
|
<template
|
||||||
</el-form-item>
|
slot-scope="scope">{{scope.row.parentCategoryName}}>{{scope.row.productCategoryName}}</template>
|
||||||
<el-form-item v-show="coupon.useType===1">
|
</el-table-column>
|
||||||
<el-cascader
|
<el-table-column label="操作" align="center" width="100">
|
||||||
clearable
|
<template slot-scope="scope">
|
||||||
placeholder="请选择分类名称"
|
<el-button size="mini" type="text"
|
||||||
v-model="selectProductCate"
|
@click="handleDeleteProductCateRelation(scope.$index, scope.row)">删除
|
||||||
:options="productCateOptions">
|
</el-button>
|
||||||
</el-cascader>
|
</template>
|
||||||
<el-button @click="handleAddProductCategoryRelation()">添加</el-button>
|
</el-table-column>
|
||||||
<el-table ref="productCateRelationTable"
|
</el-table>
|
||||||
:data="coupon.productCategoryRelationList"
|
</el-form-item>
|
||||||
style="width: 100%;margin-top: 20px"
|
<el-form-item v-show="coupon.useType===2">
|
||||||
border>
|
<el-select v-model="selectProduct" filterable remote reserve-keyword placeholder="商品名称/商品货号"
|
||||||
<el-table-column label="分类名称" align="center">
|
:remote-method="searchProductMethod" :loading="selectProductLoading">
|
||||||
<template slot-scope="scope">{{scope.row.parentCategoryName}}>{{scope.row.productCategoryName}}</template>
|
<el-option v-for="item in selectProductOptions" :key="item.productId" :label="item.productName"
|
||||||
</el-table-column>
|
:value="item.productId">
|
||||||
<el-table-column label="操作" align="center" width="100">
|
<span style="float: left">{{ item.productName }}</span>
|
||||||
<template slot-scope="scope">
|
<span style="float: right; color: #8492a6; font-size: 13px">NO.{{ item.productSn }}</span>
|
||||||
<el-button size="mini"
|
</el-option>
|
||||||
type="text"
|
</el-select>
|
||||||
@click="handleDeleteProductCateRelation(scope.$index, scope.row)">删除
|
<el-button @click="handleAddProductRelation()">添加</el-button>
|
||||||
</el-button>
|
<el-table ref="productRelationTable" :data="coupon.productRelationList"
|
||||||
</template>
|
style="width: 100%;margin-top: 20px" border>
|
||||||
</el-table-column>
|
<el-table-column label="商品名称" align="center">
|
||||||
</el-table>
|
<template slot-scope="scope">{{scope.row.productName}}</template>
|
||||||
</el-form-item>
|
</el-table-column>
|
||||||
<el-form-item v-show="coupon.useType===2">
|
<el-table-column label="货号" align="center" width="120">
|
||||||
<el-select
|
<template slot-scope="scope">NO.{{scope.row.productSn}}</template>
|
||||||
v-model="selectProduct"
|
</el-table-column>
|
||||||
filterable
|
<el-table-column label="操作" align="center" width="100">
|
||||||
remote
|
<template slot-scope="scope">
|
||||||
reserve-keyword
|
<el-button size="mini" type="text"
|
||||||
placeholder="商品名称/商品货号"
|
@click="handleDeleteProductRelation(scope.$index, scope.row)">删除
|
||||||
:remote-method="searchProductMethod"
|
</el-button>
|
||||||
:loading="selectProductLoading">
|
</template>
|
||||||
<el-option
|
</el-table-column>
|
||||||
v-for="item in selectProductOptions"
|
</el-table>
|
||||||
:key="item.productId"
|
</el-form-item>
|
||||||
:label="item.productName"
|
<el-form-item label="备注:">
|
||||||
:value="item.productId">
|
<el-input class="input-width" type="textarea" :rows="5" placeholder="请输入内容" v-model="coupon.note">
|
||||||
<span style="float: left">{{ item.productName }}</span>
|
</el-input>
|
||||||
<span style="float: right; color: #8492a6; font-size: 13px">NO.{{ item.productSn }}</span>
|
</el-form-item>
|
||||||
</el-option>
|
<el-form-item>
|
||||||
</el-select>
|
<el-button type="primary" @click="onSubmit('couponFrom')">提交</el-button>
|
||||||
<el-button @click="handleAddProductRelation()">添加</el-button>
|
<el-button v-if="!isEdit" @click="resetForm('couponFrom')">重置</el-button>
|
||||||
<el-table ref="productRelationTable"
|
</el-form-item>
|
||||||
:data="coupon.productRelationList"
|
</el-form>
|
||||||
style="width: 100%;margin-top: 20px"
|
</el-card>
|
||||||
border>
|
|
||||||
<el-table-column label="商品名称" align="center">
|
|
||||||
<template slot-scope="scope">{{scope.row.productName}}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="货号" align="center" width="120" >
|
|
||||||
<template slot-scope="scope">NO.{{scope.row.productSn}}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" width="100">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button size="mini"
|
|
||||||
type="text"
|
|
||||||
@click="handleDeleteProductRelation(scope.$index, scope.row)">删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注:">
|
|
||||||
<el-input
|
|
||||||
class="input-width"
|
|
||||||
type="textarea"
|
|
||||||
:rows="5"
|
|
||||||
placeholder="请输入内容"
|
|
||||||
v-model="coupon.note">
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" @click="onSubmit('couponFrom')">提交</el-button>
|
|
||||||
<el-button v-if="!isEdit" @click="resetForm('couponFrom')">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
</el-card>
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {createCoupon,getCoupon,updateCoupon} from '@/api/coupon';
|
import {
|
||||||
import {fetchSimpleList as fetchProductList} from '@/api/product';
|
createCoupon,
|
||||||
import {fetchListWithChildren} from '@/api/productCate'
|
getCoupon,
|
||||||
const defaultCoupon = {
|
updateCoupon
|
||||||
type: 0,
|
} from '@/api/coupon';
|
||||||
name: null,
|
import {
|
||||||
platform: 0,
|
fetchSimpleList as fetchProductList
|
||||||
amount: null,
|
} from '@/api/product';
|
||||||
perLimit: 1,
|
import {
|
||||||
minPoint: null,
|
fetchListWithChildren
|
||||||
startTime: null,
|
} from '@/api/productCate'
|
||||||
endTime: null,
|
const defaultCoupon = {
|
||||||
useType: 0,
|
type: 0,
|
||||||
note: null,
|
name: null,
|
||||||
publishCount: null,
|
platform: 0,
|
||||||
productRelationList: [],
|
amount: null,
|
||||||
productCategoryRelationList: []
|
perLimit: 1,
|
||||||
};
|
minPoint: null,
|
||||||
const defaultTypeOptions = [
|
startTime: null,
|
||||||
{
|
endTime: null,
|
||||||
label: '全场赠券',
|
useType: 0,
|
||||||
value: 0
|
note: null,
|
||||||
},
|
publishCount: null,
|
||||||
{
|
productRelationList: [],
|
||||||
label: '会员赠券',
|
productCategoryRelationList: []
|
||||||
value: 1
|
};
|
||||||
},
|
const defaultTypeOptions = [{
|
||||||
{
|
label: '全场赠券',
|
||||||
label: '购物赠券',
|
value: 0
|
||||||
value: 2
|
},
|
||||||
},
|
{
|
||||||
{
|
label: '会员赠券',
|
||||||
label: '注册赠券',
|
value: 1
|
||||||
value: 3
|
},
|
||||||
}
|
{
|
||||||
];
|
label: '购物赠券',
|
||||||
const defaultPlatformOptions = [
|
value: 2
|
||||||
{
|
},
|
||||||
label: '全平台',
|
{
|
||||||
value: 0
|
label: '注册赠券',
|
||||||
},
|
value: 3
|
||||||
{
|
}
|
||||||
label: '移动平台',
|
];
|
||||||
value: 1
|
const defaultPlatformOptions = [{
|
||||||
},
|
label: '全平台',
|
||||||
{
|
value: 0
|
||||||
label: 'PC平台',
|
},
|
||||||
value: 2
|
{
|
||||||
}
|
label: '移动平台',
|
||||||
];
|
value: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'PC平台',
|
||||||
|
value: 2
|
||||||
|
}
|
||||||
|
];
|
||||||
var validatePrice = (rule, value, callback) => {
|
var validatePrice = (rule, value, callback) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
callback(new Error("面额不能为空"));
|
callback(new Error("面额不能为空"));
|
||||||
} else if (value.split(".").length > 2) {
|
} else if (value.split(".").length > 2) {
|
||||||
callback(new Error("请输入正确格式的金额")); //防止输入多个小数点
|
callback(new Error("请输入正确格式的金额")); //防止输入多个小数点
|
||||||
}
|
}
|
||||||
// else if (value > add_Com.Retail_Price) {
|
// else if (value > add_Com.Retail_Price) {
|
||||||
// callback(new Error("金额不能大于零售价"));
|
// callback(new Error("金额不能大于零售价"));
|
||||||
// }
|
// }
|
||||||
else {
|
else {
|
||||||
value = Math.round(value * Math.pow(10, 2)) / Math.pow(10, 2); //四舍五入
|
value = Math.round(value * Math.pow(10, 2)) / Math.pow(10, 2); //四舍五入
|
||||||
value = Number(value).toFixed(2); //不足补位
|
value = Number(value).toFixed(2); //不足补位
|
||||||
this.add_Com.Cost_Price = value;
|
this.add_Com.Cost_Price = value;
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CouponDetail',
|
name: 'CouponDetail',
|
||||||
props: {
|
props: {
|
||||||
isEdit: {
|
isEdit: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
coupon: Object.assign({}, defaultCoupon),
|
coupon: Object.assign({}, defaultCoupon),
|
||||||
typeOptions: Object.assign({}, defaultTypeOptions),
|
typeOptions: Object.assign({}, defaultTypeOptions),
|
||||||
platformOptions: Object.assign({}, defaultPlatformOptions),
|
platformOptions: Object.assign({}, defaultPlatformOptions),
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [{
|
||||||
{required: true, message: '请输入优惠券名称', trigger: 'blur'},
|
required: true,
|
||||||
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
|
message: '请输入优惠券名称',
|
||||||
],
|
trigger: 'blur'
|
||||||
publishCount: [
|
},
|
||||||
{type: 'number',required: true, message: '只能输入正整数', trigger: 'blur'}
|
{
|
||||||
],
|
min: 2,
|
||||||
// amount: [
|
max: 140,
|
||||||
// // {type: 'number',required: true,message: '面值只能是数值,0.01-10000,限2位小数',trigger: 'blur'}
|
message: '长度在 2 到 140 个字符',
|
||||||
// // { required: true, validator: validatePrice, trigger: "blur" },
|
trigger: 'blur'
|
||||||
// ],
|
}
|
||||||
minPoint: [
|
],
|
||||||
{type: 'number',required: true,message: '只能输入正整数',trigger: 'blur'}
|
publishCount: [{
|
||||||
]
|
type: 'number',
|
||||||
},
|
required: true,
|
||||||
selectProduct:null,
|
message: '只能输入正整数',
|
||||||
selectProductLoading: false,
|
trigger: 'blur'
|
||||||
selectProductOptions:[],
|
}],
|
||||||
selectProductCate: null,
|
amount: [{
|
||||||
productCateOptions: []
|
|
||||||
}
|
required: true,
|
||||||
},
|
message: '面值只能是数值,0.01-10000,限2位小数',
|
||||||
created(){
|
trigger: 'blur'
|
||||||
if(this.isEdit){
|
}],
|
||||||
getCoupon(this.$route.query.id).then(response=>{
|
minPoint: [{
|
||||||
this.coupon=response.data;
|
type: 'number',
|
||||||
});
|
required: true,
|
||||||
}
|
message: '只能输入正整数',
|
||||||
this.getProductCateList();
|
trigger: 'blur'
|
||||||
},
|
}]
|
||||||
methods:{
|
},
|
||||||
UpNumber(val, limit = 2) {
|
selectProduct: null,
|
||||||
val = val.replace(/[^\d.]/g, '') // 保留数字
|
selectProductLoading: false,
|
||||||
val = val.replace(/^00/, '0.') // 开头不能有两个0
|
selectProductOptions: [],
|
||||||
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0.
|
selectProductCate: null,
|
||||||
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个
|
productCateOptions: []
|
||||||
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点
|
}
|
||||||
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0
|
},
|
||||||
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
|
created() {
|
||||||
const reg = new RegExp(str)
|
if (this.isEdit) {
|
||||||
if (limit === 0) {
|
getCoupon(this.$route.query.id).then(response => {
|
||||||
// 不需要小数点
|
this.coupon = response.data;
|
||||||
val = val.replace(reg, '$1')
|
});
|
||||||
} else {
|
}
|
||||||
// 通过正则保留小数点后指定的位数
|
this.getProductCateList();
|
||||||
val = val.replace(reg, '$1.$2')
|
},
|
||||||
}
|
methods: {
|
||||||
return val
|
UpNumber(val, limit = 2) {
|
||||||
},
|
val = val.replace(/[^\d.]/g, '') // 保留数字
|
||||||
onSubmit(formName) {
|
val = val.replace(/^00/, '0.') // 开头不能有两个0
|
||||||
this.$refs[formName].validate((valid) => {
|
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0.
|
||||||
if (valid) {
|
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个
|
||||||
this.$confirm('是否提交数据', '提示', {
|
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点
|
||||||
confirmButtonText: '确定',
|
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0
|
||||||
cancelButtonText: '取消',
|
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
|
||||||
type: 'warning'
|
const reg = new RegExp(str)
|
||||||
}).then(() => {
|
if (limit === 0) {
|
||||||
if(this.isEdit){
|
// 不需要小数点
|
||||||
updateCoupon(this.$route.query.id,this.coupon).then(response=>{
|
val = val.replace(reg, '$1')
|
||||||
this.$refs[formName].resetFields();
|
} else {
|
||||||
this.$message({
|
// 通过正则保留小数点后指定的位数
|
||||||
message: '修改成功',
|
val = val.replace(reg, '$1.$2')
|
||||||
type: 'success',
|
}
|
||||||
duration:1000
|
return val
|
||||||
});
|
},
|
||||||
this.$router.back();
|
onSubmit(formName) {
|
||||||
});
|
this.$refs[formName].validate((valid) => {
|
||||||
}else{
|
if (valid) {
|
||||||
createCoupon(this.coupon).then(response=>{
|
this.$confirm('是否提交数据', '提示', {
|
||||||
this.$refs[formName].resetFields();
|
confirmButtonText: '确定',
|
||||||
this.$message({
|
cancelButtonText: '取消',
|
||||||
message: '提交成功',
|
type: 'warning'
|
||||||
type: 'success',
|
}).then(() => {
|
||||||
duration:1000
|
if (this.isEdit) {
|
||||||
});
|
updateCoupon(this.$route.query.id, this.coupon).then(response => {
|
||||||
this.$router.back();
|
this.$refs[formName].resetFields();
|
||||||
});
|
this.$message({
|
||||||
}
|
message: '修改成功',
|
||||||
});
|
type: 'success',
|
||||||
} else {
|
duration: 1000
|
||||||
this.$message({
|
});
|
||||||
message: '验证失败',
|
this.$router.back();
|
||||||
type: 'error',
|
});
|
||||||
duration:1000
|
} else {
|
||||||
});
|
createCoupon(this.coupon).then(response => {
|
||||||
return false;
|
this.$refs[formName].resetFields();
|
||||||
}
|
this.$message({
|
||||||
});
|
message: '提交成功',
|
||||||
},
|
type: 'success',
|
||||||
resetForm(formName) {
|
duration: 1000
|
||||||
this.$refs[formName].resetFields();
|
});
|
||||||
this.coupon = Object.assign({},defaultCoupon);
|
this.$router.back();
|
||||||
},
|
});
|
||||||
searchProductMethod(query){
|
}
|
||||||
if (query !== '') {
|
});
|
||||||
this.loading = true;
|
} else {
|
||||||
fetchProductList({keyword:query}).then(response=>{
|
this.$message({
|
||||||
this.loading=false;
|
message: '验证失败',
|
||||||
let productList = response.data;
|
type: 'error',
|
||||||
this.selectProductOptions = [];
|
duration: 1000
|
||||||
for(let i=0;i<productList.length;i++){
|
});
|
||||||
let item = productList[i];
|
return false;
|
||||||
this.selectProductOptions.push({productId:item.id,productName:item.name,productSn:item.productSn});
|
}
|
||||||
}
|
});
|
||||||
});
|
},
|
||||||
} else {
|
resetForm(formName) {
|
||||||
this.selectProductOptions = [];
|
this.$refs[formName].resetFields();
|
||||||
}
|
this.coupon = Object.assign({}, defaultCoupon);
|
||||||
},
|
},
|
||||||
handleAddProductRelation(){
|
searchProductMethod(query) {
|
||||||
if(this.selectProduct===null){
|
if (query !== '') {
|
||||||
this.$message({
|
this.loading = true;
|
||||||
message: '请先选择商品',
|
fetchProductList({
|
||||||
type: 'warning'
|
keyword: query
|
||||||
});
|
}).then(response => {
|
||||||
return
|
this.loading = false;
|
||||||
}
|
let productList = response.data;
|
||||||
this.coupon.productRelationList.push(this.getProductById(this.selectProduct));
|
this.selectProductOptions = [];
|
||||||
this.selectProduct=null;
|
for (let i = 0; i < productList.length; i++) {
|
||||||
},
|
let item = productList[i];
|
||||||
handleDeleteProductRelation(index,row){
|
this.selectProductOptions.push({
|
||||||
this.coupon.productRelationList.splice(index,1);
|
productId: item.id,
|
||||||
},
|
productName: item.name,
|
||||||
handleAddProductCategoryRelation(){
|
productSn: item.productSn
|
||||||
if(this.selectProductCate===null||this.selectProductCate.length===0){
|
});
|
||||||
this.$message({
|
}
|
||||||
message: '请先选择商品分类',
|
});
|
||||||
type: 'warning'
|
} else {
|
||||||
});
|
this.selectProductOptions = [];
|
||||||
return
|
}
|
||||||
}
|
},
|
||||||
this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate));
|
handleAddProductRelation() {
|
||||||
this.selectProductCate=[];
|
if (this.selectProduct === null) {
|
||||||
},
|
this.$message({
|
||||||
handleDeleteProductCateRelation(index,row){
|
message: '请先选择商品',
|
||||||
this.coupon.productCategoryRelationList.splice(index,1);
|
type: 'warning'
|
||||||
},
|
});
|
||||||
getProductById(id){
|
return
|
||||||
for(let i=0;i<this.selectProductOptions.length;i++){
|
}
|
||||||
if(id===this.selectProductOptions[i].productId){
|
this.coupon.productRelationList.push(this.getProductById(this.selectProduct));
|
||||||
return this.selectProductOptions[i];
|
this.selectProduct = null;
|
||||||
}
|
},
|
||||||
}
|
handleDeleteProductRelation(index, row) {
|
||||||
return null;
|
this.coupon.productRelationList.splice(index, 1);
|
||||||
},
|
},
|
||||||
getProductCateList() {
|
handleAddProductCategoryRelation() {
|
||||||
fetchListWithChildren().then(response => {
|
if (this.selectProductCate === null || this.selectProductCate.length === 0) {
|
||||||
let list = response.data;
|
this.$message({
|
||||||
this.productCateOptions = [];
|
message: '请先选择商品分类',
|
||||||
for (let i = 0; i < list.length; i++) {
|
type: 'warning'
|
||||||
let children = [];
|
});
|
||||||
if (list[i].children != null && list[i].children.length > 0) {
|
return
|
||||||
for (let j = 0; j < list[i].children.length; j++) {
|
}
|
||||||
children.push({label: list[i].children[j].name, value: list[i].children[j].id});
|
this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate));
|
||||||
}
|
this.selectProductCate = [];
|
||||||
}
|
},
|
||||||
this.productCateOptions.push({label: list[i].name, value: list[i].id, children: children});
|
handleDeleteProductCateRelation(index, row) {
|
||||||
}
|
this.coupon.productCategoryRelationList.splice(index, 1);
|
||||||
});
|
},
|
||||||
},
|
getProductById(id) {
|
||||||
getProductCateByIds(ids){
|
for (let i = 0; i < this.selectProductOptions.length; i++) {
|
||||||
let name;
|
if (id === this.selectProductOptions[i].productId) {
|
||||||
let parentName;
|
return this.selectProductOptions[i];
|
||||||
for (let i = 0; i < this.productCateOptions.length; i++) {
|
}
|
||||||
if (this.productCateOptions[i].value === ids[0]) {
|
}
|
||||||
parentName = this.productCateOptions[i].label;
|
return null;
|
||||||
for (let j = 0; j < this.productCateOptions[i].children.length; j++) {
|
},
|
||||||
if (this.productCateOptions[i].children[j].value === ids[1]) {
|
getProductCateList() {
|
||||||
name = this.productCateOptions[i].children[j].label;
|
fetchListWithChildren().then(response => {
|
||||||
}
|
let list = response.data;
|
||||||
}
|
this.productCateOptions = [];
|
||||||
}
|
for (let i = 0; i < list.length; i++) {
|
||||||
}
|
let children = [];
|
||||||
return {productCategoryId: ids[1], productCategoryName: name, parentCategoryName: parentName};
|
if (list[i].children != null && list[i].children.length > 0) {
|
||||||
}
|
for (let j = 0; j < list[i].children.length; j++) {
|
||||||
}
|
children.push({
|
||||||
}
|
label: list[i].children[j].name,
|
||||||
|
value: list[i].children[j].id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.productCateOptions.push({
|
||||||
|
label: list[i].name,
|
||||||
|
value: list[i].id,
|
||||||
|
children: children
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getProductCateByIds(ids) {
|
||||||
|
let name;
|
||||||
|
let parentName;
|
||||||
|
for (let i = 0; i < this.productCateOptions.length; i++) {
|
||||||
|
if (this.productCateOptions[i].value === ids[0]) {
|
||||||
|
parentName = this.productCateOptions[i].label;
|
||||||
|
for (let j = 0; j < this.productCateOptions[i].children.length; j++) {
|
||||||
|
if (this.productCateOptions[i].children[j].value === ids[1]) {
|
||||||
|
name = this.productCateOptions[i].children[j].label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
productCategoryId: ids[1],
|
||||||
|
productCategoryName: name,
|
||||||
|
parentCategoryName: parentName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.input-width {
|
.input-width {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user