forked from shen100/wemall
-
Notifications
You must be signed in to change notification settings - Fork 9
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
16 changed files
with
181 additions
and
25 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
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,9 +1,9 @@ | ||
package order | ||
|
||
import ( | ||
"../../model" | ||
"gopkg.in/kataras/iris.v6" | ||
"time" | ||
"wemall/go/model" | ||
) | ||
|
||
// TodayCount 今日总订单数 | ||
|
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
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
25 changes: 25 additions & 0 deletions
25
nodejs/static/javascripts/admin/actions/product/requestProduct.js
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { | ||
REQUEST_PRODUCT, | ||
REQUEST_PRODUCT_SUCCESS | ||
} from '../../constants'; | ||
|
||
function receive(data) { | ||
return { | ||
type : REQUEST_PRODUCT_SUCCESS, | ||
product : data | ||
}; | ||
} | ||
|
||
export default function(id) { | ||
return dispatch => { | ||
dispatch({ | ||
type: REQUEST_PRODUCT, | ||
}); | ||
var url = pageConfig.apiURL + '/admin/product/:id'; | ||
url = url.replace(':id', id); | ||
return fetch(url) | ||
.then(response => response.json()) | ||
.then(json => dispatch(receive(json.data))); | ||
}; | ||
}; | ||
|
102 changes: 102 additions & 0 deletions
102
nodejs/static/javascripts/admin/containers/product/EditProduct.js
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 |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
|
||
import { | ||
Row, | ||
Col, | ||
Form, | ||
Input, | ||
TreeSelect | ||
} from 'antd'; | ||
|
||
import requestProduct from '../actions/product/requestProduct'; | ||
import requestCategoryList from '../actions/category/requestCategoryList'; | ||
import Software from './Software'; | ||
import utils from '../utils'; | ||
import analyze from '../../sdk/analyze'; | ||
import '../../../styles/admin/editProduct.css'; | ||
|
||
/* | ||
* 管理后台,新建或编辑商品 | ||
*/ | ||
class EditProduct extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
productId : this.props.routeParams.id, | ||
parents : [] //父分类 | ||
}; | ||
} | ||
componentDidMount() { | ||
analyze.pv(); | ||
const { dispatch } = this.props; | ||
if (this.state.productId) { | ||
dispatch(requestProduct(this.state.productId)); | ||
} | ||
dispatch(requestCategoryList()); | ||
} | ||
onParentsChange(value) { | ||
console.log('onChange ', value, arguments); | ||
this.setState({ value }); | ||
} | ||
render() { | ||
let { data } = this.props; | ||
let isLoading = this.state.productId && !data.category ? true : false; | ||
let editLabel = this.state.productId ? '编辑' : '添加'; | ||
|
||
const FormItem = Form.Item; | ||
const formItemLayout = { | ||
labelCol: { | ||
xs: { span: 24 }, | ||
sm: { span: 3 }, | ||
}, | ||
wrapperCol: { | ||
xs: { span: 24 }, | ||
sm: { span: 12 }, | ||
} | ||
}; | ||
|
||
let treeData = utils.parseCategoryTree(data.categories); | ||
|
||
const treeProps = { | ||
treeData, | ||
value : this.state.value, | ||
onChange : this.onParentsChange.bind(this), | ||
multiple : true, | ||
treeCheckable: true, | ||
showCheckedStrategy: TreeSelect.SHOW_PARENT, | ||
searchPlaceholder: '选择父分类', | ||
style: { | ||
width: '100%', | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<Row gutter={24}> | ||
<Col span={24}> | ||
<div id="productBox" className="product-box"> | ||
<div className="product-title">{editLabel}商品</div> | ||
<Form> | ||
<FormItem {...formItemLayout} label="父分类"> | ||
<TreeSelect {...treeProps} /> | ||
</FormItem> | ||
</Form> | ||
|
||
</div> | ||
</Col> | ||
</Row> | ||
<Software /> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = (state) => { | ||
return { | ||
data: state.category | ||
}; | ||
} | ||
|
||
export default connect(mapStateToProps)(EditProduct); | ||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.product-box { | ||
|
||
} | ||
|
||
.product-title { | ||
font-size: 20px; | ||
margin-bottom: 6px; | ||
color: #000; | ||
} | ||
|
||
.ant-select-tree-noline_close:after { | ||
-webkit-transform: rotate(270deg) scale(.59) !important; | ||
-ms-transform: rotate(270deg) scale(.59) !important; | ||
transform: rotate(270deg) scale(.59) !important; | ||
} |