Files
supplier-dispatch-h5/src/views/secondHandCar/mineRelease.vue

398 lines
10 KiB
Vue

<template>
<div class="wrap" >
<div class="headerWrap">
<img class="bg" src="@/assets/secondHandCar/bg.png" />
<div class="nav">
<img class="back" @click="h5GoBack" src="@/assets/secondHandCar/back.png" />
<span>我的发布</span>
<div style="opacity: 0;" class="back"></div>
</div>
<div class="tabBar">
<div v-for="(item,i) in tabList" :key="i" :class="{'active':activeTab == (i+1)}" @click="tabClickHandle(item)">{{item.name}}
<span v-if="i==0 && noPassNum">{{noPassNum}}</span>
</div>
</div>
</div>
<div class="contentWrap" v-show="!showEmpty">
<van-pull-refresh v-model="isLoading" @refresh="onRefresh" style="min-height:85vh">
<div class="contentItem">
<div class="item" v-for="(item,index) in pageList" :key="index" @click.stop="itemHandle(item)">
<div class="left">
<img class="bigImg" src="@/assets/secondHandCar/45angle.png" />
<img v-if="item.type==1" class="smallImg" src="@/assets/secondHandCar/mine_cheyuan.png" />
<img v-else class="smallImg" src="@/assets/secondHandCar/mine_qiugou.png" />
</div>
<div class="right">
<div class="title">
<span>牵引车</span>
<img class="titleImg" :src="getStatus(item.status?.code)" />
</div>
<div v-if="activeTab==0" class="type">{{ item.boardType?.label }} | {{ item.licenseType?.label }} |
{{ item.mileage }}km | {{item.emissionStandard?.label}}</div>
<div v-else class="type">{{ item.boardType?.label }} |
{{item.vehicleType }} | {{item.emissionStandard?.label}}</div>
<div class="price"><span>{{ priceHandle(item.maxPrice) }}</span> <span></span> </div>
<div class="btnWrap">
<img v-if="[1,2].includes(activeTab)" @click.stop="reviseHandle(item)" class="revise" src="@/assets/secondHandCar/revise.png" />
<img v-if="[1,2].includes(activeTab)" @click.stop="xiajiaHandle(item)" class="xiajia" src="@/assets/secondHandCar/xiajia.png" />
<img v-if="[2,3].includes(activeTab)" @click.stop="polishHandle(item)" class="polish" src="@/assets/secondHandCar/polish.png" />
<img v-if="activeTab == 3" @click.stop="reShangJiaHandle(item)" class="reshangjia" src="@/assets/secondHandCar/reshangjia.png" />
</div>
<div class="line"></div>
</div>
</div>
</div>
</van-pull-refresh>
</div>
<div class="empty" v-show="showEmpty">
<img src="@/assets/empty.png" />
</div>
<van-popup v-model="poupShow" closeable round :style="{ width: '70%',height:'18%' }" class="poupWrap">
<span class="title">下架原因</span>
<div class="poupContent">
<van-radio-group v-model="radio" class="radioWrap">
<van-radio name="1">已售出</van-radio>
<van-radio name="2">不卖了</van-radio>
</van-radio-group>
<div class="btnWrap">
<div class="btn" @click="submitHandle">确认</div>
</div>
</div>
</van-popup>
</div>
</template>
<script>
import {myMixins} from "@/utils/myMixins"
import { minePublishPageList,auditFailCount,usedCarPolish,usedCarReShelf,usedCarRemove} from "@/api/secondHandCar"
export default {
name: "mineRelease",
mixins:[myMixins],
data(){
return{
activeTab:1,
tabList:[{value:1,name:'审核中'},{value:2,name:'发布中'},{value:3,name:'已下架'},],
noClick:true,
poupShow:false,
radio:'',
pageList:[],
noPassNum:'',
showEmpty:false,
isLoading:false,
xiajiaInfo:'',
}
},
async mounted() {
await this.getCount()
await this.getList()
},
methods:{
onRefresh() {
this.getList()
setTimeout(() => {
this.$toast('刷新成功');
this.isLoading = false;
}, 1000);
},
itemHandle(item){//审核
this.$router.push({
name: item.type==1 ? "carSource" : 'wantBuy',
query: { type:2 ,id:item.id,queryType:3},
})
},
async getList(){
let res= await minePublishPageList({
queryType:this.activeTab
})
this.pageList=res?.data;
if(this.pageList?.length === 0){
this.showEmpty = true
}else {
this.showEmpty = false
}
},
async getCount(){//获取审核不通数量
let res= await auditFailCount()
this.noPassNum=res.data
},
async submitHandle(){//提交下架原因
if(!this.radio){
this.$toast('下架原因不能为空')
return
}
await usedCarRemove({
id:this.xiajiaInfo.id,
downReason:this.radio==1 ? '已售出' : '不卖了'
})
this.poupShow=false
await this.getList()
},
priceHandle(item){
return item/10000
},
reviseHandle(item){//修改
this.$router.push({
name: item.type==1 ? "carSource" : 'wantBuy',
query: { type:1 ,id:item.id,queryType:3},
})
},
async polishHandle(item){//檫亮
await usedCarPolish(item.id)
this.$toast('你的曝光度已提升')
await this.getList()
},
async reShangJiaHandle(item){//重新上架
await usedCarReShelf(item.id)
await this.getList()
},
xiajiaHandle(item){//下架
this.poupShow=true
this.xiajiaInfo=item
},
tabClickHandle(i) {
this.activeTab = i.value
this.getList()
},
getStatus(i){
switch (i){
case 5://发布中
return require('@/assets/secondHandCar/fabuing.png')
case 6://已下架
return require('@/assets/secondHandCar/alreayXiajia.png')
case 7://信息过期
return require('@/assets/secondHandCar/expire.png')
case 1://待审核
return require('@/assets/secondHandCar/wait_verify.png')
default://未通过
return require('@/assets/secondHandCar/nopass.png')
}
},
}
}
</script>
<style scoped lang="scss">
@import '@/styles/mixin.scss';
.wrap {
@include wh(100%, 100%);
position: relative;
}
.headerWrap{
width: 100%;
box-sizing: border-box;
padding: 15px 16px 0;
position: relative;
.nav {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.bg{
position: absolute;
width: 100%;
height: 120px;
line-height: 120px;
top: 0;
left: 0;
opacity: 0.5;
z-index: -1;
}
.back{
@include wh(15px,15px);
}
span{
font-weight: bold;
font-size: 16px;
color: #203152;
}
.tabBar{
display: flex;
justify-content: space-around;
font-size: 13px;
color: #6A727C;
height: 30px;
line-height: 30px;
span{
background-color: #4C81F5;
padding: 2px 6px;
border-radius: 8px;
font-size: 12px;
color: #FFFFFF;
}
}
.active{
font-weight: 600;
font-size: 15px;
color: #06336D;
position: relative;
}
.active:after {
content: '';
display: block;
background: linear-gradient( 270deg, #33A3FF 0%, #176AFE 100%);
border-radius: 2px;
@include wh(26px,2px);
position: absolute;
border-radius: 2px;
left: 50%;
transform: translateX(-50%);
}
}
.contentWrap{
height: calc(100% - 100px);
overflow-y: auto;
background-color: #F2F2F2;
box-sizing: border-box;
padding: 10px 6px 0;
margin-top: 10px;
}
.contentItem{
width: 100%;
background-color: #FFFFFF;
border-radius: 10px;
box-sizing: border-box;
padding-left: 8px;
padding-top: 18px;
.item{
display: flex;
justify-content: space-between;
}
.left{
position: relative;
.bigImg{
width: 115px;
height: 77px;
background: linear-gradient( 90deg, rgba(5,32,54,0.88) 0%, rgba(69,87,103,0.19) 64%, rgba(133,141,152,0) 100%);
border-radius: 7px;
}
.smallImg{
position: absolute;
top: 0;
left: 0;
width: 36px;
height: 18px;
}
}
.right{
.title{
box-sizing: border-box;
padding-right: 18px;
font-weight: 600;
font-size: 14px;
color: #212020;
line-height: 28px;
display: flex;
align-items: center;
justify-content: space-between;
.titleImg{
width: 43px;
height: 14px;
}
}
.type{
font-weight: 400;
font-size: 12px;
color: #282828;
line-height: 23px;
width: 200px;
white-space: nowrap; /* 强制文本在一行显示 */
overflow: hidden; /* 隐藏超出部分 */
text-overflow: ellipsis; /* 超出部分显示省略号 */
}
.date{
font-weight: 400;
font-size: 11px;
color: #999999;
line-height: 20px;
}
.price{
color: #FF5533;
span:first-child{
font-weight: bold;
font-size: 18px;
line-height: 25px;
margin-right: 2px;
}
span:last-child{
font-weight: 600;
font-size: 11px;
line-height: 16px;
}
}
.line{
width: 224px;
border-bottom: 2px solid #F5F5F5;
margin: 10px 0;
}
.btnWrap{
width: 100%;
box-sizing: border-box;
padding-right: 18px;
text-align: right;
img{
margin-left: 10px;
}
img:first-child{
margin-left: 0;
}
.revise,.xiajia{
@include wh(56px,25px)
}
.polish{
@include wh(69px,25px)
}
.reshangjia{
@include wh(78px,25px)
}
}
}
}
.poupWrap{
width: 100%;
padding-top: 20px;
padding-left: 20px;
.title{
font-size: 14px;
font-weight: bold;
color: #c8c9cc;
}
.radioWrap{
display: flex;
justify-content: space-around;
align-items: center;
margin-top: 7px;
margin-bottom: 15px;
}
.poupContent{
width: 100%;
box-sizing: border-box;
padding: 10px 20px 4px 10px;
.btnWrap{
width: 100%;
text-align: -webkit-right;
//margin-top: 20px;
.btn{
width: 80px;
height: 30px;
line-height: 30px;
background-color: #4C81F5;
color: #FFFFFF;
text-align: center;
border-radius: 8px;
}
}
}
}
.empty{
@include flexTwoCenter;
height:calc(100% - 86px);
background-color: #FAFAFA;
img{
width: 100%;
}
}
</style>