123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436 |
- <template>
- <div class="couponManage app-container">
- <div class="type-box">
- <!-- <div class="type">
- <div class="title">满减券</div>
- <div class="desc">例:满100元减20元 </div>
- <div class="desc">便于合理控制活动成本</div>
- <el-button
- class="add-btn"
- type="primary"
- size="small"
- @click="handleAdd('/operationManage/couponManage/fullDiscountCoupon')"
- >
- 立即添加
- </el-button>
- </div>
- <div class="type">
- <div class="title">折扣券</div>
- <div class="desc">例:满100元打8折</div>
- <div class="desc">便于合理控制活动成本</div>
- <el-button
- class="add-btn"
- type="primary"
- size="small"
- @click="handleAdd('/operationManage/couponManage/discountCoupon')"
- >
- 立即添加
- </el-button>
- </div> -->
- <div class="type">
- <div class="title">小桔加油券</div>
- <div class="desc">小桔加油券</div>
- <div class="desc">丰富会员权益增加会员价值</div>
- <el-button
- class="add-btn"
- type="primary"
- size="small"
- @click="handleAdd('/operationManage/couponManage/refuelCoupon')"
- >
- 立即添加
- </el-button>
- </div>
- </div>
- <div class="search">
- <div>
- <el-input
- v-model="query.couponName"
- size="small"
- placeholder="请输入优惠券名称"
- class="item-width-200"
- ></el-input>
- <el-date-picker
- v-model="date"
- size="small"
- :default-time="['00:00:00', '23:59:59']"
- value-format="yyyy-MM-dd HH:mm:ss"
- class="item-width-350 ml10"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- <!-- <el-select
- v-model="query.couponType"
- size="small"
- clearable
- class="item-width-200 ml10"
- placeholder="请选择类型"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select> -->
- <el-select
- v-model="query.status"
- size="small"
- class="item-width-200 ml10"
- clearable
- placeholder="请选择状态"
- >
- <el-option
- v-for="item in options1"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- <el-button
- class="ml10"
- type="primary"
- size="small"
- icon="el-icon-search"
- @click="handleSearch"
- >
- 搜索
- </el-button>
- </div>
- </div>
- <el-table
- :data="tableData"
- tooltip-effect="dark"
- border
- v-loading="loading"
- style="width: 100%"
- >
- <el-table-column
- align="center"
- label="优惠券名称"
- prop="couponName"
- show-overflow-tooltip
- >
- </el-table-column>
-
- <el-table-column
- prop="couponType"
- align="center"
- label="优惠券类型"
- show-overflow-tooltip
- >
- <template slot-scope="scope">
- {{scope.row.couponType|filterType}}
- </template>
- </el-table-column>
- <el-table-column
- prop="limitNum"
- align="center"
- label="发放数量"
- show-overflow-tooltip
- >
- </el-table-column>
- <el-table-column
- prop="claimNum"
- align="center"
- label="已领取"
- show-overflow-tooltip
- >
- </el-table-column>
- <el-table-column
- prop="surplusNum"
- align="center"
- label="剩余数量"
- show-overflow-tooltip
- >
- </el-table-column>
- <el-table-column
- prop="useNum"
- align="center"
- label="已使用"
- show-overflow-tooltip
- >
- </el-table-column>
- <el-table-column
- prop="createTime"
- align="center"
- label="创建时间"
- show-overflow-tooltip
- >
- </el-table-column>
-
- <el-table-column
- align="center"
- prop="status"
- label="状态"
- show-overflow-tooltip
- >
- </el-table-column>
-
- <el-table-column prop="address" width="180px" fixed="right" align="center" label="操作">
- <template slot-scope="scope">
- <el-button
- type="text"
- size="small"
- @click="handleDetail(scope.row,'detail')"
- >查看</el-button
- >
- <el-button
- type="text"
- size="small"
- @click="handleDetail(scope.row,'edit')"
- >编辑</el-button
- >
-
- <el-button type="text" size="small" v-if="scope.row.status == '进行中'" @click="handle(scope.row.id)">停止</el-button>
- <el-button type="text" size="small" v-else @click="handleDel(scope.row.id)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="page-box">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- background
- :current-page="query.currentPage"
- :page-sizes="[10, 20, 30, 40]"
- :page-size="query.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div>
- </div>
- </template>
-
- <script>
- import { debounce } from "@/utils/index";
- import { getCouponList, delCoupon,stop } from "@/api/coupon";
- export default {
- name: "couponManage",
- data() {
- return {
- tableData: [],
- options: [
- {
- value: "1",
- label: "满减券",
- },
- {
- value: "2",
- label: "打折券",
- },
- {
- value: "3",
- label: "加油券",
- },
- ],
- options1: [
- {
- value: "1",
- label: "未开始",
- },
- {
- value: "2",
- label: "进行中",
- },
- {
- value: "3",
- label: "已停止",
- },
- ],
- loading: false,
- query: {
- couponName:'',
- couponType: 3,
- status:'',
- startTime:'',
- endTime:'',
- currentPage: 1,
- pageSize: 10,
- },
- total: 0,
- date:[]
- };
- },
- watch: {
- date(val){
- if(val){
- this.query.startTime = val[0]
- this.query.endTime = val[1]
- }else{
- this.query.startTime = ''
- this.query.endTime = ''
- }
- }
- },
- filters: {
- filterType: function(value) {
- if(value == 1){
- return '满减券';
- }else if(value == 2){
- return '打折券';
- }else if(value == 3){
- return '加油券';
- }
- }
- },
- methods: {
- handleSearch(){
- this.query.currentPage = 1
- this.getList();
- },
- handleAdd(path) {
- this.$router.push({
- path: path,
- });
- },
- handle(id) {
- this.$confirm(`此操作将停止该优惠券活动, 是否继续?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- stop({
- id
- }).then((res) => {
- if (res.state == "Success") {
- this.$notify({
- title: "成功",
- message: "操作成功",
- type: "success",
- });
- this.handleSearch();
- }
- });
- });
- },
- handleDetail(row,mode) {
- let url
- if(row.couponType == 1){
- url = 'fullDiscountCoupon'
- }else if(row.couponType == 2){
- url = 'discountCoupon'
- }else if(row.couponType == 3){
- url = 'refuelCoupon'
- }
- this.$router.push({
- path: "/operationManage/couponManage/"+url,
- query: {
- id:row.id,
- mode,
- status:row.status
- },
- });
- },
- handleDel(id){
- this.$confirm(`此操作将删除该优惠券活动, 是否继续?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- delCoupon({
- id
- }).then((res) => {
- if (res.state == "Success") {
- this.$notify({
- title: "成功",
- message: "操作成功",
- type: "success",
- });
- this.handleSearch();
- }
- });
- });
- },
- handleSizeChange(val) {
- this.query.currentPage = 1;
- this.query.pageSize = val;
- this.getList();
- },
- handleCurrentChange(val) {
- this.query.currentPage = val;
- this.getList();
- },
- getList() {
- this.loading = true;
- let query = JSON.parse(JSON.stringify(this.query))
- if(!query.status){
- delete query.status
- }
- if(!query.couponType){
- delete query.couponType
- }
-
- getCouponList(query).then((res) => {
- this.loading = false;
- if (res.state == "Success") {
- this.tableData = res.content.records;
- this.total = res.content.total;
- }
- });
- },
- },
- created() {
- this.getList();
- },
- };
- </script>
-
- <style lang="scss" scoped>
- .couponManage {
- .type-box{
- display: flex;
- align-items: center;
- margin-bottom: 20px;
- .type{
- display: flex;
- flex-direction: column;
- align-items: center;
- background: rgba(244, 248, 253, 1);
- border-radius: 8px;
- padding: 20px;
- width: 250px;
- .title{
- font-size: 20px;
- color: #222;
- font-weight: bold;
- margin-bottom: 10px;
- }
- .desc{
- color: #aaa;
- font-size: 14px;
- }
- .add-btn{
- margin-top: 10px;
- }
- }
- .type+.type{
- margin-left: 20px;
- }
- }
- .search {
- justify-content: space-between;
- .add-btn {
- // margin-right: 20px;
- }
- }
- }
- </style>
-
|