1
This commit is contained in:
@@ -40,7 +40,8 @@ const mainRoutes = {
|
||||
{ path: '/book-book', component: _import('modules/book/book'), name: 'book-book', meta: { title: '图书列表', isTab: true } },
|
||||
{ path: '/order-buyorderdetail', component: _import('modules/order/buyorderdetail'), name: 'order-buyorderdetail', meta: { title: '商品列表', isTab: true } },
|
||||
{ path: '/book-bookchapter', component: _import('modules/book/bookchapter'), name: 'book-chapter', meta: { title: '图书章节', isTab: true } },
|
||||
{ path: '/book-bookchaptercontent', component: _import('modules/book/bookchaptercontent'), name: 'book-content', meta: { title: '章节内容', isTab: true } }
|
||||
{ path: '/book-bookchaptercontent', component: _import('modules/book/bookchaptercontent'), name: 'book-content', meta: { title: '章节内容', isTab: true } },
|
||||
{ path: '/seckill-seckillprodrelation', component: _import('modules/seckill/seckillprodrelation'), name: 'seckill-seckillprodrelation', meta: { title: '秒杀商品', isTab: true } },
|
||||
],
|
||||
beforeEnter (to, from, next) {
|
||||
let token = Vue.cookie.get('token')
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="155px" prop="state" header-align="center" align="center" label="状态">
|
||||
<el-table-column min-width="155px
|
||||
" prop="state" header-align="center" align="center" label="状态">
|
||||
<template slot-scope="scope">
|
||||
<el-switch :active-value=1 :inactive-value=0 style="display: block" v-model="scope.row.state"
|
||||
@change="SwitchChange(scope.row)" active-color="#13ce66" inactive-color="#ff4949" active-text="上架"
|
||||
|
||||
304
src/views/modules/coupon/coupon-add-or-update.vue
Normal file
304
src/views/modules/coupon/coupon-add-or-update.vue
Normal file
@@ -0,0 +1,304 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
<el-form-item label="优惠卷类型:" prop="type">
|
||||
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
|
||||
<el-select v-model="dataForm.type" placeholder="请选择" >
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券名称" prop="name">
|
||||
<el-input v-model="dataForm.name" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用平台">
|
||||
<!-- <el-input v-model="dataForm.platform" placeholder="使用平台"></el-input> -->
|
||||
<el-select v-model="dataForm.platform" placeholder="请选择" >
|
||||
<el-option
|
||||
v-for="item in options1"
|
||||
: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="dataForm.publishCount" placeholder="发行数量"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="数量" prop="count">
|
||||
<el-input v-model="dataForm.count" placeholder="数量"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="面额:" prop="amount">
|
||||
<el-input v-model="dataForm.amount" placeholder="面额">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="每人限领:" prop="perLimit">
|
||||
<el-input v-model="dataForm.perLimit" placeholder="">
|
||||
<template slot="append">张</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="使用门槛" prop="minPoint">
|
||||
<el-input v-model="dataForm.minPoint" placeholder="">
|
||||
<template slot="prepend">满</template>
|
||||
<template slot="append">元可用</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="有效期" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="startTime"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="结束使用时间" prop="endTime">
|
||||
<el-input v-model="dataForm.endTime" placeholder="结束使用时间"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="使用类型" prop="useType">
|
||||
<!-- <el-input v-model="dataForm.useType" placeholder="使用类型"></el-input> -->
|
||||
<el-radio-group v-model="dataForm.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-button label="深圳"></el-radio-button> -->
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="note">
|
||||
<el-input v-model="dataForm.note" placeholder="备注"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="已使用数量" prop="useCount">
|
||||
<el-input v-model="dataForm.useCount" placeholder="已使用数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="领取数量" prop="receiveCount">
|
||||
<el-input v-model="dataForm.receiveCount" placeholder="领取数量"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="可以领取的日期" prop="enableTime">
|
||||
<el-input v-model="dataForm.enableTime" placeholder="可以领取的日期"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠码" prop="code">
|
||||
<el-input v-model="dataForm.code" placeholder="优惠码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="可领取的会员类型" prop="memberLevel">
|
||||
<el-input v-model="dataForm.memberLevel" placeholder="可领取的会员类型"></el-input>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
options: [{
|
||||
value: 0,
|
||||
label: '全场赠券'
|
||||
}, {
|
||||
value: 1,
|
||||
label: '会员赠券'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '购物赠券'
|
||||
}, {
|
||||
value: 3,
|
||||
label: '注册赠券'
|
||||
}],
|
||||
options1: [{
|
||||
value: 0,
|
||||
label: '全部'
|
||||
}, {
|
||||
value: 1,
|
||||
label: '移动'
|
||||
}, {
|
||||
value: 2,
|
||||
label: 'PC'
|
||||
}],
|
||||
startTime:[],
|
||||
dataForm: {
|
||||
id: 0,
|
||||
type: '',
|
||||
name: '',
|
||||
platform: '',
|
||||
count: '',
|
||||
amount: '',
|
||||
perLimit: '',
|
||||
minPoint: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
useType: '',
|
||||
note: '',
|
||||
publishCount: '',
|
||||
useCount: '1',
|
||||
receiveCount: '',
|
||||
enableTime: '',
|
||||
code: '',
|
||||
memberLevel: ''
|
||||
},
|
||||
dataRule: {
|
||||
type: [
|
||||
{ required: true, message: '优惠卷类型;0->全场赠券;1->会员赠券;2->购物赠券;3->注册赠券不能为空', trigger: 'blur' }
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: '名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
platform: [
|
||||
{ required: true, message: '使用平台:0->全部;1->移动;2->PC不能为空', trigger: 'blur' }
|
||||
],
|
||||
count: [
|
||||
{ required: true, message: '数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
amount: [
|
||||
{ required: true, message: '金额不能为空', trigger: 'blur' }
|
||||
],
|
||||
perLimit: [
|
||||
{ required: true, message: '每人限领张数不能为空', trigger: 'blur' }
|
||||
],
|
||||
minPoint: [
|
||||
{ required: true, message: '使用门槛;0表示无门槛不能为空', trigger: 'blur' }
|
||||
],
|
||||
startTime: [
|
||||
{ required: true, message: '开始使用时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
endTime: [
|
||||
{ required: true, message: '结束使用时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
useType: [
|
||||
{ required: true, message: '使用类型:0->全场通用;1->指定分类;2->指定商品不能为空', trigger: 'blur' }
|
||||
],
|
||||
note: [
|
||||
{ required: true, message: '备注不能为空', trigger: 'blur' }
|
||||
],
|
||||
publishCount: [
|
||||
{ required: true, message: '发行数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
useCount: [
|
||||
{ required: true, message: '已使用数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
receiveCount: [
|
||||
{ required: true, message: '领取数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
enableTime: [
|
||||
{ required: true, message: '可以领取的日期不能为空', trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: '优惠码不能为空', trigger: 'blur' }
|
||||
],
|
||||
memberLevel: [
|
||||
{ required: true, message: '可领取的会员类型:0->无限制不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/coupon/info/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.type = data.coupon.type
|
||||
this.dataForm.name = data.coupon.name
|
||||
this.dataForm.platform = data.coupon.platform
|
||||
this.dataForm.count = data.coupon.count
|
||||
this.dataForm.amount = data.coupon.amount
|
||||
this.dataForm.perLimit = data.coupon.perLimit
|
||||
this.dataForm.minPoint = data.coupon.minPoint
|
||||
this.dataForm.startTime = data.coupon.startTime
|
||||
this.dataForm.endTime = data.coupon.endTime
|
||||
this.dataForm.useType = data.coupon.useType
|
||||
this.dataForm.note = data.coupon.note
|
||||
this.dataForm.publishCount = data.coupon.publishCount
|
||||
this.dataForm.useCount = data.coupon.useCount
|
||||
this.dataForm.receiveCount = data.coupon.receiveCount
|
||||
this.dataForm.enableTime = data.coupon.enableTime
|
||||
this.dataForm.code = data.coupon.code
|
||||
this.dataForm.memberLevel = data.coupon.memberLevel
|
||||
|
||||
this.startTime = [this.dataForm.startTime,this.dataForm.endTime]
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/coupon/${!this.dataForm.id ? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'id': this.dataForm.id || undefined,
|
||||
'type': this.dataForm.type,
|
||||
'name': this.dataForm.name,
|
||||
'platform': this.dataForm.platform,
|
||||
'count': this.dataForm.count,
|
||||
'amount': this.dataForm.amount,
|
||||
'perLimit': this.dataForm.perLimit,
|
||||
'minPoint': this.dataForm.minPoint,
|
||||
'startTime': this.startTime[0],
|
||||
'endTime': this.startTime[1],
|
||||
'useType': this.dataForm.useType,
|
||||
'note': this.dataForm.note,
|
||||
'publishCount': this.dataForm.publishCount,
|
||||
'useCount': this.dataForm.useCount,
|
||||
'receiveCount': this.dataForm.receiveCount,
|
||||
'enableTime': this.dataForm.enableTime,
|
||||
'code': this.dataForm.code,
|
||||
'memberLevel': this.dataForm.memberLevel
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
259
src/views/modules/coupon/coupon.vue
Normal file
259
src/views/modules/coupon/coupon.vue
Normal file
@@ -0,0 +1,259 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:coupon:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('book:coupon:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="序号">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠券名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="type"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠卷类型">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="platform"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="使用平台">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="count"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="数量">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="amount"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="金额">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="perLimit"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="每人限领张数">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="minPoint"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="使用门槛">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="startTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="开始使用时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="endTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="结束使用时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="useType"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="使用类型">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="note"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="备注">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="publishCount"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="发行数量">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="useCount"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="已使用数量">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="receiveCount"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="领取数量">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="enableTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="可以领取的日期">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="code"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="memberLevel"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="可领取的会员类型">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './coupon-add-or-update'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/coupon/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/coupon/delete'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
165
src/views/modules/coupon/couponhistory-add-or-update.vue
Normal file
165
src/views/modules/coupon/couponhistory-add-or-update.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
<el-form-item label="优惠券id" prop="couponId">
|
||||
<el-input v-model="dataForm.couponId" placeholder="优惠券id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员id" prop="memberId">
|
||||
<el-input v-model="dataForm.memberId" placeholder="会员id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单id" prop="orderId">
|
||||
<el-input v-model="dataForm.orderId" placeholder="订单id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="优惠券码" prop="couponCode">
|
||||
<el-input v-model="dataForm.couponCode" placeholder="优惠券码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="领取人昵称" prop="memberNickname">
|
||||
<el-input v-model="dataForm.memberNickname" placeholder="领取人昵称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="获取类型" prop="getType">
|
||||
<el-input v-model="dataForm.getType" placeholder="获取类型"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用状态" prop="useStatus">
|
||||
<el-input v-model="dataForm.useStatus" placeholder="使用状态"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用时间" prop="useTime">
|
||||
<el-input v-model="dataForm.useTime" placeholder="使用时间"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单号码" prop="orderSn">
|
||||
<el-input v-model="dataForm.orderSn" placeholder="订单号码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
couponId: '',
|
||||
memberId: '',
|
||||
orderId: '',
|
||||
couponCode: '',
|
||||
memberNickname: '',
|
||||
getType: '',
|
||||
createTime: '',
|
||||
useStatus: '',
|
||||
useTime: '',
|
||||
orderSn: ''
|
||||
},
|
||||
dataRule: {
|
||||
couponId: [
|
||||
{ required: true, message: '优惠券id不能为空', trigger: 'blur' }
|
||||
],
|
||||
memberId: [
|
||||
{ required: true, message: '会员id不能为空', trigger: 'blur' }
|
||||
],
|
||||
orderId: [
|
||||
{ required: true, message: '订单id不能为空', trigger: 'blur' }
|
||||
],
|
||||
couponCode: [
|
||||
{ required: true, message: '优惠券码不能为空', trigger: 'blur' }
|
||||
],
|
||||
memberNickname: [
|
||||
{ required: true, message: '领取人昵称不能为空', trigger: 'blur' }
|
||||
],
|
||||
getType: [
|
||||
{ required: true, message: '获取类型:0->后台赠送;1->主动获取不能为空', trigger: 'blur' }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: '创建时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
useStatus: [
|
||||
{ required: true, message: '使用状态:0->未使用;1->已使用;2->已过期不能为空', trigger: 'blur' }
|
||||
],
|
||||
useTime: [
|
||||
{ required: true, message: '使用时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
orderSn: [
|
||||
{ required: true, message: '订单号码不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/couponhistory/info/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.couponId = data.couponHistory.couponId
|
||||
this.dataForm.memberId = data.couponHistory.memberId
|
||||
this.dataForm.orderId = data.couponHistory.orderId
|
||||
this.dataForm.couponCode = data.couponHistory.couponCode
|
||||
this.dataForm.memberNickname = data.couponHistory.memberNickname
|
||||
this.dataForm.getType = data.couponHistory.getType
|
||||
this.dataForm.createTime = data.couponHistory.createTime
|
||||
this.dataForm.useStatus = data.couponHistory.useStatus
|
||||
this.dataForm.useTime = data.couponHistory.useTime
|
||||
this.dataForm.orderSn = data.couponHistory.orderSn
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/couponhistory/${!this.dataForm.id ? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'id': this.dataForm.id || undefined,
|
||||
'couponId': this.dataForm.couponId,
|
||||
'memberId': this.dataForm.memberId,
|
||||
'orderId': this.dataForm.orderId,
|
||||
'couponCode': this.dataForm.couponCode,
|
||||
'memberNickname': this.dataForm.memberNickname,
|
||||
'getType': this.dataForm.getType,
|
||||
'createTime': this.dataForm.createTime,
|
||||
'useStatus': this.dataForm.useStatus,
|
||||
'useTime': this.dataForm.useTime,
|
||||
'orderSn': this.dataForm.orderSn
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
217
src/views/modules/coupon/couponhistory.vue
Normal file
217
src/views/modules/coupon/couponhistory.vue
Normal file
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:couponhistory:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('book:couponhistory:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="couponId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠券id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="memberId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="会员id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="orderId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="订单id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="couponCode"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠券码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="memberNickname"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="领取人昵称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="getType"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="获取类型:0->后台赠送;1->主动获取">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="创建时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="useStatus"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="使用状态:0->未使用;1->已使用;2->已过期">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="useTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="使用时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="orderSn"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="订单号码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './couponhistory-add-or-update'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/couponhistory/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/couponhistory/delete'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
<el-form-item label="优惠券id" prop="couponId">
|
||||
<el-input v-model="dataForm.couponId" placeholder="优惠券id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类id" prop="productCategoryId">
|
||||
<el-input v-model="dataForm.productCategoryId" placeholder="商品分类id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分类名称" prop="productCategoryName">
|
||||
<el-input v-model="dataForm.productCategoryName" placeholder="商品分类名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父分类名称" prop="parentCategoryName">
|
||||
<el-input v-model="dataForm.parentCategoryName" placeholder="父分类名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
couponId: '',
|
||||
productCategoryId: '',
|
||||
productCategoryName: '',
|
||||
parentCategoryName: ''
|
||||
},
|
||||
dataRule: {
|
||||
couponId: [
|
||||
{ required: true, message: '优惠券id不能为空', trigger: 'blur' }
|
||||
],
|
||||
productCategoryId: [
|
||||
{ required: true, message: '商品分类id不能为空', trigger: 'blur' }
|
||||
],
|
||||
productCategoryName: [
|
||||
{ required: true, message: '商品分类名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
parentCategoryName: [
|
||||
{ required: true, message: '父分类名称不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/couponproductcategoryrelation/info/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.couponId = data.couponProductCategoryRelation.couponId
|
||||
this.dataForm.productCategoryId = data.couponProductCategoryRelation.productCategoryId
|
||||
this.dataForm.productCategoryName = data.couponProductCategoryRelation.productCategoryName
|
||||
this.dataForm.parentCategoryName = data.couponProductCategoryRelation.parentCategoryName
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/couponproductcategoryrelation/${!this.dataForm.id ? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'id': this.dataForm.id || undefined,
|
||||
'couponId': this.dataForm.couponId,
|
||||
'productCategoryId': this.dataForm.productCategoryId,
|
||||
'productCategoryName': this.dataForm.productCategoryName,
|
||||
'parentCategoryName': this.dataForm.parentCategoryName
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
181
src/views/modules/coupon/couponproductcategoryrelation.vue
Normal file
181
src/views/modules/coupon/couponproductcategoryrelation.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:couponproductcategoryrelation:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('book:couponproductcategoryrelation:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="couponId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠券id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="productCategoryId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="商品分类id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="productCategoryName"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="商品分类名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="parentCategoryName"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="父分类名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './couponproductcategoryrelation-add-or-update'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/couponproductcategoryrelation/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/couponproductcategoryrelation/delete'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
111
src/views/modules/coupon/couponproductrelation-add-or-update.vue
Normal file
111
src/views/modules/coupon/couponproductrelation-add-or-update.vue
Normal file
@@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
<el-form-item label="优惠券id" prop="couponId">
|
||||
<el-input v-model="dataForm.couponId" placeholder="优惠券id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品id" prop="productId">
|
||||
<el-input v-model="dataForm.productId" placeholder="商品id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称" prop="productName">
|
||||
<el-input v-model="dataForm.productName" placeholder="商品名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品条码" prop="productSn">
|
||||
<el-input v-model="dataForm.productSn" placeholder="商品条码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
couponId: '',
|
||||
productId: '',
|
||||
productName: '',
|
||||
productSn: ''
|
||||
},
|
||||
dataRule: {
|
||||
couponId: [
|
||||
{ required: true, message: '优惠券id不能为空', trigger: 'blur' }
|
||||
],
|
||||
productId: [
|
||||
{ required: true, message: '商品id不能为空', trigger: 'blur' }
|
||||
],
|
||||
productName: [
|
||||
{ required: true, message: '商品名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
productSn: [
|
||||
{ required: true, message: '商品条码不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (id) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/couponproductrelation/info/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.couponId = data.couponProductRelation.couponId
|
||||
this.dataForm.productId = data.couponProductRelation.productId
|
||||
this.dataForm.productName = data.couponProductRelation.productName
|
||||
this.dataForm.productSn = data.couponProductRelation.productSn
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/couponproductrelation/${!this.dataForm.id ? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'id': this.dataForm.id || undefined,
|
||||
'couponId': this.dataForm.couponId,
|
||||
'productId': this.dataForm.productId,
|
||||
'productName': this.dataForm.productName,
|
||||
'productSn': this.dataForm.productSn
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
181
src/views/modules/coupon/couponproductrelation.vue
Normal file
181
src/views/modules/coupon/couponproductrelation.vue
Normal file
@@ -0,0 +1,181 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:couponproductrelation:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('book:couponproductrelation:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="couponId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="优惠券id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="productId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="商品id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="productName"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="商品名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="productSn"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="商品条码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './couponproductrelation-add-or-update'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/couponproductrelation/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/couponproductrelation/delete'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
186
src/views/modules/seckill/seckillprodrelation-add-or-update.vue
Normal file
186
src/views/modules/seckill/seckillprodrelation-add-or-update.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible" append-to-body>
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
||||
<el-form-item label="商品名称" prop="">
|
||||
<el-autocomplete
|
||||
v-model="state"
|
||||
:fetch-suggestions="querySearchAsync"
|
||||
placeholder="请输入内容"
|
||||
@select="handleSelect"
|
||||
></el-autocomplete>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="场次id" prop="promotionSeckillId">
|
||||
<el-input v-model="dataForm.promotionSeckillId" placeholder="场次id"></el-input>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="商品id" prop="prodId">
|
||||
<el-input v-model="dataForm.prodId" placeholder="商品id"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="秒杀价格" prop="seckillPrice">
|
||||
<el-input-number v-model="dataForm.seckillPrice" :precision="2" :step="0.1" :max="999"></el-input-number>
|
||||
<!-- <el-input v-model="dataForm.seckillPrice" placeholder="秒杀价格"></el-input> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="秒杀数量" prop="seckillCount">
|
||||
<el-input-number v-model="dataForm.seckillCount" label="秒杀数量"></el-input-number>
|
||||
<!-- <el-input v-model="dataForm.seckillCount" placeholder="秒杀数量"></el-input> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="限制购买" prop="seckillLimit">
|
||||
<el-input-number v-model="dataForm.seckillLimit" label="限制购买"></el-input-number>
|
||||
<!-- <el-input v-model="dataForm.seckillLimit" placeholder="限制购买"></el-input> -->
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="权重" prop="seckillSort">
|
||||
<el-input v-model="dataForm.seckillSort" placeholder="权重"></el-input>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
restaurants: [],
|
||||
state: '',
|
||||
id : '',
|
||||
timeout: null,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
promotionId: '',
|
||||
promotionSeckillId: '',
|
||||
prodId: '',
|
||||
seckillPrice: '',
|
||||
seckillCount: '',
|
||||
seckillLimit: '',
|
||||
seckillSort: ''
|
||||
},
|
||||
dataRule: {
|
||||
promotionId: [
|
||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||
],
|
||||
promotionSeckillId: [
|
||||
{ required: true, message: '场次id不能为空', trigger: 'blur' }
|
||||
],
|
||||
prodId: [
|
||||
{ required: true, message: '商品id不能为空', trigger: 'blur' }
|
||||
],
|
||||
seckillPrice: [
|
||||
{ required: true, message: '秒杀价格不能为空', trigger: 'blur' }
|
||||
],
|
||||
seckillCount: [
|
||||
{ required: true, message: '秒杀数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
seckillLimit: [
|
||||
{ required: true, message: '限制购买不能为空', trigger: 'blur' }
|
||||
],
|
||||
seckillSort: [
|
||||
{ required: true, message: '权重不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
init (id,seckillId) {
|
||||
this.dataForm.id = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/seckillprodrelation/info/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.promotionId = data.seckillProdRelation.promotionId
|
||||
this.dataForm.promotionSeckillId = data.seckillProdRelation.promotionSeckillId
|
||||
this.dataForm.prodId = data.seckillProdRelation.prodId
|
||||
this.dataForm.seckillPrice = data.seckillProdRelation.seckillPrice
|
||||
this.dataForm.seckillCount = data.seckillProdRelation.seckillCount
|
||||
this.dataForm.seckillLimit = data.seckillProdRelation.seckillLimit
|
||||
this.dataForm.seckillSort = data.seckillProdRelation.seckillSort
|
||||
}
|
||||
})
|
||||
}
|
||||
this.dataForm.promotionSeckillId = seckillId
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/seckillprodrelation/${!this.dataForm.id ? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'id': this.dataForm.id || undefined,
|
||||
'promotionId': this.dataForm.promotionId,
|
||||
'promotionSeckillId': this.dataForm.promotionSeckillId,
|
||||
'prodId': this.dataForm.prodId,
|
||||
'seckillPrice': this.dataForm.seckillPrice,
|
||||
'seckillCount': this.dataForm.seckillCount,
|
||||
'seckillLimit': this.dataForm.seckillLimit,
|
||||
'seckillSort': this.dataForm.seckillSort
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList',this.dataForm.promotionSeckillId)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
loadAll() {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/shopproduct/prodSearch`),
|
||||
method: 'get'
|
||||
}).then(({data}) => {
|
||||
this.restaurants = data.list
|
||||
console.log(this.restaurants)
|
||||
})
|
||||
},
|
||||
querySearchAsync(queryString, cb) {
|
||||
console.log('数据'+this.restaurants)
|
||||
var restaurants = this.restaurants;
|
||||
var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
|
||||
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = setTimeout(() => {
|
||||
cb(results);
|
||||
}, 3000 * Math.random());
|
||||
},
|
||||
createStateFilter(queryString) {
|
||||
return (state) => {
|
||||
return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
|
||||
};
|
||||
},
|
||||
handleSelect(item) {
|
||||
console.log(item);
|
||||
this.dataForm.prodId = item.productId,
|
||||
this.dataForm.promotionId = item.value
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loadAll();
|
||||
// this.restaurants = this.loadAll();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
204
src/views/modules/seckill/seckillprodrelation.vue
Normal file
204
src/views/modules/seckill/seckillprodrelation.vue
Normal file
@@ -0,0 +1,204 @@
|
||||
<template>
|
||||
<el-dialog title="秒杀商品列表" :visible.sync="relationProdVisible" @close="handlereset">
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:seckillprodrelation:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('book:seckillprodrelation:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column label="序号" width="70" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="promotionId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="商品名称">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column
|
||||
prop="promotionSeckillId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="场次id">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="prodId"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="商品id">
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
prop="seckillPrice"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="秒杀价格">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="seckillCount"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="秒杀数量">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="seckillLimit"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="限制购买">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './seckillprodrelation-add-or-update'
|
||||
export default {
|
||||
name: "dialogComponent",
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
seckillId:'',
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false,
|
||||
relationProdVisible:false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList (id) {
|
||||
this.seckillId = id
|
||||
this.relationProdVisible = true
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/seckillprodrelation/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key,
|
||||
'promotionSeckillId': id
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id,this.seckillId)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/seckillprodrelation/delete'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList(this.seckillId)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
handlereset(){
|
||||
this.relationProdVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
145
src/views/modules/seckill/shopseckill-add-or-update.vue
Normal file
145
src/views/modules/seckill/shopseckill-add-or-update.vue
Normal file
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<el-dialog :title="!dataForm.seckillId ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible" @close="handlereset">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
||||
label-width="80px">
|
||||
<el-form-item label="名称" prop="nam">
|
||||
<el-input v-model="dataForm.nam" placeholder="名称"></el-input>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="秒杀开启时间" prop="startTime">
|
||||
<el-input v-model="dataForm.startTime" placeholder="秒杀开启时间"></el-input>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="秒杀结束" prop="endTime">
|
||||
<el-date-picker v-model="value2" type="datetimerange" :picker-options="pickerOptions" range-separator="至" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" align="right">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
|
||||
</el-form-item> -->
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click=handlereset>取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
pickerOptions: {
|
||||
shortcuts: [{
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近一个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近三个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}]
|
||||
},
|
||||
value2: '',
|
||||
dataForm: {
|
||||
seckillId: 0,
|
||||
nam: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
createTime: ''
|
||||
},
|
||||
dataRule: {
|
||||
// nam: [
|
||||
// { required: true, message: '名称不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// startTime: [
|
||||
// { required: true, message: '秒杀开启时间不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// endTime: [
|
||||
// { required: true, message: '秒杀结束时间不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// createTime: [
|
||||
// { required: true, message: '创建时间不能为空', trigger: 'blur' }
|
||||
// ]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (id) {
|
||||
this.dataForm.seckillId = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.seckillId) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/shopseckill/info/${this.dataForm.seckillId}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.nam = data.shopSeckill.nam
|
||||
this.dataForm.startTime = data.shopSeckill.startTime
|
||||
this.dataForm.endTime = data.shopSeckill.endTime
|
||||
this.dataForm.createTime = data.shopSeckill.createTime
|
||||
|
||||
this.value2 = [this.dataForm.startTime,this.dataForm.endTime]
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/book/shopseckill/${!this.dataForm.seckillId ? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'seckillId': this.dataForm.seckillId || undefined,
|
||||
'nam': this.dataForm.nam,
|
||||
'startTime': this.value2[0],
|
||||
'endTime': this.value2[1],
|
||||
'createTime': this.dataForm.createTime
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handlereset(){
|
||||
this.value2 = ''
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
193
src/views/modules/seckill/shopseckill.vue
Normal file
193
src/views/modules/seckill/shopseckill.vue
Normal file
@@ -0,0 +1,193 @@
|
||||
<template>
|
||||
<div class="mod-config">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-if="isAuth('book:shopseckill:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||
<el-button v-if="isAuth('book:shopseckill:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column label="序号" width="70" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ (pageIndex - 1) * pageSize + scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="nam"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="startTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="秒杀开启时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="endTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="秒杀结束时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="创建时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="relationProdHandle(scope.row.seckillId)">关联商品</el-button>
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.seckillId)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.seckillId)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<dialog-component v-if="relationProdVisible" ref="dialog"></dialog-component>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './shopseckill-add-or-update'
|
||||
import dialogComponent from './seckillprodrelation'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false,
|
||||
relationProdVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
dialogComponent
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.relationProdVisible = false
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/shopseckill/list'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.page.list
|
||||
this.totalPage = data.page.totalCount
|
||||
} else {
|
||||
this.dataList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
this.dataListLoading = false
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
//关联商品
|
||||
relationProdHandle (id) {
|
||||
this.relationProdVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dialog.getDataList(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.seckillId
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/book/shopseckill/delete'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getDataList()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -30,17 +30,25 @@
|
||||
<el-form-item label="电话" prop="tel">
|
||||
<el-input v-model="dataForm.tel" placeholder="电话"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<!-- <el-form-item label="密码" prop="password">
|
||||
<el-input v-model="dataForm.password" placeholder="密码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="会员类型" prop="vip">
|
||||
<el-input v-model="dataForm.vip" placeholder="0-普通 1-vip"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="vip 有效期" prop="vipValidtime">
|
||||
<el-input v-model="dataForm.vipValidtime" placeholder="vip 有效期"></el-input>
|
||||
<el-date-picker
|
||||
v-model="dataForm.vipValidtime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
align="right"
|
||||
:picker-options="pickerOptions">
|
||||
</el-date-picker>
|
||||
<!-- <el-input v-model="dataForm.vipValidtime" placeholder="vip 有效期"></el-input> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="花生币" prop="peanutCoin">
|
||||
<el-input v-model="dataForm.peanutCoin" placeholder="花生币"></el-input>
|
||||
<!-- <el-input v-model="dataForm.peanutCoin" placeholder="花生币"></el-input> -->
|
||||
<el-input-number v-model="dataForm.peanutCoin" label="花生币"></el-input-number>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="阅读时间" prop="readTime">
|
||||
<el-input v-model="dataForm.readTime" placeholder="阅读时间"></el-input>
|
||||
@@ -94,9 +102,9 @@ export default {
|
||||
// name: [
|
||||
// { required: true, message: '姓名不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
// age: [
|
||||
// { required: true, message: '年龄不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
age: [
|
||||
{ required: true, message: '年龄不能为空', trigger: 'blur' }
|
||||
],
|
||||
// sex: [
|
||||
// { required: true, message: '性别不能为空', trigger: 'blur' }
|
||||
// ],
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="ck(scope.row.id)">充/扣花生币</el-button>
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||
</template>
|
||||
@@ -152,6 +153,29 @@
|
||||
</el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
<el-dialog title="充/扣花生币" :close-on-click-modal="false" :visible.sync="adc" append-to-body width="30%">
|
||||
<el-form :model="pointForm">
|
||||
<el-form-item label="充值类型" label-width="15%">
|
||||
<!-- <el-input v-model="pointForm.pointType" placeholder="0-普通 1-vip"></el-input>
|
||||
-->
|
||||
<el-select v-model="pointForm.pointType" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="金额" label-width="15%">
|
||||
<el-input-number v-model="pointForm.pointType" placeholder=""></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="adc=false">取消</el-button>
|
||||
<el-button type="primary" >确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -163,6 +187,17 @@
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
options: [{
|
||||
value: 0,
|
||||
label: '充花生币'
|
||||
}, {
|
||||
value: 1,
|
||||
label: '扣花生币'
|
||||
}],
|
||||
adc:false,
|
||||
pointForm:{
|
||||
pointType: 0,
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
@@ -252,6 +287,9 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
ck(){
|
||||
this.adc = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user