oil-station/fuintCashierWeb/src/views/details/userInfoOrder/couponList.vue

165 lines
5.1 KiB
Vue
Raw Normal View History

2024-01-13 15:16:57 +08:00
<template>
<div>
<el-radio-group v-model="cardList" size="mini" style="margin-bottom: 30px;" @change="changeStatus()">
<el-radio-button label="notUse">未使用</el-radio-button>
<el-radio-button label="used">已使用</el-radio-button>
<el-radio-button label="expired">已过期</el-radio-button>
<el-radio-button label="whole">全部</el-radio-button>
</el-radio-group>
<div>
<el-table ref="tables" v-loading="loading" :data="list">
2024-02-22 17:53:41 +08:00
<el-table-column align="center" prop="storeName" label="所属油站">
2024-01-13 15:16:57 +08:00
<template slot-scope="scope">
2024-02-22 17:53:41 +08:00
<span>{{store.name}}</span>
2024-01-13 15:16:57 +08:00
</template>
</el-table-column>
2024-02-22 17:53:41 +08:00
<el-table-column align="center" prop="couponName" label="优惠券名称"/>
<el-table-column align="center" prop="couponType" label="卡券类型">
<!-- <template slot-scope="scope">-->
<!-- <el-tag v-if="scope.row.type == 0">油品券</el-tag>-->
<!-- <el-tag v-if="scope.row.type == 1" type="success">商品券</el-tag>-->
<!-- <el-tag v-if="scope.row.type == 2" type="warning">通用券</el-tag>-->
<!-- </template>-->
</el-table-column>
<el-table-column align="center" prop="couponAmount" label="优惠金额/参与次数">
2024-01-15 18:17:40 +08:00
<template slot-scope="scope">
2024-02-22 17:53:41 +08:00
<span>{{scope.row.couponAmount || 0}}</span>
2024-01-15 18:17:40 +08:00
</template>
</el-table-column>
2024-02-22 17:53:41 +08:00
<el-table-column align="center" prop="couponContent" label="券面额/使用说明"/>
<!-- <el-table-column align="center" prop="oilType" label="适用油品">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ getOilNames(oilNameList,scope.row.oilType) }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" prop="useStatus" label="状态">
2024-01-13 15:16:57 +08:00
<template slot-scope="scope">
2024-02-22 17:53:41 +08:00
<el-tag v-if="scope.row.useStatus == 0">未使用</el-tag>
<el-tag v-if="scope.row.useStatus == 1" type="success">已使用</el-tag>
<el-tag v-if="scope.row.useStatus == 2" type="warning">已过期</el-tag>
2024-01-13 15:16:57 +08:00
</template>
</el-table-column>
2024-02-22 17:53:41 +08:00
<!-- <el-table-column align="center" label="卡券可用规则">-->
<el-table-column align="center" prop="name" label="到期时间">
<template slot-scope="scope">
{{ scope.row.endTime }}
</template>
2024-01-13 15:16:57 +08:00
</el-table-column>
2024-02-22 17:53:41 +08:00
<!-- <el-table-column align="center" prop="availablePeriod" label="周期与时段"/>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="createTime" label="领取时间"/>-->
<!-- <el-table-column align="center" prop="exchangeFrom" label="描述"/>-->
2024-01-13 15:16:57 +08:00
</el-table>
<pagination
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</div>
</template>
<script>
2024-02-22 17:53:41 +08:00
import {getCardFavorableList, getCardFavorableLists} from "@/api/cashier/userInfoOrder";
2024-01-15 18:17:40 +08:00
import {oilNumbers} from "@/api/cashier/oilnumber";
2024-02-22 17:53:41 +08:00
import {ljStoreInfo} from "@/api/staff/store";
2024-01-13 15:16:57 +08:00
export default {
props:["pUserId"],
data(){
return {
cardList:'notUse',
userId:"",
loading:false,
list:[],
total:0,
queryParams:{
status: 0,
page:1,
pageSize:10,
2024-01-15 18:17:40 +08:00
},
2024-02-22 17:53:41 +08:00
oilNameList:[],
store:{},
2024-01-13 15:16:57 +08:00
}
},
created() {
2024-01-22 11:51:12 +08:00
// this.userId = this.pUserId;
this.userId = this.$route.query.id;
2024-01-13 15:16:57 +08:00
this.getList()
2024-01-15 18:17:40 +08:00
this.getOilName()
2024-01-13 15:16:57 +08:00
},
methods:{
2024-01-15 18:17:40 +08:00
getOilNames(list,oilIds){
let name = "";
let oilNames = []
2024-01-19 14:28:32 +08:00
if(oilIds){
let oilId = oilIds.split(",")
list.forEach(item => {
oilId.forEach(i => {
if (item.oilName == i){
oilNames.push(item.oilNames)
}
})
2024-01-15 18:17:40 +08:00
})
2024-01-19 14:28:32 +08:00
}
2024-01-15 18:17:40 +08:00
let arr = []
for (let i = 0;i<oilNames.length;i++){
if (arr.indexOf(oilNames[i])==-1){
arr.push(oilNames[i])
name += oilNames[i]+","
}
}
return name;
},
getOilName(){
oilNumbers().then(res => {
this.oilNameList = res.data
})
},
2024-01-13 15:16:57 +08:00
getList(){
this.loading = true
2024-02-22 17:53:41 +08:00
this.queryParams.id = this.userId
getCardFavorableLists(this.queryParams).then(res=>{
2024-01-13 15:16:57 +08:00
if (res.code == 200) {
2024-01-19 14:28:32 +08:00
2024-01-13 15:16:57 +08:00
this.list = res.data.records
this.total = res.data.total
this.loading = false
2024-02-22 17:53:41 +08:00
this.getStore()
2024-01-19 14:28:32 +08:00
2024-01-13 15:16:57 +08:00
}
})
},
2024-02-22 17:53:41 +08:00
getStore(){
ljStoreInfo().then(res => {
this.store = res.data
})
},
2024-01-13 15:16:57 +08:00
changeStatus() {
if (this.cardList == 'notUse') {
2024-02-22 17:53:41 +08:00
this.queryParams.useStatus = 0
2024-01-13 15:16:57 +08:00
} else if (this.cardList == 'used') {
2024-02-22 17:53:41 +08:00
this.queryParams.useStatus = 1
2024-01-13 15:16:57 +08:00
} else if (this.cardList == 'expired') {
2024-02-22 17:53:41 +08:00
this.queryParams.useStatus = 2
2024-01-13 15:16:57 +08:00
} else {
2024-02-22 17:53:41 +08:00
this.queryParams.useStatus = ''
2024-01-13 15:16:57 +08:00
}
this.getList()
}
}
}
</script>
<style lang="scss" scoped>
</style>