2024-06-05 18:58:12 +08:00
|
|
|
<template>
|
2024-06-11 00:34:43 +08:00
|
|
|
<view class="property-detail">
|
|
|
|
<template v-for="item in goodsPropertyList" :key="item.id">
|
|
|
|
<view class="property-item ss-p-40 ss-gap-40" v-if="item.checked">
|
|
|
|
<view class="property-name ss-flex ss-gap-40 ss-m-b-20">
|
|
|
|
<view class="property-name-text">规格名</view>
|
|
|
|
<view class="property-name-value">{{ item.name }}</view>
|
|
|
|
</view>
|
|
|
|
<view class="property-value ss-flex ss-gap-40">
|
|
|
|
<view class="property-value-text">规格值</view>
|
|
|
|
<view class="property-value-value ss-flex ss-gap-10">
|
2024-08-28 18:36:22 +08:00
|
|
|
<view
|
|
|
|
v-for="sitem in item.propertyValues"
|
|
|
|
@tap="chooseProperty(sitem)"
|
|
|
|
@longpress="longPropertyValuePress(sitem)"
|
|
|
|
:class="['item', sitem.checked ? 'active' : '']"
|
|
|
|
>{{ sitem.name }}</view
|
|
|
|
>
|
|
|
|
</view>
|
|
|
|
<view v-if="canEdit" style="height: 60rpx" @click="addPropertyValueClick(item)">
|
|
|
|
<text style="color: #ff3300; font-size: 30px" class="cicon-add-round-o"></text>
|
2024-06-11 00:34:43 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
2024-08-28 18:36:22 +08:00
|
|
|
<uni-popup ref="inputPropertyValueDialogRef" type="dialog">
|
|
|
|
<uni-popup-dialog
|
|
|
|
mode="input"
|
|
|
|
:title="propertyValueTitle"
|
|
|
|
v-model="inputPropertyValueFormdata.name"
|
|
|
|
placeholder="请输入商品规格"
|
|
|
|
:before-close="true"
|
|
|
|
@confirm="dialogInputPropertyValueConfirm"
|
|
|
|
@close="inputPropertyValueDialogRef.close()"
|
|
|
|
></uni-popup-dialog>
|
|
|
|
</uni-popup>
|
2024-06-11 00:34:43 +08:00
|
|
|
</view>
|
2024-06-05 18:58:12 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-06-07 18:34:58 +08:00
|
|
|
import { defineProps, defineEmits, ref, computed } from 'vue'
|
2024-08-28 18:36:22 +08:00
|
|
|
import {
|
|
|
|
goodsPropertyList,
|
|
|
|
canEdit,
|
|
|
|
addPropertyValueClick,
|
|
|
|
inputPropertyValueDialogRef,
|
|
|
|
inputPropertyValueFormdata,
|
|
|
|
propertyValueTitle,
|
|
|
|
dialogInputPropertyValueConfirm,
|
|
|
|
longPropertyValuePress,
|
|
|
|
} from '../js/sku'
|
2024-06-05 18:58:12 +08:00
|
|
|
|
|
|
|
const props = defineProps({
|
2024-06-11 00:34:43 +08:00
|
|
|
modelValue: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
goodsPropertyList: {
|
|
|
|
type: Array,
|
|
|
|
default: () => [],
|
|
|
|
},
|
2024-06-05 18:58:12 +08:00
|
|
|
})
|
|
|
|
|
2024-06-07 18:34:58 +08:00
|
|
|
const emit = defineEmits(['changeSubProperty'])
|
|
|
|
|
2024-06-05 18:58:12 +08:00
|
|
|
function chooseProperty(item) {
|
2024-06-11 00:34:43 +08:00
|
|
|
if (canEdit.value) {
|
2024-06-07 18:34:58 +08:00
|
|
|
item.checked = !item.checked
|
|
|
|
emit('changeSubProperty')
|
2024-06-11 00:34:43 +08:00
|
|
|
}
|
2024-06-05 18:58:12 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.property-detail {
|
2024-06-11 00:34:43 +08:00
|
|
|
.property-item {
|
|
|
|
margin: 0 40rpx 20rpx;
|
|
|
|
background-color: #f9f9f9;
|
|
|
|
border-radius: 10px;
|
2024-06-05 18:58:12 +08:00
|
|
|
|
2024-06-11 00:34:43 +08:00
|
|
|
.property-name {
|
|
|
|
.property-name-text {
|
|
|
|
color: #606266;
|
|
|
|
}
|
|
|
|
}
|
2024-06-06 02:20:25 +08:00
|
|
|
|
2024-06-11 00:34:43 +08:00
|
|
|
.property-value {
|
|
|
|
.property-value-text {
|
|
|
|
color: #606266;
|
|
|
|
}
|
2024-06-06 02:20:25 +08:00
|
|
|
|
2024-06-11 00:34:43 +08:00
|
|
|
.property-value-value {
|
|
|
|
.item {
|
|
|
|
text-align: center;
|
|
|
|
line-height: 60rpx;
|
|
|
|
height: 60rpx;
|
|
|
|
padding: 0 10px;
|
|
|
|
border-radius: 10px;
|
|
|
|
background-color: var(--ui-BG-4);
|
|
|
|
}
|
2024-06-05 18:58:12 +08:00
|
|
|
|
2024-06-11 00:34:43 +08:00
|
|
|
.active {
|
|
|
|
color: #fff;
|
|
|
|
background-color: var(--ui-BG-Main);
|
2024-06-05 18:58:12 +08:00
|
|
|
}
|
2024-06-11 00:34:43 +08:00
|
|
|
}
|
2024-06-05 18:58:12 +08:00
|
|
|
}
|
2024-06-11 00:34:43 +08:00
|
|
|
}
|
2024-06-05 18:58:12 +08:00
|
|
|
}
|
|
|
|
</style>
|