import Taro, { Component } from '@tarojs/taro' 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' import URL from '../../serviceAPI.config' import './goods.scss' class Goods extends Component { config = { navigationBarTitleText: '商品详情' } constructor() { super(...arguments) this.state = { 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] }) } componentDidMount() { } componentWillReceiveProps(nextProps) { console.log(this.props, nextProps) } componentWillUnmount() { } componentDidShow() { } componentDidHide() { } render() { const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }] // const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }] return ( 11 11 原价 ¥11 促销价 ¥11 商品类型 设计师商品 服务区域 中国/福建省(全省) 月销量 0 总销量 0 浏览量 13 {/* 规格或者数量 */} 可选规格: {this.state.selectorChecked} {/* 详情和评论区 */} {/* 大类 */} 商品细节: { /*子标签类*/} { this.state.subCurrent === 0 ? 全部 : null } { this.state.subCurrent === 1 ? 好评 : null } { this.state.subCurrent === 2 ? 中评 : null } { this.state.subCurrent === 3 ? 差评 : null } { this.state.subCurrent === 4 ? 公开 : null } { this.state.subCurrent === 5 ? 匿名 : null } 标签页三的内容 进店 收藏商品 加入购物车 ) } } export default Goods