2021-05-13 11:03:32 +08:00
|
|
|
|
<template>
|
2022-05-03 10:12:01 +08:00
|
|
|
|
<view class="myTracks">
|
|
|
|
|
<u-navbar title="我的足迹">
|
2023-10-07 16:12:04 +08:00
|
|
|
|
<div slot="right">
|
|
|
|
|
<div class="light-color edit" @click="isEdit = !isEdit">{{ !isEdit ? '编辑' : '完成'}}</div>
|
|
|
|
|
</div>
|
2022-05-03 10:12:01 +08:00
|
|
|
|
</u-navbar>
|
2023-10-07 16:12:04 +08:00
|
|
|
|
<u-notice-bar mode="vertical" :list="['右划删除浏览记录']"></u-notice-bar>
|
2022-05-03 10:12:01 +08:00
|
|
|
|
<u-empty text="暂无历史记录" style="margin-top:200rpx;" mode="history" v-if="whetherEmpty"></u-empty>
|
|
|
|
|
<div v-else>
|
2023-10-07 16:12:04 +08:00
|
|
|
|
<view v-for="(item, index) in trackList" :key="index">
|
|
|
|
|
<view class="myTracks-title" @click="navigateToStore(item)">{{item.storeName}}</view>
|
2022-05-03 10:12:01 +08:00
|
|
|
|
<view class="myTracks-items">
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-10 12:06:28 +08:00
|
|
|
|
<u-swipe-action style="width: 100%;" :show="item.show" :index="index" :key="item.id"
|
|
|
|
|
@click="delTracks" @open="open" :options="options">
|
2023-10-07 16:12:04 +08:00
|
|
|
|
|
|
|
|
|
<view class="myTracks-item">
|
|
|
|
|
<u-checkbox-group v-if="isEdit" class="store-line-check">
|
|
|
|
|
<u-checkbox shape="circle" :active-color="lightColor" v-model="item.checked"
|
|
|
|
|
@change="checkboxChangeDP(item)"></u-checkbox>
|
|
|
|
|
</u-checkbox-group>
|
2023-05-08 18:15:01 +08:00
|
|
|
|
<view class="myTracks-item-img" @click.stop="navigateToDetail(item)">
|
2022-05-03 10:12:01 +08:00
|
|
|
|
<image :src="item.thumbnail"></image>
|
|
|
|
|
</view>
|
2023-05-08 18:15:01 +08:00
|
|
|
|
<view class="myTracks-item-content" @click.stop="navigateToDetail(item)">
|
2022-05-03 10:12:01 +08:00
|
|
|
|
<view class="myTracks-item-title">
|
|
|
|
|
{{ item.goodsName }}
|
|
|
|
|
<view class="myTracks-item-title-desc"> </view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="myTracks-item-price">
|
|
|
|
|
¥{{ item.price | unitPrice }}
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-swipe-action>
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="myTracks-divider"></view>
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
</view>
|
2023-10-07 16:12:04 +08:00
|
|
|
|
<div @click="handleClickDeleteSelected" v-if="isEdit" class="submit">
|
|
|
|
|
删除所选
|
|
|
|
|
</div>
|
2022-05-03 10:12:01 +08:00
|
|
|
|
</div>
|
2022-05-10 12:06:28 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
myTrackList,
|
|
|
|
|
deleteHistoryListId
|
|
|
|
|
} from "@/api/members.js";
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2023-10-07 16:12:04 +08:00
|
|
|
|
isEdit:false,
|
2022-05-03 10:12:01 +08:00
|
|
|
|
whetherEmpty: false, //是否数据为空
|
|
|
|
|
params: {
|
|
|
|
|
pageNumber: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
order: "desc",
|
|
|
|
|
sort: "updateTime",
|
|
|
|
|
},
|
2023-10-07 16:12:04 +08:00
|
|
|
|
lightColor:this.$lightColor,
|
2022-05-10 12:06:28 +08:00
|
|
|
|
options: [{
|
|
|
|
|
text: '删除',
|
|
|
|
|
style: {
|
|
|
|
|
backgroundColor: '#dd524d'
|
2022-05-03 10:12:01 +08:00
|
|
|
|
}
|
2022-05-10 12:06:28 +08:00
|
|
|
|
}],
|
2022-05-03 10:12:01 +08:00
|
|
|
|
trackList: [], //足迹列表
|
|
|
|
|
};
|
|
|
|
|
},
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
/**
|
|
|
|
|
* 滑到底部加载下一页数据
|
|
|
|
|
*/
|
|
|
|
|
onReachBottom() {
|
2022-05-10 12:06:28 +08:00
|
|
|
|
this.params.pageNumber++;
|
|
|
|
|
this.getList();
|
2022-05-03 10:12:01 +08:00
|
|
|
|
},
|
2022-05-10 12:06:28 +08:00
|
|
|
|
onShow() {
|
2023-05-24 16:54:15 +08:00
|
|
|
|
this.params.pageNumber = 1
|
2022-05-10 12:06:28 +08:00
|
|
|
|
this.trackList = [];
|
2022-05-03 10:12:01 +08:00
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
this.trackList = [];
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-10-07 16:12:04 +08:00
|
|
|
|
checkboxChangeDP(val){
|
|
|
|
|
console.log(val)
|
|
|
|
|
},
|
|
|
|
|
// 删除所选的数据
|
|
|
|
|
handleClickDeleteSelected(val){
|
|
|
|
|
const ids = this.trackList.filter(item=>item.checked).map(item=>item.goodsId);
|
|
|
|
|
if(!ids.length){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title:"请选择删除数据",
|
|
|
|
|
icon:"none"
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.delTracks(0,ids)
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-05-03 10:12:01 +08:00
|
|
|
|
/**
|
|
|
|
|
* 导航到店铺
|
|
|
|
|
*/
|
2023-05-08 18:15:01 +08:00
|
|
|
|
navigateToStore(val) {
|
2022-09-15 15:40:50 +08:00
|
|
|
|
uni.navigateTo({
|
2022-05-03 10:12:01 +08:00
|
|
|
|
url: "/pages/product/shopPage?id=" + val.storeId,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
open(index) {
|
|
|
|
|
// 先将正在被操作的swipeAction标记为打开状态,否则由于props的特性限制,
|
|
|
|
|
// 原本为'false',再次设置为'false'会无效
|
|
|
|
|
this.trackList[index].show = true;
|
|
|
|
|
this.trackList.map((val, idx) => {
|
|
|
|
|
if (index != idx) this.trackList[idx].show = false;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 跳转详情
|
|
|
|
|
*/
|
2023-05-08 18:15:01 +08:00
|
|
|
|
navigateToDetail(item) {
|
2022-09-15 15:40:50 +08:00
|
|
|
|
uni.navigateTo({
|
2022-05-03 10:12:01 +08:00
|
|
|
|
url: "/pages/product/goods?id=" + item.id + "&goodsId=" + item.goodsId,
|
|
|
|
|
});
|
|
|
|
|
},
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取我的足迹列表
|
|
|
|
|
*/
|
|
|
|
|
getList() {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: "加载中",
|
|
|
|
|
});
|
|
|
|
|
myTrackList(this.params).then((res) => {
|
|
|
|
|
uni.stopPullDownRefresh();
|
2023-10-07 16:12:04 +08:00
|
|
|
|
uni.hideLoading();
|
2022-05-03 10:12:01 +08:00
|
|
|
|
if (res.statusCode == 200) {
|
2022-05-19 09:31:32 +08:00
|
|
|
|
res.data.result.records.length &&
|
|
|
|
|
res.data.result.records.forEach((item) => {
|
2022-05-03 10:12:01 +08:00
|
|
|
|
item.show = false;
|
2023-10-07 16:12:04 +08:00
|
|
|
|
item.checked = false
|
2022-05-03 10:12:01 +08:00
|
|
|
|
});
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-19 09:31:32 +08:00
|
|
|
|
let data = res.data.result.records;
|
2022-05-03 10:12:01 +08:00
|
|
|
|
if (data.total == 0) {
|
|
|
|
|
this.whetherEmpty = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.trackList.push(...data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2021-11-22 15:25:42 +08:00
|
|
|
|
|
2021-05-14 17:31:40 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
/**
|
|
|
|
|
* 删除足迹
|
|
|
|
|
*/
|
2023-10-07 16:12:04 +08:00
|
|
|
|
delTracks(index,ids) {
|
|
|
|
|
deleteHistoryListId(ids || this.trackList[index].goodsId).then((res) => {
|
2022-05-03 10:12:01 +08:00
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
|
this.trackList = [];
|
2023-10-07 16:12:04 +08:00
|
|
|
|
this.params.pageNumber = 1
|
2022-05-03 10:12:01 +08:00
|
|
|
|
this.getList();
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.message,
|
|
|
|
|
duration: 2000,
|
|
|
|
|
icon: "none",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2021-05-13 11:03:32 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2023-10-07 16:12:04 +08:00
|
|
|
|
.submit{
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 20rpx;
|
|
|
|
|
left: 10%;
|
|
|
|
|
width: 80%;
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border-radius: 100px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
background: $light-color;
|
2023-05-08 18:15:01 +08:00
|
|
|
|
}
|
2022-05-03 10:12:01 +08:00
|
|
|
|
.myTracks {
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding-top: 2rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.myTracks-title {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 110rpx;
|
|
|
|
|
padding-left: 20rpx;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #666;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
align-items: center;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
display: -webkit-flex;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.myTracks-items {
|
|
|
|
|
padding-top: 2rpx;
|
|
|
|
|
align-items: center;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
display: -webkit-flex;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
.myTracks-item {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 226rpx;
|
|
|
|
|
padding-left: 20rpx;
|
|
|
|
|
padding-right: 20rpx;
|
|
|
|
|
margin-bottom: 2rpx;
|
|
|
|
|
// border-radius: 6/@px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
position: relative;
|
|
|
|
|
align-items: center;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
display: -webkit-flex;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
.myTracks-item-img {
|
|
|
|
|
margin-right: 20rpx;
|
|
|
|
|
border-radius: 8rpx;
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
image {
|
|
|
|
|
width: 130rpx;
|
|
|
|
|
height: 130rpx;
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
.myTracks-item-title {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
.myTracks-item-title-desc {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
.myTracks-item-price {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: $light-color;
|
|
|
|
|
padding: 10rpx 0 0 0;
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2023-10-07 16:12:04 +08:00
|
|
|
|
.myTracks-action {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
background: #fff;
|
|
|
|
|
height: 75rpx;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 0 32rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.myTracks-action-btn {
|
|
|
|
|
width: 130rpx;
|
|
|
|
|
height: 60rpx;
|
|
|
|
|
line-height: 60rpx;
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2022-05-03 10:12:01 +08:00
|
|
|
|
.myTracks-divider {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 20rpx;
|
|
|
|
|
}
|
2021-05-13 11:03:32 +08:00
|
|
|
|
|
2023-10-07 16:12:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.myTracks-action-check {
|
|
|
|
|
align-items: center;
|
|
|
|
|
display: -webkit-box;
|
|
|
|
|
display: -webkit-flex;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
.edit{
|
|
|
|
|
padding-right: 32rpx;
|
|
|
|
|
}
|
2022-07-20 18:24:49 +08:00
|
|
|
|
</style>
|