我们发布啦

This commit is contained in:
张乐
2020-08-13 16:12:57 +08:00
parent ec2ddb4e10
commit acd9b0cb1a
1884 changed files with 344865 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
<template>
<div>砍价</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,15 @@
<template>
<div>
营销
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,15 @@
<template>
<div>
优惠券模板
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,15 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,271 @@
<template>
<div class="divBox">
<el-card class="box-card">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm">
<el-form-item label="优惠劵名称" prop="name">
<el-input v-model="ruleForm.name" style="width: 350px" placeholder="请输入优惠券名称"></el-input>
</el-form-item>
<el-form-item label="优惠劵类型">
<el-radio-group v-model="ruleForm.useType">
<el-radio :label="1">通用卷</el-radio>
<el-radio :label="2">商品券</el-radio>
<el-radio :label="3">品类券</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择品类:" prop="primaryKey" v-if="ruleForm.useType === 3">
<el-cascader v-model="ruleForm.primaryKey" :options="merCateList" :props="props2" clearable class="selWidth" :show-all-levels="false" />
</el-form-item>
<el-form-item label="商品:" v-if="ruleForm.useType === 2">
<div class="acea-row">
<template v-if="checked.length">
<div class="pictrue" v-for="(item, index) in checked" :key="index">
<img :src="item.image">
<i class="el-icon-error btndel" @click="handleRemove(index)" />
</div>
</template>
<div class="upLoadPicBox" @click="changeGood">
<div class="upLoad">
<i class="el-icon-camera cameraIconfont" />
</div>
</div>
</div>
</el-form-item>
<el-form-item label="优惠券面值" prop="money">
<el-input-number v-model="ruleForm.money" :min="1" :max="10" label="描述文字"></el-input-number>
</el-form-item>
<el-form-item label="使用门槛">
<el-radio-group v-model="threshold">
<el-radio :label="false">无门槛</el-radio>
<el-radio :label="true">有门槛</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="优惠券最低消费" prop="minPrice" v-if="threshold">
<el-input-number v-model="ruleForm.minPrice" :min="1" label="描述文字"></el-input-number>
</el-form-item>
<el-form-item label="使用有效期">
<el-radio-group v-model="ruleForm.isFixedTime">
<el-radio :label="false">天数</el-radio>
<el-radio :label="true">时间段</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="使用有效期限(天)" prop="resource" v-if="!ruleForm.isFixedTime">
<el-input-number v-model="ruleForm.day" :min="0" label="描述文字"></el-input-number>
</el-form-item>
<el-form-item label="使用有效期限" prop="resource" v-if="ruleForm.isFixedTime">
<el-date-picker
style="width: 550px"
v-model="termTime"
type="datetimerange"
range-separator=""
format="yyyy - MM - dd - HH : mm : ss"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="领取是否限时" prop="isForever">
<el-radio-group v-model="ruleForm.isForever">
<el-radio :label="true">限时</el-radio>
<el-radio :label="false">不限时</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="领取时间" v-if="ruleForm.isForever">
<el-date-picker
style="width: 550px"
v-model="isForeverTime"
type="datetimerange"
range-separator=""
format="yyyy - MM - dd - HH : mm : ss"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="领取方式" prop="resource">
<el-radio-group v-model="ruleForm.type">
<el-radio :label="1">手动领取</el-radio>
<el-radio :label="2">新人卷</el-radio>
<el-radio :label="3">赠送卷</el-radio>
<!--<el-radio :label="4">付费会员卷</el-radio>-->
</el-radio-group>
</el-form-item>
<el-form-item label="是否限量" prop="isLimited">
<el-radio-group v-model="ruleForm.isLimited">
<el-radio :label="true">限量</el-radio>
<el-radio :label="false">不限量</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="发布数量" prop="total" v-if="ruleForm.isLimited">
<el-input-number v-model="ruleForm.total" :min="1" label="排序"></el-input-number>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input-number v-model="ruleForm.sort" :min="0" label="排序"></el-input-number>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="ruleForm.status">
<el-radio :label="true">开启</el-radio>
<el-radio :label="false">关闭</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="submitForm('ruleForm')" :loading="loading">立即创建</el-button>
<!--<el-button @click="resetForm('ruleForm')">重置</el-button>-->
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import { couponSaveApi, couponInfoApi } from '@/api/marketing'
import { categoryApi } from '@/api/store'
export default {
name: "creatCoupon",
data() {
return {
loading: false,
threshold: false,
termTime: [],
isForeverTime: [],
props2: {
children: 'child',
label: 'name',
value: 'id',
checkStrictly: true,
emitPath: false
},
couponType: 0,
term: 'termday',
merCateList: [], // 商户分类筛选
ruleForm: {
useType: 1,
isFixedTime: false,
name: '',
money: 1,
minPrice: 1,
day: null,
isForever: false,
primaryKey: '',
type: 2,
isLimited: false,
useStartTime: '', // 使用
useEndTime: '', // 结束
receiveStartTime: '', //领取
receiveEndTime: '',
sort: 0,
total: 1,
status: false
},
rules: {
name: [
{ required: true, message: '请输入优惠券名称', trigger: 'blur' },
],
},
checked: []
}
},
mounted() {
this.getCategorySelect()
if( this.$route.params.id ) this.getInfo()
},
methods: {
// 商品分类;
getCategorySelect() {
categoryApi({ status: -1, type: 1 }).then(res => {
this.merCateList = res
this.merCateList.map(item => {
this.$set(item , 'disabled', true)
})
})
},
getInfo(){
this.loading = true
couponInfoApi({id: this.$route.params.id}).then(res => {
const info = res.coupon
this.ruleForm = {
useType: info.useType,
isFixedTime: info.isFixedTime,
isForever: info.isForever,
name: info.name,
money: info.money,
minPrice: info.minPrice,
day: info.day,
type: info.type,
isLimited: info.isLimited,
sort: info.sort,
total: info.total,
status: info.status,
primaryKey: Number(info.primaryKey)
}
this.checked = res.product
info.minPrice === 0 ? this.threshold = false : this.threshold = true
info.isForever ? this.isForeverTime = [info.receiveStartTime, info.receiveEndTime] : this.isForeverTime = []
info.isFixedTime ? this.termTime = [info.useStartTime, info.useEndTime] : this.termTime = []
this.loading = false
}).catch(res => {
this.loading = false
this.$message.error(res.message)
})
},
handleRemove (i) {
this.checked.splice(i, 1)
},
changeGood(){
const _this = this
this.$modalGoodList(function(row) {
_this.checked = row
},'many',_this.checked)
},
submitForm(formName) {
if( this.ruleForm.useType === 2 ) this.ruleForm.primaryKey = this.checked.map(item => {return item.id}).join(',')
if( this.ruleForm.useType === 1 ) this.ruleForm.primaryKey = ''
if( !this.threshold ) this.ruleForm.minPrice = 0
if( !this.ruleForm.isLimited ) this.ruleForm.total = 0
this.ruleForm.isFixedTime && this.termTime.length ? (this.ruleForm.useStartTime = this.termTime[0], this.ruleForm.day = null) : this.ruleForm.useStartTime = ''
this.ruleForm.isFixedTime && this.termTime.length ? (this.ruleForm.useEndTime = this.termTime[1], this.ruleForm.day = null) : this.ruleForm.useEndTime = ''
this.ruleForm.isForever && this.isForeverTime.length ? this.ruleForm.receiveStartTime = this.isForeverTime[0] : this.ruleForm.receiveStartTime = ''
this.ruleForm.isForever && this.isForeverTime.length ? this.ruleForm.receiveEndTime = this.isForeverTime[1] : this.ruleForm.receiveEndTime = ''
this.$refs[formName].validate((valid) => {
if (valid) {
this.loading = true
couponSaveApi(this.ruleForm).then(() => {
this.$message.success("新增成功")
this.loading = false
setTimeout(() => {
this.$router.push({ path: `/marketing/coupon/list` })
}, 200);
}).catch(() => {
this.loading = false
})
} else {
this.loading = false
return false;
}
});
},
}
}
</script>
<style scoped lang="scss">
.pictrue{
width: 60px;
height: 60px;
border: 1px dotted rgba(0,0,0,0.1);
margin-right: 10px;
position: relative;
cursor: pointer;
img{
width: 100%;
height: 100%;
}
}
.btndel{
position: absolute;
z-index: 1;
width :20px !important;
height: 20px !important;
left: 46px;
top: -4px;
}
</style>

View File

@@ -0,0 +1,295 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="filter-container">
<div class="demo-input-suffix acea-row">
<span class="seachTiele">状态</span>
<el-select v-model="tableFrom.status" placeholder="请选择" class="filter-item selWidth mr20" @change="seachList" clearable>
<el-option label="未开启" :value="0" />
<el-option label="开启" :value="1" />
</el-select>
<span class="seachTiele">优惠券名称</span>
<el-input v-model="tableFrom.name" placeholder="请输入优惠券名称" class="selWidth">
<el-button slot="append" icon="el-icon-search" @click="seachList" />
</el-input>
</div>
</div>
<router-link :to=" { path: '/marketing/coupon/list/save' } ">
<el-button size="small" type="primary">添加优惠劵</el-button>
</router-link>
</div>
<el-table
v-loading="listLoading"
:data="tableData.data"
style="width: 100%"
size="mini"
>
<el-table-column
prop="id"
label="ID"
min-width="50"
/>
<el-table-column
prop="name"
label="名称"
min-width="120"
/>
<el-table-column
label="类型"
min-width="80"
>
<template slot-scope="{ row }">
<span>{{row.useType | couponUserTypeFilter}}</span>
</template>
</el-table-column>
<el-table-column
prop="money"
label="面值"
min-width="100"
/>
<el-table-column
prop="name"
label="领取方式"
min-width="100"
>
<template slot-scope="{ row }">
<span>{{row.useType | couponTypeFilter}}</span>
</template>
</el-table-column>
<el-table-column
min-width="260"
label="领取日期"
>
<template slot-scope="{ row }">
<div v-if="row.receiveEndTime">
{{ row.receiveStartTime }} - {{ row.receiveEndTime }}
</div>
<span v-else>不限时</span>
</template>
</el-table-column>
<el-table-column
min-width="260"
label="使用时间"
>
<template slot-scope="{ row }">
<div v-if="row.day">
{{ row.day }}
</div>
<span v-else>
{{ row.useStartTime }} - {{ row.useEndTime }}
</span>
</template>
</el-table-column>
<el-table-column
min-width="100"
label="发布数量"
>
<template slot-scope="{ row }">
<span v-if=" !row.isLimited ">不限量</span>
<div v-else>
<span class="fa">发布{{ row.total }}</span>
<span class="sheng">剩余{{ row.lastTotal }}</span>
</div>
</template>
</el-table-column>
<el-table-column
label="是否开启"
min-width="100"
>
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:active-value="true"
:inactive-value="false"
active-text="开启"
inactive-text="关闭"
@click.native="onchangeIsShow(scope.row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" min-width="130" fixed="right">
<template slot-scope="scope">
<el-button type="text" class="mr10" size="small" @click="receive(scope.row)">领取记录</el-button>
<router-link :to=" { path: '/marketing/coupon/list/save/' + scope.row.id } ">
<el-button type="text" size="small">复制</el-button>
</router-link>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:page-sizes="[20, 40, 60, 80]"
:page-size="tableFrom.limit"
:current-page="tableFrom.page"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.total"
@size-change="handleSizeChange"
@current-change="pageChange"
/>
</div>
</el-card>
<!--领取记录-->
<el-dialog
title="领取记录"
:visible.sync="dialogVisible"
width="500px"
:before-close="handleClose"
>
<el-table
v-loading="Loading"
:data="issueData.data"
style="width: 100%"
>
<el-table-column
prop="user.nickname"
label="用户名"
min-width="120"
/>
<el-table-column label="用户头像" min-width="80">
<template slot-scope="scope">
<div class="demo-image__preview">
<el-image
style="width: 36px; height: 36px"
:src="scope.row.avatar"
:preview-src-list="[scope.row.avatar]"
/>
</div>
</template>
</el-table-column>
<el-table-column
prop="createTime"
label="领取时间"
min-width="180"
/>
</el-table>
<div class="block">
<el-pagination
:page-sizes="[10, 20, 30, 40]"
:page-size="tableFromIssue.limit"
:current-page="tableFromIssue.page"
layout="total, sizes, prev, pager, next, jumper"
:total="issueData.total"
@size-change="handleSizeChangeIssue"
@current-change="pageChangeIssue"
/>
</div>
</el-dialog>
</div>
</template>
<script>
import { marketingListApi, couponIssueStatusApi, couponUserListApi } from '@/api/marketing'
import { roterPre } from '@/settings'
export default {
name: 'CouponList',
data() {
return {
Loading: false,
dialogVisible: false,
roterPre: roterPre,
listLoading: true,
tableData: {
data: [],
total: 0
},
tableFrom: {
page: 1,
limit: 20,
status: '',
name: ''
},
tableFromIssue: {
page: 1,
limit: 10,
couponId: ''
},
issueData: {
data: [],
total: 0
}
}
},
mounted() {
this.getList()
},
methods: {
seachList() {
this.tableFrom.page = 1
this.getList()
},
handleClose() {
this.dialogVisible = false
},
// 领取记录
receive(row) {
this.dialogVisible = true
this.getIssueList(row)
},
// 列表
getIssueList(row) {
this.Loading = true
this.tableFromIssue.couponId = row.id
couponUserListApi(this.tableFromIssue).then(res => {
this.issueData.data = res.list
this.issueData.total = res.total
this.Loading = false
}).catch(res => {
this.Loading = false
this.$message.error(res.message)
})
},
pageChangeIssue(page) {
this.tableFromIssue.page = page
this.getIssueList()
},
handleSizeChangeIssue(val) {
this.tableFromIssue.limit = val
this.getIssueList()
},
// 列表
getList() {
this.listLoading = true
marketingListApi(this.tableFrom).then(res => {
this.tableData.data = res.list
this.tableData.total = res.total
this.listLoading = false
}).catch(res => {
this.listLoading = false
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList()
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList()
},
// 修改状态
onchangeIsShow(row) {
couponIssueStatusApi({id:row.id, status:row.status}).then(() => {
this.$message.success('修改成功')
this.getList()
})
}
}
}
</script>
<style scoped lang="scss">
.selWidth{
width: 350px !important;
}
.seachTiele{
line-height: 35px;
}
.fa{
color: #0a6aa1;
display: block;
}
.sheng{
color: #ff0000;
display: block;
}
</style>

View File

@@ -0,0 +1,201 @@
<template>
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="filter-container">
<el-form :inline="true">
<el-form-item label="使用状态:" class="mr10">
<el-select v-model="tableFromIssue.status" placeholder="请选择评价状态" clearable class="selWidth" @change="seachList">
<el-option label="已使用" value="1" />
<el-option label="未使用" value="0" />
<el-option label="已过期" value="2" />
</el-select>
</el-form-item>
<el-form-item label="领取人:" class="mr10">
<el-input v-model="tableFromIssue.coupon_id" placeholder="请输入领取人" class="selWidth">
<el-button size="mini" slot="append" icon="el-icon-search" @click="seachList"/>
</el-input>
</el-form-item>
<el-form-item label="优惠劵:" class="mr10">
<el-input v-model="tableFromIssue.name" placeholder="请输入优惠劵" class="selWidth">
<el-button slot="append" icon="el-icon-search" @click="seachList"/>
</el-input>
</el-form-item>
</el-form>
</div>
</div>
<el-table
v-loading="Loading"
:data="issueData.data"
style="width: 100%"
>
<el-table-column
prop="couponId"
label="优惠券ID"
min-width="80"
/>
<el-table-column
prop="name"
label="优惠券名称"
min-width="150"
/>
<el-table-column
prop="nickname"
label="领取人"
min-width="130"
/>
<el-table-column
prop="money"
label="面值"
min-width="100"
/>
<el-table-column
prop="minPrice"
label="最低消费额"
min-width="120"
/>
<el-table-column
prop="startTime"
label="开始使用时间"
min-width="150"
/>
<el-table-column
prop="endTime"
label="结束使用时间"
min-width="150"
/>
<el-table-column
label="获取方式"
min-width="150"
>
<template slot-scope="scope">
<span>{{scope.row.type | failFilter}}</span>
</template>
</el-table-column>
<el-table-column
prop="is_fail"
label="是否可用"
min-width="100"
>
<template slot-scope="scope">
<i v-if="scope.row.status === 0" class="el-icon-check" style="font-size: 14px;color: #0092DC;" />
<i v-else class="el-icon-download" style="font-size: 14px;color: #ed5565;" />
</template>
</el-table-column>
<el-table-column
label="使用状态"
min-width="100"
>
<template slot-scope="scope">
<span>{{scope.row.status | statusFilter}}</span>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:page-sizes="[20, 40, 60, 80]"
:page-size="tableFromIssue.limit"
:current-page="tableFromIssue.page"
layout="total, sizes, prev, pager, next, jumper"
:total="issueData.total"
@size-change="handleSizeChangeIssue"
@current-change="pageChangeIssue"
/>
</div>
</el-card>
</div>
</template>
<script>
import { couponUserListApi } from '@/api/marketing'
import { roterPre } from '@/settings'
export default {
name: 'CouponUser',
filters: {
failFilter(status) {
const statusMap = {
'receive': '自己领取',
'send': '后台发送',
'give': '满赠',
'new': '新人',
'buy': '买赠送'
}
return statusMap[status]
},
statusFilter(status) {
const statusMap = {
0: '未使用',
1: '已使用',
2: '已过期'
}
return statusMap[status]
}
},
data() {
return {
Loading: false,
roterPre: roterPre,
imgList: [],
tableFromIssue: {
page: 1,
limit: 20,
name: '',
status: ''
},
issueData: {
data: [],
total: 0
}
}
},
mounted() {
this.getIssueList()
},
methods: {
seachList() {
this.tableFromIssue.page = 1
this.getIssueList()
},
// 列表
getIssueList() {
this.Loading = true
couponUserListApi(this.tableFromIssue).then(res => {
this.issueData.data = res.list
this.issueData.total = res.total
// this.issueData.data.map((item) => {
// this.imgList.push(item.user.avatar)
// })
this.Loading = false
}).catch(res => {
this.Loading = false
this.$message.error(res.message)
})
},
pageChangeIssue(page) {
this.tableFromIssue.page = page
this.getIssueList()
},
handleSizeChangeIssue(val) {
this.tableFromIssue.limit = val
this.getIssueList()
}
}
}
</script>
<style scoped lang="scss">
.selWidth{
width: 350px !important;
}
.seachTiele{
line-height: 35px;
}
.fa{
color: #0a6aa1;
display: block;
}
.sheng{
color: #ff0000;
display: block;
}
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>拼团</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,15 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>list222</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,39 @@
<template>
<div class="divBox">
<el-card class="box-card">
<zb-parser
:form-id="109"
:is-create="isCreate"
:edit-data="editData"
@submit="handlerSubmit"
/>
</el-card>
</div>
</template>
<script>
import zbParser from '@/components/FormGenerator/components/parser/ZBParser'
import { smsSaveApi } from '@/api/sms'
export default {
name: "integralconfig",
components: { zbParser },
data() {
return {
isCreate: 0,
editData: {}
}
},
methods: {
handlerSubmit(formValue) {
smsSaveApi(formValue).then(data => {
this.$message.success('新增成功')
this.editData = {}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,15 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,104 @@
<template>
<div>
<zb-parser
v-if="formConf.fields.length > 0"
:form-id="formid"
:is-create="isCreate"
:edit-data="editData"
@submit="handlerSubmit"
/>
<!-- {{ editData }}-->
</div>
</template>
<script>
import * as constants from '@/utils/constants.js'
import zbParser from '@/components/FormGenerator/components/parser/ZBParser'
import * as systemGroupDataApi from '@/api/systemGroupData.js'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
export default {
// name: "combineEdit"
components: { zbParser },
props: {
formid: {
type: Number,
required: true
},
isCreate: {
type: Number,
default: 0 // 0=create 1=edit
},
editData: {
type: Object
}
},
data() {
return {
constants,
formConf: { fields: [] },
selfForm: {
sort: 0,
status: 0
}
}
},
mounted() {
this.handlerGetFormConfig()
this.handlerInitEditData()
},
methods: {
handlerInitEditData() {
const { sort, status } = this.editData
this.selfForm.sort = sort
this.selfForm.status = status
},
handlerGetFormConfig() { // 获取表单配置后生成table列
const _pram = { id: this.formid }
systemFormConfigApi.getFormConfigInfo(_pram).then(data => {
this.formConf = JSON.parse(data.content)
})
},
handlerSubmit(formValue) {
this.isCreate === 0 ? this.handlerSave(formValue) : this.handlerEdit(formValue)
},
handlerSave(formValue) {
const _pram = this.buildFormPram(formValue)
systemGroupDataApi.groupDataSave(_pram).then(data => {
this.$message.success('添加数据成功')
this.$emit('hideDialog')
})
},
handlerEdit(formValue) {
const _pram = this.buildFormPram(formValue)
systemGroupDataApi.groupDataEdit(_pram, this.editData.id).then(data => {
this.$message.success('编辑数据成功')
this.$emit('hideDialog')
})
},
buildFormPram(formValue) {
const _pram = {
gid: this.formid,
form: {
fields: [],
id: this.formid
// sort: this.selfForm.sort,
// status: this.selfForm.status
}}
const _fields = []
Object.keys(formValue).forEach((key) => {
_fields.push({
name: key,
title: key,
value: formValue[key]
})
})
_pram.form.fields = _fields
return _pram
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,167 @@
<template>
<div class="components-container">
<el-form inline>
<el-form-item>
<el-button type="primary" @click="handlerOpenEditData({},0)">添加数据</el-button>
</el-form-item>
<el-form-item>
<el-select v-model="listPram.status" placeholder="状态" clearable @change="handlerSearch">
<el-option
v-for="item in constants.showHiddenStatus"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="关键词">-->
<!-- <el-input v-model="listPram.keywords" placeholder="请输入关键词" clearable></el-input>-->
<!-- </el-form-item>-->
<!-- <el-form-item>-->
<!-- <el-button type="primary" @click="handlerSearch">查询</el-button>-->
<!-- </el-form-item>-->
</el-form>
<el-dialog
:title="editDataConfig.isCreate === 0?'添加数据':'编辑数据'"
:visible.sync="editDataConfig.visible"
append-to-body
destroy-on-close
>
<edit
v-if="editDataConfig.visible"
:formid="formId"
:edit-data="editDataConfig.editData"
:is-create="editDataConfig.isCreate"
@hideDialog="handlerHideDia"
/>
</el-dialog>
<el-table
:data="dataList.list"
style="width: 100%;margin-bottom: 20px;"
>
<el-table-column label="编号" prop="id" />
<el-table-column
v-for="item,index in formConf.fields"
:key="index"
:label="item.__config__.label"
:prop="item.__vModel__"
>
<template slot-scope="scope"><!-- 自定义维护特殊列展示 -->
<span v-if="item.__config__.label === '状态'">
{{ scope.row[item.__vModel__] | filterShowOrHideForFormConfig }}</span>
<span v-else>{{ scope.row[item.__vModel__] }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button type="primary" @click="handlerOpenEditData(scope.row,1)">编辑</el-button>
<el-button type="danger" @click="handlerDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="listPram.page"
:page-sizes="constants.page.limit"
:layout="constants.page.layout"
:total="dataList.total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import edit from './edit'
import * as constants from '@/utils/constants.js'
import * as systemGroupDataApi from '@/api/systemGroupData.js'
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
export default {
// name: "combineDataList"
components: { edit },
data() {
return {
constants,
listPram: {
gid: null,
keywords: null,
status: null, // 1=开启 2=关闭
page: 1,
limit: constants.page.limit[0]
},
editDataConfig: {
visible: false,
isCreate: 0, // 0=create 1=edit
editData: {}
},
formConf: { fields: [] },
dataList: { list: [], total: 0 },
formId: constants.formConfigIds[1].id
}
},
mounted() {
this.handlerGetFormConfig()
this.listPram.gid = this.formId
this.handlerGetListData(this.listPram)
},
methods: {
handlerSearch() {
this.listPram.page = 1
this.handlerGetListData(this.listPram)
},
handlerGetListData(pram) { // 获取列表数据
systemGroupDataApi.groupDataList(pram).then(data => {
const _selfList = []
data.list.forEach(_lItem => {
_lItem.value = JSON.parse(_lItem.value)
const _fields = _lItem.value.fields
const _rowData = {}
_fields.map((item) => {
_rowData[item.name] = item.value
})
_rowData.id = _lItem.id
_rowData.sort = _lItem.sort
_rowData.status = _lItem.status
_selfList.push(_rowData)
})
this.dataList.list = _selfList
this.dataList.total = data.total
})
},
handlerGetFormConfig() { // 获取表单配置后生成table列
const _pram = { id: this.formId }
systemFormConfigApi.getFormConfigInfo(_pram).then(data => {
this.formConf = JSON.parse(data.content)
})
},
handlerOpenEditData(rowData, isCreate) {
this.editDataConfig.editData = rowData
this.editDataConfig.isCreate = isCreate
this.editDataConfig.visible = true
},
handlerHideDia() {
this.handlerGetListData(this.listPram)
this.editDataConfig.visible = false
},
handlerDelete(rowData) {
this.$confirm('确实删除当前数据', '提示').then(() => {
systemGroupDataApi.groupDataDelete(rowData).then(data => {
this.$message.success('删除数据成功')
this.handlerHideDia()
})
})
},
handleSizeChange(val) {
this.listPram.limit = val
this.handlerGetListData(this.listPram)
},
handleCurrentChange(val) {
this.listPram.page = val
this.handlerGetListData(this.listPram)
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,13 @@
<template>
<div>秒杀商品</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>

View File

@@ -0,0 +1,15 @@
<template>
<div>
<router-view />
</div>
</template>
<script>
export default {
}
</script>
<style lang="sass" scoped>
</style>