|
@@ -183,7 +183,8 @@
|
|
|
// import share from '@/components/share';
|
|
|
import uniNumberBox from '@/components/uni-number-box.vue';
|
|
|
import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
|
|
|
-import { goodsDetail, cartAdd, collectAdd, collectDel, seckillGoods, groupGoods } from '@/api/product.js';
|
|
|
+import { goodsDetail, cartAdd, collectAdd, collectDel, seckillGoods, groupGoods } from '@/api/product.js';
|
|
|
+import { timeComputed } from '@/utils/rocessor.js';
|
|
|
// #ifdef H5
|
|
|
import { weixindata,shareLoad } from '@/utils/wxAuthorized';
|
|
|
import { mapState } from 'vuex';
|
|
@@ -276,15 +277,64 @@ export default {
|
|
|
// 获取当前时间
|
|
|
let acitonTime = new Date();
|
|
|
// 判断当前时间是否大于结束时间
|
|
|
- if (acitonTime.getTime() > stoptime) {
|
|
|
- // 当前秒杀时间已经结束
|
|
|
- this.seckillObj.stop = true;
|
|
|
- } else {
|
|
|
- // 计算倒计时
|
|
|
- this.timeComputed(stoptime, this.seckillObj);
|
|
|
- }
|
|
|
- this.seckillGoods();
|
|
|
- return;
|
|
|
+ seckillGoods({}, this.goodsid).then(({ data }) => {
|
|
|
+ obj.list = data;
|
|
|
+ console.log(obj.list, '秒杀商品数据++++++++++');
|
|
|
+ // obj.good_list = data.good_list; //保存猜你喜欢列表
|
|
|
+ obj.reply = data.reply; //保存评论列表
|
|
|
+ let goods = data.storeInfo;
|
|
|
+ obj.goodsNumberMax = goods.num;
|
|
|
+ // console.log('obj.goodsNumberMin+++++++++',obj.goodsNumberMin)
|
|
|
+ console.log(goods.stop_time,"时间")
|
|
|
+ const time = timeComputed(goods.stop_time);
|
|
|
+ obj.seckillObj = {
|
|
|
+ stop: time.tpye, //是否结束
|
|
|
+ stopTimeH: time.hours, //小时
|
|
|
+ stopTimeM: time.minutes, //分钟
|
|
|
+ stopTimeS: time.seconds //秒钟
|
|
|
+ };
|
|
|
+
|
|
|
+ console.log(obj.seckillObj, '数据');
|
|
|
+ // console.log(obj.seckillObj,'obj.seckillObj++++++++++++++++++++++')
|
|
|
+ obj.goodsObjact = goods;
|
|
|
+ if (obj.goodsObjact.description != null) {
|
|
|
+ obj.description = obj.goodsObjact.description.replace(/\<img/gi, '<img class="rich-img"');
|
|
|
+ } //小程序商品详情图超出屏幕问题
|
|
|
+ obj.imgList = goods.images; //保存轮播图
|
|
|
+ obj.specList = data.productAttr; //保存分类列表
|
|
|
+ if (Array.isArray(data.productValue) != true) {
|
|
|
+ console.log('多规格+++++++++++++');
|
|
|
+ obj.many = 2;
|
|
|
+ obj.specList = data.productAttr; //保存产品属性
|
|
|
+ obj.productValue = data.productValue; //保存属性值
|
|
|
+ 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].quota;
|
|
|
+ // console.log(obj.goodsNumberMax,'obj.goodsNumberMax++++++++++++')
|
|
|
+ obj.actionImage = obj.productValue[str].image;
|
|
|
+ obj.uniqueId = obj.productValue[str].unique;
|
|
|
+ obj.goodsStore = obj.productValue[str].stock;
|
|
|
+ } else {
|
|
|
+ console.log('单规格+++++++++++++');
|
|
|
+ obj.many = 1;
|
|
|
+ obj.productValue = data.productValue; //保存分类查询数据
|
|
|
+ obj.actionPrice = goods.price; //保存默认选中商品价格
|
|
|
+ obj.actionImage = goods.image_base; //保存默认选中商品图片
|
|
|
+ // obj.goodsNumberMax = goods.quota; //保存默认选中最大可购买商品数量
|
|
|
+ console.log(obj.goodsNumberMax, 'obj.goodsNumberMax---------------');
|
|
|
+ obj.shopId = data.mer_id; //保存商店id
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
if (options.type == 2) {
|
|
|
// 保存当前拼团商品类型
|