bugfix
This commit is contained in:
parent
f0032a3fe8
commit
2c18f68f2e
@ -219,4 +219,23 @@ export function reqSupplyAndDemandSecondCategory(data){
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//收藏 /product/publish_product_collect.dspy
|
||||
export function reqPublishProductCollect(data){
|
||||
return request({
|
||||
url: '/user/favorite_add.dspy',
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data
|
||||
})
|
||||
}
|
||||
//取消收藏 /user/favorite_delete.dspy
|
||||
export function reqFavoriteDelete(data){
|
||||
return request({
|
||||
url: '/user/favorite_delete.dspy',
|
||||
method: 'post',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data
|
||||
})
|
||||
}
|
||||
@ -52,13 +52,29 @@
|
||||
</div>
|
||||
<div class="product-price">
|
||||
<span class="price">¥{{ item.discount_price }}</span>
|
||||
<span class="price-unit">{{ item.unit }} {{ item.short_term === '1' ? '(可短租)' : '' }} </span>
|
||||
<span class="price-unit">{{ item.unit }} {{ item.short_term === '1' ? '(可短租)' : '' }} </span> <el-tag v-if="item.favorite=='1'" type="success">已收藏</el-tag>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: flex-start;align-items: center;gap: 16px;">
|
||||
<el-button :disabled="loadingStates[item.id]" class="consult-btn" @click="openTalk">立即咨询</el-button>
|
||||
<span @click="openDetail(item)" class="detail-btn">
|
||||
详情 <i v-if="loadingStates[item.id]" class="el-icon-loading"></i> <span v-else>>></span>
|
||||
</span>
|
||||
<span
|
||||
:style="{ color: item.favorite === '1' ? 'red' : 'green' }"
|
||||
@click="collect(item)"
|
||||
class="detail-btn"
|
||||
style="cursor: pointer;"
|
||||
>
|
||||
{{ item.favorite === '1' ? '取消收藏' : '收藏' }}
|
||||
<i v-if="collectLoadingStates[item.id]" class="el-icon-loading"></i>
|
||||
<i
|
||||
v-else
|
||||
:class="item.favorite === '1' ? 'el-icon-star-off' : 'el-icon-star-on'"
|
||||
style="width: 14px;height: 14px;margin-left: 2px;"
|
||||
></i>
|
||||
</span>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
|
||||
<el-button :disabled="loadingStates[item.id]" class="consult-btn" @click="openTalk">立即咨询</el-button> <span @click="openDetail(item)"
|
||||
class="detail-btn">详情 <i v-if="loadingStates[item.id]" class="el-icon-loading"></i> <span v-else>>></span> </span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
@ -94,10 +110,25 @@
|
||||
<span class="price">¥{{ item.discount_price }}</span>
|
||||
<span class="price-unit">{{ item.unit }} {{ item.short_term === '1' ? '(可短租)' : '' }} </span>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-between;align-items: center;">
|
||||
|
||||
<el-button :disabled="loadingStates[item.id]" class="consult-btn" @click="openTalk">立即咨询</el-button> <span @click="openDetail(item)"
|
||||
class="detail-btn">详情 <i v-if="loadingStates[item.id]" class="el-icon-loading"></i> <span v-else>>></span> </span>
|
||||
<div style="display: flex;justify-content: flex-start;align-items: center;gap: 16px;">
|
||||
<el-button :disabled="loadingStates[item.id]" class="consult-btn" @click="openTalk">立即咨询</el-button>
|
||||
<span @click="openDetail(item)" class="detail-btn">
|
||||
详情 <i v-if="loadingStates[item.id]" class="el-icon-loading"></i> <span v-else>>></span>
|
||||
</span>
|
||||
<span
|
||||
:style="{ color: item.favorite === '1' ? 'red' : 'green' }"
|
||||
@click="collect(item)"
|
||||
class="detail-btn"
|
||||
style="cursor: pointer;"
|
||||
>
|
||||
{{ item.favorite === '1' ? '取消收藏' : '收藏' }}
|
||||
<i v-if="collectLoadingStates[item.id]" class="el-icon-loading"></i>
|
||||
<i
|
||||
v-else
|
||||
:class="item.favorite === '1' ? 'el-icon-star-off' : 'el-icon-star-on'"
|
||||
style="width: 14px;height: 14px;margin-left: 2px;"
|
||||
></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@ -107,7 +138,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import Talk from '@/views/homePage/dialog/talk/index.vue'
|
||||
import { reqGetProductDetail } from '@/api/ncmatch'
|
||||
import { reqGetProductDetail,reqPublishProductCollect,reqFavoriteDelete } from '@/api/ncmatch'
|
||||
export default {
|
||||
name: 'productCard',
|
||||
components: {
|
||||
@ -129,10 +160,43 @@ export default {
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
loadingStates: {}
|
||||
loadingStates: {},
|
||||
collectLoadingStates: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
collect(item){
|
||||
this.$set(this.collectLoadingStates, item.id, true);
|
||||
// 这里添加收藏/取消收藏的逻辑
|
||||
console.log("收藏",item);
|
||||
if(item.favorite=='1'){
|
||||
reqFavoriteDelete({
|
||||
id:item.id,
|
||||
}).then(res=>{
|
||||
if(res.status){
|
||||
this.$message.success(res.msg);
|
||||
this.$set(this.collectLoadingStates, item.id, false);
|
||||
}else{
|
||||
this.$message.error(res.msg);
|
||||
this.$set(this.collectLoadingStates, item.id, false);
|
||||
}
|
||||
})
|
||||
}else if(item.favorite=='0'){
|
||||
reqPublishProductCollect({
|
||||
productid:item.id,
|
||||
favorite_type:item.publish_type
|
||||
}).then(res=>{
|
||||
if(res.status){
|
||||
this.$message.success(res.msg);
|
||||
this.$set(this.collectLoadingStates, item.id, false);
|
||||
}else{
|
||||
this.$message.error(res.msg);
|
||||
this.$set(this.collectLoadingStates, item.id, false);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
openTalk() {
|
||||
this.$store.commit('setShowTalk', true);
|
||||
},
|
||||
@ -276,16 +340,18 @@ export default {
|
||||
}
|
||||
|
||||
.consult-btn {
|
||||
width: 100%;
|
||||
background: linear-gradient(90deg, #275AFF 0%, #2EBDFA 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
padding: 12px 32px;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
white-space: nowrap;
|
||||
min-width: 120px;
|
||||
flex-shrink: 0;
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 4px 12px rgba(39, 90, 255, 0.3);
|
||||
|
||||
@ -13,11 +13,15 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="content" label="内容" min-width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_time" label="创建时间" min-width="180">
|
||||
<el-table-column prop="create_time" label="咨询时间" min-width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="update_time" label="更新时间" min-width="180">
|
||||
<el-table-column prop="update_time" label="联系时间" min-width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="update_time" label="操作" min-width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="handleEdit(scope.row)">已回复</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user