update 8 files

master
Reza_ashrafi 3 years ago
parent c10d14f827
commit b96f686440
  1. 1
      src/redux/actions/userProduct.js
  2. 1
      src/redux/reducers/config.js
  3. 22
      src/screens/Address/index.js
  4. 51
      src/screens/DeliveryForm/Address/index.js
  5. 4
      src/screens/DeliveryForm/TransportMethod/index.js
  6. 136
      src/screens/DeliveryForm/index.js
  7. 18
      src/screens/ShoppingCart/index.js

@ -24,7 +24,6 @@ const userProduct = {
(data = {}, data2 = {}, data3 = {}) =>
async (dispatch) => {
await proxy.post("userProduct/add", data, { dispatch });
await proxy.get("userFactor/info", data3, { dispatch });
},
del:
(data = {}, data2 = {}) =>

@ -16,7 +16,6 @@ export default function config(state = initialState, action) {
error: null,
};
case "config/availableForSell":
console.log(data);
return {
...state,
loading: false,

@ -553,17 +553,30 @@ const Address = ({
</View>
{!profilePage ? (
<>
<View style={{ width: "100%", height: 250, marginTop: 20}}>
<View
style={{
width: "100%",
height: height / 4,
marginTop: 20,
borderWidth: 1,
borderRadius: 2,
overflow: "hidden",
borderColor:
theme === "light"
? Colors.theme1.gray2077 + "66"
: Colors.theme1.grayE3,
}}
>
<MapSelector
setAddress={(address) => setMapAddress(address)}
/>
</View>
<TextInput
style={[
tw("w-full mt-4 py-4 px-2 rounded-md h-40"),
tw("w-full mt-4 py-4 px-2 rounded-sm h-40"),
{
backgroundColor:
theme === "light" ? Colors.theme1.grayF9 : null,
theme === "light" ? Colors.theme1.white : null,
color:
theme === "light"
? Colors.theme1.gray20
@ -572,10 +585,9 @@ const Address = ({
textAlign: "right",
fontFamily: "light",
borderWidth: 1,
borderColor:
theme === "light"
? Colors.theme1.grayE3
? Colors.theme1.gray2077 + "66"
: Colors.theme1.white + "55",
},
]}

@ -8,7 +8,7 @@ import {
} from "react-native";
import React from "react";
import { connect } from "react-redux";
import {asyncAwesomeAlert} from "../../../utils/AsyncWrappers";
import { asyncAwesomeAlert } from "../../../utils/AsyncWrappers";
import { Ionicons, Entypo } from "@expo/vector-icons";
import { useNavigation } from "@react-navigation/native";
import { userFactor, userAddress } from "../../../redux/actions";
@ -59,7 +59,7 @@ const Address = ({
borderColor: active ? Colors.theme1.greenCF : Colors.theme1.grayE3,
},
tw(
`flex flex-row-reverse items-center w-full px-3 rounded-sm mt-2 ${
`flex flex-row-reverse items-center w-full px-3 rounded-sm mt-2 mb-4 ${
mobile ? "py-3.5" : "py-4"
}`
),
@ -134,7 +134,7 @@ const Address = ({
onConfirm: () => deleteItem({ id: address?.id }),
})
}
style={tw('h-full')}
style={tw("h-full")}
>
<Ionicons
name="trash-bin"
@ -156,26 +156,29 @@ const Address = ({
return (
<View style={tw("w-full mt-2")}>
{addresses?.length ? (
<Text
style={{
fontSize: mobile ? fontSize.base : fontSize.base,
fontFamily: "bold",
color: light ? Colors.theme1.green79 : Colors.theme1.white,
textAlign: ios ? "right" : "auto",
}}
>
لطفا آدرس مورد نظر را انتخاب کنید.
</Text>
<React.Fragment>
<Text
style={{
fontSize: mobile ? fontSize.base : fontSize.base,
fontFamily: "bold",
color: light ? Colors.theme1.green79 : Colors.theme1.white,
textAlign: ios ? "right" : "auto",
}}
>
لطفا آدرس مورد نظر را انتخاب کنید.
</Text>
<View style={tw("p-0 mt-2 flex")}>
{addresses?.map((address, index) => (
<Location
address={address}
key={index}
active={userAddressId === address?.id}
/>
))}
</View>
</React.Fragment>
) : null}
<View style={tw("p-0 mt-2 flex")}>
{addresses?.map((address, index) => (
<Location
address={address}
key={index}
active={userAddressId === address?.id}
/>
))}
</View>
<TouchableOpacity
style={[
{
@ -186,7 +189,7 @@ const Address = ({
borderWidth: 1.5,
},
tw(
`flex flex-row-reverse justify-center py-3 rounded-sm items-center w-full mt-4`
`flex flex-row-reverse justify-center py-3 rounded-sm items-center w-full`
),
]}
onPress={() => navigation.push("CreateAddress")}
@ -224,7 +227,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = {
update: userFactor.update,
deleteItem: userAddress.update
deleteItem: userAddress.update,
};
export default connect(mapStateToProps, mapDispatchToProps)(Address);

@ -139,7 +139,7 @@ const TransportMethod = ({
[factorInfo, loading]
);
return (
return factorInfo?.transports?.length ? (
<View style={tw(`w-full ${mobile ? "mt-4" : "mt-4"}`)}>
<Text
style={{
@ -161,7 +161,7 @@ const TransportMethod = ({
))}
</View>
</View>
);
) : null;
};
const mapStateToProps = (state) => ({

@ -6,11 +6,13 @@ import {
StatusBar,
Platform,
Dimensions,
Text
} from "react-native";
import React, { useEffect } from "react";
import { connect } from "react-redux";
import { userFactor, userAddress } from "../../redux/actions";
import { asyncAwesomeAlert } from "../../utils/AsyncWrappers";
import separate from "../../utils/separate";
//components
import Navbar from "../../components/Navbar";
@ -23,9 +25,65 @@ import CustomPressable from "../../components/Pressable";
//style
import tw from "tailwind-rn";
import Colors from "../../constants/Colors";
import fontSize from "../../constants/fontSize";
const { height } = Dimensions.get("window");
const PriceStatus = ({ name, value, type, theme }) => {
return (
<View style={tw("w-full flex flex-row-reverse justify-between py-2")}>
<Text
style={[
tw(""),
{
fontSize: fontSize.tiny,
color:
theme === "light" ? Colors.theme1.gray20 : Colors.theme1.white,
fontFamily: "bold",
},
]}
>
{name}
</Text>
<View style={tw("flex flex-row-reverse items-center")}>
<Text
style={[
{
color:
type === "error"
? Colors.theme1.redFF1
: theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: fontSize.xl,
fontFamily: "bold",
},
]}
>
{value}
</Text>
<Text
style={[
{
color:
type === "error"
? Colors.theme1.redFF1
: theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: fontSize.sm,
fontFamily: "regular",
marginRight: 4,
},
]}
>
تومان
</Text>
</View>
</View>
);
};
const DeliveryForm = ({
list,
form,
@ -85,6 +143,83 @@ const DeliveryForm = ({
<TransportDate transportDate={form?.transportDate} />
</View>
) : null}
<View
style={tw(
`flex w-full border-t py-2 border-gray-300 border-b mt-6 ${
theme === "light" ? "" : "border-opacity-20"
}`
)}
>
<PriceStatus
name="مبلغ سبد خرید"
value={separate(Math.round(factorInfo?.sumPrice || 0))}
type="normal"
theme={theme}
/>
<PriceStatus
name="هزینه ارسال"
value={separate(Math.round(list?.length ? factorInfo?.transportPrice : 0))}
type="error"
theme={theme}
/>
<PriceStatus
name="میزان تخفیف"
value={separate(Math.round(factorInfo?.offPrice || 0))}
type="error"
theme={theme}
/>
</View>
<View
style={tw(
"flex flex-row-reverse justify-between items-center w-full py-3"
)}
>
<Text
style={[
{
color:
theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: fontSize.base,
fontFamily: "bold",
},
]}
>
جمع کل سبد خرید
</Text>
<View style={tw("flex flex-row-reverse items-center")}>
<Text
style={[
{
color:
theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: fontSize.xl,
fontFamily: "bold",
},
]}
>
{separate(factorInfo?.payPrice)}
</Text>
<Text
style={[
{
color:
theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
fontSize: fontSize.sm,
fontFamily: "regular",
marginRight: 4,
},
]}
>
تومان
</Text>
</View>
</View>
</View>
</ScrollView>
<View style={tw("w-full pt-4")}>
@ -114,7 +249,6 @@ const styles = StyleSheet.create({
},
container: {
paddingVertical: 5,
},
});

@ -114,6 +114,10 @@ function ShoppingCart({
);
}, [list]);
useEffect(() => {
getFactorInfo({ userId });
}, [list]);
useEffect(() => {
getList();
getFactorInfo({ userId });
@ -174,6 +178,7 @@ function ShoppingCart({
type="normal"
theme={theme}
/>
<PriceStatus
name="میزان تخفیف"
value={
@ -182,16 +187,7 @@ function ShoppingCart({
type="error"
theme={theme}
/>
<PriceStatus
name="مالیات بر ارزش افزوده"
value={
isEmpty
? 0
: separate(Math.round((factorInfo?.sumPrice || 0) * 0.009))
}
type="error"
theme={theme}
/>
</View>
<View
style={tw(
@ -225,7 +221,7 @@ function ShoppingCart({
},
]}
>
{isEmpty ? 0 : separate(factorInfo?.payPrice || "")}
{isEmpty ? 0 : separate(factorInfo?.payPrice - factorInfo?.transportPrice)}
</Text>
<Text
style={[

Loading…
Cancel
Save