2023-3-15
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
<el-form-item label="取货点名称:" prop="name">
|
<el-form-item label="取货点名称:" prop="name">
|
||||||
<el-input v-model="community.name"></el-input>
|
<el-input v-model="community.name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="取货点电话:" prop="counts">
|
<el-form-item label="取货点电话:" prop="phone">
|
||||||
<el-input v-model="community.counts"></el-input>
|
<el-input v-model="community.phone" maxlength="11"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="取货点地址:" prop="details">
|
<el-form-item label="取货点地址:" prop="details">
|
||||||
<el-input v-model="community.details"></el-input>
|
<el-input v-model="community.details"></el-input>
|
||||||
@@ -61,12 +61,12 @@
|
|||||||
</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 {
|
import {
|
||||||
createCommunity,
|
createCommunity,
|
||||||
getCommunity,
|
getCommunity,
|
||||||
@@ -81,15 +81,15 @@
|
|||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
name: 'CommunityDetail',
|
name: 'CommunityDetail',
|
||||||
components: {
|
// components: {
|
||||||
SingleUpload,
|
// SingleUpload,
|
||||||
BaiduMap,
|
// BaiduMap,
|
||||||
BmLocalSearch,
|
// BmLocalSearch,
|
||||||
BmCityList,
|
// BmCityList,
|
||||||
BmView,
|
// BmView,
|
||||||
BmCopyright,
|
// BmCopyright,
|
||||||
BmMarker
|
// BmMarker
|
||||||
},
|
// },
|
||||||
props: {
|
props: {
|
||||||
isEdit: {
|
isEdit: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -97,6 +97,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
var checkSubmit = (rule, value, callback) => {
|
||||||
|
const Submit =
|
||||||
|
/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
|
||||||
|
if (value) {
|
||||||
|
if (!Submit.test(value)) {
|
||||||
|
callback(new Error('手机号格式不正确'))
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
// if (Submit.test(value)) {
|
||||||
|
// return callback()
|
||||||
|
// }
|
||||||
|
// callback(new Error('请输入手机号'))
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
name: "",
|
name: "",
|
||||||
community: Object.assign({}, defaultCommunity),
|
community: Object.assign({}, defaultCommunity),
|
||||||
@@ -112,15 +127,20 @@
|
|||||||
message: '长度在 2 到 140 个字符',
|
message: '长度在 2 到 140 个字符',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
phone: [{
|
||||||
|
required: true,
|
||||||
|
validator: checkSubmit,
|
||||||
|
trigger: 'blur'
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
location: '北京',
|
// location: '北京',
|
||||||
keyword: '百度',
|
// keyword: '百度',
|
||||||
center: {
|
// center: {
|
||||||
lng: 116.404,
|
// lng: 116.404,
|
||||||
lat: 39.915
|
// lat: 39.915
|
||||||
},
|
// },
|
||||||
zoom: 15
|
// zoom: 15
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -135,15 +155,15 @@
|
|||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
getCommunity(this.$route.query.id).then(response => {
|
getCommunity(this.$route.query.id).then(response => {
|
||||||
this.community = response.data;
|
this.community = response.data;
|
||||||
if (this.community.latitude) {
|
// if (this.community.latitude) {
|
||||||
this.center.lat = 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);
|
||||||
@@ -151,24 +171,42 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
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 {
|
// const {
|
||||||
lng,
|
// lng,
|
||||||
lat
|
// lat
|
||||||
} = e.target.getCenter()
|
// } = e.target.getCenter()
|
||||||
this.center.lng = lng
|
// this.center.lng = lng
|
||||||
this.center.lat = lat
|
// this.center.lat = lat
|
||||||
this.zoom = e.target.getZoom()
|
// this.zoom = e.target.getZoom()
|
||||||
|
// },
|
||||||
|
UpNumber(val, limit = 2) {
|
||||||
|
val = val.replace(/[^\d]/g, '') // 保留数字
|
||||||
|
val = val.replace(/^00/, '0.') // 开头不能有两个0
|
||||||
|
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0.
|
||||||
|
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个
|
||||||
|
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点
|
||||||
|
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0
|
||||||
|
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
|
||||||
|
const reg = new RegExp(str)
|
||||||
|
if (limit === 0) {
|
||||||
|
// 不需要小数点
|
||||||
|
val = val.replace(reg, '$1')
|
||||||
|
} else {
|
||||||
|
// 通过正则保留小数点后指定的位数
|
||||||
|
val = val.replace(reg, '$1.$2')
|
||||||
|
}
|
||||||
|
return val
|
||||||
},
|
},
|
||||||
onSubmit(formName) {
|
onSubmit(formName) {
|
||||||
this.$refs[formName].validate((valid) => {
|
this.$refs[formName].validate((valid) => {
|
||||||
@@ -179,8 +217,8 @@
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.community.companyId = this.$route.query.cid
|
this.community.companyId = this.$route.query.cid
|
||||||
this.community.latitude = this.center.lat;
|
// this.community.latitude = this.center.lat;
|
||||||
this.community.longitude = this.center.lng;
|
// this.community.longitude = this.center.lng;
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
updateCommunity(this.$route.query.id, this.community).then(response => {
|
updateCommunity(this.$route.query.id, this.community).then(response => {
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
@@ -190,7 +228,7 @@
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
this.$router.back();
|
this.$router.go(-1);
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: response.msg,
|
message: response.msg,
|
||||||
@@ -210,7 +248,7 @@
|
|||||||
type: 'success',
|
type: 'success',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
this.$router.back();
|
this.$router.go(-1);
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: response.msg,
|
message: response.msg,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
<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.address}}</template>
|
<template slot-scope="scope">{{scope.row.details}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column label="创建时间" width="200" align="center">
|
<el-table-column label="创建时间" width="200" align="center">
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="form-container" shadow="never">
|
<el-card class="form-container" shadow="never">
|
||||||
<el-form :model="productCate"
|
<el-form :model="productCate" :rules="rules" ref="productCateFrom" label-width="150px">
|
||||||
:rules="rules"
|
|
||||||
ref="productCateFrom"
|
|
||||||
label-width="150px">
|
|
||||||
<el-form-item label="分类名称:" prop="name">
|
<el-form-item label="分类名称:" prop="name">
|
||||||
<el-input v-model="productCate.name"></el-input>
|
<el-input v-model="productCate.name"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="上级分类:">
|
<el-form-item label="上级分类:">
|
||||||
<el-select v-model="productCate.parentId"
|
<el-select v-model="productCate.parentId" placeholder="请选择分类">
|
||||||
placeholder="请选择分类">
|
<el-option v-for="item in selectProductCateList" :key="item.id" :label="item.name" :value="item.id">
|
||||||
<el-option
|
|
||||||
v-for="item in selectProductCateList"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.id">
|
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -24,18 +16,18 @@
|
|||||||
<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>
|
||||||
@@ -45,14 +37,9 @@
|
|||||||
<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>
|
||||||
<el-form-item v-for="(filterProductAttr, index) in filterProductAttrList"
|
<el-form-item v-for="(filterProductAttr, index) in filterProductAttrList" :label="index | filterLabelFilter"
|
||||||
:label="index | filterLabelFilter"
|
:key="filterProductAttr.key">
|
||||||
:key="filterProductAttr.key"
|
<el-cascader clearable v-model="filterProductAttr.value" :options="filterAttrs">
|
||||||
>
|
|
||||||
<el-cascader
|
|
||||||
clearable
|
|
||||||
v-model="filterProductAttr.value"
|
|
||||||
:options="filterAttrs">
|
|
||||||
</el-cascader>
|
</el-cascader>
|
||||||
<el-button style="margin-left: 20px" @click.prevent="removeFilterAttr(filterProductAttr)">删除</el-button>
|
<el-button style="margin-left: 20px" @click.prevent="removeFilterAttr(filterProductAttr)">删除</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -74,9 +61,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {fetchList, createProductCate, updateProductCate, getProductCate} from '@/api/productCate';
|
import {
|
||||||
import {fetchListWithAttr} from '@/api/productAttrCate';
|
fetchList,
|
||||||
import {getProductAttrInfo} from '@/api/productAttr';
|
createProductCate,
|
||||||
|
updateProductCate,
|
||||||
|
getProductCate
|
||||||
|
} from '@/api/productCate';
|
||||||
|
import {
|
||||||
|
fetchListWithAttr
|
||||||
|
} from '@/api/productAttrCate';
|
||||||
|
import {
|
||||||
|
getProductAttrInfo
|
||||||
|
} from '@/api/productAttr';
|
||||||
import SingleUpload from '@/components/Upload/singleUpload';
|
import SingleUpload from '@/components/Upload/singleUpload';
|
||||||
|
|
||||||
const defaultProductCate = {
|
const defaultProductCate = {
|
||||||
@@ -84,17 +80,19 @@
|
|||||||
icon: '',
|
icon: '',
|
||||||
keywords: '',
|
keywords: '',
|
||||||
name: '',
|
name: '',
|
||||||
navStatus: 0,
|
navStatus: 1,
|
||||||
parentId: 0,
|
parentId: 0,
|
||||||
productUnit: '',
|
productUnit: '',
|
||||||
showStatus: 1,
|
showStatus: 0,
|
||||||
indexStatus: 1,
|
indexStatus: 1,
|
||||||
sort: 0,
|
sort: 0,
|
||||||
productAttributeIdList: []
|
productAttributeIdList: []
|
||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
name: "ProductCateDetail",
|
name: "ProductCateDetail",
|
||||||
components: {SingleUpload},
|
components: {
|
||||||
|
SingleUpload
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
isEdit: {
|
isEdit: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@@ -106,9 +104,17 @@
|
|||||||
productCate: Object.assign({}, defaultProductCate),
|
productCate: Object.assign({}, defaultProductCate),
|
||||||
selectProductCateList: [],
|
selectProductCateList: [],
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [{
|
||||||
{required: true, message: '请输入品牌名称', trigger: 'blur'},
|
required: true,
|
||||||
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
|
message: '请输入品牌名称',
|
||||||
|
trigger: 'blur'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
min: 2,
|
||||||
|
max: 140,
|
||||||
|
message: '长度在 2 到 140 个字符',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
filterAttrs: [],
|
filterAttrs: [],
|
||||||
@@ -141,9 +147,15 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getSelectProductCateList() {
|
getSelectProductCateList() {
|
||||||
fetchList(0, {pageSize: 100, pageNum: 1}).then(response => {
|
fetchList(0, {
|
||||||
|
pageSize: 100,
|
||||||
|
pageNum: 1
|
||||||
|
}).then(response => {
|
||||||
this.selectProductCateList = response.data.records;
|
this.selectProductCateList = response.data.records;
|
||||||
this.selectProductCateList.unshift({id: 0, name: '无上级分类'});
|
this.selectProductCateList.unshift({
|
||||||
|
id: 0,
|
||||||
|
name: '无上级分类'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getProductAttrCateList() {
|
getProductAttrCateList() {
|
||||||
@@ -152,7 +164,8 @@
|
|||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
let productAttrCate = list[i];
|
let productAttrCate = list[i];
|
||||||
let children = [];
|
let children = [];
|
||||||
if (productAttrCate.productAttributeList != null && productAttrCate.productAttributeList.length > 0) {
|
if (productAttrCate.productAttributeList != null && productAttrCate.productAttributeList
|
||||||
|
.length > 0) {
|
||||||
for (let j = 0; j < productAttrCate.productAttributeList.length; j++) {
|
for (let j = 0; j < productAttrCate.productAttributeList.length; j++) {
|
||||||
children.push({
|
children.push({
|
||||||
label: productAttrCate.productAttributeList[j].name,
|
label: productAttrCate.productAttributeList[j].name,
|
||||||
@@ -160,7 +173,11 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.filterAttrs.push({label: productAttrCate.name, value: productAttrCate.id, children: children});
|
this.filterAttrs.push({
|
||||||
|
label: productAttrCate.name,
|
||||||
|
value: productAttrCate.id,
|
||||||
|
children: children
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -185,7 +202,8 @@
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
this.productCate.productAttributeIdList = this.getProductAttributeIdList();
|
this.productCate.productAttributeIdList = this.getProductAttributeIdList();
|
||||||
updateProductCate(this.$route.query.id, this.productCate).then(response => {
|
updateProductCate(this.$route.query.id, this.productCate).then(
|
||||||
|
response => {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '修改成功',
|
message: '修改成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
|||||||
@@ -119,6 +119,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resetParentId() {
|
resetParentId() {
|
||||||
|
console.log('parentId>>>', this.$route.query.parentId);
|
||||||
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 {
|
||||||
@@ -130,8 +131,11 @@
|
|||||||
},
|
},
|
||||||
getList() {
|
getList() {
|
||||||
this.listLoading = true;
|
this.listLoading = true;
|
||||||
|
console.log('parentId>>>', this.parentId);
|
||||||
|
console.log('listQuery>>>', this.listQuery);
|
||||||
fetchList(this.parentId, this.listQuery).then(response => {
|
fetchList(this.parentId, this.listQuery).then(response => {
|
||||||
this.listLoading = false;
|
this.listLoading = false;
|
||||||
|
console.log('list>>>', response.data.records);
|
||||||
this.list = response.data.records;
|
this.list = response.data.records;
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
});
|
});
|
||||||
@@ -188,6 +192,10 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleShowNextLevel(index, row) {
|
handleShowNextLevel(index, row) {
|
||||||
|
this.listQuery = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 5
|
||||||
|
}
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/pms/productCate',
|
path: '/pms/productCate',
|
||||||
query: {
|
query: {
|
||||||
|
|||||||
Reference in New Issue
Block a user