|
|
@@ -99,7 +99,7 @@
|
|
|
<text>{{ item.attr_name }}</text>
|
|
|
<view class="item-list">
|
|
|
<text v-for="(childItem, childIndex) in item.attr_value" :key="childIndex" class="tit"
|
|
|
- :class="{ selected: childItem.check }" @click="selectSpec(childItem, item, index)">
|
|
|
+ :class="{ selected: childItem.check }" @click="suk ? '':selectSpec(childItem, item, index)">
|
|
|
{{ childItem.attr }}
|
|
|
</text>
|
|
|
</view>
|
|
|
@@ -162,6 +162,9 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ suk: '',
|
|
|
+ stock: 0,
|
|
|
+ uid: '',
|
|
|
isfg: 0,
|
|
|
details: '',
|
|
|
reply: '', //评论
|
|
|
@@ -215,6 +218,7 @@
|
|
|
is_bk: 0,
|
|
|
is_xf: 0,
|
|
|
goodIntegral: 0, //需要使用的积分
|
|
|
+ spread: '',
|
|
|
};
|
|
|
},
|
|
|
async onLoad(options) {
|
|
|
@@ -228,13 +232,23 @@
|
|
|
if (options.is_xf) {
|
|
|
obj.is_xf = options.is_xf
|
|
|
}
|
|
|
+ if(options.suk) {
|
|
|
+ this.suk = options.suk
|
|
|
+ }
|
|
|
+ if(options.stock) {
|
|
|
+ this.stock = options.stock
|
|
|
+ }
|
|
|
//保存商品id
|
|
|
this.goodsid = options.id;
|
|
|
// 判断有无人邀请
|
|
|
if (options.spread) {
|
|
|
+ this.spread = options.spread
|
|
|
// 存储邀请人
|
|
|
uni.setStorageSync('spread', options.spread);
|
|
|
}
|
|
|
+ if(options.uid) {
|
|
|
+ this.uid = options.uid
|
|
|
+ }
|
|
|
// 判断是否为秒杀商品
|
|
|
if (options.type == 1) {
|
|
|
// 保存商品类型
|
|
|
@@ -323,6 +337,9 @@
|
|
|
obj.actionPrice = goods.price;
|
|
|
obj.actionImage = goods.image_base; //保存默认选中商品价格
|
|
|
obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
|
|
|
+ if(obj.suk) {
|
|
|
+ obj.goodsNumberMax = Number(obj.stock); //保存默认选中最大可购买商品数量
|
|
|
+ }
|
|
|
obj.shopId = data.mer_id; //保存商店id
|
|
|
console.log(obj.goodsObjact.is_pack, 'v');
|
|
|
if (obj.goodsObjact.is_pack == 1 || obj.goodsObjact.is_one == 1) {
|
|
|
@@ -333,21 +350,33 @@
|
|
|
obj.shareDate();
|
|
|
// #endif
|
|
|
// 保存默认选中的对象
|
|
|
- obj.specSelected = []; //初始化默认选择对象
|
|
|
- for (let i = 0; i < obj.specList.length; i++) {
|
|
|
- // 设置默认数据
|
|
|
- let attrValue = obj.specList[i].attr_value[0];
|
|
|
- attrValue.check = true;
|
|
|
- obj.specSelected.push(attrValue.attr);
|
|
|
+
|
|
|
+ if(obj.suk) {
|
|
|
+ let arr = obj.suk.split(',')
|
|
|
+ arr.forEach((item,index) => {
|
|
|
+ obj.selectSpec({attr: item,check: true},obj.specList[index],index)
|
|
|
+ })
|
|
|
+ obj.actionImage = obj.productValue[obj.suk].image;
|
|
|
+ obj.uniqueId = obj.productValue[obj.suk].unique;
|
|
|
+ obj.goodIntegral = obj.productValue[obj.suk].integral
|
|
|
+ }else {
|
|
|
+ obj.specSelected = []; //初始化默认选择对象
|
|
|
+ for (let i = 0; i < obj.specList.length; i++) {
|
|
|
+ // 设置默认数据
|
|
|
+ let attrValue = obj.specList[i].attr_value[0];
|
|
|
+ attrValue.check = true;
|
|
|
+ obj.specSelected.push(attrValue.attr);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存默认选中的对象字符串名称
|
|
|
+ let str = obj.specSelected.join(',');
|
|
|
+
|
|
|
+ // 设置默认值
|
|
|
+ obj.actionImage = obj.productValue[str].image;
|
|
|
+ obj.uniqueId = obj.productValue[str].unique;
|
|
|
+ obj.goodIntegral = obj.productValue[str].integral
|
|
|
}
|
|
|
|
|
|
- //保存默认选中的对象字符串名称
|
|
|
- let str = obj.specSelected.join(',');
|
|
|
- // 设置默认值
|
|
|
- obj.actionImage = obj.productValue[str].image;
|
|
|
- obj.uniqueId = obj.productValue[str].unique;
|
|
|
- obj.goodIntegral = obj.productValue[str].integral
|
|
|
-
|
|
|
|
|
|
});
|
|
|
},
|
|
|
@@ -394,9 +423,13 @@
|
|
|
},
|
|
|
//选择规格
|
|
|
selectSpec(item, arr, ind) {
|
|
|
+ console.log(item, arr, ind,'++++++++++');
|
|
|
let obj = this
|
|
|
arr.attr_value.forEach(function(e) {
|
|
|
e.check = false;
|
|
|
+ if(obj.suk && e.attr == obj.suk) {
|
|
|
+ e.check = true;
|
|
|
+ }
|
|
|
});
|
|
|
item.check = true;
|
|
|
this.specSelected[ind] = item.attr;
|
|
|
@@ -419,6 +452,9 @@
|
|
|
if (obj.goodsObjact.is_pack == 1 || obj.goodsObjact.is_one == 1) {
|
|
|
this.goodsNumberMax = 1;
|
|
|
}
|
|
|
+ if(obj.suk) {
|
|
|
+ this.goodsNumberMax = Number(obj.stock);
|
|
|
+ }
|
|
|
},
|
|
|
//分享
|
|
|
share() {
|
|
|
@@ -503,7 +539,7 @@
|
|
|
// 跳转到支付页
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/order/createOrder?id=' + data.cartId + '&goodsType=' + obj
|
|
|
- .goodsType + '&is_pick=' + obj.goodsObjact.is_pick + '&store_id=' + (obj.storeObjact.id || 0)
|
|
|
+ .goodsType + '&is_pick=' + obj.goodsObjact.is_pick + '&store_id=' + (obj.storeObjact.id || 0) + '&uid=' + (obj.uid || obj.spread) + '&isjxs=' + (obj.suk ? 1: 0)
|
|
|
});
|
|
|
}
|
|
|
if (obj.type == 2) {
|