alipay initial
This commit is contained in:
parent
ad18b8919c
commit
bf08b9d9d4
@ -89,7 +89,7 @@ class App extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentDidShow() { }
|
||||
|
16
src/app.scss
16
src/app.scss
@ -5,7 +5,9 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
||||
$linearDarkRed:linear-gradient(to right, #d9534f, #d9534f);;
|
||||
$linearGreen:linear-gradient(to right, #5cb85c, #5cb85c);;
|
||||
$linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
|
||||
page{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.input-index--at-input__title{
|
||||
font-weight: bold
|
||||
@ -25,27 +27,31 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
|
||||
color:white;
|
||||
font-size: 28px;
|
||||
background:$linearGreen;
|
||||
margin:20px auto
|
||||
margin:20px auto;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
.button-dark-red{
|
||||
color:white;
|
||||
font-size: 28px;
|
||||
background:$linearDarkRed;
|
||||
margin:20px auto
|
||||
margin:20px auto;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
.button-orange{
|
||||
color:white;
|
||||
font-size: 28px;
|
||||
background:$linearOrange;
|
||||
margin:20px auto
|
||||
margin:20px auto;
|
||||
border-color: #fff;
|
||||
}
|
||||
.button-blue{
|
||||
color:white;
|
||||
font-size: 28px;
|
||||
background:$linearBlue;
|
||||
margin:20px auto
|
||||
margin:20px auto;
|
||||
border-color: #fff;
|
||||
}
|
||||
.blur{
|
||||
opacity: 0.5;
|
||||
|
@ -4,6 +4,7 @@ import { AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtNotice
|
||||
|
||||
import VoucherPosterComponent from './voucherPosterComponent/voucherPosterComponent'
|
||||
|
||||
import onClickValueService from '../../util/onClickValueService'
|
||||
import './filteredShopComponent.scss'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
@ -41,8 +42,8 @@ class recommondShop extends Component {
|
||||
}
|
||||
}
|
||||
goToShop(e) {
|
||||
console.log('e',e)
|
||||
const value = e.currentTarget.dataset.eTapAA
|
||||
|
||||
const value = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/shop/shop?id=' + value.shop_id
|
||||
})
|
||||
@ -245,8 +246,8 @@ class recommondShop extends Component {
|
||||
const goodsElementsArray = goods !== null ? slicedGoods.map((item, index) => {
|
||||
return <View className='goods-img-box' key={index}>
|
||||
<Image className='goods-img' onClick={this.goToShop.bind(this, this.props.shop)}
|
||||
mode='aspectFit' style='max-height: 100%; max-width: 100%;'
|
||||
src={URL.Base + item.goods_url}
|
||||
mode='aspectFit' style='max-height: 100%; max-width: 100%;'
|
||||
src={URL.Base + item.goods_url}
|
||||
/>
|
||||
</View>
|
||||
}) : null
|
||||
@ -264,10 +265,10 @@ class recommondShop extends Component {
|
||||
<Text>联系人:</Text>
|
||||
</View>
|
||||
<Input name='value'
|
||||
type='text'
|
||||
value={this.state.userName}
|
||||
placeholder='请输入联系人'
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
type='text'
|
||||
value={this.state.userName}
|
||||
placeholder='请输入联系人'
|
||||
onInput={this.handleInputCsultName.bind(this)}
|
||||
/>
|
||||
|
||||
</View>
|
||||
@ -276,11 +277,11 @@ class recommondShop extends Component {
|
||||
<Text>联系电话:</Text>
|
||||
</View>
|
||||
<Input name='value'
|
||||
type='number'
|
||||
maxLength='11'
|
||||
value={this.state.userPhone}
|
||||
placeholder='请输入联系电话'
|
||||
onInput={this.handleInputCsultPhone.bind(this)}
|
||||
type='number'
|
||||
maxLength='11'
|
||||
value={this.state.userPhone}
|
||||
placeholder='请输入联系电话'
|
||||
onInput={this.handleInputCsultPhone.bind(this)}
|
||||
/>
|
||||
</View>
|
||||
</AtModalContent>
|
||||
@ -296,20 +297,20 @@ class recommondShop extends Component {
|
||||
<View className='shop-list-box' >
|
||||
{consultModalElement}
|
||||
<VoucherPosterComponent
|
||||
name={this.state.userName}
|
||||
phone={this.state.userPhone}
|
||||
shopId={this.props.shop.shop_id}
|
||||
isCanVoucher={this.state.isCanVoucher}
|
||||
isVoucherPoster={this.state.isOpenVoucher}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
voucherLeft={this.props.shop.left_nums}
|
||||
voucherResponseMsg={this.state.voucherResponseMsg}
|
||||
categoryLevel={this.props.categoryLevel}
|
||||
classId={this.props.classId === '-1' ? '' : this.props.classId}
|
||||
name={this.state.userName}
|
||||
phone={this.state.userPhone}
|
||||
shopId={this.props.shop.shop_id}
|
||||
isCanVoucher={this.state.isCanVoucher}
|
||||
isVoucherPoster={this.state.isOpenVoucher}
|
||||
onPassDataToChild={this.getDataFromChild.bind(this)}
|
||||
voucherLeft={this.props.shop.left_nums}
|
||||
voucherResponseMsg={this.state.voucherResponseMsg}
|
||||
categoryLevel={this.props.categoryLevel}
|
||||
classId={this.props.classId === '-1' ? '' : this.props.classId}
|
||||
></VoucherPosterComponent>
|
||||
<View className='header'>
|
||||
|
||||
<View className='title'>
|
||||
<View className='title' style='text-align:left'>
|
||||
<Image src={ads !== 0 ? hornIcon : houseIcon} style='width:12px; height:12px; vertical-align: middle;' />
|
||||
<Text style='margin-left:2px; vertical-align: middle;'> {title}</Text>
|
||||
</View>
|
||||
|
@ -137,11 +137,11 @@ class VoucherPoster extends Component {
|
||||
当前优惠券<Text class='left-amount'>{this.props.voucherLeft}</Text>张
|
||||
</View>
|
||||
<View className='input-name' >
|
||||
<View className='title'> <Text>联系人:</Text></View>
|
||||
<View className='title' style='padding:0px'> <Text>联系人:</Text></View>
|
||||
<Input class='input-info' type='text' placeholder='请输入联系人' value={this.props.name} onInput={this.handleNameChange.bind(this)} />
|
||||
</View>
|
||||
<View className='input-number' >
|
||||
<View className='title'> <Text>联系电话:</Text></View>
|
||||
<View className='title' style='padding:0px'> <Text>联系电话:</Text></View>
|
||||
<Input class='input-info' placeholder='请输入联系电话' type='number' maxLength='11' value={this.props.phone} onInput={this.handlePhoneChange.bind(this)} />
|
||||
</View>
|
||||
<View>
|
||||
@ -151,7 +151,7 @@ class VoucherPoster extends Component {
|
||||
</View>
|
||||
|
||||
<View className='button' >
|
||||
<Button size='default' disabled={!this.props.isCanVoucher} className={!this.props.isCanVoucher ? 'button-orange blur' : 'button-orange'} onClick={this.voucherModalConfirm.bind(this)}>预约领取</Button>
|
||||
<Button size='default' disabled={!this.props.isCanVoucher} style='border:0px;line-hight:47px;padding:0;' className={!this.props.isCanVoucher ? 'button-orange blur' : 'button-orange'} onClick={this.voucherModalConfirm.bind(this)}>预约领取</Button>
|
||||
</View>
|
||||
<View className='declare'>
|
||||
|
||||
|
@ -39,9 +39,6 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
||||
top:0px;
|
||||
background-size:100% 100%;
|
||||
min-height:100%;
|
||||
|
||||
|
||||
|
||||
.close-icon{
|
||||
margin-left:88%;
|
||||
margin-top:2%;
|
||||
@ -60,7 +57,6 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
||||
.input-name,.input-number{
|
||||
margin-top:2%;
|
||||
margin-left:10%;
|
||||
|
||||
overflow: hidden;
|
||||
width: 80%;
|
||||
|
||||
@ -73,6 +69,7 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
|
||||
align-items:center;
|
||||
.title{
|
||||
margin-left:7%;
|
||||
width:200px;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Text, Image, Button } from '@tarojs/components'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtToast, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import { AtInput, Picker, AtIcon, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
|
||||
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
|
||||
import loginExpired from '../../util/loginExpired'
|
||||
import onClickValueService from '../../util/onClickValueService'
|
||||
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './allDemanding.scss'
|
||||
@ -165,7 +166,7 @@ class AllDemanding extends Component {
|
||||
|
||||
}
|
||||
grabOrder(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
const id = onClickValueService(e)
|
||||
this.setState({ isOpenedGrabModal: true, grabOrderId: id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
@ -204,7 +205,7 @@ class AllDemanding extends Component {
|
||||
}
|
||||
|
||||
goToGrabOrderPage(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
const id = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + id
|
||||
})
|
||||
@ -328,7 +329,7 @@ class AllDemanding extends Component {
|
||||
{/* 开始和结束日期选择 */}
|
||||
<View className='page-section'>
|
||||
<View className='picker-box'>
|
||||
<Picker mode='date' className='picker-container' onChange={this.onStartDateChange}>
|
||||
<Picker mode='date' className='picker-container' style=' width: 56px' onChange={this.onStartDateChange}>
|
||||
<View className='picker'>
|
||||
<View className='title-box'>
|
||||
<Text className='title'>开始日期:</Text> <Text className='date'>{this.state.startDateSel}</Text>
|
||||
|
@ -54,7 +54,7 @@ $themeColor: #FF7142;
|
||||
flex-wrap: nowrap;
|
||||
flex-direction: row;
|
||||
.picker-container{
|
||||
flex:1
|
||||
width: 56px
|
||||
}
|
||||
}
|
||||
.button-box{
|
||||
|
@ -36,6 +36,7 @@ class Goods extends Component {
|
||||
|
||||
// 商品详情api
|
||||
getGoodDescription() {
|
||||
|
||||
Taro.request({
|
||||
url: URL.GetShopItemDetail,
|
||||
method: 'POST',
|
||||
|
@ -5,6 +5,7 @@ import { AtCurtain } from 'taro-ui'
|
||||
|
||||
import URL from '../../../serviceAPI.config'
|
||||
import './renderingView.scss'
|
||||
import onClickValueService from '../../../util/onClickValueService'
|
||||
|
||||
|
||||
|
||||
@ -25,7 +26,7 @@ class RenderingView extends Component {
|
||||
}
|
||||
|
||||
onClickHandler(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
const item = onClickValueService(e)
|
||||
this.setState({
|
||||
image: URL.Base + item.file_path,
|
||||
isOpened:true
|
||||
|
62
src/pages/home/clientDemanding/clientDemanding.js
Normal file
62
src/pages/home/clientDemanding/clientDemanding.js
Normal file
@ -0,0 +1,62 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Button, ScrollView, Text } from '@tarojs/components'
|
||||
|
||||
import './clientDemanding.scss'
|
||||
import onClickValueService from '../../../util/onClickValueService'
|
||||
|
||||
|
||||
class ClientDemanding extends Component {
|
||||
|
||||
passIdToParent(e) {
|
||||
this.props.onGrabOrderId(e)
|
||||
}
|
||||
// 导航去抢单页面
|
||||
goToGrabOrderPage(e) {
|
||||
const orderId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
const { ClientDemandingList } = this.props
|
||||
const clientDemandingElementArray = ClientDemandingList.length ? ClientDemandingList.map((item, index) => {
|
||||
return <View key={index} className={ClientDemandingList.length - 1 === index ? 'demanding-item last' : 'demanding-item'}>
|
||||
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<View className='item-tag'>
|
||||
<Text className='item-tag-text'> {item.class_name}</Text>
|
||||
</View>
|
||||
<View className='item-title'>
|
||||
{item.sd_title}
|
||||
</View>
|
||||
<View className='item-address'>
|
||||
{item.user_address || '--'}
|
||||
</View>
|
||||
<View className='item-name'>
|
||||
业主:{item.user_name}
|
||||
</View>
|
||||
</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.passIdToParent.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
|
||||
</View>
|
||||
}) : <View />
|
||||
return <ScrollView
|
||||
style='height100%'
|
||||
scrollX
|
||||
scrollWithAnimation
|
||||
scrollTop='0'
|
||||
lowerThreshold='20'
|
||||
upperThreshold='20'
|
||||
style='white-space: nowrap;'
|
||||
>
|
||||
{clientDemandingElementArray}
|
||||
</ScrollView>
|
||||
}
|
||||
}
|
||||
export default ClientDemanding
|
57
src/pages/home/clientDemanding/clientDemanding.scss
Normal file
57
src/pages/home/clientDemanding/clientDemanding.scss
Normal file
@ -0,0 +1,57 @@
|
||||
$themeColor: #FF7142;
|
||||
|
||||
.demanding-item{
|
||||
border:2px solid #ddd;
|
||||
border-right: 0px;
|
||||
height:100%;
|
||||
width:40%;
|
||||
display:inline-block;
|
||||
text-align: center;
|
||||
.item-tag{
|
||||
color:white;
|
||||
font-size: 30px;
|
||||
text-align: right;
|
||||
.item-tag-text{
|
||||
padding:5px;
|
||||
background-color: $themeColor;
|
||||
}
|
||||
}
|
||||
.item-title{
|
||||
font-size: 40px;
|
||||
min-height: 21px;
|
||||
clear: both;
|
||||
color: $themeColor;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.item-address{
|
||||
padding-top: 5px;
|
||||
font-size: 35px;
|
||||
// margin-top: 20px;
|
||||
}
|
||||
.item-name{
|
||||
color: #ccc;
|
||||
padding-top: 5px;
|
||||
font-size: 30px;
|
||||
// margin-top: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.button-orange{
|
||||
color:white;
|
||||
font-size: 28px;
|
||||
background:linear-gradient(to right, #FF7142, #FF7142);;
|
||||
margin:20px auto
|
||||
}
|
||||
.blur{
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.last{
|
||||
border-right: 2px solid #ddd;
|
||||
}
|
@ -1,11 +1,14 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
||||
import { View, Button, Text, Swiper, SwiperItem, Image, ScrollView } from '@tarojs/components'
|
||||
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import MainCateSlider from './mainCateSlider/mainCateSlider'
|
||||
import SubCateSlider from './subCateSlider/subCateSlider'
|
||||
import ClientDemanding from './clientDemanding/clientDemanding'
|
||||
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
|
||||
import onClickValueService from '../../util/onClickValueService'
|
||||
import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
@ -212,19 +215,17 @@ class Home extends Component {
|
||||
}
|
||||
// 点击大类icon
|
||||
onClickParentCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
const item = onClickValueService(e)
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
this.getShops({})
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// 点击子类
|
||||
onClickChildCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
clickChildCateHanlder(e) {
|
||||
const item = onClickValueService(e)
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
@ -235,13 +236,13 @@ class Home extends Component {
|
||||
// this.getShops(item.parent_class_id, item.class_id, 2)
|
||||
|
||||
}
|
||||
scrollToSubCate(item) {
|
||||
scrollToSubFromChild(e) {
|
||||
|
||||
Taro.pageScrollTo({
|
||||
scrollTop: 410,
|
||||
duration: 300
|
||||
})
|
||||
this.onClickParentCate(item)
|
||||
this.onClickParentCate(e)
|
||||
}
|
||||
// 转到其他页面
|
||||
goToAllDemandingPage() {
|
||||
@ -255,7 +256,7 @@ class Home extends Component {
|
||||
}
|
||||
|
||||
grabOrderId(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
const id = onClickValueService(e)
|
||||
this.setState({ isOpen: true, grabOrderId: id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
@ -274,14 +275,7 @@ class Home extends Component {
|
||||
}
|
||||
|
||||
|
||||
// 导航去抢单页面
|
||||
goToGrabOrderPage(e) {
|
||||
const orderId = e.currentTarget.dataset.eTapAA
|
||||
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
}
|
||||
goToMyNeedsPublish() {
|
||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
||||
Taro.navigateTo({
|
||||
@ -362,60 +356,14 @@ class Home extends Component {
|
||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
|
||||
|
||||
return <SwiperItem key={index} >
|
||||
<View className={this.state.demanding.length - 1 === index ? 'demanding-item last' : 'demanding-item'}>
|
||||
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<View className='item-tag'>
|
||||
<Text className='item-tag-text'> {item.class_name}</Text>
|
||||
</View>
|
||||
<View className='item-title'>
|
||||
{item.sd_title}
|
||||
</View>
|
||||
<View className='item-address'>
|
||||
{item.user_address || '--'}
|
||||
</View>
|
||||
<View className='item-name'>
|
||||
业主:{item.user_name}
|
||||
</View>
|
||||
</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
{/* <View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
</SwiperItem >
|
||||
}) : null
|
||||
const mainCate1 = this.state.categories[0]
|
||||
const mainCate2 = this.state.categories[1]
|
||||
|
||||
const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
|
||||
return <SwiperItem key={index}>
|
||||
<Image className='banner-img' src={URL.Base + item.ads_pic} />
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
// 这里应该代码可以优化-----
|
||||
const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
|
||||
const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
|
||||
return <FilteredShopComponent
|
||||
shop={item}
|
||||
@ -431,8 +379,14 @@ class Home extends Component {
|
||||
}) : null
|
||||
|
||||
return (
|
||||
<View className='home'>
|
||||
|
||||
<ScrollView
|
||||
className='home'
|
||||
scrollY
|
||||
scrollWithAnimation
|
||||
scrollTop='0'
|
||||
lowerThreshold='20'
|
||||
upperThreshold='20'
|
||||
>
|
||||
{/* 获取微信用户的信息 */}
|
||||
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
||||
|
||||
@ -440,8 +394,8 @@ class Home extends Component {
|
||||
|
||||
<View className='first-banner'>
|
||||
<Swiper
|
||||
style='height:90%;padding:0'
|
||||
className='swipper'
|
||||
style='height:120px;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
@ -454,33 +408,15 @@ class Home extends Component {
|
||||
</Swiper>
|
||||
</View>
|
||||
{/* 第二行图片滚动条 */}
|
||||
|
||||
<View className='second-banner'>
|
||||
<Swiper
|
||||
style='height:100%;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
// autoplay
|
||||
>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray1}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray2}
|
||||
</View>
|
||||
</SwiperItem>
|
||||
</Swiper>
|
||||
<MainCateSlider onScrollFromChild={this.scrollToSubFromChild.bind(this)} firstSlideData={mainCate1} secondSlideData={mainCate2} />
|
||||
</View>
|
||||
|
||||
{/* 第三行图片滚动条 */}
|
||||
<View className='third-banner'>
|
||||
<Swiper
|
||||
style='height:100px;'
|
||||
style='height:100%;padding:0'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
@ -509,31 +445,12 @@ class Home extends Component {
|
||||
</Text>
|
||||
</View>
|
||||
<View className='customer-demanding'>
|
||||
<Swiper
|
||||
style='height:180px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
|
||||
displayMultipleItems='2.5'
|
||||
>
|
||||
{demandingElemensArray}
|
||||
</Swiper>
|
||||
<ClientDemanding onGrabOrderId={this.grabOrderId.bind(this)} ClientDemandingList={this.state.demanding} />
|
||||
</View>
|
||||
|
||||
<View className='second-banner-level2'>
|
||||
{this.state.subCate.length ? <Swiper
|
||||
style='height:35px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
displayMultipleItems={this.state.subCate.length > 4.5 ? 4.5 : this.state.subCate.length}
|
||||
>
|
||||
{subCateElementsArray}
|
||||
</Swiper> : null}
|
||||
</View>
|
||||
{this.state.subCate.length ? <View className='second-banner-level2'>
|
||||
<SubCateSlider onClickChildCate={this.clickChildCateHanlder.bind(this)} subCateList={this.state.subCate} />
|
||||
</View> : <View />}
|
||||
<View className='title'>
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>行业推荐</Text>
|
||||
@ -559,7 +476,7 @@ class Home extends Component {
|
||||
{/* <BottomNav otherData={this.state.otherData} /> */}
|
||||
</View>
|
||||
{/* {this.state.isShopOwner ? <SellerTabBarComponent currentUrl={currentUrl} /> : <ClientTabBarComponent currentUrl={currentUrl} />} */}
|
||||
</View>
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,16 @@
|
||||
$themeColor: #FF7142;
|
||||
.home{
|
||||
overflow: hidden;
|
||||
|
||||
.first-banner{
|
||||
height:250px;
|
||||
.banner-img{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.first-banner ,.third-banner{
|
||||
height:200px;
|
||||
.banner-img{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
@ -47,7 +56,8 @@ $themeColor: #FF7142;
|
||||
}
|
||||
}
|
||||
.customer-demanding{
|
||||
padding:0 20px;
|
||||
padding:0 20px 20px;
|
||||
height: 300px;
|
||||
.demanding-item{
|
||||
border: 2rpx solid #ddd;
|
||||
border-right:0px;
|
||||
@ -127,8 +137,7 @@ $themeColor: #FF7142;
|
||||
|
||||
}
|
||||
.second-banner{
|
||||
height:28vh;
|
||||
|
||||
height:330px;
|
||||
.categories{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@ -148,18 +157,6 @@ $themeColor: #FF7142;
|
||||
}
|
||||
}
|
||||
.second-banner-level2{
|
||||
.swipper{
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
border-bottom:1px solid #F2F2F2;
|
||||
|
||||
.text{
|
||||
margin-top: 20px
|
||||
}
|
||||
}
|
||||
padding: 20px;
|
||||
|
||||
}
|
||||
|
||||
.swiper-sub{
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
64
src/pages/home/mainCateSlider/mainCateSlider.js
Normal file
64
src/pages/home/mainCateSlider/mainCateSlider.js
Normal file
@ -0,0 +1,64 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View } from '@tarojs/components'
|
||||
import { AtGrid, Swiper, SwiperItem } from 'taro-ui'
|
||||
|
||||
import URL from '../../../serviceAPI.config'
|
||||
import './mainCateSlider.scss'
|
||||
|
||||
|
||||
class MainCateSlider extends Component {
|
||||
|
||||
|
||||
passDataToParent(e) {
|
||||
|
||||
this.props.onScrollFromChild(e)
|
||||
}
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
}
|
||||
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
|
||||
componentDidHide() { }
|
||||
formateSliderData(data) {
|
||||
const formatedData = data.map(item => {
|
||||
item.image = URL.Base + item.icon
|
||||
item.value = item.class_name
|
||||
return item
|
||||
})
|
||||
console.log('formatedData', formatedData)
|
||||
return formatedData
|
||||
}
|
||||
render() {
|
||||
const { firstSlideData, secondSlideData } = this.props
|
||||
|
||||
const formatedFirstSlideData = firstSlideData ? this.formateSliderData(firstSlideData) : []
|
||||
const formatedSecondSlideData = secondSlideData ? this.formateSliderData(secondSlideData) : []
|
||||
|
||||
return (
|
||||
<Swiper
|
||||
style='height:100%'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
>
|
||||
<SwiperItem>
|
||||
<View style='height:100%'>
|
||||
< AtGrid hasBorder={false} columnNum={5} data={formatedFirstSlideData} onClick={this.passDataToParent.bind(this)} />
|
||||
</View>
|
||||
</SwiperItem> <SwiperItem>
|
||||
<View style='height:100%'>
|
||||
< AtGrid hasBorder={false} columnNum={5} data={formatedSecondSlideData} onClick={this.passDataToParent.bind(this)} />
|
||||
</View>
|
||||
</SwiperItem>
|
||||
</Swiper>
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default MainCateSlider
|
0
src/pages/home/mainCateSlider/mainCateSlider.scss
Normal file
0
src/pages/home/mainCateSlider/mainCateSlider.scss
Normal file
45
src/pages/home/subCateSlider/subCateSlider.js
Normal file
45
src/pages/home/subCateSlider/subCateSlider.js
Normal file
@ -0,0 +1,45 @@
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View } from '@tarojs/components'
|
||||
import { AtGrid, Swiper, SwiperItem } from 'taro-ui'
|
||||
import URL from '../../../serviceAPI.config'
|
||||
import './subCateSlider.scss'
|
||||
|
||||
|
||||
class SubCateSlider extends Component {
|
||||
|
||||
|
||||
passDataToParent(e) {
|
||||
|
||||
this.props.onClickChildCate(e)
|
||||
}
|
||||
|
||||
render() {
|
||||
const { subCateList } = this.props
|
||||
const subCateElementsArray = subCateList.map((item, index) => {
|
||||
return <View key={index} onClick={this.passDataToParent.bind(this, item)} className='view-item'>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</View>
|
||||
})
|
||||
|
||||
return (
|
||||
|
||||
<ScrollView
|
||||
|
||||
className='scroll-view'
|
||||
scrollX
|
||||
scrollWithAnimation
|
||||
scrollTop='0'
|
||||
lowerThreshold='20'
|
||||
upperThreshold='20'
|
||||
style='white-space: nowrap;'
|
||||
>
|
||||
|
||||
{subCateElementsArray}
|
||||
|
||||
</ScrollView>
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default SubCateSlider
|
11
src/pages/home/subCateSlider/subCateSlider.scss
Normal file
11
src/pages/home/subCateSlider/subCateSlider.scss
Normal file
@ -0,0 +1,11 @@
|
||||
.scroll-view{
|
||||
height:100%;
|
||||
padding:0px 0px;
|
||||
.view-item{
|
||||
width:150px;
|
||||
display:inline-block;
|
||||
text-align:center;
|
||||
padding-bottom: 10px;
|
||||
border-bottom:2px solid #F2F2F2;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import Logout from '../../util/logout'
|
||||
|
||||
import './individualCenter.scss'
|
||||
import URL from '../../serviceAPI.config'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
|
||||
|
||||
|
||||
@ -54,7 +55,8 @@ class IndividualCenter extends Component {
|
||||
}
|
||||
}
|
||||
handlerGridClick(e) {
|
||||
const value = e.currentTarget.dataset.eTapAA.value
|
||||
const value = onClickValueService(e).value
|
||||
|
||||
switch (value) {
|
||||
case '需求发布':
|
||||
Taro.switchTab({
|
||||
|
@ -55,10 +55,8 @@ class Login extends Component {
|
||||
Taro.showToast({
|
||||
title: '未知错误请联系管理员',
|
||||
icon: 'none',
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
componentDidMount() {
|
||||
|
||||
@ -96,7 +94,7 @@ class Login extends Component {
|
||||
<Input type='text' focus={true} name='username' maxLength='11' placeholder='请输入用户名/手机号' value={this.state.username} onInput={this.usernameHandler} />
|
||||
</View>
|
||||
<View className='password'>
|
||||
<Input type='password' name='password' placeholder='请输入密码' value={this.state.password} onInput={this.passwordHandler} />
|
||||
<Input type='password' name='password' password={true} placeholder='请输入密码' value={this.state.password} onInput={this.passwordHandler} />
|
||||
</View>
|
||||
|
||||
<Button className='button button-orange' onClick={this.loginHandler}>登录</Button>
|
||||
|
@ -7,6 +7,7 @@ import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToT
|
||||
import URL from '../../serviceAPI.config'
|
||||
import './myGoodList.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
|
||||
|
||||
class MyGoodList extends Component {
|
||||
@ -379,7 +380,7 @@ class MyGoodList extends Component {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
const value = e.currentTarget.dataset.eTapAA
|
||||
const value = onClickValueService(e)
|
||||
this.setState({ selectedFilterValue: value })
|
||||
if (value == 0) {
|
||||
this.setState({
|
||||
@ -492,7 +493,7 @@ class MyGoodList extends Component {
|
||||
// 单个商品选择
|
||||
handleCheckChange(e) {
|
||||
//如果goodid 一样的那么checked 就取反
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
const id = onClickValueService(e)
|
||||
const newMyGoodList = this.state.myGoodList.map((item) => {
|
||||
if (item.goods_id === id) {
|
||||
item.checked = !item.checked
|
||||
@ -536,7 +537,9 @@ class MyGoodList extends Component {
|
||||
}
|
||||
// 导航到商品编辑页面myGoodsEdit
|
||||
goToGoodEditPage(e) {
|
||||
const goodId = e.currentTarget.dataset.eTapAA
|
||||
console.log('e',e)
|
||||
const goodId = onClickValueService(e)
|
||||
console.log('goodId',goodId)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myGoodsEdit/myGoodsEdit?id=' + goodId
|
||||
})
|
||||
@ -549,7 +552,7 @@ class MyGoodList extends Component {
|
||||
})
|
||||
}
|
||||
goToGoodspage(e) {
|
||||
const goodId = e.currentTarget.dataset.eTapAA
|
||||
const goodId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/goods/goods?id=' + goodId
|
||||
})
|
||||
|
@ -10,6 +10,7 @@ import LoginService from '../../util/LoginService'
|
||||
|
||||
import './myNeeds.scss'
|
||||
import loginExpired from '../../util/loginExpired';
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
|
||||
class MyNeeds extends Component {
|
||||
|
||||
@ -252,20 +253,20 @@ class MyNeeds extends Component {
|
||||
})
|
||||
}
|
||||
goToMyNeedsViewPage(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
const id = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + id
|
||||
})
|
||||
|
||||
}
|
||||
goToMyNeedsEditPage(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
const id = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsEdit/myNeedsEdit?id=' + id
|
||||
})
|
||||
}
|
||||
deleteButton(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
const item = onClickValueService(e)
|
||||
this.setState({ isDeleteModal: true, needsItem: item })
|
||||
}
|
||||
handleWindowModCancel() {
|
||||
|
@ -10,6 +10,7 @@ import loginExpired from '../../util/loginExpired'
|
||||
|
||||
|
||||
import './mySupplyDemand.scss'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
|
||||
|
||||
class MySupplyDemand extends Component {
|
||||
@ -234,8 +235,8 @@ class MySupplyDemand extends Component {
|
||||
|
||||
// 删除我的供求
|
||||
handleOnDelete(e) {
|
||||
const title = e.currentTarget.dataset.eTapAA.sd_title
|
||||
const id = e.currentTarget.dataset.eTapAA.sd_id
|
||||
const title = onClickValueService(e).sd_title
|
||||
const id = onClickValueService(e).sd_id
|
||||
this.setState({ isConfirmWindow: true, demandSupplyItemName: title, demandSupplyId: id })
|
||||
}
|
||||
|
||||
@ -244,7 +245,7 @@ class MySupplyDemand extends Component {
|
||||
|
||||
// 跳转到我的供求编辑页面
|
||||
goToMyDSEditPage(e) {
|
||||
const sdId = e.currentTarget.dataset.eTapAA
|
||||
const sdId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myDemandSupplyEdit/myDemandSupplyEdit?sdId=' + sdId
|
||||
})
|
||||
@ -252,7 +253,7 @@ class MySupplyDemand extends Component {
|
||||
}
|
||||
// 转到供求查看页面
|
||||
goSupplyDemandView(e) {
|
||||
const sdId = e.currentTarget.dataset.eTapAA
|
||||
const sdId = onClickValueService(e)
|
||||
Taro.navigateTo({
|
||||
url: '/pages/supplyDemandView/supplyDemandView?sdId=' + sdId
|
||||
})
|
||||
|
@ -11,6 +11,7 @@ import './shop.scss'
|
||||
import ShopItem from '../../component/shopItemComponent/shopItemComponent'
|
||||
//import BottomNav from '../../component/bottomNav/bottomNav'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
import onClickValueService from '../../util/onClickValueService';
|
||||
|
||||
const locationIcon = require('../../assets/img/location.png')
|
||||
|
||||
@ -352,7 +353,7 @@ class Shop extends Component {
|
||||
|
||||
// 产品排序
|
||||
accendingDescending(e) {
|
||||
const value = e.currentTarget.dataset.eTapAA
|
||||
const value = onClickValueService(e)
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
this.setState({ selectedFilterValue: value })
|
||||
if (value == 0) {
|
||||
@ -705,8 +706,8 @@ class Shop extends Component {
|
||||
<View className='button-box'>{widthnessElementsArray}</View>
|
||||
|
||||
<View className='confirm-button'>
|
||||
<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>
|
||||
<Button className='button' type='primary' size='mini' style='background-color:#FF7142;border:0px' onClick={this.submitFilter.bind(this)} >确认</Button>
|
||||
<Button className='button' type='primary' size='mini' style='background-color:#5cb85c;border:0px' onClick={this.resetFilterList.bind(this)}>重置</Button>
|
||||
<View className='gap'></View>
|
||||
</View>
|
||||
</View>
|
||||
|
@ -18,36 +18,86 @@ bug: 商品编辑 增加图片后 图片顺序乱了
|
||||
|
||||
等待后台--- 单个我的商品页面的图片顺序,单个我的需求页面的接口, 当个我哦的需求编辑页面的接口
|
||||
import Taro, { Component } from '@tarojs/taro'
|
||||
import { View, Input, Button, Image } from '@tarojs/components'
|
||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
||||
import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
|
||||
import MainCateSlider from './mainCateSlider/mainCateSlider'
|
||||
import FilteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
||||
import ScrollToTopComponent from '../../component/scrollToTopComponent/scrollToTopComponent'
|
||||
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||
|
||||
|
||||
import LoginService from '../../util/LoginService'
|
||||
import weChatLogin from '../../util/weChatLogin'
|
||||
import URL from '../../serviceAPI.config'
|
||||
|
||||
import './login.scss'
|
||||
import './home.scss'
|
||||
|
||||
|
||||
|
||||
class Login extends Component {
|
||||
|
||||
class Home extends Component {
|
||||
|
||||
config = {
|
||||
navigationBarTitleText: '登入'
|
||||
navigationBarTitleText: '首页',
|
||||
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.state = {
|
||||
username: '',
|
||||
password: '',
|
||||
backgroundImage: 'background-image:url(' + URL.Base + '/Public/images/bg3.jpg);'
|
||||
shops: [], // 推荐店铺的信息
|
||||
ads: [], //广告图片数组
|
||||
categories: [],// 大类
|
||||
subCate: [], //小类
|
||||
demanding: [],// 业主需求
|
||||
otherData: [], // 底部导航栏
|
||||
isOpen: false, // 抢单消息提示
|
||||
grabOrderId: '',//抢到订单的id
|
||||
userName: Taro.getStorageSync('user_identity').userName || '',//用户名字
|
||||
userPhone: Taro.getStorageSync('user_identity').userPhone || '',// 用户电话
|
||||
isShowTopNav: false,// 是否显示返回顶部按钮
|
||||
loadMorePageIndex: 1,//下拉加载页面数
|
||||
isAddToList: false,
|
||||
parentClass: '',// 大类的id
|
||||
childClass: '-1',//小类的id
|
||||
supplyLevel: 1,// 筛选1是小类或者2是大类,
|
||||
latitude: '',
|
||||
longitude: '',
|
||||
|
||||
}
|
||||
}
|
||||
//用户信息姓名和电话号码接口
|
||||
setUserInfoToStorage() {
|
||||
|
||||
// onPullDownRefresh() {
|
||||
// Taro.showLoading({ title: '加载中' })
|
||||
|
||||
// this.login().then(() => {
|
||||
// this.getShops({})
|
||||
// this.getHomeCategoriesInfo()
|
||||
// }).catch(err => console.log('微信登入失败:', err))
|
||||
|
||||
// Taro.stopPullDownRefresh()
|
||||
// }
|
||||
|
||||
|
||||
//api得到首页的信息
|
||||
getHomeCategoriesInfo() {
|
||||
Taro.request({
|
||||
url: URL.ShopWxStore,
|
||||
header: {
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
// 'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('首页基本信息', res)
|
||||
if (res.data.err_msg === 'success') {
|
||||
Taro.setStorageSync('user_identity', { username: res.data.otherData.userName, userphone: res.data.otherData.userPhone })
|
||||
|
||||
this.setState({
|
||||
ads: res.data.data.adsLb,
|
||||
categories: [res.data.data.supplyClass[0], Object.values(res.data.data.supplyClass[1])],
|
||||
demanding: res.data.data.demand.supplys,
|
||||
otherData: res.data.otherData,
|
||||
userName: res.data.otherData.userName,
|
||||
userPhone: res.data.otherData.userPhone,
|
||||
})
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
@ -57,115 +107,482 @@ class Login extends Component {
|
||||
}
|
||||
})
|
||||
}
|
||||
loginApi() {
|
||||
// api 得到推荐商店的信息
|
||||
getShops({ parent_supply_class = this.state.parentClass, supply_class = this.state.childClass, supply_level = this.state.supplyLevel, curr_page = 1,
|
||||
page_count = 5, action = "2" }) {
|
||||
Taro.request({
|
||||
url: URL.Base + 'user-login',
|
||||
url: URL.ShopSupplyShops,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
username: this.state.username,
|
||||
password: this.state.password,
|
||||
param: JSON.stringify({
|
||||
curr_page: curr_page,
|
||||
page_count: page_count,
|
||||
parent_supply_class: parent_supply_class, //父级class id
|
||||
supply_class: supply_class,// 子级class id
|
||||
supply_level: supply_level,// 层级
|
||||
action: action,
|
||||
latitude: this.state.latitude,
|
||||
longitude: this.state.longitude,
|
||||
})
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log('所有店铺的信息', res)
|
||||
Taro.hideLoading()
|
||||
if (res.data.err_code === 0) {
|
||||
if (this.state.isAddToList) {
|
||||
if (res.data.shops) {
|
||||
this.setState({ shops: this.state.shops.concat(res.data.shops), isAddToList: false })
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: '没有更多了',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
} else {
|
||||
res.data.shops ? this.setState({ shops: res.data.shops }) : this.setState({ shops: [] })
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
|
||||
this.setState({ isAddToList: false })
|
||||
}
|
||||
)
|
||||
}
|
||||
getUserLocation() {
|
||||
return new Promise((resolve, reject) => {
|
||||
Taro.getLocation({
|
||||
type: 'wgs84', // 返回可以用于wx.openLocation的经纬度
|
||||
success(res) {
|
||||
resolve(res)
|
||||
},
|
||||
fail(res) {
|
||||
Taro.showToast({
|
||||
title: '获取定位失败',
|
||||
icon: 'none'
|
||||
})
|
||||
reject(res)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 微信用户设置
|
||||
// wxUserSetting() {
|
||||
// Taro.getSetting({
|
||||
// success(res) {
|
||||
// if (res.authSetting['scope.userInfo']) {
|
||||
// console.log('personal info', res)
|
||||
// Taro.authorize({
|
||||
// scope: 'scope.userInfo',
|
||||
// success() {
|
||||
// // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
|
||||
// // Taro.getUserInfo({
|
||||
// // success(res1) {
|
||||
// // console.log('res1',res1)
|
||||
// // }
|
||||
// // })
|
||||
// console.log('权限允许')
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// api 抢单请求
|
||||
GrabDemand({ demandId = 218 }) {
|
||||
Taro.request({
|
||||
url: URL.GrabDemand,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
demandId: demandId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.data.err_code === 0) {
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg === 'success' ? '抢单成功' : res.data.err_msg,
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
Taro.showToast({
|
||||
title: res.data.err_msg && '登入成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
Taro.setStorageSync('session_id', res.data.session_id)
|
||||
Taro.setStorageSync('shopInfo', res.data.shop_info)
|
||||
Taro.setStorageSync('userInfo', res.data.user_info)
|
||||
Taro.setStorageSync('accountInfo',{username:this.state.username,password:this.state.password})
|
||||
|
||||
this.setUserInfoToStorage()
|
||||
|
||||
setTimeout(() => {
|
||||
// Taro.navigateBack({
|
||||
// delta: 1
|
||||
// })
|
||||
Taro.reLaunch({
|
||||
url:'/pages/home/home'
|
||||
})
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.data.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
console.log('抢单请求:', res)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
// 点击大类icon
|
||||
onClickParentCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ parentClass: item.class_id, childClass: item.class_id, supplyLevel: 1, subCate: item.children || [] }, () => {
|
||||
this.getShops({})
|
||||
})
|
||||
|
||||
|
||||
usernameHandler(e) {
|
||||
let value = e.detail.value
|
||||
this.setState({ username: value })
|
||||
}
|
||||
passwordHandler(e) {
|
||||
let value = e.detail.value
|
||||
this.setState({ password: value })
|
||||
// 点击子类
|
||||
onClickChildCate(e) {
|
||||
const item = e.currentTarget.dataset.eTapAA
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ childClass: item.class_id, supplyLevel: 2 }, () => {
|
||||
this.getShops({})
|
||||
|
||||
})
|
||||
// this.getShops(item.parent_class_id, item.class_id, 2)
|
||||
|
||||
}
|
||||
loginHandler() {
|
||||
this.loginApi()
|
||||
scrollToSubCate(item) {
|
||||
|
||||
Taro.pageScrollTo({
|
||||
scrollTop: 410,
|
||||
duration: 300
|
||||
})
|
||||
this.onClickParentCate(item)
|
||||
}
|
||||
// 转到其他页面
|
||||
goToAllDemandingPage() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
LoginService()
|
||||
return
|
||||
}
|
||||
Taro.navigateTo({
|
||||
url: '/pages/allDemanding/allDemanding'
|
||||
})
|
||||
}
|
||||
|
||||
grabOrderId(e) {
|
||||
const id = e.currentTarget.dataset.eTapAA
|
||||
this.setState({ isOpen: true, grabOrderId: id })
|
||||
}
|
||||
handleGrabModalClose() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabModalCancel() {
|
||||
this.setState({ isOpen: false })
|
||||
}
|
||||
handleGrabConfirm() {
|
||||
if (!Taro.getStorageSync('userInfo').user_id) {
|
||||
LoginService()
|
||||
}
|
||||
this.setState({ isOpen: false })
|
||||
// 确认抢单之后
|
||||
this.GrabDemand({ demandId: this.state.grabOrderId })
|
||||
}
|
||||
|
||||
|
||||
// 导航去抢单页面
|
||||
goToGrabOrderPage(e) {
|
||||
const orderId = e.currentTarget.dataset.eTapAA
|
||||
|
||||
Taro.navigateTo({
|
||||
url: '/pages/grabOrderPage/grabOrderPage?orderId=' + orderId
|
||||
})
|
||||
}
|
||||
goToMyNeedsPublish() {
|
||||
// 传参数给myNeedsPublish页面- 显示效果图选项
|
||||
Taro.navigateTo({
|
||||
url: '/pages/myNeedsPublish/myNeedsPublish?id=1'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
// promise 返回经纬度给state 然后调用函数
|
||||
this.getUserLocation().then(res => {
|
||||
this.setState({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude
|
||||
}, () => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
}).catch(err => {
|
||||
this.getShops({})
|
||||
this.getHomeCategoriesInfo()
|
||||
})
|
||||
// 本地缓存没有userid时 从新登入
|
||||
Taro.getStorageSync('userInfo').user_id ? true : weChatLogin()
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
console.log(this.props, nextProps)
|
||||
}
|
||||
componentWillMount() {
|
||||
|
||||
}
|
||||
componentWillUnmount() { }
|
||||
|
||||
componentDidShow() { }
|
||||
componentDidShow() {
|
||||
|
||||
}
|
||||
|
||||
componentDidHide() { }
|
||||
|
||||
|
||||
// 微信用户信息
|
||||
onGotUserInfo(e) {
|
||||
console.log(e.detail.errMsg)
|
||||
console.log(e.detail.userInfo)
|
||||
console.log(e.detail.rawData)
|
||||
}
|
||||
// 页面位置
|
||||
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 })
|
||||
}
|
||||
}
|
||||
// 底部加载
|
||||
onReachBottom() {
|
||||
Taro.showLoading({
|
||||
title: '加载中'
|
||||
})
|
||||
this.setState({ loadMorePageIndex: this.state.loadMorePageIndex + 1, isAddToList: true }, () => {
|
||||
this.getShops({ curr_page: this.state.loadMorePageIndex, })
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
// 提示模态弹窗element
|
||||
const modalMessageGrabElement = <AtModal isOpened={this.state.isOpen}>
|
||||
<AtModalHeader>提示</AtModalHeader>
|
||||
<AtModalContent>
|
||||
确认抢单?
|
||||
</AtModalContent>
|
||||
<AtModalAction> <Button onClick={this.handleGrabModalCancel.bind(this)}>取消</Button> <Button className='orange' onClick={this.handleGrabConfirm.bind(this)}>确定</Button> </AtModalAction>
|
||||
</AtModal>
|
||||
|
||||
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
|
||||
|
||||
return <SwiperItem key={index} >
|
||||
<View className={this.state.demanding.length - 1 === index ? 'demanding-item last' : 'demanding-item'}>
|
||||
<View onClick={this.goToGrabOrderPage.bind(this, item.sd_id)}>
|
||||
<View className='item-tag'>
|
||||
<Text className='item-tag-text'> {item.class_name}</Text>
|
||||
</View>
|
||||
<View className='item-title'>
|
||||
{item.sd_title}
|
||||
</View>
|
||||
<View className='item-address'>
|
||||
{item.user_address || '--'}
|
||||
</View>
|
||||
<View className='item-name'>
|
||||
业主:{item.user_name}
|
||||
</View>
|
||||
</View>
|
||||
{item.state === '1' ? <View className='button' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button size='mini' className='button-orange'>抢单</Button>
|
||||
</View> : null || item.state === '2' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null || item.state === '3' ? <View className='button'>
|
||||
<Button size='mini' className='button-orange blur'>{item.state_name}</Button>
|
||||
</View> : null}
|
||||
{/* <View className='item-button-box' onClick={this.grabOrderId.bind(this, item.sd_id)}>
|
||||
<Button className='item-button' > {item.state_name === '在用' ? '抢单' : '已抢光'}</Button>
|
||||
</View> */}
|
||||
</View>
|
||||
</SwiperItem >
|
||||
}) : null
|
||||
|
||||
const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
|
||||
return <SwiperItem key={index}>
|
||||
<Image className='banner-img' src={URL.Base + item.ads_pic} />
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
// 这里应该代码可以优化-----
|
||||
const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
|
||||
return <View className='category-item' key={index} onClick={this.scrollToSubCate.bind(this, item)}>
|
||||
{/* onClick={this.onClickParentCate.bind(this, item)}> */}
|
||||
<Image className='cate-img' src={URL.Base + item.icon} />
|
||||
<View>{item.class_name}</View>
|
||||
</View>
|
||||
}) : null
|
||||
|
||||
const shopCollectionElementsArray = this.state.shops.length ? this.state.shops.map((item, index) => {
|
||||
return <FilteredShopComponent
|
||||
shop={item}
|
||||
key={index}
|
||||
categoryLevel={this.state.supplyLevel}
|
||||
classId={this.state.parentClass === this.state.childClass ? this.state.parentClass : this.state.childClass}
|
||||
></FilteredShopComponent>
|
||||
}) : <View className='no-more-title top'> 没有更多了</View>
|
||||
const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
|
||||
return <SwiperItem key={index} onClick={this.onClickChildCate.bind(this, item)}>
|
||||
<View className='text'>{item.class_name}</View>
|
||||
</SwiperItem>
|
||||
}) : null
|
||||
|
||||
return (
|
||||
<View className='login'>
|
||||
<View className='background' style={this.state.backgroundImage}></View>
|
||||
<View className='logo'>
|
||||
<View className='image-wrapper'>
|
||||
<View className='image-inner-wrapper'>
|
||||
<Image style='width: 240px;height: 80px;background: #fff;' src={URL.Base + '/Public/images/com-logo.png'} />
|
||||
</View>
|
||||
<View className='home'>
|
||||
|
||||
<View className='title'>全屋定制商城</View>
|
||||
</View>
|
||||
{/* 获取微信用户的信息 */}
|
||||
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
||||
|
||||
{modalMessageGrabElement}
|
||||
|
||||
<View className='first-banner'>
|
||||
<Swiper
|
||||
className='swipper'
|
||||
style='height:120px;'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
{adsImgElementsArray}
|
||||
|
||||
</Swiper>
|
||||
</View>
|
||||
<View className='login-wrapper'>
|
||||
<View className='title'>用户登入</View>
|
||||
<View className='bgtopWrap'>
|
||||
<View className='loginWrap'>
|
||||
<View className='username'>
|
||||
<Input type='text' focus={true} name='username' maxLength='11' placeholder='请输入用户名/手机号' value={this.state.username} onInput={this.usernameHandler} />
|
||||
{/* 第二行图片滚动条 */}
|
||||
{/* <View className='second-banner'>
|
||||
<Swiper
|
||||
style='height:100%;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
hotizontal
|
||||
circular
|
||||
indicatorDots
|
||||
// autoplay
|
||||
>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray1}
|
||||
</View>
|
||||
<View className='password'>
|
||||
<Input type='password' name='password' placeholder='请输入密码' value={this.state.password} onInput={this.passwordHandler} />
|
||||
</SwiperItem>
|
||||
<SwiperItem>
|
||||
<View className='categories'>
|
||||
{categoriesElementsArray2}
|
||||
</View>
|
||||
|
||||
<Button className='button button-orange' onClick={this.loginHandler}>登录</Button>
|
||||
</View>
|
||||
</View>
|
||||
</SwiperItem>
|
||||
</Swiper>
|
||||
</View> */}
|
||||
<MainCateSlider/>
|
||||
{/* 第三行图片滚动条 */}
|
||||
<View className='third-banner'>
|
||||
<Swiper
|
||||
style='height:100px;'
|
||||
className='swipper'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
circular
|
||||
indicatorDots
|
||||
autoplay
|
||||
>
|
||||
<SwiperItem onClick={this.goToMyNeedsPublish.bind(this)}>
|
||||
<Image className='banner-img' src={URL.Base + 'Public/images/xgt.png'} />
|
||||
</SwiperItem>
|
||||
|
||||
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
{/* 业主需求和行业推荐 */}
|
||||
<View className='container'>
|
||||
<View className='title'>
|
||||
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>业主需求</Text>
|
||||
|
||||
<Text className='more-link' onClick={this.goToAllDemandingPage.bind(this)}>
|
||||
更多>>
|
||||
</Text>
|
||||
</View>
|
||||
<View className='customer-demanding'>
|
||||
<Swiper
|
||||
style='height:180px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
|
||||
displayMultipleItems='2.5'
|
||||
>
|
||||
{demandingElemensArray}
|
||||
</Swiper>
|
||||
</View>
|
||||
|
||||
<View className='second-banner-level2'>
|
||||
{this.state.subCate.length ? <Swiper
|
||||
style='height:35px;'
|
||||
className='swipper swiper-sub'
|
||||
indicatorColor='#999'
|
||||
indicatorActiveColor='#333'
|
||||
horizontal
|
||||
displayMultipleItems={this.state.subCate.length > 4.5 ? 4.5 : this.state.subCate.length}
|
||||
>
|
||||
{subCateElementsArray}
|
||||
</Swiper> : null}
|
||||
</View>
|
||||
<View className='title'>
|
||||
<Text className='title-block'></Text>
|
||||
<Text className='title-text'>行业推荐</Text>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
<View className='shop-box'>
|
||||
{shopCollectionElementsArray}
|
||||
|
||||
|
||||
</View>
|
||||
{this.state.isShowTopNav ? <ScrollToTopComponent ></ScrollToTopComponent> : null}
|
||||
|
||||
<CopyrightComponent></CopyrightComponent>
|
||||
<View className='gap'>
|
||||
|
||||
</View>
|
||||
|
||||
|
||||
</View>
|
||||
<View className='bottom-nav-box'>
|
||||
{/* <BottomNav otherData={this.state.otherData} /> */}
|
||||
</View>
|
||||
{/* {this.state.isShopOwner ? <SellerTabBarComponent currentUrl={currentUrl} /> : <ClientTabBarComponent currentUrl={currentUrl} />} */}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Login
|
||||
export default Home
|
||||
|
11
src/util/onClickValueService.js
Normal file
11
src/util/onClickValueService.js
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
export default function onClickValueService(e) {
|
||||
let value
|
||||
if (process.env.TARO_ENV === 'alipay') {
|
||||
value = e.currentTarget.dataset.eOnTapAA
|
||||
} else if (process.env.TARO_ENV === 'weapp') {
|
||||
value = e.currentTarget.dataset.eTapAA
|
||||
}
|
||||
return value
|
||||
}
|
Loading…
Reference in New Issue
Block a user