Explorar el Código

0526测试版本

panhui hace 5 años
padre
commit
f8088ac6cd

+ 36 - 12
App.js

@@ -12,7 +12,7 @@ import {
 import { EvaIconsPack } from "@ui-kitten/eva-icons";
 import { default as theme } from "./theme.json"; // <-- Import app theme
 import { default as customMapping } from "./mapping.json"; // <-- Import app theme
-
+import { SafeAreaView } from "react-native";
 import { SplashScreen } from "expo";
 import * as Font from "expo-font";
 import { Ionicons } from "@expo/vector-icons";
@@ -64,6 +64,19 @@ export default function App(props) {
                     ...Ionicons.font,
                     "space-mono": require("./assets/fonts/SpaceMono-Regular.ttf"),
                 });
+
+                await Font.loadAsync(
+                    "antoutline",
+                    // eslint-disable-next-line
+                    require("@ant-design/icons-react-native/fonts/antoutline.ttf")
+                );
+
+                await Font.loadAsync(
+                    "antfill",
+                    // eslint-disable-next-line
+                    require("@ant-design/icons-react-native/fonts/antfill.ttf")
+                );
+
                 getWords();
             } catch (e) {
                 // We might want to provide this error information to an error reporting service
@@ -78,9 +91,13 @@ export default function App(props) {
     }, []);
 
     const [loginState, setLogin] = React.useState("loading");
-    const { getUserInfo, getGuideStep, initApp, refreashReason } = useModel(
-        "userModel"
-    );
+    const {
+        getUserInfo,
+        getGuideStep,
+        initApp,
+        refreashReason,
+        changeInIt,
+    } = useModel("userModel");
 
     React.useEffect(() => {
         console.log("刷新");
@@ -99,16 +116,23 @@ export default function App(props) {
                 })
                 .catch(() => {
                     setLogin("loginOut");
+                })
+                .finally(() => {
+                    changeInIt();
                 });
         } else if (initApp && refreashReason == "guideStep") {
             setLogin("loading");
-            getGuideStep().then(res => {
-                if (res == "finish") {
-                    setLogin("login");
-                } else {
-                    setLogin(res);
-                }
-            });
+            getGuideStep()
+                .then(res => {
+                    if (res == "finish") {
+                        setLogin("login");
+                    } else {
+                        setLogin(res);
+                    }
+                })
+                .finally(() => {
+                    changeInIt();
+                });
         }
     }, [initApp]);
 
@@ -135,7 +159,7 @@ export default function App(props) {
                                         cardStyleInterpolator:
                                             CardStyleInterpolators.forHorizontalIOS,
                                     }}
-                                    // initialRouteName='OrderSetting'
+                                    // initialRouteName='GoodsSpecification'
                                 >
                                     {/* <Stack.Screen
                                     name='LoadingModel'

+ 6 - 5
babel.config.js

@@ -1,6 +1,7 @@
-module.exports = function(api) {
-  api.cache(true);
-  return {
-    presets: ['babel-preset-expo'],
-  };
+module.exports = function (api) {
+    api.cache(true);
+    return {
+        presets: ["babel-preset-expo"],
+        plugins: [["import", { libraryName: "antd-mobile-rn" }]],
+    };
 };

+ 1 - 3
components/Complaint.js

@@ -33,9 +33,7 @@ export default function Complaint(props) {
             <Divider style={styles.drivider} />
 
             <Text category='h1' status='info'>
-                您的订单已经被取消收款方老司机的发链接SDK溜老司机
-                的上路考订水房间了圣诞节弗兰克斯家电快溜缝胶看楼上的甲方看了圣诞节放凌空加施蒂
-                <br />
+                您的订单已经被取消收款方老司机的发链接SDK溜老司机的上路考订水房间了圣诞节弗兰克斯家电快溜缝胶看楼上的甲方看了圣诞节放凌空加施蒂
             </Text>
 
             <Layout style={styles.imgList}>

+ 17 - 9
components/Datepicker.js

@@ -6,6 +6,7 @@ import {
     LayoutAnimation,
     Platform,
     UIManager,
+    View,
 } from "react-native";
 import {
     CheckBox,
@@ -50,16 +51,23 @@ export default function MyDatepicker(props) {
                     chooseDate(dateValue);
                 }}
             >
-                <Datepicker
-                    style={{ minHeight: 200, width: "100%", flexShrink: 0 }}
-                    proportion={[1, 1, 1]}
-                    startYear={TimeUtil.getNowYear()}
-                    numberOfYears={10}
-                    date={TimeUtil.getDateStr()}
-                    onChange={date => {
-                        chooseValue(date);
+                <View
+                    style={{
+                        height: 200,
+                        marginBottom: 50,
+                        minHeight: 200,
                     }}
-                />
+                >
+                    <Datepicker
+                        proportion={[1, 1, 1]}
+                        startYear={TimeUtil.getNowYear()}
+                        numberOfYears={10}
+                        date={TimeUtil.getDateStr()}
+                        onChange={date => {
+                            chooseValue(date);
+                        }}
+                    />
+                </View>
             </BottomModal>
         </>
     );

+ 6 - 1
components/FormInput.js

@@ -180,7 +180,12 @@ const FormInput = React.memo(props => {
                         }}
                     >
                         <Cascader
-                            style={{ height: 200, marginBottom: 50 }}
+                            style={{
+                                width: "100%",
+                                height: 200,
+                                marginBottom: 50,
+                                minHeight: 200,
+                            }}
                             data={selectList}
                             fieldKeys={{
                                 labelKey: "name",

+ 35 - 13
components/GoodsCard.js

@@ -22,6 +22,7 @@ export default function GoodsCard(props) {
         discountAmount,
         amount,
         takeOff,
+        status,
     } = info || {};
 
     const { takeOffInfo, ChangeTakeOff } = useModel("goodsModel", true);
@@ -41,8 +42,21 @@ export default function GoodsCard(props) {
                         source={{
                             uri: img,
                         }}
-                    />
-
+                    ></Avatar>
+                    {status == "PENDING" && (
+                        <Text style={styles.status} category='h1'>
+                            待审核
+                        </Text>
+                    )}
+                    {status == "DENY" && (
+                        <Text
+                            style={styles.status}
+                            category='h1'
+                            status='danger'
+                        >
+                            审核未通过
+                        </Text>
+                    )}
                     <Layout style={styles.main}>
                         <Text
                             category='s1'
@@ -74,8 +88,7 @@ export default function GoodsCard(props) {
                             </Text>
                         </Text>
                     </Layout>
-
-                    {!props.appearance && props.isAdd && (
+                    {props.appearance && props.type == "goodsList" && (
                         <Layout style={styles.butContent}>
                             <Button
                                 status='primary'
@@ -99,7 +112,6 @@ export default function GoodsCard(props) {
                             </Button>
                         </Layout>
                     )}
-
                     {!props.appearance && !props.isAdd && (
                         <Layout style={styles.butContent}>
                             <Button
@@ -111,7 +123,6 @@ export default function GoodsCard(props) {
                             </Button>
                         </Layout>
                     )}
-
                     {props.appearance && props.isAdd && (
                         <Layout style={styles.butContent}>
                             <Button
@@ -123,8 +134,7 @@ export default function GoodsCard(props) {
                             </Button>
                         </Layout>
                     )}
-
-                    {props.appearance == "classification" &&
+                    {/* {props.appearance == "classification" &&
                         props.type != "goodsList" && (
                             <Button
                                 style={styles.miniButton}
@@ -132,7 +142,7 @@ export default function GoodsCard(props) {
                                 onPress={props.removeEvent}
                                 accessoryLeft={StarIcon}
                             />
-                        )}
+                        )} */}
                 </Layout>
             ) : (
                 <Layout style={styles.layout} />
@@ -156,6 +166,7 @@ const styles = StyleSheet.create({
     },
     main: {
         flex: 1,
+        backgroundColor: "transparent",
     },
     flex1: {
         flex: 1,
@@ -167,12 +178,23 @@ const styles = StyleSheet.create({
         color: "#B5B5B5",
     },
     miniButton: {
-        minWidth: 18,
-        minHeight: 18,
-        width: 18,
-        height: 18,
+        minWidth: 22,
+        minHeight: 22,
+        width: 22,
+        height: 22,
         position: "absolute",
         right: 10,
         bottom: 5,
+        maxWidth: 22,
+        minHeight: 22,
+    },
+    status: {
+        position: "absolute",
+        left: 0,
+        width: 80,
+        paddingVertical: 4,
+        backgroundColor: "#F0F0F0",
+        bottom: 0,
+        textAlign: "center",
     },
 });

+ 11 - 1
components/ListComponent.js

@@ -22,16 +22,26 @@ export default function ListComponent(props) {
         extraData,
         delId,
         setChild,
+        startState,
     } = props;
 
     useFocusEffect(
         React.useCallback(() => {
-            onRefresh();
+            if (startState != false) {
+                onRefresh();
+            }
         }, [])
     );
+    React.useEffect(() => {
+        if (startState) {
+            onRefresh();
+        }
+    }, [startState]);
+
     function getList() {
         if (getInfo != null) {
             return getInfo(page, size).then(res => {
+                console.log(res);
                 if (emptyEvent) {
                     if (res.numberOfElements === 0) {
                         emptyEvent(true);

+ 1 - 0
components/ScrollPage.js

@@ -70,6 +70,7 @@ export default function scrollPage(props) {
                 }
                 style={style}
                 contentContainerStyle={{ flexGrow: 1 }}
+                // keyboardShouldPersistTaps={"handled"}
             >
                 {props.children}
             </ScrollView>

+ 17 - 2
models/goodsModel.js

@@ -99,9 +99,24 @@ export default {
             });
         },
         // 添加分类商品
-        addClassGoods(info) {},
+        addClassGoods(info) {
+            let { successText } = model("wordsModel");
+            let { success } = model("loadingModel");
+            let { httpPost } = model("httpModel");
+            return httpPost(
+                "/goodsSpecification/save",
+                info,
+                {
+                    body: "json",
+                },
+                true
+            ).then(res => {
+                success(successText);
+                return Promise.resolve(res);
+            });
+        },
         //移除商品分类
-        removeCLass(info,callBack) {
+        removeCLass(info, callBack) {
             let { showDialog } = model("dialogModel");
             let { removeTips, editSuccess } = model("wordsModel");
             let { httpPost } = model("httpModel");

+ 1 - 0
models/httpModel.js

@@ -101,6 +101,7 @@ export default {
             });
         },
         addAsyncStorage(key, value) {
+            console.log(key, value);
             return new Promise(async (resolve, reject) => {
                 try {
                     await AsyncStorage.setItem(key, value);

+ 37 - 3
models/userModel.js

@@ -27,6 +27,9 @@ export default {
                 }
             });
         },
+        changeInIt() {
+            setState({ initApp: false });
+        },
         checkLogin() {
             const { getUserInfo, status } = model();
             const { getAsyncStorage } = model("httpModel");
@@ -35,7 +38,7 @@ export default {
                     .then(async _ => {
                         let guideStep = await getAsyncStorage("guideStep");
                         if (status == "PASS") {
-                            guideStep = 4;
+                            guideStep = "4";
                         }
                         if (guideStep) {
                             setState({ guideStep: guideStep, isLogin: true });
@@ -99,7 +102,7 @@ export default {
                 addAsyncStorage("token", res).then(() => {
                     if (res) {
                         success("注册成功");
-                        addAsyncStorage("guideStep", 1).then(() => {
+                        addAsyncStorage("guideStep", "1").then(() => {
                             setState({ initApp: true });
                         });
                     }
@@ -121,9 +124,15 @@ export default {
             registerUser(_registerInfo);
         },
         changeGuideStep(step) {
+            console.log("a");
+            console.log(step);
             const { addAsyncStorage } = model("httpModel");
             addAsyncStorage("guideStep", step.toString()).then(() => {
                 setState({ initApp: true, refreashReason: "guideStep" });
+
+                setTimeout(() => {
+                    setState({ initApp: false });
+                }, 500);
             });
         },
         saveMerchant({ ...data }) {
@@ -138,7 +147,7 @@ export default {
                 },
                 { body: "json" }
             ).then(res => {
-                changeGuideStep(4);
+                changeGuideStep("5");
             });
         },
         checkInfo({ aliAccountEvent, aliNameEvent }) {
@@ -224,5 +233,30 @@ export default {
                 }
             });
         },
+        closeMer() {
+            const { isOpen ,getUserInfo} = model();
+            const { httpGet } = model("httpModel");
+            const { success } = model("loadingModel");
+            let { showDialog } = model("dialogModel");
+            let { removeTips, editSuccess } = model("wordsModel");
+            if (isOpen) {
+                showDialog({
+                    bodyText: "停止当前营业,直到下次营业开启",
+                    status: "danger",
+                    cancelable: true,
+                    confirmCallback: () => {
+                        httpGet("/merchant/closeMer", {}, true).then(res => {
+                            success("操作成功");
+                            getUserInfo()
+                        });
+                    },
+                });
+            } else {
+                httpGet("/merchant/closeMer", {}, true).then(res => {
+                    success("操作成功");
+                    getUserInfo()
+                });
+            }
+        },
     }),
 };

+ 3 - 0
navigation/BasicNavigator.js

@@ -12,6 +12,7 @@ import Bank from "../screens/Bank";
 import SetEvent from "../screens/Set";
 import Coupon from "../screens/Coupon";
 import Appraisal from "../screens/Appraisal";
+import Goods from "../screens/Goods";
 
 export default function BasicScreens(Screen) {
     return (
@@ -35,6 +36,8 @@ export default function BasicScreens(Screen) {
             {Coupon(Screen)}
 
             {Appraisal(Screen)}
+
+            {Goods(Screen)}
         </>
     );
 }

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 2407 - 1356
package-lock.json


+ 9 - 3
package.json

@@ -13,11 +13,13 @@
     "preset": "jest-expo"
   },
   "dependencies": {
+    "@ant-design/react-native": "^3.3.0",
+    "@babel/polyfill": "^7.8.7",
     "@eva-design/eva": "^2.0.0-alpha.1",
     "@expo/vector-icons": "^10.0.0",
     "@react-native-community/masked-view": "0.1.6",
     "@react-navigation/bottom-tabs": "^5.0.0",
-    "@react-navigation/material-top-tabs": "^5.2.5",
+    "@react-navigation/material-top-tabs": "^5.2.8",
     "@react-navigation/native": "^5.4.0",
     "@react-navigation/stack": "^5.0.0",
     "@react-navigation/web": "~1.0.0-alpha.9",
@@ -52,12 +54,16 @@
     "react-native-svg": "11.0.1",
     "react-native-tab-view": "^2.14.0",
     "react-native-textarea": "^1.0.4",
-    "react-native-web": "^0.11.7"
+    "react-native-web": "^0.11.7",
+    "teaset": "^0.7.4"
   },
   "devDependencies": {
-    "@babel/core": "^7.8.6",
+    "@babel/cli": "^7.8.4",
+    "@babel/core": "^7.9.6",
+    "@babel/preset-env": "^7.9.6",
     "@expo/webpack-config": "^0.11.25",
     "babel-loader": "^8.1.0",
+    "babel-plugin-import": "^1.13.0",
     "babel-preset-expo": "^8.1.0",
     "jest-expo": "^37.0.0"
   },

+ 35 - 24
screens/FullReduction.js

@@ -57,10 +57,10 @@ export default function FullReduction({ navigation, route }) {
         React.useCallback(() => {
             changeBackground(theme["color-primary-500"]);
 
-            httpGet("/fullReduction/my").then((res) => {
+            httpGet("/fullReduction/my").then(res => {
                 if (res.length > 0) {
                     changeFllReduction(
-                        res.map((item) => {
+                        res.map(item => {
                             return { ...item, edit: false };
                         })
                     );
@@ -110,34 +110,40 @@ export default function FullReduction({ navigation, route }) {
                 <Text>{fullReduction1}</Text>
                 <Input
                     size='small'
-                    value={info.fullAmount}
+                    defaultValue={info.fullAmount.toString()}
                     style={styles.input}
-                    key={0}
+                    key={index + 0}
                     keyboardType='numeric'
-                    onChangeText={(value) => changeText(value, index, "full")}
+                    onChangeText={value => changeText(value, index, "full")}
                 />
                 <Text>{fullReduction2}</Text>
                 <Input
                     size='small'
-                    value={info.minusAmount}
+                    defaultValue={info.minusAmount.toString()}
                     style={styles.input}
-                    key={1}
+                    key={index + 1}
                     keyboardType='numeric'
-                    onChangeText={(value) => changeText(value, index, "minus")}
+                    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)}
+                disabled={!info.minusAmount || !info.fullAmount}
+                onPress={() => saveInfo(info, index)}
             >
-                {cancel}
+                {confirm}
             </Button>
+            {!!info.id && (
+                <Button
+                    size='small'
+                    appearance='outline'
+                    style={styles.buttonlast}
+                    onPress={() => cancelInfo(info, index)}
+                >
+                    {cancel}
+                </Button>
+            )}
         </Layout>
     );
     const editInfo = (info, index) => {
@@ -153,13 +159,13 @@ export default function FullReduction({ navigation, route }) {
             cancelable: true,
             confirmCallback: () => {
                 httpPost("/fullReduction/del/" + info.id)
-                    .then((res) => {
+                    .then(res => {
                         success(successText);
                         let _fullReductions = [...fullReductions];
                         _fullReductions.splice(index, 1);
                         changeFllReduction(_fullReductions);
                     })
-                    .catch((e) => {
+                    .catch(e => {
                         warnning(e.error);
                     });
             },
@@ -187,7 +193,7 @@ export default function FullReduction({ navigation, route }) {
                 body: "json",
             }
         )
-            .then((res) => {
+            .then(res => {
                 success(successText);
                 let _fullReductions = [...fullReductions];
                 _fullReductions.splice(index, 1, {
@@ -196,7 +202,7 @@ export default function FullReduction({ navigation, route }) {
                 });
                 changeFllReduction(_fullReductions);
             })
-            .catch((e) => {
+            .catch(e => {
                 warnning(e.error);
             });
     };
@@ -227,13 +233,14 @@ export default function FullReduction({ navigation, route }) {
     return (
         <>
             <NavHeaderBar title={userTitle21} />
-            <ScrollPage style={styles.lay}>
-                <Layout style={[styles.lay]}>
+            <Layout style={styles.all}>
+                <Layout style={[styles.all]}>
                     <List
                         style={styles.list}
                         data={fullReductions}
                         renderItem={renderItem}
                         ListEmptyComponent={EmptyComponent}
+                        keyboardShouldPersistTaps='handled'
                     />
                 </Layout>
                 <ActionButton
@@ -241,12 +248,12 @@ export default function FullReduction({ navigation, route }) {
                     onPress={addFullReduction}
                     position='left'
                 />
-            </ScrollPage>
+            </Layout>
         </>
     );
 }
 
-const PulsIcon = (props) => (
+const PulsIcon = props => (
     <Icon
         {...props}
         style={[props.style, { width: 33, height: 33 }]}
@@ -254,6 +261,10 @@ const PulsIcon = (props) => (
     />
 );
 const styles = StyleSheet.create({
+    all: {
+        backgroundColor: "#fff",
+        flex: 1,
+    },
     lay: {
         backgroundColor: "#fff",
     },
@@ -264,7 +275,7 @@ const styles = StyleSheet.create({
         paddingVertical: 10,
         paddingHorizontal: 15,
         backgroundColor: "transparent",
-        flex: 0,
+        flex: 1,
     },
     item: {
         flexDirection: "row",

+ 291 - 0
screens/Goods/GoodsDetailScreen.js

@@ -0,0 +1,291 @@
+import * as WebBrowser from "expo-web-browser";
+import * as React from "react";
+import {
+    Image,
+    Platform,
+    StyleSheet,
+    TouchableOpacity,
+    View,
+    ImageBackground,
+} from "react-native";
+import scrollPage from "../decorator/scrollPage";
+import { useModel } from "flooks";
+import {
+    Layout,
+    Tab,
+    TabView,
+    Text,
+    useTheme,
+    Button,
+    Card,
+    List,
+    Input,
+    Icon,
+} from "@ui-kitten/components";
+import EmptyComponent from "../../components/EmptyComponent";
+import FormInput from "../../components/FormInput";
+import { useFocusEffect } from "@react-navigation/native";
+import ScrollPage from "../../components/ScrollPage";
+import NavHeaderBar from "../../components/NavHeaderBar";
+import GoodsCard from "../../components/GoodsCard";
+import ActionButton from "react-native-action-button";
+
+export default function GoodsDetailScreen({ navigation, route }) {
+    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",
+    },
+});

+ 342 - 0
screens/Goods/GoodsSpecificationScreen.js

@@ -0,0 +1,342 @@
+import * as WebBrowser from "expo-web-browser";
+import * as React from "react";
+import {
+    Image,
+    Platform,
+    StyleSheet,
+    TouchableOpacity,
+    View,
+    ImageBackground,
+} from "react-native";
+import { useModel } from "flooks";
+import {
+    Layout,
+    Tab,
+    TabView,
+    Text,
+    useTheme,
+    Button,
+    Card,
+    Input,
+    Icon,
+} from "@ui-kitten/components";
+import EmptyComponent from "../../components/EmptyComponent";
+import FormInput from "../../components/FormInput";
+import { useFocusEffect, useRoute } from "@react-navigation/native";
+import ListComponent from "../../components/ListComponent";
+import NavHeaderBar from "../../components/NavHeaderBar";
+import GoodsCard from "../../components/GoodsCard";
+import ActionButton from "react-native-action-button";
+
+export default function GoodsSpecificationScreen({ navigation }) {
+    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 [allEditInfo, setEdit] = React.useState({});
+    const [goodsId, setGoodsId] = React.useState(0);
+    const [startState, changeState] = React.useState(true);
+    const [editList, setEditList] = React.useState([]);
+    const [addNew, changeNew] = React.useState(false);
+    const [isNew, changeIsNew] = React.useState(false);
+
+    const {
+        userTitle21,
+        fullReduction2,
+        fullReduction1,
+        delText,
+        editText,
+        confirm,
+        cancel,
+        complete,
+        successText,
+        removeTips,
+    } = useModel("wordsModel");
+    const { addClassGoods } = useModel("goodsModel");
+    useFocusEffect(
+        React.useCallback(() => {
+            changeBackground(theme["color-primary-500"]);
+        }, [])
+    );
+
+    const route = useRoute();
+
+    function getList() {
+        let { params } = route;
+        let { goodsId } = params || {};
+        setGoodsId(goodsId);
+        return httpGet(
+            "/goodsSpecification/byGoodsId",
+            {
+                goodsId: goodsId || 0,
+            },
+            true
+        ).then(res => {
+            changeState(false);
+            if (res.length === 0) {
+                changeIsNew(true);
+            } else {
+                changeIsNew(false);
+            }
+            let content = res || [];
+            if (isNew || addNew) {
+                content.push({ name: "", amount: "" });
+            }
+
+            return Promise.resolve({
+                content: content.map(item => {
+                    let _info = { ...item, amount: item.amount.toString() };
+
+                    if (!_info.id || editList.indexOf(_info.id) != -1) {
+                        _info.edit = true;
+                    } else {
+                        _info.edit = false;
+                    }
+                    return _info;
+                }),
+                last: true,
+            });
+        });
+    }
+
+    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}>
+            <Layout style={[styles.text, styles.flexRow]}>
+                <Text category='c1'>添加{info.name}</Text>
+                <Layout style={styles.money}>
+                    <Text category='c1'>¥{info.amount}</Text>
+                </Layout>
+            </Layout>
+
+            <Button
+                size='small'
+                appearance='outline'
+                onPress={() => editInfo(info.id)}
+            >
+                {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>规格</Text>
+                <Input
+                    size='small'
+                    defaultValue={info.name}
+                    style={styles.input}
+                    key={index + "_0"}
+                    keyboardType='numeric'
+                    onChangeText={text => {
+                        let _editInfo = { ...allEditInfo } || {};
+                        if (!_editInfo[info.id || "new"]) {
+                            _editInfo[info.id || "new"] = {};
+                        }
+                        _editInfo[info.id || "new"]["name"] = text;
+                        setEdit(_editInfo);
+                    }}
+                />
+                <Text>价钱</Text>
+                <Input
+                    size='small'
+                    defaultValue={info.amount}
+                    style={styles.input}
+                    key={index + "_1"}
+                    keyboardType='numeric'
+                    onChangeText={text => {
+                        let _editInfo = { ...allEditInfo } || {};
+                        if (!_editInfo[info.id || "new"]) {
+                            _editInfo[info.id || "new"] = {};
+                        }
+                        _editInfo[info.id || "new"]["amount"] = text;
+                        setEdit(_editInfo);
+                    }}
+                />
+            </Layout>
+
+            <Button size='small' onPress={() => saveInfo(info)}>
+                {confirm}
+            </Button>
+            <Button
+                size='small'
+                appearance='outline'
+                style={styles.buttonlast}
+                onPress={() => cancelInfo(info)}
+            >
+                {cancel}
+            </Button>
+        </Layout>
+    );
+
+    function setName(index, text) {}
+
+    function setAmount(index, text) {}
+
+    const editInfo = id => {
+        let _editList = [...editList];
+        _editList.push(id);
+        setEditList(_editList);
+        changeState(true);
+    };
+    const delInfo = (info, index) => {
+        showDialog({
+            bodyText: removeTips,
+            status: "danger",
+            cancelable: true,
+            confirmCallback: () => {
+                httpPost("/goodsSpecification/del/" + info.id)
+                    .then(res => {
+                        success(successText);
+                        changeState(true);
+                    })
+                    .catch(e => {
+                        warnning(e.error);
+                    });
+            },
+        });
+    };
+    //取消
+    const cancelInfo = info => {
+        let _editInfo = { ...allEditInfo };
+        _editInfo[info.id || "new"] = {};
+        setEdit(_editInfo);
+
+        if (info.id) {
+            let _editList = [...editList];
+            _editList = _editList.filter(item => {
+                return item != res.id;
+            });
+            setEditList(_editList);
+        } else if (!isNew) {
+            changeNew(false);
+        }
+        changeState(true);
+    };
+    //保存
+    const saveInfo = info => {
+        let _editInfo = { ...allEditInfo };
+        let name = "";
+        let amount = "";
+        if (_editInfo[info.id || "new"]) {
+            name = _editInfo[info.id || "new"]["name"];
+            amount = _editInfo[info.id || "new"]["amount"];
+        }
+        let data = {
+            ...info,
+            name: name,
+            amount: amount,
+            goodsId: goodsId,
+        };
+        if (!info.id && !isNew) {
+            changeNew(false);
+        }
+
+        addClassGoods(data).then(res => {
+            _editInfo["new"] = {};
+            _editInfo[res.id] = {};
+            setEdit(_editInfo);
+            let _editList = [...editList];
+            _editList = _editList.filter(item => {
+                return item != res.id;
+            });
+            setEditList(_editList);
+            changeState(true);
+        });
+    };
+
+    //
+    const addFullReduction = () => {
+        changeNew(true);
+        changeState(true);
+    };
+
+    return (
+        <>
+            <NavHeaderBar title='商品规格编辑' />
+
+            <Layout style={[styles.lay]}>
+                <ListComponent
+                    getInfo={getList}
+                    renderItem={renderItem}
+                    style={styles.list}
+                    separatorStyle={styles.separatorStyle}
+                    showEmpty={true}
+                    extraData={{ allEditInfo }}
+                    startState={startState}
+                />
+                <ActionButton
+                    buttonColor={theme["color-primary-500"]}
+                    onPress={addFullReduction}
+                    position='left'
+                />
+            </Layout>
+        </>
+    );
+}
+
+const PulsIcon = props => (
+    <Icon
+        {...props}
+        style={[props.style, { width: 33, height: 33 }]}
+        name='plus-circle'
+    />
+);
+const styles = StyleSheet.create({
+    lay: {
+        backgroundColor: "#fff",
+        flex: 1,
+    },
+    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",
+    },
+    money: {
+        marginLeft: 10,
+    },
+});

+ 120 - 0
screens/Goods/SearchScreen.js

@@ -0,0 +1,120 @@
+import * as WebBrowser from "expo-web-browser";
+import * as React from "react";
+import {
+    Image,
+    Platform,
+    StyleSheet,
+    TouchableOpacity,
+    View,
+    ImageBackground,
+} from "react-native";
+import { useModel } from "flooks";
+import {
+    Layout,
+    Tab,
+    TabView,
+    Text,
+    useTheme,
+    Button,
+    Card,
+    List,
+} from "@ui-kitten/components";
+import FormInput from "../../components/FormInput";
+import { useFocusEffect } from "@react-navigation/native";
+import ScrollPage from "../../components/ScrollPage";
+import NavHeaderBar from "../../components/NavHeaderBar";
+import GoodsCard from "../../components/GoodsCard";
+import UpLoadImage from "../../components/UpLoadImage";
+import GoodsCardLarge from "../../components/GoodsCard";
+import EmptyComponent from "../../components/EmptyComponent";
+
+export default function SearchScreen({ navigation, route }) {
+    const theme = useTheme();
+    const { changeBackground } = useModel("barModel");
+    const { banner, logo, uploadStoreImg } = useModel("userModel");
+    const { httpGet } = useModel("httpModel");
+    const [goods, changeGoods] = React.useState("");
+    const [type, setType] = React.useState("banner");
+    const { showDialog } = useModel("dialogModel");
+    const {
+        userTitle3,
+        addGoods2,
+        remove,
+        editText,
+        uplaodText,
+        uplaodImg,
+        removeTips,
+    } = useModel("wordsModel");
+
+    useFocusEffect(
+        React.useCallback(() => {
+            changeBackground(theme["color-primary-500"]);
+            getAllGoods();
+        }, [])
+    );
+
+    function getAllGoods() {
+        httpGet("/goods/my").then(res => {
+            changeGoods(res);
+        });
+    }
+
+    const goodsItem = ({ item, index }) => (
+        <GoodsCardLarge
+            appearance='classification'
+            type='goodsList'
+            key={item.id}
+            info={item}
+            canEdit={true}
+            style={{ marginBottom: 7 }}
+            onPress={() => {
+                navigation.navigate("AddGoods", {
+                    id: item.id,
+                });
+            }}
+            changeInfo={info => {
+                var _goods = [...goods];
+                _goods.splice(index, 1, info);
+                console.log(_goods);
+                changeGoods(_goods);
+            }}
+        />
+    );
+
+    return (
+        <>
+            <NavHeaderBar title={userTitle3} />
+            <Layout style={styles.container}>
+                <Layout style={styles.bntLay}>
+                    <Input />
+                </Layout>
+                <List
+                    style={styles.list}
+                    data={goods}
+                    renderItem={goodsItem}
+                    ListEmptyComponent={EmptyComponent}
+                />
+            </Layout>
+        </>
+    );
+}
+
+const styles = StyleSheet.create({
+    container: {
+        flex: 1,
+    },
+    bntLay: {
+        paddingVertical: 5,
+        flexDirection: "row",
+        alignItems: "center",
+        justifyContent: "center",
+        backgroundColor: "#EEEEEE",
+        flexShrink: 0,
+    },
+    list: {
+        flex: 1,
+        backgroundColor: "#EEEEEE",
+        paddingTop: 10,
+        paddingHorizontal: 15,
+    },
+});

+ 19 - 0
screens/Goods/index.js

@@ -0,0 +1,19 @@
+import * as WebBrowser from "expo-web-browser";
+import * as React from "react";
+import SearchScreen from "./SearchScreen";
+import GoodsSpecificationScreen from "./GoodsSpecificationScreen";
+
+export default function Set(Screen) {
+    return (
+        <>
+            {/* 搜索 */}
+            <Screen name='SearchScreen' component={SearchScreen} />
+            {/* 商品规格 */}
+            <Screen
+                name='GoodsSpecification'
+                component={GoodsSpecificationScreen}
+                initialParams={{ goodsId: 562 }}
+            />
+        </>
+    );
+}

+ 72 - 17
screens/Guide1Screen.js

@@ -72,6 +72,8 @@ export default function Guide1Screen({ navigation }) {
     const [introduction, changeIntroduction] = React.useState();
     const [loadingSuccess, ChangeLoadingSuccess] = React.useState(false);
     const [defaultValue, ChangeDefaultValue] = React.useState("");
+    const [goodsSpecification, changeGoodsSpecification] = React.useState([]);
+    const [isIn, changeIn] = React.useState(false);
 
     const [img, changeImg] = React.useState();
     const timeValue = React.useMemo(() => {
@@ -85,28 +87,33 @@ export default function Guide1Screen({ navigation }) {
     useFocusEffect(
         React.useCallback(() => {
             changeBackground(theme["color-primary-500"]);
-            console.log(route.params);
-            if (route.params) {
-                if (route.params.id) {
-                    changeId(route.params.id);
+            let { params } = route;
+            if (params) {
+                if (params.id) {
+                    changeIn(false);
+                    changeId(params.id);
+                    httpGet("/goods/get/" + params.id).then(res => {
+                        getInfo(res);
+                        ChangeLoadingSuccess(true);
+                    });
+
+                    httpGet(
+                        "/goodsSpecification/byGoodsId",
+                        {
+                            goodsId: params.id,
+                        },
+                        true
+                    ).then(res => {
+                        changeGoodsSpecification(res);
+                    });
                 }
             } else {
                 ChangeLoadingSuccess(true);
+                getInfo({});
             }
         }, [])
     );
 
-    React.useEffect(() => {
-        if (id) {
-            httpGet("/goods/get/" + id).then(res => {
-                getInfo(res);
-                ChangeLoadingSuccess(true);
-            });
-        } else {
-            getInfo({});
-        }
-    }, [id]);
-
     function getInfo(res) {
         changeName(res.name || "");
         if (res.discountAmount) {
@@ -137,6 +144,19 @@ export default function Guide1Screen({ navigation }) {
         }
     }
 
+    const specify = () => {
+        return goodsSpecification.map(item => {
+            return (
+                <Layout key={item.id} style={styles.lay}>
+                    <Text category='c1'>添加{item.name}</Text>
+                    <Layout style={styles.money}>
+                        <Text category='c1'>¥{item.amount}</Text>
+                    </Layout>
+                </Layout>
+            );
+        });
+    };
+
     const canNext = React.useMemo(() => {
         if (
             name &&
@@ -208,6 +228,26 @@ export default function Guide1Screen({ navigation }) {
                             onChange={changeDiscountAmount}
                             textAlign='right'
                         />
+                        {id != 0 && (
+                            <>
+                                {/* 商品规格 */}
+                                <FormInput
+                                    label='商品规格'
+                                    type='url'
+                                    changePath={() => {
+                                        navigation.navigate(
+                                            "GoodsSpecification",
+                                            {
+                                                goodsId: id,
+                                            }
+                                        );
+                                    }}
+                                    textAlign='right'
+                                />
+                                {specify()}
+                            </>
+                        )}
+
                         {/* 每日供应数量 */}
                         <FormInput
                             label={guide1_form_4}
@@ -297,8 +337,15 @@ export default function Guide1Screen({ navigation }) {
                                             bodyText: removeTips,
                                             cancelable: true,
                                             confirmCallback: () => {
-                                                success("删除成功");
-                                                navigation.goBack();
+                                                httpPost(
+                                                    "/goods/del/" + id,
+                                                    {},
+                                                    {},
+                                                    true
+                                                ).then(res => {
+                                                    success("删除成功");
+                                                    navigation.goBack();
+                                                });
                                             },
                                         });
                                     }}
@@ -379,4 +426,12 @@ const styles = StyleSheet.create({
         paddingVertical: 10,
         height: 100,
     },
+    lay: {
+        flexDirection: "row",
+        marginLeft: 120,
+        marginBottom: 10,
+    },
+    money: {
+        marginLeft: 10,
+    },
 });

+ 6 - 5
screens/Guide2Screen.js

@@ -73,7 +73,7 @@ export default function Guide1Screen({ navigation }) {
     );
     React.useEffect(() => {
         if (selectInfos.length > 0) {
-            let _ids = selectInfos.map((item) => {
+            let _ids = selectInfos.map(item => {
                 return item.id;
             });
             changeGoodsIds(_ids.join(","));
@@ -98,7 +98,7 @@ export default function Guide1Screen({ navigation }) {
                 merchantId: mid,
             },
             { body: "json" }
-        ).then((res) => {});
+        ).then(res => {});
     };
 
     return (
@@ -152,9 +152,10 @@ export default function Guide1Screen({ navigation }) {
                                     status='primary'
                                     disabled={!canNext}
                                     onPress={() => {
-                                        addClass().then((_) => {
+                                        addClass().then(_ => {
                                             success("添加成功");
                                             RootNavigation.goBack();
+                                            changeSelect([]);
                                         });
                                     }}
                                 >
@@ -171,11 +172,11 @@ export default function Guide1Screen({ navigation }) {
                                     disabled={!canNext}
                                     onPress={() => {
                                         addClass()
-                                            .then((_) => {
+                                            .then(_ => {
                                                 success("添加成功");
                                                 changeGuideStep(3);
                                             })
-                                            .then((e) => {});
+                                            .then(e => {});
                                     }}
                                 >
                                     {next}

+ 7 - 6
screens/Guide3Screen.js

@@ -30,7 +30,10 @@ export default function Guide1Screen({ navigation, route }) {
     const theme = useTheme();
     const { changeBackground } = useModel("barModel");
     const { httpGet } = useModel("httpModel", true);
-    const { saveMerchant, guideStep, checkInfo } = useModel("userModel", true);
+    const { saveMerchant, guideStep, checkInfo, changeGuideStep } = useModel(
+        "userModel",
+        true
+    );
 
     const {
         guide3_title1,
@@ -54,14 +57,12 @@ export default function Guide1Screen({ navigation, route }) {
     );
 
     const canNext = React.useMemo(() => {
-        if(aliAccount&&aliName){
+        if (aliAccount && aliName) {
             return true;
-        }
-        else{
+        } else {
             return false;
         }
-      
-    }, [aliName,aliAccount]);
+    }, [aliName, aliAccount]);
 
     return (
         <>

+ 49 - 8
screens/HomeScreenPage1.js

@@ -25,6 +25,7 @@ import GoodsCardLarge from "../components/GoodsCard";
 import * as RootNavigation from "../navigation/RootNavigation.js";
 import ActionButton from "react-native-action-button";
 import EmptyComponent from "../components/EmptyComponent";
+import { ClassificationUtil } from "../Utils/SystemRuleUtil";
 
 const width = Dimensions.get("window").width;
 const height = Dimensions.get("window").height;
@@ -80,6 +81,14 @@ export default function HomePage1(props) {
         }
     }, [selectId]);
 
+    const selectClassInfo = React.useMemo(() => {
+        return (
+            classifications.find(item => {
+                return item.id == selectId;
+            }) || {}
+        );
+    }, [selectId, classifications]);
+
     const classificationItem = ({ item, index }) => (
         <ListItem
             appearance='classification'
@@ -95,6 +104,20 @@ export default function HomePage1(props) {
                     {item.name}
                 </Text>
             )}
+            accessoryRight={props => {
+                if (!item.isOpen) {
+                    return (
+                        <Icon
+                            fill='rgb(241, 90, 60)'
+                            {...props}
+                            style={[props.style, styles.hid]}
+                            name='power'
+                        />
+                    );
+                } else {
+                    return null;
+                }
+            }}
             onPress={() => {
                 changeSelectId(item.id);
             }}
@@ -205,7 +228,9 @@ export default function HomePage1(props) {
                                 style={styles.addClassificat}
                                 appearance='classification'
                                 onPress={() => {
-                                    RootNavigation.navigate("AddNewClass");
+                                    RootNavigation.navigate(
+                                        "ClassificationManage"
+                                    );
                                 }}
                             >
                                 编辑分类
@@ -224,13 +249,23 @@ export default function HomePage1(props) {
                                 status='danger'
                                 accessoryLeft={StarIcon}
                                 onPress={() => {
-                                    RootNavigation.navigate(
-                                        "AddClassification",
-                                        {
-                                            type: "classification",
-                                            classificationId: selectId,
-                                        }
-                                    );
+                                    if (
+                                        new ClassificationUtil(selectClassInfo).checkSystem()
+                                    ) {
+                                        RootNavigation.navigate(
+                                            "SystemClassificationEdit",
+                                            {
+                                                classifyId: selectId,
+                                            }
+                                        );
+                                    } else {
+                                        RootNavigation.navigate(
+                                            "ClassificationEdit",
+                                            {
+                                                classifyId: selectId,
+                                            }
+                                        );
+                                    }
                                 }}
                             />
                         )}
@@ -307,4 +342,10 @@ const styles = StyleSheet.create({
         color: "#FFC21C",
         fontWeight: "bold",
     },
+    hid: {
+        width: 10,
+        height: 10,
+        position: "absolute",
+        right: -10,
+    },
 });

+ 2 - 2
screens/HomeScreenPage3.js

@@ -30,6 +30,7 @@ import * as RootNavigation from "../navigation/RootNavigation.js";
 
 import OpenTimeUtil from "../Utils/OpenTimeUtil";
 import ListUtil from "../Utils/ListUtil";
+import ActionButton from "react-native-action-button";
 
 const Label = (props, title, value) => (
     <Layout style={[styles.lable]}>
@@ -178,7 +179,6 @@ export default function HomePage3(props) {
                     </Button>
                 </Layout>
             </Layout>
-
             <Menu style={styles.menu}>
                 <MenuItem
                     title={props =>
@@ -333,5 +333,5 @@ const styles = StyleSheet.create({
         marginHorizontal: 8,
         fontSize: 13,
     },
-    lableText: {},
+    lableText: {}
 });

+ 3 - 11
screens/LoginScreen.js

@@ -100,7 +100,7 @@ export default function LoginScreen({ navigation, route }) {
                 <View style={styles.tabContent}>
                     <TabView
                         selectedIndex={selectedIndex}
-                        onSelect={(index) => setSelectedIndex(index)}
+                        onSelect={index => setSelectedIndex(index)}
                         indicatorStyle={{ height: 0 }}
                     >
                         <Tab title={login_tab_1}>
@@ -177,17 +177,9 @@ export default function LoginScreen({ navigation, route }) {
                             disabled={!canLogin}
                             onPress={() => {
                                 if (selectedIndex === 0) {
-                                    loginByPassword(phone, password).then(
-                                        (_) => {
-                                            RootNavigation.replace(
-                                                "LoadingModel"
-                                            );
-                                        }
-                                    );
+                                    loginByPassword(phone, password);
                                 } else {
-                                    loginByCode(phone, code).then((_) => {
-                                        RootNavigation.replace("LoadingModel");
-                                    });
+                                    loginByCode(phone, code).then(_ => {});
                                 }
                             }}
                         >

+ 3 - 3
screens/RegisterSeScreen.js

@@ -54,11 +54,11 @@ export default function RegisterScreen({ navigation }) {
     useFocusEffect(
         React.useCallback(() => {
             changeBackground(theme["color-primary-500"]);
-            httpGet("/category/tree", { id: 1 }).then((res) => {
+            httpGet("/category/tree", { id: 1 }).then(res => {
                 changeCategoryList(res);
             });
 
-            httpGet("/merchantNature/all").then((res) => {
+            httpGet("/merchantNature/all").then(res => {
                 changeMerchantNatureList(res.content);
             });
         }, [])
@@ -66,7 +66,7 @@ export default function RegisterScreen({ navigation }) {
 
     React.useEffect(() => {
         console.log(registerInfo);
-        if (registerInfo.qualification) {
+        if (registerInfo && registerInfo.qualification) {
             changeQualification(registerInfo.qualification);
         }
     }, [registerInfo]);

+ 84 - 36
screens/Set/FirstOrderScreen.js

@@ -46,7 +46,8 @@ export default function FirstOrderScreen({ navigation, route }) {
         successText,
         removeTips,
     } = useModel("wordsModel");
-    const [money, changeMoney] = React.useState();
+    const [money, changeMoney] = React.useState("");
+    const [edit, changeEdit] = React.useState(false);
     useFocusEffect(
         React.useCallback(() => {
             changeBackground(theme["color-primary-500"]);
@@ -55,51 +56,98 @@ export default function FirstOrderScreen({ navigation, route }) {
 
     const { mid, firstOrder, updateMerchant } = useModel("userModel");
     React.useEffect(() => {
-        changeMoney(firstOrder || 0);
+        if (!firstOrder) {
+            changeEdit(true);
+        } else {
+            changeMoney(firstOrder.toString() || "");
+        }
     }, [firstOrder]);
 
     return (
         <>
-            <NavHeaderBar title="首单" />
-            <ScrollPage style={styles.lay}>
+            <NavHeaderBar title='首单' />
+            <ScrollPage
+                style={styles.lay}
+                enabledFresh={true}
+                refreshEvent={() => {
+                    return Promise.resolve();
+                }}
+            >
                 <Layout style={[styles.lay]}>
                     <Layout style={styles.item}>
                         <Layout style={[styles.text, styles.flexRow]}>
                             <Text category='c2'>新用户立减</Text>
-                            <Input
-                                size='small'
-                                style={styles.input}
-                                value={money}
-                                keyboardType='numeric'
-                                onChangeText={changeMoney}
-                            />
+                            {edit ? (
+                                <Input
+                                    size='small'
+                                    style={styles.input}
+                                    value={money}
+                                    keyboardType='numeric'
+                                    onChangeText={changeMoney}
+                                />
+                            ) : (
+                                <Text category='c2'>{money}</Text>
+                            )}
+
                             <Text category='c2'>元</Text>
                         </Layout>
-
-                        <Button
-                            size='small'
-                            onPress={() => {
-                                updateMerchant({ firstOrder: money }).then(
-                                    () => {
-                                        success("保存成功");
-                                    }
-                                );
-                            }}
-                        >
-                            {confirm}
-                        </Button>
-                        <Button
-                            size='small'
-                            appearance='outline'
-                            style={styles.buttonlast}
-                            onPress={() => {
-                                updateMerchant({ firstOrder: 0 }).then(() => {
-                                    success("取消成功");
-                                });
-                            }}
-                        >
-                            {cancel}
-                        </Button>
+                        {!edit ? (
+                            <>
+                                <Button
+                                    size='small'
+                                    appearance='outline'
+                                    onPress={() => {
+                                        changeEdit(true);
+                                    }}
+                                >
+                                    {editText}
+                                </Button>
+                                <Button
+                                    size='small'
+                                    appearance='outline'
+                                    style={styles.buttonlast}
+                                    onPress={() => {
+                                        changeEdit(false);
+                                    }}
+                                >
+                                    {cancel}
+                                </Button>
+                            </>
+                        ) : (
+                            <>
+                                <Button
+                                    size='small'
+                                    onPress={() => {
+                                        changeEdit(false);
+                                        updateMerchant({
+                                            firstOrder: money,
+                                        }).then(() => {
+                                            // success("保存成功");
+                                        });
+                                    }}
+                                >
+                                    保存
+                                </Button>
+                                {money != "" && (
+                                    <Button
+                                        size='small'
+                                        status='danger'
+                                        style={styles.buttonlast}
+                                        onPress={() => {
+                                            changeMoney("");
+                                            changeEdit(true);
+                                            updateMerchant({
+                                                firstOrder: 0,
+                                            }).then(() => {
+                                                // success("删除成功");
+                                            });
+                                        }}
+                                    >
+                                        {delText}
+                                    </Button>
+                                )}
+                            </>
+                        )}
                     </Layout>
                 </Layout>
             </ScrollPage>

+ 7 - 4
screens/Set/SystemClassificationEditScreen.js

@@ -52,15 +52,17 @@ export default function SystemClassificationEditScreen({ navigation }) {
     const [tips, setTipList] = React.useState([]);
     const [classifyInfo, setClass] = React.useState(new ClassificationUtil());
     const [delId, setDel] = React.useState(0);
+    const [isOpen, changeIsOpen] = React.useState(false);
 
     const checkEvent = isChecked => {
+        changeIsOpen(isChecked);
         if (!isChecked) {
             clossClassTip(() => {
                 saveInfo({
                     ...classifyInfo.allInfo,
                     isOpen: isChecked,
                 }).then(res => {
-                    getInfo();
+                    getInfo(classifyInfo.id);
                 });
             });
         } else {
@@ -68,7 +70,7 @@ export default function SystemClassificationEditScreen({ navigation }) {
                 ...classifyInfo.allInfo,
                 isOpen: isChecked,
             }).then(res => {
-                getInfo();
+                getInfo(classifyInfo.id);
             });
         }
     };
@@ -98,6 +100,7 @@ export default function SystemClassificationEditScreen({ navigation }) {
                 let classify = new ClassificationUtil(res);
                 setClass(classify);
                 setTipList(classify.getMenuTipsList());
+                changeIsOpen(res.isOpen);
             }
         );
     }
@@ -126,11 +129,11 @@ export default function SystemClassificationEditScreen({ navigation }) {
         _tips.push(
             <Toggle
                 key='Toggle'
-                checked={classifyInfo.isOpen}
+                checked={isOpen}
                 onChange={checkEvent}
                 style={styles.toggle}
             >
-                {classifyInfo.isOpen ? "开启" : "关闭"}
+                {isOpen ? "开启" : "关闭"}
             </Toggle>
         );
 

+ 24 - 6
screens/UserScreen.js

@@ -44,6 +44,8 @@ export default function UserScreen({ navigation }) {
         proclamation,
         updateMerchant,
         banner,
+        closeMer,
+        isOpen,
     } = useModel("userModel");
 
     const {
@@ -104,6 +106,9 @@ export default function UserScreen({ navigation }) {
                             <MenuItem
                                 title={userTitle22}
                                 accessoryRight={ForwardIcon}
+                                onPress={() => {
+                                    navigation.navigate("ClassificationManage");
+                                }}
                             />
                             <MenuItem
                                 title={userTitle23}
@@ -135,13 +140,13 @@ export default function UserScreen({ navigation }) {
                                     navigation.navigate("ClassificationManage");
                                 }}
                             />
-                            <MenuItem
+                            {/* <MenuItem
                                 title={userTitle33}
                                 accessoryRight={ForwardIcon}
                                 onPress={() => {
                                     navigation.navigate("ClassificationManage");
                                 }}
-                            />
+                            /> */}
                             <MenuItem
                                 title={userTitle34}
                                 accessoryRight={ForwardIcon}
@@ -155,14 +160,14 @@ export default function UserScreen({ navigation }) {
                                 title={userTitle41}
                                 accessoryRight={ForwardIcon}
                                 onPress={() => {
-                                    navigation.navigate("Complaintlist");
+                                    navigation.navigate("OrderSetting");
                                 }}
                             />
                             <MenuItem
                                 title={userTitle42}
                                 accessoryRight={ForwardIcon}
                                 onPress={() => {
-                                    navigation.navigate("Complaintlist");
+                                    navigation.navigate("OrderSetting");
                                 }}
                             />
                         </MenuGroup>
@@ -198,11 +203,21 @@ export default function UserScreen({ navigation }) {
                                 }}
                             />
                         </MenuGroup>
+
                         {/* <MenuGroup title='Akveo React Native'>
                             <MenuItem title='UI Kitten' />
                             <MenuItem title='Kitten Tricks' />
                         </MenuGroup> */}
                     </Menu>
+
+                    <Layout style={styles.loginOut}>
+                        <Button
+                            appearance={isOpen ? "outline" : "fill"}
+                            onPress={closeMer}
+                        >
+                            {isOpen ? "停止营业" : "开始营业"}
+                        </Button>
+                    </Layout>
                 </Layout>
             </ScrollPage>
         </>
@@ -222,8 +237,7 @@ const ForwardIcon = props => (
 
 const styles = StyleSheet.create({
     container: {
-        flexDirection: "row",
-        justifyContent: "space-between",
+
     },
     menu: {
         flex: 1,
@@ -237,4 +251,8 @@ const styles = StyleSheet.create({
     menuGroup2: {
         marginTop: 6,
     },
+    loginOut: {
+        paddingHorizontal: 20,
+        backgroundColor:"transparent"
+    },
 });

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio