所有修改

This commit is contained in:
郑茂强 2018-12-11 17:34:06 +08:00
parent da14bd8f2d
commit 161862d12f
13 changed files with 295 additions and 224 deletions

View File

@ -23,7 +23,7 @@ class App extends Component {
'pages/shop/shop',
'pages/goods/goods',
'pages/goodsPublish/goodsPublish',
'pages/supplyDemandPubish/supplyDemandPubish',
'pages/supplyDemandPublish/supplyDemandPublish',
'pages/mySupplyDemand/mySupplyDemand',
'pages/allDemanding/allDemanding',
],

View File

@ -17,14 +17,14 @@ class AllDemanding extends Component {
constructor() {
super(...arguments)
this.state = {
supplys:[],
isMore:'more',
selector: ['全部', '需求', '供应', '人才'],
selectorChecked: '全部',
selector1: ['全部', '上架', '下架'],
selectorChecked1: '全部',
dateSel: '2018-04-22',
supplys:[], // 需求列表
isMore:'more', // 上拉加载状态
demandingState: [ '需求', '供应', '人才'], // 供求状态选择
demandingStateSelected:'全部', // 当前供求状态
industryCate: ['制定家具', '成品家具', '办公家具','设计'], // 行业分类状态选择
industryCateSelected: '全部', // 当前行业分类状态
startDateSel: '2018-04-22',
endDateSel: '2018-04-22',
}
}
GetAllDemanding({ curr_page=1, page_count=20}) {
@ -52,6 +52,8 @@ class AllDemanding extends Component {
}
})
}
// 向上拉升延迟一秒加载数据
handleLoadMore(){
this.setState({isMore:'loading'})
setTimeout(() => {
@ -59,17 +61,29 @@ class AllDemanding extends Component {
this.GetAllDemanding({ curr_page: currentPage })
}, 1000);
}
onChange = e => {
// 改变需求选项
changeDemandingState = e => {
this.setState({
selectorChecked: this.state.selector[e.detail.value]
demandingStateSelected: this.state.demandingState[e.detail.value]
})
}
onDateChange = e => {
// 改变行业类别选项
changeIndustryCate = e => {
this.setState({
dateSel: e.detail.value
industryCateSelected: this.state.industryCate[e.detail.value]
})
}
//改变开始日期
onStartDateChange = e => {
this.setState({
startDateSel: e.detail.value
})
}
// 改变结束日期
onEndDateChange = e => {
this.setState({
endDateSel: e.detail.value
})
}
@ -78,6 +92,7 @@ class AllDemanding extends Component {
console.log(this.props, nextProps)
}
componentDidMount(){
// 得到第一页需求数据
this.GetAllDemanding({})
}
@ -93,7 +108,8 @@ class AllDemanding extends Component {
return <View className='demanding-info' key={index}>
<View className='header'>
<View className='name'>业主:{item.user_name}</View>
<AtIcon value='user' size='12' color='#2196F3'></AtIcon>
<View className='name'> 业主:{item.user_name}</View>
<View className='others'>
<Text className='cate'>{item.class_name+' '} </Text>
|
@ -112,9 +128,7 @@ class AllDemanding extends Component {
<AtButton type='primary' size='small'>
抢单</AtButton>
</View>
</View>
</View>
<View className='footer'>
<View className='location'><AtIcon value='map-pin' size='12' color='black'></AtIcon></View>
@ -126,12 +140,12 @@ class AllDemanding extends Component {
return (
<View className='allDemanding'>
<View className='page-section'>
{/* 供求状态选择 */}
<View>
<Picker mode='selector' range={this.state.selector1} onChange={this.onChange1}>
<Picker mode='selector' range={this.state.demandingState} onChange={this.changeDemandingState}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.selectorChecked1}</Text>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingStateSelected}</Text>
</View>
</View>
@ -149,39 +163,33 @@ class AllDemanding extends Component {
onChange={this.handleChange.bind(this)}
/>
</View>
{/* 开始和结束日期选择 */}
<View className='page-section'>
<View className='picker-box'>
<Picker mode='date' className='picker-container' onChange={this.onDateChange}>
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.dateSel}</Text>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.startDateSel}</Text>
</View>
</View>
</Picker>
<Picker className='picker-container' mode='date' onChange={this.onDateChange}>
<Picker className='picker-container' mode='date' onChange={this.onEndDateChange}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.dateSel}</Text>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
</View>
</View>
</Picker>
</View>
</View>
{/* 行业分类选择 */}
<View className='page-section'>
<View>
<Picker mode='selector' range={this.state.selector1} onChange={this.onChange1}>
<Picker mode='selector' range={this.state.industryCate} onChange={this.changeIndustryCate}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.selectorChecked1}</Text>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.industryCateSelected}</Text>
</View>
</View>
</Picker>
</View>
@ -193,7 +201,8 @@ class AllDemanding extends Component {
搜索</AtButton>
</View>
</View>
<View className='demanding-box' >
{/* 供求页面的数据加载 */}
<View className='demanding-box'>
{allDemandingElementArray}
</View>
<AtLoadMore

View File

@ -7,7 +7,7 @@
}
.at-input__container{
color:black;
font-weight: bold;
font-weight: bold;
.at-input__input{
font-weight: normal
}
@ -29,7 +29,7 @@
width:172rpx;
font-size:32rpx;
line-height:1.5;
vertical-align:middle;
// vertical-align:middle;
text-align:left;
font-weight: bold;
}
@ -75,6 +75,7 @@
padding:20px 20px 5px;
border-bottom: 1px solid #F2F2F2;
.name{
margin-left: 10px;
flex:1
}
.others{
@ -83,6 +84,9 @@
.cate{
color:#2196F3
}
.watch{
padding-left: 10px;
}
}
}

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Image } from '@tarojs/components'
import { AtSearchBar, AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast ,Picker } from 'taro-ui'
import { View, Text, Image } from '@tarojs/components'
import {AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast ,Picker } from 'taro-ui'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
@ -9,44 +9,45 @@ import URL from '../../serviceAPI.config'
import './goods.scss'
class Goods extends Component {
config = {
navigationBarTitleText: '商品'
navigationBarTitleText: '商品详情'
}
constructor() {
super(...arguments)
this.state = {
value:'',
current: 0,
subCurrent:0,
isOpened:false,
selector: ['0', '1', '2', '3'],
selectorChecked: '0',
current: 0, // 当前大类评论区
subCurrent:0, // 当前小类评论区
isOpened:false, // 是否显示轻提示
selector: ['0', '1', '2', '3'], // 数量或者规格选择
selectorChecked: '0', // 已选择的数量或规格
}}
// 大类评论区方法
handleClick(value) {
this.setState({
current: value
})
}
// 小磊评论区方法
onClick(value) {
this.setState({
subCurrent: value
})
}
// 去其他页面
goShopPage(){
Taro.navigateTo({
url: '/pages/shop/shop'
})
}
// 收藏商品
saveItem(){
this.setState({isOpened:true})
}
// 数量或者规格方法
onChange = e => {
this.setState({
selectorChecked: this.state.selector[e.detail.value]
@ -67,7 +68,7 @@ class Goods extends Component {
render() {
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
// const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
return (
<View className='gooods=container'>
@ -121,12 +122,7 @@ class Goods extends Component {
</View>
</View>
<View className='standard-box'>
{/* <View className='title'>
可选规格
</View>
<View className='more'>
>点击
</View> */}
{/* 规格或者数量 */}
<Picker mode='selector' range={this.state.selector} onChange={this.onChange}>
<View className='picker'>
<View className='title'>
@ -139,14 +135,16 @@ class Goods extends Component {
</View>
</Picker>
</View>
{/* 详情和评论区 */}
<View className='details-box'>
{/* 大类 */}
<AtTabs color='#FF9500' className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
<AtTabsPane current={this.state.current} index={0} >
<View style='padding: 100px 50px;background-color: #FAFBFC;text-align: center;' >商品细节</View>
</AtTabsPane>
<AtTabsPane current={this.state.current} index={1}>
<View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'>
{ /*子标签Tab*/}
{ /*子标签*/}
<AtSegmentedControl selectedColor='#FF9500'
values={['全部', '好评', '中评', '差评', '公开','匿名']}
onClick={this.onClick.bind(this)}

View File

@ -43,9 +43,7 @@
.spe-price{
font-weight: bold;
margin-left: 20px;
.title{
}
.price{
font-size: 40px;
color: #c00;

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Input, Radio, RadioGroup, Label } from '@tarojs/components'
import { AtInput, AtForm, AtImagePicker, AtTextarea, AtRadio, AtButton, Picker } from 'taro-ui'
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } from 'taro-ui'
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
@ -16,8 +16,12 @@ class GoodsPublish extends Component {
constructor() {
super(...arguments)
this.state = {
selector: ['需求', '供应', '人才'],
selector: ['需求', '供应', '人才'], // 应该是树型结构,需要修改
selectorChecked: '需求',
productName:'',
productPrice:'',
productUnit:'',
productDescript:'',
files: [{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki1.jpeg',
},
@ -26,7 +30,7 @@ class GoodsPublish extends Component {
},
{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki3.png',
}],
}], // 上传的图片
list: [
{
value: '美国',
@ -49,24 +53,55 @@ class GoodsPublish extends Component {
checked: false
}
]
] // 店铺分类选项
}
}
onChange1 = e => {
// 改变商品分类状态
onChange(e){
this.setState({
selectorChecked: this.state.selector[e.detail.value]
})
}
onChange(files) {
productNameChange(event){
this.setState({
files
productName: event
})
}
productPriceChange(event){
this.setState({
productPrice: event
})
}
productUnitChange(event){
this.setState({
productUnit: event
})
}
productDescriptChange(event){
this.setState({
productDescript: event.target.value
})
}
// 上传图片
onChangeImg(files,operationType) {
if (operationType === 'add') {
this.setState({
files
})
}
if (operationType === 'remove') {
this.state.files.splice(index, 1);
this.setState({ files: this.state.files });
}
}
// 图片上传失败
onFail(mes) {
console.log(mes)
}
onImageClick(index, file) {
console.log(index, file)
// 删除图片
onImageClick(index) {
}
componentWillReceiveProps(nextProps) {
@ -83,14 +118,11 @@ class GoodsPublish extends Component {
return (
<View className='goods-publish'>
<SearchBarComponent></SearchBarComponent>
<View className='goods-category'>
<View className='page-section'>
<View>
<Picker mode='selector' range={this.state.selector} onChange1={this.onChange}>
<Picker mode='selector' range={this.state.selector} onChange={this.onChange}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.selectorChecked}</Text>
@ -104,11 +136,11 @@ class GoodsPublish extends Component {
<View className='input-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='商品名称:'
type='text'
value={this.state.value}
onChange={this.handleChange.bind(this)}
name='value'
title='商品名称:'
type='text'
value={this.state.productName}
onChange={this.productNameChange.bind(this)}
/>
</View>
<View className='input-box'>
@ -116,10 +148,10 @@ class GoodsPublish extends Component {
<AtInput
name='value'
title='商品价格:'
type='text'
type='number'
placeholder='¥'
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.productPrice}
onChange={this.productPriceChange.bind(this)}
/>
</View>
<View className='input-box'>
@ -128,33 +160,28 @@ class GoodsPublish extends Component {
name='value'
title='商品单位:'
type='text'
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.productUnit}
onChange={this.productUnitChange.bind(this)}
/>
</View>
{/* 图片上传 */}
<View className='img-box'>
<View className='title-box'>
<Text className='require'>*</Text>
<Text className='title'>上传图片:</Text>
</View>
<View className='img-container'>
<AtImagePicker
multiple
files={this.state.files}
onChange={this.onChange.bind(this)}
onChange={this.onChangeImg.bind(this)}
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View>
</View>
<View className='shoptype-box'>
{/* 店铺分类 */}
<View className='title-box'>
<Text className='require'>*</Text>
<Text className='title'>店铺分类:</Text>
@ -209,12 +236,13 @@ class GoodsPublish extends Component {
<View className='description-box'>
<View className='title-box'>
<Text className='require'></Text>
<Text className='title'>商品简介:</Text>
</View>
<AtTextarea
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.productDescript}
onChange={this.productDescriptChange.bind(this)}
maxlength='200'
placeholder='你的产品简介'
/>

View File

@ -8,6 +8,9 @@
.at-input__container{
color:black;
font-weight: bold;
.at-input__input{
font-weight: normal
}
}
.img-box{
margin-top:10Px;

View File

@ -13,29 +13,24 @@ class Home extends Component {
}
constructor() {
super(...arguments);
this.state = {
shopsDetails: '',
ads: '',
categories: '',
subCate:[],
demanding: '',
otherData:''
shopsDetails: [], // 推荐店铺的信息
ads: [], //广告图片数组
categories: [],// 大类
subCate:[], //小类
demanding: [],// 业主需求
otherData:[] // 底部导航栏
}
}
componentWillMount(){
}
componentDidMount() {
// 页面加载后 得到首页的基本信息和推荐店铺的信息
this.getShops()
this.getHomeCategoriesInfo()
}
componentWillReceiveProps(nextProps) {
//console.log(this.props, nextProps)
}
componentWillUnmount() { }
componentDidShow() { }
@ -48,18 +43,16 @@ class Home extends Component {
url: URL.ShopWxStore,
})
.then(res => {
console.log(res)
console.log('首页基本信息',res)
this.setState({
ads: res.data.data.adsLb,
categories: res.data.data.supplyClass,
demanding: res.data.data.demand.supplys,
otherData:res.data.otherData
}, () => {
//console.log(this.state.demanding)
})
})
}
// 得到所有商店的信息
// 得到推荐商店的信息
getShops(parent_supply_class = 0, supply_class = '-1', supply_level = 1) {
Taro.request({
url: URL.ShopSupplyShops,
@ -81,19 +74,22 @@ class Home extends Component {
}
})
.then(res => {
console.log('所有店铺的信息', res)
this.setState({ shopsDetails: res.data.shops }, () => {
// console.log('-----',res)
})
}
)
}
// 点击大类
onClickParentCate(item) {
this.setState({ subCate: item.children })
this.getShops(item.parent_class_id, item.class_id)
}
// 点击子类
onClickChildCate(item) {
this.getShops(item.parent_class_id, item.class_id, 2)
}
// 转到其他页面
goToAllDemandingPage(){
Taro.navigateTo({
url: '/pages/allDemanding/allDemanding'
@ -101,7 +97,7 @@ class Home extends Component {
}
render() {
const demandingElemensArray = this.state.demanding?this.state.demanding.map((item, index) => {
const demandingElemensArray = this.state.demanding.length?this.state.demanding.map((item, index) => {
return < SwiperItem key={index} >
<View className='demanding-item'>
<View className='item-tag'>
@ -123,26 +119,26 @@ class Home extends Component {
</SwiperItem >
}) :null
const adsImgElementsArray = this.state.ads?this.state.ads.map((item, index) => {
const adsImgElementsArray = this.state.ads.length?this.state.ads.map((item, index) => {
return <SwiperItem key={index}>
<Image className='banner-img' src={URL.Base + item.ads_pic} />
</SwiperItem>
}):null
// 这里应该代码可以优化-----
const categoriesElementsArray1 = this.state.categories?this.state.categories[0].map((item, index) => {
const categoriesElementsArray1 = this.state.categories[0].length?this.state.categories[0].map((item, index) => {
return <View className='category-item' key={index} onClick={this.onClickParentCate.bind(this, item)}>
<Image className='cate-img' src={URL.Base + item.icon} />
<View>{item.class_name}</View>
</View>
}):null
const categoriesElementsArray2 = this.state.categories?this.state.categories[1].map((item, index) => {
const categoriesElementsArray2 = this.state.categories.length?this.state.categories[1].map((item, index) => {
return <View className='category-item' key={index} onClick={this.onClickParentCate.bind(this, item)}>
<View> <Image className='cate-img' src={URL.Base + item.icon} /></View>
<View>{item.class_name}</View>
</View>
}):null
const shopCollectionElementsArray = this.state.shopsDetails?this.state.shopsDetails.map((item, index) => {
const shopCollectionElementsArray = this.state.shopsDetails.length?this.state.shopsDetails.map((item, index) => {
return <filteredShopComponent shop={item} key={index}></filteredShopComponent>
}):null
@ -153,7 +149,6 @@ class Home extends Component {
}):null
console.log(this.state.subCate)
return (
<View className='home'>
{/* 第一行图片滚动条 */}
@ -272,9 +267,6 @@ class Home extends Component {
</View>
</View>
<View className='bottom-nav-box'>
<bottomNav otherData={this.state.otherData}/>
</View>

View File

@ -1,5 +1,5 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text } from '@tarojs/components'
import { View } from '@tarojs/components'
import { connect } from '@tarojs/redux'
import { add, minus, asyncAdd } from '../../actions/counter'
@ -30,7 +30,7 @@ class Index extends Component {
Taro.navigateTo({
// url: '/pages/home/home'
// url: '/pages/goodsPublish/goodsPublish'
url: '/pages/goods/goods'
url: '/pages/home/home'
})
}
componentWillReceiveProps (nextProps) {

View File

@ -1,5 +1,5 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text } from '@tarojs/components'
import { View, Text } from '@tarojs/components'
import { AtInput, AtButton, Picker,AtIcon } from 'taro-ui'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
@ -18,27 +18,41 @@ class MySupplyDemand extends Component {
constructor() {
super(...arguments)
this.state = {
selector: ['全部','需求', '供应', '人才'],
selectorChecked: '全部',
selector1: ['全部','上架', '下架'],
selectorChecked1: '全部',
dateSel: '2018-04-22',
demandSupplyCate: ['全部','需求', '供应', '人才'],
demandSupplyCateSelected: '全部',
demandSupplyState: ['全部','上架', '下架'],
demandSupplyStatesSelected: '全部',
title:'',
startDateSel: '2018-04-22',
endDateSel: '2018-04-22',
}
}
onChange = e => {
//修改供求类型
demSupplyCateChange = e => {
this.setState({
selectorChecked: this.state.selector[e.detail.value]
demandSupplyCateSelected: this.state.demandSupplyCate[e.detail.value]
})
}
onChange1 = e => {
// 修改供求状态
demSupplyStateChange = e => {
this.setState({
selectorChecked1: this.state.selector1[e.detail.value]
demandSupplyStatesSelected: this.state.demandSupplyState[e.detail.value]
})
}
onDateChange = e => {
titleChange(event){
this.setState({title:event})
}
// 修改开始日期
onStartDateChange = e => {
this.setState({
dateSel: e.detail.value
startDateSel: e.detail.value
})
}
// 修改结束日期
onEndDateChange = e => {
this.setState({
endDateSel: e.detail.value
})
}
@ -58,32 +72,33 @@ class MySupplyDemand extends Component {
return (
<View className='mySupplyDemand'>
<searchBarComponent></searchBarComponent>
{/* 供求类型 */}
<View className='page-section'>
<View>
<Picker mode='selector' range={this.state.selector} onChange={this.onChange}>
<Picker mode='selector' range={this.state.demandSupplyCate} onChange={this.demSupplyCateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.selectorChecked}</Text>
</View>
</View>
</Picker>
</View>
</View>
<View className='page-section'>
<View>
<Picker mode='selector' range={this.state.selector1} onChange={this.onChange1}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.selectorChecked1}</Text>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyCateSelected}</Text>
</View>
</View>
</Picker>
</View>
</View>
{/* 供求状态 */}
<View className='page-section'>
<View>
<Picker mode='selector' range={this.state.demandSupplyState} onChange={this.demSupplyStateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandSupplyStatesSelected}</Text>
</View>
</View>
</Picker>
</View>
</View>
{/* 供求标题 */}
<View className='input-box'>
<Text className='require'>*</Text>
<AtInput
@ -91,27 +106,26 @@ class MySupplyDemand extends Component {
title='供求标题:'
placeholder='供求标题·'
type='text'
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.title}
onChange={this.titleChange.bind(this)}
/>
</View>
{/* 开始和结束日期 */}
<View className='page-section'>
<View className='picker-box'>
<Picker mode='date' className='picker-container' onChange={this.onDateChange}>
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.dateSel}</Text>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.startDateSel}</Text>
</View>
</View>
</Picker>
<Picker className='picker-container' mode='date' onChange={this.onDateChange}>
<Picker className='picker-container' mode='date' onChange={this.onEndDateChange}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.dateSel}</Text>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
</View>
</View>
</Picker>
@ -131,6 +145,7 @@ class MySupplyDemand extends Component {
</View>
</View>
<View className='total-count'>一共<Text className='number'>20</Text> </View>
{/* 我的供求信息 */}
<View className='info-box'>
<View className='info-container'>

View File

@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Swiper, SwiperItem, Image } from '@tarojs/components'
import { AtSearchBar, AtTag, AtIcon ,AtSegmentedControl, AtTabBar, AtDrawer } from 'taro-ui'
import { View, Button, Text, Image } from '@tarojs/components'
import { AtSearchBar, AtTag, AtIcon } from 'taro-ui'
import URL from '../../serviceAPI.config'
import './shop.scss'
@ -16,15 +16,16 @@ class Shop extends Component {
constructor() {
super(...arguments)
this.state = {
shopItem:'',
value: '',
shopId:'',
shopName:'',
FilterText:'',
isShopDetailsOn:false, // 是否显示店铺说明页面
shopItem:'', // 所有商品
value: '', // 搜索框的值
shopId:'', // 店铺的id
shopName:'', // 店铺名
FilterText:'', // 筛选的可选项
filterBar:['综合排序','销量','新品','价格','人气'],
selectedFilterValue:0,
isShowFilter:false,
综合排序:true,
selectedFilterValue:0, //筛选项
isShowFilter:false, //是否显示侧边筛选
综合排序:true,
销量:false,
新品:false,
价格:false,
@ -41,6 +42,7 @@ class Shop extends Component {
}
}
// 搜索栏值的改变方法
onChange(value) {
this.setState({
@ -49,7 +51,7 @@ class Shop extends Component {
console.log(this.state.value)
})
}
// 搜索栏的方法
getSearchBarkeyWords(){
Taro.request({
url: URL.SearchBarKeyWords,
@ -64,10 +66,12 @@ class Shop extends Component {
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
console.log(res)
console.log('搜索栏的搜索结果',res)
})
}
// 得到筛选的标签
getSearchParams({shop_name = false, shop_id = 1305, shop_class_id = "", goods_class_id=0,class_filter=0}){
Taro.request({
url: URL.GetSearchParam,
@ -97,7 +101,7 @@ class Shop extends Component {
})
}
// get goods info
// 得到所有的产品
goodsSearch({ curr_page = 1, page_count = 50, shop_name = false, shop_id = 1305, config_id = 4, shop_class_id = '', order = '', currPage = 1 }) {
Taro.request({
url: URL.GoodsSearch,
@ -130,6 +134,7 @@ class Shop extends Component {
this.setState({ shopItem:res.data})
})
}
// 产品排序
accendingDescending(value){
this.setState({selectedFilterValue:value})
if(value==0){
@ -161,9 +166,11 @@ class Shop extends Component {
}
}
// 是否显示侧边筛选
showAndHideFilter(){
this.setState({ isShowFilter: !this.state.isShowFilter })
}
// 选择侧边筛选的标签
selectTag(value){
for(let item in this.state.cate){
if(value===item){
@ -173,9 +180,7 @@ class Shop extends Component {
[item]:!this.state.cate[item]
}
}),()=>{
this.getSearchParams({ goods_class_id: value , class_filter :1})
})
}
}
@ -185,9 +190,10 @@ class Shop extends Component {
this.setState({ shopId: this.$router.params.id, shopName: this.$router.params.name}) // 输出 { id: 2, type: 'test' }
}
componentDidMount(){
//页面加载之后 得到指定店铺的商品 和 筛选标签
this.goodsSearch({})
this.getSearchParams({})
this.getSearchBarkeyWords()
this.getSearchParams({})
// this.getSearchBarkeyWords()
}
componentDidShow() { }
@ -195,7 +201,7 @@ class Shop extends Component {
componentDidHide() { }
render() {
const shopName= this.state.shopName
// const shopName= this.state.shopName
const ShopItemElementsArray =this.state.shopItem? this.state.shopItem.goods.map((item,index)=>{
return <View key={index} className='shop-item' >
<ShopItem item={item}></ShopItem>
@ -215,7 +221,7 @@ class Shop extends Component {
// const widthness = this.state.FilterText ? this.state.FilterText.goodsParamExt[5].param_value[0] : null // filter 宽度选项
// 分类
// 侧边筛选的分类项
const goodsClassElementsArray = this.state.FilterText.goods_class ? this.state.FilterText.goods_class.map((item, index) => {
@ -227,7 +233,7 @@ class Shop extends Component {
onClick={this.selectTag.bind(this, item.class_id)}
>{item.class_name}</AtTag>
}):null
// 商品类型
// 侧边筛选的商品类型
const goodsTypeKeyArray = this.state.FilterText.goods_type ? Object.keys(this.state.FilterText.goods_type):null
const goodsTypeElementsArray = goodsTypeKeyArray ? goodsTypeKeyArray.map((key, index) => {
let object = this.state.FilterText.goods_type
@ -239,7 +245,7 @@ class Shop extends Component {
>{object[key].goods_type_ch_name}</AtTag>
}):null
//---------
// 侧边筛选的其他项
const goodsParamKeyArray = this.state.FilterText.goodsParam ? Object.keys(this.state.FilterText.goodsParam):null
const goodsParamElementsArray = goodsParamKeyArray ? goodsParamKeyArray.map((key, index) => {
let object = this.state.FilterText.goodsParam
@ -301,7 +307,7 @@ class Shop extends Component {
</View>
<View className={this.state.isShowFilter ? 'side-filter show' :'side-filter'}>
<View className='left' onClick={this.showAndHideFilter.bind(this)}></View>
{/* sidebar 筛选 */}
{/* 侧边筛选 */}
<View className='right'>
<View className='filter-box'>
<View className='title'>分类</View>
@ -327,6 +333,7 @@ class Shop extends Component {
</View>
</View>
{/* 店铺的商品列表 */}
<View className='container'>
{ShopItemElementsArray}
@ -335,9 +342,7 @@ class Shop extends Component {
<View className='bottom-nav-box'>
<bottomNav otherData={{menu:[{ name: '首页' }, { name: '分类' }, { name: '购物车' }, { name: '教程软件' }, { name:'更多'}]}} />
</View>
</View>
)
}

View File

@ -7,7 +7,7 @@ import SearchBarComponent from '../../component/searchBarComponent/searchBarComp
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import './supplyDemandPubish.scss'
import './supplyDemandPublish.scss'
@ -19,11 +19,16 @@ class SupplyDemand extends Component {
constructor() {
super(...arguments)
this.state = {
selector: ['需求', '供应', '人才'],
selectorChecked: '需求',
selector1: ['上架', '下架'],
selectorChecked1: '上架',
addImg:true,
demandingSupplyCate: ['需求', '供应', '人才'], //供求类型选择
demandingSupplyCateSelected: '需求',// 当前供求类型
demandingSupplyState: ['上架', '下架'], // 状态选择
demandingSupplyStateSelected: '上架',// 当前状态
title:'',
contactName:'',
contactNumber:'',
contactAddress:'',
content:'',
addImg:true, // 是否支持添加图片
files: [{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki1.jpeg',
},
@ -36,19 +41,36 @@ class SupplyDemand extends Component {
}
}
// onChange = e => {
// this.setState({
// selectorChecked: this.state.selector[e.detail.value]
// })
// }
onChange1 = e => {
// 修改供求类型
demandingSupplyCate = e => {
this.setState({
selectorChecked1: this.state.selector1[e.detail.value]
demandingSupplyCateSelected: this.state.demandingSupplyCate[e.detail.value]
})
}
// 修改供求状态
demSupplyStateChange = e => {
this.setState({
demandingSupplyStateSelected: this.state.demandingSupplyState[e.detail.value]
})
}
//改标题
titleChange(event){
this.setState({title:event})
}
contactNameChange(event){
this.setState({contactName:event})
}
contactNumberChange(event){
this.setState({contactNumber:event})
}
contactAddressChange(event){
this.setState({contactAddress:event.target.value})
}
contentChange(event){
this.setState({ content: event.target.value})
}
// 添加图片
onChange(files, operationType,index) {
console.log(files, operationType,index)
if (operationType==='add'){
this.setState({
files
@ -86,25 +108,23 @@ class SupplyDemand extends Component {
<View className='page-section'>
<View>
<Picker mode='selector' range={this.state.selector} onChange={this.onChange}>
<Picker mode='selector' range={this.state.demandingSupplyCate} onChange={this.demandingSupplyCate.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.selectorChecked}</Text>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingSupplyCateSelected}</Text>
</View>
</View>
</Picker>
</View>
</View>
<View className='border-box'>
<Text className='require'>*</Text><AtInput
name='value'
title='需求标题:'
type='text'
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.title}
onChange={this.titleChange.bind(this)}
/>
</View>
<View className='input-box'>
@ -113,8 +133,8 @@ class SupplyDemand extends Component {
name='value'
title='联系人:'
type='text'
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.contactName}
onChange={this.contactNameChange.bind(this)}
/>
</View>
<View className='input-box'>
@ -123,32 +143,32 @@ class SupplyDemand extends Component {
name='value'
title='联系电话:'
type='number'
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.contactNumber}
onChange={this.contactNumberChange.bind(this)}
/>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text>
</View>
<AtTextarea
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.contactAddress}
onChange={this.contactAddressChange.bind(this)}
maxlength='200'
placeholder='联系地址'
/>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text>
</View>
<AtTextarea
value={this.state.value}
onChange={this.handleChange.bind(this)}
value={this.state.content}
onChange={this.contentChange.bind(this)}
maxlength='200'
placeholder=''
/>
</View>
<View className='img-box'>
<View className='title-box'>
@ -158,23 +178,22 @@ class SupplyDemand extends Component {
<View className='img-container'>
<AtImagePicker
showAddBtn={this.state.addImg}
files={this.state.files}
onChange={this.onChange.bind(this)}
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
showAddBtn={this.state.addImg}
files={this.state.files}
onChange={this.onChange.bind(this)}
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View>
</View>
<View className='page-section'>
<View>
<Picker mode='selector' range={this.state.selector1} onChange={this.onChange1}>
<Picker mode='selector' range={this.state.demandingSupplyState} onChange={this.demSupplyStateChange}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.selectorChecked1}</Text>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.demandingSupplyStateSelected}</Text>
</View>
</View>