1 line
16 KiB
Plaintext
1 line
16 KiB
Plaintext
|
{"version":3,"file":"s-select-sku.js","sources":["../../../../../../src/sheep/components/s-select-sku/s-select-sku.vue","../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy9zaGVlcC9jb21wb25lbnRzL3Mtc2VsZWN0LXNrdS9zLXNlbGVjdC1za3UudnVl"],"sourcesContent":["<template>\r\n <!-- 规格弹窗 -->\r\n <su-popup :show=\"show\" round=\"10\" @close=\"emits('close')\">\r\n <!-- SKU 信息 -->\r\n <view class=\"ss-modal-box bg-white ss-flex-col\">\r\n <view class=\"modal-header ss-flex ss-col-center\">\r\n <view class=\"header-left ss-m-r-30\">\r\n <image\r\n class=\"sku-image\"\r\n :src=\"state.selectedSku.picUrl || goodsInfo.picUrl\"\r\n mode=\"aspectFill\"\r\n />\r\n </view>\r\n <view class=\"header-right ss-flex-col ss-row-between ss-flex-1\">\r\n <view class=\"goods-title ss-line-2\">{{ goodsInfo.name }}</view>\r\n <view class=\"header-right-bottom ss-flex ss-col-center ss-row-between\">\r\n <view class=\"ss-flex\">\r\n <view class=\"price-text\">\r\n {{ fen2yuan(state.selectedSku.price || goodsInfo.price) }}\r\n </view>\r\n </view>\r\n <view class=\"stock-text ss-m-l-20\">\r\n {{ formatStock('exact', state.selectedSku.stock || goodsInfo.stock) }}\r\n </view>\r\n </view>\r\n </view>\r\n </view>\r\n\r\n <!-- 属性选择 -->\r\n <view class=\"modal-content ss-flex-1\">\r\n <scroll-view scroll-y=\"true\" class=\"modal-content-scroll\" @touchmove.stop>\r\n <view class=\"sku-item ss-m-b-20\" v-for=\"property in propertyList\" :key=\"property.id\">\r\n <view class=\"label-text ss-m-b-20\">{{ property.name }}</view>\r\n <view class=\"ss-flex ss-col-center ss-flex-wrap\">\r\n <button\r\n class=\"ss-reset-button spec-btn\"\r\n v-for=\"value in property.values\"\r\n :class=\"[\r\n {\r\n 'ui-BG-Main-Gradient': state.currentPropertyArray[property.id] === value.id,\r\n },\r\n {\r\n 'disabled-btn': value.disabled === true,\r\n },\r\n ]\"\r\n :key=\"value.id\"\r\n :disabled=\"value.disabled === true\"\r\n @tap=\"onSelectSku(property.id, value.id)\"\r\n >\r\n {{ value.name }}\r\n </button>\r\n </view>\r\n </view>\r\n <view class=\"buy-num-box ss-flex ss-col-center ss-row-between ss-m-b-40\">\r\n <view class=\"label-text\">购买数量</view>\r\n <su-number-box\r\n :min=\"1\"\r\n :max=\"state.selectedSku.stock\"\r\n :step=\"1\"\r\n v-model=\"state.selectedSku.goods_num\"\r\n @change=\"onNumberChange($event)\"\r\n />\r\n </view>\r\n </scroll-view>\r\n </view>\r\n\r\n <!-- 操作区 -->\r\n <view class=\"modal-footer border-top\">\r\n <view class=\"buy-box ss-flex ss-col-center ss-flex ss-col-center ss-row-center\">\r\n <button class=\"ss-reset-button add-btn ui-Shadow-Main\" @tap=\"onAddCart\">\r\n 加入购物车\r\n </button>\r\n <button class=\"ss-reset-button buy-btn ui-Shadow-Main\" @tap=\"onBuy\">立即购买</button>\r\n </view>\r\n </view>\r\n </view>\r\n </su-popup>\r\n</template>\r\n\r\n<script setup>\r\nimport { computed, reactive, watch } from 'vue'\r\nimport sheep from '@/sheep'\r\nimport { formatStock, convertProductPropertyList, fen2yuan } from '@/sheep/hooks/useGoods'\r\n\r\nconst emits = defineEmits(['change', 'addCart', 'buy', 'close'])\r\nconst props = defineProps({\r\n goodsInfo: {\r\n type: Object,\r\n default() {},\r\n },\r\n show: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n})\r\n\r\nconst state = reactive({\r\n selectedSku: {}, // 选中
|