Feat:删除用户商品浏览足迹
This commit is contained in:
@@ -578,6 +578,10 @@ export function getHistory(params) {
|
|||||||
return request.get('/history/list', params)
|
return request.get('/history/list', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function deleteHistory(id) {
|
||||||
|
return request.delete(`/history/${id}`)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 购物车猜你喜欢
|
* 购物车猜你喜欢
|
||||||
* @param {*} params
|
* @param {*} params
|
||||||
|
|||||||
@@ -27,6 +27,13 @@
|
|||||||
class="v12-white v12-radius-20 history-card"
|
class="v12-white v12-radius-20 history-card"
|
||||||
@click="goodsDetail(historyItem)"
|
@click="goodsDetail(historyItem)"
|
||||||
>
|
>
|
||||||
|
<view class="delete-icon" @click.stop="deleteHistoryItem(historyItem)">
|
||||||
|
<u-icon
|
||||||
|
name="close"
|
||||||
|
color="#fff"
|
||||||
|
size="16"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
<image
|
<image
|
||||||
class="goods-img"
|
class="goods-img"
|
||||||
:src="historyItem.image"
|
:src="historyItem.image"
|
||||||
@@ -83,7 +90,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getHistory } from '@/api/user'
|
import { getHistory, deleteHistory as deleteHistoryApi } from '@/api/user'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -179,6 +186,21 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
deleteHistoryItem(historyItem) {
|
||||||
|
const id = historyItem.id
|
||||||
|
if (!id) return
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '确认删除该浏览足迹吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
deleteHistoryApi(id).then(() => {
|
||||||
|
this.queryHistory()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
queryHistory() {
|
queryHistory() {
|
||||||
this.items = []
|
this.items = []
|
||||||
this.isLoad = false
|
this.isLoad = false
|
||||||
@@ -245,6 +267,7 @@ export default {
|
|||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
&:nth-child(3n) {
|
&:nth-child(3n) {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
@@ -271,6 +294,19 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.delete-icon{
|
||||||
|
position: absolute;
|
||||||
|
top: 8rpx;
|
||||||
|
right: 8rpx;
|
||||||
|
z-index: 2;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
// background-color: rgba(0, 0, 0, 0.35);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
.active{
|
.active{
|
||||||
background: #C52733;
|
background: #C52733;
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user