修改 优惠卷和咨询接口,和按钮

This commit is contained in:
郑茂强 2019-02-22 17:12:35 +08:00
parent 5baa65e718
commit 59a4a40eb4
4 changed files with 30 additions and 12 deletions

View File

@ -35,7 +35,8 @@ class recommondShop extends Component {
voucherResponseMsg: 'i am voucherResponseMsg', voucherResponseMsg: 'i am voucherResponseMsg',
userName: Taro.getStorageSync('user_identity').username || '', userName: Taro.getStorageSync('user_identity').username || '',
userPhone: Taro.getStorageSync('user_identity').userphone || '', userPhone: Taro.getStorageSync('user_identity').userphone || '',
canConsult: false isCanConsult: true,
isCanVoucher: true
} }
} }
@ -76,7 +77,7 @@ class recommondShop extends Component {
.then(res => { .then(res => {
this.setState({ this.setState({
voucherResponseMsg: res.data.tips, voucherResponseMsg: res.data.tips,
canConsult: res.data.canConsult, isCanVoucher: res.data.canConsult,
}) })
console.log('优惠卷请求', res) console.log('优惠卷请求', res)
}) })
@ -113,7 +114,7 @@ class recommondShop extends Component {
} }
}) })
.then(res => { .then(res => {
this.setState({ consultTip: res.data.tips }) this.setState({ consultTip: res.data.tips,isCanConsult:res.data.canConsult })
console.log('咨询请求', res) console.log('咨询请求', res)
}) })
} }
@ -122,7 +123,8 @@ class recommondShop extends Component {
phone = this.state.userPhone, phone = this.state.userPhone,
shops = [this.props.shop.shop_id], shops = [this.props.shop.shop_id],
source_type = "2", source_type = "2",
source_level = 1, source_level = this.props.categoryLevel,
source_class = this.props.classId === '-1' ? '' : this.props.classId,
coupons_flag = 0 }) { coupons_flag = 0 }) {
Taro.request({ Taro.request({
url: URL.BuyConsult, url: URL.BuyConsult,
@ -135,6 +137,7 @@ class recommondShop extends Component {
shops: shops, shops: shops,
source_type: source_type, source_type: source_type,
source_level: source_level, source_level: source_level,
source_class: source_class,
coupons_flag: coupons_flag, coupons_flag: coupons_flag,
}) })
}, },
@ -187,8 +190,9 @@ class recommondShop extends Component {
} else { } else {
this.setState({ isOpenConsult: false }) this.setState({ isOpenConsult: false })
this.buyConsult({ user: this.state.userName, phone: this.state.userPhone }) this.buyConsult({})
} }
} }
handleInputCsultName(e) { handleInputCsultName(e) {
@ -215,7 +219,6 @@ class recommondShop extends Component {
//console.log(this.props, nextProps) //console.log(this.props, nextProps)
} }
componentDidMount() { componentDidMount() {
console.log('this.props', this.props)
} }
componentWillUnmount() { } componentWillUnmount() { }
@ -279,10 +282,13 @@ class recommondShop extends Component {
/> />
</View> </View>
</AtModalContent> </AtModalContent>
<AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> <Button style='color:#FF7142' onClick={this.consultModalConfirm.bind(this)}></Button> </AtModalAction> <AtModalAction>
<Button onClick={this.consultModalClose.bind(this)} >取消</Button>
<Button disabled={!this.state.isCanConsult} className={!this.state.isCanConsult?'confirm_button blur':'confirm_button'} onClick={this.consultModalConfirm.bind(this)}>确定</Button>
</AtModalAction>
</AtModal> </AtModal>
// <AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> {this.props.canConsult?<Button style='color:#FF7142' onClick={this.consultModalConfirm.bind(this)}>确定</Button>:<Text></Text>} </AtModalAction> // <AtModalAction> <Button onClick={this.consultModalClose.bind(this)} >取消</Button> {this.props.canConsult?<Button style='color:#FF7142' onClick={this.consultModalConfirm.bind(this)}>确定</Button>:<Text></Text>} </AtModalAction>
return ( return (
<View className='shop-list-box' > <View className='shop-list-box' >
@ -291,12 +297,13 @@ class recommondShop extends Component {
name={this.state.userName} name={this.state.userName}
phone={this.state.userPhone} phone={this.state.userPhone}
shopId={this.props.shop.shop_id} shopId={this.props.shop.shop_id}
canConsult={this.state.canConsult} isCanVoucher={this.state.isCanVoucher}
isVoucherPoster={this.state.isOpenVoucher} isVoucherPoster={this.state.isOpenVoucher}
onPassDataToChild={this.getDataFromChild.bind(this)} onPassDataToChild={this.getDataFromChild.bind(this)}
voucherLeft={this.props.shop.left_nums} voucherLeft={this.props.shop.left_nums}
voucherResponseMsg={this.state.voucherResponseMsg} voucherResponseMsg={this.state.voucherResponseMsg}
categoryLevel={this.props.categoryLevel} categoryLevel={this.props.categoryLevel}
classId={this.props.classId === '-1' ? '' : this.props.classId}
></VoucherPosterComponent> ></VoucherPosterComponent>
<View className='header'> <View className='header'>

View File

@ -5,6 +5,12 @@ $linearBlue:linear-gradient(to right, #337ab7, #337ab7);
border-radius: 3px; border-radius: 3px;
box-shadow: 0 5px 5px #ddd; box-shadow: 0 5px 5px #ddd;
margin-bottom: 10px; margin-bottom: 10px;
.confirm_button{
color:#FF7142!important
}
.blur{
opacity: 0.5
}
.voucher-modal{ .voucher-modal{
background-color: black; background-color: black;

View File

@ -30,6 +30,7 @@ class VoucherPoster extends Component {
shops = [this.props.shopId], shops = [this.props.shopId],
source_type = '4', source_type = '4',
source_level = this.props.categoryLevel, source_level = this.props.categoryLevel,
source_class = this.props.classId,
coupons_flag = '1' }) { coupons_flag = '1' }) {
Taro.request({ Taro.request({
url: URL.BuyConsult, url: URL.BuyConsult,
@ -43,6 +44,7 @@ class VoucherPoster extends Component {
source_type: source_type, source_type: source_type,
source_level: source_level, source_level: source_level,
coupons_flag: coupons_flag, coupons_flag: coupons_flag,
source_class: source_class
}) })
}, },
header: { header: {
@ -55,7 +57,7 @@ class VoucherPoster extends Component {
console.log('购买咨询请求成功', res) console.log('购买咨询请求成功', res)
if (res.data.err_code === 0) { if (res.data.err_code === 0) {
Taro.showToast({ Taro.showToast({
title: '领取成功', title: '咨询成功',
icon: 'success', icon: 'success',
duration: 1500 duration: 1500
}) })
@ -150,7 +152,7 @@ class VoucherPoster extends Component {
</View> </View>
<View className='button' > <View className='button' >
<Button size='default' className='button-orange' onClick={this.voucherModalConfirm.bind(this)}>预约领取</Button> <Button size='default' disabled={!this.props.isCanVoucher} className={!this.props.isCanVoucher ? 'button-orange blur' : 'button-orange'} onClick={this.voucherModalConfirm.bind(this)}>预约领取</Button>
</View> </View>
<View className='declare'> <View className='declare'>

View File

@ -41,6 +41,7 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
min-height:100%; min-height:100%;
.close-icon{ .close-icon{
margin-left:88%; margin-left:88%;
margin-top:2%; margin-top:2%;
@ -100,7 +101,9 @@ $linearOrange:linear-gradient(to right, #FF7142, #FF7142);
font-size: 28px; font-size: 28px;
background:$linearOrange; background:$linearOrange;
padding: 12rpx; padding: 12rpx;
}
.blur{
opacity: 0.5;
} }
} }
.declare{ .declare{