diff --git a/manifest.json b/manifest.json index 4732b6d3..ac575dbe 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "appid": "__UNI__460BC4C", "description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。", "versionName": "2.1.0", - "versionCode": 183, + "versionCode": "183", "transformPx": false, "app-plus": { "usingComponents": true, @@ -188,7 +188,8 @@ "setting": { "urlCheck": false, "minified": true, - "postcss": true + "postcss": false, + "es6": false }, "optimization": { "subPackages": true @@ -236,4 +237,4 @@ "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639", "locale": "zh-Hans", "fallbackLocale": "zh-Hans" -} +} \ No newline at end of file diff --git a/pages/goods/groupon.vue b/pages/goods/groupon.vue index 503d9c98..9c9669c2 100644 --- a/pages/goods/groupon.vue +++ b/pages/goods/groupon.vue @@ -90,7 +90,7 @@ {{ - fen2yuan(state.selectedSku.price * state.selectedSku.count || state.activity.price * state.selectedSku.count || state.goodsInfo.price * state.selectedSku.count || state.goodsInfo.price) + fen2yuan( + state.selectedSku.price * state.selectedSku.count || + state.activity.price * state.selectedSku.count || + state.goodsInfo.price * state.selectedSku.count || + state.goodsInfo.price, + ) }} 未开始 已结束 @@ -263,10 +268,12 @@ // 加载商品信息 const { data: spu } = await SpuApi.getSpuDetail(activity.spuId); state.goodsId = spu.id; + // 默认显示最低价 - activity.products.forEach((product) => { - state.activity.price = Math.min(spu.price, product.combinationPrice); // 设置 SPU 的最低价格 - }); + spu.price = activity.products.reduce((min, product) => { + return Math.min(min, product.combinationPrice || Infinity); + }, Infinity); + // 价格、库存使用活动的 spu.skus.forEach((sku) => { const product = activity.products.find((product) => product.skuId === sku.id); diff --git a/pages/user/goods_details_store/index.vue b/pages/user/goods_details_store/index.vue index 07b68508..3df0435d 100644 --- a/pages/user/goods_details_store/index.vue +++ b/pages/user/goods_details_store/index.vue @@ -1,7 +1,12 @@ @@ -297,35 +297,34 @@ * 商品卡片 * * @property {Array} size = [xs | sm | md | lg | sl ] - 列表数据 - * @property {String} tag - md及以上才有 - * @property {String} img - 图片 - * @property {String} background - 背景色 - * @property {String} topRadius - 上圆角 - * @property {String} bottomRadius - 下圆角 - * @property {String} title - 标题 - * @property {String} titleColor - 标题颜色 + * @property {String} tag - md及以上才有 + * @property {String} img - 图片 + * @property {String} background - 背景色 + * @property {String} topRadius - 上圆角 + * @property {String} bottomRadius - 下圆角 + * @property {String} title - 标题 + * @property {String} titleColor - 标题颜色 * @property {Number} titleWidth = 0 - 标题宽度,默认0,单位rpx - * @property {String} subTitle - 副标题 - * @property {String} subTitleColor - 副标题颜色 - * @property {String} subTitleBackground - 副标题背景 - * @property {String | Number} price - 价格 - * @property {String} priceColor - 价格颜色 - * @property {String | Number} originPrice - 原价/划线价 - * @property {String} originPriceColor - 原价颜色 - * @property {String | Number} sales - 销售数量 - * @property {String} salesColor - 销售数量颜色 + * @property {String} subTitle - 副标题 + * @property {String} subTitleColor - 副标题颜色 + * @property {String} subTitleBackground - 副标题背景 + * @property {String | Number} price - 价格 + * @property {String} priceColor - 价格颜色 + * @property {String | Number} originPrice - 原价/划线价 + * @property {String} originPriceColor - 原价颜色 + * @property {String | Number} sales - 销售数量 + * @property {String} salesColor - 销售数量颜色 * * @slots activity - 活动插槽 * @slots cart - 购物车插槽,默认包含文字,背景色,文字颜色 || 图片 || 行为 * - * @event {Function()} click - 点击卡片 + * @event {Function()} click - 点击卡片 * */ import { computed, reactive, getCurrentInstance, onMounted, nextTick } from 'vue'; import sheep from '@/sheep'; import { fen2yuan, formatSales } from '@/sheep/hooks/useGoods'; import { formatStock } from '@/sheep/hooks/useGoods'; - import goodsCollectVue from '@/pages/user/goods-collect.vue'; import { isArray } from 'lodash-es'; // 数据 @@ -354,11 +353,11 @@ }, tagStyle: { type: Object, - default: {}, + default: () => ({}), }, data: { type: Object, - default: {}, + default: () => ({}), }, size: { type: String, @@ -451,6 +450,7 @@ // 获取卡片实时高度 const { proxy } = getCurrentInstance(); const elId = `sheep_${Math.ceil(Math.random() * 10e5).toString(36)}`; + function getGoodsPriceCardWH() { if (props.size === 'md') { const view = uni.createSelectorQuery().in(proxy); @@ -469,6 +469,7 @@ }); } } + onMounted(() => { nextTick(() => { getGoodsPriceCardWH(); @@ -482,11 +483,13 @@ left: 0; top: 0; z-index: 2; + .tag-icon { width: 72rpx; height: 44rpx; } } + .seckill-tag { position: absolute; left: 0; @@ -501,6 +504,7 @@ color: #ffffff; line-height: 32rpx; } + .groupon-tag { position: absolute; left: 0; @@ -515,14 +519,17 @@ color: #ffffff; line-height: 32rpx; } + .goods-img { width: 100%; height: 100%; background-color: #f5f5f5; } + .price-unit { margin-right: -4px; } + .sales-text { display: table; font-size: 24rpx; @@ -586,10 +593,12 @@ width: 100%; height: 208rpx; } + .sm-goods-content { padding: 20rpx 16rpx; box-sizing: border-box; } + .sm-goods-title { font-size: 26rpx; color: #333; @@ -619,6 +628,7 @@ color: #333; width: 100%; } + .md-goods-subtitle { font-size: 24rpx; font-weight: 400; @@ -669,6 +679,7 @@ // line-height: 36rpx; // width: 410rpx; } + .lg-goods-subtitle { font-size: 24rpx; font-weight: 400; @@ -695,6 +706,7 @@ font-size: 24rpx; color: #ffffff; } + .tag-box { width: 100%; } @@ -708,10 +720,12 @@ z-index: 1; width: 100%; background-color: $white; + .sl-goods-content { padding: 20rpx 20rpx; box-sizing: border-box; } + .sl-img-box { width: 100%; height: 360rpx; @@ -722,6 +736,7 @@ color: #333; font-weight: 500; } + .sl-goods-subtitle { font-size: 24rpx; font-weight: 400; diff --git a/sheep/components/s-groupon-block/s-groupon-block.vue b/sheep/components/s-groupon-block/s-groupon-block.vue index d7e6fcf5..6c9d6544 100644 --- a/sheep/components/s-groupon-block/s-groupon-block.vue +++ b/sheep/components/s-groupon-block/s-groupon-block.vue @@ -1,171 +1,326 @@ - + \ No newline at end of file + .goods-box { + &:nth-last-of-type(1) { + margin-bottom: 0 !important; + } + } + + .goods-md-box, + .goods-sl-box, + .goods-lg-box { + position: relative; + + .cart-btn { + position: absolute; + bottom: 18rpx; + right: 20rpx; + z-index: 11; + height: 50rpx; + line-height: 50rpx; + padding: 0 20rpx; + border-radius: 25rpx; + font-size: 24rpx; + color: #fff; + } + } + diff --git a/sheep/components/s-live-block/s-live-block.vue b/sheep/components/s-live-block/s-live-block.vue index 9d1ad032..6e0b6c95 100644 --- a/sheep/components/s-live-block/s-live-block.vue +++ b/sheep/components/s-live-block/s-live-block.vue @@ -70,8 +70,8 @@ default() {}, }, }); - const { mode, goodsFields, mpliveIds } = props.data ?? {}; - const { marginLeft, marginRight } = props.styles ?? {}; + const { mode, goodsFields, mpliveIds } = props.data || {}; + const { marginLeft, marginRight } = props.styles || {}; async function getLiveListByIds(ids) { const { data } = await sheep.$api.app.mplive.getRoomList(ids); diff --git a/sheep/helper/index.js b/sheep/helper/index.js index 38e6afeb..59272f5d 100644 --- a/sheep/helper/index.js +++ b/sheep/helper/index.js @@ -621,7 +621,7 @@ function setProperty(obj, key, value) { function page() { const pages = getCurrentPages(); // 某些特殊情况下(比如页面进行redirectTo时的一些时机),pages可能为空数组 - return `/${pages[pages.length - 1]?.route ?? ''}`; + return `/${pages[pages.length - 1]?.route || ''}`; } /** diff --git a/sheep/platform/share.js b/sheep/platform/share.js index 9ab2a3a6..d200f671 100644 --- a/sheep/platform/share.js +++ b/sheep/platform/share.js @@ -178,7 +178,7 @@ const decryptSpm = (spm) => { }; // 绑定推广员 -const bindBrokerageUser = async (val= undefined) => { +const bindBrokerageUser = async (val = undefined) => { try { const shareId = val || uni.getStorageSync('shareId'); if (!shareId) { @@ -186,7 +186,8 @@ const bindBrokerageUser = async (val= undefined) => { } await BrokerageApi.bindBrokerageUser({ bindUserId: shareId }); uni.removeStorageSync('shareId'); - } catch { + } catch (e) { + console.error(e); } };