xnzt/xnzt-h5/pages/index/tradeList/sellList.vue

317 lines
6.0 KiB
Vue
Raw Normal View History

2024-11-11 10:27:27 +08:00
<template>
<!-- 我要买卖 -->
<view class="container">
<view class="banner">
<image src="@/static/images/index/b4.png" mode="aspectFill"></image>
</view>
<view class="bottom">
<view class="list">
<view class="item u-flex u-col-top u-row-center" v-for="(item,index) in list" :key="index" @click="gotoDetail(item.id)">
<view class="l">
<view class="title u-l-1">
{{item.goodsName}}
</view>
<view class="name">
{{item.typeName}}
</view>
</view>
<view class="r">
{{type==0?'销售数量':'求购数量'}}{{item.quantity}}{{item.measureUnit}}
</view>
</view>
<view class="nolist" v-if="nolist">
暂无信息
</view>
</view>
</view>
</view>
</template>
<script>
import { listProductCat } from "@/api/xinfadiProduct/product";
import { listSalesDemandLish } from "@/api/lef/demandPublish.js";
import {demandList,shoppingList} from '@/api/home.js'
export default {
data() {
return {
nolist:'',
goodsType:"",
address: "",
addressIndex: -1,
classname: "",
classIndex: -1,
type: 1,
list:[],
list1:[],
list2:['宜都市','枝江市','当阳市','远安县','兴山县','秭归县','长阳土家族自治县','五峰土家族自治县','夷陵区','西陵区','伍家岗区','点军区','猇亭区','其他'],
}
},
onLoad(i) {
console.log(i,'i')
// this.getData()
this.type = i.type
uni.setNavigationBarTitle({
title: this.type == 0 ? '销售需求列表' : '求购需求列表'
});
this.getList()
},
// onReachBottom() {
// if(this.page<this.total){
// this.page++
// this.getList()
// }else{
// uni.showToast({
// title: '没有了',
// icon: "none",
// duration: 1500
// });
// }
// },
methods: {
gotoDetail(id){
uni.navigateTo({
url:`/pages/index/tradeList/sellDetail?id=${id}&type=${this.type}`
})
},
getList(callback) {
if(this.type == 0){
shoppingList().then((res)=>{
this.list = res.rows
console.log(res,'ressssss')
})
}else{
demandList().then((res)=>{
this.list = res.rows
console.log(res,'ressssss')
})
}
// console.log('this.address',this.address,this.page)
// listSalesDemandLish({
// goodsType:this.goodsType,
// address:this.address,
// pageSize: 10000,
// page: this.page
// }).then((res) => {
// if (res.code == 200) {
// if(this.page == 1){
// this.list = [];
// }
// this.list = this.list.concat(res.rows)
// if(res.rows.length < this.pageSize){
// // this.showNoData = true;
// }
// } else {
// uni.showToast({
// title: res.msg,
// icon: "none",
// duration: 1500
// });
// }
// }).finally(() => {
// callback && callback();
// });
},
// typeChange(e){
// let index = e.detail.value
// this.goodsType = this.list1[index]
// this.page = 1
// this.list = []
// this.getList()
// },
// addrChange(e){
// let index = e.detail.value
// this.address = this.list2[index]
// this.page = 1
// this.list = []
// this.getList()
// },
// getData(){
// listProductCat().then(res => {
// if (res.code == 200) {
// this.list1 = res.data
// } else {
// uni.showToast({
// title: res.msg,
// icon: "none",
// duration: 1500
// });
// }
// })
// },
// addrCancel() {
// this.address = ''
// this.page = 1
// this.list = []
// this.getList()
// },
// classCancel() {
// this.goodsType = ''
// this.page = 1
// this.list = []
// this.getList()
// },
// 销售需求列表
}
}
</script>
<style lang="scss" scoped>
$color: #4892FD;
.right {
position: fixed;
bottom: 100rpx;
right: 30rpx;
width: 110rpx;
height: 110rpx;
border-radius: 50%;
background-color: $color;
display: flex;
flex-direction: column;
align-content: center;
align-items: center;
text-align: center;
justify-content: center;
text {
color: #fff;
font-size: 24rpx;
}
}
.right2{
bottom: 220rpx;
background-color: #ffba00;
}
.container {
.banner {
width: 100%;
height: 320rpx;
margin-bottom: 20rpx;
image {
width: 100%;
height: 100%;
}
}
.bottom {
padding: 30rpx;
background-color: #fff;
width:100%;
.screens {
height: 80rpx;
line-height: 80rpx;
.i {
flex: 1;
text-align: center;
display: flex;
justify-content: center;
.picker {
text {
color: #666;
font-size: 24rpx;
margin-right: 10rpx;
}
image {
width: 32rpx;
height: 32rpx;
}
}
}
}
.titles {
border-bottom: 2rpx solid #eee;
.i {
flex: 1;
text-align: center;
font-size: 28rpx;
color: #666;
position: relative;
height: 80rpx;
line-height: 80rpx;
}
.on {
font-size: 32rpx;
color: #333;
&::after {
content: "";
position: absolute;
bottom: 0;
left: 50%;
margin-left: -30rpx;
width: 60rpx;
height: 10rpx;
border-radius: 5rpx;
background-color: $color;
}
}
}
}
.list {
width: 100%;
.item {
border-bottom: 2rpx solid #eee;
padding: 25rpx 0;
&:last-child {
border-bottom: 0;
}
.l {
flex: 1;
width: 1rpx;
margin-right: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
color: #333333;
line-height: 50rpx;
height: 50rpx;
}
.name {
margin-top: 20rpx;
font-size: 26rpx;
font-weight: 500;
color: #777777;
line-height: 40rpx;
height: 40rpx;
}
}
.r {
font-size: 26rpx;
font-weight: 500;
color: #0D0D0D;
line-height: 80rpx;
height: 80rpx;
}
}
}
}
</style>