添加店铺页面

This commit is contained in:
2018-12-03 17:32:48 +08:00
parent c8ce8d602f
commit 215a2c5f61
11 changed files with 337 additions and 45 deletions

View File

@@ -0,0 +1,67 @@
import Taro, { Component } from '@tarojs/taro'
import { View} from '@tarojs/components'
import { AtTabBar } from 'taro-ui'
import './bottomNav.scss'
class bottomNav extends Component {
config = {
navigationBarTitleText: 'bottomNav'
}
constructor(){
super(...arguments);
this.state={
current:0
}
}
handleClick(value){
this.setState({
current: value
})
let path=this.props.otherData.menu[value].url
Taro.navigateTo({
url: path,
})
}
componentWillReceiveProps(nextProps) {
//console.log(this.props, nextProps)
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
const otherDataElementsArray = this.props.otherData.menu? this.props.otherData.menu.map((item, index) => {
return { title: item.name, iconType: 'clock' }
}):null
return (
<View >
<AtTabBar className='bottom-nav'
fixed
fontSize='10'
iconSize='18'
selectedColor='#FF7142'
tabList={
otherDataElementsArray
}
onClick={this.handleClick.bind(this)}
current={this.state.current}
/>
</View>
)
}
}
export default bottomNav

View File

View File

@@ -3,16 +3,21 @@ import { View, Button, Text,Image } from '@tarojs/components'
import { AtIcon } from 'taro-ui'
import './filteredShopComponent.scss'
import URL from '../../serviceAPI.config'
const hornIcon = require('../../icons/horn.png')
const houseIcon = require('../../icons/house.png')
class recommondShop extends Component {
config = {
navigationBarTitleText: 'recommondShop'
}
goToShop(value) {
Taro.navigateTo({
url: '/pages/shop/shop?id='+value.shop_id+'&name='+value.shop_name
})
}
componentWillReceiveProps(nextProps) {
//console.log(this.props, nextProps)
@@ -27,23 +32,22 @@ class recommondShop extends Component {
render() {
const title = this.props.shop.shop_name
const imgUrl = 'http://192.168.1.230/' + this.props.shop.goods[0].goods_url
const imgUrl = URL.Base + this.props.shop.goods[0].goods_url
const price = this.props.shop.goods[0].goods_price
const goods = this.props.shop.goods
const ProductName = this.props.shop.goods[0].goods_name
const address = this.props.shop.shop_address
const distance = this.props.shop.distance
const ads = this.props.shop.ads
// const consultText = this.props.shop.wx_open
const voucherLeft = this.props.shop.left_nums
const goodsElementsArray=goods.slice(1).map((item,index)=>{
return <View className='goods-img-box' key={index}>
<Image className='goods-img' src={'http://192.168.1.230/'+item.goods_url} />
<Image className='goods-img' src={URL.Base+item.goods_url} />
</View>
})
return (
<View className='shop-list-box'>
<View className='shop-list-box' >
<View className='header'>
<View className='title'>
<Image src={ads==0 ? hornIcon :houseIcon} style='width:12px; height:12px; vertical-align: middle;'/>
@@ -56,7 +60,7 @@ class recommondShop extends Component {
</View>
</View>
<View className='body'>
<View className='shop-img'>
<View className='shop-img' onClick={this.goToShop.bind(this, this.props.shop)}>
<Image src={imgUrl}/>
</View>
{goods.length !== 1 ? goodsElementsArray:<View className='details'>

View File

@@ -8,7 +8,7 @@
border-bottom:1px solid #F2F2F2;
display: flex;
.title{
width: 50%;
width: 55%;
color: #333;
font-weight: bold;
font-size: 30px;
@@ -16,7 +16,7 @@
}
.consult-voucher-button{
width: 50%;
width: 45%;
//margin-top: 20px ;
margin-left: 200px;
display: flex;