优惠券
This commit is contained in:
@@ -105,7 +105,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="16" v-if="dataForm.couponRange == 2">
|
<el-col :span="16" v-if="dataForm.couponRange == 2">
|
||||||
<el-form-item label="添加绑定" prop="rangeInfo" width="100%">
|
<el-form-item label="绑定类目" prop="rangeInfo" width="100%">
|
||||||
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
|
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
|
||||||
<!-- {{cateSelectLinkList}} -->
|
<!-- {{cateSelectLinkList}} -->
|
||||||
<el-select
|
<el-select
|
||||||
@@ -122,6 +122,7 @@
|
|||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<span v-if="showCateError" style="color:red; font-size:12px">请选择绑定类目</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" v-if="dataForm.couponRange == 1">
|
<el-col :span="24" v-if="dataForm.couponRange == 1">
|
||||||
@@ -271,6 +272,7 @@ export default {
|
|||||||
baseUrl: global.baseUrl,
|
baseUrl: global.baseUrl,
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
showCateError: false,
|
||||||
requesturl:'', // 课程的请求地址
|
requesturl:'', // 课程的请求地址
|
||||||
showSelectPro:false,
|
showSelectPro:false,
|
||||||
baseUrl: global.baseUrl,
|
baseUrl: global.baseUrl,
|
||||||
@@ -404,6 +406,7 @@ export default {
|
|||||||
changeCate(e) {
|
changeCate(e) {
|
||||||
console.log("e", e);
|
console.log("e", e);
|
||||||
this.cateSelectLinkList = e;
|
this.cateSelectLinkList = e;
|
||||||
|
this.showCateError = false
|
||||||
// this.dataForm.rangeInfo = e.join(",");
|
// this.dataForm.rangeInfo = e.join(",");
|
||||||
},
|
},
|
||||||
async changeRange(e) {
|
async changeRange(e) {
|
||||||
@@ -434,9 +437,13 @@ export default {
|
|||||||
return list;
|
return list;
|
||||||
},
|
},
|
||||||
init(id) {
|
init(id) {
|
||||||
|
if(!id){
|
||||||
|
console.log('没有传值')
|
||||||
|
this.visible = true;
|
||||||
|
return
|
||||||
|
}
|
||||||
this.dataForm.id = id || 0;
|
this.dataForm.id = id || 0;
|
||||||
this.getCouponInfoLoad = true;
|
this.getCouponInfoLoad = true;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["dataForm"].resetFields();
|
this.$refs["dataForm"].resetFields();
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
@@ -558,6 +565,7 @@ export default {
|
|||||||
couponRange: "", //优惠卷范围 0无限制 1课程卷 2课程品类卷
|
couponRange: "", //优惠卷范围 0无限制 1课程卷 2课程品类卷
|
||||||
rangeInfo: "" //范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割)
|
rangeInfo: "" //范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割)
|
||||||
};
|
};
|
||||||
|
this.proSelectLinkList = []
|
||||||
this.cateSelectLinkList = []
|
this.cateSelectLinkList = []
|
||||||
this.selectLinkList = []
|
this.selectLinkList = []
|
||||||
this.fileList = []
|
this.fileList = []
|
||||||
@@ -566,9 +574,9 @@ export default {
|
|||||||
// 表单提交
|
// 表单提交
|
||||||
dataFormSubmit() {
|
dataFormSubmit() {
|
||||||
this.$refs["dataForm"].validate(valid => {
|
this.$refs["dataForm"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if(this.dataForm.effectTime < new Date().getTime()) return this.$message.error("生效时间不能小于当前时间")
|
if(!this.dataForm.id && this.dataForm.effectType == 2 && this.dataForm.effectTime < new Date().getTime()) return this.$message.error("生效时间不能小于当前时间")
|
||||||
if (this.dataForm.effectType == 2) {
|
if (this.dataForm.effectType == 2 ) {
|
||||||
if (
|
if (
|
||||||
this.dataForm.effectTime == null ||
|
this.dataForm.effectTime == null ||
|
||||||
this.dataForm.effectTime == ""
|
this.dataForm.effectTime == ""
|
||||||
@@ -601,7 +609,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.dataForm.couponRange == 2) {
|
if (this.dataForm.couponRange == 2) {
|
||||||
if(this.cateSelectLinkList.length == 0) return this.$message.error("请选择课程品类");
|
if(this.cateSelectLinkList.length == 0) {this.showCateError = true; return this.$message.error("请选择课程品类");}
|
||||||
this.dataForm.rangeInfo = this.cateSelectLinkList.join(',')
|
this.dataForm.rangeInfo = this.cateSelectLinkList.join(',')
|
||||||
// if (
|
// if (
|
||||||
// this.dataForm.rangeInfo == null ||
|
// this.dataForm.rangeInfo == null ||
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mod-config">
|
<div class="mod-config">
|
||||||
<el-radio-group v-model="currentState" style="margin-bottom: 15px;" @tab-click="handleClick">
|
<el-radio-group v-model="currentState" style="margin-bottom: 15px;" @tab-click="handleClick">
|
||||||
|
<el-radio-button label="">全部</el-radio-button>
|
||||||
<el-radio-button label="0">生效中</el-radio-button>
|
<el-radio-button label="0">生效中</el-radio-button>
|
||||||
<el-radio-button label="1">已过期</el-radio-button>
|
<el-radio-button label="1">已过期</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
@@ -60,13 +61,12 @@
|
|||||||
align="center"
|
align="center"
|
||||||
label="优惠券名称">
|
label="优惠券名称">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="couponType"
|
|
||||||
header-align="center"
|
header-align="center"
|
||||||
align="center"
|
align="center"
|
||||||
label="优惠券类型" width="100px">
|
label="优惠券类型" width="100px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.couponType | getType}}
|
{{scope.row.effectType | getType}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@@ -115,6 +115,22 @@
|
|||||||
align="center"
|
align="center"
|
||||||
label="领取数量">
|
label="领取数量">
|
||||||
</el-table-column> -->
|
</el-table-column> -->
|
||||||
|
<el-table-column
|
||||||
|
prop="receiveCount"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.currentState"
|
||||||
|
:active-value ="0"
|
||||||
|
:inactive-value='1'
|
||||||
|
@change="changeStateHandle(scope.row.id, scope.row.currentState)"
|
||||||
|
active-text="发放中"
|
||||||
|
inactive-text="暂停发放">
|
||||||
|
</el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
fixed="right"
|
fixed="right"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
@@ -122,7 +138,7 @@
|
|||||||
width="150"
|
width="150"
|
||||||
label="操作">
|
label="操作">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="primary" size="small" plain @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
<el-button type="primary" size="small" plain @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||||
<el-button type="danger" size="small" plain @click="deleteHandle(scope.row.id)">删除</el-button>
|
<el-button type="danger" size="small" plain @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -154,7 +170,7 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
couponRange: '',
|
couponRange: '',
|
||||||
couponType:''
|
couponType:''
|
||||||
},
|
},
|
||||||
currentState:'0', // "currentState":""//当前状态 0 发放中 1结束
|
currentState:'', // "currentState":""//当前状态 0 发放中 1结束
|
||||||
dataList: [],
|
dataList: [],
|
||||||
rangList: global.rangList,
|
rangList: global.rangList,
|
||||||
TypeList: global.TypeList,
|
TypeList: global.TypeList,
|
||||||
@@ -197,9 +213,34 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
activated () {
|
activated () {
|
||||||
this.getDataList()
|
this.getDataList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 修改优惠券状态
|
||||||
|
changeStateHandle (id, state) {
|
||||||
|
console.log('进来了')
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/common/coupon/updateCouponState'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
id: id,
|
||||||
|
currentState: state
|
||||||
|
})
|
||||||
|
}).then(({data}) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '操作成功',
|
||||||
|
type:'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.getDataList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg)
|
||||||
|
}
|
||||||
|
}).catch((e) => {
|
||||||
|
this.$message.error(e.msg)
|
||||||
|
})
|
||||||
|
},
|
||||||
handleClick(){
|
handleClick(){
|
||||||
console.log(this.currentState)
|
console.log(this.currentState)
|
||||||
this.pageIndex = 1
|
this.pageIndex = 1
|
||||||
@@ -251,10 +292,11 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
this.dataListSelections = val
|
this.dataListSelections = val
|
||||||
},
|
},
|
||||||
// 新增 / 修改
|
// 新增 / 修改
|
||||||
addOrUpdateHandle (id) {
|
addOrUpdateHandle (id) {
|
||||||
this.addOrUpdateVisible = true
|
this.addOrUpdateVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.addOrUpdate.init(id)
|
this.$refs.addOrUpdate.init(id)
|
||||||
|
// this.addOrUpdateVisible = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
size="50%"
|
size="50%"
|
||||||
title="请选择"
|
title="用户优惠券列表"
|
||||||
:visible.sync="drawer"
|
:visible.sync="drawer"
|
||||||
:direction="direction"
|
:direction="direction"
|
||||||
:before-close="handleClose"
|
:before-close="handleClose"
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="id" label="优惠券类型">
|
<el-table-column prop="id" label="优惠券类型">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{scope.row.couponEntity.couponType | getType}}
|
{{scope.row.couponEntity.effectType | getType}}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="description" label="操作" width="100">
|
<el-table-column prop="description" label="操作" width="100">
|
||||||
@@ -306,11 +306,11 @@ export default {
|
|||||||
dialogHandleClose(){
|
dialogHandleClose(){
|
||||||
this.youVisible = false
|
this.youVisible = false
|
||||||
this.youForm.ids = undefined
|
this.youForm.ids = undefined
|
||||||
this.youForm.remark = ''
|
// this.youForm.remark = ''
|
||||||
|
|
||||||
},
|
},
|
||||||
surYou() {
|
surYou() {
|
||||||
if(this.youForm.ids.length == 0){
|
if(!this.youForm.ids){
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请选择优惠券',
|
message: '请选择优惠券',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
|
|||||||
@@ -385,7 +385,8 @@ export default {
|
|||||||
// console.log('editor ready!', quill)
|
// console.log('editor ready!', quill)
|
||||||
},
|
},
|
||||||
init(row) {
|
init(row) {
|
||||||
console.log("11111", row);
|
console.log("进来了吗?", row);
|
||||||
|
// if(!)
|
||||||
if (row && row.id) {
|
if (row && row.id) {
|
||||||
this.courseId = row.id
|
this.courseId = row.id
|
||||||
this.$http
|
this.$http
|
||||||
|
|||||||
412
src/views/modules/shop/proCouponList.vue
Normal file
412
src/views/modules/shop/proCouponList.vue
Normal file
@@ -0,0 +1,412 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-drawer
|
||||||
|
size="50%"
|
||||||
|
title="商品优惠券列表"
|
||||||
|
:visible.sync="drawer"
|
||||||
|
:direction="direction"
|
||||||
|
:before-close="handleClose"
|
||||||
|
>
|
||||||
|
<div style="padding:15px">
|
||||||
|
<!-- <el-button class="closeBtn" type="primary" plain
|
||||||
|
@click="handleClose">确定选中并关闭</el-button
|
||||||
|
> -->
|
||||||
|
<!-- <el-form
|
||||||
|
:inline="true"
|
||||||
|
:model="query"
|
||||||
|
@keyup.enter.native="getDataList()"
|
||||||
|
> -->
|
||||||
|
<!-- <el-form-item label="课程名称">
|
||||||
|
<el-input
|
||||||
|
v-model="query.courseName"
|
||||||
|
placeholder="课程名称"
|
||||||
|
clearable
|
||||||
|
></el-input>
|
||||||
|
</el-form-item> -->
|
||||||
|
<!-- <el-form-item> -->
|
||||||
|
<el-button type="primary" @click="getAllCoupon()"
|
||||||
|
>绑定新优惠券</el-button
|
||||||
|
>
|
||||||
|
<!-- </el-form-item> -->
|
||||||
|
<!-- </el-form> -->
|
||||||
|
</div>
|
||||||
|
<div style="padding: 15px">
|
||||||
|
<!-- {{dataList}} -->
|
||||||
|
<el-table
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
:data="dataList"
|
||||||
|
border
|
||||||
|
style="width: 100%; "
|
||||||
|
>
|
||||||
|
<!-- <el-table-column type="selection" > </el-table-column> -->
|
||||||
|
<el-table-column prop="id" label="名称">
|
||||||
|
<template slot-scope="scope">{{scope.row.couponEntity.couponName}}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column prop="id" label="获得途径">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.getType == 0">后台赠送<br/>
|
||||||
|
<i>原因:{{scope.row.remark}}</i>
|
||||||
|
</span>
|
||||||
|
<span v-if="scope.row.getType == 1">主动获取</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column> -->
|
||||||
|
<el-table-column prop="id" label="使用上限(x张)">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{scope.row.couponEntity.limitedCollar}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="id" label="使用门槛(元)">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{scope.row.couponEntity.useLevel}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="id" label="优惠券范围">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{scope.row.couponEntity.couponRange | getRange}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="id" label="优惠券类型">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{scope.row.couponEntity.effectType | getType}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="description" label="操作" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
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"
|
||||||
|
style="padding: 30px 0; text-align: center;"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
>
|
||||||
|
</el-pagination>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
<el-dialog
|
||||||
|
title="添加优惠券绑定"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="youVisible"
|
||||||
|
append-to-body
|
||||||
|
width="600px"
|
||||||
|
@close="dialogHandleClose"
|
||||||
|
>
|
||||||
|
<el-form :model="youForm" label-width="100px">
|
||||||
|
<el-form-item label="选择优惠券">
|
||||||
|
<el-select
|
||||||
|
v-model="youForm.ids"
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
reserve-keyword
|
||||||
|
placeholder="请输入优惠券名称"
|
||||||
|
:remote-method="getAllCoupon"
|
||||||
|
:loading="loading"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in couponList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.couponName"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- {{youForm.ids}} -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="surYou"
|
||||||
|
>绑 定</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="youVisible = false">取消</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "productCouponList",
|
||||||
|
props: ["productId"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
youVisible: false,
|
||||||
|
// userId: this.$router.query.userId,
|
||||||
|
drawer: true,
|
||||||
|
direction: "rtl",
|
||||||
|
dataList: [],
|
||||||
|
selected: [],
|
||||||
|
query: {
|
||||||
|
// courseName: ""
|
||||||
|
status: "",
|
||||||
|
getType: ""
|
||||||
|
},
|
||||||
|
couponList: [],
|
||||||
|
statusList: [
|
||||||
|
{
|
||||||
|
label: "未使用",
|
||||||
|
value: "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "已使用",
|
||||||
|
value: "1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "已过期",
|
||||||
|
value: "2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
typeList: [
|
||||||
|
{
|
||||||
|
label: "后台赠送",
|
||||||
|
value: "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "主动获取",
|
||||||
|
value: "1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
pageSize: 10,
|
||||||
|
pageIndex: 1,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
youForm: {
|
||||||
|
couponName:'',
|
||||||
|
ids:undefined
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
console.log("挂载", this.productId);
|
||||||
|
// this.userId =
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
// 格式化时间
|
||||||
|
getType (value) {
|
||||||
|
switch (value) {
|
||||||
|
case 0:
|
||||||
|
return '长期有效'
|
||||||
|
case 1:
|
||||||
|
return '领取生效'
|
||||||
|
case 2:
|
||||||
|
return '自定义'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getRange (value) {
|
||||||
|
switch (value) {
|
||||||
|
case 0:
|
||||||
|
|
||||||
|
return '无限制'
|
||||||
|
case 1:
|
||||||
|
return '课程券'
|
||||||
|
case 2:
|
||||||
|
return '课程品类券'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
deleteHandle (id) {
|
||||||
|
// var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||||
|
// return item.id
|
||||||
|
// })
|
||||||
|
this.$confirm(`确定对[id=${id}]进行删除操作?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/common/coupon/unbindCouponToProduct'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
"id": id
|
||||||
|
})
|
||||||
|
}).then(({data}) => {
|
||||||
|
if(data.code!== 0) return this.$message.error(data.msg)
|
||||||
|
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '解绑成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.getDataList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
dialogHandleClose(){
|
||||||
|
this.youVisible = false
|
||||||
|
this.youForm.ids = undefined
|
||||||
|
// this.youForm.remark = ''
|
||||||
|
|
||||||
|
},
|
||||||
|
surYou() {
|
||||||
|
if(!this.youForm.ids){
|
||||||
|
this.$message({
|
||||||
|
message: '请选择优惠券',
|
||||||
|
type: 'warning',
|
||||||
|
duration: 1500,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var data = {
|
||||||
|
"couponId": this.youForm.ids,
|
||||||
|
"productId": this.productId,
|
||||||
|
|
||||||
|
}
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/common/coupon/setCouponToProduct'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData(data)
|
||||||
|
}).then(({
|
||||||
|
data
|
||||||
|
}) => {
|
||||||
|
if (data.code!== 0) return this.$message.error(data.msg);
|
||||||
|
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: '绑定成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1500,
|
||||||
|
})
|
||||||
|
this.dialogHandleClose()
|
||||||
|
this.getDataList()
|
||||||
|
}
|
||||||
|
// else{
|
||||||
|
// this.$message({
|
||||||
|
// message: data.msg,
|
||||||
|
// type: 'error',
|
||||||
|
// duration: 1500,
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
givePersonCoupon() {
|
||||||
|
// this.youVisible = true
|
||||||
|
},
|
||||||
|
getAllCoupon() {
|
||||||
|
this.loading = true;
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/common/coupon/getCouponList"),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornData({
|
||||||
|
page: 1,
|
||||||
|
limit: 10,
|
||||||
|
couponName: this.youForm.couponName,
|
||||||
|
currentState: '0', //当前状态 0 发放中 1结束
|
||||||
|
couponType: '', //优惠券类型 0现金 1折扣
|
||||||
|
couponRange: '' //优惠卷范围 0无限制 1课程卷 2课程品类卷
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(({ data }) => {
|
||||||
|
if (data.code !== 0) return this.$message.error(data.msg);
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.couponList = data.couponPage.records;
|
||||||
|
this.youVisible = true
|
||||||
|
// this.totalPage = data.couponPage.total;
|
||||||
|
} else {
|
||||||
|
this.dataList = [];
|
||||||
|
// this.totalPage = 0;
|
||||||
|
}
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.$message.error(e.msg);
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleSelect(row) {
|
||||||
|
var _list = this.selected.map(item => item.id);
|
||||||
|
if (_list.includes(row.id)) {
|
||||||
|
this.$message({
|
||||||
|
message: "已选择该课程",
|
||||||
|
type: "warning"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.selected.push(row);
|
||||||
|
let index = this.dataList.findIndex(item => item.id === row.id);
|
||||||
|
this.dataList.splice(index, 1);
|
||||||
|
this.$message({
|
||||||
|
message: "选择成功",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
console.log("选择的课程", this.selected);
|
||||||
|
},
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.pageSize = val;
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
this.pageIndex = val;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
handleClose(done) {
|
||||||
|
this.$emit("close", this.selected);
|
||||||
|
this.selected = [];
|
||||||
|
},
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true;
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/common/coupon/couponToProductList"),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornData({
|
||||||
|
page: this.pageIndex,
|
||||||
|
limit: this.pageSize,
|
||||||
|
productId: this.productId
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(({ data }) => {
|
||||||
|
if (data.code != 0) return this.$message.error(data.msg);
|
||||||
|
// console.log('data',data)
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.dataList = data.couponToShopproductPage.records;
|
||||||
|
|
||||||
|
this.totalPage = data.couponToShopproductPage.total;
|
||||||
|
} else {
|
||||||
|
this.dataList = [];
|
||||||
|
this.totalPage = 0;
|
||||||
|
}
|
||||||
|
this.dataListLoading = false;
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.$message.error(e.msg);
|
||||||
|
this.dataListLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.closeBtn{position: absolute;right: 15px;top: 15px;}
|
||||||
|
</style>
|
||||||
@@ -142,7 +142,10 @@
|
|||||||
@click.native="handleEditCurriculum(scope.row.productId)"
|
@click.native="handleEditCurriculum(scope.row.productId)"
|
||||||
>新版修改</el-dropdown-item
|
>新版修改</el-dropdown-item
|
||||||
> -->
|
> -->
|
||||||
|
<el-dropdown-item
|
||||||
|
@click.native="showLinkCoupon(scope.row.productId)"
|
||||||
|
>购买赠优惠券</el-dropdown-item
|
||||||
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@click.native="handleEditCorrelation(scope.row.productId)"
|
@click.native="handleEditCorrelation(scope.row.productId)"
|
||||||
>图书与课程</el-dropdown-item
|
>图书与课程</el-dropdown-item
|
||||||
@@ -196,11 +199,12 @@
|
|||||||
<commonTags ref="commonTags"></commonTags>
|
<commonTags ref="commonTags"></commonTags>
|
||||||
<correlation ref="correlation"></correlation>
|
<correlation ref="correlation"></correlation>
|
||||||
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book>
|
<choose-book v-if="chooseBookVisible" :bookIds = bookIds ref="chooseBook" :chooseBookVisible = chooseBookVisible @closeBookf = "closeBookf"></choose-book>
|
||||||
|
<pro-coupon-list v-if="LinkCouponVisible" :productId="curProductId" @close="proCouponClose"></pro-coupon-list>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import proCouponList from "./proCouponList.vue";
|
||||||
import chooseBook from "./chooseBook.vue";
|
import chooseBook from "./chooseBook.vue";
|
||||||
import curriculum from "./curriculum.vue";
|
import curriculum from "./curriculum.vue";
|
||||||
import AddOrUpdate from "./shopproduct-add-or-update";
|
import AddOrUpdate from "./shopproduct-add-or-update";
|
||||||
@@ -225,7 +229,10 @@ export default {
|
|||||||
addOrUpdateVisible: false,
|
addOrUpdateVisible: false,
|
||||||
chooseBookVisible: false,
|
chooseBookVisible: false,
|
||||||
curriculumVisible: false,
|
curriculumVisible: false,
|
||||||
bookIds: []
|
bookIds: [],
|
||||||
|
LinkCouponVisible:false, // 显示优惠券弹窗
|
||||||
|
curProductId: undefined, // 当前的商品id
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -233,13 +240,23 @@ export default {
|
|||||||
AddOrUpdate,
|
AddOrUpdate,
|
||||||
chooseBook,
|
chooseBook,
|
||||||
commonTags,
|
commonTags,
|
||||||
correlation
|
correlation,
|
||||||
|
proCouponList
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
this.getGoodsTypeList();
|
this.getGoodsTypeList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
showLinkCoupon(id) {
|
||||||
|
this.curProductId = id;
|
||||||
|
this.LinkCouponVisible = true;
|
||||||
|
|
||||||
|
},
|
||||||
|
proCouponClose() {
|
||||||
|
this.LinkCouponVisible = false;
|
||||||
|
},
|
||||||
|
|
||||||
getGoodsTypeList() {
|
getGoodsTypeList() {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl("/book/sysdictdata/selectByType/goodsType"),
|
url: this.$http.adornUrl("/book/sysdictdata/selectByType/goodsType"),
|
||||||
|
|||||||
Reference in New Issue
Block a user