panhui 5 năm trước cách đây
mục cha
commit
8b3d691b4a

+ 5 - 1
App.js

@@ -96,7 +96,11 @@ export default function App(props) {
       // 未登录
       setinitRoute("Login");
       setInit("Login");
-    } else if (mid !== 0) {
+    }
+    // else if (__DEV__) {
+    //   setInit("GoodsDetailMore");
+    // }
+    else if (mid !== 0) {
       checkNowGuideStep();
     }
   }, [mid]);

+ 3 - 6
components/OrderCard.js

@@ -144,7 +144,7 @@ export default function OrderCard(props) {
   } = info || {};
 
   const Footer = props => {
-    if (riderStatus !== "NOT_RECEIVED") {
+    if (riderStatus && riderStatus !== "NOT_RECEIVED") {
       return (
         <Layout {...props} style={[props.style]}>
           <Layout style={styles.orderItem1}>
@@ -233,9 +233,7 @@ export default function OrderCard(props) {
       <Layout style={styles.orderItem1}>
         <Text category="c2">{id}</Text>
         <Text category="c2">
-          {orderInfo2}
-          :
-          {orderTime}
+          {orderInfo2}:{orderTime}
         </Text>
       </Layout>
       <Layout style={styles.orderItem1}>
@@ -282,8 +280,7 @@ export default function OrderCard(props) {
 
       <Layout style={styles.orderItem2}>
         <Text category="c2" style={styles.leftText}>
-          {orderInfo6}
-          :
+          {orderInfo6}:
         </Text>
         <Text category="h1">{remark || "无"}</Text>
       </Layout>

+ 15 - 0
components/SmsInput.jsx

@@ -13,11 +13,26 @@ export default function SmsInput({
   phone,
   onCodeChange,
   type,
+  takePhone = false,
 }) {
   const [code, setCode] = React.useState();
   const [interval, setInterval] = React.useState(null);
   const [count, setCount] = React.useState(60);
 
+  React.useEffect(() => {
+    if (takePhone) {
+      sendSms(phone, type || "register")
+        .then(() => {
+          setCount(60);
+          setInterval(1000);
+        })
+        .catch(e => {
+          console.log(e);
+          Toast.info(e.response.data.error);
+        });
+    }
+  }, [takePhone]);
+
   useInterval(
     () => {
       setCount(count - 1);

+ 19 - 0
package-lock.json

@@ -7438,6 +7438,11 @@
         "whatwg-url": "^7.0.0"
       }
     },
+    "date-and-time": {
+      "version": "0.9.0",
+      "resolved": "https://registry.npmjs.org/date-and-time/-/date-and-time-0.9.0.tgz",
+      "integrity": "sha512-4JybB6PbR+EebpFx/KyR5Ybl+TcdXMLIJkyYsCx3P4M4CWGMuDyFF19yh6TyasMAIF5lrsgIxiSHBXh2FFc7Fg=="
+    },
     "dayjs": {
       "version": "1.8.33",
       "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.8.33.tgz",
@@ -18282,6 +18287,15 @@
       "resolved": "https://registry.npmjs.org/react-native-maps/-/react-native-maps-0.27.1.tgz",
       "integrity": "sha512-HygBkZBecTnIVRYrSiLRAvu4OmXOYso/A7c6Cy73HkOh9CgGV8Ap5eBea24tvmFGptjj5Hg8AJ94/YbmWK1Okw=="
     },
+    "react-native-masked-text": {
+      "version": "1.13.0",
+      "resolved": "https://registry.npmjs.org/react-native-masked-text/-/react-native-masked-text-1.13.0.tgz",
+      "integrity": "sha512-iMku5Ky6DP4fTRosjsYNJOhH8yoBQCzRALBdv1wVDKmCBQhhVE8RHr5EW4SNUjkYTZL473sDdEKl4NI948q9FQ==",
+      "requires": {
+        "date-and-time": "0.9.0",
+        "tinymask": "1.0.2"
+      }
+    },
     "react-native-modal": {
       "version": "11.5.6",
       "resolved": "https://registry.npmjs.org/react-native-modal/-/react-native-modal-11.5.6.tgz",
@@ -20435,6 +20449,11 @@
       "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=",
       "dev": true
     },
+    "tinymask": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/tinymask/-/tinymask-1.0.2.tgz",
+      "integrity": "sha1-3zd1qUCHsNPQVsJW6JI8AbfsCUE="
+    },
     "tmp": {
       "version": "0.0.33",
       "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",

+ 3 - 2
package.json

@@ -57,17 +57,18 @@
     "react-native-gifted-chat": "^0.16.3",
     "react-native-magnus": "^1.0.41",
     "react-native-maps": "0.27.1",
+    "react-native-masked-text": "^1.13.0",
     "react-native-modal": "^11.5.6",
     "react-native-number-please": "^1.0.5",
     "react-native-reanimated": "~1.9.0",
     "react-native-safe-area-context": "~3.0.7",
     "react-native-screens": "~2.9.0",
+    "react-native-svg": "12.1.0",
     "react-native-tab-view": "^2.14.0",
     "react-native-textarea": "^1.0.4",
     "react-native-vector-icons": "^7.0.0",
     "react-native-web": "~0.11.7",
-    "react-native-webview": "9.4.0",
-    "react-native-svg": "12.1.0"
+    "react-native-webview": "9.4.0"
   },
   "devDependencies": {
     "@babel/cli": "^7.10.0",

+ 2 - 2
screens/EditGoods.js

@@ -58,8 +58,8 @@ export default function EditGoods({ navigation }) {
       canEdit
       style={{ marginBottom: 7 }}
       onPress={() => {
-        navigation.navigate("AddGoods", {
-          id: item.id,
+        navigation.navigate("GoodsDetailMore", {
+          goodsId: item.id,
         });
       }}
       changeInfo={info => {

+ 24 - 28
screens/FullReduction.js

@@ -2,15 +2,9 @@
 import * as WebBrowser from "expo-web-browser";
 import * as React from "react";
 import { StyleSheet } from "react-native";
-import {
-  Layout,
-  Text,
-  useTheme,
-  Button,
-  List,
-  Input,
-} from "@ui-kitten/components";
+import { Layout, Text, useTheme, Button, List } from "@ui-kitten/components";
 import { useModel } from "flooks";
+import { Input, Div } from "react-native-magnus";
 import { useFocusEffect } from "@react-navigation/native";
 import ActionButton from "react-native-action-button";
 import EmptyComponent from "../components/EmptyComponent";
@@ -206,24 +200,25 @@ export default function FullReduction() {
   );
 
   const editItem = (info, index) => (
-    <Layout style={styles.item} key={index}>
+    <Layout style={styles.item}>
       <Layout style={[styles.text, styles.flexRow]}>
         <Text>{fullReduction1}</Text>
         <Input
-          size="small"
-          defaultValue={info.fullAmount.toString()}
-          style={styles.input}
-          key={`${index + 1}_0`}
           keyboardType="numeric"
+          flex={1}
+          py={3}
+          mx={5}
+          value={info.fullAmount.toString()}
           onChangeText={value => changeText(value, index, "full")}
         />
+
         <Text>{fullReduction2}</Text>
         <Input
-          size="small"
-          defaultValue={info.minusAmount.toString()}
-          style={styles.input}
-          key={`${index + 1}_1272`}
+          py={3}
           keyboardType="numeric"
+          flex={1}
+          mx={5}
+          value={info.minusAmount.toString()}
           onChangeText={value => changeText(value, index, "minus")}
         />
       </Layout>
@@ -256,22 +251,23 @@ export default function FullReduction() {
 
   return (
     <>
-      <NavHeaderBar title={userTitle21} />
-      <Layout style={styles.all}>
-        <Layout style={[styles.all]}>
-          <List
-            style={styles.list}
-            data={fullReductions}
-            renderItem={renderItem}
-            ListEmptyComponent={EmptyComponent}
-          />
-        </Layout>
+      <Div bg="white" flex={1}>
+        <NavHeaderBar title={userTitle21} />
+        <List
+          ListHeaderComponent={() => {
+            return <Div h={50} />;
+          }}
+          style={styles.list}
+          data={fullReductions}
+          renderItem={renderItem}
+          ListEmptyComponent={EmptyComponent}
+        />
         <ActionButton
           buttonColor={theme["color-primary-500"]}
           onPress={addFullReduction}
           position="left"
         />
-      </Layout>
+      </Div>
     </>
   );
 }

+ 0 - 287
screens/Goods/GoodsDetailScreen.js

@@ -1,287 +0,0 @@
-// import * as WebBrowser from "expo-web-browser";
-// import * as React from "react";
-// import {
-//     Image,
-//     Platform,
-//     StyleSheet,
-//     View,
-//     ImageBackground,
-// } from "react-native";
-// import {
-//     Layout,
-//     Tab,
-//     TabView,
-//     Text,
-//     useTheme,
-//     Button,
-//     Card,
-//     List,
-//     Input,
-//     Icon,
-// } from "@ui-kitten/components";
-// import { useModel } from "flooks";
-// import { useFocusEffect } from "@react-navigation/native";
-// import ActionButton from "react-native-action-button";
-// import ScrollPage from "../../components/ScrollPage";
-// import EmptyComponent from "../../components/EmptyComponent";
-// import NavHeaderBar from "../../components/NavHeaderBar";
-
-// export default function GoodsDetailScreen() {
-//     const theme = useTheme();
-//     const { changeBackground } = useModel("barModel", true);
-//     const { mid } = useModel("userModel");
-//     const { httpGet, httpPost } = useModel("httpModel", true);
-//     const { success, warnning } = useModel("loadingModel", true);
-//     const { showDialog } = useModel("dialogModel");
-
-//     const {
-//         userTitle21,
-//         fullReduction2,
-//         fullReduction1,
-//         delText,
-//         editText,
-//         confirm,
-//         cancel,
-//         complete,
-//         successText,
-//         removeTips,
-//     } = useModel("wordsModel");
-//     const [fullReductions, changeFllReduction] = React.useState([
-//         { fullAmount: "", minusAmount: "" },
-//     ]);
-//     useFocusEffect(
-//         React.useCallback(() => {
-//             changeBackground(theme["color-primary-500"]);
-
-//             httpGet("/fullReduction/my").then((res) => {
-//                 if (res.length > 0) {
-//                     changeFllReduction(
-//                         res.map((item) => {
-//                             return { ...item, edit: false };
-//                         })
-//                     );
-//                 }
-//             });
-//         }, [])
-//     );
-
-//     const renderItem = ({ item, index }) => {
-//         if (!item.id || item.edit) {
-//             return editItem(item, index);
-//         } else {
-//             return saveItem(item);
-//         }
-//     };
-
-//     const saveItem = (info, index) => (
-//         <Layout style={styles.item}>
-//             <Text style={styles.text}>
-//                 {fullReduction1}
-//                 {info.fullAmount}
-//                 {fullReduction2}
-//                 {info.minusAmount}
-//             </Text>
-
-//             <Button
-//                 size='small'
-//                 appearance='outline'
-//                 onPress={() => editInfo(info, index)}
-//             >
-//                 {editText}
-//             </Button>
-//             <Button
-//                 size='small'
-//                 status='danger'
-//                 style={styles.buttonlast}
-//                 onPress={() => delInfo(info, index)}
-//             >
-//                 {delText}
-//             </Button>
-//         </Layout>
-//     );
-
-//     const editItem = (info, index) => (
-//         <Layout style={styles.item}>
-//             <Layout style={[styles.text, styles.flexRow]}>
-//                 <Text>{fullReduction1}</Text>
-//                 <Input
-//                     size='small'
-//                     value={info.fullAmount}
-//                     style={styles.input}
-//                     key={0}
-//                     keyboardType='numeric'
-//                     onChangeText={(value) => changeText(value, index, "full")}
-//                 />
-//                 <Text>{fullReduction2}</Text>
-//                 <Input
-//                     size='small'
-//                     value={info.minusAmount}
-//                     style={styles.input}
-//                     key={1}
-//                     keyboardType='numeric'
-//                     onChangeText={(value) => changeText(value, index, "minus")}
-//                 />
-//             </Layout>
-
-//             <Button size='small' onPress={() => saveInfo(info, index)}>
-//                 {confirm}
-//             </Button>
-//             <Button
-//                 size='small'
-//                 appearance='outline'
-//                 style={styles.buttonlast}
-//                 onPress={() => cancelInfo(info, index)}
-//             >
-//                 {cancel}
-//             </Button>
-//         </Layout>
-//     );
-//     const editInfo = (info, index) => {
-//         let _fullReductions = [...fullReductions];
-//         info.edit = true;
-//         _fullReductions[index] = info;
-//         changeFllReduction(_fullReductions);
-//     };
-//     const delInfo = (info, index) => {
-//         showDialog({
-//             bodyText: removeTips,
-//             status: "danger",
-//             cancelable: true,
-//             confirmCallback: () => {
-//                 httpPost("/fullReduction/del/" + info.id)
-//                     .then((res) => {
-//                         success(successText);
-//                         let _fullReductions = [...fullReductions];
-//                         _fullReductions.splice(index, 1);
-//                         changeFllReduction(_fullReductions);
-//                     })
-//                     .catch((e) => {
-//                         warnning(e.error);
-//                     });
-//             },
-//         });
-//     };
-//     const cancelInfo = (info, index) => {
-//         let _fullReductions = [...fullReductions];
-//         if (info.id) {
-//             info.edit = false;
-//             _fullReductions[index] = info;
-//         } else {
-//             _fullReductions.pop();
-//         }
-
-//         changeFllReduction(_fullReductions);
-//     };
-//     const saveInfo = (info, index) => {
-//         httpPost(
-//             "/fullReduction/save",
-//             {
-//                 ...info,
-//                 merchantId: mid,
-//             },
-//             {
-//                 body: "json",
-//             }
-//         )
-//             .then((res) => {
-//                 success(successText);
-//                 let _fullReductions = [...fullReductions];
-//                 _fullReductions.splice(index, 1, {
-//                     ...res,
-//                     edit: false,
-//                 });
-//                 changeFllReduction(_fullReductions);
-//             })
-//             .catch((e) => {
-//                 warnning(e.error);
-//             });
-//     };
-//     function changeText(value, index, type) {
-//         let _fullReductions = [...fullReductions];
-//         let info = _fullReductions[index];
-//         if (type == "full") {
-//             info.fullAmount = value;
-//         } else {
-//             info.minusAmount = value;
-//         }
-//         _fullReductions.splice(index, 1, info);
-//         changeFllReduction(_fullReductions);
-//     }
-//     const addFullReduction = () => {
-//         console.log("aaa");
-//         let _fullReductions = [...fullReductions];
-//         let last = _fullReductions[_fullReductions.length - 1];
-//         if (last.id) {
-//             _fullReductions.push({
-//                 fullAmount: "",
-//                 minusAmount: "",
-//             });
-//             changeFllReduction(_fullReductions);
-//         }
-//     };
-
-//     return (
-//         <>
-//             <NavHeaderBar title={userTitle21} />
-//             <ScrollPage style={styles.lay}>
-//                 <Layout style={[styles.lay]}>
-//                     <List
-//                         style={styles.list}
-//                         data={fullReductions}
-//                         renderItem={renderItem}
-//                         ListEmptyComponent={EmptyComponent}
-//                     />
-//                 </Layout>
-//                 <ActionButton
-//                     buttonColor={theme["color-primary-500"]}
-//                     onPress={addFullReduction}
-//                     position='left'
-//                 />
-//             </ScrollPage>
-//         </>
-//     );
-// }
-
-// const PulsIcon = (props) => (
-//     <Icon
-//         {...props}
-//         style={[props.style, { width: 33, height: 33 }]}
-//         name='plus-circle'
-//     />
-// );
-// const styles = StyleSheet.create({
-//     lay: {
-//         backgroundColor: "#fff",
-//     },
-//     padBot: {
-//         paddingBottom: 100,
-//     },
-//     list: {
-//         paddingVertical: 10,
-//         paddingHorizontal: 15,
-//         backgroundColor: "transparent",
-//         flex: 0,
-//     },
-//     item: {
-//         flexDirection: "row",
-//         alignItems: "center",
-//         paddingVertical: 10,
-//     },
-//     input: {
-//         marginHorizontal: 5,
-//         minWidth: 49,
-//     },
-//     text: {
-//         flex: 1,
-//     },
-//     flexRow: {
-//         flexDirection: "row",
-//         alignItems: "center",
-//     },
-//     buttonlast: {
-//         marginLeft: 10,
-//     },
-//     button: {
-//         alignSelf: "flex-start",
-//     },
-// });

+ 461 - 0
screens/Goods/GoodsDetailScreen.jsx

@@ -0,0 +1,461 @@
+import * as WebBrowser from "expo-web-browser";
+import * as React from "react";
+import { Dimensions } from "react-native";
+import { Button } from "@ui-kitten/components";
+import { Div, Image, Text, Avatar, Input, Icon } from "react-native-magnus";
+import { ScrollView } from "react-native-gesture-handler";
+import { useFocusEffect } from "@react-navigation/native";
+import { useModel } from "flooks";
+import { useMount, useCreation, useRequest } from "ahooks";
+import UpLoadImage from "../../components/UpLoadImage";
+import OpenTime from "../../components/OpenTime";
+import CommentCard from "../../components/Comment";
+
+const { width } = Dimensions.get("window");
+
+const img1 = require("../../assets/images/zan.png");
+
+const img2 = require("../../assets/images/cai.png");
+
+const AppraisalSortMap = new Map([
+  [
+    "ALL",
+    {
+      name: "全部",
+    },
+  ],
+  [
+    "LATEST",
+    {
+      name: "最新",
+    },
+  ],
+  [
+    "PRAISE",
+    {
+      name: "好评",
+    },
+  ],
+  [
+    "BAD_REVIEW",
+    {
+      name: "差评",
+      isBad: true,
+    },
+  ],
+  [
+    "HAVE_PIC",
+    {
+      name: "有图",
+    },
+  ],
+]);
+
+const CommentItem = ({ info }) => {
+  const imgs = info.img ? info.img.split(",") : [];
+
+  const imageSize = imgs.length > 1 ? 80 : 167;
+  return (
+    <Div row py={10} px={15} bg="white" mt={10}>
+      <Image source={{ uri: info.avatar }} w={33} h={33} />
+      <Div flex={1} ml={5}>
+        <Div row>
+          <Div flex={1}>
+            <Text fontSize="sm" textAlign="left">
+              {info.nickname}
+            </Text>
+            <Div row>
+              <Image source={img1} w={12} h={12} />
+              <Text fontSize="sm" color="yellow500" textAlign="left">
+                {info.likes || 0}
+              </Text>
+            </Div>
+          </Div>
+          <Text fontSize="sm" color="gray400" textAlign="left">
+            {info.appraiseTime}
+          </Text>
+        </Div>
+        <Text my={5} textAlign="left">
+          {info.goodsAppraise}
+        </Text>
+        <Div row>
+          {imgs.map((item, index) => {
+            return (
+              <Image
+                key={index}
+                mt={5}
+                mr={5}
+                source={{ uri: item }}
+                w={imageSize}
+                h={imageSize}
+                rounded={3}
+              />
+            );
+          })}
+        </Div>
+      </Div>
+    </Div>
+  );
+};
+
+export default function LinksScreen({ navigation, route }) {
+  const { changeBackground } = useModel("barModel");
+  const { httpGet, httpPost } = useModel("httpModel");
+  const { success, loading, clearLoading } = useModel("loadingModel", true);
+
+  useFocusEffect(
+    React.useCallback(() => {
+      changeBackground("rgba(0,0,0,0)");
+    }, [])
+  );
+
+  const {
+    addClassification,
+    editGoodsMap,
+    saveClassByList,
+    removeGoodsClassMap,
+    sortClassification,
+  } = useModel("goodsModel");
+
+  const { GVDYKL, IQYCDU } = useModel("wordsModel");
+
+  const { params } = route;
+  const { goodsId } = params;
+
+  const [goodsInfo, setgoodsInfo] = React.useState({});
+
+  const [comments, setcomments] = React.useState([]);
+
+  const [appraisalSort, setappraisalSort] = React.useState("ALL");
+  useRequest(
+    () => {
+      return httpGet(`/appraisal/goods?goodsId=${goodsId}`);
+    },
+    {
+      refreshDeps: [goodsId],
+      onSuccess: result => {
+        setcomments(result);
+      },
+    }
+  );
+
+  useMount(() => {
+    if (goodsId) {
+      loading();
+      httpGet(`/goods/get/${goodsId}`, {}, true)
+        .then(res => {
+          setgoodsInfo(res);
+          setname(res.name);
+          setimg(res.img);
+          setinventory(res.inventory.toString());
+          setamount((res.amount || "").toString());
+          setdiscountAmount((res.discountAmount || "").toString());
+          setintroduction(res.introduction);
+          changeGoodsSpecification(sortClassification(res.specifications));
+          setpackingPrice((res.packingPrice || 0).toString());
+          changeWeek(res.week || "");
+          changeStartTime(res.startTime || "");
+          changeEndTime(res.endTime || "");
+        })
+        .finally(() => {
+          clearLoading();
+        });
+    }
+  });
+
+  React.useEffect(() => {
+    if (editGoodsMap.has(goodsId)) {
+      changeGoodsSpecification(editGoodsMap.get(goodsId));
+    }
+  }, [editGoodsMap.get(goodsId)]);
+
+  const { goodNum, badNum, monthSales, merchantId } = goodsInfo;
+
+  const [img, setimg] = React.useState();
+  const [name, setname] = React.useState("");
+  const [inventory, setinventory] = React.useState(0);
+  const [amount, setamount] = React.useState("");
+  const [discountAmount, setdiscountAmount] = React.useState();
+  const [packingPrice, setpackingPrice] = React.useState("0");
+  const [introduction, setintroduction] = React.useState("");
+  const [goodsSpecification, changeGoodsSpecification] = React.useState([]);
+  const [week, changeWeek] = React.useState("");
+  const [startTime, changeStartTime] = React.useState("08:00:00");
+  const [endTime, changeEndTime] = React.useState("18:00:00");
+
+  // 需要批量提交的规格
+  const postByList = useCreation(() => {
+    return goodsSpecification.filter(item => {
+      return !item.id || item.id < 0;
+    });
+  }, [goodsSpecification]);
+
+  return (
+    <>
+      {/* <NavHeaderBar title="商品规格编辑" /> */}
+      <ScrollView
+        contentContainerStyle={{
+          flexGrow: 1,
+          backgroundColor: "#eee",
+        }}
+      >
+        <Div h={width}>
+          <UpLoadImage value={img} changeIcon={setimg} size="100%" />
+        </Div>
+        <Div bg="white" py={20} px={15}>
+          <Div row>
+            <Text fontSize="sm" minW={70}>
+              商品名
+            </Text>
+            <Div flex={1} ml={5} alignItems="flex-start">
+              <Input
+                value={name}
+                h={25}
+                py={2}
+                lineHeight={21}
+                fontSize="md"
+                bg="gray100"
+                minW={119}
+                onChangeText={setname}
+              />
+
+              <Div row alignItems="center" my={10}>
+                <Image source={img1} w={12} h={12} />
+                <Text fontSize="xs" mr={10} ml={3} color="yellow500">
+                  {goodNum || 0}
+                </Text>
+                <Image source={img2} w={12} h={12} />
+                <Text fontSize="xs" ml={3} mr={10} color="gray300">
+                  {badNum || 0}
+                </Text>
+                <Text fontSize="xs" color="gray300">
+                  月售
+                  {monthSales || 0}
+                </Text>
+              </Div>
+            </Div>
+          </Div>
+
+          <Div row alignItems="center">
+            <Text fontSize="sm" minW={70}>
+              份数
+            </Text>
+            <Input
+              value={inventory}
+              bg="gray100"
+              minW={70}
+              px={12}
+              ml={5}
+              h={25}
+              py={2}
+              lineHeight={21}
+              fontSize="md"
+              keyboardType="numeric"
+              onChangeText={setinventory}
+            />
+          </Div>
+          <Div h={1} bg="gray100" my={20} />
+          <Div>
+            <Div alignSelf="flex-start" pb={10}>
+              <Button
+                appearance="outline"
+                onPress={() => {
+                  navigation.navigate("GoodsSpecification", {
+                    goodsId: goodsId,
+                  });
+                }}
+              >
+                编辑规格
+              </Button>
+            </Div>
+
+            <Div w={200}>
+              {goodsSpecification.map((item, index) => {
+                return (
+                  <Div key={index}>
+                    {item.parent ? (
+                      <Div row alignItems="center" mt={3} pl={20}>
+                        <Text fontSize="md" flex={1}>
+                          添加 {item.name}
+                        </Text>
+                        <Text fontSize="sm" color="red500">
+                          ¥{item.amount || 0}
+                        </Text>
+                      </Div>
+                    ) : (
+                      <Div row mt={10}>
+                        <Text flex={1} fonySize="xl">
+                          分类名: {item.name}
+                        </Text>
+                        <Text fontSize="sm">
+                          {item.multiple ? IQYCDU : GVDYKL}
+                        </Text>
+                      </Div>
+                    )}
+                  </Div>
+                );
+              })}
+            </Div>
+          </Div>
+
+          <Div h={1} bg="gray100" my={20} />
+
+          <Div>
+            <Text fontSize="sm" minW={70} mb={10}>
+              商品简介
+            </Text>
+            <Input
+              placeholder="添加商品简介(不超过50字)"
+              value={introduction}
+              bg="gray100"
+              px={12}
+              onChangeText={setintroduction}
+              multiline
+              numberOfLines={4}
+              maxLength={50}
+              textAlignVertical="top"
+            />
+            <Div position="absolute" right={12} bottom={12}>
+              <Text fontSize="xs" color="gary500">
+                {introduction.length}
+                /50
+              </Text>
+            </Div>
+          </Div>
+
+          <Div h={1} bg="gray100" my={20} />
+
+          <Div row alignItems="center">
+            <Text fontSize="sm" minW={70}>
+              原价
+            </Text>
+            <Input
+              value={amount}
+              h={30}
+              py={5}
+              lineHeight={20}
+              fontSize="xl"
+              bg="gray100"
+              minW={70}
+              px={12}
+              ml={5}
+              keyboardType="numeric"
+              onChangeText={setamount}
+            />
+          </Div>
+          <Div row alignItems="center" my={10}>
+            <Text fontSize="sm" minW={70}>
+              优惠价
+            </Text>
+            <Input
+              value={discountAmount}
+              h={30}
+              py={5}
+              lineHeight={20}
+              fontSize="xl"
+              bg="gray100"
+              minW={70}
+              px={12}
+              ml={5}
+              keyboardType="numeric"
+              onChangeText={setdiscountAmount}
+            />
+          </Div>
+          <Div row alignItems="center" my={10}>
+            <Text fontSize="sm" minW={70}>
+              包装价格
+            </Text>
+            <Input
+              value={packingPrice}
+              h={30}
+              py={5}
+              lineHeight={20}
+              fontSize="xl"
+              bg="gray100"
+              minW={70}
+              px={12}
+              ml={5}
+              keyboardType="numeric"
+              onChangeText={setpackingPrice}
+            />
+          </Div>
+
+          <Div row alignItems="center" my={10}>
+            <Text fontSize="sm" minW={70}>
+              供应时间
+            </Text>
+            <OpenTime
+              submit={(_week, _startTime, _endTime) => {
+                changeWeek(_week);
+                changeStartTime(_startTime);
+                changeEndTime(_endTime);
+              }}
+              week={week}
+              startTime={startTime}
+              endTime={endTime}
+            />
+          </Div>
+
+          <Div my={20} minW={112} alignSelf="center">
+            <Button
+              status="primary"
+              onPress={() => {
+                loading();
+                const info = { ...goodsInfo };
+                delete info.merchant;
+                delete info.specifications;
+                delete info.isFullReduction;
+                httpPost(
+                  "/goods/save",
+                  {
+                    id: goodsId,
+                    merchantId: info.merchantId,
+                    name,
+                    amount,
+                    discountAmount,
+                    inventory,
+                    week,
+                    startTime,
+                    endTime,
+                    introduction,
+                    img,
+                    packingPrice,
+                  },
+                  { body: "json" },
+                  true
+                )
+                  .then(res => {
+                    return saveClassByList(postByList, res.id);
+                  })
+                  .then(() => {
+                    success("提交成功");
+                    navigation.goBack();
+                  })
+                  .finally(() => {
+                    clearLoading();
+                  });
+              }}
+            >
+              提交审核
+            </Button>
+          </Div>
+        </Div>
+
+        <Div bg="gray100">
+          <Text lineHeight={45} px={15} fontSize='xl'>商品评价</Text>
+          {comments.map(item => {
+            return <CommentItem info={item} key={item.goodsAppraise} />;
+          })}
+
+          {comments.length === 0 && (
+            <Div px={10} py={20}>
+              <Text color="gray300" textAlign="center">
+                暂无数据
+              </Text>
+            </Div>
+          )}
+        </Div>
+      </ScrollView>
+    </>
+  );
+}

+ 2 - 2
screens/Goods/SearchScreen.js

@@ -71,8 +71,8 @@ export default function SearchScreen({ navigation }) {
       canEdit
       style={{ marginBottom: 7 }}
       onPress={() => {
-        navigation.navigate("AddGoods", {
-          id: item.id,
+        navigation.navigate("GoodsDetailMore", {
+          goodsId: item.id,
         });
       }}
       changeInfo={info => {

+ 9 - 2
screens/Goods/index.js

@@ -2,18 +2,25 @@ import * as WebBrowser from "expo-web-browser";
 import * as React from "react";
 import SearchScreen from "./SearchScreen";
 import GoodsSpecificationScreen from "./GoodsSpecificationScreenNew";
+import GoodsDetailScreen from "./GoodsDetailScreen";
 
 export default function GoodsConfig(Screen) {
     return (
       <>
         {/* 搜索 */}
-        <Screen name='Search' component={SearchScreen} />
+        <Screen name="Search" component={SearchScreen} />
         {/* 商品规格 */}
         <Screen
-          name='GoodsSpecification'
+          name="GoodsSpecification"
           component={GoodsSpecificationScreen}
           initialParams={{ goodsId: 562 }}
         />
+        {/* 商品规格 */}
+        <Screen
+          name="GoodsDetailMore"
+          component={GoodsDetailScreen}
+          initialParams={{ goodsId: 214 }}
+        />
       </>
     );
 }

+ 26 - 1
screens/Guide1Screen.js

@@ -123,6 +123,7 @@ export default function Guide1Screen({ navigation }) {
   const [endTime, changeEndTime] = React.useState("18:00:00");
   const [introduction, changeIntroduction] = React.useState();
   const [goodsSpecification, changeGoodsSpecification] = React.useState([]);
+  const [packingPrice, setPackingPrice] = React.useState();
 
   const [img, changeImg] = React.useState();
 
@@ -144,6 +145,10 @@ export default function Guide1Screen({ navigation }) {
     if (res.inventory) {
       changeInventory(res.inventory.toString());
     }
+
+    if (res.packingPrice) {
+      setPackingPrice(res.packingPrice.toString());
+    }
     changeWeek(res.week || "");
     changeStartTime(res.startTime || "");
     changeEndTime(res.endTime || "");
@@ -219,7 +224,16 @@ export default function Guide1Screen({ navigation }) {
   };
 
   const canNext = React.useMemo(() => {
-    if (name && amount && inventory && week && startTime && endTime && img) {
+    if (
+      name &&
+      amount &&
+      inventory &&
+      week &&
+      startTime &&
+      endTime &&
+      img &&
+      packingPrice
+    ) {
       return true;
     }
     return false;
@@ -280,6 +294,16 @@ export default function Guide1Screen({ navigation }) {
               textAlign="right"
             />
 
+            {/* 包装价格 */}
+            <FormInput
+              label="包装价格"
+              placeholder="输入包装价格"
+              value={packingPrice}
+              type="money"
+              onChange={setPackingPrice}
+              textAlign="right"
+            />
+
             {/* 商品规格 */}
             <FormInput
               label="商品规格"
@@ -356,6 +380,7 @@ export default function Guide1Screen({ navigation }) {
                       introduction,
                       img,
                       merchantId: mid,
+                      packingPrice,
                     },
                     { body: "json" },
                     true

+ 1 - 1
screens/HomeScreen.js

@@ -265,7 +265,7 @@ export default function HomeScreen({ navigation, route }) {
             userLogout();
           }}
         />
-        <MenuItem title="0824版本" />
+        <MenuItem title="0904版本" />
         <MenuItem title={`切换语言(${local})`} onPress={changeLocal} />
       </OverflowMenu>
     </>

+ 1 - 3
screens/HomeScreenPage2.js

@@ -56,17 +56,15 @@ export default function HomePage2() {
       <Layout style={styles.bageList}>
         <Badge appearance="filled" status="warning" right={5} bottom={4}>
           {TCSOVO}
-          7345
         </Badge>
         <Badge appearance="filled" right={5} bottom={4}>
           {BWEOYE}
         </Badge>
         <Badge appearance="filled" right={5} bottom={4}>
           {POKFOW}
-          1213
         </Badge>
         <Badge appearance="filled" status="info" right={5} bottom={4}>
-          差评12
+          差评
         </Badge>
       </Layout>
       <Layout style={styles.back}>

+ 1 - 0
screens/OrderScreen.js

@@ -88,6 +88,7 @@ export default function OrderScreen({ navigation }) {
   function getList(page, size) {
     const query = {
       merchantStatus: orderStatus[selectedIndex],
+      cancel: false,
     };
     return getOrderList(page, size, query).then(res => {
       changeStart(false);

+ 126 - 0
screens/Set/BackPasswordScreen.js

@@ -0,0 +1,126 @@
+import React, { useState } from "react";
+import { Div, Text } from "react-native-magnus";
+import { Button } from "@ui-kitten/components";
+import { useModel } from "flooks";
+import { useCreation, useMount } from "ahooks";
+import NavHeaderBar from "../../components/NavHeaderBar";
+import SmsInput from "../../components/SmsInput";
+import FormInput from "../../components/FormInput";
+
+export default function BackPasswordScreen({ navigation }) {
+  const { userInfo } = useModel("userModel");
+  const { login_form_3, login_pla_3, confirm } = useModel("wordsModel");
+  const { httpPost } = useModel("httpModel");
+  const { success } = useModel("loadingModel");
+
+  const [code, setcode] = useState("");
+  const [password, setpassword] = useState();
+  const [password2, setpassword2] = useState();
+  const { showDialog } = useModel("dialogModel");
+  const [takePhone, settakePhone] = useState(false);
+
+  const { phone } = userInfo;
+
+  const showPhone = useCreation(() => {
+    if (phone) return `${phone.substr(0, 3)} **** ${phone.substr(-4, 4)}`;
+
+    return "";
+  }, [phone]);
+
+  function changePassword() {
+    httpPost(
+      "/user/changePassword",
+      {
+        password,
+        key: `+86${phone}`,
+        code,
+      },
+      {},
+      true
+    ).then(() => {
+      success("设置成功");
+      setTimeout(() => {
+        navigation.goBack();
+      }, 1500);
+    });
+  }
+
+  useMount(() => {
+    if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(phone)) {
+      showDialog({
+        bodyText: "当前客户手机号异常,请联系客服更换密码",
+        status: "danger",
+        cancelable: false,
+        confirmCallback: () => {
+          navigation.goBack();
+        },
+      });
+    } else {
+      settakePhone(true);
+    }
+  });
+
+  const canSubmit = useCreation(() => {
+    if (phone && code && password && password2 === password) return true;
+    return false;
+  }, [phone, password, code, password2]);
+
+  return (
+    <>
+      <NavHeaderBar title="登录密码设置" />
+      <Div bg="white" py={15} alignItems="center" mt={10}>
+        <Text color="black">我们已经向您的手机发送了短信校验码:</Text>
+        <Text color="black" mt={5}>
+          {showPhone}
+        </Text>
+      </Div>
+
+      <Div bg="white" p={20} mt={10}>
+        {/* 验证码 */}
+        <SmsInput
+          label={`${login_form_3}:`}
+          placeholder={login_pla_3}
+          labelWidth={50}
+          phone={phone}
+          onCodeChange={setcode}
+          type="login"
+          takePhone={takePhone}
+        />
+
+        {/* 密码 */}
+        <FormInput
+          label="新密码"
+          value={password}
+          type="password"
+          placeholder="输入新密码"
+          onChange={setpassword}
+          textAlign="right"
+          labelStyle={{ width: 50 }}
+        />
+
+        {/* 确认密码 */}
+        <FormInput
+          label="确认密码"
+          value={password2}
+          type="password"
+          placeholder="再次输入新密码"
+          onChange={setpassword2}
+          textAlign="right"
+          labelStyle={{ width: 50 }}
+        />
+
+        <Button
+          disabled={!canSubmit}
+          onPress={changePassword}
+          style={{
+            width: 112,
+            marginTop: 20,
+            alignSelf: "center",
+          }}
+        >
+          {confirm}
+        </Button>
+      </Div>
+    </>
+  );
+}

+ 1 - 1
screens/Set/DistributionScreen.js

@@ -73,7 +73,7 @@ export default function DistributionScreen({ navigation }) {
             setAmount(startingAmount);
         }
         if (preparationTime) {
-            setTime(startingAmount);
+            setTime(preparationTime);
         }
     }, [startingAmount, preparationTime]);
 

+ 27 - 27
screens/Set/index.js

@@ -7,33 +7,33 @@ import SystemClassificationEditScreen from "./SystemClassificationEditScreen";
 import ClassificationEditScreen from "./ClassificationEditScreen";
 import FirstOrderScreen from "./FirstOrderScreen";
 import OrderSetting from "./OrderSetting";
+import BackPasswordScreen from "./BackPasswordScreen";
 
 export default function Set(Screen) {
-    return (
-      <>
-        {/* 自动回复 */}
-        <Screen name='Automatic' component={AutomaticScreen} />
-        {/* 物流设置 */}
-        <Screen name='Distribution' component={DistributionScreen} />
-        {/* 分类管理 */}
-        <Screen
-          name='ClassificationManage'
-          component={ClassificationManageScreen}
-        />
-        {/* 系统分类编辑 */}
-        <Screen
-          name='SystemClassificationEdit'
-          component={SystemClassificationEditScreen}
-        />
-        {/* 普通分类编辑 */}
-        <Screen
-          name='ClassificationEdit'
-          component={ClassificationEditScreen}
-        />
-        {/* 首单优惠 */}
-        <Screen name='FirstOrder' component={FirstOrderScreen} />
-        {/* 首单优惠 */}
-        <Screen name='OrderSetting' component={OrderSetting} />
-      </>
-    );
+  return (
+    <>
+      {/* 自动回复 */}
+      <Screen name="Automatic" component={AutomaticScreen} />
+      {/* 物流设置 */}
+      <Screen name="Distribution" component={DistributionScreen} />
+      {/* 分类管理 */}
+      <Screen
+        name="ClassificationManage"
+        component={ClassificationManageScreen}
+      />
+      {/* 系统分类编辑 */}
+      <Screen
+        name="SystemClassificationEdit"
+        component={SystemClassificationEditScreen}
+      />
+      {/* 普通分类编辑 */}
+      <Screen name="ClassificationEdit" component={ClassificationEditScreen} />
+      {/* 首单优惠 */}
+      <Screen name="FirstOrder" component={FirstOrderScreen} />
+      {/* 首单优惠 */}
+      <Screen name="OrderSetting" component={OrderSetting} />
+
+      <Screen name="BackPassword" component={BackPasswordScreen} />
+    </>
+  );
 }

+ 29 - 0
screens/UserScreen.js

@@ -216,6 +216,35 @@ export default function UserScreen({ navigation }) {
             />
           </MenuGroup>
 
+          <MenuGroup title="设置" style={styles.menuGroup2}>
+            <MenuItem
+              title="密码设置"
+              accessoryRight={ForwardIcon}
+              onPress={() => {
+                navigation.navigate("Money");
+              }}
+            />
+
+            <MenuItem
+              title="配送设置"
+              accessoryRight={ForwardIcon}
+              onPress={() => {
+                navigation.navigate("Distribution");
+              }}
+            />
+          </MenuGroup>
+
+          <MenuItem
+            title="培训中心"
+            accessoryRight={ForwardIcon}
+            style={styles.menuItem}
+            onPress={() => {
+              // navigation.navigate("Home", {
+              //   screen: "homeTab3",
+              // });
+            }}
+          />
+
           {/* <MenuGroup title='Akveo React Native'>
                             <MenuItem title='UI Kitten' />
                             <MenuItem title='Kitten Tricks' />