Files
2024-03-21 15:38:10 +08:00

233 lines
5.8 KiB
Vue

<template>
<view class="content">
<view class="onecontent flex-between">
<u-search shape="square" :clearabled="true" @blur='servicelists' :showAction="false" placeholder="输入关键字"
v-model="like"></u-search>
<view class="flex-start" style="padding-left:20rpx;" @click="contentfixedclick()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建商品</text>
</view>
<view class="flex-start" style="padding-left:20rpx;" @click="createcap()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建分类</text>
</view>
</view>
<view class="contenttow">
<view class="contenttowitem" v-for="(item,index) in list" :key="index" @click="contentfixedclick(item)">
<view class="contenttowitemone flex-between">
<text class="contenttowitemone_one"
:style="item.service_status == 0?'color: #ccc;':''">{{item.title}}</text>
<view class="contenttowitemone_tow flex-start" >
<text class="contenttowitemone_towtext">编辑商品</text>
<u-icon name="file-text" color="#999" size="20"></u-icon>
</view>
</view>
<view class="contenttowitemtow flex-between" v-for="(item1,index1) in item.spec" :key="index1">
<image class="contenttowitemtowimage" :src="item1.img" mode=""></image>
<view class="contenttowitemtow_item flex-colum-start">
<view class="contenttowitemtow_itemone" :style="item.service_status == 0?'color: #ccc;':''">
{{item1.title}}
</view>
<view class="contenttowitemtow_ittow flex-between">
<view class="contenttowitemtow_ittowone">
¥{{item1.price}}
<!-- <text class="contenttowitemtow_ittowonetext">{{item1.price}}</text> -->
</view>
<view class="contenttowitemtow_ittowtow">
<text v-if="item.status == 1" style="color: green;">已上架</text>
<text v-else style="color: red;">已下架</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="list.length==0 && form.is_end == true" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
like: "",
list: [],
form: {
is_end: false,
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.form = {
is_end: false,
page: 1,
status: 'loadmore',
},
this.list = []
this.shoppinggoodslist()
},
onReachBottom() {
this.shoppinggoodslist()
},
methods: {
servicelists() {
this.list = []
this.form.page = 1
this.shoppinggoodslist()
},
contentfixedclick(e) {
if(e){
uni.pro.navigateTo('mailproject/create', {
id: e.id
})
}else{
uni.pro.navigateTo('mailproject/create')
}
},
createcap() {
uni.pro.navigateTo('mailproject/createcap')
},
async shoppinggoodslist(e) { //项目列表
let res = await this.api.shoppinggoodslist({
page: this.form.page,
like: this.like
});
if (res.data.length == 0) {
this.form.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.form.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
}
</script>
<style lang="scss">
page {
background: #fbfbfa;
}
.content {
.onecontent {
padding: 16rpx 20rpx;
width: 100%;
background: #FFFFFF;
.flex-start {
.flex-starttext {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttow {
padding: 0 28rpx;
.contenttowitem {
margin-top: 34rpx;
padding: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 24rpx;
.contenttowitemone {
width: 100%;
padding-bottom: 18rpx;
border-bottom: 1rpx solid #EAEAEA;
.contenttowitemone_one {
width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 28rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
}
.contenttowitemone_tow {
.contenttowitemone_towtext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttowitemtow {
width: 100%;
padding: 18rpx 0;
border-bottom: 1rpx solid #ccc;
.contenttowitemtowimage {
width: 136rpx;
height: 136rpx;
border-radius: 10rpx;
}
.contenttowitemtow_item {
height: 136rpx;
width: 75%;
justify-content: space-between;
.contenttowitemtow_itemone {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.contenttowitemtow_ittow {
width: 100%;
.contenttowitemtow_ittowone {
font-size: 32rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
.contenttowitemtow_ittowonetext {
text-decoration: line-through;
margin-left: 10rpx;
font-size: 22rpx;
font-weight: 400;
}
}
.contenttowitemtow_ittowtow {
font-size: 16rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
}
}
}
</style>