2020-06-01 16:51:11 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="mine-history">
|
2020-07-06 17:32:29 +08:00
|
|
|
|
<scroll-view scroll-y class="history-box" @scrolltolower="reachBottom">
|
|
|
|
|
<view class="item-box">
|
2020-07-18 17:43:37 +08:00
|
|
|
|
<!-- 需求:只显示最近五十条数据 后台未作限制 -->
|
2020-07-06 17:32:29 +08:00
|
|
|
|
<view v-for="(item, index) in historyList.slice(0, 50)" :key="index" class="history-item">
|
2020-08-09 18:39:35 +08:00
|
|
|
|
<view class="item-title" @click="viewStoreDetails(item.store_id)">
|
2020-07-06 17:32:29 +08:00
|
|
|
|
<image :src="item.store_avatar"></image>
|
2020-08-12 18:38:14 +08:00
|
|
|
|
<view class="u-line-1">{{ item.store_name }}</view>
|
2020-07-06 17:32:29 +08:00
|
|
|
|
</view>
|
2020-08-14 10:58:05 +08:00
|
|
|
|
<image :src="item.goods_image" class="item-image" mode="aspectFit" @click="viewGoodsDetails(item.goods_id)"></image>
|
2020-08-09 18:39:35 +08:00
|
|
|
|
<view class="item-info" @click="viewGoodsDetails(item.goods_id)">
|
2020-07-06 17:32:29 +08:00
|
|
|
|
<view class="info-name u-line-1">{{ item.goods_name }}</view>
|
2020-08-14 10:58:05 +08:00
|
|
|
|
<view @click.stop="viewAction(item.goods_id)">
|
|
|
|
|
<u-icon name="more-dot-fill" color="#333" size="32"></u-icon>
|
|
|
|
|
</view>
|
2020-07-06 17:32:29 +08:00
|
|
|
|
</view>
|
2020-06-02 11:42:13 +08:00
|
|
|
|
</view>
|
2020-06-01 16:51:11 +08:00
|
|
|
|
</view>
|
2020-08-14 10:58:05 +08:00
|
|
|
|
<u-action-sheet :list="actionList" v-model="showAction" :cancel-btn="true" @click="delHistory" border-radius="20"></u-action-sheet>
|
2020-07-18 17:43:37 +08:00
|
|
|
|
<u-empty text="暂无足迹" mode="list" color="#000" v-if="!historyList.length"></u-empty>
|
2020-08-18 10:06:20 +08:00
|
|
|
|
<u-loadmore class="load-size" :status="loadStatus" bgColor="#ECECEC" margin-top="20" margin-bottom="20" v-if="historyList.length > pageSize" @loadmore="reachBottom"></u-loadmore>
|
2020-07-06 17:32:29 +08:00
|
|
|
|
</scroll-view>
|
2020-06-01 16:51:11 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-08-14 14:57:46 +08:00
|
|
|
|
pageSize: 12,
|
2020-08-14 10:58:05 +08:00
|
|
|
|
hid: '', // 选中的商品 id
|
2020-07-18 17:43:37 +08:00
|
|
|
|
historyList: [],
|
2020-07-06 17:32:29 +08:00
|
|
|
|
page: 1, // 默认1
|
|
|
|
|
loadStatus: 'loadmore',
|
|
|
|
|
timer: true,
|
2020-08-14 10:58:05 +08:00
|
|
|
|
showAction: false,
|
|
|
|
|
actionList: [
|
|
|
|
|
{
|
|
|
|
|
text: '删除',
|
|
|
|
|
color: '#000000',
|
|
|
|
|
fontSize: 36
|
|
|
|
|
}
|
|
|
|
|
]
|
2020-06-01 16:51:11 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
2020-06-29 17:24:57 +08:00
|
|
|
|
onLoad() {
|
|
|
|
|
this.getBrowseList();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2020-08-14 10:58:05 +08:00
|
|
|
|
viewAction(id) {
|
|
|
|
|
this.showAction = true;
|
|
|
|
|
this.hid = id;
|
|
|
|
|
},
|
|
|
|
|
delHistory() {
|
|
|
|
|
let glist = [];
|
|
|
|
|
glist.push(this.hid);
|
|
|
|
|
this.$u.api.delMemberBrowse({ goods_id: glist }).then(res => {
|
|
|
|
|
if(res.errCode == 0) {
|
|
|
|
|
this.getBrowseList();
|
|
|
|
|
} else {
|
|
|
|
|
this.$u.toast(res.message);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2020-08-09 18:39:35 +08:00
|
|
|
|
viewStoreDetails(sid) {
|
|
|
|
|
this.$u.route({
|
|
|
|
|
url: 'pageC/merchant/index',
|
|
|
|
|
params: {
|
|
|
|
|
id: sid,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
viewGoodsDetails(id) {
|
|
|
|
|
this.$u.route({
|
|
|
|
|
url: 'pageB/sdetails/index',
|
|
|
|
|
params: {
|
|
|
|
|
id: id,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2020-08-14 10:58:05 +08:00
|
|
|
|
async getBrowseList ({ load = 'reload' } = {}) {
|
2020-08-14 11:24:44 +08:00
|
|
|
|
if(load == 'reload') this.page = 1;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
const res = await this.$u.api.getBrowseList({ page: this.page });
|
2020-08-12 11:45:12 +08:00
|
|
|
|
this.timer = true;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
if(res.errCode == 0) {
|
2020-08-14 10:58:05 +08:00
|
|
|
|
if(load == 'reload') this.historyList = res.data.storeInfo;
|
|
|
|
|
else if(load == 'loadmore') this.historyList.push(...res.data.storeInfo);
|
2020-07-06 17:32:29 +08:00
|
|
|
|
}
|
|
|
|
|
return res.data.storeInfo.length;
|
|
|
|
|
},
|
|
|
|
|
reachBottom() {
|
|
|
|
|
if(!this.timer) return false;
|
2020-08-12 11:45:12 +08:00
|
|
|
|
this.timer = false;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
this.loadStatus = "loading";
|
|
|
|
|
this.page++;
|
2020-08-14 10:58:05 +08:00
|
|
|
|
this.getBrowseList({ load: 'loadmore' }).then(length => {
|
2020-07-06 17:32:29 +08:00
|
|
|
|
if(length == 0) {
|
|
|
|
|
this.page--;
|
2020-08-12 11:45:12 +08:00
|
|
|
|
this.loadStatus = 'nomore';
|
2020-07-06 17:32:29 +08:00
|
|
|
|
} else {
|
2020-08-12 11:45:12 +08:00
|
|
|
|
this.loadStatus = 'loading';
|
2020-06-29 17:24:57 +08:00
|
|
|
|
}
|
2020-07-06 17:32:29 +08:00
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.loadStatus = "nomore";
|
|
|
|
|
this.page--;
|
2020-06-29 17:24:57 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-06-01 16:51:11 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
2020-06-02 11:42:13 +08:00
|
|
|
|
.mine-history {
|
2020-06-04 08:21:34 +08:00
|
|
|
|
min-height: calc(100vh - var(--window-top));
|
2020-06-01 16:51:11 +08:00
|
|
|
|
background: #ECECEC;
|
2020-06-02 11:42:13 +08:00
|
|
|
|
.history-box {
|
2020-07-18 17:43:37 +08:00
|
|
|
|
box-sizing: border-box;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
height: calc(100vh - var(--window-top));
|
2020-06-02 11:42:13 +08:00
|
|
|
|
padding: 20rpx 30rpx 0;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
.item-box {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
.history-item {
|
|
|
|
|
width: 220rpx;
|
|
|
|
|
height: 290rpx;
|
|
|
|
|
background: rgba(255,255,255,1);
|
2020-06-02 11:42:13 +08:00
|
|
|
|
border-radius: 10rpx;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
padding: 20rpx 20rpx 22rpx;
|
2020-08-14 11:24:44 +08:00
|
|
|
|
margin: 0 11rpx 20rpx 0;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
.item-title {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2020-08-14 10:58:05 +08:00
|
|
|
|
margin-bottom: 20rpx;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
> image {
|
|
|
|
|
width: 50rpx;
|
|
|
|
|
height: 50rpx;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
margin-right: 19rpx;
|
|
|
|
|
}
|
|
|
|
|
> view {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: rgba(51,51,51,1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.item-image {
|
|
|
|
|
width: 180rpx;
|
|
|
|
|
height: 140rpx;
|
|
|
|
|
border-radius: 10rpx;
|
2020-06-02 11:42:13 +08:00
|
|
|
|
}
|
2020-07-06 17:32:29 +08:00
|
|
|
|
.item-info {
|
2020-08-14 10:58:05 +08:00
|
|
|
|
height: 60rpx;
|
|
|
|
|
font-size: 22rpx;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
.info-name {
|
2020-08-14 10:58:05 +08:00
|
|
|
|
height: 60rpx;
|
|
|
|
|
line-height: 60rpx;
|
|
|
|
|
margin-right: 14rpx;
|
2020-07-06 17:32:29 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
color: rgba(51,51,51,1);
|
|
|
|
|
}
|
2020-06-02 11:42:13 +08:00
|
|
|
|
}
|
2020-06-01 16:51:11 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-06 17:32:29 +08:00
|
|
|
|
|
2020-06-01 16:51:11 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|