2018-12-06 17:24:34 +08:00
|
|
|
|
import Taro, { Component } from '@tarojs/taro'
|
2018-12-11 17:34:06 +08:00
|
|
|
|
import { View, Text, Image } from '@tarojs/components'
|
|
|
|
|
import {AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast ,Picker } from 'taro-ui'
|
2018-12-07 17:17:46 +08:00
|
|
|
|
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
2018-12-10 17:38:17 +08:00
|
|
|
|
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
2018-12-06 17:24:34 +08:00
|
|
|
|
|
2018-12-10 17:38:17 +08:00
|
|
|
|
import URL from '../../serviceAPI.config'
|
2018-12-06 17:24:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import './goods.scss'
|
|
|
|
|
|
|
|
|
|
class Goods extends Component {
|
|
|
|
|
|
|
|
|
|
config = {
|
2018-12-11 17:34:06 +08:00
|
|
|
|
navigationBarTitleText: '商品详情'
|
2018-12-06 17:24:34 +08:00
|
|
|
|
}
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments)
|
|
|
|
|
this.state = {
|
2018-12-11 17:34:06 +08:00
|
|
|
|
current: 0, // 当前大类评论区
|
|
|
|
|
subCurrent:0, // 当前小类评论区
|
|
|
|
|
isOpened:false, // 是否显示轻提示
|
|
|
|
|
selector: ['0', '1', '2', '3'], // 数量或者规格选择
|
|
|
|
|
selectorChecked: '0', // 已选择的数量或规格
|
2018-12-06 17:24:34 +08:00
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 大类评论区方法
|
2018-12-06 17:24:34 +08:00
|
|
|
|
handleClick(value) {
|
|
|
|
|
this.setState({
|
|
|
|
|
current: value
|
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 小磊评论区方法
|
2018-12-10 17:38:17 +08:00
|
|
|
|
onClick(value) {
|
2018-12-06 17:24:34 +08:00
|
|
|
|
this.setState({
|
|
|
|
|
subCurrent: value
|
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 去其他页面
|
2018-12-10 17:38:17 +08:00
|
|
|
|
goShopPage(){
|
|
|
|
|
Taro.navigateTo({
|
|
|
|
|
url: '/pages/shop/shop'
|
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 收藏商品
|
2018-12-10 17:38:17 +08:00
|
|
|
|
saveItem(){
|
|
|
|
|
this.setState({isOpened:true})
|
|
|
|
|
}
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 数量或者规格方法
|
2018-12-10 17:38:17 +08:00
|
|
|
|
onChange = e => {
|
|
|
|
|
this.setState({
|
|
|
|
|
selectorChecked: this.state.selector[e.detail.value]
|
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-06 17:24:34 +08:00
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
|
|
console.log(this.props, nextProps)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() { }
|
|
|
|
|
|
|
|
|
|
componentDidShow() { }
|
|
|
|
|
|
|
|
|
|
componentDidHide() { }
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
|
2018-12-06 17:24:34 +08:00
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<View className='gooods=container'>
|
2018-12-10 17:38:17 +08:00
|
|
|
|
<SearchBarComponent></SearchBarComponent>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
<View className='img-box'>
|
2018-12-10 17:38:17 +08:00
|
|
|
|
<Image className='img' src={URL.Base + 'Uploads/zone/user_1041/201808/thumb/e10a0bfea09a3078a800af8054bc80ce_400X400.jpg'}></Image>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
<View className='title-box'>
|
|
|
|
|
<View className='main-title'>
|
|
|
|
|
11
|
|
|
|
|
</View>
|
|
|
|
|
<View className='subtitle-box'>
|
|
|
|
|
11
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='price-box'>
|
|
|
|
|
<View className='org-box'>
|
|
|
|
|
<Text className='title'>原价</Text>
|
|
|
|
|
<Text className='price'>¥11</Text>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='spe-price'>
|
|
|
|
|
<Text className='title'>促销价</Text>
|
|
|
|
|
<Text className='price'>¥11</Text>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='info-box'>
|
|
|
|
|
<View className='type'>
|
|
|
|
|
<Text className='title'>商品类型</Text>
|
|
|
|
|
<Text className='desc'>设计师商品</Text>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
<View className='district'>
|
|
|
|
|
<Text className='title'>服务区域</Text>
|
|
|
|
|
<Text className='desc'>中国/福建省(全省)</Text>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='counter-box'>
|
|
|
|
|
<View className='month-sold'>
|
|
|
|
|
<Text className='title'>月销量</Text>
|
|
|
|
|
<Text className='amount'>0</Text>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='total-sold'>
|
|
|
|
|
<Text className='title'>总销量</Text>
|
|
|
|
|
<Text className='amount'>0</Text>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='browsing-amount'>
|
|
|
|
|
<Text className='title'>浏览量</Text>
|
|
|
|
|
<Text className='amount'>13</Text>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='standard-box'>
|
2018-12-11 17:34:06 +08:00
|
|
|
|
{/* 规格或者数量 */}
|
2018-12-10 17:38:17 +08:00
|
|
|
|
<Picker mode='selector' range={this.state.selector} onChange={this.onChange}>
|
|
|
|
|
<View className='picker'>
|
|
|
|
|
<View className='title'>
|
|
|
|
|
可选规格:
|
|
|
|
|
</View>
|
|
|
|
|
<View className='more'>
|
|
|
|
|
{this.state.selectorChecked}
|
2018-12-06 17:24:34 +08:00
|
|
|
|
</View>
|
2018-12-10 17:38:17 +08:00
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
</Picker>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
</View>
|
2018-12-11 17:34:06 +08:00
|
|
|
|
{/* 详情和评论区 */}
|
2018-12-06 17:24:34 +08:00
|
|
|
|
<View className='details-box'>
|
2018-12-11 17:34:06 +08:00
|
|
|
|
{/* 大类 */}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<AtTabs selectedColor='#FF7142' className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
|
2018-12-10 17:38:17 +08:00
|
|
|
|
<AtTabsPane current={this.state.current} index={0} >
|
|
|
|
|
<View style='padding: 100px 50px;background-color: #FAFBFC;text-align: center;' >商品细节:</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
</AtTabsPane>
|
|
|
|
|
<AtTabsPane current={this.state.current} index={1}>
|
|
|
|
|
<View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'>
|
2018-12-11 17:34:06 +08:00
|
|
|
|
{ /*子标签类*/}
|
2018-12-10 17:38:17 +08:00
|
|
|
|
<AtSegmentedControl selectedColor='#FF9500'
|
2018-12-06 17:24:34 +08:00
|
|
|
|
values={['全部', '好评', '中评', '差评', '公开','匿名']}
|
2018-12-10 17:38:17 +08:00
|
|
|
|
onClick={this.onClick.bind(this)}
|
2018-12-06 17:24:34 +08:00
|
|
|
|
current={this.state.subCurrent}
|
|
|
|
|
/>
|
|
|
|
|
{
|
2018-12-10 17:38:17 +08:00
|
|
|
|
this.state.subCurrent === 0
|
|
|
|
|
? <View className='tab-content'>
|
|
|
|
|
<Text className='title'>全部</Text>
|
|
|
|
|
</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
{
|
2018-12-10 17:38:17 +08:00
|
|
|
|
this.state.subCurrent === 1
|
|
|
|
|
? <View className='tab-content'>好评</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
{
|
2018-12-10 17:38:17 +08:00
|
|
|
|
this.state.subCurrent === 2
|
|
|
|
|
? <View className='tab-content'>中评</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
{
|
2018-12-10 17:38:17 +08:00
|
|
|
|
this.state.subCurrent === 3
|
|
|
|
|
? <View className='tab-content'>差评</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
{
|
2018-12-10 17:38:17 +08:00
|
|
|
|
this.state.subCurrent === 4
|
|
|
|
|
? <View className='tab-content'>公开</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
{
|
2018-12-10 17:38:17 +08:00
|
|
|
|
this.state.subCurrent === 5
|
|
|
|
|
? <View className='tab-content'>匿名</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
</AtTabsPane>
|
|
|
|
|
<AtTabsPane current={this.state.current} index={2}>
|
|
|
|
|
<View style='padding: 100px 50px;background-color: #FAFBFC;text-align: center;'>标签页三的内容</View>
|
|
|
|
|
</AtTabsPane>
|
|
|
|
|
</AtTabs>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
|
2018-12-07 17:17:46 +08:00
|
|
|
|
<copyrightComponent></copyrightComponent>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
|
|
|
|
|
<View className='shop-bottom-box' >
|
|
|
|
|
<View className='shop-bottom-nav'>
|
2018-12-10 17:38:17 +08:00
|
|
|
|
<View className='to-shop' onClick={this.goShopPage.bind(this)}>
|
|
|
|
|
<AtIcon className='icon' value='home' size='12' color='black'></AtIcon>
|
|
|
|
|
<Text className='title'>进店</Text>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
</View>
|
2018-12-10 17:38:17 +08:00
|
|
|
|
<View className='collection' onClick={this.saveItem.bind(this)}>
|
|
|
|
|
<AtIcon className='icon' value='heart' size='12' color='white'></AtIcon>
|
|
|
|
|
<AtToast
|
|
|
|
|
isOpened={this.state.isOpened}
|
|
|
|
|
duration={1000}
|
|
|
|
|
text='收藏成功'
|
|
|
|
|
></AtToast>
|
|
|
|
|
<Text className='title'>收藏商品</Text>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
</View>
|
|
|
|
|
<View className='add-cart'>
|
|
|
|
|
加入购物车
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Goods
|