|
|
|
@ -33,6 +33,7 @@ import useUserStore from "../store/user";
|
|
|
|
|
import { t } from "../i18n"; |
|
|
|
|
import { payApi } from "../services/api/payApi"; |
|
|
|
|
import IconComponent from "../components/IconComponent"; |
|
|
|
|
import {getSubjectTransLanguage,getAttributeTransLanguage} from "../utils/languageUtils"; |
|
|
|
|
|
|
|
|
|
export const CartScreen = () => { |
|
|
|
|
const [cartList, setCartList] = useState<GetCartList[]>([]); |
|
|
|
@ -705,8 +706,12 @@ export const CartScreen = () => {
|
|
|
|
|
style={styles.imageThumbnail} |
|
|
|
|
/> |
|
|
|
|
<View style={styles.productInfoContainer2}> |
|
|
|
|
<Text style={styles.casualTextSnippet}> |
|
|
|
|
{item.subject} |
|
|
|
|
<Text
|
|
|
|
|
style={styles.casualTextSnippet} |
|
|
|
|
numberOfLines={2} |
|
|
|
|
ellipsizeMode="tail" |
|
|
|
|
> |
|
|
|
|
{getSubjectTransLanguage(item)} |
|
|
|
|
</Text> |
|
|
|
|
<Text style={styles.productDetailsTextStyle1}> |
|
|
|
|
{t("cart.min_order")}: {item.min_order_quantity} |
|
|
|
@ -714,7 +719,8 @@ export const CartScreen = () => {
|
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
{item.skus.map((sku, index) => ( |
|
|
|
|
{item.skus.map((sku, index) => { |
|
|
|
|
return ( |
|
|
|
|
<Swipeable |
|
|
|
|
key={sku.cart_item_id} |
|
|
|
|
enabled={!!user_id} |
|
|
|
@ -726,13 +732,11 @@ export const CartScreen = () => {
|
|
|
|
|
alignItems: "center", |
|
|
|
|
width: 80, |
|
|
|
|
}} |
|
|
|
|
onPress={() => |
|
|
|
|
handleDeleteSku( |
|
|
|
|
onPress={() => handleDeleteSku( |
|
|
|
|
item.cart_id, |
|
|
|
|
sku.cart_item_id, |
|
|
|
|
item.cart_id |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
)} |
|
|
|
|
disabled={!user_id} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
@ -760,13 +764,11 @@ export const CartScreen = () => {
|
|
|
|
|
> |
|
|
|
|
<View style={styles.svgContainer1}> |
|
|
|
|
<TouchableOpacity |
|
|
|
|
onPress={() => |
|
|
|
|
user_id && toggleSelection( |
|
|
|
|
onPress={() => user_id && toggleSelection( |
|
|
|
|
String(sku.cart_item_id), |
|
|
|
|
index1, |
|
|
|
|
index |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
)} |
|
|
|
|
disabled={!user_id} |
|
|
|
|
> |
|
|
|
|
<View style={[styles.iconContainer]}> |
|
|
|
@ -785,8 +787,7 @@ export const CartScreen = () => {
|
|
|
|
|
? sku.attributes[0]?.sku_image_url |
|
|
|
|
: item.product_image, |
|
|
|
|
}} |
|
|
|
|
style={styles.productImageDisplayStyle} |
|
|
|
|
/> |
|
|
|
|
style={styles.productImageDisplayStyle} /> |
|
|
|
|
<View style={styles.productCardWidget1}> |
|
|
|
|
{/* 1. SKU attributes at the top */} |
|
|
|
|
{sku.attributes[0]?.value && ( |
|
|
|
@ -796,9 +797,9 @@ export const CartScreen = () => {
|
|
|
|
|
numberOfLines={2} |
|
|
|
|
ellipsizeMode="tail" |
|
|
|
|
> |
|
|
|
|
{sku.attributes[0]?.value}{" "} |
|
|
|
|
{getAttributeTransLanguage(sku.attributes[0])}{" "} |
|
|
|
|
{sku.attributes[1] ? "/" : ""}{" "} |
|
|
|
|
{sku.attributes[1]?.value} |
|
|
|
|
{sku.attributes[1] ? getAttributeTransLanguage(sku.attributes[1]) : ""} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
)} |
|
|
|
@ -816,8 +817,7 @@ export const CartScreen = () => {
|
|
|
|
|
<View style={styles.vipContainer}> |
|
|
|
|
<Image |
|
|
|
|
source={require("../../assets/img/折扣VIP1 (1).png")} |
|
|
|
|
style={styles.VipImg} |
|
|
|
|
/> |
|
|
|
|
style={styles.VipImg} /> |
|
|
|
|
<Text style={styles.discountPercentageTextStyle}> |
|
|
|
|
-{((1 - vip_discount) * 100).toFixed(0)}% |
|
|
|
|
</Text> |
|
|
|
@ -842,14 +842,12 @@ export const CartScreen = () => {
|
|
|
|
|
styles.svgContainer4, |
|
|
|
|
{ borderRightWidth: 0 }, |
|
|
|
|
]} |
|
|
|
|
onPress={() => |
|
|
|
|
user_id && handleDecreaseQuantity( |
|
|
|
|
onPress={() => user_id && handleDecreaseQuantity( |
|
|
|
|
item.cart_id, |
|
|
|
|
sku.cart_item_id, |
|
|
|
|
sku.quantity, |
|
|
|
|
item.min_order_quantity |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
)} |
|
|
|
|
disabled={!user_id} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
@ -864,13 +862,11 @@ export const CartScreen = () => {
|
|
|
|
|
</TouchableOpacity> |
|
|
|
|
<TouchableOpacity |
|
|
|
|
style={styles.quantityLabelContainer} |
|
|
|
|
onPress={() => |
|
|
|
|
user_id && handleQuantityPress( |
|
|
|
|
onPress={() => user_id && handleQuantityPress( |
|
|
|
|
item.cart_id, |
|
|
|
|
sku.cart_item_id, |
|
|
|
|
sku.quantity |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
)} |
|
|
|
|
disabled={!user_id} |
|
|
|
|
> |
|
|
|
|
<Text style={styles.quantityText}> |
|
|
|
@ -882,13 +878,11 @@ export const CartScreen = () => {
|
|
|
|
|
styles.svgContainer4, |
|
|
|
|
{ borderLeftWidth: 0, marginLeft: 0 }, |
|
|
|
|
]} |
|
|
|
|
onPress={() => |
|
|
|
|
user_id && handleIncreaseQuantity( |
|
|
|
|
onPress={() => user_id && handleIncreaseQuantity( |
|
|
|
|
item.cart_id, |
|
|
|
|
sku.cart_item_id, |
|
|
|
|
sku.quantity |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
)} |
|
|
|
|
disabled={!user_id} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
@ -906,7 +900,8 @@ export const CartScreen = () => {
|
|
|
|
|
</View> |
|
|
|
|
</TouchableOpacity> |
|
|
|
|
</Swipeable> |
|
|
|
|
))} |
|
|
|
|
); |
|
|
|
|
})} |
|
|
|
|
</View> |
|
|
|
|
))} |
|
|
|
|
|
|
|
|
|