Commit a432fc73 by zhanghaozhe

tmp

parent b1a33eac
import React, { Component } from 'react' import React, { PureComponent } from 'react'
import './coupon.scss' import './coupon.scss'
import classnames from 'classnames' import classnames from 'classnames'
class Coupon extends Component { class Coupon extends PureComponent {
pick = () => { pick = () => {
let {purpose, select, invalid} = this.props let {purpose, select, invalid} = this.props
......
...@@ -10,7 +10,7 @@ class ExchangeBar extends Component { ...@@ -10,7 +10,7 @@ class ExchangeBar extends Component {
} }
render() { render() {
const {onChange, exchangeNum} = this.props const {onChange, exchangeCode} = this.props
return ( return (
<div className="exchange-bar"> <div className="exchange-bar">
<Input <Input
...@@ -19,7 +19,7 @@ class ExchangeBar extends Component { ...@@ -19,7 +19,7 @@ class ExchangeBar extends Component {
type={'number'} type={'number'}
/> />
<button className={classnames({ <button className={classnames({
active: exchangeNum && exchangeNum.length > 0 active: exchangeCode && exchangeCode.length > 0
})}>兑换 })}>兑换
</button> </button>
</div> </div>
......
...@@ -19,6 +19,6 @@ ...@@ -19,6 +19,6 @@
} }
.coupon-list { .coupon-list {
padding: 15px 12px; padding: 72px 12px 0;
} }
} }
\ No newline at end of file
import React, { Component } from 'react' import React, { PureComponent } from 'react'
import './coupons.scss' import './coupons.scss'
// import { Toast } from "antd-mobile"; // import { Toast } from "antd-mobile";
...@@ -25,32 +25,25 @@ const mockData = [ ...@@ -25,32 +25,25 @@ const mockData = [
] ]
class ExchangeCoupons extends Component { class ExchangeCoupons extends PureComponent {
constructor(props) { state = {
super(props) exchangeCode: ''
this.state = {
exchangeNum: ''
}
} }
onChange = (val) => { onChange = (val) => {
this.setState({exchangeNum: val}) this.setState({exchangeCode: val})
} }
useCoupon = (val) => { useCoupon = (val) => {
console.log(val) console.log(val)
} }
componentDidMount() {
document.getElementsByClassName('tabbar')[0].style.display = 'none'
}
render() { render() {
return ( return (
<div id='coupons'> <div id='coupons'>
<ExchangeBar <ExchangeBar
onChange={this.onChange} onChange={this.onChange}
exchangeNum={this.state.exchangeNum} exchangeCode={this.state.exchangeCode}
/> />
<Content <Content
coupons={mockData} coupons={mockData}
......
...@@ -3,8 +3,7 @@ import './use-coupon.scss' ...@@ -3,8 +3,7 @@ import './use-coupon.scss'
import ExchangeaBar from "../common/ExchangeBar"; import ExchangeaBar from "../common/ExchangeBar";
import Coupon from '../common/Coupon' import Coupon from '../common/Coupon'
import { WithFullSize } from '@/HOCs' import { http, api } from '@/utils'
const mockData = { const mockData = {
valid: [ valid: [
...@@ -44,12 +43,22 @@ const mockData = { ...@@ -44,12 +43,22 @@ const mockData = {
class UseCoupon extends Component { class UseCoupon extends Component {
constructor(props) { state = {
super(props) selected: 0,
this.state = { exchangeCode: '',
selected: 0, couponList: []
exchangeNum: '' }
}
componentDidMount(){
http.get(`${api.home}/m/coupon/all`)
.then(res => {
const data = res.data
if(data.code === 200){
this.setState({
couponList: data.data
})
}
})
} }
select = (val) => { select = (val) => {
...@@ -60,7 +69,7 @@ class UseCoupon extends Component { ...@@ -60,7 +69,7 @@ class UseCoupon extends Component {
} }
handleChange = (val) => { handleChange = (val) => {
this.setState({exchangeNum: val}) this.setState({exchangeCode: val})
} }
render() { render() {
...@@ -123,4 +132,4 @@ function Content({coupons, selected, ...rest}) { ...@@ -123,4 +132,4 @@ function Content({coupons, selected, ...rest}) {
) )
} }
export default WithFullSize(UseCoupon); export default UseCoupon;
\ No newline at end of file \ No newline at end of file
.use-coupon { .use-coupon {
height: 100%;
display: flex; display: flex;
flex-flow: column; flex-flow: column;
.coupons-area { .coupons-area {
padding: 15px 12px; padding: 72px 12px;
background: $bg_f5f5f5; background: $bg_f5f5f5;
flex: 1 1 auto; flex: 1 1 auto;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment