Files
czg_business_wechat/pages/mailproject/createcap.vue
2024-03-21 15:38:10 +08:00

204 lines
4.3 KiB
Vue

<template>
<view class="index">
<view class="title_text">
创建分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
商品分类
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="titles" maxlength="8" type="text"
placeholder="请输入商品分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="title_text">
管理分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="onecontent_itemleft">
{{item.name}}
</view>
<u-icon name="arrow-right" color="#333" size="20"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" style="margin-top: 100rpx;width: 100%;" 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 {
titles: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onReachBottom() {
this.shoppinggooodstype()
},
onShow() {
this.init_fn()
},
methods: {
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.shoppinggooodstype()
},
async shoppinggooodstype() {
let res = await this.api.shoppinggooodstype({
page:this.form.page
});
if (res.code == 1) {
if (res.data.length == 0) {
this.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.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
contentfixedclick(e) {
// let data = {
// title: e.title,
// goods_type_id: e.id
// }
uni.navigateTo({
url: '/pages/mailproject/createcapinfo?name=' + e.name +'&goods_type_id='+ e.id
});
},
async servicecreateitemclass() {
let res = await this.api.shoppingcreategoodstype({
title: this.titles,
type: 1,
goods_type_id: ''
});
if (res.code == 1) {
uni.showToast({
title: '创建成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #FFFFFF;
}
.onecontent {
background: #ffffff;
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
}
</style>