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

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

@@ -7,6 +7,7 @@ if (process.env.NODE_ENV === 'development') {
} else if (process.env.NODE_ENV === 'production') { } else if (process.env.NODE_ENV === 'production') {
//baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川 //baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
baseUrl = "https://api.nuttyreading.com/"; //线上正式 baseUrl = "https://api.nuttyreading.com/"; //线上正式
//baseUrl = "https://testapi.nuttyreading.com/"; //线上正式
} }
const courtConfig = { const courtConfig = {
//微信公众号APPID //微信公众号APPID

View File

@@ -2,8 +2,8 @@
"name" : "心灵空间", "name" : "心灵空间",
"appid" : "__UNI__BBBDFD2", "appid" : "__UNI__BBBDFD2",
"description" : "心灵空间", "description" : "心灵空间",
"versionName" : "1.0.32", "versionName" : "1.0.33",
"versionCode" : 1032, "versionCode" : 1033,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@@ -533,7 +533,7 @@
.section_content_progress { .section_content_progress {
background: initial; background: initial;
padding: 0 15rpx; padding: 0 20rpx;
} }
.content_result { .content_result {

View File

@@ -1123,21 +1123,14 @@
}, },
]; ];
} }
if ( if (this.goodsDataList.some(item => item.activityPrice && item.activityPrice > 0)) {
this.goodsDataList[0].activityPrice &&
this.goodsDataList[0].activityPrice > 0
) {
this.priceBreakdownList.push({ this.priceBreakdownList.push({
text: "活动立减", text: "活动立减",
imgUrl: "", imgUrl: "",
type: 5, type: 5,
}); });
} }
if ( if (this.goodsDataList.some(item => item.isVipPrice==1 && item.vipPrice && item.vipPrice > 0)) {
this.goodsDataList[0].isVipPrice &&
this.goodsDataList[0].vipPrice &&
this.goodsDataList[0].vipPrice > 0
) {
this.priceBreakdownList.push({ this.priceBreakdownList.push({
text: "VIP专享立减", text: "VIP专享立减",
imgUrl: "", imgUrl: "",

View File

@@ -170,6 +170,73 @@
</view> </view>
</view> </view>
</view> </view>
<view class="linkPro" v-if="tjProList.length > 0">
<uni-section style="padding: 0 20rpx;" class="mb-10 graybg" title="相关书籍" type="line"></uni-section>
<view class="list supermarketBox">
<scroll-view class="scroll-view_H" scroll-x="true">
<view class="item" v-for="(item, index) in tjProList" :key="index" @click="goToGoodsList(item)">
<view class="imgcontainer" style="position: relative;">
<view v-if="item.isVipPrice==1&&item.vipPrice!=0&&item.vipPrice!=null"
style="z-index:10;position: absolute;top:0;left:0;text-align: center;font-size: 20rpx;background-color: #f94f04;color: #fff;font-weight: bold;border-radius:4px; line-height: 30rpx; padding:10rpx;box-sizing: border-box;">
VIP优惠</view>
<image :src="item.productImages" mode="aspectFit"></image>
</view>
<view class="name">
{{ item.productName }}
</view>
<text
class="price"
v-if="
item.isVipPrice == 1 &&
item.vipPrice != 0 &&
item.vipPrice != null
"
>
<text
style="color: #e97512; font-size: 12px; font-weight: bold"
>¥{{ item.vipPrice.toFixed(2) }}</text
>
<text
style="
color: #8a8a8a;
font-size: 10px;
margin-left: 4px;
font-weight: bold;
text-decoration: line-through;
"
>¥{{ Number(item.price) }}</text
>
</text>
<text
v-else-if="item.activityPrice && item.activityPrice > 0"
class="price"
>
<text
style="color: #e97512; font-size: 12px; font-weight: bold"
>¥{{ item.activityPrice }}</text
>
<text
style="
color: #8a8a8a;
font-size: 10px;
margin-left: 4px;
font-weight: bold;
text-decoration: line-through;
"
>¥{{ Number(item.price)}}</text
>
</text>
<text v-else class="price" style="color: #e97512 !important;"
>¥{{ Number(item.price) }}</text
>
</view>
</scroll-view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@@ -297,6 +364,7 @@
fuduId: null, fuduId: null,
showNewPayBtn: [], //复读状态 showNewPayBtn: [], //复读状态
newPaymentProList: [], //复读列表数据 newPaymentProList: [], //复读列表数据
tjProList: [], //相关书籍
}; };
}, },
onLoad(options) { onLoad(options) {
@@ -677,6 +745,15 @@
}; };
} }
if (
res.data.shopProductList &&
res.data.shopProductList.length > 0
) {
this.tjProList = res.data.shopProductList;
} else {
this.tjProList = [];
}
//获取的数据解析 //获取的数据解析
that.removeImagesFromHTML(); that.removeImagesFromHTML();
@@ -686,6 +763,16 @@
that.$forceUpdate(); that.$forceUpdate();
}); });
}, },
//相关书籍跳转
goToGoodsList(data) {
if (data.delFlag == -1) {
this.$commonJS.showToast("商品已下架");
} else {
uni.navigateTo({
url: `/pages/goods/index?isMiaosha=1&id=${data.productId}`,
});
}
},
}, },
onBackPress() { onBackPress() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
@@ -709,12 +796,6 @@
} }
} }
.scroll-view_H {
background-color: #fff;
white-space: nowrap;
padding: 10rpx;
}
.contentBox { .contentBox {
height: calc(100% - 50px); height: calc(100% - 50px);
@@ -1492,4 +1573,59 @@
max-height: 48px; max-height: 48px;
height: auto; height: auto;
} }
.linkPro {
margin-top: 10rpx;
.more {
font-size: 24rpx;
color: #666;
}
.supermarketBox{
background: #fff;
border-radius: 4px;
box-shadow: 0px 0px 10px 0px #a7bbe4;
}
}
.scroll-view_H {
white-space: nowrap;
padding: 20rpx 10rpx;
margin-top: 12rpx;
.item {
padding: 10rpx;
overflow: hidden;
display: inline-block;
padding-bottom: 0;
width: 210rpx !important;
margin-right: 8rpx;
border-radius: 10rpx;
image {
display: block;
width: 100%;
height: 260rpx;
}
.name {
display: block;
margin-top: 2rpx;
color: #666;
font-size: 28rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
/deep/.uni-section-header__decoration{
width: 14px;
height: 34px;
}
/deep/.distraction{
font-size: 32rpx !important;
color: #294a97 !important;
font-weight: bold;
}
</style> </style>

View File

@@ -1002,7 +1002,7 @@ export default {
this.$commonJS.showToast("商品已下架"); this.$commonJS.showToast("商品已下架");
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: `/pages/goods/index?id=${id}`, url: `/pages/goods/index?isMiaosha=1&id=${id}`,
}); });
} }
}, },

View File

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

View File

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

View File

@@ -9,7 +9,7 @@
</view> </view>
<view class="cartContent" style="position: relative;"> <view class="cartContent" style="position: relative;">
<span v-if="item.isVipPrice==1&&item.vipPrice!=0&&item.vipPrice!=null" <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> <image :src="item.image" mode="" @click="goDetail(item.productId)"></image>
<view class="itemCenter"> <view class="itemCenter">
@@ -236,6 +236,8 @@
productName: item.productName, productName: item.productName,
goodsType: item.goodsType, goodsType: item.goodsType,
productAmount: item.productAmount, productAmount: item.productAmount,
price: item.price,
activityPrice: item.activityPrice,
}) })
} }
}) })
@@ -326,6 +328,7 @@
justify-content: space-between; justify-content: space-between;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: 9;
.selectAll { .selectAll {

View File

@@ -3,7 +3,7 @@ $uni-space-root: 2;
// 边框半径默认值 // 边框半径默认值
$uni-radius-root:5px; $uni-radius-root:5px;
// 主色 // 主色
$uni-primary: #2979ff; $uni-primary: #294a97;
// 辅助色 // 辅助色
$uni-success: #4cd964; $uni-success: #4cd964;
// 警告色 // 警告色

View File

@@ -100,7 +100,7 @@
} }
</script> </script>
<style lang="scss" > <style lang="scss" >
$uni-primary: #2979ff !default; $uni-primary: #294a97 !default;
.uni-section { .uni-section {
background-color: #fff; background-color: #fff;

View File

@@ -4,7 +4,7 @@ export default {
activeStyle: { activeStyle: {
type: [String, Object], type: [String, Object],
default: () => ({ default: () => ({
color: '#2979ff', color: '#294a97',
fontSize: '14px' fontSize: '14px'
}) })
}, },

View File

@@ -15,7 +15,7 @@ export default {
min: 0, min: 0,
max: 100, max: 100,
step: 1, step: 1,
activeColor: '#2979ff', activeColor: '#294a97',
inactiveColor: '#c0c4cc', inactiveColor: '#c0c4cc',
blockColor: '#ffffff', blockColor: '#ffffff',
showValue: false, showValue: false,

View File

@@ -13,7 +13,7 @@ export default {
loading: false, loading: false,
disabled: false, disabled: false,
size: 25, size: 25,
activeColor: '#2979ff', activeColor: '#294a97',
inactiveColor: '#ffffff', inactiveColor: '#ffffff',
value: false, value: false,
activeValue: true, activeValue: true,