From 0b0844aeb44dd42a655384aa921937e22bb0252e Mon Sep 17 00:00:00 2001 From: woody Date: Tue, 3 Jun 2025 17:37:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(details):=20=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=A7=84=E6=A0=BC=E5=B1=95=E7=A4=BA=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.bak.vue | 1012 +++++++++++++++++++++++++++++++++ pages/specialArea/details.vue | 448 ++++++++------- 2 files changed, 1243 insertions(+), 217 deletions(-) create mode 100644 pages/index/index.bak.vue diff --git a/pages/index/index.bak.vue b/pages/index/index.bak.vue new file mode 100644 index 0000000..a9df53f --- /dev/null +++ b/pages/index/index.bak.vue @@ -0,0 +1,1012 @@ + + + + + diff --git a/pages/specialArea/details.vue b/pages/specialArea/details.vue index fbb39eb..452f45d 100644 --- a/pages/specialArea/details.vue +++ b/pages/specialArea/details.vue @@ -1,6 +1,6 @@ @@ -234,22 +221,12 @@ export default { backIcon, selSpaceGoods, }, - filters: { - seles(value) { - if (value > 999) { - return 999 + '+' - } else { - return value - } - }, - }, data() { return { waresCode: '', specialArea: '', goodDetail: '', imgUrlList: [], - selSku: false, skuString: '', num: 1, isWidth: 375, @@ -279,6 +256,45 @@ export default { // } }, methods: { + getCurrentlySelectedCount(productGroup) { + if (!productGroup || !productGroup.waresItemsParamsList) { + return 0 + } + return productGroup.waresItemsParamsList.reduce((sum, sku) => { + return sum + (sku.quantity || 0) + }, 0) + }, + formatPriceToThousandth(value) { + if (value === null || value === undefined || isNaN(parseFloat(value))) { + return value + } + let numStr = parseFloat(value).toFixed(2) + let parts = numStr.split('.') + parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',') + return parts.join('.') + }, + formatSales(value) { + if (value > 999) { + return '999+' + } else { + return value + } + }, + formatNumberToCurrency(value, isLocal = false) { + if (value === null || value === undefined || isNaN(parseFloat(value))) { + return '' + } + let num = parseFloat(value) + // Removed a ssumed currency symbol logic. Now only formats to two decimal places. + return num.toFixed(2) + }, + isLocalCurrency() { + // Helper to determine if local currency formatting is needed + // This is a placeholder. The original `isLocal` filter's logic might be more complex + // and depend on `this.pkCountry` or other global settings. + // For now, let's assume it's true if pkCountry is 1 (China). + return this.pkCountry === 1 + }, toIndex() { uni.switchTab({ url: '/pages/index/index' }) }, @@ -309,6 +325,9 @@ export default { productGroup: [], pkCountry: this.pkCountry, } + uni.showLoading({ + title: '加载中', + }) this.goodDetail.productParams.forEach(item => { item.waresItemsParamsList.forEach(ctem => { if (ctem.quantity != 0) { @@ -323,31 +342,26 @@ export default { if (this.goodDetail.isMakerGift == 2) { this.$refs.selSpaceGoods.getData(carList) } else { - api.addShopping(carList).then(res => { - if (res.code == 200) { - uni.showToast({ - title: '购物车添加成功', - icon: 'success', - mask: true, - }) - this.$store.dispatch('getCarLength') - } - }) + api + .addShopping(carList) + .then(res => { + if (res.code == 200) { + uni.showToast({ + title: '购物车添加成功', + icon: 'success', + mask: true, + }) + this.$store.dispatch('getCarLength') + } + }) + .finally(() => { + uni.hideLoading() + }) } }, getCatLength() { this.$store.dispatch('getCarLength', this.goodDetail.specialArea) }, - close() { - this.selSku = false - }, - goBuy() { - uni.navigateTo({ - url: - '/pages/shareArea/orderShare?allData=' + - JSON.stringify(this.goodDetail), - }) - }, getDetails() { api .waresDetail({ @@ -573,6 +587,13 @@ export default { // 作为返回值返回 return d + '天' + h + ':' + m + ':' + s }, + goBuy() { + uni.navigateTo({ + url: + '/pages/shareArea/orderShare?allData=' + + JSON.stringify(this.goodDetail), + }) + }, }, } @@ -650,7 +671,7 @@ export default { } } .t_hei { - font-size: 13px; + font-size: 32rpx; font-family: PingFang SC-Semibold, PingFang SC; @@ -697,87 +718,90 @@ export default { margin: 10rpx auto; } } -.pop_a { - background: #f7f7f7; - max-height: 80vh; - overflow-y: auto; -} -.pop_tt { - padding: 0 10rpx; - margin: 0rpx 10rpx; - height: 172rpx; - background: #fff; - position: fixed; - width: calc(100% - 40rpx); - display: flex; - align-items: center; - z-index: 1; - .pop_t { - display: flex; - align-items: center; - img { - width: 58px; - height: 58px; - border-radius: 8px 8px 8px 8px; - margin-right: 40rpx; - } - font-size: 28px; - font-family: Arial-Bold, Arial; - font-weight: bold; - color: #b42b2a; + +// START: Styles for integrated SKU selection +.sku-selection-container { + padding: 20rpx 0; + .sku-selection-title { + font-size: 16px; + font-weight: 600; + color: #333; + margin-bottom: 20rpx; + display: block; } -} -.zhan { - height: 172rpx; -} -.zhan1 { - height: 130rpx; -} -.pop { - padding: 10rpx 20rpx; - margin: 20rpx 10rpx; - box-shadow: 0px 2px 10px 0px rgba(204, 204, 204, 0.5); - border-radius: 8px 8px 8px 8px; - background: #fff; - .pop_c { - border-bottom: 8rpx solid rgba(0, 0, 0, 0.05); - padding: 10rpx 0 20rpx 0; - .ggTit { - font-size: 12px; - font-family: - PingFang SC-Medium, - PingFang SC; + + .sku-options-list { + // Styles for the list of product groups + } + + .sku-product-group { + margin-bottom: 20rpx; + &:last-child { + margin-bottom: 0; + } + .sku-product-name { + font-size: 14px; font-weight: 500; - color: #333333; - margin: 20rpx 0; + color: #444; + margin-bottom: 15rpx; + padding-left: 8rpx; } - .pop_ci { + } + + .sku-col-item { + margin-bottom: 20rpx; + } + + .sku-item { + display: flex; + flex-direction: row; + align-items: center; + background: #f9f9f9; + border-radius: 8px; + padding: 12rpx; + height: auto; + box-sizing: border-box; + justify-content: space-between; + + .sku-item-cover { + width: 80rpx; + height: 80rpx; + border-radius: 4px; + margin-right: 15rpx; + flex-shrink: 0; + } + + .sku-item-content-right { + flex: 1; display: flex; - align-items: center; + flex-direction: column; justify-content: space-between; - background: #eeeeee; - border-radius: 4px 4px 4px 4px; - opacity: 1; - margin-bottom: 20rpx; - padding: 4rpx 12rpx; - .pop_cl { - display: flex; - align-items: center; - .gui_iit { - margin-left: 20rpx; - } - } + width: 0; } - img { - width: 48rpx; - height: 48rpx; - border-radius: 4px 4px 4px 4px; + + .sku-item-name { + font-size: 13px; + color: #333; + line-height: 1.4; + margin-bottom: 8rpx; + text-align: right; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .u-number-box { + width: auto; + align-self: flex-end; } } } -::v-deep .u-popup__content__close { - z-index: 2; +// END: Styles for integrated SKU selection + +.warning-text { + color: #e54d42; /* 警告红色 */ } + .hui { width: 22px; height: 22px; @@ -812,16 +836,6 @@ export default { margin: 0 10rpx; border-radius: 3px 3px 3px 3px; } -.pop_b { - position: fixed; - bottom: 0; - height: 166rpx; - background: #ffffff; - width: 100%; -} -.pop_bb { - padding: 20rpx 40rpx; -} .footer_f { position: fixed; bottom: 0;