|
|
|
@ -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, |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|