mirror of
https://gitee.com/ShopeX/ECShopX_mobile-frontend
synced 2026-08-10 22:01:57 +08:00
v4.6.2
This commit is contained in:
@@ -61,7 +61,6 @@ const initialState = {
|
||||
const $instance = Taro.getCurrentInstance()
|
||||
|
||||
function SpSkuSelect(props) {
|
||||
useTranslation()
|
||||
const {
|
||||
info,
|
||||
open = false,
|
||||
@@ -109,13 +108,18 @@ function SpSkuSelect(props) {
|
||||
// }, [open])
|
||||
|
||||
const init = () => {
|
||||
const { skuList, specItems } = info
|
||||
const { skuList, specItems, curItem } = info
|
||||
console.log('skuList:', skuList)
|
||||
console.log('specItems:', specItems)
|
||||
skuDictRef.current = {}
|
||||
specItems.forEach((item) => {
|
||||
const key = item.specItem.map((spec) => spec.specId).join('_')
|
||||
skuDictRef.current[key] = item
|
||||
})
|
||||
// 优先使用上一次已选择的规格,避免重新打开后回退到默认规格
|
||||
const matchedSelectedSpecItem = curItem?.itemId
|
||||
? specItems.find((item) => `${item.itemId}` === `${curItem.itemId}`)
|
||||
: null
|
||||
// 默认选中有库存并且前端可销售的sku
|
||||
let defaultSpecItem = specItems.find(
|
||||
(item) => item.store > 0 && ['onsale'].includes(item.approveStatus)
|
||||
@@ -126,8 +130,9 @@ function SpSkuSelect(props) {
|
||||
}
|
||||
|
||||
let selection = Array(skuList.length).fill(null)
|
||||
if (defaultSpecItem) {
|
||||
selection = defaultSpecItem.specItem.map((item) => item.specId)
|
||||
const targetSpecItem = matchedSelectedSpecItem || defaultSpecItem
|
||||
if (targetSpecItem) {
|
||||
selection = targetSpecItem.specItem.map((item) => item.specId)
|
||||
}
|
||||
|
||||
calcDisabled(selection)
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
SpCheckboxNew,
|
||||
SpPrivacyModal
|
||||
} from '@/components'
|
||||
import { useTranslation, $t } from '@/i18n'
|
||||
import { useTranslation, $t, ti } from '@/i18n'
|
||||
|
||||
import CompGoodsItem from './comps/comp-goodsitem'
|
||||
|
||||
@@ -338,10 +338,6 @@ function CartIndex() {
|
||||
const allChecked = all_item.cart_total_count == all_item.list.length
|
||||
return (
|
||||
<View className='shop-cart-item' key={`shop-cart-item__${all_index}`}>
|
||||
<View className='shop-cart-item-hd'>
|
||||
<Text className='iconfont icon-shop' />
|
||||
{all_item.shop_name || $t('f9ef9536.491c0c')}
|
||||
</View>
|
||||
<View className='shop-cart-item-shadow'>
|
||||
<View className='shop-cart-item-hd'>
|
||||
{all_item.shop_name || $t('f9ef9536.491c0c')}
|
||||
@@ -451,30 +447,41 @@ function CartIndex() {
|
||||
{/** 结算/全选操作开始 */}
|
||||
|
||||
<View className='shop-cart-item-ft'>
|
||||
<View className='lf'>
|
||||
<SpCheckboxNew
|
||||
checked={allChecked}
|
||||
label={$t('f9ef9536.66eeac')}
|
||||
onChange={onChangeGoodsIsCheck.bind(this, all_item, 'all')}
|
||||
/>
|
||||
<View>
|
||||
<View className='lf'>
|
||||
<SpCheckboxNew
|
||||
checked={allChecked}
|
||||
label={$t('f9ef9536.66eeac')}
|
||||
onChange={onChangeGoodsIsCheck.bind(this, all_item, 'all')}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className='shop-cart-item-ft'>
|
||||
<View className='rg'>
|
||||
<View className='rg-lt'>
|
||||
<View className='total-price-wrap'>
|
||||
{$t('f9ef9536.7b2864')}
|
||||
<SpPrice className='total-pirce' value={all_item.total_fee / 100} />
|
||||
</View>
|
||||
{all_item.discount_fee > 0 && (
|
||||
<View className='discount-price-wrap'>
|
||||
{$t('f9ef9536.1784cf')}
|
||||
<SpPrice
|
||||
className='total-pirce'
|
||||
value={all_item.discount_fee / 100}
|
||||
/>
|
||||
<View>
|
||||
<View className='rg'>
|
||||
<View className='rg-lt'>
|
||||
<View className='total-price-wrap'>
|
||||
{$t('f9ef9536.7b2864')}
|
||||
<SpPrice className='total-pirce' value={all_item.total_fee / 100} />
|
||||
</View>
|
||||
)}
|
||||
{all_item.discount_fee > 0 && (
|
||||
<View className='discount-price-wrap'>
|
||||
{$t('f9ef9536.1784cf')}
|
||||
<SpPrice
|
||||
className='total-pirce'
|
||||
value={all_item.discount_fee / 100}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
<AtButton
|
||||
className='btn-calc'
|
||||
type='primary'
|
||||
circle
|
||||
disabled={all_item.cart_total_num <= 0}
|
||||
onClick={() => handleCheckout(all_item)}
|
||||
>
|
||||
{ti('f9ef9536.605bad', [all_item.cart_total_num])}
|
||||
</AtButton>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user