|
@@ -33,11 +33,13 @@
|
|
|
|
|
|
<view class="introduce-section">
|
|
|
<text class="title" v-if="goodsType == 1">{{ goodsObjact.title }}</text>
|
|
|
- <view class="price-box" v-if="goodsType == 0">
|
|
|
- <text class="price-tip">¥</text>
|
|
|
- <text class="price">{{ goodsObjact.price }}</text>
|
|
|
- <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text>
|
|
|
- <!-- <text class="coupon-tip">7折</text> -->
|
|
|
+ <view class="price-box" v-if="goodsType == 0">
|
|
|
+ <text class="price-tip">¥</text>
|
|
|
+ <text class="price">{{ goodsObjact.price }}</text>
|
|
|
+ <text class="price-tip" v-if="goodsObjact.max_use_integral*1 > 0">+</text>
|
|
|
+ <text class="price" v-if="goodsObjact.max_use_integral*1 > 0">{{ goodsObjact.max_use_integral }}积分</text>
|
|
|
+ <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text>
|
|
|
+ <!-- <text class="coupon-tip">7折</text> -->
|
|
|
</view>
|
|
|
<text class="title" v-if="goodsType == 0">{{ goodsObjact.store_name }}</text>
|
|
|
<view class="bot-row">
|
|
@@ -95,16 +97,10 @@
|
|
|
<text class="selected-text">{{ goodsObjact.num + goodsObjact.unit_name }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- <view class="c-row b-b">
|
|
|
- <text class="tit">优惠券</text>
|
|
|
- <text class="con t-r red">领取优惠券</text>
|
|
|
- <text class="iconfont iconenter"></text>
|
|
|
- </view> -->
|
|
|
- <view class="c-row b-b" v-if="goodsObjact.max_use_integral != 0 ">
|
|
|
- <text class="tit">积分</text>
|
|
|
- <view class="bz-list con">
|
|
|
- <text>最高抵扣¥{{ moneyNum(goodsObjact.max_use_integral) == 0 ? moneyNum(goodsObjact.price) : moneyNum(goodsObjact.max_use_integral) }}</text>
|
|
|
- </view>
|
|
|
+ <view class="c-row b-b" v-if="goodsObjact.give_integral != 0">
|
|
|
+ <text class="tit">获取积分</text>
|
|
|
+ <text class="con t-r red">每购买一件商品送{{goodsObjact.give_integral}}积分</text>
|
|
|
+ <!-- <text class="iconfont iconenter"></text> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="shop-box flex" v-if="goodsType == 0 && shopId > 0">
|
|
@@ -133,10 +129,13 @@
|
|
|
<text class="iconfont " :class="{ iconlike: !goodsObjact.userCollect, iconlikefill: goodsObjact.userCollect }"></text>
|
|
|
<text>收藏</text>
|
|
|
</view>
|
|
|
-
|
|
|
- <view class="action-btn-group">
|
|
|
- <button type="primary" class=" action-btn no-border buy-now-btn" @click="toggleSpec(2)">加入购物车</button>
|
|
|
- <button type="primary" class=" action-btn no-border add-cart-btn" @click="toggleSpec(1)">立即购买</button>
|
|
|
+
|
|
|
+ <view class="action-btn-group" v-if="goodsObjact.max_use_integral == 0">
|
|
|
+ <button type="primary" class=" action-btn no-border buy-now-btn" @click="toggleSpec(2)">加入购物车</button>
|
|
|
+ <button type="primary" class=" action-btn no-border add-cart-btn" @click="toggleSpec(1)">立即购买</button>
|
|
|
+ </view>
|
|
|
+ <view class="action-btn-group" v-if="goodsObjact.max_use_integral != 0">
|
|
|
+ <button type="primary" class=" action-btn no-border add-cart-btn" style="width: 750rpx;" @click="toggleSpec(1)">立即购买</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 秒杀商品购买 -->
|
|
@@ -164,7 +163,8 @@
|
|
|
<image :src="actionImage"></image>
|
|
|
<view class="right">
|
|
|
<view class="good-name clamp">{{goodsObjact.store_name}}</view>
|
|
|
- <text class="price">¥{{ actionPrice }}</text>
|
|
|
+ <text class="price" v-if="goodsObjact.max_use_integral > 0">¥{{ actionPrice }}+{{goodsObjact.max_use_integral*1}}积分</text>
|
|
|
+ <text class="price" v-else>¥{{ actionPrice }}</text>
|
|
|
<!-- <text class="stock">库存:{{ goodsObjact.stock }}件</text> -->
|
|
|
<!-- <view class="selected" v-if="goodsType == 0">
|
|
|
已选:
|
|
@@ -244,7 +244,8 @@ export default {
|
|
|
specList: [],
|
|
|
// 对比对象
|
|
|
productValue: [],
|
|
|
- actionPrice: 0, //默认选中商品价格
|
|
|
+ actionPrice: 0, //默认选中商品价格
|
|
|
+ actionIntegral: 0,//默认选中商品积分
|
|
|
actionImage: '', //默认选中图片
|
|
|
uniqueId: '', //选中的商品分类
|
|
|
specSelected: [], //选中的分类
|
|
@@ -458,28 +459,47 @@ export default {
|
|
|
// 获取商品信息
|
|
|
goodsDetail() {
|
|
|
let obj = this;
|
|
|
- goodsDetail({}, this.goodsid).then(function({ data }) {
|
|
|
- obj.details = data;
|
|
|
+ goodsDetail({}, this.goodsid).then(function({ data }) {
|
|
|
+ obj.details = data;
|
|
|
let goods = data.storeInfo;
|
|
|
- let store_info = data.system_store// 保存店铺信息
|
|
|
- console.log(store_info)
|
|
|
+ let store_info = data.system_store; // 保存店铺信息
|
|
|
+ console.log(store_info);
|
|
|
obj.storeObjact = store_info;
|
|
|
- obj.goodsObjact = goods;
|
|
|
- obj.reply = data.reply; //保存评论列表
|
|
|
- obj.imgList = goods.slider_image; //保存轮播图
|
|
|
- obj.specList = data.productAttr; //保存分类列表
|
|
|
- obj.productValue = data.productValue; //保存分类查询数据
|
|
|
- obj.actionPrice = goods.price; //保存默认选中商品价格
|
|
|
- obj.actionImage = goods.image_base; //保存默认选中商品价格
|
|
|
- obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
|
|
|
- obj.shopId = data.mer_id; //保存商店id
|
|
|
- if (obj.shopId > 0) {
|
|
|
- obj.getShoping();
|
|
|
- }
|
|
|
- // #ifdef H5
|
|
|
+ obj.goodsObjact = goods;
|
|
|
+ //商品详情图超出屏幕问题
|
|
|
+ if (obj.goodsObjact.description != null) {
|
|
|
+ obj.goodsObjact.description = obj.goodsObjact.description.replace(/<img/g, '<img class="rich-img"').replace(/<p>\s*<img/g, '<p class="pHeight"><img');
|
|
|
+ }
|
|
|
+ if ( obj.goodsObjact.rule != null ) {
|
|
|
+ obj.goodsObjact.rule ='<p>' + obj.goodsObjact.rule.replace(/\n/g, '</p><p>').trim() + '</p>'
|
|
|
+ }
|
|
|
+ obj.reply = data.reply; //保存评论列表
|
|
|
+ obj.imgList = goods.slider_image; //保存轮播图
|
|
|
+ obj.specList = data.productAttr; //保存分类列表
|
|
|
+ console.log(data.productAttr);
|
|
|
+ obj.productValue = data.productValue; //保存分类查询数据
|
|
|
+ obj.actionPrice = goods.price; //保存默认选中商品价格
|
|
|
+ obj.actionIntegral = goods.integral; //保存默认选中商品积分
|
|
|
+ obj.actionImage = goods.image_base; //保存默认选中商品价格
|
|
|
+ obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
|
|
|
+ obj.shopId = data.mer_id; //保存商店id
|
|
|
+ // 保存默认选中的对象
|
|
|
+ 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;
|
|
|
+ // #ifdef H5
|
|
|
obj.shareDate();
|
|
|
- obj.IndexShare()
|
|
|
- // #endif
|
|
|
+ // #endif
|
|
|
});
|
|
|
},
|
|
|
// #ifdef H5
|
|
@@ -535,7 +555,8 @@ export default {
|
|
|
if (this.productValue[str]) {
|
|
|
let data = this.productValue[str];
|
|
|
this.actionPrice = data.price;
|
|
|
- this.goodsNumberMax = data.stock;
|
|
|
+ this.goodsNumberMax = data.stock;
|
|
|
+ this.actionIntegral = data.integral
|
|
|
this.actionImage = data.image;
|
|
|
this.uniqueId = data.unique;
|
|
|
}
|