Browse Source

2023-3-15

master
guoxing 2 years ago
parent
commit
7cfbdaf947
  1. 8
      mallplusui-web-admin/src/router/index.js
  2. 393
      mallplusui-web-admin/src/views/build/community/components/CommunityDetail.vue
  3. 599
      mallplusui-web-admin/src/views/build/community/index.vue
  4. 8
      mallplusui-web-admin/src/views/build/wuyeCompany/components/WuyeCompanyDetail.vue
  5. 8
      mallplusui-web-admin/src/views/build/wuyeCompany/index.vue
  6. 12
      mallplusui-web-admin/src/views/pms/productCate/components/ProductCateDetail.vue
  7. 444
      mallplusui-web-admin/src/views/pms/productCate/index.vue
  8. 7
      mallplusui-web-admin/src/views/sms/advertise/components/HomeAdvertiseDetail.vue
  9. 18
      mallplusui-web-admin/src/views/sms/advertise/index.vue
  10. 793
      mallplusui-web-admin/src/views/sms/coupon/components/CouponDetail.vue

8
mallplusui-web-admin/src/router/index.js

@ -1269,7 +1269,7 @@ export const constantRouterMap = [{
name: 'addCommunity',
component: () => import('@/views/build/community/add'),
meta: {
title: '添加小区'
title: '添加取货点'
},
hidden: true
},
@ -1278,7 +1278,7 @@ export const constantRouterMap = [{
name: 'updateCommunity',
component: () => import('@/views/build/community/update'),
meta: {
title: '编辑小区'
title: '编辑取货点'
},
hidden: true
},
@ -1560,7 +1560,7 @@ export const constantRouterMap = [{
name: 'addWuyeCompany',
component: () => import('@/views/build/wuyeCompany/add'),
meta: {
title: '添加物业公司'
title: '添加社区'
},
hidden: true
},
@ -1569,7 +1569,7 @@ export const constantRouterMap = [{
name: 'updateWuyeCompany',
component: () => import('@/views/build/wuyeCompany/update'),
meta: {
title: '编辑物业公司'
title: '编辑社区'
},
hidden: true
},

393
mallplusui-web-admin/src/views/build/community/components/CommunityDetail.vue

@ -1,34 +1,38 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="community" :rules="rules" ref="communityFrom" label-width="100px">
<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-card class="form-container" shadow="never">
<el-form :model="community" :rules="rules" ref="communityFrom" label-width="130px">
<el-form-item label="社区名称:" >
<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-input v-model="community.nearbyLandmarks"></el-input>
</el-form-item>
<el-form-item label="电话:" prop="phone">
-->
<!-- <el-form-item label="电话:" prop="phone">
<el-input v-model="community.phone"></el-input>
</el-form-item>
<el-form-item label="照片:" prop="pic">
<single-upload v-model="community.pic"></single-upload>
</el-form-item>
<el-form-item label="地图:" prop="phone">
</el-form-item> -->
<!-- <el-form-item label="地图:" prop="phone">
<input v-model.number="center.lng" />
<input v-model.number="center.lat" />
<!--<label>关键词<input v-model="keyword"></label>
<label>地区<input v-model="location"></label>-->
<!--
<baidu-map ak="15BWmtGEGGkZ8lSPUGah30XZ6IGw57HE"
class="map bm-view"
@ -45,184 +49,203 @@
</bm-copyright>
<bm-city-list anchor="BMAP_ANCHOR_TOP_LEFT" @changeAfter="changeAfters"></bm-city-list>
<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>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit('communityFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('communityFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</el-form-item> -->
<el-form-item>
<el-button type="primary" @click="onSubmit('communityFrom')">提交</el-button>
<el-button v-if="!isEdit" @click="resetForm('communityFrom')">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import BaiduMap from 'vue-baidu-map/components/map/Map.vue'
import BmLocalSearch from 'vue-baidu-map/components/search/LocalSearch';
import BmCityList from 'vue-baidu-map/components/controls/CityList';
import BmCopyright from 'vue-baidu-map/components/controls/Copyright';
import BmView from 'vue-baidu-map/components/map/MapView';
import BaiduMap from 'vue-baidu-map/components/map/Map.vue'
import BmLocalSearch from 'vue-baidu-map/components/search/LocalSearch';
import BmCityList from 'vue-baidu-map/components/controls/CityList';
import BmCopyright from 'vue-baidu-map/components/controls/Copyright';
import BmView from 'vue-baidu-map/components/map/MapView';
import BmMarker from 'vue-baidu-map/components/overlays/Marker'
import {createCommunity, getCommunity, updateCommunity} from '@/api/build/community'
import SingleUpload from '@/components/Upload/singleUpload'
import {formatDate} from '@/utils/date';
const defaultCommunity={
name: ''
};
export default {
name: 'CommunityDetail',
components:{SingleUpload,BaiduMap,BmLocalSearch,BmCityList,BmView,BmCopyright,BmMarker},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
community:Object.assign({}, defaultCommunity),
rules: {
name: [
{required: true, message: '请输入名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [
{required: true, message: '请输入品牌logo', trigger: 'blur'}
],
sort: [
{type: 'number', message: '排序必须为数字'}
],
},
location: '北京',
keyword: '百度',
center: {
lng: 116.404,
lat: 39.915
},
zoom: 15
}
},
mounted (){
// this.handleScroll()
// window.addEventListener('mousewheel',this.handleScroll,false)
},
created() {
if (this.isEdit) {
getCommunity(this.$route.query.id).then(response => {
this.community = response.data;
if(this.community.latitude){
this.center.lat=this.community.latitude;
import {
createCommunity,
getCommunity,
updateCommunity
} from '@/api/build/community'
import SingleUpload from '@/components/Upload/singleUpload'
import {
formatDate
} from '@/utils/date';
const defaultCommunity = {
name: ''
};
export default {
name: 'CommunityDetail',
components: {
SingleUpload,
BaiduMap,
BmLocalSearch,
BmCityList,
BmView,
BmCopyright,
BmMarker
},
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
name: "",
community: Object.assign({}, defaultCommunity),
rules: {
name: [{
required: true,
message: '请输入取货点名称',
trigger: 'blur'
},
{
min: 2,
max: 140,
message: '长度在 2 到 140 个字符',
trigger: 'blur'
}
]
},
location: '北京',
keyword: '百度',
center: {
lng: 116.404,
lat: 39.915
},
zoom: 15
}
},
mounted() {
// this.handleScroll()
// window.addEventListener('mousewheel',this.handleScroll,false)
},
created() {
console.log("query>>>",this.$route.query)
this.name = this.$route.query.cname
if (this.isEdit) {
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){
this.center.lng=this.community.longitude;
if (this.community.longitude) {
this.center.lng = this.community.longitude;
}
if(this.community.city){
this.location=this.community.city;
if (this.community.city) {
this.location = this.community.city;
}
});
}else{
this.community = Object.assign({},defaultCommunity);
}
},
methods: {
changeAfters(e){
console.log('123')
console.log(e)
},
handleScroll (e) {
//body100%hover
document.body.scrollTop=0
document.documentElement.scrollTop =0
},
syncCenterAndZoom (e) {
const {lng, lat} = e.target.getCenter()
this.center.lng = lng
this.center.lat = lat
this.zoom = e.target.getZoom()
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.community.companyId=this.$route.query.cid
this.community.latitude=this.center.lat;
this.community.longitude=this.center.lng;
if (this.isEdit) {
updateCommunity(this.$route.query.id, this.community).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
} else {
createCommunity(this.community).then(response => {
if(response.code==200){
this.$refs[formName].resetFields();
this.community = Object.assign({},defaultCommunity);
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
}else{
this.$message({
message: response.msg,
type: 'error',
duration:1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.community = Object.assign({},defaultCommunity);
},
});
} else {
this.community = Object.assign({}, defaultCommunity);
}
},
methods: {
changeAfters(e) {
console.log('123')
console.log(e)
},
handleScroll(e) {
//body100%hover
document.body.scrollTop = 0
document.documentElement.scrollTop = 0
},
syncCenterAndZoom(e) {
const {
lng,
lat
} = e.target.getCenter()
this.center.lng = lng
this.center.lat = lat
this.zoom = e.target.getZoom()
},
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.community.companyId = this.$route.query.cid
this.community.latitude = this.center.lat;
this.community.longitude = this.center.lng;
if (this.isEdit) {
updateCommunity(this.$route.query.id, this.community).then(response => {
if (response.code == 200) {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
this.$router.back();
} else {
this.$message({
message: response.msg,
type: 'error',
duration: 1000
});
}
});
} else {
createCommunity(this.community).then(response => {
if (response.code == 200) {
this.$refs[formName].resetFields();
this.community = Object.assign({}, defaultCommunity);
this.$message({
message: '提交成功',
type: 'success',
duration: 1000
});
this.$router.back();
} else {
this.$message({
message: response.msg,
type: 'error',
duration: 1000
});
}
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration: 1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.community = Object.assign({}, defaultCommunity);
},
},
},
}
}
</script>
<style>
.bm-view {
width: 100%;
height: 400px;
}
.bm-view {
width: 100%;
height: 400px;
}
</style>

599
mallplusui-web-admin/src/views/build/community/index.vue

@ -1,36 +1,32 @@
<template> 
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button
style="float: right"
@click="searchCommunityList()"
type="primary"
size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="品牌名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<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>
<div class="app-container">
<el-card class="filter-container" shadow="never">
<div>
<i class="el-icon-search"></i>
<span>筛选搜索</span>
<el-button style="float: right" @click="searchCommunityList()" type="primary" size="small">
查询结果
</el-button>
</div>
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<el-form-item label="输入搜索:">
<el-input style="width: 203px" v-model="listQuery.keyword" placeholder="取货点名称/关键字"></el-input>
</el-form-item>
</el-form>
</div>
</el-card>
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<span v-show="name"> - {{name}}</span>
<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
style="display: inline"
@ -40,65 +36,52 @@
:before-upload="beforeUpload"
:action="importExcel">
<el-button size="mini" type="success" :disabled="!enabledUploadBtn" :icon="uploadBtnIcon">导入</el-button>
</el-upload>
</el-upload> -->
</el-card>
<div class="table-container">
<el-table ref="communityTable"
:data="list"
style="width: 100%"
@selection-change="handleSelectionChange"
v-loading="listLoading"
border>
<el-table-column type="selection" width="60" align="center"></el-table-column>
</el-card>
<div class="table-container">
<el-table ref="communityTable" :data="list" style="width: 100%" @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">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="取货点ID" align="center" width="100">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="小区名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="电话" align="center">
<template slot-scope="scope">{{scope.row.phone}}</template>
</el-table-column>
<el-table-column label="小区栋数" align="center">
<template slot-scope="scope">{{scope.row.counts}}</template>
</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="取货点名称" width="200" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="取货点电话" width="160" align="center">
<template slot-scope="scope">{{scope.row.phone}}</template>
</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.createTime|formatCreateTime}}</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>
</el-table-column>
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
</el-table-column>-->
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<!-- <el-button
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<!-- <el-button
size="mini"
@click="getAttrList(scope.$index, scope.row)">添加楼
</el-button> -->
<!-- <el-button
<!-- <el-button
size="mini"
@click="getAttrList1(scope.$index, scope.row)">添加缴费规则
</el-button> -->
<!-- <el-button
<!-- <el-button
size="mini"
@click="getAttrList2(scope.$index, scope.row)">添加缴费记录
</el-button> -->
<!-- <el-button
<!-- <el-button
size="mini"
@click="getAttrList3(scope.$index, scope.row)">添加通知
</el-button>
@ -106,241 +89,279 @@
size="mini"
@click="getAttrList4(scope.$index, scope.row)">添加轮播图
</el-button> -->
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
<el-button size="mini" @click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="batch-operate-container">
</div>
<div class="pagination-container">
<el-pagination
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>
</div>
<div class="pagination-container">
<el-pagination 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>
<script>
import {fetchList, deleteCommunity,exportExcel} from '@/api/build/community'
import {formatDate} from '@/utils/date';
export default {
name: 'communityList',
data() {
import {
fetchList,
deleteCommunity,
exportExcel
} from '@/api/build/community'
import {
formatDate
} from '@/utils/date';
export default {
name: 'communityList',
data() {
return {
importExcel: process.env.BASE_API+'/building/community/importExcel',
uploadBtnIcon:'el-icon-upload2',
enabledUploadBtn:true,
dialogVisible:false,
btnText:'数据导入',
return {
name: "",
importExcel: process.env.BASE_API + '/building/community/importExcel',
uploadBtnIcon: 'el-icon-upload2',
enabledUploadBtn: true,
dialogVisible: false,
btnText: '数据导入',
cid:0,
operates: [
{
label: "显示品牌",
value: "showCommunity"
},
{
label: "隐藏品牌",
value: "hideCommunity"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
cid: 0,
operates: [{
label: "显示品牌",
value: "showCommunity"
},
{
label: "隐藏品牌",
value: "hideCommunity"
}
],
operateType: null,
listQuery: {
keyword: null,
pageNum: 1,
pageSize: 10
},
list: null,
total: null,
listLoading: true,
multipleSelection: []
}
},
created() {
this.getList();
},
filters: {
formatCreateTime(time) {
let date = new Date(time);
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
},
formatStatus(value) {
if (value === 1) {
return '申请';
} else if (value === 2) {
return '审核失败';
} else if (value === 3) {
return '审核成功';
}
},
},
methods: {
onSuccess(response,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入成功!");
formatStatus(value) {
if (value === 1) {
return '申请';
} else if (value === 2) {
return '审核失败';
} else if (value === 3) {
return '审核成功';
}
},
},
methods: {
onSuccess(response, file, fileList) {
this.enabledUploadBtn = true;
this.uploadBtnIcon = "el-icon-upload2";
this.btnText = '数据导入';
alert("数据导入成功!");
},
},
onError(err,file,fileList){
this.enabledUploadBtn=true;
this.uploadBtnIcon="el-icon-upload2";
this.btnText='数据导入';
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
},
beforeUpload(file){
this.enabledUploadBtn=false;
this.uploadBtnIcon="el-icon-loading";
this.btnText='正在导入';
},
exportExcel(){
window.open(process.env.BASE_API+'/building/community/exportExcel')
},
onError(err, file, fileList) {
this.enabledUploadBtn = true;
this.uploadBtnIcon = "el-icon-upload2";
this.btnText = '数据导入';
alert("数据导入失败!请检查是否有重复数据,和网络连接状况!");
},
beforeUpload(file) {
this.enabledUploadBtn = false;
this.uploadBtnIcon = "el-icon-loading";
this.btnText = '正在导入';
},
exportExcel() {
window.open(process.env.BASE_API + '/building/community/exportExcel')
},
getAttrList(index, row) {
this.$router.push({path: '/build/floor',query:{cid:row.id,cname:row.name}})
},
getAttrList1(index, row) {
this.$router.push({path: '/build/typePrice',query:{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) {
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;
this.cid=this.$route.query.cid;
getAttrList(index, row) {
this.$router.push({
path: '/build/floor',
query: {
cid: row.id,
cname: row.name
}
})
},
getAttrList1(index, row) {
this.$router.push({
path: '/build/typePrice',
query: {
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) {
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) {
this.listQuery.companyId=this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({path: '/build/updateCommunity', query: {id: row.id}})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCommunity(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
if (this.cid) {
this.listQuery.companyId = this.cid;
}
fetchList(this.listQuery).then(response => {
this.listLoading = false;
console.log("list》》》》", response.data.records);
this.list = response.data.records;
this.total = response.data.total;
this.totalPage = response.data.pages;
this.pageSize = response.data.size;
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleUpdate(index, row) {
this.$router.push({
path: '/build/updateCommunity',
query: {
id: row.id,
cname:row.companyName
}
})
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCommunity(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
},
getProductList(index, row) {
console.log(index, row);
},
getProductCommentList(index, row) {
console.log(index, row);
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchCommunityList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
searchCommunityList() {
this.listQuery.pageNum = 1;
this.getList();
},
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showCommunity') {
showStatus = 1;
} else if (this.operateType === 'hideCommunity') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addCommunity() {
this.$router.push({path: '/build/addCommunity',query:{cid:this.$route.query.cid,cname:this.$route.query.cname}});
}
}
}
handleBatchOperate() {
console.log(this.multipleSelection);
if (this.multipleSelection < 1) {
this.$message({
message: '请选择一条记录',
type: 'warning',
duration: 1000
});
return;
}
let showStatus = 0;
if (this.operateType === 'showCommunity') {
showStatus = 1;
} else if (this.operateType === 'hideCommunity') {
showStatus = 0;
} else {
this.$message({
message: '请选择批量操作类型',
type: 'warning',
duration: 1000
});
return;
}
let ids = [];
for (let i = 0; i < this.multipleSelection.length; i++) {
ids.push(this.multipleSelection[i].id);
}
let data = new URLSearchParams();
data.append("ids", ids);
data.append("showStatus", showStatus);
updateShowStatus(data).then(response => {
this.getList();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
addCommunity() {
this.$router.push({
path: '/build/addCommunity',
query: {
cid: this.$route.query.cid,
cname: this.$route.query.cname
}
});
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>

8
mallplusui-web-admin/src/views/build/wuyeCompany/components/WuyeCompanyDetail.vue

@ -2,7 +2,7 @@
<el-card class="form-container" shadow="never">
<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-form-item>
<el-form-item label="联系方式:" prop="phone">
@ -15,10 +15,10 @@
<el-radio :label="3">审核成功</el-radio>
</el-radio-group>
</el-form-item>-->
<el-form-item label="照片:" prop="pic">
<el-form-item label="社区照片:" prop="pic">
<single-upload v-model="wuyeCompany.pic"></single-upload>
</el-form-item>
<el-form-item label="位置:" prop="address">
<el-form-item label="社区位置:" prop="address">
<el-input v-model="wuyeCompany.address"></el-input>
</el-form-item>
@ -54,7 +54,7 @@
wuyeCompany:Object.assign({}, defaultWuyeCompany),
rules: {
name: [
{required: true, message: '请输入品牌名称', trigger: 'blur'},
{required: true, message: '请输入社区名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
logo: [

8
mallplusui-web-admin/src/views/build/wuyeCompany/index.vue

@ -15,7 +15,7 @@
<div style="margin-top: 15px">
<el-form :inline="true" :model="listQuery" size="small" label-width="140px">
<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>
</div>
@ -42,7 +42,7 @@
<el-table-column label="编号" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="名称" align="center">
<el-table-column label="社区名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="联系方式" align="center">
@ -51,10 +51,10 @@
<!-- <el-table-column label="状态" align="center">
<template slot-scope="scope">{{scope.row.status|formatStatus}}</template>
</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>
</el-table-column>
<el-table-column label="位置" align="center">
<el-table-column label="社区位置" align="center">
<template slot-scope="scope">{{scope.row.address}}</template>
</el-table-column>
<el-table-column label="创建时间" align="center">

12
mallplusui-web-admin/src/views/pms/productCate/components/ProductCateDetail.vue

@ -24,24 +24,24 @@
<el-form-item label="排序:">
<el-input v-model="productCate.sort"></el-input>
</el-form-item>
<el-form-item label="是否显示:">
<!-- <el-form-item label="是否显示:">
<el-radio-group v-model="productCate.showStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form-item> -->
<el-form-item label="是否显示在导航栏:">
<el-radio-group v-model="productCate.navStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否显示在首页:">
<!-- <el-form-item label="是否显示在首页:">
<el-radio-group v-model="productCate.indexStatus">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form-item> -->
<el-form-item label="分类图标:">
<single-upload v-model="productCate.icon"></single-upload>
</el-form-item>
@ -87,8 +87,8 @@
navStatus: 0,
parentId: 0,
productUnit: '',
showStatus: 0,
indexStatus:0,
showStatus: 1,
indexStatus:1,
sort: 0,
productAttributeIdList: []
};

444
mallplusui-web-admin/src/views/pms/productCate/index.vue

@ -1,36 +1,30 @@
<template>
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets" style="margin-top: 5px"></i>
<span style="margin-top: 5px">数据列表</span>
<el-button
class="btn-add"
@click="handleAddProductCate()"
size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="productCateTable"
style="width: 100%"
:data="list"
v-loading="listLoading" border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="分类名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="级别" width="100" align="center">
<template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
</el-table-column>
<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">
<div class="app-container">
<el-card class="operate-container" shadow="never">
<i class="el-icon-tickets" style="margin-top: 5px"></i>
<span style="margin-top: 5px">数据列表</span>
<el-button class="btn-add" @click="handleAddProductCate()" size="mini">
添加
</el-button>
</el-card>
<div class="table-container">
<el-table ref="productCateTable" style="width: 100%" :data="list" v-loading="listLoading" border>
<el-table-column label="编号" width="100" align="center">
<template slot-scope="scope">{{scope.row.id}}</template>
</el-table-column>
<el-table-column label="分类名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="级别" width="100" align="center">
<template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
</el-table-column>
<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">
<el-switch
@change="handleNavStatusChange(scope.$index, scope.row)"
@ -39,18 +33,15 @@
v-model="scope.row.navStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="是否显示" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleShowStatusChange(scope.$index, scope.row)"
:active-value="1"
:inactive-value="0"
v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="是否首页显示" width="100" align="center">
</el-table-column> -->
<el-table-column label="是否显示" width="100" align="center">
<template slot-scope="scope">
<el-switch @change="handleShowStatusChange(scope.$index, scope.row)" :active-value="1"
:inactive-value="0" v-model="scope.row.showStatus">
</el-switch>
</template>
</el-table-column>
<!-- <el-table-column label="是否首页显示" width="100" align="center">
<template slot-scope="scope">
<el-switch
@change="handleIndexStatusChange(scope.$index, scope.row)"
@ -59,193 +50,196 @@
v-model="scope.row.indexStatus">
</el-switch>
</template>
</el-table-column>
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort }}</template>
</el-table-column>
<el-table-column label="设置" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
:disabled="scope.row.level | disableNextLevel"
@click="handleShowNextLevel(scope.$index, scope.row)">查看下级
</el-button>
<el-button
</el-table-column> -->
<el-table-column label="排序" width="100" align="center">
<template slot-scope="scope">{{scope.row.sort }}</template>
</el-table-column>
<el-table-column label="设置" width="200" align="center">
<template slot-scope="scope">
<el-button size="mini" :disabled="scope.row.level | disableNextLevel"
@click="handleShowNextLevel(scope.$index, scope.row)">查看下级
</el-button>
<!-- <el-button
size="mini"
@click="handleTransferProduct(scope.$index, scope.row)">转移商品
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination
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>
</el-button> -->
</template>
</el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button size="mini" @click="handleUpdate(scope.$index, scope.row)">编辑
</el-button>
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container">
<el-pagination 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>
<script>
import {fetchList,deleteProductCate,updateShowStatus,updateNavStatus,updateIndexStatus} from '@/api/productCate'
import {
fetchList,
deleteProductCate,
updateShowStatus,
updateNavStatus,
updateIndexStatus
} from '@/api/productCate'
export default {
name: "productCateList",
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
pageNum: 1,
pageSize: 5
},
parentId: 0
}
},
created() {
this.resetParentId();
this.getList();
},
watch: {
$route(route) {
this.resetParentId();
this.getList();
}
},
methods: {
resetParentId(){
if (this.$route.query.parentId != null) {
this.parentId = this.$route.query.parentId;
} else {
this.parentId = 0;
}
},
handleAddProductCate() {
this.$router.push('/pms/addProductCate');
},
getList() {
this.listLoading = true;
fetchList(this.parentId, this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
});
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleNavStatusChange(index, row) {
let data = new URLSearchParams();
let ids=[];
ids.push(row.id)
data.append('ids',ids);
data.append('navStatus',row.navStatus);
updateNavStatus(data).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleShowStatusChange(index, row) {
let data = new URLSearchParams();
let ids=[];
ids.push(row.id)
data.append('ids',ids);
data.append('showStatus',row.showStatus);
updateShowStatus(data).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleIndexStatusChange(index, row) {
let data = new URLSearchParams();
let ids=[];
ids.push(row.id)
data.append('ids',ids);
data.append('indexStatus',row.indexStatus);
updateIndexStatus(data).then(response=>{
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleShowNextLevel(index, row) {
this.$router.push({path: '/pms/productCate', query: {parentId: row.id}})
},
handleTransferProduct(index, row) {
console.log('handleAddProductCate');
},
handleUpdate(index, row) {
this.$router.push({path:'/pms/updateProductCate',query:{id:row.id}});
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteProductCate(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
}
},
filters: {
levelFilter(value) {
if (value === 0) {
return '一级';
} else if (value === 1) {
return '二级';
}
},
disableNextLevel(value) {
if (value === 0) {
return false;
} else {
return true;
}
}
}
}
export default {
name: "productCateList",
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
pageNum: 1,
pageSize: 5
},
parentId: 0
}
},
created() {
this.resetParentId();
this.getList();
},
watch: {
$route(route) {
this.resetParentId();
this.getList();
}
},
methods: {
resetParentId() {
if (this.$route.query.parentId != null) {
this.parentId = this.$route.query.parentId;
} else {
this.parentId = 0;
}
},
handleAddProductCate() {
this.$router.push('/pms/addProductCate');
},
getList() {
this.listLoading = true;
fetchList(this.parentId, this.listQuery).then(response => {
this.listLoading = false;
this.list = response.data.records;
this.total = response.data.total;
});
},
handleSizeChange(val) {
this.listQuery.pageNum = 1;
this.listQuery.pageSize = val;
this.getList();
},
handleCurrentChange(val) {
this.listQuery.pageNum = val;
this.getList();
},
handleNavStatusChange(index, row) {
let data = new URLSearchParams();
let ids = [];
ids.push(row.id)
data.append('ids', ids);
data.append('navStatus', row.navStatus);
updateNavStatus(data).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleShowStatusChange(index, row) {
let data = new URLSearchParams();
let ids = [];
ids.push(row.id)
data.append('ids', ids);
data.append('showStatus', row.showStatus);
updateShowStatus(data).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleIndexStatusChange(index, row) {
let data = new URLSearchParams();
let ids = [];
ids.push(row.id)
data.append('ids', ids);
data.append('indexStatus', row.indexStatus);
updateIndexStatus(data).then(response => {
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
});
},
handleShowNextLevel(index, row) {
this.$router.push({
path: '/pms/productCate',
query: {
parentId: row.id
}
})
},
handleTransferProduct(index, row) {
console.log('handleAddProductCate');
},
handleUpdate(index, row) {
this.$router.push({
path: '/pms/updateProductCate',
query: {
id: row.id
}
});
},
handleDelete(index, row) {
this.$confirm('是否要删除该品牌', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteProductCate(row.id).then(response => {
this.$message({
message: '删除成功',
type: 'success',
duration: 1000
});
this.getList();
});
});
}
},
filters: {
levelFilter(value) {
if (value === 0) {
return '一级';
} else if (value === 1) {
return '二级';
}
},
disableNextLevel(value) {
if (value === 0) {
return false;
} else {
return true;
}
}
}
}
</script>
<style scoped>

7
mallplusui-web-admin/src/views/sms/advertise/components/HomeAdvertiseDetail.vue

@ -9,14 +9,15 @@
<el-input v-model="homeAdvertise.name" class="input-width"></el-input>
</el-form-item>
<el-form-item label="广告位置:">
<el-select v-model="homeAdvertise.type">
<!-- <el-select v-model="homeAdvertise.type">
<el-option
v-for="type in typeOptions"
:key="type.value"
:label="type.label"
:value="type.value">
</el-option>
</el-select>
</el-select> -->
<span>Android首页轮播</span>
</el-form-item>
<el-form-item label="开始时间:" prop="startTime">
<el-date-picker
@ -84,7 +85,7 @@
];
const defaultHomeAdvertise = {
name: null,
type: 1,
type: 2,
pic: null,
startTime: null,
endTime: null,

18
mallplusui-web-admin/src/views/sms/advertise/index.vue

@ -23,7 +23,7 @@
<el-form-item label="广告名称:">
<el-input v-model="listQuery.name" class="input-width" placeholder="广告名称"></el-input>
</el-form-item>
<el-form-item label="广告位置:">
<!-- <el-form-item label="广告位置:">
<el-select v-model="listQuery.type" placeholder="全部" clearable class="input-width">
<el-option v-for="item in typeOptions"
:key="item.value"
@ -31,7 +31,7 @@
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="到期时间:">
<el-date-picker
class="input-width"
@ -62,13 +62,13 @@
<el-table-column label="广告名称" align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</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>
</el-table-column>
<el-table-column label="广告图片" width="120" align="center">
</el-table-column> -->
<el-table-column label="广告图片" width="250" align="center">
<template slot-scope="scope"><img style="height: 80px" :src="scope.row.pic"></template>
</el-table-column>
<el-table-column label="时间" width="220" align="center">
<el-table-column label="时间" width="320" align="center">
<template slot-scope="scope">
<p>开始时间{{scope.row.startTime | formatTime}}</p>
<p>到期时间{{scope.row.endTime | formatTime}}</p>
@ -84,13 +84,13 @@
</el-switch>
</template>
</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>
</el-table-column>
<el-table-column label="生成订单" width="120" align="center">
<template slot-scope="scope">{{scope.row.orderCount}}</template>
</el-table-column>
<el-table-column label="操作" width="120" align="center">
</el-table-column> -->
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<el-button size="mini"
type="text"

793
mallplusui-web-admin/src/views/sms/coupon/components/CouponDetail.vue

@ -1,403 +1,408 @@
<template> 
<el-card class="form-container" shadow="never">
<el-form :model="coupon"
:rules="rules"
ref="couponFrom"
label-width="150px"
size="small">
<el-form-item label="优惠券类型:">
<el-select v-model="coupon.type">
<el-option v-for='type in typeOptions' :key='type.value' :label='type.label' :value='type.value'></el-option>
</el-select>
</el-form-item>
<el-form-item label="优惠券名称:" prop="name">
<el-input v-model="coupon.name" class="input-width"></el-input>
</el-form-item>
<el-form-item label="适用平台:">
<el-select v-model="coupon.platform">
<el-option
v-for="item in platformOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="总发行量:" prop="publishCount">
<el-input v-model.number="coupon.publishCount" placeholder="只能输入正整数" class="input-width"></el-input>
</el-form-item>
<el-form-item label="面额:" prop="amount">
<el-input v-model="coupon.amount" @keyup.native="coupon.amount = UpNumber(coupon.amount,2)" placeholder="面值只能是数值,限2位小数" class="input-width">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="每人限领:">
<el-input v-model="coupon.perLimit" placeholder="只能输入正整数" class="input-width">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="使用门槛:" prop="minPoint">
<el-input v-model.number="coupon.minPoint" placeholder="只能输入正整数" class="input-width">
<template slot="prepend"></template>
<template slot="append">元可用</template>
</el-input>
</el-form-item>
<el-form-item label="有效期:">
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.startTime" style="width: 150px"></el-date-picker>
<span style="margin-left: 20px;margin-right: 20px"></span>
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.endTime" style="width: 150px"></el-date-picker>
</el-form-item>
<el-form-item label="可使用商品:">
<el-radio-group v-model="coupon.useType">
<el-radio-button :label="0">全场通用</el-radio-button>
<el-radio-button :label="1">指定分类</el-radio-button>
<el-radio-button :label="2">指定商品</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="coupon.useType===1">
<el-cascader
clearable
placeholder="请选择分类名称"
v-model="selectProductCate"
:options="productCateOptions">
</el-cascader>
<el-button @click="handleAddProductCategoryRelation()">添加</el-button>
<el-table ref="productCateRelationTable"
:data="coupon.productCategoryRelationList"
style="width: 100%;margin-top: 20px"
border>
<el-table-column label="分类名称" align="center">
<template slot-scope="scope">{{scope.row.parentCategoryName}}>{{scope.row.productCategoryName}}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini"
type="text"
@click="handleDeleteProductCateRelation(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item v-show="coupon.useType===2">
<el-select
v-model="selectProduct"
filterable
remote
reserve-keyword
placeholder="商品名称/商品货号"
:remote-method="searchProductMethod"
:loading="selectProductLoading">
<el-option
v-for="item in selectProductOptions"
:key="item.productId"
:label="item.productName"
:value="item.productId">
<span style="float: left">{{ item.productName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">NO.{{ item.productSn }}</span>
</el-option>
</el-select>
<el-button @click="handleAddProductRelation()">添加</el-button>
<el-table ref="productRelationTable"
:data="coupon.productRelationList"
style="width: 100%;margin-top: 20px"
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>
<el-card class="form-container" shadow="never">
<el-form :model="coupon" :rules="rules" ref="couponFrom" label-width="150px" size="small">
<el-form-item label="优惠券类型:">
<span>全场赠券</span>
</el-form-item>
<el-form-item label="优惠券名称:" prop="name">
<el-input v-model="coupon.name" class="input-width"></el-input>
</el-form-item>
<el-form-item label="适用平台:">
<span>全平台</span>
</el-form-item>
<el-form-item label="总发行量:" prop="publishCount">
<el-input v-model.number="coupon.publishCount" placeholder="只能输入正整数" class="input-width"></el-input>
</el-form-item>
<el-form-item label="面额:" prop="amount">
<el-input v-model="coupon.amount" @keyup.native="coupon.amount = UpNumber(coupon.amount,2)"
placeholder="面值只能是数值,限2位小数" class="input-width">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="每人限领:">
<el-input v-model="coupon.perLimit" placeholder="只能输入正整数" class="input-width">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="使用门槛:" prop="minPoint">
<el-input v-model.number="coupon.minPoint" placeholder="只能输入正整数" class="input-width">
<template slot="prepend"></template>
<template slot="append">元可用</template>
</el-input>
</el-form-item>
<el-form-item label="有效期:" >
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.startTime" style="width: 150px">
</el-date-picker>
<span style="margin-left: 20px;margin-right: 20px"></span>
<el-date-picker type="date" placeholder="选择日期" v-model="coupon.endTime" style="width: 150px">
</el-date-picker>
</el-form-item>
<el-form-item label="可使用商品:">
<el-radio-group v-model="coupon.useType">
<el-radio-button :label="0">全场通用</el-radio-button>
<el-radio-button :label="1">指定分类</el-radio-button>
<el-radio-button :label="2">指定商品</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-show="coupon.useType===1">
<el-cascader clearable placeholder="请选择分类名称" v-model="selectProductCate" :options="productCateOptions">
</el-cascader>
<el-button @click="handleAddProductCategoryRelation()">添加</el-button>
<el-table ref="productCateRelationTable" :data="coupon.productCategoryRelationList"
style="width: 100%;margin-top: 20px" border>
<el-table-column label="分类名称" align="center">
<template
slot-scope="scope">{{scope.row.parentCategoryName}}>{{scope.row.productCategoryName}}</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini" type="text"
@click="handleDeleteProductCateRelation(scope.$index, scope.row)">删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item v-show="coupon.useType===2">
<el-select v-model="selectProduct" filterable remote reserve-keyword placeholder="商品名称/商品货号"
:remote-method="searchProductMethod" :loading="selectProductLoading">
<el-option v-for="item in selectProductOptions" :key="item.productId" :label="item.productName"
:value="item.productId">
<span style="float: left">{{ item.productName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">NO.{{ item.productSn }}</span>
</el-option>
</el-select>
<el-button @click="handleAddProductRelation()">添加</el-button>
<el-table ref="productRelationTable" :data="coupon.productRelationList"
style="width: 100%;margin-top: 20px" 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>
<script>
import {createCoupon,getCoupon,updateCoupon} from '@/api/coupon';
import {fetchSimpleList as fetchProductList} from '@/api/product';
import {fetchListWithChildren} from '@/api/productCate'
const defaultCoupon = {
type: 0,
name: null,
platform: 0,
amount: null,
perLimit: 1,
minPoint: null,
startTime: null,
endTime: null,
useType: 0,
note: null,
publishCount: null,
productRelationList: [],
productCategoryRelationList: []
};
const defaultTypeOptions = [
{
label: '全场赠券',
value: 0
},
{
label: '会员赠券',
value: 1
},
{
label: '购物赠券',
value: 2
},
{
label: '注册赠券',
value: 3
}
];
const defaultPlatformOptions = [
{
label: '全平台',
value: 0
},
{
label: '移动平台',
value: 1
},
{
label: 'PC平台',
value: 2
}
];
import {
createCoupon,
getCoupon,
updateCoupon
} from '@/api/coupon';
import {
fetchSimpleList as fetchProductList
} from '@/api/product';
import {
fetchListWithChildren
} from '@/api/productCate'
const defaultCoupon = {
type: 0,
name: null,
platform: 0,
amount: null,
perLimit: 1,
minPoint: null,
startTime: null,
endTime: null,
useType: 0,
note: null,
publishCount: null,
productRelationList: [],
productCategoryRelationList: []
};
const defaultTypeOptions = [{
label: '全场赠券',
value: 0
},
{
label: '会员赠券',
value: 1
},
{
label: '购物赠券',
value: 2
},
{
label: '注册赠券',
value: 3
}
];
const defaultPlatformOptions = [{
label: '全平台',
value: 0
},
{
label: '移动平台',
value: 1
},
{
label: 'PC平台',
value: 2
}
];
var validatePrice = (rule, value, callback) => {
if (!value) {
callback(new Error("面额不能为空"));
} else if (value.split(".").length > 2) {
callback(new Error("请输入正确格式的金额")); //
if (!value) {
callback(new Error("面额不能为空"));
} else if (value.split(".").length > 2) {
callback(new Error("请输入正确格式的金额")); //
}
// else if (value > add_Com.Retail_Price) {
// callback(new Error(""));
// }
else {
value = Math.round(value * Math.pow(10, 2)) / Math.pow(10, 2); //
value = Number(value).toFixed(2); //
this.add_Com.Cost_Price = value;
callback();
}
};
export default {
name: 'CouponDetail',
props: {
isEdit: {
type: Boolean,
default: false
}
// else if (value > add_Com.Retail_Price) {
// callback(new Error(""));
// }
else {
value = Math.round(value * Math.pow(10, 2)) / Math.pow(10, 2); //
value = Number(value).toFixed(2); //
this.add_Com.Cost_Price = value;
callback();
},
data() {
return {
coupon: Object.assign({}, defaultCoupon),
typeOptions: Object.assign({}, defaultTypeOptions),
platformOptions: Object.assign({}, defaultPlatformOptions),
rules: {
name: [{
required: true,
message: '请输入优惠券名称',
trigger: 'blur'
},
{
min: 2,
max: 140,
message: '长度在 2 到 140 个字符',
trigger: 'blur'
}
],
publishCount: [{
type: 'number',
required: true,
message: '只能输入正整数',
trigger: 'blur'
}],
amount: [{
required: true,
message: '面值只能是数值,0.01-10000,限2位小数',
trigger: 'blur'
}],
minPoint: [{
type: 'number',
required: true,
message: '只能输入正整数',
trigger: 'blur'
}]
},
selectProduct: null,
selectProductLoading: false,
selectProductOptions: [],
selectProductCate: null,
productCateOptions: []
}
};
export default {
name: 'CouponDetail',
props: {
isEdit: {
type: Boolean,
default: false
}
},
data() {
return {
coupon: Object.assign({}, defaultCoupon),
typeOptions: Object.assign({}, defaultTypeOptions),
platformOptions: Object.assign({}, defaultPlatformOptions),
rules: {
name: [
{required: true, message: '请输入优惠券名称', trigger: 'blur'},
{min: 2, max: 140, message: '长度在 2 到 140 个字符', trigger: 'blur'}
],
publishCount: [
{type: 'number',required: true, message: '只能输入正整数', trigger: 'blur'}
],
// amount: [
// // {type: 'number',required: true,message: '0.01-100002',trigger: 'blur'}
// // { required: true, validator: validatePrice, trigger: "blur" },
// ],
minPoint: [
{type: 'number',required: true,message: '只能输入正整数',trigger: 'blur'}
]
},
selectProduct:null,
selectProductLoading: false,
selectProductOptions:[],
selectProductCate: null,
productCateOptions: []
}
},
created(){
if(this.isEdit){
getCoupon(this.$route.query.id).then(response=>{
this.coupon=response.data;
});
}
this.getProductCateList();
},
methods:{
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) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(this.isEdit){
updateCoupon(this.$route.query.id,this.coupon).then(response=>{
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}else{
createCoupon(this.coupon).then(response=>{
this.$refs[formName].resetFields();
this.$message({
message: '提交成功',
type: 'success',
duration:1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration:1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.coupon = Object.assign({},defaultCoupon);
},
searchProductMethod(query){
if (query !== '') {
this.loading = true;
fetchProductList({keyword:query}).then(response=>{
this.loading=false;
let productList = response.data;
this.selectProductOptions = [];
for(let i=0;i<productList.length;i++){
let item = productList[i];
this.selectProductOptions.push({productId:item.id,productName:item.name,productSn:item.productSn});
}
});
} else {
this.selectProductOptions = [];
}
},
handleAddProductRelation(){
if(this.selectProduct===null){
this.$message({
message: '请先选择商品',
type: 'warning'
});
return
}
this.coupon.productRelationList.push(this.getProductById(this.selectProduct));
this.selectProduct=null;
},
handleDeleteProductRelation(index,row){
this.coupon.productRelationList.splice(index,1);
},
handleAddProductCategoryRelation(){
if(this.selectProductCate===null||this.selectProductCate.length===0){
this.$message({
message: '请先选择商品分类',
type: 'warning'
});
return
}
this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate));
this.selectProductCate=[];
},
handleDeleteProductCateRelation(index,row){
this.coupon.productCategoryRelationList.splice(index,1);
},
getProductById(id){
for(let i=0;i<this.selectProductOptions.length;i++){
if(id===this.selectProductOptions[i].productId){
return this.selectProductOptions[i];
}
}
return null;
},
getProductCateList() {
fetchListWithChildren().then(response => {
let list = response.data;
this.productCateOptions = [];
for (let i = 0; i < list.length; i++) {
let children = [];
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};
}
}
}
},
created() {
if (this.isEdit) {
getCoupon(this.$route.query.id).then(response => {
this.coupon = response.data;
});
}
this.getProductCateList();
},
methods: {
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) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$confirm('是否提交数据', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.isEdit) {
updateCoupon(this.$route.query.id, this.coupon).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '修改成功',
type: 'success',
duration: 1000
});
this.$router.back();
});
} else {
createCoupon(this.coupon).then(response => {
this.$refs[formName].resetFields();
this.$message({
message: '提交成功',
type: 'success',
duration: 1000
});
this.$router.back();
});
}
});
} else {
this.$message({
message: '验证失败',
type: 'error',
duration: 1000
});
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.coupon = Object.assign({}, defaultCoupon);
},
searchProductMethod(query) {
if (query !== '') {
this.loading = true;
fetchProductList({
keyword: query
}).then(response => {
this.loading = false;
let productList = response.data;
this.selectProductOptions = [];
for (let i = 0; i < productList.length; i++) {
let item = productList[i];
this.selectProductOptions.push({
productId: item.id,
productName: item.name,
productSn: item.productSn
});
}
});
} else {
this.selectProductOptions = [];
}
},
handleAddProductRelation() {
if (this.selectProduct === null) {
this.$message({
message: '请先选择商品',
type: 'warning'
});
return
}
this.coupon.productRelationList.push(this.getProductById(this.selectProduct));
this.selectProduct = null;
},
handleDeleteProductRelation(index, row) {
this.coupon.productRelationList.splice(index, 1);
},
handleAddProductCategoryRelation() {
if (this.selectProductCate === null || this.selectProductCate.length === 0) {
this.$message({
message: '请先选择商品分类',
type: 'warning'
});
return
}
this.coupon.productCategoryRelationList.push(this.getProductCateByIds(this.selectProductCate));
this.selectProductCate = [];
},
handleDeleteProductCateRelation(index, row) {
this.coupon.productCategoryRelationList.splice(index, 1);
},
getProductById(id) {
for (let i = 0; i < this.selectProductOptions.length; i++) {
if (id === this.selectProductOptions[i].productId) {
return this.selectProductOptions[i];
}
}
return null;
},
getProductCateList() {
fetchListWithChildren().then(response => {
let list = response.data;
this.productCateOptions = [];
for (let i = 0; i < list.length; i++) {
let children = [];
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>
<style scoped>
.input-width {
width: 60%;
}
.input-width {
width: 60%;
}
</style>

Loading…
Cancel
Save