|
|
@@ -26,7 +26,22 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 标题 -->
|
|
|
- <product-content :goodsObjact="goodsObjact" v-if="!isSckill"></product-content>
|
|
|
+ <view class="introduce-section" v-if="!isSckill">
|
|
|
+
|
|
|
+ <button open-type="share" class="shareDate" style="border: none;">
|
|
|
+ <image class="share-img" src="../../static/icon/share.png"></image>
|
|
|
+ </button>
|
|
|
+ <view class="price-box">
|
|
|
+ <text class="price-tip">¥</text>
|
|
|
+ <view class="price">
|
|
|
+ {{ goodInfo.price }}
|
|
|
+ <text class="m-price" v-if="goodInfo.ot_price*1 > goodInfo.price*1">¥{{ goodInfo.ot_price }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <text class="title clamp2" v-if="goodInfo.title">{{ goodInfo.title }}</text>
|
|
|
+ <text class="title clamp2" v-else>{{ goodInfo.store_name }}</text>
|
|
|
+ </view>
|
|
|
+ <product-content :goodsObjact="goodInfo"</product-content>
|
|
|
<view class="good-title clamp2" v-if="isSckill">{{ sckillGoodInfo.title }}</view>
|
|
|
<!-- 选择数量 -->
|
|
|
<!-- <view class="row b-b">
|
|
|
@@ -108,7 +123,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { goodsDetail, cartAdd, seckillGoods, getSeckillProductDetail, getStoreDetail } from '@/api/product.js';
|
|
|
+import { goodsDetail, cartAdd, seckillGoods, getSeckillProductDetail, getStoreDetail ,getProductDetail} from '@/api/product.js';
|
|
|
import { mapState } from 'vuex';
|
|
|
import store from '@/store/index.js';
|
|
|
import { saveUrl } from '@/utils/loginUtils.js';
|
|
|
@@ -207,7 +222,8 @@ export default {
|
|
|
product_id: 0,
|
|
|
sckillGoodInfo: {}, //秒杀商品信息
|
|
|
shopInfo: {}, //店铺信息
|
|
|
- product_type: 0
|
|
|
+ product_type: 0,
|
|
|
+ goodInfo: {}
|
|
|
};
|
|
|
},
|
|
|
filters: {
|
|
|
@@ -228,7 +244,7 @@ export default {
|
|
|
obj.userInfo = uni.getStorageSync('userInfo');
|
|
|
//保存商品id
|
|
|
this.goodsid = options.id;
|
|
|
- this.getGoodsDetails();
|
|
|
+
|
|
|
this.product_id = options.id;
|
|
|
this.goodsType = options.type;
|
|
|
// 判断有无人邀请
|
|
|
@@ -249,6 +265,9 @@ export default {
|
|
|
// }
|
|
|
if (options.type === '1') {
|
|
|
obj.isSckill = true;
|
|
|
+ this.getGoodsDetails();
|
|
|
+ }else if(options.type === '0' ){
|
|
|
+ this.getProductDetail()
|
|
|
}
|
|
|
// 注册邀请信息
|
|
|
// #ifdef H5
|
|
|
@@ -491,7 +510,7 @@ export default {
|
|
|
// };
|
|
|
let is_new = 0
|
|
|
if(obj.type == 1){
|
|
|
- is_new = 1
|
|
|
+ is_new = 0
|
|
|
}
|
|
|
let data = {
|
|
|
product_id: goodId,
|
|
|
@@ -501,9 +520,6 @@ export default {
|
|
|
is_new: is_new
|
|
|
}
|
|
|
console.log("立即购买++++++",data);
|
|
|
- if (obj.type == 2) {
|
|
|
- data.new = 0;
|
|
|
- }
|
|
|
cartAdd(data)
|
|
|
.then(function(e) {
|
|
|
console.log(e,"立即购买++++++fanhui")
|
|
|
@@ -521,7 +537,7 @@ export default {
|
|
|
duration: 2000,
|
|
|
icon: 'none'
|
|
|
});
|
|
|
- obj.getGoodsDetails();
|
|
|
+ obj.getProductDetail();
|
|
|
}
|
|
|
obj.toggleSpec();
|
|
|
})
|
|
|
@@ -543,6 +559,7 @@ export default {
|
|
|
// getTime() {
|
|
|
// let start = new data()
|
|
|
// }
|
|
|
+ // 获取秒杀商品信息
|
|
|
getGoodsDetails() {
|
|
|
let obj = this;
|
|
|
getSeckillProductDetail({}, this.goodsid).then(({ data }) => {
|
|
|
@@ -600,6 +617,67 @@ export default {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ getProductDetail() {
|
|
|
+ let obj = this
|
|
|
+ getProductDetail(this.goodsid,{}).then(({data})=> {
|
|
|
+ console.log(data,"putong+++++++++++++++")
|
|
|
+ // console.log(data, 'goodInfo6666666666666');
|
|
|
+ obj.imgList = data.slider_image; //保存轮播图
|
|
|
+ obj.goodInfo.title = data.store_name; //保存商品名称
|
|
|
+ obj.goodInfo.price = data.price; //保存商品展示价格
|
|
|
+ obj.goodInfo.ot_price = data.ot_price; //保存商品市场价
|
|
|
+ console.log(obj.goodInfo,'goodInfo++++++++++++++')
|
|
|
+ // this.$forceUpdate()
|
|
|
+ obj.stopTimes = timeComputed(data.stop * 1000); //设置结束时间
|
|
|
+ obj.product_type = data.product_type//保存商品类型
|
|
|
+ //小程序商品详情图超出屏幕问题
|
|
|
+ if (data.content.content !== null) {
|
|
|
+ obj.description = data.content.content.replace(/\<img/gi, '<img class="rich-img"');
|
|
|
+ }
|
|
|
+ //获取保存店铺详细信息
|
|
|
+ getStoreDetail(data.mer_id).then(({ data }) => {
|
|
|
+ console.log(data, 'shop data');
|
|
|
+ obj.shopInfo = data;
|
|
|
+ });
|
|
|
+ // 获取商品属性
|
|
|
+ obj.specList = data.attr; //保存分类列表
|
|
|
+ if (data.attr.length != 0) {
|
|
|
+ console.log("有好多属性")
|
|
|
+ obj.many = 2;
|
|
|
+ obj.specList = data.attr; //保存产品属性
|
|
|
+ obj.productValue = data.sku; //保存属性值
|
|
|
+ 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(',');
|
|
|
+ console.log(str, 'str');
|
|
|
+ // 设置默认值
|
|
|
+ obj.actionPrice = obj.productValue[str].price;
|
|
|
+ obj.goodsNumberMax = obj.productValue[str].stock;
|
|
|
+ obj.actionImage = obj.productValue[str].image;
|
|
|
+ obj.uniqueId = obj.productValue[str].unique;
|
|
|
+ obj.goodsStore = obj.productValue[str].stock;
|
|
|
+ } else {
|
|
|
+ console.log("zhiyou yige shuxing")
|
|
|
+ obj.many = 1;
|
|
|
+
|
|
|
+ obj.productValue = data.sku[''];
|
|
|
+ console.log(obj.productValue,'obj.productValue11111111111')//保存分类查询数据
|
|
|
+ obj.actionPrice =obj.productValue.price; //保存默认选中商品价格
|
|
|
+ obj.actionImage = obj.productValue.image; //保存默认选中商品图片
|
|
|
+ obj.goodsNumberMax = data.stock; //保存默认选中最大可购买商品数量
|
|
|
+ // obj.shopId = data.mer_id; //保存商店id
|
|
|
+ obj.goodsStore = data.stock
|
|
|
+ obj.uniqueId = obj.productValue.unique
|
|
|
+ console.log(obj.uniqueId)
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -978,4 +1056,95 @@ page {
|
|
|
font-weight: 800;
|
|
|
color: #333333;
|
|
|
}
|
|
|
+.introduce-section {
|
|
|
+ position: relative;
|
|
|
+ background: #fff;
|
|
|
+ padding: 35rpx 0rpx;
|
|
|
+ padding-left: 20rpx;
|
|
|
+ .title {
|
|
|
+ font-size: 32rpx;
|
|
|
+ color: $font-color-dark;
|
|
|
+ padding-right: 34rpx;
|
|
|
+ .tip-o {
|
|
|
+ color: #ff3334;
|
|
|
+ padding-left: 15rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .shareDate {
|
|
|
+ position: absolute;
|
|
|
+ top: 25rpx;
|
|
|
+ right: 10rpx;
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: #3d3f46;
|
|
|
+ border-radius: 15rpx;
|
|
|
+ background-color: #ffffff;
|
|
|
+ height: 60rpx;
|
|
|
+ line-height: 60rpx;
|
|
|
+ &::after {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .share-img {
|
|
|
+ width: 30rpx;
|
|
|
+ height: 30rpx;
|
|
|
+ position: relative;
|
|
|
+ top: 5rpx;
|
|
|
+ left: 0;
|
|
|
+ margin-right: 10rpx;
|
|
|
+ }
|
|
|
+ .info {
|
|
|
+ color: #999999;
|
|
|
+ font-size: 26rpx;
|
|
|
+ padding-bottom: 15rpx;
|
|
|
+ }
|
|
|
+ .progress-box {
|
|
|
+ width: 260rpx;
|
|
|
+ position: relative;
|
|
|
+ margin-top: 15rpx;
|
|
|
+ line-height: 10px;
|
|
|
+ .number {
|
|
|
+ font-size: 17rpx;
|
|
|
+ position: absolute;
|
|
|
+ z-index: 999;
|
|
|
+ top: 3rpx;
|
|
|
+ left: 15rpx;
|
|
|
+ color: #ffffff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .price-box {
|
|
|
+ display: flex;
|
|
|
+ align-items: baseline;
|
|
|
+ height: 64rpx;
|
|
|
+ padding: 10rpx 0;
|
|
|
+ font-size: 27rpx;
|
|
|
+ color: #EF041F;
|
|
|
+ }
|
|
|
+ .price {
|
|
|
+ font-size: $font-lg + 6rpx;
|
|
|
+ .text {
|
|
|
+ padding-left: 5rpx;
|
|
|
+ color: #b0b0b0;
|
|
|
+ font-size: 22rpx !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .price-green {
|
|
|
+ color: #2dbd59;
|
|
|
+ font-size: 28rpx !important;
|
|
|
+ text {
|
|
|
+ background: #2dbd59;
|
|
|
+ color: #ffffff;
|
|
|
+ padding: 0rpx 10rpx;
|
|
|
+ border-radius: 5rpx;
|
|
|
+ font-size: 22rpx !important;
|
|
|
+ margin-left: 15rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .m-price {
|
|
|
+ margin: 0 12rpx;
|
|
|
+ color: $font-color-light;
|
|
|
+ text-decoration: line-through;
|
|
|
+ margin-left: 25rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|