cf-wx-app/src/pages/shop/shop.js

133 lines
3.6 KiB
JavaScript
Raw Normal View History

2018-12-03 17:32:48 +08:00
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text, Swiper, SwiperItem, Image } from '@tarojs/components'
import { AtSearchBar, Picker } from 'taro-ui'
import URL from '../../serviceAPI.config'
import './shop.scss'
class Shop extends Component {
// 项目配置
config = {
navigationBarTitleText: '店铺'
}
constructor() {
super(...arguments)
this.state = {
value: '',
shopId:'',
shopName:''
}
}
onChange(value) {
this.setState({
value: value
})
}
onActionClick() {
console.log('开始搜索')
}
getShopInfo() {
Taro.request({
url: URL.GoodsSearch,
method:'POST',
dataType: 'json',
data:{
goods: JSON.stringify({
curr_page: 1,
page_count: 50,
shop_name: false,
shop_id: 1254,
config_id: 4,
shop_class_id: '',
order: 'g.browse_times desc',
currPage: 1,
goods_class_id: 10401
}),
goodsRegion: JSON.stringify({}),
goodsSpec: JSON.stringify([]),
goodsParam: JSON.stringify([]),
goodsParamExt: JSON.stringify([]),
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With':'XMLHttpRequest'
}
})
.then(res => {
console.log('res--',res)
})
}
componentWillMount() {
this.setState({ shopId: this.$router.params.id, shopName: this.$router.params.name}) // 输出 { id: 2, type: 'test' }
}
componentDidMount(){
this.getShopInfo()
}
componentDidShow() { }
componentDidHide() { }
render() {
const shopName= this.state.shopName
console.log(shopName)
return (
<View className='shop'>
<View className='searchBar-box'>
<AtSearchBar
showActionButton
value={this.state.value}
onChange={this.onChange.bind(this)}
onActionClick={this.onActionClick.bind(this)}
/>
</View>
<View className='banner-box'>
<Image src={URL.Base + 'Public/visual_editing/img/ksh_bg.jpg'} style='height:120px'/>
<View className='shop-name'>{shopName}</View>
</View>
<View className='nav-box'>
<View className='nav'>
<View className='shop-cate'>
<Text className='text'>
店铺全部分类
</Text>
</View>
<View className='home-link'>
<Text className='text'>
首页
</Text>
</View>
<View className='home-link'>
<Text className='text'>
店铺说明
</Text>
</View>
</View>
</View>
<View className='filter-box'>
</View>
<View className='container'>
</View>
</View>
)
}
}
export default Shop