delete mine history 8.14

This commit is contained in:
2020-08-14 10:58:05 +08:00
parent f4ae3578a2
commit 07ac250ddd
4 changed files with 97 additions and 122 deletions

View File

@@ -8,16 +8,16 @@
<image :src="item.store_avatar"></image>
<view class="u-line-1">{{ item.store_name }}</view>
</view>
<image :src="item.goods_image" class="item-image" @click="viewGoodsDetails(item.goods_id)"></image>
<image :src="item.goods_image" class="item-image" mode="aspectFit" @click="viewGoodsDetails(item.goods_id)"></image>
<view class="item-info" @click="viewGoodsDetails(item.goods_id)">
<view class="info-name u-line-1">{{ item.goods_name }}</view>
<u-icon name="trash" color="#666" size="32"></u-icon>
<view @click.stop="viewAction(item.goods_id)">
<u-icon name="more-dot-fill" color="#333" size="32"></u-icon>
</view>
</view>
<!-- <view @click.stop="delArticle(item.article_id)">
</view> -->
</view>
</view>
<u-action-sheet :list="actionList" v-model="showAction" :cancel-btn="true" @click="delHistory" border-radius="20"></u-action-sheet>
<u-empty text="暂无足迹" mode="list" color="#000" v-if="!historyList.length"></u-empty>
<u-loadmore :status="loadStatus" bgColor="#ECECEC" margin-bottom="20" v-if="historyList.length > 9"></u-loadmore>
</scroll-view>
@@ -28,16 +28,40 @@
export default {
data() {
return {
hid: '', // 选中的商品 id
historyList: [],
page: 1, // 默认1
loadStatus: 'loadmore',
timer: true,
showAction: false,
actionList: [
{
text: '删除',
color: '#000000',
fontSize: 36
}
]
};
},
onLoad() {
this.getBrowseList();
},
methods: {
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);
}
})
},
viewStoreDetails(sid) {
this.$u.route({
url: 'pageC/merchant/index',
@@ -54,11 +78,12 @@ export default {
}
})
},
async getBrowseList () {
async getBrowseList ({ load = 'reload' } = {}) {
const res = await this.$u.api.getBrowseList({ page: this.page });
this.timer = true;
if(res.errCode == 0) {
this.historyList.push(...res.data.storeInfo);
if(load == 'reload') this.historyList = res.data.storeInfo;
else if(load == 'loadmore') this.historyList.push(...res.data.storeInfo);
}
return res.data.storeInfo.length;
},
@@ -67,7 +92,7 @@ export default {
this.timer = false;
this.loadStatus = "loading";
this.page++;
this.getBrowseList().then(length => {
this.getBrowseList({ load: 'loadmore' }).then(length => {
if(length == 0) {
this.page--;
this.loadStatus = 'nomore';
@@ -103,6 +128,7 @@ export default {
.item-title {
display: flex;
align-items: center;
margin-bottom: 20rpx;
> image {
width: 50rpx;
height: 50rpx;
@@ -115,25 +141,24 @@ export default {
}
}
.item-image {
margin: 20rpx 0 17rpx;
width: 180rpx;
height: 140rpx;
border-radius: 10rpx;
}
.item-info {
height: 60rpx;
font-size: 22rpx;
display: flex;
justify-content: space-between;
align-items: center;
.info-name {
margin-right: 10rpx;
height: 60rpx;
line-height: 60rpx;
margin-right: 14rpx;
flex: 1;
font-size: 22rpx;
color: rgba(51,51,51,1);
}
// > image {
// width: 37rpx;
// height: 8rpx;
// }
}
}
}