|
@@ -81,7 +81,7 @@
|
|
|
</block>
|
|
|
<view class="grace-margin-top"><text class="grace-title">购买数量</text></view>
|
|
|
<view style="margin-bottom: 40rpx;">
|
|
|
- <graceNumberBox :value="buyNum" v-on:change="buyNumChange"></graceNumberBox>
|
|
|
+ <graceNumberBox :minNum="1" :maxNum="kuNum" :value="buyNum" v-on:change="buyNumChange"></graceNumberBox>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
<view class="grace-product-attr-btn">
|
|
@@ -183,7 +183,7 @@ export default {
|
|
|
if (res.confirm) {
|
|
|
if (this.item.goods.type == 2 || this.item.goods.type == 4) {
|
|
|
this.copy(this.item.goods.code);
|
|
|
- this.Dever.alert('已复制,请打开' + name + 'APP即可看到该商品');
|
|
|
+ this.Dever.alert('已复制,请打开' + name + 'APP即可购买该商品');
|
|
|
} else {
|
|
|
this.Dever.location(this.item.goods.link);
|
|
|
}
|
|
@@ -211,13 +211,9 @@ export default {
|
|
|
this.getAttrKey();
|
|
|
},
|
|
|
// 购买数量变化
|
|
|
- buyNumChange : function (e) {
|
|
|
- var price = this.getAttrKey();
|
|
|
- if (price) {
|
|
|
- console.info(this.buyNum);
|
|
|
- this.buyNum = e[0];
|
|
|
- this.payPrice = parseFloat(price) * this.buyNum;
|
|
|
- }
|
|
|
+ buyNumChange : function (e) {
|
|
|
+ this.buyNum = e[0];
|
|
|
+ this.getAttrKey();
|
|
|
},
|
|
|
// 属性提交
|
|
|
attrSubmit : function(e) {
|
|
@@ -227,13 +223,16 @@ export default {
|
|
|
icon:"none"
|
|
|
});
|
|
|
var data = {};
|
|
|
- data.goods = this.item.goods.id;
|
|
|
+ data.goods_id = this.item.goods.id;
|
|
|
data.price = this.payPrice;
|
|
|
data.num = this.buyNum;
|
|
|
data.sku = this.skuId;
|
|
|
console.log(data);
|
|
|
//如果想关闭属性
|
|
|
//this.closeAttr();
|
|
|
+ this.Dever.post('app/collection/?l=pay.product', data, function(t) {
|
|
|
+ console.info(t);
|
|
|
+ });
|
|
|
},
|
|
|
// 获取属性key
|
|
|
getAttrKey : function() {
|
|
@@ -245,19 +244,12 @@ export default {
|
|
|
|
|
|
if (this.item.goods.price_type == 1) {
|
|
|
this.kuNum = parseInt(this.item.goods.num);
|
|
|
-
|
|
|
- if (this.buyNum >= this.kuNum) {
|
|
|
- return false;
|
|
|
- }
|
|
|
this.skuId = 0;
|
|
|
- return this.item.goods.price.min.price;
|
|
|
+ this.payPrice = parseFloat(this.item.goods.price.min.price) * this.buyNum;
|
|
|
} else if (this.item.goods.price_type == 2 && this.item.goods.price.list[this.attrKey]) {
|
|
|
this.kuNum = parseInt(this.item.goods.price.list[this.attrKey].num);
|
|
|
- if (this.buyNum >= this.kuNum) {
|
|
|
- return false;
|
|
|
- }
|
|
|
this.skuId = this.item.goods.price.list[this.attrKey].id;
|
|
|
- return this.item.goods.price.list[this.attrKey].price;
|
|
|
+ this.payPrice = parseFloat(this.item.goods.price.list[this.attrKey].price) * this.buyNum;
|
|
|
}
|
|
|
|
|
|
return true;
|