优惠券
This commit is contained in:
@@ -8,3 +8,6 @@
|
|||||||
export default {
|
export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.flexBox{ display: flex;}
|
||||||
|
</style>
|
||||||
|
|||||||
178
src/components/selectPro.vue
Normal file
178
src/components/selectPro.vue
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
<template>
|
||||||
|
<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
|
||||||
|
@click="
|
||||||
|
pageIndex = 1;
|
||||||
|
getDataList();
|
||||||
|
"
|
||||||
|
>查询</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div style="padding: 15px">
|
||||||
|
<el-table v-loading="dataListLoading"
|
||||||
|
:data="dataList"
|
||||||
|
border
|
||||||
|
style="width: 100%; "
|
||||||
|
>
|
||||||
|
<!-- <el-table-column type="selection" > </el-table-column> -->
|
||||||
|
<el-table-column prop="title" label="名称" > </el-table-column>
|
||||||
|
<el-table-column prop="description" label="操作" width="100">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button :disabled="checkBtnStatus(scope.row)"
|
||||||
|
type="primary" plain
|
||||||
|
size="small"
|
||||||
|
@click="handleSelect(scope.row)"
|
||||||
|
>
|
||||||
|
{{checkBtnStatus(scope.row) ? '已选择' : '选择'}}
|
||||||
|
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "selectPro",
|
||||||
|
props: ["requesturl", "oldData"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
drawer: true,
|
||||||
|
direction: "rtl",
|
||||||
|
dataList: [],
|
||||||
|
selected: [],
|
||||||
|
query: {
|
||||||
|
courseName: ""
|
||||||
|
},
|
||||||
|
pageSize: 10,
|
||||||
|
pageIndex: 1,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
console.log("挂载");
|
||||||
|
this.getDataList();
|
||||||
|
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkBtnStatus(val) {
|
||||||
|
let index = this.oldData.findIndex(item => item.id === val.id);
|
||||||
|
if(index > -1){
|
||||||
|
return true
|
||||||
|
}else{
|
||||||
|
return 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(this.requesturl),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornData({
|
||||||
|
page: this.pageIndex,
|
||||||
|
limit: this.pageSize,
|
||||||
|
courseName: this.query.courseName,
|
||||||
|
type:1,
|
||||||
|
medicalId:"",//医学标签id,type为1时生效,空字符串为全部
|
||||||
|
sociologyId:""//国学标签id,type为2时生效,空字符串为全部
|
||||||
|
})
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if(data.code != 0) return this.$message.error(data.msg);
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.dataList = data.page.records;
|
||||||
|
this.totalPage = data.page.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>
|
||||||
@@ -1,7 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible" width="900px" @close="closeDia">
|
<div v-loading.fullscreen.lock="getCouponInfoLoad">
|
||||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
<el-dialog
|
||||||
label-width="100px">
|
:title="!dataForm.id ? '新增' : '修改'"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="visible"
|
||||||
|
width="900px"
|
||||||
|
@close="closeDia"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
:model="dataForm"
|
||||||
|
:rules="dataRule"
|
||||||
|
ref="dataForm"
|
||||||
|
@keyup.enter.native="dataFormSubmit()"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="优惠卷类型" prop="couponType">
|
<el-form-item label="优惠卷类型" prop="couponType">
|
||||||
@@ -11,51 +23,144 @@
|
|||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8"><el-form-item label="使用门槛" prop="useLevel">
|
<el-col :span="8"
|
||||||
<el-input v-model="dataForm.useLevel" placeholder="" oninput="value=value.replace(/[^\d.]/g,'')">
|
><el-form-item label="使用门槛" prop="useLevel">
|
||||||
|
<el-input
|
||||||
|
v-model="dataForm.useLevel"
|
||||||
|
placeholder=""
|
||||||
|
oninput="value=value.replace(/[^\d.]/g,'')"
|
||||||
|
>
|
||||||
<template slot="append">元</template>
|
<template slot="append">元</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
</el-form-item></el-col>
|
|
||||||
<el-col :span="8"><el-form-item label="优惠卷范围" prop="couponRange">
|
|
||||||
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
|
|
||||||
<el-select v-model="dataForm.couponRange" placeholder="请选择">
|
|
||||||
<el-option
|
|
||||||
v-for="item in rangList"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item></el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="10">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="优惠券名称" prop="couponName">
|
|
||||||
<el-input v-model="dataForm.couponName" placeholder="名称"></el-input>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="面额:" prop="couponAmount">
|
<el-form-item label="面额:" prop="couponAmount">
|
||||||
<el-input v-model="dataForm.couponAmount" placeholder="面额" oninput="value=value.replace(/[^\d.]/g,'')">
|
<el-input
|
||||||
|
v-model="dataForm.couponAmount"
|
||||||
|
placeholder="面额"
|
||||||
|
oninput="value=value.replace(/[^\d.]/g,'')"
|
||||||
|
>
|
||||||
<template slot="append">元</template>
|
<template slot="append">元</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="优惠券名称" prop="couponName">
|
||||||
|
<el-input
|
||||||
|
v-model="dataForm.couponName"
|
||||||
|
placeholder="名称"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="总发行量" prop="totalCirculation">
|
||||||
|
<el-input
|
||||||
|
v-model="dataForm.totalCirculation"
|
||||||
|
placeholder="发行数量"
|
||||||
|
oninput="value=value.replace(/[^\d.]/g,'')"
|
||||||
|
>
|
||||||
|
<template slot="append">张</template>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="每人限领:" prop="limitedCollar">
|
<el-form-item label="每人限领:" prop="limitedCollar">
|
||||||
<el-input v-model="dataForm.limitedCollar" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="">
|
<el-input
|
||||||
|
v-model="dataForm.limitedCollar"
|
||||||
|
oninput="value=value.replace(/[^\d.]/g,'')"
|
||||||
|
placeholder=""
|
||||||
|
>
|
||||||
<template slot="append">张</template>
|
<template slot="append">张</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-row ::gutter="10"> </el-row>
|
||||||
<el-row ::gutter="10">
|
<el-row ::gutter="10">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="优惠卷范围" prop="couponRange">
|
||||||
|
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
|
||||||
|
<el-select
|
||||||
|
v-model="dataForm.couponRange"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="changeRange"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in rangList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16" v-if="dataForm.couponRange == 2">
|
||||||
|
<el-form-item label="添加绑定" prop="rangeInfo" width="100%">
|
||||||
|
<!-- <el-input v-model="dataForm.type" placeholder="优惠卷类型"></el-input> -->
|
||||||
|
<!-- {{cateSelectLinkList}} -->
|
||||||
|
<el-select
|
||||||
|
v-model="cateSelectLinkList"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择课程类目"
|
||||||
|
@change="changeCate"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in courseCateList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.title"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-if="dataForm.couponRange == 1">
|
||||||
|
<el-form-item label="" prop="rangeInfo" width="100%">
|
||||||
|
<div class="flexBox">
|
||||||
|
<el-table v-if="proSelectLinkList.length > 0" :data="proSelectLinkList">
|
||||||
|
<el-table-column label="课程名称">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.title }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="封面">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div
|
||||||
|
v-if="scope.row.image"
|
||||||
|
style="width:100%;display: flex;
|
||||||
|
align-items: center;justify-content: center;"
|
||||||
|
>
|
||||||
|
<img :src="scope.row.image" alt="" width="40px" height="40px" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="danger" @click="delCourse(scope.row.id)" size="mini"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div
|
||||||
|
style="text-align:center; margin-top: 20px"
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="addLinkPro">添加绑定</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row ::gutter="10">
|
<el-row ::gutter="10">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
@@ -66,51 +171,86 @@
|
|||||||
<el-radio :label="2">自定义</el-radio>
|
<el-radio :label="2">自定义</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开始时间" prop="effectTime" v-if="dataForm.effectType == '2'">
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
label="开始时间"
|
||||||
|
prop="effectTime"
|
||||||
|
v-if="dataForm.effectType == '2'"
|
||||||
|
>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="dataForm.effectTime" @change="datePicked"
|
v-model="dataForm.effectTime"
|
||||||
type="datetime" value-format="timestamp"
|
@change="datePicked"
|
||||||
|
type="datetime"
|
||||||
|
value-format="timestamp"
|
||||||
placeholder="选择日期时间"
|
placeholder="选择日期时间"
|
||||||
default-time="12:00:00">
|
default-time="12:00:00"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item
|
||||||
|
label="结束时间"
|
||||||
|
prop="expireTime"
|
||||||
|
v-if="dataForm.effectType == '2'"
|
||||||
|
>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dataForm.expireTime"
|
||||||
|
@change="datePicked"
|
||||||
|
type="datetime"
|
||||||
|
value-format="timestamp"
|
||||||
|
placeholder="选择日期时间"
|
||||||
|
default-time="12:00:00"
|
||||||
|
>
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" v-show="dataForm.effectType == '1'">
|
<el-col :span="8" v-show="dataForm.effectType == '1'">
|
||||||
<el-form-item label="时效" prop="validity">
|
<el-form-item label="时效" prop="validity">
|
||||||
<el-input placeholder="" v-model="dataForm.validity" oninput="value=value.replace(/[^\d.]/g,'')">
|
<el-input
|
||||||
|
placeholder=""
|
||||||
|
v-model="dataForm.validity"
|
||||||
|
oninput="value=value.replace(/[^\d.]/g,'')"
|
||||||
|
>
|
||||||
<template slot="append">天</template>
|
<template slot="append">天</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row ::gutter="10">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="总发行量" prop="totalCirculation">
|
|
||||||
<el-input v-model="dataForm.totalCirculation" placeholder="发行数量" oninput="value=value.replace(/[^\d.]/g,'')">
|
|
||||||
<template slot="append">张</template>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="封面图" prop="couponUrl">
|
<el-form-item label="封面图" prop="couponUrl">
|
||||||
<el-upload :limit="1" class="el-uploadfeng"
|
<el-upload
|
||||||
:action= "baseUrl + '/oss/fileoss'" list-type="picture-card"
|
:limit="1"
|
||||||
:on-preview="handlePictureCardPreview" :file-list="fileList" :on-success="handlePicSuccess"
|
class="el-uploadfeng"
|
||||||
accept=".jpeg,.jpg,.gif,.png" :on-remove="handleRemove">
|
:action="baseUrl + '/oss/fileoss'"
|
||||||
|
list-type="picture-card"
|
||||||
|
:on-preview="handlePictureCardPreview"
|
||||||
|
:file-list="fileList"
|
||||||
|
:on-success="handlePicSuccess"
|
||||||
|
accept=".jpeg,.jpg,.gif,.png"
|
||||||
|
:on-remove="handleRemove"
|
||||||
|
>
|
||||||
<i class="el-icon-plus"></i>
|
<i class="el-icon-plus"></i>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
|
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
|
||||||
<img width="100%" :src="dataForm.couponUrl" alt="">
|
<img width="100%" :src="dataForm.couponUrl" alt="" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="8">
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="dataForm.remark" placeholder="备注" type="textarea" rows="2" autosize>
|
<el-input
|
||||||
|
v-model="dataForm.remark"
|
||||||
|
placeholder="备注"
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
autosize
|
||||||
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -120,75 +260,91 @@
|
|||||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<selectPro ref="selectPro" v-if="showSelectPro" @close="selectProClose" :requesturl = "requesturl" :oldData="proSelectLinkList"></selectPro>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import global from '../../common/common.vue' //引入共用组间
|
import selectPro from '../../../components/selectPro.vue'
|
||||||
|
import global from "../../common/common.vue"; //引入共用组间
|
||||||
export default {
|
export default {
|
||||||
baseUrl:global.baseUrl,
|
baseUrl: global.baseUrl,
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
baseUrl:global.baseUrl,
|
requesturl:'', // 课程的请求地址
|
||||||
|
showSelectPro:false,
|
||||||
|
baseUrl: global.baseUrl,
|
||||||
visible: true,
|
visible: true,
|
||||||
options2: [{
|
options2: [
|
||||||
|
{
|
||||||
value: 0,
|
value: 0,
|
||||||
label: '商品'
|
label: "商品"
|
||||||
},{
|
},
|
||||||
|
{
|
||||||
value: 1,
|
value: 1,
|
||||||
label: '电子书'
|
label: "电子书"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
options: [{
|
options: [
|
||||||
|
{
|
||||||
value: 0,
|
value: 0,
|
||||||
label: '现金券'
|
label: "现金券"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
value: 1,
|
value: 1,
|
||||||
label: '折扣券'
|
label: "折扣券"
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
rangList: global.rangList,
|
rangList: global.rangList,
|
||||||
TypeList: global.TypeList,
|
TypeList: global.TypeList,
|
||||||
dialogVisible:false,
|
dialogVisible: false,
|
||||||
fileList: [], // 封面图
|
fileList: [], // 封面图
|
||||||
|
rangeInfo: [],
|
||||||
|
courseCateList: [], //课程品类列表
|
||||||
|
selectLinkList: [], // 选中的商品列表()
|
||||||
|
cateSelectLinkList: [], // 选中的课程品类列表
|
||||||
|
proSelectLinkList: [], // 选中的商品列表()
|
||||||
dataForm: {
|
dataForm: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
couponType:0, //优惠券类型 0现金 1折扣
|
couponType: 0, //优惠券类型 0现金 1折扣
|
||||||
couponName:'', //优惠券名称
|
couponName: "", //优惠券名称
|
||||||
couponAmount : undefined, //优惠券面额
|
couponAmount: undefined, //优惠券面额
|
||||||
couponUrl: '', //优惠券封面
|
couponUrl: "", //优惠券封面
|
||||||
limitedCollar:1, //每人限领
|
limitedCollar: 1, //每人限领
|
||||||
validity : 7, //时效(天)
|
validity: 7, //时效(天)
|
||||||
effectType: 0, //生效方式 0长期有效 1领取生效 2自定义
|
effectType: 0, //生效方式 0长期有效 1领取生效 2自定义
|
||||||
effectTime :undefined, //生效日期
|
effectTime: null, //生效日期
|
||||||
expireTime: undefined, //截止日期
|
expireTime: null, //截止日期
|
||||||
totalCirculation : 100, //总发行数量
|
totalCirculation: 100, //总发行数量
|
||||||
remark: '', //备注
|
remark: "", //备注
|
||||||
useLevel : undefined, //使用门槛
|
useLevel: undefined, //使用门槛
|
||||||
couponRange : '', //优惠卷范围 0无限制 1课程卷 2课程品类卷
|
couponRange: "", //优惠卷范围 0无限制 1课程卷 2课程品类卷
|
||||||
rangeInfo:"",//范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割)
|
rangeInfo: "" //范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
getCouponInfoLoad: false, // 获取优惠券loadding
|
||||||
|
|
||||||
dataRule: {
|
dataRule: {
|
||||||
couponType: [
|
couponType: [
|
||||||
{ required: true, message: '请填写本项', trigger: 'blur' }
|
{ required: true, message: "请填写本项", trigger: "blur" }
|
||||||
],
|
],
|
||||||
couponName: [
|
couponName: [
|
||||||
{ required: true, message: '名称不能为空', trigger: 'blur' }
|
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
couponAmount: [
|
couponAmount: [
|
||||||
{ required: true, message: '优惠券面额不能为空', trigger: 'blur' }
|
{ required: true, message: "优惠券面额不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
effectType: [
|
effectType: [
|
||||||
{ required: true, message: '生效方式不能为空', trigger: 'blur' }
|
{ required: true, message: "生效方式不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
// validity: [
|
// validity: [
|
||||||
// { required: true, message: '时效不能为空', trigger: 'blur' }
|
// { required: true, message: '时效不能为空', trigger: 'blur' }
|
||||||
// ],
|
// ],
|
||||||
couponRange: [
|
couponRange: [
|
||||||
{ required: true, message: '商品类型不能为空', trigger: 'blur' }
|
{ required: true, message: "商品类型不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
useLevel: [
|
useLevel: [
|
||||||
{ required: true, message: '使用门槛;0表示无门槛', trigger: 'blur' }
|
{ required: true, message: "使用门槛;0表示无门槛", trigger: "blur" }
|
||||||
],
|
]
|
||||||
// startTime: [
|
// startTime: [
|
||||||
// { required: true, message: '开始使用时间不能为空', trigger: 'blur' }
|
// { required: true, message: '开始使用时间不能为空', trigger: 'blur' }
|
||||||
// ],
|
// ],
|
||||||
@@ -220,36 +376,143 @@ export default {
|
|||||||
// { required: true, message: '可领取的会员类型:0->无限制不能为空', trigger: 'blur' }
|
// { required: true, message: '可领取的会员类型:0->无限制不能为空', trigger: 'blur' }
|
||||||
// ]
|
// ]
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
},
|
||||||
|
async created(){
|
||||||
|
// if (e == 2) {
|
||||||
|
this.courseCateList = await this.getCourseCateList();
|
||||||
|
console.log("this.courseCateList", await this.getCourseCateList());
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
selectProClose(data){
|
||||||
|
console.log('data', data)
|
||||||
|
this.showSelectPro = false
|
||||||
|
this.requesturl = ''
|
||||||
|
if(data.length > 0){
|
||||||
|
this.proSelectLinkList = this.proSelectLinkList.concat(data)
|
||||||
|
var list = [...this.proSelectLinkList]
|
||||||
|
this.proSelectLinkList = [...new Map(list.map(item => [item.id, item])).values()];
|
||||||
|
// this.dataForm.rangeInfo = this.proSelectLinkList.map( item => item.id).join(',')
|
||||||
|
console.log('去重后', this.proSelectLinkList)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addLinkPro(){
|
||||||
|
this.showSelectPro = true
|
||||||
|
this.requesturl = '/master/course/getCourseList'
|
||||||
|
},
|
||||||
|
changeCate(e) {
|
||||||
|
console.log("e", e);
|
||||||
|
this.cateSelectLinkList = e;
|
||||||
|
// this.dataForm.rangeInfo = e.join(",");
|
||||||
|
},
|
||||||
|
async changeRange(e) {
|
||||||
|
console.log("范围切换", e);
|
||||||
|
// this.dataForm.couponRange = e
|
||||||
|
// this.getDataList()
|
||||||
|
},
|
||||||
|
async getCourseCateList() {
|
||||||
|
var list = [];
|
||||||
|
await this.$http({
|
||||||
|
url: this.$http.adornUrl("/master/courseMedical/getCourseMedicalList"),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornData({})
|
||||||
|
})
|
||||||
|
.then(async ({ data }) => {
|
||||||
|
if (data.code !== 0) return this.$message.error(data.msg);
|
||||||
|
console.log("data.Medicals", data.Medicals);
|
||||||
|
if (data && data.code == 0) {
|
||||||
|
this.courseCateList = data.Medicals;
|
||||||
|
} else {
|
||||||
|
this.courseCateList = [];
|
||||||
|
}
|
||||||
|
// this.dataListLoading = false
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
this.$message.error(err.msg);
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
},
|
||||||
init(id) {
|
init(id) {
|
||||||
this.dataForm.id = id || 0
|
this.dataForm.id = id || 0;
|
||||||
this.visible = true
|
this.getCouponInfoLoad = true;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs['dataForm'].resetFields()
|
this.$refs["dataForm"].resetFields();
|
||||||
if (this.dataForm.id) {
|
if (this.dataForm.id) {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(`/common/coupon/getCouponInfo`),
|
url: this.$http.adornUrl(`/common/coupon/getCouponInfo`),
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: this.$http.adornData(
|
data: this.$http.adornData({ id: this.dataForm.id })
|
||||||
{ id: this.dataForm.id}
|
|
||||||
)
|
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
if(data.code !==0) return this.$message.error(data.msg)
|
if (data.code !== 0) return this.$message.error(data.msg);
|
||||||
if (data && data.code === 0) {
|
this.visible = true;
|
||||||
this.dataForm = data.couponEntity
|
this.getCouponInfoLoad = false;
|
||||||
|
if (data && data.code == 0) {
|
||||||
|
this.dataForm = data.couponEntity;
|
||||||
|
if (
|
||||||
|
this.dataForm.effectTime &&
|
||||||
|
this.dataForm.effectTime != null
|
||||||
|
) {
|
||||||
|
this.dataForm.effectTime = new Date(
|
||||||
|
data.couponEntity.effectTime
|
||||||
|
).getTime();
|
||||||
|
console.log("this.dataForm.effectTime", this.dataForm.effectTime );
|
||||||
|
} else {
|
||||||
|
this.dataForm.effectTime = null;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
this.dataForm.expireTime &&
|
||||||
|
this.dataForm.expireTime != null
|
||||||
|
) {
|
||||||
|
this.dataForm.expireTime = new Date(
|
||||||
|
data.couponEntity.expireTime
|
||||||
|
).getTime();
|
||||||
|
console.log(
|
||||||
|
"this.dataForm.expireTime",
|
||||||
|
this.dataForm.expireTime
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.dataForm.expireTime = null;
|
||||||
|
}
|
||||||
|
if(data.couponEntity.rangeList && data.couponEntity.rangeList.length > 0){
|
||||||
|
this.selectLinkList = data.couponEntity.rangeList
|
||||||
|
}else{
|
||||||
|
this.selectLinkList = []
|
||||||
|
}
|
||||||
|
if(this.dataForm.couponRange == 2 && this.dataForm.rangeInfo.length > 0 ){
|
||||||
|
|
||||||
|
// var list1 = [...this.selectLinkList]
|
||||||
|
// list1.forEach( item => {
|
||||||
|
// item.label = item.name
|
||||||
|
// })
|
||||||
|
// this.cateSelectLinkList = this.selectLinkList
|
||||||
|
var ss = this.dataForm.rangeInfo.split(',')
|
||||||
|
|
||||||
|
this.cateSelectLinkList = ss.map(element => parseInt(element) );
|
||||||
|
|
||||||
|
}else if(this.dataForm.couponRange == 1){
|
||||||
|
this.proSelectLinkList = this.selectLinkList
|
||||||
|
}else{
|
||||||
|
this.cateSelectLinkList = []
|
||||||
|
this.proSelectLinkList = []
|
||||||
|
}
|
||||||
// this.dataForm.couponUrl = {name:'', url:}
|
// this.dataForm.couponUrl = {name:'', url:}
|
||||||
if (data.couponEntity.couponUrl != "") {
|
if (this.dataForm.couponUrl && this.dataForm.couponUrl != "") {
|
||||||
var img = { name: '', url: data.ouponEntity.couponUrl }
|
var img = { name: "", url: this.dataForm.couponUrl };
|
||||||
var attr = []
|
var attr = [];
|
||||||
attr.push(img)
|
attr.push(img);
|
||||||
this.fileList = attr
|
this.fileList = attr;
|
||||||
|
}else{
|
||||||
|
this.fileList = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
this.$message.error(err.msg);
|
||||||
|
this.getCouponInfoLoad = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
handlePicSuccess(res, file) {
|
handlePicSuccess(res, file) {
|
||||||
if (res.msg == "success") {
|
if (res.msg == "success") {
|
||||||
@@ -260,72 +523,147 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
this.dataForm.couponUrl = '';
|
this.dataForm.couponUrl = "";
|
||||||
},
|
},
|
||||||
handlePictureCardPreview(file) {
|
handlePictureCardPreview(file) {
|
||||||
this.dataForm.couponUrl = file.url;
|
this.dataForm.couponUrl = file.url;
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
},
|
},
|
||||||
datePicked(){
|
datePicked() {
|
||||||
console.log(this.dataForm.startTime)
|
console.log(this.dataForm.startTime);
|
||||||
},
|
},
|
||||||
closeDia(){
|
delCourse(id) {
|
||||||
this.visible = false
|
console.log('id',id)
|
||||||
this.dataForm.couponUrl = '';
|
let index = this.proSelectLinkList.findIndex(item => item.id === id);
|
||||||
this.$refs.dataForm.resetFields()
|
this.proSelectLinkList.splice(index,1)
|
||||||
this.dataForm ={
|
},
|
||||||
couponType:null,
|
closeDia() {
|
||||||
couponRange:null, // 使用商品类型
|
this.visible = false;
|
||||||
useLevel:null, // 使用门槛
|
this.dataForm.couponUrl = "";
|
||||||
id: 0,
|
this.$refs.dataForm.resetFields();
|
||||||
couponName:'',
|
this.dataForm = {
|
||||||
couponAmount:null,
|
id: undefined,
|
||||||
couponUrl:'',
|
couponType: 0, //优惠券类型 0现金 1折扣
|
||||||
limitedCollar:null,
|
couponName: "", //优惠券名称
|
||||||
validity:'',
|
couponAmount: undefined, //优惠券面额
|
||||||
effectType: null, // 生效方式
|
couponUrl: "", //优惠券封面
|
||||||
effectTime:null,
|
limitedCollar: 1, //每人限领
|
||||||
totalCirculation:null,
|
validity: 7, //时效(天)
|
||||||
remark:''
|
effectType: 0, //生效方式 0长期有效 1领取生效 2自定义
|
||||||
|
effectTime: null, //生效日期
|
||||||
}
|
expireTime: null, //截止日期
|
||||||
|
totalCirculation: 100, //总发行数量
|
||||||
|
remark: "", //备注
|
||||||
|
useLevel: undefined, //使用门槛
|
||||||
|
couponRange: "", //优惠卷范围 0无限制 1课程卷 2课程品类卷
|
||||||
|
rangeInfo: "" //范围详情(课程卷是课程id,分割 课程品类卷是课程分类根id,分割)
|
||||||
|
};
|
||||||
|
this.cateSelectLinkList = []
|
||||||
|
this.selectLinkList = []
|
||||||
|
this.fileList = []
|
||||||
},
|
},
|
||||||
|
|
||||||
// 表单提交
|
// 表单提交
|
||||||
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.effectType == 2) {
|
||||||
|
if (
|
||||||
|
this.dataForm.effectTime == null ||
|
||||||
|
this.dataForm.effectTime == ""
|
||||||
|
) {
|
||||||
|
this.$message.error("生效时间不能为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
this.dataForm.expireTime == null ||
|
||||||
|
this.dataForm.expireTime == ""
|
||||||
|
) {
|
||||||
|
this.$message.error("截止时间不能为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.dataForm.effectTime > this.dataForm.expireTime) {
|
||||||
|
this.$message.error("生效时间不能大于截止时间");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this.dataForm.effectType == 1) {
|
||||||
|
if (
|
||||||
|
this.dataForm.validity == null ||
|
||||||
|
this.dataForm.validity == "" ||
|
||||||
|
this.dataForm.validity == 0
|
||||||
|
) {
|
||||||
|
this.$message.error("时效不能为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.dataForm.couponRange == 2) {
|
||||||
|
if(this.cateSelectLinkList.length == 0) return this.$message.error("请选择课程品类");
|
||||||
|
this.dataForm.rangeInfo = this.cateSelectLinkList.join(',')
|
||||||
|
// if (
|
||||||
|
// this.dataForm.rangeInfo == null ||
|
||||||
|
// this.dataForm.rangeInfo == ""
|
||||||
|
// ) {
|
||||||
|
// this.$message.error("请选择课程品类");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this.dataForm.couponRange == 1) {
|
||||||
|
if(this.proSelectLinkList.length == 0) return this.$message.error("请选择课程");
|
||||||
|
this.dataForm.rangeInfo = this.proSelectLinkList.map( item => item.id).join(',')
|
||||||
|
// if (
|
||||||
|
// this.dataForm.rangeInfo == null ||
|
||||||
|
// this.dataForm.rangeInfo == ""
|
||||||
|
// ) {
|
||||||
|
// this.$message.error("请选择课程");
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
if(this.dataForm.useLevel < this.dataForm.couponAmount) return this.$message.error("优惠券面额不能大于使用门槛");
|
||||||
|
console.log('this.dataForm', this.dataForm)
|
||||||
|
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl(`/common/coupon/${!this.dataForm.id ? 'addCoupon' : 'updateCoupon'}`),
|
url: this.$http.adornUrl(
|
||||||
method: 'post',
|
`/common/coupon/${
|
||||||
|
!this.dataForm.id ? "addCoupon" : "updateCoupon"
|
||||||
|
}`
|
||||||
|
),
|
||||||
|
method: "post",
|
||||||
data: this.$http.adornData({
|
data: this.$http.adornData({
|
||||||
...this.dataForm
|
...this.dataForm
|
||||||
})
|
})
|
||||||
}).then(({ data }) => {
|
})
|
||||||
if(data.code!==0) return this.$message.error(data.msg)
|
.then(({ data }) => {
|
||||||
|
if (data.code !== 0) return this.$message.error(data.msg);
|
||||||
|
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
|
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '操作成功',
|
message: "操作成功",
|
||||||
type: 'success',
|
type: "success",
|
||||||
duration: 1500,
|
duration: 1500,
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
this.dataForm.couponUrl = ''
|
this.dataForm.couponUrl = "";
|
||||||
this.closeDia()
|
this.closeDia();
|
||||||
this.$emit('refreshDataList')
|
this.$emit("refreshDataList");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(err => {
|
||||||
|
this.$message.error(err.msg);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
});
|
||||||
this.$message.error(err.msg)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
components: {
|
||||||
|
selectPro
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.el-form-item__label {
|
.el-form-item__label {
|
||||||
@@ -341,6 +679,6 @@ export default {
|
|||||||
width: 60px;
|
width: 60px;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
line-height: 70px;
|
line-height: 70px;
|
||||||
|
}
|
||||||
}}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input v-model="dataForm.couponName" placeholder="参数名" clearable></el-input>
|
<el-input v-model="dataForm.couponName" placeholder="参数名" clearable></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="优惠卷范围">
|
<el-form-item label="优惠券范围">
|
||||||
<el-select v-model="dataForm.couponRange" placeholder="请选择" @change="pageIndex = 1; getDataList()">
|
<el-select v-model="dataForm.couponRange" placeholder="请选择" @change="pageIndex = 1; getDataList()">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in rangList"
|
v-for="item in rangList"
|
||||||
@@ -42,12 +42,12 @@
|
|||||||
v-loading="dataListLoading"
|
v-loading="dataListLoading"
|
||||||
@selection-change="selectionChangeHandle"
|
@selection-change="selectionChangeHandle"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
<el-table-column
|
<!-- <el-table-column
|
||||||
type="selection"
|
type="selection"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
align="center"
|
align="center"
|
||||||
width="50">
|
width="50">
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="id"
|
prop="id"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
@@ -64,7 +64,10 @@
|
|||||||
prop="couponType"
|
prop="couponType"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
align="center"
|
align="center"
|
||||||
label="优惠卷类型" width="100px">
|
label="优惠券类型" width="100px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{scope.row.couponType | getType}}
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="couponAmount"
|
prop="couponAmount"
|
||||||
@@ -119,8 +122,8 @@
|
|||||||
width="150"
|
width="150"
|
||||||
label="操作">
|
label="操作">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
<el-button type="primary" size="small" plain @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||||
<!-- <el-button type="text" size="small" @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>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -160,14 +163,23 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
totalPage: 0,
|
totalPage: 0,
|
||||||
dataListLoading: false,
|
dataListLoading: false,
|
||||||
dataListSelections: [],
|
dataListSelections: [],
|
||||||
addOrUpdateVisible: false
|
addOrUpdateVisible: false,
|
||||||
|
courseCateList:[]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
// 格式化时间
|
// 格式化时间
|
||||||
|
getType (value) {
|
||||||
|
switch (value) {
|
||||||
|
case 0:
|
||||||
|
return '长期有效'
|
||||||
|
case 1:
|
||||||
|
return '领取生效'
|
||||||
|
case 2:
|
||||||
|
return '自定义'
|
||||||
|
}
|
||||||
|
},
|
||||||
getRange (value) {
|
getRange (value) {
|
||||||
// if (value && value != 0) {
|
|
||||||
// console.log('555555555',value)
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
@@ -177,9 +189,6 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
case 2:
|
case 2:
|
||||||
return '课程品类券'
|
return '课程品类券'
|
||||||
}
|
}
|
||||||
// } else {
|
|
||||||
// return ''
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -189,6 +198,8 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
this.getDataList()
|
this.getDataList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
|
||||||
handleClick(){
|
handleClick(){
|
||||||
console.log(this.currentState)
|
console.log(this.currentState)
|
||||||
this.pageIndex = 1
|
this.pageIndex = 1
|
||||||
@@ -219,6 +230,9 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
this.totalPage = 0
|
this.totalPage = 0
|
||||||
}
|
}
|
||||||
this.dataListLoading = false
|
this.dataListLoading = false
|
||||||
|
}).catch((e) => {
|
||||||
|
this.$message.error(e.msg)
|
||||||
|
this.dataListLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 每页数
|
// 每页数
|
||||||
@@ -245,18 +259,20 @@ import commentsListVue from '../book/commentsList.vue'
|
|||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
deleteHandle (id) {
|
deleteHandle (id) {
|
||||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
// var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||||
return item.id
|
// return item.id
|
||||||
})
|
// })
|
||||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
this.$confirm(`确定对[id=${id}]进行删除操作?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/book/coupon/delete'),
|
url: this.$http.adornUrl('/common/coupon/delCoupon'),
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: this.$http.adornData(ids, false)
|
data: this.$http.adornData({
|
||||||
|
id: id
|
||||||
|
})
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
|||||||
451
src/views/modules/coupon/userCouponList.vue
Normal file
451
src/views/modules/coupon/userCouponList.vue
Normal file
@@ -0,0 +1,451 @@
|
|||||||
|
<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 label="优惠券状态">
|
||||||
|
<el-select
|
||||||
|
v-model="query.status"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="
|
||||||
|
pageIndex = 1;
|
||||||
|
getDataList();
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in statusList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="获得类型">
|
||||||
|
<el-select
|
||||||
|
v-model="query.getType"
|
||||||
|
placeholder="请选择"
|
||||||
|
@change="
|
||||||
|
pageIndex = 1;
|
||||||
|
getDataList();
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeList"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</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">
|
||||||
|
生效时间:{{scope.row.couponEntity.effectTime}}<br/>
|
||||||
|
结束时间:{{scope.row.couponEntity.expireTime}}
|
||||||
|
</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.couponType | getType}}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="description" label="操作" width="100">
|
||||||
|
<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>
|
||||||
|
<el-form-item label="赠送原因">
|
||||||
|
<el-input
|
||||||
|
v-model="youForm.reason" type="textarea"
|
||||||
|
placeholder="请输入"
|
||||||
|
clearable
|
||||||
|
></el-input>
|
||||||
|
</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: "selectPro",
|
||||||
|
props: ["userId"],
|
||||||
|
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:'',
|
||||||
|
reason:'后台客服操作赠送',
|
||||||
|
ids:undefined
|
||||||
|
},
|
||||||
|
loading: false,
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
console.log("挂载", this.userId);
|
||||||
|
// 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/delCoupon'),
|
||||||
|
method: 'post',
|
||||||
|
data: this.$http.adornData({
|
||||||
|
id: id
|
||||||
|
})
|
||||||
|
}).then(({data}) => {
|
||||||
|
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
|
||||||
|
|
||||||
|
},
|
||||||
|
surYou() {
|
||||||
|
if(this.youForm.ids.length == 0){
|
||||||
|
this.$message({
|
||||||
|
message: '请选择优惠券',
|
||||||
|
type: 'warning',
|
||||||
|
duration: 1500,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var data = {
|
||||||
|
"couponId": this.youForm.ids,
|
||||||
|
"userId": this.userId,
|
||||||
|
"getType":0 //获取类型 0 后台赠送 1 主动获取
|
||||||
|
}
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl('/common/coupon/insertCouponHistory'),
|
||||||
|
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/getCouponHistoryList"),
|
||||||
|
method: "post",
|
||||||
|
data: this.$http.adornData({
|
||||||
|
page: this.pageIndex,
|
||||||
|
limit: this.pageSize,
|
||||||
|
getType: this.query.getType, //获取类型 0 后台赠送 1 主动获取
|
||||||
|
status: this.query.status, //使用状态 0 未使用 1 已使用 2 已过期
|
||||||
|
userInfo: "", //用户信息
|
||||||
|
userId: this.userId
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(({ data }) => {
|
||||||
|
if (data.code != 0) return this.$message.error(data.msg);
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.dataList = data.couponList.records;
|
||||||
|
|
||||||
|
this.totalPage = data.couponList.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>
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
<el-button type="text" size="small">充/扣天医币记录</el-button>
|
<el-button type="text" size="small">充/扣天医币记录</el-button>
|
||||||
</router-link>
|
</router-link>
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item><el-button type="text" size="small" @click="youhui(scope.row)">优惠券列表</el-button></el-dropdown-item>
|
<el-dropdown-item><el-button type="text" size="small" @click=" thisUserID = scope.row.id; youVisible = true">优惠券列表</el-button></el-dropdown-item>
|
||||||
<el-dropdown-item><el-button type="text" size="small" @click="resetPassword(scope.row)">修改密码</el-button></el-dropdown-item>
|
<el-dropdown-item><el-button type="text" size="small" @click="resetPassword(scope.row)">修改密码</el-button></el-dropdown-item>
|
||||||
<el-dropdown-item>
|
<el-dropdown-item>
|
||||||
<router-link :to="{ path: '/userCourse', query: {id:scope.row.id} }">
|
<router-link :to="{ path: '/userCourse', query: {id:scope.row.id} }">
|
||||||
@@ -164,39 +164,15 @@
|
|||||||
<el-button type="primary" @click="huaSheng(pointForm.peanutCoin)">确定</el-button>
|
<el-button type="primary" @click="huaSheng(pointForm.peanutCoin)">确定</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<userCouponList v-if="youVisible" ref="userCouponList" :userId='thisUserID' @close="closeCoupon"></userCouponList>
|
||||||
|
|
||||||
<el-dialog title="优惠券列表" :close-on-click-modal="false" :visible.sync="youVisible" append-to-body width="600px">
|
|
||||||
<el-form :model="youForm" label-width="100px">
|
|
||||||
<el-form-item label="用户">
|
|
||||||
{{youForm.tel}} <span v-if="youForm.name!=''">({{youForm.name}})</span>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="赠送优惠券">
|
|
||||||
<el-select v-model="youForm.courType" placeholder="请选择">
|
|
||||||
<el-option v-for="item in courperList" :key="item.id" :label="item.couponName" :value="item.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
<el-button type="primary" @click="surYou" :disabled="youForm.courType==undefined">赠送</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
<el-table :data="courperHistList" border :key='Math.random()'>
|
|
||||||
<el-table-column prop="couponName" label="已获得优惠券">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" header-align="center" align="center" width="80">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button type="text" size="small" @click="courDelete(scope.row)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-form>
|
|
||||||
<span slot="footer" class="dialog-footer">
|
|
||||||
<el-button @click="youVisible=false">取消</el-button>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import userCouponList from '../coupon/userCouponList'
|
||||||
import AddOrUpdate from './user-add-or-update'
|
import AddOrUpdate from './user-add-or-update'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -239,13 +215,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
AddOrUpdate
|
AddOrUpdate,
|
||||||
|
userCouponList
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.getDataList()
|
this.getDataList()
|
||||||
this.getcourpeList()
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
closeCoupon(val){
|
||||||
|
this.youVisible = false
|
||||||
|
},
|
||||||
// 用户课程
|
// 用户课程
|
||||||
userCourse(val){
|
userCourse(val){
|
||||||
|
|
||||||
@@ -312,26 +292,7 @@
|
|||||||
// });
|
// });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 获取优惠券列表
|
|
||||||
getcourpeList() {
|
|
||||||
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,
|
|
||||||
'currentState': '1'
|
|
||||||
})
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
if (data && data.code === 0) {
|
|
||||||
this.courperList = data.page.list
|
|
||||||
this.totalPage = data.page.totalCount
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 每页数
|
// 每页数
|
||||||
sizeChangeHandle(val) {
|
sizeChangeHandle(val) {
|
||||||
this.pageSize = val
|
this.pageSize = val
|
||||||
@@ -417,58 +378,48 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// async getUserCouponList(userId) {
|
||||||
|
// var obj = undefined
|
||||||
|
// await this.$http({
|
||||||
|
// url: this.$http.adornUrl('/common/coupon/getCouponHistoryList'),
|
||||||
|
// method: 'post',
|
||||||
|
// data: this.$http.adornData({
|
||||||
|
// // 'userId': this.youForm.id,
|
||||||
|
// "page":1,
|
||||||
|
// "limit":10,
|
||||||
|
// "getType":"",//获取类型 0 后台赠送 1 主动获取
|
||||||
|
// "status":"",//使用状态 0 未使用 1 已使用 2 已过期
|
||||||
|
// "userInfo":"",//用户信息
|
||||||
|
// "userId": userId
|
||||||
|
// })
|
||||||
|
// }).then(async({ data }) => {
|
||||||
|
// if(data.code != 0 ) return this.$message.error(data.msg)
|
||||||
|
// if (data && data.code == 0) {
|
||||||
|
// obj = data
|
||||||
|
// console.log('data', data)
|
||||||
|
// this.youVisible = true
|
||||||
|
// }
|
||||||
|
// }).catch(({e}) => {
|
||||||
|
// console.log(e,'e')
|
||||||
|
// obj = undefined
|
||||||
|
// this.$message.error(e.msg)
|
||||||
|
// })
|
||||||
|
// return obj
|
||||||
|
// },
|
||||||
// 个人优惠券
|
// 个人优惠券
|
||||||
youhui(e) {
|
// async youhui(e) {
|
||||||
this.youForm = e
|
// this.youForm = e
|
||||||
this.youForm.memberId = e.id
|
// this.youForm.memberId = e.id
|
||||||
this.$http({
|
// var obj = await this.getUserCouponList(e.id)
|
||||||
url: this.$http.adornUrl('/book/couponhistory/list'),
|
// // if(obj){
|
||||||
method: 'post',
|
// // this.courperHistList = obj
|
||||||
params: this.$http.adornParams({
|
// console.log('1', obj)
|
||||||
'userId': e.id
|
// // }
|
||||||
})
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
if (data && data.code === 0) {
|
|
||||||
this.courperHistList = data.page.list
|
|
||||||
this.youVisible = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
// // this.courperHistList = await this.getcourpeList(e.id)
|
||||||
surYou() {
|
|
||||||
let arrList = {}
|
// },
|
||||||
arrList.memberId = this.youForm.memberId
|
|
||||||
arrList.couponId = this.youForm.courType
|
|
||||||
arrList.memberNickname = this.youForm.nickname
|
|
||||||
arrList.useStatus = 0
|
|
||||||
|
|
||||||
this.$http({
|
|
||||||
url: this.$http.adornUrl('/book/couponhistory/save'),
|
|
||||||
method: 'post',
|
|
||||||
data: this.$http.adornData(arrList, false)
|
|
||||||
}).then(({
|
|
||||||
data
|
|
||||||
}) => {
|
|
||||||
if (data && data.code === 0) {
|
|
||||||
this.$message({
|
|
||||||
message: data.msg,
|
|
||||||
type: 'success',
|
|
||||||
duration: 1500,
|
|
||||||
})
|
|
||||||
this.youhui(this.youForm)
|
|
||||||
this.getDataList()
|
|
||||||
}else{
|
|
||||||
this.$message({
|
|
||||||
message: data.msg,
|
|
||||||
type: 'error',
|
|
||||||
duration: 1500,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 删除优惠券
|
// 删除优惠券
|
||||||
courDelete(e) {
|
courDelete(e) {
|
||||||
let arrList = []
|
let arrList = []
|
||||||
|
|||||||
Reference in New Issue
Block a user