import {Component} from "react"
import React from "react"
import './index.css'
import {NavBar} from 'antd-mobile'
import {Row, Col, Icon} from 'antd'
import {orderProduct_by_props} from "../../../../utils/gql"
import {Query} from "react-apollo"
import gql from "graphql-tag"
import {ButtonGroupRender} from '../display'
class Detail extends Component {
constructor(props) {
super(props)
this.state = {
data: {}
}
}
componentWillMount() {
let {location} = this.props
if (location && location.state) {
this.setState({
data: location.state.data
})
}
}
statusRender = (status) => {
switch (status) {
case '0':
return (
等待付款
)
case '1':
return (
等待发货
)
case '2':
return (
等待收货
)
case '3':
return (
完成
)
default:
return (
等待确认
)
}
}
productsRender = (data) => {
return (
data.map(data => (
{data.product_id.name}
数量:{data.count} 规格:{data.productColor}
尺寸:{data.productSize}
))
)
}
render() {
let {data} = this.state
return (
}
onLeftClick={() => {
this.props.history.go(-1)
}}
>订单详情
{/*内容*/}
{this.statusRender(data.orderStatus)}
¥{data.productTotalPay}
{data.userAddress_id.username} {data.userAddress_id.telephone}
地址:{data.userAddress_id.province + data.userAddress_id.city + data.userAddress_id.area + data.userAddress_id.address}
JD
{
({loading, error, data}) => {
if (error) {
return 'error!'
}
data = data.orderProductbyprops
return (
{this.productsRender(data)}
)
}
}
联系客服
)
}
}
export default Detail
class Order extends Component {
constructor(props) {
super(props)
this.state = {
}
}
render() {
let {data} = this.props
return (
订单编号:
{data.id}
下单时间:
{data.createdAt}
)
}
}