2018-12-03 17:32:48 +08:00
|
|
|
|
import Taro, { Component } from '@tarojs/taro'
|
2019-01-17 08:52:30 +08:00
|
|
|
|
import { View, Button, Text, Image, Map } from '@tarojs/components'
|
2019-01-14 17:04:08 +08:00
|
|
|
|
import { AtTag, AtIcon, } from 'taro-ui'
|
2018-12-03 17:32:48 +08:00
|
|
|
|
import URL from '../../serviceAPI.config'
|
|
|
|
|
|
2019-01-21 17:25:14 +08:00
|
|
|
|
|
2019-01-18 17:09:17 +08:00
|
|
|
|
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
|
2019-01-17 08:52:30 +08:00
|
|
|
|
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
2018-12-03 17:32:48 +08:00
|
|
|
|
import './shop.scss'
|
2018-12-04 17:32:30 +08:00
|
|
|
|
import ShopItem from '../../component/shopItemComponent/shopItemComponent'
|
2019-01-27 17:35:20 +08:00
|
|
|
|
//import BottomNav from '../../component/bottomNav/bottomNav'
|
2019-01-10 17:36:45 +08:00
|
|
|
|
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
2019-01-14 17:04:08 +08:00
|
|
|
|
|
2019-01-27 17:35:20 +08:00
|
|
|
|
const locationIcon = require('../../assets/img/location.png')
|
2018-12-05 17:30:18 +08:00
|
|
|
|
|
2018-12-03 17:32:48 +08:00
|
|
|
|
class Shop extends Component {
|
|
|
|
|
// 项目配置
|
|
|
|
|
config = {
|
|
|
|
|
navigationBarTitleText: '店铺'
|
|
|
|
|
}
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments)
|
|
|
|
|
this.state = {
|
2018-12-14 17:10:23 +08:00
|
|
|
|
isShopDetailsOn: false, // 是否显示店铺说明页面
|
|
|
|
|
shopItem: [], // 所有商品
|
2018-12-11 17:34:06 +08:00
|
|
|
|
value: '', // 搜索框的值
|
2018-12-14 17:10:23 +08:00
|
|
|
|
shopId: '', // 店铺的id
|
|
|
|
|
shopName: '', // 店铺名
|
|
|
|
|
FilterText: '', // 筛选的可选项
|
2018-12-18 17:37:23 +08:00
|
|
|
|
filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'], //筛选选项
|
|
|
|
|
filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' }, // 筛选选项对应值
|
2018-12-14 17:10:23 +08:00
|
|
|
|
selectedFilterValue: 0, //筛选项
|
2018-12-29 17:15:59 +08:00
|
|
|
|
isShowFilter: false, //是否显示侧边筛选
|
2018-12-18 17:37:23 +08:00
|
|
|
|
showShopHomePage: true,// 是否显示首页页面
|
2018-12-14 17:10:23 +08:00
|
|
|
|
shopDescriptionData: '',// 店铺详情信息
|
|
|
|
|
shopName: '',//店铺名称
|
|
|
|
|
shopAddress: '',//店铺地址
|
|
|
|
|
contactName: '',//联系人
|
|
|
|
|
contactNumber: '',//联系电话
|
|
|
|
|
shopDescription: '',//店铺简介
|
|
|
|
|
filterOptions: {
|
|
|
|
|
all: true,
|
|
|
|
|
amount: false,
|
|
|
|
|
newProduct: false,
|
|
|
|
|
price: false,
|
|
|
|
|
popularity: false,
|
|
|
|
|
},
|
|
|
|
|
filterCondition: '',// 筛选条件
|
2018-12-28 17:29:42 +08:00
|
|
|
|
mainType: [],// 侧边筛选分类
|
|
|
|
|
goodType: [],//侧边商品类型
|
|
|
|
|
otherType: [],//侧边其他类型
|
|
|
|
|
widthType: [],// 侧边宽度类型
|
|
|
|
|
checkedFilterIdList: [],//已选的筛选id
|
2019-01-14 17:04:08 +08:00
|
|
|
|
isAddToList: false,// 请求店铺商品的时候是否添加到旧列表里
|
2019-01-18 17:09:17 +08:00
|
|
|
|
loadMorePageIndex: 1,//上拉加载页面数
|
2019-01-17 08:52:30 +08:00
|
|
|
|
isShowTopNav: false,// 是否显示返回顶部按钮
|
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
// 下面是函数的默认参数
|
|
|
|
|
curr_page: 1,
|
|
|
|
|
page_count: 10,
|
|
|
|
|
shop_name: false,
|
2019-01-10 17:36:45 +08:00
|
|
|
|
shop_id: this.$router.params.id,
|
2018-12-28 17:29:42 +08:00
|
|
|
|
config_id: 4,
|
|
|
|
|
shop_class_id: '',
|
|
|
|
|
order: '',
|
|
|
|
|
goods_class_id: '',
|
2019-01-27 17:35:20 +08:00
|
|
|
|
class_filter: '',
|
|
|
|
|
goods_type: '',
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goodsSpec: [],
|
|
|
|
|
goodsParam: [],
|
|
|
|
|
goodsParamExt: [],
|
2019-01-21 17:25:14 +08:00
|
|
|
|
// 地图的经度和维度
|
2019-01-17 08:52:30 +08:00
|
|
|
|
longitude: '',
|
2019-01-21 17:25:14 +08:00
|
|
|
|
latitude: '',
|
2019-01-27 17:35:20 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
2018-12-03 17:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-12-25 17:26:35 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
// api 得到筛选的标签请求
|
2018-12-28 17:29:42 +08:00
|
|
|
|
getSearchParams({
|
|
|
|
|
shop_name = this.state.shop_name,
|
|
|
|
|
shop_id = this.state.shop_id,
|
|
|
|
|
shop_class_id = this.state.shop_class_id,
|
|
|
|
|
goods_class_id = this.state.goods_class_id,
|
|
|
|
|
class_filter = this.state.class_filter,
|
|
|
|
|
goods_type = this.state.goods_type,
|
|
|
|
|
goodsSpec = this.state.goodsSpec,
|
|
|
|
|
goodsParam = this.state.goodsParam,
|
|
|
|
|
goodsParamExt = this.state.goodsParamExt }) {
|
2018-12-04 17:32:30 +08:00
|
|
|
|
Taro.request({
|
2018-12-05 17:30:18 +08:00
|
|
|
|
url: URL.GetSearchParam,
|
2018-12-04 17:32:30 +08:00
|
|
|
|
method: 'POST',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
goods: JSON.stringify({
|
2018-12-14 17:10:23 +08:00
|
|
|
|
shop_name: shop_name,
|
|
|
|
|
shop_id: shop_id,
|
2018-12-05 17:30:18 +08:00
|
|
|
|
shop_class_id: shop_class_id,
|
|
|
|
|
goods_class_id: goods_class_id,
|
|
|
|
|
class_filter: class_filter,
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goods_type: goods_type,
|
2018-12-05 17:30:18 +08:00
|
|
|
|
|
|
|
|
|
}),
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goodsSpec: JSON.stringify(goodsSpec),
|
|
|
|
|
goodsParam: JSON.stringify(goodsParam),
|
|
|
|
|
goodsParamExt: JSON.stringify(goodsParamExt),
|
2018-12-04 17:32:30 +08:00
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
header: {
|
|
|
|
|
'content-type': 'application/x-www-form-urlencoded',
|
2019-02-12 08:54:34 +08:00
|
|
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
|
|
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
2018-12-04 17:32:30 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
2018-12-28 17:29:42 +08:00
|
|
|
|
if (res.statusCode === 200) {
|
|
|
|
|
console.log('筛选项目成功', res)
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.hideLoading()
|
2018-12-28 17:29:42 +08:00
|
|
|
|
this.formatFilterData(res.data).then(data => {
|
2019-01-27 17:35:20 +08:00
|
|
|
|
console.log('data', data)
|
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
this.setState({
|
|
|
|
|
sideFilterdata: data,
|
2019-01-27 17:35:20 +08:00
|
|
|
|
mainType: data.mainType,
|
|
|
|
|
goodType: data.goodType,
|
|
|
|
|
otherType: data.otherType,
|
|
|
|
|
widthType: data.widthType,
|
2018-12-28 17:29:42 +08:00
|
|
|
|
})
|
2019-01-27 17:35:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
console.log('formated data', data)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
console.log('筛选项目获取失败')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-04 17:32:30 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
async formatFilterData(data) {
|
|
|
|
|
const formatedFilterOptions = {}
|
|
|
|
|
//侧边筛选分类
|
|
|
|
|
if (data.goods_class) {
|
|
|
|
|
let typeArray = []
|
2019-01-27 17:35:20 +08:00
|
|
|
|
// 如果后台返回的筛选项有和checkedFilterIdList重叠的 就不显示.
|
|
|
|
|
if (this.state.checkedFilterIdList.length) {
|
|
|
|
|
data.goods_class.forEach(item => {
|
|
|
|
|
this.state.checkedFilterIdList.forEach((checkedItem) => {
|
|
|
|
|
if (checkedItem.id !== item.class_id) {
|
|
|
|
|
typeArray.push({ id: item.class_id, name: item.class_name, checked: false })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
data.goods_class.forEach(item => {
|
|
|
|
|
typeArray.push({ id: item.class_id, name: item.class_name, checked: false })
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
formatedFilterOptions.mainType = typeArray
|
2019-01-27 17:35:20 +08:00
|
|
|
|
} else {
|
|
|
|
|
formatedFilterOptions.mainType = []
|
2018-12-28 17:29:42 +08:00
|
|
|
|
}
|
|
|
|
|
//侧边筛选商品类型
|
|
|
|
|
if (data.goods_type) {
|
2019-01-14 17:04:08 +08:00
|
|
|
|
// console.log('数据',data.goods_type)
|
2018-12-28 17:29:42 +08:00
|
|
|
|
let goodTypeArray = []
|
|
|
|
|
Object.keys(data.goods_type).forEach(key => {
|
2019-01-17 08:52:30 +08:00
|
|
|
|
if (data.goods_type[key]) {
|
|
|
|
|
goodTypeArray.push({
|
|
|
|
|
id: data.goods_type[key].goods_type_id,
|
|
|
|
|
name: data.goods_type[key].goods_type_ch_name,
|
|
|
|
|
checked: false
|
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
});
|
|
|
|
|
formatedFilterOptions.goodType = goodTypeArray
|
2019-01-27 17:35:20 +08:00
|
|
|
|
} else {
|
|
|
|
|
formatedFilterOptions.goodType = []
|
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
}
|
|
|
|
|
//侧边筛选其他类型
|
|
|
|
|
if (data.goodsParam) {
|
|
|
|
|
let goodsParamArray = []
|
|
|
|
|
|
|
|
|
|
Object.keys(data.goodsParam).forEach(key => {
|
2019-01-17 08:52:30 +08:00
|
|
|
|
if (data.goodsParam[key]) {
|
|
|
|
|
const value = data.goodsParam[key]
|
|
|
|
|
const subArray = value.param_value.map(item => {
|
|
|
|
|
return { id: value.param_id, name: item, checked: false }
|
|
|
|
|
})
|
|
|
|
|
goodsParamArray.push({ [value.param_name]: subArray })
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
});
|
|
|
|
|
formatedFilterOptions.otherType = goodsParamArray
|
|
|
|
|
}
|
2019-01-27 17:35:20 +08:00
|
|
|
|
else {
|
|
|
|
|
formatedFilterOptions.otherType = []
|
|
|
|
|
|
|
|
|
|
}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
//侧边筛选宽度类型
|
|
|
|
|
if (data.goodsParamExt) {
|
|
|
|
|
let goodsParamExtArray = []
|
|
|
|
|
Object.keys(data.goodsParamExt).forEach(key => {
|
|
|
|
|
const value = data.goodsParamExt[key]
|
|
|
|
|
const keyId = value.param_id
|
|
|
|
|
Object.keys(value.param_value).forEach(item => {
|
|
|
|
|
const name = value.param_value[item].value_desc
|
|
|
|
|
const value1 = value.param_value[item]
|
|
|
|
|
|
|
|
|
|
goodsParamExtArray.push({ name: name, value: value1, checked: false, id: keyId })
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
formatedFilterOptions.widthType = goodsParamExtArray
|
|
|
|
|
|
2019-01-27 17:35:20 +08:00
|
|
|
|
} else {
|
|
|
|
|
formatedFilterOptions.widthType = []
|
2018-12-28 17:29:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return formatedFilterOptions
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
// api 得到所有的产品请求
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goodsSearch({
|
|
|
|
|
curr_page = this.state.curr_page,
|
|
|
|
|
page_count = this.state.page_count,
|
|
|
|
|
shop_name = this.state.shop_name,
|
|
|
|
|
shop_id = this.state.shop_id,
|
|
|
|
|
config_id = this.state.config_id,
|
|
|
|
|
shop_class_id = this.state.shop_class_id,
|
|
|
|
|
order = this.state.order,
|
|
|
|
|
goods_class_id = this.state.goods_class_id,
|
2019-01-17 08:52:30 +08:00
|
|
|
|
currPage = '', // 不知道为什么筛选的时候要加 加这个参数为1
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goodsSpec = this.state.goodsSpec,
|
|
|
|
|
goodsParam = this.state.goodsParam,
|
|
|
|
|
goodsParamExt = this.state.goodsParamExt }) {
|
2018-12-03 17:32:48 +08:00
|
|
|
|
Taro.request({
|
|
|
|
|
url: URL.GoodsSearch,
|
2018-12-14 17:10:23 +08:00
|
|
|
|
method: 'POST',
|
2018-12-03 17:32:48 +08:00
|
|
|
|
dataType: 'json',
|
2018-12-14 17:10:23 +08:00
|
|
|
|
data: {
|
|
|
|
|
goods: JSON.stringify({
|
2018-12-05 17:30:18 +08:00
|
|
|
|
curr_page: curr_page,
|
|
|
|
|
page_count: page_count,
|
|
|
|
|
shop_name: shop_name,
|
|
|
|
|
shop_id: shop_id,
|
|
|
|
|
config_id: config_id,
|
|
|
|
|
shop_class_id: shop_class_id,
|
|
|
|
|
order: order,
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goods_class_id: goods_class_id,
|
2019-01-17 08:52:30 +08:00
|
|
|
|
currPage: currPage
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}),
|
2018-12-03 17:32:48 +08:00
|
|
|
|
goodsRegion: JSON.stringify({}),
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goodsSpec: JSON.stringify(goodsSpec),
|
|
|
|
|
goodsParam: JSON.stringify(goodsParam),
|
|
|
|
|
goodsParamExt: JSON.stringify(goodsParamExt),
|
2018-12-03 17:32:48 +08:00
|
|
|
|
},
|
|
|
|
|
header: {
|
2019-01-27 17:35:20 +08:00
|
|
|
|
// 'content-type': 'application/x-www-form-urlencoded',
|
|
|
|
|
// 'X-Requested-With': 'XMLHttpRequest'
|
2018-12-03 17:32:48 +08:00
|
|
|
|
'content-type': 'application/x-www-form-urlencoded',
|
2019-01-27 17:35:20 +08:00
|
|
|
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
2018-12-14 17:10:23 +08:00
|
|
|
|
'X-Requested-With': 'XMLHttpRequest'
|
2018-12-03 17:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
2019-01-14 17:04:08 +08:00
|
|
|
|
console.log('searchGood', res)
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.hideLoading()
|
2019-01-21 17:25:14 +08:00
|
|
|
|
if (res.data.goods && res.data.goods.length) {
|
2019-01-14 17:04:08 +08:00
|
|
|
|
if (this.state.isAddToList) {
|
|
|
|
|
this.setState({
|
|
|
|
|
shopItem: this.state.shopItem.concat(res.data.goods)
|
|
|
|
|
}, () => {
|
|
|
|
|
this.setState({ isAddToList: false })
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ shopItem: res.data.goods, filterCondition: order })
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2019-01-21 17:25:14 +08:00
|
|
|
|
if (this.state.isAddToList) {
|
|
|
|
|
Taro.showToast({
|
|
|
|
|
title: '没有更多了',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({ shopItem: res.data.goods })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-01-14 17:04:08 +08:00
|
|
|
|
}
|
2019-01-18 17:09:17 +08:00
|
|
|
|
this.setState({ isAddToList: false })
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
2018-12-03 17:32:48 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-25 17:26:35 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
// api 得到店铺详情请求
|
2019-01-18 17:09:17 +08:00
|
|
|
|
getShopDescription({ shopID = this.state.shop_id }) {
|
2018-12-14 17:10:23 +08:00
|
|
|
|
Taro.request({
|
2018-12-18 17:37:23 +08:00
|
|
|
|
url: URL.ShopDescription,
|
2018-12-14 17:10:23 +08:00
|
|
|
|
method: 'POST',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
|
|
|
|
shopID: shopID,
|
|
|
|
|
},
|
|
|
|
|
header: {
|
|
|
|
|
'content-type': 'application/x-www-form-urlencoded',
|
2019-02-12 08:54:34 +08:00
|
|
|
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.then(res => {
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.hideLoading()
|
2019-01-14 17:04:08 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
this.setState({
|
|
|
|
|
shopDescriptionData: res.data,
|
|
|
|
|
shopName: res.data.data.shop_name,
|
|
|
|
|
shopAddress: res.data.data.shop_address,
|
|
|
|
|
contactName: res.data.userRes.name,
|
|
|
|
|
contactNumber: res.data.userRes.phone,
|
2019-01-17 08:52:30 +08:00
|
|
|
|
shopDescription: res.data.data.shop_desc,
|
2019-01-21 17:25:14 +08:00
|
|
|
|
latitude: res.data.data.shop_map.split(',')[1],
|
|
|
|
|
longitude: res.data.data.shop_map.split(',')[0],
|
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}, () => {
|
2018-12-25 17:26:35 +08:00
|
|
|
|
// console.log(this.state.shopDescriptionData)
|
2018-12-14 17:10:23 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
)
|
2018-12-05 17:30:18 +08:00
|
|
|
|
}
|
2018-12-25 17:26:35 +08:00
|
|
|
|
|
2019-01-21 17:25:14 +08:00
|
|
|
|
getDataFromShopChild(value) {
|
|
|
|
|
console.log('从子组件店铺分类传回来的值', value)
|
|
|
|
|
this.setState({ shop_class_id: value.id }, () => {
|
|
|
|
|
this.goodsSearch({})
|
|
|
|
|
})
|
2018-12-25 17:26:35 +08:00
|
|
|
|
|
|
|
|
|
}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
|
|
|
|
|
|
2018-12-25 17:26:35 +08:00
|
|
|
|
|
|
|
|
|
// 产品排序
|
|
|
|
|
accendingDescending(value) {
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.showLoading({ title: '加载中' })
|
2018-12-14 17:10:23 +08:00
|
|
|
|
this.setState({ selectedFilterValue: value })
|
|
|
|
|
if (value == 0) {
|
|
|
|
|
this.setState({
|
|
|
|
|
filterOptions: {
|
|
|
|
|
all: true,
|
|
|
|
|
amount: false,
|
|
|
|
|
newProduct: false,
|
|
|
|
|
price: false,
|
|
|
|
|
popularity: false
|
2019-01-21 17:25:14 +08:00
|
|
|
|
},
|
|
|
|
|
curr_page: 1,
|
|
|
|
|
page_count: 10,
|
|
|
|
|
shop_name: false,
|
|
|
|
|
config_id: 4,
|
|
|
|
|
shop_class_id: '',
|
|
|
|
|
order: '',
|
|
|
|
|
goods_class_id: '',
|
|
|
|
|
goodsSpec: [],
|
|
|
|
|
goodsParam: [],
|
|
|
|
|
goodsParamExt: [],
|
|
|
|
|
}, () => {
|
|
|
|
|
this.goodsSearch({})
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}
|
|
|
|
|
)
|
2019-01-21 17:25:14 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}
|
|
|
|
|
if (value == 1) {
|
|
|
|
|
this.setState({
|
2019-01-17 08:52:30 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
filterOptions: {
|
|
|
|
|
all: false,
|
|
|
|
|
amount: !this.state.filterOptions.amount,
|
|
|
|
|
newProduct: false,
|
|
|
|
|
price: false,
|
|
|
|
|
popularity: false
|
|
|
|
|
}
|
|
|
|
|
}, () => {
|
2019-01-17 08:52:30 +08:00
|
|
|
|
this.state.filterOptions.amount ? this.goodsSearch({ currPage: 1, order: "g.sales_volume desc" }) : this.goodsSearch({ currPage: 1, order: "g.sales_volume" })
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
if (value == 2) {
|
|
|
|
|
this.setState({
|
2019-01-17 08:52:30 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
filterOptions: {
|
|
|
|
|
all: false,
|
|
|
|
|
amount: false,
|
|
|
|
|
newProduct: !this.state.filterOptions.newProduct,
|
|
|
|
|
price: false,
|
|
|
|
|
popularity: false
|
|
|
|
|
}
|
|
|
|
|
}, () => {
|
2019-01-17 08:52:30 +08:00
|
|
|
|
this.state.filterOptions.newProduct ? this.goodsSearch({ currPage: 1, order: "g.create_date desc" }) : this.goodsSearch({ currPage: 1, order: "g.create_date" })
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (value == 3) {
|
|
|
|
|
|
|
|
|
|
this.setState({
|
2019-01-17 08:52:30 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
filterOptions: {
|
|
|
|
|
all: false,
|
|
|
|
|
amount: false,
|
|
|
|
|
newProduct: false,
|
|
|
|
|
price: !this.state.filterOptions.price,
|
|
|
|
|
popularity: false
|
|
|
|
|
}
|
|
|
|
|
}, () => {
|
2019-01-17 08:52:30 +08:00
|
|
|
|
this.state.filterOptions.price ? this.goodsSearch({ currPage: 1, order: "g.goods_price desc" }) : this.goodsSearch({ currPage: 1, order: "g.goods_price" })
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (value == 4) {
|
|
|
|
|
|
|
|
|
|
this.setState({
|
2019-01-17 08:52:30 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
filterOptions: {
|
|
|
|
|
all: false,
|
|
|
|
|
amount: false,
|
|
|
|
|
newProduct: false,
|
|
|
|
|
price: false,
|
|
|
|
|
popularity: !this.state.filterOptions.popularity
|
|
|
|
|
}
|
|
|
|
|
}, () => {
|
2019-01-17 08:52:30 +08:00
|
|
|
|
this.state.filterOptions.popularity ? this.goodsSearch({ currPage: 1, order: "g.browse_times desc", }) : this.goodsSearch({ currPage: 1, order: "g.browse_times" })
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}
|
2018-12-05 17:30:18 +08:00
|
|
|
|
}
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 是否显示侧边筛选
|
2018-12-14 17:10:23 +08:00
|
|
|
|
showAndHideFilter() {
|
2018-12-05 17:30:18 +08:00
|
|
|
|
this.setState({ isShowFilter: !this.state.isShowFilter })
|
2018-12-04 17:32:30 +08:00
|
|
|
|
}
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 选择侧边筛选的标签
|
2018-12-28 17:29:42 +08:00
|
|
|
|
selectTag(name) {
|
|
|
|
|
const id = name.name
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.showLoading({ title: '加载中' })
|
2018-12-28 17:29:42 +08:00
|
|
|
|
// 处理分类筛选项
|
|
|
|
|
const newMainType = this.state.mainType.map((item) => {
|
|
|
|
|
if (item.id === id) {
|
|
|
|
|
item.checked = !item.checked
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({ goods_class_id: id, checkedFilterIdList: this.state.checkedFilterIdList.concat([item]) }, () => {
|
|
|
|
|
this.getSearchParams({ goods_class_id: this.state.goods_class_id })
|
|
|
|
|
this.goodsSearch({ goods_class_id: this.state.goods_class_id })
|
|
|
|
|
})
|
|
|
|
|
}, 1000);
|
2018-12-14 17:10:23 +08:00
|
|
|
|
}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
return item
|
|
|
|
|
})
|
|
|
|
|
// 处理商品类型筛选项
|
|
|
|
|
const newGoodType = this.state.goodType.map((item) => {
|
|
|
|
|
if (item.id === id) {
|
|
|
|
|
item.checked = !item.checked
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({ goods_type: id, checkedFilterIdList: this.state.checkedFilterIdList.concat([item]) }, () => {
|
|
|
|
|
this.getSearchParams({ goods_type: this.state.goods_type })
|
|
|
|
|
this.goodsSearch({ goods_type: this.state.goods_type })
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
|
|
|
|
// 处理其他筛选项
|
|
|
|
|
const newOtherType = this.state.otherType.map(item => {
|
|
|
|
|
const value = Object.values(item)[0]
|
|
|
|
|
for (let each in value) {
|
|
|
|
|
if (value[each].name === id) {
|
|
|
|
|
value[each].checked = !value[each].checked
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
2018-12-29 17:15:59 +08:00
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
this.setState({ checkedFilterIdList: this.state.checkedFilterIdList.concat(value[each]), goodsParam: [{ param_id: value[each].name.id, param_value: value[each].name }] }, () => {
|
|
|
|
|
this.getSearchParams({ goodsParam: this.state.goodsParam })
|
|
|
|
|
this.goodsSearch({ goodsParam: this.state.goodsParam })
|
|
|
|
|
})
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
|
|
|
|
// 处理宽度筛选项
|
|
|
|
|
const newWidthType = this.state.widthType.map((item) => {
|
|
|
|
|
if (item.name === id) {
|
|
|
|
|
item.checked = !item.checked
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.setState({ checkedFilterIdList: this.state.checkedFilterIdList.concat(item), goodsParamExt: [{ param_id: item.id, param_ext: [item.value] }] }, () => {
|
|
|
|
|
this.getSearchParams({ goodsParamExt: this.state.goodsParamExt })
|
|
|
|
|
this.goodsSearch({ goodsParamExt: this.state.goodsParamExt })
|
|
|
|
|
})
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
2019-01-18 17:09:17 +08:00
|
|
|
|
|
|
|
|
|
this.setState({ mainType: newMainType, loadMorePageIndex: 1, goodType: newGoodType, widthType: newWidthType, otherType: newOtherType }, () => {
|
2018-12-28 17:29:42 +08:00
|
|
|
|
// console.log(this.state.mainType)
|
|
|
|
|
})
|
2018-12-04 17:32:30 +08:00
|
|
|
|
}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
handleOnPageChange(value) {
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.showLoading({ title: '加载中' })
|
2018-12-14 17:10:23 +08:00
|
|
|
|
this.goodsSearch({ curr_page: value.current, order: this.state.filterCondition })
|
|
|
|
|
}
|
|
|
|
|
showHomePage() {
|
|
|
|
|
this.setState({ showShopHomePage: true })
|
|
|
|
|
}
|
|
|
|
|
showDescriptionPage() {
|
|
|
|
|
this.setState({ showShopHomePage: false })
|
|
|
|
|
}
|
2019-01-14 17:04:08 +08:00
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
// 确认筛选
|
|
|
|
|
submitFilter() {
|
|
|
|
|
this.setState({ isShowFilter: false })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//重置按键筛选
|
|
|
|
|
resetFilterList() {
|
2019-01-14 17:04:08 +08:00
|
|
|
|
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.showLoading({ title: '加载中' })
|
2018-12-25 17:26:35 +08:00
|
|
|
|
this.setState({
|
2019-01-27 17:35:20 +08:00
|
|
|
|
checkedFilterIdList: [],
|
|
|
|
|
curr_page: 1,
|
2018-12-28 17:29:42 +08:00
|
|
|
|
page_count: 10,
|
|
|
|
|
shop_name: false,
|
|
|
|
|
config_id: 4,
|
|
|
|
|
shop_class_id: '',
|
|
|
|
|
order: '',
|
2019-01-17 08:52:30 +08:00
|
|
|
|
curr_page: 1,
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goods_class_id: '',
|
2019-01-27 17:35:20 +08:00
|
|
|
|
class_filter: '',
|
|
|
|
|
goods_type: '',
|
2018-12-28 17:29:42 +08:00
|
|
|
|
goodsSpec: [],
|
|
|
|
|
goodsParam: [],
|
|
|
|
|
goodsParamExt: [],
|
|
|
|
|
}, () => {
|
|
|
|
|
this.getSearchParams({})
|
|
|
|
|
this.goodsSearch({})
|
2018-12-25 17:26:35 +08:00
|
|
|
|
})
|
2018-12-28 17:29:42 +08:00
|
|
|
|
|
|
|
|
|
|
2018-12-25 17:26:35 +08:00
|
|
|
|
}
|
2019-01-27 17:35:20 +08:00
|
|
|
|
openNavMap() {
|
|
|
|
|
Taro.openLocation({
|
|
|
|
|
latitude: Number(this.state.latitude),
|
|
|
|
|
longitude: Number(this.state.longitude),
|
|
|
|
|
name: this.state.shopAddress,
|
2018-12-28 17:29:42 +08:00
|
|
|
|
|
2019-01-27 17:35:20 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
componentDidMount() {
|
2018-12-29 17:15:59 +08:00
|
|
|
|
Taro.showLoading({ title: '加载中' })
|
2018-12-11 17:34:06 +08:00
|
|
|
|
//页面加载之后 得到指定店铺的商品 和 筛选标签
|
2019-01-18 17:09:17 +08:00
|
|
|
|
this.goodsSearch({}) // 加载店铺商品
|
2018-12-25 17:26:35 +08:00
|
|
|
|
this.getSearchParams({})// 加载筛选项
|
2019-01-18 17:09:17 +08:00
|
|
|
|
this.getShopDescription({}) // 加载店铺说明
|
2018-12-03 17:32:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidShow() { }
|
|
|
|
|
|
|
|
|
|
componentDidHide() { }
|
|
|
|
|
|
2019-01-14 17:04:08 +08:00
|
|
|
|
// 底部加载
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
Taro.showLoading({
|
|
|
|
|
title: '加载中'
|
|
|
|
|
})
|
2019-01-18 17:09:17 +08:00
|
|
|
|
this.setState({ isAddToList: true, loadMorePageIndex: this.state.loadMorePageIndex + 1 }, () => {
|
2019-01-17 08:52:30 +08:00
|
|
|
|
this.goodsSearch({ curr_page: this.state.loadMorePageIndex })
|
2019-01-14 17:04:08 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
2019-01-18 17:09:17 +08:00
|
|
|
|
// 页面位置
|
|
|
|
|
onPageScroll(location) {
|
|
|
|
|
if (location.scrollTop <= 300 && this.state.isShowTopNav) {
|
|
|
|
|
this.setState({ isShowTopNav: false })
|
|
|
|
|
} else if (location.scrollTop > 300 && !this.state.isShowTopNav) {
|
|
|
|
|
this.setState({ isShowTopNav: true })
|
|
|
|
|
}
|
2019-01-17 08:52:30 +08:00
|
|
|
|
}
|
2018-12-03 17:32:48 +08:00
|
|
|
|
render() {
|
2019-01-27 17:35:20 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
const ShopItemElementsArray = this.state.shopItem.length ? this.state.shopItem.map((item, index) => {
|
2018-12-04 17:32:30 +08:00
|
|
|
|
return <View key={index} className='shop-item' >
|
|
|
|
|
<ShopItem item={item}></ShopItem>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
</View>
|
|
|
|
|
}) : null
|
|
|
|
|
|
|
|
|
|
const filterElementsArray = this.state.filterBar.map((item, index) => {
|
|
|
|
|
let isTure = this.state.filterOptions[item]
|
|
|
|
|
|
|
|
|
|
return <View key={index} onClick={this.accendingDescending.bind(this, index)} className={index === this.state.selectedFilterValue ? 'filter-title actived' : 'filter-title'}>
|
2018-12-04 17:32:30 +08:00
|
|
|
|
<Text className='text'>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
{this.state.filterBarKeys[item]}
|
2018-12-04 17:32:30 +08:00
|
|
|
|
</Text>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
{index !== 0 && index !== 5 && (isTure ? <AtIcon value='chevron-down' size='10' color='#F00'></AtIcon> : <AtIcon value='chevron-up' size='10' color='#F00'></AtIcon>)}
|
2018-12-04 17:32:30 +08:00
|
|
|
|
</View>
|
|
|
|
|
})
|
2018-12-28 17:29:42 +08:00
|
|
|
|
// 侧边已选项
|
|
|
|
|
const checkedFilterElementsArray = this.state.checkedFilterIdList.map((item, index) => {
|
|
|
|
|
return <AtTag style='margin-left:5px' key={index}
|
2019-01-27 17:35:20 +08:00
|
|
|
|
name={item.id}
|
|
|
|
|
type='primary'
|
|
|
|
|
active={item.checked}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
//onClick={this.selectTag.bind(this)}
|
|
|
|
|
>{item.name}</AtTag>
|
|
|
|
|
})
|
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
// 侧边筛选的分类项
|
|
|
|
|
const goodsClassElementsArray = this.state.mainType.map((item, index) => {
|
2018-12-05 17:30:18 +08:00
|
|
|
|
return <AtTag style='margin-left:5px' key={index}
|
2019-01-27 17:35:20 +08:00
|
|
|
|
name={item.id}
|
|
|
|
|
type='primary'
|
|
|
|
|
active={item.checked}
|
|
|
|
|
onClick={this.selectTag.bind(this)}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
>{item.name}</AtTag>
|
|
|
|
|
})
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 侧边筛选的商品类型项
|
2018-12-28 17:29:42 +08:00
|
|
|
|
const goodsTypeElementsArray = this.state.goodType.map((item, index) => {
|
2018-12-06 17:24:34 +08:00
|
|
|
|
return <AtTag style='margin-left:5px' key={index}
|
2019-01-27 17:35:20 +08:00
|
|
|
|
name={item.id}
|
|
|
|
|
type='primary'
|
|
|
|
|
active={item.checked}
|
|
|
|
|
onClick={this.selectTag.bind(this)}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
>{item.name}</AtTag>
|
|
|
|
|
})
|
2018-12-14 17:10:23 +08:00
|
|
|
|
|
2018-12-11 17:34:06 +08:00
|
|
|
|
// 侧边筛选的其他项
|
2018-12-28 17:29:42 +08:00
|
|
|
|
const goodsParamElementsArray = this.state.otherType.map((item, index) => {
|
|
|
|
|
let titleKey = Object.keys(item)[0]
|
|
|
|
|
let values = item[titleKey]
|
|
|
|
|
return <View key={index}><View className='title' >{titleKey}</View>
|
|
|
|
|
{values.map((subItem, subIndex) => {
|
|
|
|
|
let name = subItem.name
|
|
|
|
|
let isCheck = subItem.checked
|
|
|
|
|
return <View className='button-box' key={subIndex}>
|
|
|
|
|
<AtTag style='margin-left:5px'
|
2019-01-27 17:35:20 +08:00
|
|
|
|
name={name}
|
|
|
|
|
type='primary'
|
|
|
|
|
active={isCheck}
|
|
|
|
|
onClick={this.selectTag.bind(this)}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
>{name}</AtTag>
|
|
|
|
|
</View>
|
|
|
|
|
})}
|
2018-12-06 17:24:34 +08:00
|
|
|
|
</View>
|
2018-12-28 17:29:42 +08:00
|
|
|
|
})
|
2018-12-04 17:32:30 +08:00
|
|
|
|
|
2018-12-28 17:29:42 +08:00
|
|
|
|
// 侧边筛选宽度选项
|
|
|
|
|
const widthnessElementsArray = this.state.widthType.map((item, index) => {
|
|
|
|
|
return <AtTag style='margin-left:5px' key={index}
|
2019-01-27 17:35:20 +08:00
|
|
|
|
name={item.name}
|
|
|
|
|
type='primary'
|
|
|
|
|
active={item.checked}
|
|
|
|
|
onClick={this.selectTag.bind(this)}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
>{item.name}</AtTag>
|
|
|
|
|
})
|
2018-12-14 17:10:23 +08:00
|
|
|
|
// 店铺页面/店铺主页
|
|
|
|
|
const shopHomepageElement = <View className='shop-home-page'>
|
|
|
|
|
<View className='filter-box'>
|
|
|
|
|
{filterElementsArray}
|
|
|
|
|
<View onClick={this.showAndHideFilter.bind(this)} className='filter-title' >
|
|
|
|
|
<Text className='text'>
|
|
|
|
|
筛选
|
|
|
|
|
</Text>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<View className={this.state.isShowFilter ? 'side-filter show' : 'side-filter'}>
|
|
|
|
|
<View className='left' onClick={this.showAndHideFilter.bind(this)}></View>
|
|
|
|
|
{/* 侧边筛选 */}
|
|
|
|
|
<View className='right'>
|
|
|
|
|
<View className='filter-box'>
|
2018-12-28 17:29:42 +08:00
|
|
|
|
{this.state.checkedFilterIdList.length ? <View className='title'>已选择</View> : null}
|
|
|
|
|
<View className='button-box'>{checkedFilterElementsArray}</View>
|
2019-01-14 17:04:08 +08:00
|
|
|
|
{this.state.mainType.length ? <View className='title'>分类</View> : null}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='button-box'>{goodsClassElementsArray}</View>
|
2019-01-14 17:04:08 +08:00
|
|
|
|
{this.state.goodType.length ? <View className='title'>商品类型</View> : null}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='button-box'>{goodsTypeElementsArray}</View>
|
|
|
|
|
{goodsParamElementsArray}
|
2019-01-14 17:04:08 +08:00
|
|
|
|
{this.state.widthType.length ? <View className='title'>宽度</View> : null}
|
2018-12-28 17:29:42 +08:00
|
|
|
|
<View className='button-box'>{widthnessElementsArray}</View>
|
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='confirm-button'>
|
2018-12-28 17:29:42 +08:00
|
|
|
|
<Button className='button' type='primary' size='mini' style='background-color:#FF7142' onClick={this.submitFilter.bind(this)} >确认</Button>
|
|
|
|
|
<Button className='button' type='primary' size='mini' style='background-color:#5cb85c' onClick={this.resetFilterList.bind(this)}>重置</Button>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='gap'></View>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
{/* 店铺的商品列表 */}
|
|
|
|
|
<View className='container'>
|
2019-01-27 17:35:20 +08:00
|
|
|
|
{this.state.shopItem.length ? ShopItemElementsArray : <View className='no-more-title'> 没有更多了</View>}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
</View>
|
2019-01-14 17:04:08 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
</View>
|
|
|
|
|
// 店铺详情
|
|
|
|
|
const shopDescriptionElement = <View className='shop-description'>
|
|
|
|
|
<View className='img-box'>
|
2018-12-28 17:29:42 +08:00
|
|
|
|
<Image src={URL.Base + 'Public/images/shop/bg_banner.png'} mode='scaleToFill' style='width: 100%;height:150px;' />
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='content'>
|
|
|
|
|
<View className='shop-name'>
|
|
|
|
|
{this.state.shopName}
|
|
|
|
|
</View>
|
|
|
|
|
<View className='shop-address'>
|
|
|
|
|
{this.state.shopAddress}
|
|
|
|
|
</View>
|
|
|
|
|
<View className='contact'>
|
|
|
|
|
<Text className='contact-name'>联系人:{this.state.contactName}</Text>
|
|
|
|
|
<Text className='contact-number'>联系电话:{this.state.contactNumber}</Text>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='shop-description2'>
|
|
|
|
|
<View className='title'>
|
|
|
|
|
店铺简介
|
|
|
|
|
</View>
|
2019-01-21 17:25:14 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='description'>
|
|
|
|
|
<Text className='title-sub'>店铺介绍:</Text>
|
|
|
|
|
<Text className='detail'>{this.state.shopDescription}</Text>
|
|
|
|
|
</View>
|
|
|
|
|
</View>
|
2019-01-21 17:25:14 +08:00
|
|
|
|
|
|
|
|
|
{/* <View className='description-img'>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='img-box'> <Image mode='aspectFit' src={URL.Base + 'Public/images/shop/bg_banner.png'} style='max-width: 100%; max-height:100%;' /></View>
|
|
|
|
|
<View className='img-box'> <Image mode='aspectFit' src={URL.Base + 'Public/images/shop/bg_banner.png'} style='max-width: 100%;max-height:100%;' /></View>
|
|
|
|
|
<View className='img-box'> <Image mode='aspectFit' src={URL.Base + 'Public/images/shop/bg_banner.png'} style='max-width: 100%;max-height:100%;' /></View>
|
2019-01-21 17:25:14 +08:00
|
|
|
|
</View> */}
|
|
|
|
|
{/* location.png */}
|
2019-01-17 08:52:30 +08:00
|
|
|
|
<Map
|
2019-01-27 17:35:20 +08:00
|
|
|
|
id='map'
|
|
|
|
|
longitude={this.state.longitude}
|
|
|
|
|
latitude={this.state.latitude}
|
|
|
|
|
scale='14'
|
|
|
|
|
controls='{{controls}}'
|
|
|
|
|
bindcontroltap='controltap'
|
|
|
|
|
markers={[{
|
|
|
|
|
iconPath: locationIcon,
|
|
|
|
|
id: 0,
|
|
|
|
|
latitude: this.state.latitude,
|
|
|
|
|
longitude: this.state.longitude,
|
|
|
|
|
width: 30,
|
|
|
|
|
height: 30
|
|
|
|
|
}]}
|
|
|
|
|
bindmarkertap='markertap'
|
|
|
|
|
polyline='{{polyline}}'
|
|
|
|
|
bindregionchange='regionchange'
|
|
|
|
|
show-location
|
|
|
|
|
style='width: 100%; height: 300px;'
|
2019-01-17 08:52:30 +08:00
|
|
|
|
></Map>
|
2019-01-27 17:35:20 +08:00
|
|
|
|
<View className='button-box'>
|
|
|
|
|
<Button className='button-blue' onClick={this.openNavMap.bind(this)}>打开地图</Button>
|
|
|
|
|
</View>
|
|
|
|
|
|
2019-01-21 17:25:14 +08:00
|
|
|
|
{/* <Map
|
|
|
|
|
id='map'
|
|
|
|
|
longitude={this.state.longitude}
|
|
|
|
|
latitude={this.state.latitude}
|
|
|
|
|
scale='14'
|
|
|
|
|
controls='{{controls}}'
|
|
|
|
|
bindcontroltap='controltap'
|
|
|
|
|
markers='{{markers}}'
|
|
|
|
|
bindmarkertap='markertap'
|
|
|
|
|
polyline='{{polyline}}'
|
|
|
|
|
bindregionchange='regionchange'
|
|
|
|
|
show-location
|
|
|
|
|
style='width: 100%; height: 300px;'
|
|
|
|
|
></Map> */}
|
2018-12-14 17:10:23 +08:00
|
|
|
|
</View>
|
2018-12-25 17:26:35 +08:00
|
|
|
|
|
2019-01-21 17:25:14 +08:00
|
|
|
|
|
2018-12-03 17:32:48 +08:00
|
|
|
|
return (
|
2018-12-25 17:26:35 +08:00
|
|
|
|
<View className='shop' >
|
2019-01-14 17:04:08 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='banner-box'>
|
2018-12-28 17:29:42 +08:00
|
|
|
|
<Image src={URL.Base + 'Public/visual_editing/img/ksh_bg.jpg'} mode='scaleToFill' style='width: 100%;height:120px; ' />
|
2018-12-25 17:26:35 +08:00
|
|
|
|
<View className='shop-name'>{this.state.shopName}</View>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
</View>
|
|
|
|
|
<View className='nav-box'>
|
|
|
|
|
<View className='nav'>
|
2019-01-21 17:25:14 +08:00
|
|
|
|
<View className='shop-cate'>
|
2019-01-27 17:35:20 +08:00
|
|
|
|
<View>
|
|
|
|
|
<ShopTypeInteractionComp url={URL.GetShopCategoryList} style='position:absolute;z-index:2;opacity:0;left:0'
|
|
|
|
|
shopId={this.state.shop_id}
|
|
|
|
|
onPassDataToChild={this.getDataFromShopChild.bind(this)}
|
|
|
|
|
></ShopTypeInteractionComp>
|
|
|
|
|
</View>
|
|
|
|
|
<View className='interactive' onClick={this.showPopUp.bind(this)}>
|
2019-01-21 17:25:14 +08:00
|
|
|
|
<Text className='text'>
|
|
|
|
|
店铺全部分类
|
|
|
|
|
</Text>
|
|
|
|
|
<AtIcon value='menu' size='10' color='white'></AtIcon>
|
|
|
|
|
</View>
|
2018-12-03 17:32:48 +08:00
|
|
|
|
</View>
|
2019-01-21 17:25:14 +08:00
|
|
|
|
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='homepage-link' onClick={this.showHomePage.bind()}>
|
2018-12-03 17:32:48 +08:00
|
|
|
|
<Text className='text'>
|
|
|
|
|
首页
|
|
|
|
|
</Text>
|
|
|
|
|
</View>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
<View className='shoppage-link' onClick={this.showDescriptionPage.bind()}>
|
2018-12-03 17:32:48 +08:00
|
|
|
|
<Text className='text'>
|
|
|
|
|
店铺说明
|
|
|
|
|
</Text>
|
|
|
|
|
</View>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
</View>
|
2018-12-03 17:32:48 +08:00
|
|
|
|
</View>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
{/* 显示店铺首页或者店铺详情 */}
|
|
|
|
|
{this.state.showShopHomePage ? shopHomepageElement : shopDescriptionElement}
|
2019-01-17 08:52:30 +08:00
|
|
|
|
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
2019-01-10 17:36:45 +08:00
|
|
|
|
<CopyrightComponent></CopyrightComponent>
|
2019-01-18 17:09:17 +08:00
|
|
|
|
|
2019-01-17 08:52:30 +08:00
|
|
|
|
<View className='gap' style='height:150rpx'>
|
|
|
|
|
</View>
|
2018-12-06 17:24:34 +08:00
|
|
|
|
<View className='bottom-nav-box'>
|
2019-01-27 17:35:20 +08:00
|
|
|
|
{/* <BottomNav otherData={{ menu: [{ name: '首页' }, { name: '分类' }, { name: '购物车' }, { name: '教程软件' }, { name: '更多' }] }} /> */}
|
2018-12-06 17:24:34 +08:00
|
|
|
|
</View>
|
2018-12-14 17:10:23 +08:00
|
|
|
|
</View>
|
2018-12-03 17:32:48 +08:00
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Shop
|