[new feature] Sku: update style & add several props (#3875)

This commit is contained in:
codpoe 2019-07-22 10:51:40 +08:00 committed by neverland
parent e8c528a6f6
commit 503fe5f469
13 changed files with 301 additions and 165 deletions

View File

@ -120,9 +120,11 @@ export default {
| v-model | Whether to show sku | `boolean` | `false` | | v-model | Whether to show sku | `boolean` | `false` |
| sku | Sku data | `object` | - | | sku | Sku data | `object` | - |
| goods | Goods info | `object` | - | | goods | Goods info | `object` | - |
| goods-id | Goods id | `string | number` | - | | goods-id | Goods id | `string | `number` | - |
| price-tag | Tag behind the price | `string` | - |
| hide-stock | Whether to hide stock | `boolean` | `false` | | hide-stock | Whether to hide stock | `boolean` | `false` |
| hide-quota-text | Whether to hide quota text | `boolean` | `false` | | hide-quota-text | Whether to hide quota text | `boolean` | `false` |
| hide-selected-text | Whether to hide selected text | `boolean` | `false` |
| show-add-cart-btn | Whether to show cart button | `boolean` | `true` | | show-add-cart-btn | Whether to show cart button | `boolean` | `true` |
| buy-text | Buy button text | `string` | - | - | | buy-text | Buy button text | `string` | - | - |
| add-cart-text | Add cart button text | `string` | - | - | | add-cart-text | Add cart button text | `string` | - | - |
@ -263,7 +265,13 @@ customStepperConfig: {
Toast('not enough stock'); Toast('not enough stock');
} }
} }
} },
// custom callback when stepper value change
handleStepperChange: currentValue => {},
// stock
stockNum: 1999,
// stock fomatter
stockFormatter: stockNum => {},
} }
``` ```

View File

@ -123,8 +123,10 @@ export default {
| sku | 商品sku数据 | `object` | - | - | | sku | 商品sku数据 | `object` | - | - |
| goods | 商品信息 | `object` | - | - | | goods | 商品信息 | `object` | - | - |
| goods-id | 商品 id | `string | number` | - | - | | goods-id | 商品 id | `string | number` | - | - |
| price-tag | 显示在价格后面的标签 | `string` | - | - |
| hide-stock | 是否显示商品剩余库存 | `boolean` | `false` | - | | hide-stock | 是否显示商品剩余库存 | `boolean` | `false` | - |
| hide-quota-text | 是否显示限购提示 | `boolean` | `false` | 1.4.8 | | hide-quota-text | 是否显示限购提示 | `boolean` | `false` | 1.4.8 |
| hide-selected-text | 是否隐藏已选提示 | `boolean` | `false` | - |
| show-add-cart-btn | 是否显示加入购物车按钮 | `boolean` | `true` | - | | show-add-cart-btn | 是否显示加入购物车按钮 | `boolean` | `true` | - |
| buy-text | 购买按钮文字 | `string` | `立即购买` | - | | buy-text | 购买按钮文字 | `string` | `立即购买` | - |
| add-cart-text | 加入购物车按钮文字 | `string` | `加入购物车` | - | | add-cart-text | 加入购物车按钮文字 | `string` | `加入购物车` | - |
@ -275,7 +277,13 @@ customStepperConfig: {
Toast('库存不够了'); Toast('库存不够了');
} }
} }
} },
// 步进器变化的回调
handleStepperChange: currentValue => {},
// 库存
stockNum: 1999,
// 格式化库存
stockFormatter: stockNum => {},
} }
``` ```

View File

@ -4,6 +4,7 @@ import Popup from '../popup';
import Toast from '../toast'; import Toast from '../toast';
import ImagePreview from '../image-preview'; import ImagePreview from '../image-preview';
import SkuHeader from './components/SkuHeader'; import SkuHeader from './components/SkuHeader';
import SkuHeaderItem from './components/SkuHeaderItem';
import SkuRow from './components/SkuRow'; import SkuRow from './components/SkuRow';
import SkuRowItem from './components/SkuRowItem'; import SkuRowItem from './components/SkuRowItem';
import SkuStepper from './components/SkuStepper'; import SkuStepper from './components/SkuStepper';
@ -19,6 +20,7 @@ const { QUOTA_LIMIT } = LIMIT_TYPE;
export default createComponent({ export default createComponent({
props: { props: {
sku: Object, sku: Object,
priceTag: String,
goods: Object, goods: Object,
value: Boolean, value: Boolean,
buyText: String, buyText: String,
@ -28,6 +30,7 @@ export default createComponent({
stepperTitle: String, stepperTitle: String,
getContainer: Function, getContainer: Function,
hideQuotaText: Boolean, hideQuotaText: Boolean,
hideSelectedText: Boolean,
resetStepperOnHide: Boolean, resetStepperOnHide: Boolean,
customSkuValidator: Function, customSkuValidator: Function,
closeOnClickOverlay: Boolean, closeOnClickOverlay: Boolean,
@ -83,10 +86,8 @@ export default createComponent({
show(val) { show(val) {
this.$emit('input', val); this.$emit('input', val);
if (!val) { if (!val) {
const selectedSkuValues = getSelectedSkuValues(this.sku.tree, this.selectedSku);
this.$emit('sku-close', { this.$emit('sku-close', {
selectedSkuValues, selectedSkuValues: this.selectedSkuValues,
selectedNum: this.selectedNum, selectedNum: this.selectedNum,
selectedSkuComb: this.selectedSkuComb selectedSkuComb: this.selectedSkuComb
}); });
@ -114,7 +115,6 @@ export default createComponent({
skuGroupClass() { skuGroupClass() {
return [ return [
'van-sku-group-container', 'van-sku-group-container',
'van-hairline--bottom',
{ {
'van-sku-group-container--hide-soldout': !this.showSoldoutSku 'van-sku-group-container--hide-soldout': !this.showSoldoutSku
} }
@ -160,6 +160,10 @@ export default createComponent({
return null; return null;
}, },
selectedSkuValues() {
return getSelectedSkuValues(this.skuTree, this.selectedSku);
},
price() { price() {
if (this.selectedSkuComb) { if (this.selectedSkuComb) {
return (this.selectedSkuComb.price / 100).toFixed(2); return (this.selectedSkuComb.price / 100).toFixed(2);
@ -168,6 +172,13 @@ export default createComponent({
return this.sku.price; return this.sku.price;
}, },
originPrice() {
if (this.selectedSkuComb && this.selectedSkuComb.origin_price) {
return (this.selectedSkuComb.origin_price / 100).toFixed(2);
}
return this.sku.origin_price;
},
skuTree() { skuTree() {
return this.sku.tree || []; return this.sku.tree || [];
}, },
@ -191,6 +202,53 @@ export default createComponent({
} }
return imageList; return imageList;
},
stock() {
const { stockNum } = this.customStepperConfig;
if (stockNum !== undefined) {
return stockNum;
}
if (this.selectedSkuComb) {
return this.selectedSkuComb.stock_num;
}
return this.sku.stock_num;
},
stockText() {
const { stockFormatter } = this.customStepperConfig;
if (stockFormatter) return stockFormatter(this.stock);
return `剩余 ${this.stock}`;
},
quotaText() {
const { quotaText, hideQuotaText } = this.customStepperConfig;
if (hideQuotaText) return '';
let text = '';
if (quotaText) {
text = quotaText;
} else if (this.quota > 0) {
text = `每人限购${this.quota}`;
}
return text;
},
selectedText() {
if (this.selectedSkuComb) {
return `已选 ${this.selectedSkuValues.map(item => item.name).join('')}`;
}
const unselected = this.skuTree
.filter(item => this.selectedSku[item.k_s] === UNSELECTED_SKU_VALUE_ID)
.map(item => item.k)
.join('');
return `选择 ${unselected}`;
} }
}, },
@ -378,6 +436,7 @@ export default createComponent({
sku, sku,
goods, goods,
price, price,
originPrice,
skuEventBus, skuEventBus,
selectedSku, selectedSku,
selectedNum, selectedNum,
@ -388,6 +447,7 @@ export default createComponent({
const slotsProps = { const slotsProps = {
price, price,
originPrice,
selectedNum, selectedNum,
skuEventBus, skuEventBus,
selectedSku, selectedSku,
@ -398,9 +458,25 @@ export default createComponent({
const Header = slots('sku-header') || ( const Header = slots('sku-header') || (
<SkuHeader sku={sku} goods={goods} skuEventBus={skuEventBus} selectedSku={selectedSku}> <SkuHeader sku={sku} goods={goods} skuEventBus={skuEventBus} selectedSku={selectedSku}>
{slots('sku-header-price') || ( {slots('sku-header-price') || (
<div class="van-sku__goods-price"> <div>
<span class="van-sku__price-symbol"></span> <div class="van-sku__goods-price">
<span class="van-sku__price-num">{price}</span> <span class="van-sku__price-symbol"></span>
<span class="van-sku__price-num">{price}</span>
{this.priceTag && <span class="van-sku__price-tag">{this.priceTag}</span>}
</div>
{originPrice && (
<SkuHeaderItem>原价 {originPrice}</SkuHeaderItem>
)}
{!this.hideStock && (
<SkuHeaderItem>
<span class="van-sku__stock">{this.stockText}</span>
{!hideQuotaText && this.quotaText && <span class="van-sku__quota">({this.quotaText})</span>}
</SkuHeaderItem>
)}
{this.hasSku && !this.hideSelectedText && (
<SkuHeaderItem>{this.selectedText}</SkuHeaderItem>
)}
{slots('sku-header-extra')}
</div> </div>
)} )}
</SkuHeader> </SkuHeader>
@ -429,16 +505,14 @@ export default createComponent({
const Stepper = slots('sku-stepper') || ( const Stepper = slots('sku-stepper') || (
<SkuStepper <SkuStepper
ref="skuStepper" ref="skuStepper"
stock={this.stock}
quota={this.quota} quota={this.quota}
hideStock={this.hideStock}
quotaUsed={this.quotaUsed} quotaUsed={this.quotaUsed}
skuEventBus={skuEventBus} skuEventBus={skuEventBus}
selectedNum={selectedNum} selectedNum={selectedNum}
selectedSku={selectedSku} selectedSku={selectedSku}
stepperTitle={stepperTitle} stepperTitle={stepperTitle}
skuStockNum={sku.stock_num} skuStockNum={sku.stock_num}
hideQuotaText={hideQuotaText}
selectedSkuComb={selectedSkuComb}
disableStepperInput={this.disableStepperInput} disableStepperInput={this.disableStepperInput}
customStepperConfig={this.customStepperConfig} customStepperConfig={this.customStepperConfig}
onChange={event => { onChange={event => {
@ -472,6 +546,7 @@ export default createComponent({
class="van-sku-container" class="van-sku-container"
getContainer={this.getContainer} getContainer={this.getContainer}
closeOnClickOverlay={this.closeOnClickOverlay} closeOnClickOverlay={this.closeOnClickOverlay}
round
> >
{Header} {Header}
<div class="van-sku-body" style={this.bodyStyle}> <div class="van-sku-body" style={this.bodyStyle}>

View File

@ -50,10 +50,9 @@ function SkuHeader(
<img src={goodsImg} /> <img src={goodsImg} />
</div> </div>
<div class={bem('goods-info')}> <div class={bem('goods-info')}>
<div class="van-sku__goods-name van-ellipsis">{goods.title}</div>
{slots.default && slots.default()} {slots.default && slots.default()}
<Icon <Icon
name="close" name="clear"
class="van-sku__close-icon" class="van-sku__close-icon"
onClick={() => { onClick={() => {
skuEventBus.$emit('sku:close'); skuEventBus.$emit('sku:close');

View File

@ -0,0 +1,25 @@
import { createNamespace } from '../../utils';
import { inherit } from '../../utils/functional';
// Types
import { CreateElement, RenderContext } from 'vue/types';
import { DefaultSlots } from '../../utils/types';
export type SkuHeaderItemProps = {};
const [createComponent, bem] = createNamespace('sku-header-item');
function SkuHeader(
h: CreateElement,
props: SkuHeaderItemProps,
slots: DefaultSlots,
ctx: RenderContext<SkuHeaderItemProps>
) {
return (
<div class={bem()} {...inherit(ctx)}>
{slots.default && slots.default()}
</div>
);
}
export default createComponent<SkuHeaderItemProps>(SkuHeader);

View File

@ -18,20 +18,16 @@ export default createComponent({
data() { data() {
return { return {
// 正在上传的图片 base64 // 正在上传的图片 base64
paddingImg: '' paddingImg: '',
uploadFail: false
}; };
}, },
computed: {
imgList() {
return this.value && !this.paddingImg ? [this.value] : [];
}
},
methods: { methods: {
afterReadFile(file) { afterReadFile(file) {
// 上传文件 // 上传文件
this.paddingImg = file.content; this.paddingImg = file.content;
this.uploadFail = false;
this.uploadImg(file.file, file.content) this.uploadImg(file.file, file.content)
.then(img => { .then(img => {
this.$emit('input', img); this.$emit('input', img);
@ -40,23 +36,53 @@ export default createComponent({
}); });
}) })
.catch(() => { .catch(() => {
this.paddingImg = ''; this.uploadFail = true;
}); });
}, },
onOversize() { onOversize() {
this.$toast(`最大可上传图片为${this.maxSize}MB请尝试压缩图片尺寸`); this.$toast(`最大可上传图片为${this.maxSize}MB请尝试压缩图片尺寸`);
},
renderUploader(content, disabled = false) {
return (
<Uploader
class={bem('uploader')}
disabled={disabled}
afterRead={this.afterReadFile}
maxSize={this.maxSize * 1024 * 1024}
onOversize={this.onOversize}
>
<div class={bem('img')}>
{content}
</div>
</Uploader>
);
},
renderMask() {
return (
<div class={bem('mask')}>
{this.uploadFail
? (
[
<Icon name="warning-o" size="20px" />,
<div class={bem('warn-text')}>上传失败<br />重新上传</div>
]
) : (
<Loading type="spinner" size="20px" color="white" />
)}
</div>
);
} }
}, },
render(h) { render(h) {
const { imgList, paddingImg } = this; return (
<div class={bem()}>
const ImageList = (paddingImg || imgList.length > 0) && ( {this.value && this.renderUploader(
<div class="van-clearfix"> [
{imgList.map(img => ( <img src={this.value} />,
<div class={bem('img')}>
<img src={img} />
<Icon <Icon
name="clear" name="clear"
class={bem('delete')} class={bem('delete')}
@ -64,40 +90,24 @@ export default createComponent({
this.$emit('input', ''); this.$emit('input', '');
}} }}
/> />
</div> ],
))} true
{paddingImg && ( )}
<div class={bem('img')}>
<img src={paddingImg} /> {this.paddingImg && this.renderUploader(
<Loading type="spinner" class={bem('uploading')} /> [
<img src={this.paddingImg} />,
this.renderMask()
],
!this.uploadFail
)}
{!this.value && !this.paddingImg && this.renderUploader(
<div class={bem('trigger')}>
<Icon name="photograph" size="22px" />
</div> </div>
)} )}
</div> </div>
); );
return (
<div class={bem()}>
<Uploader
disabled={!!paddingImg}
afterRead={this.afterReadFile}
maxSize={this.maxSize * 1024 * 1024}
onOversize={this.onOversize}
>
<div class={bem('header')}>
{paddingImg ? (
<div>正在上传...</div>
) : (
[
<Icon name="photograph" />,
<span class="label">{this.value ? '重拍' : '拍照'} </span>,
<Icon name="photo" />,
<span class="label">{this.value ? '重新选择照片' : '选择照片'}</span>
]
)}
</div>
</Uploader>
{ImageList}
</div>
);
} }
}); });

View File

@ -127,6 +127,7 @@ export default createComponent({
{this.messages.map((message, index) => (message.type === 'image' ? ( {this.messages.map((message, index) => (message.type === 'image' ? (
<Cell <Cell
class={bem('image-cell')} class={bem('image-cell')}
value-class={bem('image-cell-value')}
label="仅限一张" label="仅限一张"
title={message.name} title={message.name}
key={`${this.goodsId}-${index}`} key={`${this.goodsId}-${index}`}

View File

@ -19,8 +19,8 @@ function SkuRow(
ctx: RenderContext<SkuRowProps> ctx: RenderContext<SkuRowProps>
) { ) {
return ( return (
<div class={bem()} {...inherit(ctx)}> <div class={[bem(), 'van-hairline--bottom']} {...inherit(ctx)}>
<div class={bem('title')}>{props.skuRow.k}</div> <div class={bem('title')}>{props.skuRow.k}</div>
{slots.default && slots.default()} {slots.default && slots.default()}
</div> </div>
); );

View File

@ -37,6 +37,7 @@ export default createComponent({
render(h) { render(h) {
const choosed = this.skuValue.id === this.selectedSku[this.skuKeyStr]; const choosed = this.skuValue.id === this.selectedSku[this.skuKeyStr];
const imgUrl = this.skuValue.imgUrl || this.skuValue.img_url;
return ( return (
<span <span
@ -49,7 +50,8 @@ export default createComponent({
]} ]}
onClick={this.onSelect} onClick={this.onSelect}
> >
{this.skuValue.name} {imgUrl && <img class="van-sku-row__item-img" src={imgUrl} />}
<span class="van-sku-row__item-name">{this.skuValue.name}</span>
</span> </span>
); );
} }

View File

@ -7,14 +7,11 @@ const { QUOTA_LIMIT, STOCK_LIMIT } = LIMIT_TYPE;
export default createComponent({ export default createComponent({
props: { props: {
hideStock: Boolean, stock: Number,
selectedSku: Object,
skuEventBus: Object, skuEventBus: Object,
skuStockNum: Number, skuStockNum: Number,
selectedNum: Number, selectedNum: Number,
stepperTitle: String, stepperTitle: String,
hideQuotaText: Boolean,
selectedSkuComb: Object,
disableStepperInput: Boolean, disableStepperInput: Boolean,
customStepperConfig: Object, customStepperConfig: Object,
quota: { quota: {
@ -48,40 +45,6 @@ export default createComponent({
}, },
computed: { computed: {
stock() {
const { stockNum } = this.customStepperConfig;
if (stockNum !== undefined) {
return stockNum;
}
if (this.selectedSkuComb) {
return this.selectedSkuComb.stock_num;
}
return this.skuStockNum;
},
stockText() {
const { stockFormatter } = this.customStepperConfig;
if (stockFormatter) return stockFormatter(this.stock);
return `剩余${this.stock}`;
},
quotaText() {
const { quotaText, hideQuotaText } = this.customStepperConfig;
if (hideQuotaText) return '';
let text = '';
if (quotaText) {
text = quotaText;
} else if (this.quota > 0) {
text = `每人限购${this.quota}`;
}
return text;
},
stepperLimit() { stepperLimit() {
const quotaLimit = this.quota - this.quotaUsed; const quotaLimit = this.quota - this.quotaUsed;
let limit; let limit;
@ -125,7 +88,7 @@ export default createComponent({
return ( return (
<div class="van-sku-stepper-stock"> <div class="van-sku-stepper-stock">
<div class="van-sku-stepper-container"> <div class="van-sku-stepper-container">
<div class="van-sku__stepper-title">{this.stepperTitle || '购买数量'}</div> <div class="van-sku__stepper-title">{this.stepperTitle || '购买数量'}</div>
<Stepper <Stepper
vModel={this.currentNum} vModel={this.currentNum}
class="van-sku__stepper" class="van-sku__stepper"
@ -135,10 +98,6 @@ export default createComponent({
onChange={this.onChange} onChange={this.onChange}
/> />
</div> </div>
{!this.hideStock && <div class="van-sku__stock">{this.stockText}</div>}
{!this.hideQuotaText && this.quotaText && (
<div class="van-sku__quota">{this.quotaText}</div>
)}
</div> </div>
); );
} }

View File

@ -1,6 +1,7 @@
import Sku from './Sku'; import Sku from './Sku';
import SkuActions from './components/SkuActions'; import SkuActions from './components/SkuActions';
import SkuHeader from './components/SkuHeader'; import SkuHeader from './components/SkuHeader';
import SkuHeaderItem from './components/SkuHeaderItem';
import SkuMessages from './components/SkuMessages'; import SkuMessages from './components/SkuMessages';
import SkuStepper from './components/SkuStepper'; import SkuStepper from './components/SkuStepper';
import SkuRow from './components/SkuRow'; import SkuRow from './components/SkuRow';
@ -10,6 +11,7 @@ import constants from './constants';
Sku.SkuActions = SkuActions; Sku.SkuActions = SkuActions;
Sku.SkuHeader = SkuHeader; Sku.SkuHeader = SkuHeader;
Sku.SkuHeaderItem = SkuHeaderItem;
Sku.SkuMessages = SkuMessages; Sku.SkuMessages = SkuMessages;
Sku.SkuStepper = SkuStepper; Sku.SkuStepper = SkuStepper;
Sku.SkuRow = SkuRow; Sku.SkuRow = SkuRow;

View File

@ -3,6 +3,10 @@
.van-sku { .van-sku {
&-container { &-container {
display: flex;
flex-direction: column;
align-items: stretch;
height: 70%;
max-height: max-content; /* avoid androiod keyboard cover fields */ max-height: max-content; /* avoid androiod keyboard cover fields */
overflow-y: visible; overflow-y: visible;
font-size: 14px; font-size: 14px;
@ -10,6 +14,7 @@
} }
&-body { &-body {
flex: 1 1 auto;
max-height: 350px; max-height: 350px;
overflow-y: scroll; overflow-y: scroll;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
@ -26,11 +31,11 @@
&__img-wrap { &__img-wrap {
position: relative; position: relative;
float: left; float: left;
width: 80px; width: 96px;
height: 80px; height: 96px;
margin-top: -10px; margin: 12px 0 12px;
background: @background-color; background: @background-color;
border-radius: 2px; border-radius: 4px;
img { img {
position: absolute; position: absolute;
@ -45,37 +50,51 @@
} }
&__goods-info { &__goods-info {
box-sizing: border-box; min-height: 96px;
min-height: 82px; padding: 12px 36px 12px 8px;
padding: 10px 60px 10px 10px;
overflow: hidden; overflow: hidden;
} }
} }
&__goods-name { &-header-item {
margin-top: 8px;
color: @gray-dark;
font-size: 12px; font-size: 12px;
line-height: 16px;
} }
&__price-symbol { &__price-symbol {
vertical-align: middle; font-size: 16px;
vertical-align: text-bottom;
} }
&__price-num { &__price-num {
font-size: 16px; font-weight: 500;
font-size: 22px;
vertical-align: middle; vertical-align: middle;
} }
&__goods-price { &__goods-price {
margin-top: 10px;
color: @red; color: @red;
}
&__price-tag {
display: inline-block;
margin-left: 8px;
padding: 0 5px;
color: @red;
font-size: 12px;
line-height: 16px;
vertical-align: middle; vertical-align: middle;
background-color: @sku-price-tag-color;
border-radius: 8px;
} }
&__close-icon { &__close-icon {
position: absolute; position: absolute;
top: 10px; top: 12px;
right: 15px; right: 15px;
color: @gray-dark; color: @sku-icon-gray-color;
font-size: 20px; font-size: 20px;
text-align: center; text-align: center;
} }
@ -93,40 +112,53 @@
/* sku row */ /* sku row */
&-row { &-row {
margin: 0 15px 10px 0; margin: 0 3px 12px 0;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
&__title { &__title {
padding-bottom: 10px; padding-bottom: 12px;
} }
&__item { &__item {
display: inline-block; display: inline-flex;
box-sizing: border-box; align-items: center;
min-width: 52px; justify-content: center;
height: 28px; min-width: 40px;
margin: 0 10px 10px 0; margin: 0 12px 12px 0;
padding: 5px 9px;
color: @text-color; color: @text-color;
font-size: 12px; font-size: 13px;
line-height: 16px; line-height: 16px;
text-align: center; vertical-align: middle;
border: 1px solid @gray-dark; background: @sku-item-background-color;
border-radius: 3px; border-radius: 4px;
&-img {
width: 24px;
height: 24px;
margin: 4px 0 4px 4px;
object-fit: cover;
border-radius: 2px;
}
&-name {
padding: 8px;
}
&--active { &--active {
color: @white; color: @red;
background: @red; background: @sku-item-active-background-color;
border-color: @red;
} }
&--disabled { &--disabled {
color: @gray; color: @gray;
background: @active-color; background: @active-color;
border-color: @border-color;
.van-sku-row__item-img {
opacity: .3;
}
} }
} }
} }
@ -176,6 +208,7 @@
} }
.van-cell__value { .van-cell__value {
overflow: visible;
text-align: left; text-align: left;
} }
} }
@ -184,35 +217,23 @@
&-img-uploader { &-img-uploader {
display: inline-block; display: inline-block;
&__header { &__uploader {
padding: 0 10px; vertical-align: middle;
color: @text-color;
font-size: 12px;
line-height: 24px;
border: 1px solid @border-color;
border-radius: 3px;
.van-icon {
top: 3px;
margin-right: 5px;
font-size: 14px;
}
} }
&__img { &__img {
position: relative; position: relative;
float: left; float: left;
width: 60px; width: 64px;
height: 60px; height: 64px;
margin: 10px 10px 0 0; margin-right: 8px;
border: 1px solid @border-color; background: @sku-item-background-color;
border-radius: 2px;
img { img {
position: relative; width: 100%;
top: 50%; height: 100%;
max-width: 100%; object-fit: contain;
max-height: 100%;
transform: translateY(-50%);
} }
} }
@ -222,7 +243,8 @@
right: -14px; right: -14px;
z-index: 1; z-index: 1;
padding: 6px; padding: 6px;
color: @red; color: @sku-upload-mask-color;
opacity: .8;
&::before { &::before {
background-color: @white; background-color: @white;
@ -230,15 +252,33 @@
} }
} }
&__uploading { &__mask {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0;
bottom: 0;
left: 0; left: 0;
width: 20px; display: flex;
height: 20px; flex-direction: column;
margin: auto; align-items: center;
justify-content: center;
width: 100%;
height: 100%;
color: white;
background: @sku-upload-mask-color;
}
&__warn-text {
margin-top: 6px;
font-size: 12px;
line-height: 14px;
}
&__trigger {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
color: @sku-icon-gray-color;
} }
} }

View File

@ -651,3 +651,10 @@
@uploader-file-icon-color: @gray-darker; @uploader-file-icon-color: @gray-darker;
@uploader-file-name-font-size: @font-size-sm; @uploader-file-name-font-size: @font-size-sm;
@uploader-file-name-text-color: @gray-darker; @uploader-file-name-text-color: @gray-darker;
// Sku
@sku-price-tag-color: rgba(227, 20, 54, .1);
@sku-item-background-color: #f7f8fa;
@sku-item-active-background-color: rgba(227, 20, 54, .1);
@sku-icon-gray-color: #dcdde0;
@sku-upload-mask-color: rgba(50, 50, 51, .8);