|
@@ -28,43 +28,89 @@ export default function OrderCard(props) {
|
|
|
const { showDialog } = useModel("dialogModel");
|
|
const { showDialog } = useModel("dialogModel");
|
|
|
const { receivedOrder } = useModel("orderInfoModel");
|
|
const { receivedOrder } = useModel("orderInfoModel");
|
|
|
const { info, updateInfo } = props;
|
|
const { info, updateInfo } = props;
|
|
|
- const { id, payMethod, orderTime, userAddress, merchantStatus, user } =
|
|
|
|
|
- info || {};
|
|
|
|
|
|
|
+ const {
|
|
|
|
|
+ id,
|
|
|
|
|
+ payMethod,
|
|
|
|
|
+ orderTime,
|
|
|
|
|
+ userAddress,
|
|
|
|
|
+ merchantStatus,
|
|
|
|
|
+ user,
|
|
|
|
|
+ riderStatus,
|
|
|
|
|
+ } = info || {};
|
|
|
|
|
|
|
|
- const Footer = (props) => (
|
|
|
|
|
- <Layout {...props} style={[props.style, styles.footerContainer]}>
|
|
|
|
|
- <Button
|
|
|
|
|
- style={styles.footerControl}
|
|
|
|
|
- appearance='outline'
|
|
|
|
|
- onPress={() => {
|
|
|
|
|
- showDialog({
|
|
|
|
|
- bodyText: overTips,
|
|
|
|
|
- status: "danger",
|
|
|
|
|
- cancelable: true,
|
|
|
|
|
- confirmCallback: () => {
|
|
|
|
|
- receivedOrder(id, false).then((res) => {
|
|
|
|
|
|
|
+ const Footer = (props) => {
|
|
|
|
|
+ if (riderStatus) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Layout
|
|
|
|
|
+ {...props}
|
|
|
|
|
+ style={[props.style]}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Layout style={styles.orderItem1}>
|
|
|
|
|
+ <Text category='c2'>骑手:胖齐齐</Text>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ appearance='outline'
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ Linking.openURL("tel:+" + user.phone);
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 联系骑手
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </Layout>
|
|
|
|
|
+ <Layout style={styles.orderItem1}>
|
|
|
|
|
+ <Text category='c2'>
|
|
|
|
|
+ 预计送达时间:2019-12-31 13:17
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ </Layout>
|
|
|
|
|
+ {riderStatus == "CARRY_OUT" && (
|
|
|
|
|
+ <Layout style={styles.orderItem1}>
|
|
|
|
|
+ <Text category='c2'>
|
|
|
|
|
+ 实际送达时间:2019-12-31 13:17
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ </Layout>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </Layout>
|
|
|
|
|
+ );
|
|
|
|
|
+ } else if (merchantStatus == "NOT_RECEIVED") {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Layout
|
|
|
|
|
+ {...props}
|
|
|
|
|
+ style={[props.style, styles.footerContainer]}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Button
|
|
|
|
|
+ style={styles.footerControl}
|
|
|
|
|
+ appearance='outline'
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ showDialog({
|
|
|
|
|
+ bodyText: overTips,
|
|
|
|
|
+ status: "danger",
|
|
|
|
|
+ cancelable: true,
|
|
|
|
|
+ confirmCallback: () => {
|
|
|
|
|
+ receivedOrder(id, false).then((res) => {
|
|
|
|
|
+ updateInfo(res);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ {orderButton1}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ style={styles.footerControl}
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ receivedOrder(id, true).then((res) => {
|
|
|
updateInfo(res);
|
|
updateInfo(res);
|
|
|
});
|
|
});
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- {orderButton1}
|
|
|
|
|
- </Button>
|
|
|
|
|
- <Button
|
|
|
|
|
- style={styles.footerControl}
|
|
|
|
|
- onPress={() => {
|
|
|
|
|
- receivedOrder(id, true).then((res) => {
|
|
|
|
|
- updateInfo(res);
|
|
|
|
|
- });
|
|
|
|
|
- }}
|
|
|
|
|
- appearance='outline'
|
|
|
|
|
- >
|
|
|
|
|
- {orderButton2}
|
|
|
|
|
- </Button>
|
|
|
|
|
- </Layout>
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }}
|
|
|
|
|
+ appearance='outline'
|
|
|
|
|
+ >
|
|
|
|
|
+ {orderButton2}
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </Layout>
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
return (
|
|
return (
|
|
|
<Card
|
|
<Card
|
|
|
appearance='orderCard'
|
|
appearance='orderCard'
|
|
@@ -72,8 +118,11 @@ export default function OrderCard(props) {
|
|
|
style={[props.style]}
|
|
style={[props.style]}
|
|
|
footer={Footer}
|
|
footer={Footer}
|
|
|
>
|
|
>
|
|
|
- <Text>商家{getWordsStr(merchantStatus)}</Text>
|
|
|
|
|
- <Text>商家{getWordsStr(merchantStatus)}</Text>
|
|
|
|
|
|
|
+ {riderStatus ? (
|
|
|
|
|
+ <Text>骑手{getWordsStr(riderStatus)}</Text>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <Text>商家{getWordsStr(merchantStatus)}</Text>
|
|
|
|
|
+ )}
|
|
|
<Layout style={styles.orderItem1}>
|
|
<Layout style={styles.orderItem1}>
|
|
|
<Text category='c2'>{id}</Text>
|
|
<Text category='c2'>{id}</Text>
|
|
|
<Text category='c2'>
|
|
<Text category='c2'>
|