购物车功能,手机号码兼容台湾香港

This commit is contained in:
liuyuan
2025-07-08 14:19:59 +08:00
parent 249b4b93f6
commit 334b857b39
14 changed files with 175 additions and 81 deletions

View File

@@ -454,7 +454,7 @@
this.$refs.commonSelectGoods.open();
},
//点击下单按钮
onHandleClickBuy() {
onHandleClickBuy(e) {
if(this.buttonType==0){ //如果是加入购物车
console.log('剩余', this.selectGoodsData.productStock)
if(this.selectGoodsData.productStock==0){
@@ -476,7 +476,10 @@
productImages: this.selectGoodsData.productImages,
productId: this.selectGoodsData.productId,
productName: this.selectGoodsData.productName,
activityPrice: this.selectGoodsData.activityPrice,
price: this.selectGoodsData.price,
goodsType: this.selectGoodsData.goodsType,
productAmount: 1,
}],
typeId: 0
});

View File

@@ -32,41 +32,18 @@
</template>
<template slot="goodsInfoImgSlot" slot-scope="slotProps">
<image
v-if="pageType == 'vip'"
src="/static/icon/vip.png"
class="goods_item_img"
mode="widthFix"
@click="goDetail(slotProps.row.productId)"
></image>
<image
v-else-if="
(pageType == 'goods' || pageType == 'fudu') &&
slotProps.row.productImages &&
slotProps.row.productImages != ''
"
v-if="slotProps.row.productImages && slotProps.row.productImages != ''"
class="goods_item_img"
:src="slotProps.row.productImages"
mode="aspectFit"
>
</image>
<image
v-else
src="/static/nobg1.jpg"
class="goods_item_img"
mode="widthFix"
@click="goDetail(slotProps.row.productId)"
></image>
</template>
<template slot="goodsInfoNameSlot" slot-scope="slotProps">
<span v-if="pageType == 'vip'"
>{{ slotProps.row.title
}}<span style="margin-left: 4rpx"
>{{ slotProps.row.year }}年</span
></span
>
<span v-else>{{ slotProps.row.productName }}</span>
<span>{{ slotProps.row.productName }}</span>
</template>
<template slot="goodsInfoPriceSlot" slot-scope="slotProps">
<text
v-if="
@@ -75,12 +52,8 @@
slotProps.row.vipPrice != null
"
>
<text style="color: #e97512; font-size: 28rpx; font-weight: bold"
>¥{{ slotProps.row.vipPrice.toFixed(2) }}</text
>
<text style="color: #fa2d12; font-size: 24rpx; margin-left: 4px"
>VIP到手价</text
>
<text style="color: #e97512; font-size: 28rpx; font-weight: bold">¥{{ slotProps.row.vipPrice.toFixed(2) }}</text>
<text style="color: #fa2d12; font-size: 24rpx; margin-left: 4px">VIP到手价</text>
<text
style="
color: #8a8a8a;
@@ -93,17 +66,11 @@
>
</text>
<text
v-else-if="
slotProps.row.activityPrice && slotProps.row.activityPrice > 0
"
>
<text style="color: #e97512; font-size: 28rpx; font-weight: bold"
>¥{{ slotProps.row.activityPrice.toFixed(2) }}</text
>
<text style="color: #613804; font-size: 24rpx; margin-left: 4px"
>活动价</text
>
<text v-else-if="slotProps.row.activityPrice && slotProps.row.activityPrice > 0">
<text style="color: #e97512; font-size: 28rpx; font-weight: bold">
¥{{ slotProps.row.activityPrice.toFixed(2) }}
</text>
<text style="color: #613804; font-size: 24rpx; margin-left: 4px">活动价</text>
<text
style="
color: #8a8a8a;
@@ -112,13 +79,10 @@
font-weight: bold;
text-decoration: line-through;
"
>¥{{ Number(slotProps.row.price).toFixed(2) }}</text
>
>¥{{ Number(slotProps.row.price).toFixed(2) }}</text>
</text>
<text v-else style="font-size: 28rpx"
>¥{{ Number(slotProps.row.price).toFixed(2) }}</text
>
<text v-else style="font-size: 28rpx">¥{{ Number(slotProps.row.price).toFixed(2) }}</text>
</template>
</common-order-submit>
</view>
@@ -164,13 +128,10 @@ export default {
//复读订单
this.pageType = "fudu";
this.showNumber = true;
await this.getFuduDataInfo();
} else {
//普通
this.pageType = "goods";
await this.getGoodsDataInfo();
}
@@ -283,7 +244,6 @@ export default {
this.goodsDataList = res.productList.filter(
(e) => this.options.goods[0].productName == e.productName
);
});
},
@@ -333,8 +293,6 @@ export default {
});
this.goodsDataList = res.shopProductList;
console.log('data-data', this.goodsDataList)
});
},
},

View File

@@ -9,7 +9,7 @@
</view>
<view class="cartContent" style="position: relative;">
<span v-if="item.isVipPrice==1&&item.vipPrice!=0&&item.vipPrice!=null"
style="position: absolute;z-index: 10;top: 4px;left: 0px; text-align: center;font-size: 18rpx;background-color: #f94f04;color: #fff; border-radius:4px; padding:2px 4px;line-height: 14px;">VIP优惠</span>
style="position: absolute;z-index: 1;top: 4px;left: 0px; text-align: center;font-size: 18rpx;background-color: #f94f04;color: #fff; border-radius:4px; padding:2px 4px;line-height: 14px;">VIP优惠</span>
<image :src="item.image" mode="" @click="goDetail(item.productId)"></image>
<view class="itemCenter">
@@ -236,6 +236,8 @@
productName: item.productName,
goodsType: item.goodsType,
productAmount: item.productAmount,
price: item.price,
activityPrice: item.activityPrice,
})
}
})
@@ -326,6 +328,7 @@
justify-content: space-between;
position: fixed;
bottom: 0;
z-index: 9;
.selectAll {