dever 5 年之前
父节点
当前提交
e7993eaabe
共有 1 个文件被更改,包括 19 次插入5 次删除
  1. 19 5
      pages/dream/view/product.vue

+ 19 - 5
pages/dream/view/product.vue

@@ -75,7 +75,7 @@
 					</view>
 					<!-- 属性列表区 -->
 					<scroll-view style="height:700rpx;" scroll-y>
-						<block v-for="(v, k) in item.goods.sell_attr" :key="k">
+						<block v-for="(v, k) in item.goods.sell_attr" :key="k" v-if="item.goods.price_type == 2">
 							<view class="grace-title grace-margin-top">{{v.name}}</view>
 							<view><graceSelectTags selectedColor="#FF0036" :items="v.option_sku" type="radio" @change="change"></graceSelectTags></view>
 						</block>
@@ -238,11 +238,25 @@ export default {
 				key.push(this.attrSelect[i]);
 			}
 			this.attrKey = key.join('_');
-			
-			if (this.item.goods.price.list[this.attrKey]) {
+			
+			if (this.item.goods.price_type == 1) {
+				this.kuNum = parseInt(this.item.goods.num);
+				
+				if (this.buyNum > this.kuNum) {
+					this.buyNum = this.kuNum;
+					console.info(this.buyNum);
+					return false;
+				}
+				
+				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) {
+					this.buyNum = this.kuNum;
+					return false;
+				}
+				this.skuId = this.item.goods.price.list[this.attrKey].id;
 				this.payPrice = parseFloat(this.item.goods.price.list[this.attrKey].price) * this.buyNum;
-				this.kuNum = this.item.goods.price.list[this.attrKey].num;
-				this.skuId = this.item.goods.price.list[this.attrKey].id;
 			}
 		},
 		showModal : function() {