|
@@ -5,7 +5,11 @@
|
|
|
<view class="sckill-top" v-if="isSckill">
|
|
|
<view class="top-left">
|
|
|
<view class="left-top">限时秒杀价</view>
|
|
|
- <view class="left-btm">¥<text class="now-pri">{{sckillGoodInfo.price}}</text><text class="old-pri">¥{{sckillGoodInfo.ot_price}}</text></view>
|
|
|
+ <view class="left-btm">
|
|
|
+ ¥
|
|
|
+ <text class="now-pri">{{ sckillGoodInfo.price }}</text>
|
|
|
+ <text class="old-pri">¥{{ sckillGoodInfo.ot_price }}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="top-right">
|
|
|
<view class="right-top">距离本场结束还剩</view>
|
|
@@ -23,9 +27,9 @@
|
|
|
</view>
|
|
|
<!-- 标题 -->
|
|
|
<product-content :goodsObjact="goodsObjact" v-if="!isSckill"></product-content>
|
|
|
- <view class="good-title clamp2" v-if="isSckill">{{sckillGoodInfo.title}}</view>
|
|
|
+ <view class="good-title clamp2" v-if="isSckill">{{ sckillGoodInfo.title }}</view>
|
|
|
<!-- 选择数量 -->
|
|
|
-<!-- <view class="row b-b">
|
|
|
+ <!-- <view class="row b-b">
|
|
|
<text class="tit">选择</text>
|
|
|
<picker mode="selector" :range="choNum" @change="bindChange">
|
|
|
<view class="refund" v-if="goodsNumber !== 1">{{ goodsNumber || '请选择' }}</view>
|
|
@@ -40,14 +44,17 @@
|
|
|
<view class="shop-info">
|
|
|
<view class="shop-logo"><image :src="shopInfo.mer_avatar" mode=""></image></view>
|
|
|
<view class="shop-base">
|
|
|
- <view class="base-name">{{shopInfo.mer_name}}</view>
|
|
|
- <view class="base-addr clamp">{{shopInfo.mer_address}}</view>
|
|
|
+ <view class="base-name">{{ shopInfo.mer_name }}</view>
|
|
|
+ <view class="base-addr clamp">{{ shopInfo.mer_address }}</view>
|
|
|
+ </view>
|
|
|
+ <view class="shop-dis">
|
|
|
+ <image src="../../static/icon/base_addr.png" mode="aspectFill"></image>
|
|
|
+ 距离200m
|
|
|
</view>
|
|
|
- <view class="shop-dis"><image src="../../static/icon/base_addr.png" mode="aspectFill"></image>距离200m</view>
|
|
|
</view>
|
|
|
<!-- 评价 -->
|
|
|
<estimate @navTo="navTo('/pages/product/reply?id=' + product_id)" v-if="reply" :reply="reply" :list="list"></estimate>
|
|
|
-
|
|
|
+
|
|
|
<!-- 规格信息 -->
|
|
|
<!-- <fresh-detail :goodsObjact="goodsObjact"></fresh-detail> -->
|
|
|
<!-- 图文详情 -->
|
|
@@ -125,7 +132,7 @@ import guessLike from './common/guessLike.vue';
|
|
|
// 评价
|
|
|
import estimate from './common/estimate.vue';
|
|
|
import uniNumberBox from '@/components/uni-number-box.vue';
|
|
|
-import {timeComputed} from '@/utils/rocessor.js'
|
|
|
+import { timeComputed } from '@/utils/rocessor.js';
|
|
|
export default {
|
|
|
components: {
|
|
|
guessLike,
|
|
@@ -158,7 +165,7 @@ export default {
|
|
|
percent: 1
|
|
|
}, //保存商品数据
|
|
|
//图片循环
|
|
|
- imgList: [],//顶部轮播图
|
|
|
+ imgList: [], //顶部轮播图
|
|
|
// 对比对象
|
|
|
actionPrice: 0, //默认选中商品价格
|
|
|
actionImage: '', //默认选中图片
|
|
@@ -196,11 +203,10 @@ export default {
|
|
|
seconds: 0,
|
|
|
day: 0,
|
|
|
tpye: false
|
|
|
-
|
|
|
},
|
|
|
- product_id:0,
|
|
|
- sckillGoodInfo: {},//秒杀商品信息
|
|
|
- shopInfo: {},//店铺信息
|
|
|
+ product_id: 0,
|
|
|
+ sckillGoodInfo: {}, //秒杀商品信息
|
|
|
+ shopInfo: {} //店铺信息
|
|
|
};
|
|
|
},
|
|
|
filters: {
|
|
@@ -215,14 +221,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async onLoad(options) {
|
|
|
- console.log(options)
|
|
|
-
|
|
|
+ console.log(options);
|
|
|
+
|
|
|
let obj = this;
|
|
|
obj.userInfo = uni.getStorageSync('userInfo');
|
|
|
//保存商品id
|
|
|
this.goodsid = options.id;
|
|
|
- this.getGoodsDetails()
|
|
|
- this.product_id = options.id
|
|
|
+ this.getGoodsDetails();
|
|
|
+ this.product_id = options.id;
|
|
|
this.goodsType = options.type;
|
|
|
// 判断有无人邀请
|
|
|
if (options.spread) {
|
|
@@ -230,8 +236,7 @@ export default {
|
|
|
uni.setStorageSync('spread', options.spread);
|
|
|
}
|
|
|
saveUrl();
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
// if(options.type === '1') {
|
|
|
// obj.getGoodInfo()
|
|
|
// // obj.getTime()
|
|
@@ -241,8 +246,8 @@ export default {
|
|
|
// }else {
|
|
|
// this.goodsDetail();
|
|
|
// }
|
|
|
- if(options.type === '1'){
|
|
|
- obj.isSckill = true
|
|
|
+ if (options.type === '1') {
|
|
|
+ obj.isSckill = true;
|
|
|
}
|
|
|
// 注册邀请信息
|
|
|
// #ifdef H5
|
|
@@ -251,16 +256,15 @@ export default {
|
|
|
weixindata();
|
|
|
}
|
|
|
// #endif
|
|
|
-
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['weichatObj', 'baseURL', 'urlFile']),
|
|
|
choNum() {
|
|
|
- let a = []
|
|
|
- for(let i = 1 ; i <= this.goodsNumberMax ; i++ ){
|
|
|
- a.push(i)
|
|
|
+ let a = [];
|
|
|
+ for (let i = 1; i <= this.goodsNumberMax; i++) {
|
|
|
+ a.push(i);
|
|
|
}
|
|
|
- return a
|
|
|
+ return a;
|
|
|
}
|
|
|
},
|
|
|
// 分享
|
|
@@ -310,9 +314,10 @@ export default {
|
|
|
obj.actionImage = obj.productValue[str].image;
|
|
|
obj.uniqueId = obj.productValue[str].unique;
|
|
|
obj.goodsStore = obj.productValue[str].stock;
|
|
|
- console.log(obj.uniqueId,'++++++++obj.uniqueId')
|
|
|
+ console.log(obj.uniqueId, '++++++++obj.uniqueId');
|
|
|
} else {
|
|
|
- (obj.buys_show = false), (obj.buys_shows = true);
|
|
|
+ obj.buys_show = false
|
|
|
+ obj.buys_shows = true
|
|
|
}
|
|
|
if (obj.goodsStore == 0) {
|
|
|
obj.buys_show = false;
|
|
@@ -321,10 +326,10 @@ export default {
|
|
|
obj.specSelected[ind] = item.attr;
|
|
|
},
|
|
|
// 打開彈窗
|
|
|
- specOPne(type=1) {
|
|
|
+ specOPne(type = 1) {
|
|
|
let obj = this;
|
|
|
obj.specClass = 'show';
|
|
|
- obj.type = type
|
|
|
+ obj.type = type;
|
|
|
},
|
|
|
//规格弹窗开关
|
|
|
toggleSpec(str) {
|
|
@@ -361,7 +366,7 @@ export default {
|
|
|
//加入购物车
|
|
|
Addcar(item) {
|
|
|
let obj = this;
|
|
|
- console.log("加入购物车",obj.goodsNumber)
|
|
|
+ console.log('加入购物车', obj.goodsNumber);
|
|
|
cartAdd({
|
|
|
// cartNum: '1', //商品数量
|
|
|
cartNum: obj.goodsNumber,
|
|
@@ -389,12 +394,12 @@ export default {
|
|
|
// 获取普通商品信息
|
|
|
goodsDetail({}, this.goodsid).then(function({ data }) {
|
|
|
obj.list = data;
|
|
|
- console.log(data)
|
|
|
+ console.log(data);
|
|
|
obj.good_list = data.good_list; //保存猜你喜欢列表
|
|
|
obj.reply = data.reply; //保存评论列表
|
|
|
let goods = data.storeInfo;
|
|
|
obj.goodsObjact = goods;
|
|
|
- console.log(obj.goodsObjact,"++++++++++++++")
|
|
|
+ console.log(obj.goodsObjact, '++++++++++++++');
|
|
|
if (obj.goodsObjact.description != null) {
|
|
|
obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
|
|
|
} //小程序商品详情图超出屏幕问题
|
|
@@ -433,15 +438,15 @@ export default {
|
|
|
let obj = this;
|
|
|
// 获取秒杀商品信息
|
|
|
seckillGoods({}, this.goodsid).then(function({ data }) {
|
|
|
- console.log(data)
|
|
|
+ console.log(data);
|
|
|
obj.list = data;
|
|
|
obj.good_list = data.good_list; //保存猜你喜欢列表
|
|
|
obj.reply = data.reply; //保存评论列表
|
|
|
let goods = data.storeInfo;
|
|
|
obj.goodsObjact = goods;
|
|
|
- obj.goodsObjact.title = goods.title
|
|
|
- obj.stopTimes = timeComputed(obj.list.isSeckillEnd.stop*1000)
|
|
|
- console.log(obj.stopTimes,'dddddddddd')
|
|
|
+ obj.goodsObjact.title = goods.title;
|
|
|
+ obj.stopTimes = timeComputed(obj.list.isSeckillEnd.stop * 1000);
|
|
|
+ console.log(obj.stopTimes, 'dddddddddd');
|
|
|
if (obj.goodsObjact.description != null) {
|
|
|
obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
|
|
|
} //小程序商品详情图超出屏幕问题
|
|
@@ -451,7 +456,7 @@ export default {
|
|
|
obj.many = 2;
|
|
|
obj.specList = data.productAttr; //保存产品属性
|
|
|
obj.productValue = data.productValue; //保存属性值
|
|
|
- console.log(obj.productValue,'obj.productValue++++++++')
|
|
|
+ console.log(obj.productValue, 'obj.productValue++++++++');
|
|
|
obj.specSelected = []; //初始化默认选择对象
|
|
|
for (let i = 0; i < obj.specList.length; i++) {
|
|
|
// 设置默认数据
|
|
@@ -466,7 +471,7 @@ export default {
|
|
|
obj.goodsNumberMax = obj.productValue[str].stock;
|
|
|
obj.actionImage = obj.productValue[str].image;
|
|
|
obj.uniqueId = obj.productValue[str].unique;
|
|
|
- console.log(obj.uniqueId,"obj.uniqueId+++默认")
|
|
|
+ console.log(obj.uniqueId, 'obj.uniqueId+++默认');
|
|
|
obj.goodsStore = obj.productValue[str].quota;
|
|
|
} else {
|
|
|
obj.many = 1;
|
|
@@ -476,25 +481,24 @@ export default {
|
|
|
obj.actionImage = goods.image_base; //保存默认选中商品图片
|
|
|
obj.goodsNumberMax = goods.stock; //保存默认选中最大可购买商品数量
|
|
|
obj.shopId = data.mer_id; //保存商店id
|
|
|
-
|
|
|
});
|
|
|
},
|
|
|
// 立即购买
|
|
|
buy() {
|
|
|
let obj = this;
|
|
|
// 创建传值对象
|
|
|
- let goodId = obj.goodsid
|
|
|
- if(obj.isSckill) {
|
|
|
- goodId = obj.product_id
|
|
|
+ let goodId = obj.goodsid;
|
|
|
+ if (obj.isSckill) {
|
|
|
+ goodId = obj.product_id;
|
|
|
}
|
|
|
- console.log("添加的数量",obj.goodsNumber)
|
|
|
+ console.log('添加的数量', obj.goodsNumber);
|
|
|
let data = {
|
|
|
- cartNum: obj.goodsNumber, //商品数量
|
|
|
- new: 1,
|
|
|
- productId: goodId,//商品编号
|
|
|
- uniqueId:obj.uniqueId
|
|
|
- };
|
|
|
-
|
|
|
+ cartNum: obj.goodsNumber, //商品数量
|
|
|
+ new: 1,
|
|
|
+ productId: goodId, //商品编号
|
|
|
+ uniqueId: obj.uniqueId
|
|
|
+ };
|
|
|
+ console.log(data);
|
|
|
if (obj.type == 2) {
|
|
|
data.new = 0;
|
|
|
}
|
|
@@ -516,7 +520,7 @@ export default {
|
|
|
});
|
|
|
obj.goodsDetail();
|
|
|
}
|
|
|
- obj.toggleSpec()
|
|
|
+ obj.toggleSpec();
|
|
|
})
|
|
|
.catch(e => {
|
|
|
console.log(e);
|
|
@@ -525,39 +529,69 @@ export default {
|
|
|
// 阻止触发上级事件
|
|
|
stopPrevent() {},
|
|
|
bindChange(e) {
|
|
|
- this.goodsNumber = this.choNum[e.detail.value]*1;
|
|
|
- console.log(this.goodsNumber)
|
|
|
+ this.goodsNumber = this.choNum[e.detail.value] * 1;
|
|
|
+ console.log(this.goodsNumber);
|
|
|
},
|
|
|
numberChange(e) {
|
|
|
//购买数量
|
|
|
this.chooseGoodsNumber = e.number;
|
|
|
- this.goodsNumber = e.number
|
|
|
+ this.goodsNumber = e.number;
|
|
|
},
|
|
|
// getTime() {
|
|
|
// let start = new data()
|
|
|
// }
|
|
|
getGoodsDetails() {
|
|
|
- let obj = this
|
|
|
- getSeckillProductDetail({},this.goodsid).then( ({data}) => {
|
|
|
- console.log(data)
|
|
|
+ let obj = this;
|
|
|
+ getSeckillProductDetail({}, this.goodsid).then(({ data }) => {
|
|
|
+ console.log(data, 'goodInfo6666666666666');
|
|
|
obj.imgList = data.slider_image; //保存轮播图
|
|
|
- obj.sckillGoodInfo.title = data.store_name
|
|
|
- obj.sckillGoodInfo.price = data.price
|
|
|
- obj.sckillGoodInfo.ot_price = data.ot_price
|
|
|
- obj.stopTimes = timeComputed(data.stop*1000)
|
|
|
- obj.shopInfo.name = data.merchant.mer_name
|
|
|
- obj.shopInfo.logo = data.merchant.mer_avatar
|
|
|
- if(data.content.content !== null) {
|
|
|
+ obj.sckillGoodInfo.title = data.store_name; //保存商品名称
|
|
|
+ obj.sckillGoodInfo.price = data.price; //保存商品展示价格
|
|
|
+ obj.sckillGoodInfo.ot_price = data.ot_price; //保存商品市场价
|
|
|
+ obj.stopTimes = timeComputed(data.stop * 1000); //设置结束时间
|
|
|
+ obj.shopInfo.name = data.merchant.mer_name; //保存店铺名称
|
|
|
+ obj.shopInfo.logo = data.merchant.mer_avatar; //保存店铺logo
|
|
|
+ //小程序商品详情图超出屏幕问题
|
|
|
+ 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.shopInfo.mer_address = data.mer_address
|
|
|
- // return item
|
|
|
-
|
|
|
- })
|
|
|
- })
|
|
|
+ //获取保存店铺详细信息
|
|
|
+ getStoreDetail(data.mer_id).then(({ data }) => {
|
|
|
+ console.log(data, 'shop data');
|
|
|
+ obj.shopInfo = data;
|
|
|
+ });
|
|
|
+ // 获取商品属性
|
|
|
+ obj.specList = data.attr; //保存分类列表
|
|
|
+ if (Array.isArray(data.attr) == true) {
|
|
|
+ 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].quota;
|
|
|
+ } else {
|
|
|
+ obj.many = 1;
|
|
|
+
|
|
|
+ obj.productValue = data.sku; //保存分类查询数据
|
|
|
+ obj.actionPrice = data.price; //保存默认选中商品价格
|
|
|
+ obj.actionImage = data.image; //保存默认选中商品图片
|
|
|
+ obj.goodsNumberMax = data.stock; //保存默认选中最大可购买商品数量
|
|
|
+ obj.shopId = data.mer_id; //保存商店id
|
|
|
+ obj.goodsStore = data.stock
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -786,7 +820,7 @@ page {
|
|
|
margin: 20rpx 0;
|
|
|
width: 750rpx;
|
|
|
height: 83rpx;
|
|
|
- background: #FFFFFF;
|
|
|
+ background: #ffffff;
|
|
|
padding: 29rpx 24rpx 30rpx 25rpx;
|
|
|
font-size: 26rpx;
|
|
|
font-weight: 500;
|
|
@@ -869,7 +903,7 @@ page {
|
|
|
position: absolute;
|
|
|
font-size: 24rpx;
|
|
|
font-weight: 500;
|
|
|
- color: #901B21;
|
|
|
+ color: #901b21;
|
|
|
// line-height: 140rpx;
|
|
|
right: 24rpx;
|
|
|
image {
|
|
@@ -878,7 +912,6 @@ page {
|
|
|
height: 21rpx;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
.sckill-top {
|
|
|
width: 750rpx;
|
|
@@ -896,7 +929,7 @@ page {
|
|
|
padding: 35rpx 0 23rpx 22rpx;
|
|
|
font-size: 44rpx;
|
|
|
font-weight: 500;
|
|
|
- color: #FFFFFF;
|
|
|
+ color: #ffffff;
|
|
|
line-height: 1;
|
|
|
}
|
|
|
.left-btm {
|
|
@@ -904,13 +937,13 @@ page {
|
|
|
font-size: 30rpx;
|
|
|
font-weight: 500;
|
|
|
// text-decoration: line-through;
|
|
|
- color: #FFFFFF;
|
|
|
+ color: #ffffff;
|
|
|
.now-pri {
|
|
|
display: inline-block;
|
|
|
padding-right: 8rpx;
|
|
|
font-size: 44rpx;
|
|
|
font-weight: 800;
|
|
|
- color: #FFFFFF;
|
|
|
+ color: #ffffff;
|
|
|
}
|
|
|
.old-pri {
|
|
|
text-decoration: line-through;
|
|
@@ -918,11 +951,11 @@ page {
|
|
|
}
|
|
|
}
|
|
|
.top-right {
|
|
|
- padding:67rpx 20rpx 18rpx 0;
|
|
|
+ padding: 67rpx 20rpx 18rpx 0;
|
|
|
.right-top {
|
|
|
font-size: 22rpx;
|
|
|
font-weight: 400;
|
|
|
- color: #FFFFFF;
|
|
|
+ color: #ffffff;
|
|
|
line-height: 1;
|
|
|
padding-bottom: 8rpx;
|
|
|
}
|
|
@@ -937,4 +970,4 @@ page {
|
|
|
font-weight: 800;
|
|
|
color: #333333;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|