|
@@ -28,22 +28,20 @@
|
|
|
<view class="sku-item ss-m-b-20" v-for="property in propertyList" :key="property.id">
|
|
|
<view class="label-text ss-m-b-20">{{ property.name }}</view>
|
|
|
<view class="ss-flex ss-col-center ss-flex-wrap">
|
|
|
- <button class="ss-reset-button spec-btn" v-for="value in property.values" :class="[
|
|
|
- {
|
|
|
- 'ui-BG-Main-Gradient': state.currentPropertyArray[property.id] === value.id,
|
|
|
- },
|
|
|
- {
|
|
|
- 'disabled-btn': value.disabled === true,
|
|
|
- },
|
|
|
- ]" :key="value.id" :disabled="value.disabled === true" @tap="onSelectSku(property.id, value.id)">
|
|
|
+ <button class="ss-reset-button spec-btn" v-for="value in property.values"
|
|
|
+ :class="[
|
|
|
+ { 'ui-BG-Main-Gradient': state.currentPropertyArray[property.id] === value.id },
|
|
|
+ { 'disabled-btn': value.disabled === true }
|
|
|
+ ]"
|
|
|
+ :key="value.id" :disabled="value.disabled === true" @tap="onSelectSku(property.id, value.id)"
|
|
|
+ >
|
|
|
{{ value.name }}
|
|
|
</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="buy-num-box ss-flex ss-col-center ss-row-between ss-m-b-40">
|
|
|
<view class="label-text">购买数量</view>
|
|
|
- <su-number-box :min="1" :max="state.selectedSku.stock" :step="1"
|
|
|
- v-model="state.selectedSku.goods_num" @change="onNumberChange($event)" />
|
|
|
+ <su-number-box :min="1" :max="state.selectedSku.stock" :step="1" v-model="state.selectedSku.goods_num" @change="onNumberChange($event)" />
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
@@ -269,6 +267,15 @@
|
|
|
}
|
|
|
|
|
|
changeDisabled(false);
|
|
|
+
|
|
|
+ // 默认选中规格
|
|
|
+ if (propertyList && propertyList.length) {
|
|
|
+ propertyList.forEach(e => {
|
|
|
+ if (e.values && e.values.length) onSelectSku(e.id, e.values[0].id)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// TODO 芋艿:待讨论的优化点:1)单规格,要不要默认选中;2)默认要不要选中第一个规格
|
|
|
</script>
|
|
|
|