-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
463 additions
and
380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { createAction } from 'redux-actions'; | ||
import { createAction } from 'redux-actions' | ||
|
||
export const SELECT_CARD = createAction('SELECT_CARD', cardPrice => cardPrice); | ||
export const PAY_ORDER = createAction('PAY_ORDER', user => user); | ||
export const SELECT_CARD = createAction('SELECT_CARD', cardPrice => cardPrice) | ||
export const UPDATE_PRICE = createAction('UPDATE_PRICE', price => price) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,80 @@ | ||
import React, { Component } from 'react'; | ||
import immutableTypes from 'react-immutable-proptypes'; | ||
import PropTypes from 'prop-types'; | ||
import { Link } from 'react-router-dom'; | ||
import { connect } from 'react-redux'; | ||
import { ADD_SERVICE, FETCH_SERVICE } from '../../../actions'; | ||
import React, { Component } from 'react' | ||
import immutableTypes from 'react-immutable-proptypes' | ||
import PropTypes from 'prop-types' | ||
import { Link } from 'react-router-dom' | ||
import { connect } from 'react-redux' | ||
import { ADD_SERVICE, FETCH_SERVICE } from '../../../actions' | ||
|
||
class Items extends Component { | ||
static propTypes() { | ||
return { | ||
service: immutableTypes.list, | ||
$$service: immutableTypes.list, | ||
ADD_SERVICE: PropTypes.func.isRequired, | ||
FETCH_SERVICE: PropTypes.func.isRequired | ||
}; | ||
} | ||
} | ||
|
||
componentWillMount() { | ||
const props = this.props; | ||
console.log(this.props); | ||
props.FETCH_SERVICE(props.location.hash); | ||
const props = this.props | ||
props.FETCH_SERVICE(props.location.hash) | ||
} | ||
|
||
handleAddService(item) { | ||
this.props.ADD_SERVICE(item); | ||
this.props.ADD_SERVICE(item) | ||
} | ||
|
||
render() { | ||
const props = this.props; | ||
const props = this.props | ||
return ( | ||
<div className="serviceItem"> | ||
<ul className="clear"> | ||
{ | ||
this.props.service.map(item => ( | ||
<li key={item.id}> | ||
<Link | ||
className="about" | ||
to={{ | ||
pathname: '/service/about', | ||
hash: props.location.hash | ||
}} | ||
<ul className="clear serviceItem"> | ||
{ | ||
this.props.$$service.map(item => ( | ||
<li key={item.id}> | ||
<Link | ||
className="about" | ||
to={{ | ||
pathname: '/service/about', | ||
hash: props.location.hash | ||
}} | ||
> | ||
<img src={item.img} alt="" /> | ||
</Link> | ||
<div className="textContent"> | ||
<h2>{item.type}</h2> | ||
<p>注:{item.node}</p> | ||
<p>{item.unit}</p> | ||
<strong>¥{item.price}</strong> | ||
<a | ||
onTouchTap={() => this.handleAddService({ | ||
type: item.type, | ||
num: 1, | ||
node: item.node, | ||
img: item.img, | ||
price: item.price, | ||
id: item.id | ||
})} | ||
className="shopCart" | ||
> | ||
<img src={item.img} alt="" /> | ||
</Link> | ||
<div className="textContent"> | ||
<h2>{item.type}</h2> | ||
<p>{item.node}</p> | ||
<p>{item.unit}</p> | ||
<strong>¥{item.price}</strong> | ||
<a | ||
onTouchTap={() => this.handleAddService({ | ||
type: item.type, | ||
num: 1, | ||
img: item.img, | ||
price: item.price, | ||
id: item.id | ||
})} | ||
className="shopCart" | ||
> | ||
<span>.</span> | ||
</a> | ||
</div> | ||
</li> | ||
)) | ||
} | ||
</ul> | ||
</div> | ||
); | ||
<span> | ||
{ | ||
// 购买数量 | ||
props.$$order.map(o => o.get('type') === item.type && o.get('num')) | ||
} | ||
</span> | ||
</a> | ||
</div> | ||
</li> | ||
)) | ||
} | ||
</ul> | ||
) | ||
} | ||
} | ||
|
||
export default connect(state => ({ | ||
order: state.order, | ||
service: state.service | ||
$$order: state.$$order, | ||
$$service: state.$$service | ||
}), { | ||
ADD_SERVICE, | ||
FETCH_SERVICE | ||
})(Items); | ||
})(Items) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.