Authored by Aiden Xu

商品详情

... ... @@ -23,6 +23,12 @@ class Loading {
this.settings = Object.assign({}, this.defaults, opts);
this.elem = $(template());
this.overlay = new Overlay({
animation: 'fade',
clickToClose: false
});
}
... ... @@ -37,10 +43,6 @@ class Loading {
this.elem.appendTo('body');
}
this.overlay = new Overlay({
animation: 'fade',
clickToClose: false
});
this.overlay.show();
}
}
... ...
... ... @@ -108,7 +108,10 @@ class Overlay {
});
}
this._cleanup();
setTimeout(()=> {
this._cleanup();
}, 200);
this.isVisible = false;
this.settings.onClose();
}
... ...
... ... @@ -20,6 +20,7 @@
height: 88px;
min-height: inherit;
margin-right: 20px;
margin-top: 20px;
}
</style>
<script>
... ...
... ... @@ -22,7 +22,7 @@
<feature-options name="size" :options="sizes" :selection="selection.size"></feature-options>
</section>
<button @click="addToCart()"
class="button button-solid add-to-cart">{{config.btnTxt || '加入购物袋'}}
class="button button-solid add-to-cart">{{buttonText || '加入购物袋'}}
</button>
</div>
</div>
... ... @@ -31,7 +31,7 @@
.feature-selector {
background: #fff;
width: 100%;
height: 608px;
min-height: 608px;
bottom: 0;
position: fixed;
padding: 20px 30px;
... ... @@ -80,6 +80,7 @@
margin-top: 30px;
margin-bottom: 0;
padding: 0;
max-width: 600px;
}
li {
... ... @@ -141,20 +142,11 @@
*/
onAddToCart: Function,
config: Object
buttonText: String
},
watch: {
isVisible() {
const self = this;
if (this.isVisible) {
this.overlay = new Overlay({
disableScrolling: false,
onClose: function() {
self.isVisible = false;
}
});
this.overlay.show();
} else {
this.overlay.hide();
... ... @@ -235,6 +227,15 @@
featureOptions: require('./feature-options.vue')
},
created() {
const self = this;
this.overlay = new Overlay({
disableScrolling: false,
onClose: function() {
self.isVisible = false;
}
});
// 选择颜色
this.$on('feature:color.select', (opt)=> {
const selection = {
... ... @@ -297,6 +298,12 @@
}
this.onAddToCart(this.selection, this.entity.pid);
},
getSelection() {
return {
};
}
}
};
... ...
... ... @@ -414,7 +414,7 @@
*/
onAddToCart: (selection)=> {
$.post('/product/cart.json', {
productSku: selection.size,
productSku: selection.sizeId,
buyNumber: 1
}).then((result)=> {
// TODO: 库存不足 后台暂未实现
... ... @@ -426,7 +426,7 @@
this.showFeatureSelector = false;
tip('系统异常,请稍后重试');
}
});
});
}
};
},
... ...