You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/news/goods/del.vue

377 lines
7.9 KiB

<template>
11 months ago
<view class="goods">
<view class="search">
<view class="box">
<!-- <image src="/static/news/icon-search.png"></image>
10 months ago
<input type="search" placeholder="搜索订单" /> -->
<u-search height="50" @search="getListAfter" @custom="getListAfter" placeholder="商品名称"
v-model="keyword"></u-search>
</view>
11 months ago
</view>
<view class="goods-bd">
<view class="li" v-for="(i,index) in list" :key="index" v-if="list.length>0">
11 months ago
<view class="b">
<view class="item">
10 months ago
<view class="select" @click="selectItem(i,index)">
10 months ago
<image mode="aspectFill" v-if="!i.checked" :src="$picUrl+'/static/invoice/select.png'" />
<image mode="aspectFill" v-else :src="$picUrl+'/static/invoice/select-on.png'" />
11 months ago
</view>
<view class="pic">
10 months ago
<image mode="aspectFill" :src="i.goods_image" />
11 months ago
</view>
<!-- 此层wrap在此为必写的否则可能会出现标题定位错误 -->
<view class="info">
10 months ago
<view class="title">{{i.goods_name}}</view>
11 months ago
<view class="sku">
10 months ago
{{i.selling_point}}
11 months ago
</view>
<view class="fd">
10 months ago
<view class="price"><text>{{i.goods_price_max}}</text></view>
<view class="kc">库存{{i.stock_total}}</view>
11 months ago
</view>
</view>
</view>
</view>
<view class="a">
10 months ago
<view class="status">商品状态{{i.status==10?'上架':i.status==20?'下架':'未知'}}</view>
11 months ago
</view>
</view>
<u-empty text="暂无数据显示哦~" v-else mode="list"></u-empty>
11 months ago
</view>
<view class="goods-fd">
10 months ago
<view class="a" @click="checkedAllHandle">
10 months ago
<image mode="aspectFill" v-if="!checkedAll" :src="$picUrl+'/static/invoice/select.png'" />
<image mode="aspectFill" v-else :src="$picUrl+'/static/invoice/select-on.png'" />全选
11 months ago
</view>
10 months ago
<view class="b"><text>{{checkedList.length}}</text>件商品</view>
<view class="c" @click="show=true">删除</view>
</view>
<u-toast ref="uToast" />
<u-modal v-model="show" content="确定删除选中商品吗" :show-cancel-button="true" @cancel="show=false"
@confirm="delConfirm"></u-modal>
</view>
</template>
10 months ago
<script>
import * as newFunApi from '@/api/newFun'
export default {
data() {
11 months ago
return {
10 months ago
list: [],
keyword: "",
total: 0,
pageNum: 1,
checkedAll: false,
checkedList: [],
show: false,
};
11 months ago
},
methods: {
selectItem(item, index) {
if (this.list[index].checked) { //取消选中
if (this.checkedList.indexOf(item.goods_id) != -1) {
10 months ago
this.checkedList.splice(this.checkedList.indexOf(item.goods_id), 1);
10 months ago
}
this.list[index].checked = false
} else { //选中
if (this.checkedList.indexOf(item.goods_id) == -1) {
10 months ago
this.checkedList.push(item.goods_id)
}
this.list[index].checked = true
}
if (this.list.length == this.checkedList.length) {
this.checkedAll = true;
} else {
this.checkedAll = false;
}
},
checkedAllHandle() {
this.checkedList = []
if (this.checkedAll) {
10 months ago
this.checkedAll = false
this.list.forEach(item => {
10 months ago
item.checked = false;
10 months ago
})
} else {
10 months ago
this.checkedAll = true;
this.list.forEach(item => {
10 months ago
this.checkedList.push(item.goods_id)
item.checked = true
})
}
10 months ago
},
getListAfter() {
this.checkedList = [];
10 months ago
this.list = [];
this.getList()
},
async getList() {
uni.showLoading({
title: "加载中"
10 months ago
})
let {
status,
message,
data
} = await newFunApi.storeKeeperList({
goodsNo: "",
10 months ago
page: this.pageNum,
listType: "all",
10 months ago
goodsName: this.keyword
});
if (status == 200) {
10 months ago
uni.hideLoading();
this.list = this.list.concat(data.list.data)
this.total = data.list.total
}
},
async delConfirm() {
let {
status,
message,
data
} = await newFunApi.delGoods({
goodsIds: this.checkedList
10 months ago
});
if (status == 200) {
10 months ago
uni.hideLoading();
this.$toast('删除成功')
10 months ago
this.getListAfter()
}
},
delHandle(item) {
this.selected = item;
10 months ago
this.show = true
},
},
onReady() {
this.getListAfter();
},
onReachBottom() {
if (this.list.length <= this.total) {
this.pageNum++;
10 months ago
this.getList();
}
},
11 months ago
}
</script>
<style lang="scss" scoped>
::v-deep .u-input,
::v-deep .u-content {
background-color: #fff !important;
11 months ago
}
::v-deep .u-search {
width: 640rpx !important;
}
::v-deep .u-empty {
padding: 100rpx 0;
}
.goods {
padding: 0 0 130rpx;
11 months ago
overflow: hidden;
&-fd {
width: 100%;
padding: 20rpx;
overflow: hidden;
11 months ago
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
background-color: #fff;
.a {
margin-right: 20rpx;
11 months ago
font-size: 28rpx;
font-weight: 400;
color: #313131;
display: flex;
align-items: center;
image {
width: 40rpx;
height: 40rpx;
margin-right: 10rpx;
}
}
.b {
text {
color: #ED2B00;
padding: 0 10rpx;
}
font-size: 26rpx;
font-weight: 400;
color: #A2A2A2;
margin-right: 16rpx;
11 months ago
}
.c {
width: 408rpx;
line-height: 80rpx;
background: #FF564A;
border-radius: 80rpx;
11 months ago
text-align: center;
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
11 months ago
}
}
.search {
width: 750rpx;
padding: 35rpx;
box-sizing: border-box;
.box {
padding: 15rpx 25rpx;
box-sizing: border-box;
display: flex;
align-items: center;
background: #fff;
border-radius: 60rpx;
image {
width: 28rpx;
height: 28rpx;
margin-right: 22rpx;
}
input {
flex: 1;
font-size: 28rpx;
line-height: 30rpx;
}
11 months ago
}
}
&-bd {
padding: 0 30rpx;
overflow: hidden;
.a {
padding: 15rpx 0;
11 months ago
display: flex;
align-items: center;
justify-content: space-between;
.status {
font-size: 28rpx;
font-weight: 400;
color: #B6B6B6;
11 months ago
}
.btn {
width: 148rpx;
line-height: 64rpx;
background: #FFFFFF;
border-radius: 64rpx;
text-align: center;
border: 1px solid #F55349;
font-size: 28rpx;
font-weight: 400;
color: #F55349;
11 months ago
}
}
.li {
overflow: hidden;
background-color: #fff;
padding: 0 30rpx;
margin-top: 15rpx;
&:first-child {
margin-top: 0;
}
.item {
padding: 20rpx 0;
overflow: hidden;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #EFEFEF;
.select {
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
}
11 months ago
}
.pic {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
}
11 months ago
}
.info {
flex: 1;
max-width: 370rpx;
margin-right: 20rpx;
.title {
font-size: 28rpx;
11 months ago
font-weight: 400;
color: #000000;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
11 months ago
}
.sku {
line-height: 48rpx;
margin-top: 10rpx;
11 months ago
font-size: 28rpx;
font-weight: 400;
color: #7C7C7C;
}
.fd {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 10rpx;
.price {
font-size: 32rpx;
font-weight: 400;
color: #ED2B00;
}
.kc {
font-size: 28rpx;
font-weight: 400;
color: #B6B6B6;
}
11 months ago
}
}
}
}
}
}
</style>