|
@@ -9,32 +9,14 @@
|
|
|
</swiper-item>
|
|
|
</swiper>
|
|
|
</view>
|
|
|
-
|
|
|
- <view class="introduce-section seckill-box-title" v-if="goodsType == 1">
|
|
|
- <view class="title flex">
|
|
|
- <view class="title-box">
|
|
|
- <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>
|
|
|
- <view class="flex timeStop">
|
|
|
- <view>距离结束</view>
|
|
|
- <uni-countdown color="#ffffff" background-color="#D65B3F" splitor-color="#FFFFFF" :show-day="false"
|
|
|
- :hour="seckillObj.stopTimeH" :minute="seckillObj.stopTimeM" :second="seckillObj.stopTimeS">
|
|
|
- </uni-countdown>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
<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> -->
|
|
|
<image class="image" src="../../static/img/jfdh.png" mode=""></image>
|
|
|
- <text class="price">{{ goodsObjact.price }}</text>
|
|
|
+ <text class="price">{{ goodsObjact.max_integral }}</text>
|
|
|
<text class="price-tip jifen">积分</text>
|
|
|
- <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text>
|
|
|
+ <text class="m-price">+ ¥{{goodsObjact.price- goodsObjact.max_integral }}</text>
|
|
|
<!-- <text class="coupon-tip">7折</text> -->
|
|
|
</view>
|
|
|
<text class="title" v-if="goodsType == 0">{{ goodsObjact.store_name }}</text>
|
|
@@ -82,28 +64,17 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="c-list">
|
|
|
- <view class="c-row b-b" @click="toggleSpec">
|
|
|
+ <!-- <view class="c-row b-b" @click="toggleSpec">
|
|
|
<text class="tit">选择数量</text>
|
|
|
<view class="con">
|
|
|
<text class="selected-text">{{ goodsNumber }}</text>
|
|
|
</view>
|
|
|
<text class="iconfont iconenter"></text>
|
|
|
- </view>
|
|
|
- <view class="c-row b-b" v-if="goodsType == 1">
|
|
|
- <text class="tit">限购数量</text>
|
|
|
- <view class="con">
|
|
|
- <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.is_integral == 1 && goodsType == 0">
|
|
|
<text class="tit">积分</text>
|
|
|
<view class="bz-list con">
|
|
|
- <text>最高抵扣¥{{ moneyNum(goodsObjact.use_max_integral) == 0 ? moneyNum(goodsObjact.price) : moneyNum(goodsObjact.use_max_integral) }}</text>
|
|
|
+ <text>最高抵扣¥{{ moneyNum(goodsObjact.max_integral) == 0 ? moneyNum(goodsObjact.price) : moneyNum(goodsObjact.max_integral) }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -124,44 +95,12 @@
|
|
|
</view>
|
|
|
<!-- 底部操作菜单 -->
|
|
|
<view class="page-bottom" v-if="goodsType == 0">
|
|
|
- <!-- <navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
|
|
|
- <text class="iconfont iconhome"></text>
|
|
|
- <text>首页</text>
|
|
|
- </navigator>
|
|
|
- <navigator url="/pages/cart/cart" open-type="switchTab" class="p-b-btn">
|
|
|
- <text class="iconfont iconcart"></text>
|
|
|
- <text>购物车</text>
|
|
|
- </navigator> -->
|
|
|
- <!-- <view class="p-b-btn" :class="{ active: goodsObjact.userCollect }" @click="toFavorite(goodsObjact)">
|
|
|
- <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>
|
|
|
</view>
|
|
|
- <!-- 秒杀商品购买 -->
|
|
|
- <view class="goods-pay-box flex" :class="{ stop: seckillObj.stop }" v-if="goodsType == 1">
|
|
|
- <view class="goods-pay bgLine" v-if="!seckillObj.stop" @click="toggleSpec(1)"><text>立即购买</text></view>
|
|
|
- <view class="goods-pay-stop" v-else>活动已结束</view>
|
|
|
- </view>
|
|
|
- <!-- 拼团商品购买 -->
|
|
|
- <view class="goods-pay-box flex" v-if="goodsType == 2">
|
|
|
- <view class="goods-pay bg-warning" @click="navToProductGoods">
|
|
|
- <view class="goods-buttom-money">¥{{ goodsObjact.product_price }}</view>
|
|
|
- <view class="goods-buttom">单独购买</view>
|
|
|
- </view>
|
|
|
- <view class="goods-pay bg-danger" @click="toggleSpec(1)">
|
|
|
- <view class="goods-buttom-money">¥{{ goodsObjact.price }}</view>
|
|
|
- <view class="goods-buttom">我要拼团</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
<!-- 规格-模态层弹窗 -->
|
|
|
- <view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
|
|
|
- <!-- 遮罩层 -->
|
|
|
+ <!-- <view class="popup spec" :class="specClass" @touchmove.stop.prevent="stopPrevent" @click="toggleSpec">
|
|
|
<view class="mask"></view>
|
|
|
<view class="layer attr-content" @click.stop="stopPrevent">
|
|
|
<view class="a-t">
|
|
@@ -171,11 +110,6 @@
|
|
|
<text class="price">¥{{ actionPrice }}</text>
|
|
|
<br />
|
|
|
<text class="stock" v-if="goodsObjact.can_up_level==1">等级:{{levelName}}</text>
|
|
|
- <!-- <text class="stock">库存:{{ goodsObjact.stock }}件</text> -->
|
|
|
- <!-- <view class="selected" v-if="goodsType == 0">
|
|
|
- 已选:
|
|
|
- <text class="selected-text" v-for="(sItem, sIndex) in specSelected" :key="sIndex">{{ sItem }}</text>
|
|
|
- </view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-for="(item, index) in specList" :key="index" class="attr-list">
|
|
@@ -196,10 +130,8 @@
|
|
|
</view>
|
|
|
<button class="btn" @click.stop="buy">完成</button>
|
|
|
</view>
|
|
|
- </view>
|
|
|
- <view :class="{ seckillBottom: goodsType == 1, goodsBottom: goodsType == 0 }"></view>
|
|
|
- <!-- 分享 -->
|
|
|
- <!-- <share ref="share" :contentHeight="580" :shareList="shareList"></share> -->
|
|
|
+ </view> -->
|
|
|
+ <!-- <view :class="{ seckillBottom: goodsType == 1, goodsBottom: goodsType == 0 }"></view> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -269,28 +201,6 @@
|
|
|
title: ''
|
|
|
}, //商店信息
|
|
|
goodsType: 0, //商品类型1秒杀商品0为普通商品2为拼团商品
|
|
|
- // 秒杀数据保存
|
|
|
- seckillObj: {
|
|
|
- stopTime: 0, //结束时间
|
|
|
- stop: false, //是否结束
|
|
|
- stopTimeH: 0, //小时
|
|
|
- stopTimeM: 0, //分钟
|
|
|
- stopTimeS: 0 //秒钟
|
|
|
- },
|
|
|
- // 拼团数据保存
|
|
|
- pink: {
|
|
|
- id: '', //拼团编号
|
|
|
- uid: '', //用户编号
|
|
|
- people: '', //拼团人数
|
|
|
- price: '', //拼团价格
|
|
|
- stop_time: '', //拼团结束时间
|
|
|
- nickname: '', //团长昵称
|
|
|
- avatar: '', //团长头像
|
|
|
- count: '', //拼团剩余人数
|
|
|
- h: '', //时
|
|
|
- i: '', //分
|
|
|
- s: '' //秒
|
|
|
- }
|
|
|
};
|
|
|
},
|
|
|
async onLoad(options) {
|
|
@@ -302,34 +212,6 @@
|
|
|
// 存储邀请人
|
|
|
uni.setStorageSync('spread', options.spread);
|
|
|
}
|
|
|
- // 判断是否为秒杀商品
|
|
|
- if (options.type == 1) {
|
|
|
- // 保存商品类型
|
|
|
- this.goodsType = 1;
|
|
|
- // 保存结束时间
|
|
|
- this.seckillObj.stopTime = options.stoptime;
|
|
|
- // 获取当前时间毫秒数
|
|
|
- let stoptime = options.stoptime * 1000;
|
|
|
- // 获取当前时间
|
|
|
- let acitonTime = new Date();
|
|
|
- // 判断当前时间是否大于结束时间
|
|
|
- if (acitonTime.getTime() > stoptime) {
|
|
|
- // 当前秒杀时间已经结束
|
|
|
- this.seckillObj.stop = true;
|
|
|
- } else {
|
|
|
- // 计算倒计时
|
|
|
- this.timeComputed(stoptime, this.seckillObj);
|
|
|
- }
|
|
|
- this.seckillGoods();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (options.type == 2) {
|
|
|
- // 保存当前拼团商品类型
|
|
|
- this.goodsType = 2;
|
|
|
- // 家在数据
|
|
|
- this.groupGoods();
|
|
|
- return;
|
|
|
- }
|
|
|
if (this.goodsType == 0) {
|
|
|
// 加载普通商品详情
|
|
|
this.goodsDetail();
|
|
@@ -430,75 +312,46 @@
|
|
|
}
|
|
|
},
|
|
|
// #endif
|
|
|
-
|
|
|
-
|
|
|
// 购买数量变化
|
|
|
numberChange(e) {
|
|
|
this.goodsNumber = e.number;
|
|
|
},
|
|
|
//规格弹窗开关
|
|
|
toggleSpec(str) {
|
|
|
- if (this.specClass === 'show') {
|
|
|
- this.specClass = 'hide';
|
|
|
- setTimeout(() => {
|
|
|
- this.specClass = 'none';
|
|
|
- }, 250);
|
|
|
- } else if (this.specClass === 'none') {
|
|
|
- this.specClass = 'show';
|
|
|
- }
|
|
|
+ // if (this.specClass === 'show') {
|
|
|
+ // this.specClass = 'hide';
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.specClass = 'none';
|
|
|
+ // }, 250);
|
|
|
+ // } else if (this.specClass === 'none') {
|
|
|
+ // this.specClass = 'show';
|
|
|
+ // }
|
|
|
// 保存当前购买类型
|
|
|
this.type = str;
|
|
|
+ this.buy();
|
|
|
},
|
|
|
//选择规格
|
|
|
- selectSpec(item, arr, ind) {
|
|
|
- arr.attr_value.forEach(function(e) {
|
|
|
- e.check = false;
|
|
|
- });
|
|
|
- item.check = true;
|
|
|
- this.specSelected[ind] = item.attr;
|
|
|
- let str = this.specSelected.join(',');
|
|
|
- this.specSelectedName = this.specSelected.join(' ');
|
|
|
- if (this.productValue[str]) {
|
|
|
- let data = this.productValue[str];
|
|
|
- this.actionPrice = data.price;
|
|
|
- this.levelName = data.level_name;
|
|
|
- this.goodsNumberMax = data.stock;
|
|
|
- this.actionImage = data.image;
|
|
|
- this.uniqueId = data.unique;
|
|
|
- }
|
|
|
- },
|
|
|
+ // selectSpec(item, arr, ind) {
|
|
|
+ // arr.attr_value.forEach(function(e) {
|
|
|
+ // e.check = false;
|
|
|
+ // });
|
|
|
+ // item.check = true;
|
|
|
+ // this.specSelected[ind] = item.attr;
|
|
|
+ // let str = this.specSelected.join(',');
|
|
|
+ // this.specSelectedName = this.specSelected.join(' ');
|
|
|
+ // if (this.productValue[str]) {
|
|
|
+ // let data = this.productValue[str];
|
|
|
+ // this.actionPrice = data.price;
|
|
|
+ // this.levelName = data.level_name;
|
|
|
+ // this.goodsNumberMax = data.stock;
|
|
|
+ // this.actionImage = data.image;
|
|
|
+ // this.uniqueId = data.unique;
|
|
|
+ // }
|
|
|
+ // },
|
|
|
//分享
|
|
|
- share() {
|
|
|
- this.$refs.share.toggleMask();
|
|
|
- },
|
|
|
- //收藏
|
|
|
- toFavorite(item) {
|
|
|
- let obj = this;
|
|
|
- item.userCollect = !item.userCollect;
|
|
|
- if (!item.userCollect) {
|
|
|
- collectDel({
|
|
|
- id: obj.goodsid,
|
|
|
- category: 'product'
|
|
|
- }).then(function(e) {
|
|
|
- uni.showToast({
|
|
|
- title: '成功取消收藏',
|
|
|
- type: 'top',
|
|
|
- duration: 1500
|
|
|
- });
|
|
|
- });
|
|
|
- } else {
|
|
|
- collectAdd({
|
|
|
- id: obj.goodsid,
|
|
|
- category: 'product'
|
|
|
- }).then(function(e) {
|
|
|
- uni.showToast({
|
|
|
- title: '成功加入收藏',
|
|
|
- type: 'top',
|
|
|
- duration: 1500
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
+ // share() {
|
|
|
+ // this.$refs.share.toggleMask();
|
|
|
+ // },
|
|
|
// 立即购买
|
|
|
buy() {
|
|
|
let obj = this;
|
|
@@ -506,60 +359,28 @@
|
|
|
cartNum: obj.goodsNumber, //商品数量
|
|
|
uniqueId: obj.uniqueId, //商品标签
|
|
|
new: '1', //商品是否新增加到购物车1为不加入0为加入
|
|
|
- mer_id: obj.shopId
|
|
|
+ mer_id: obj.shopId,
|
|
|
+ is_integral: 1,
|
|
|
// type: 0,//0为余额支付 1为消费券支付 2为积分支付
|
|
|
};
|
|
|
- if (obj.type == 2) {
|
|
|
- data.new = 0;
|
|
|
- }
|
|
|
if (obj.goodsType == 0) {
|
|
|
data.productId = obj.goodsid; //商品编号
|
|
|
}
|
|
|
- // 判断是否为秒杀商品
|
|
|
- if (obj.goodsType == 1) {
|
|
|
- data.secKillId = obj.goodsid; //秒杀商品编号
|
|
|
- data.productId = obj.goodsObjact.product_id; //商品编号
|
|
|
- // 判断是否秒杀已经结束
|
|
|
- if (obj.seckillObj.stop) {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '当前活动已经结束',
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- // 判断是否为拼团商品
|
|
|
- if (obj.goodsType == 2) {
|
|
|
- data.combinationId = obj.goodsid; //拼团编号
|
|
|
- data.productId = obj.goodsObjact.product_id; //商品编号
|
|
|
- }
|
|
|
cartAdd(data)
|
|
|
.then(function({
|
|
|
data
|
|
|
}) {
|
|
|
- if (obj.type == 1) {
|
|
|
- let url = '/pages/order/createOrder?id=' + data.cartId + '&goodsType=' + obj.goodsType +
|
|
|
- '&goodsUpLevel=' + obj.goodsObjact.can_up_level;
|
|
|
- // 跳转到支付页
|
|
|
- uni.navigateTo({
|
|
|
- url
|
|
|
- });
|
|
|
- }
|
|
|
- if (obj.type == 2) {
|
|
|
- uni.showToast({
|
|
|
- title: '成功加入购物车',
|
|
|
- type: 'top',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- obj.toggleSpec();
|
|
|
- }
|
|
|
+ let url = '/pages/order/createOrder?id=' + data.cartId + '&goodsType=' + obj.goodsType +
|
|
|
+ '&goodsUpLevel=' + obj.goodsObjact.can_up_level + '&checkedPoints=' + true;
|
|
|
+ // 跳转到支付页
|
|
|
+ uni.navigateTo({
|
|
|
+ url
|
|
|
+ });
|
|
|
})
|
|
|
.catch(e => {
|
|
|
console.log(e);
|
|
|
});
|
|
|
},
|
|
|
- stopPrevent() {}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -632,10 +453,11 @@
|
|
|
}
|
|
|
|
|
|
.price-tip {
|
|
|
-
|
|
|
+
|
|
|
font-size: $font-base;
|
|
|
}
|
|
|
- .jifen{
|
|
|
+
|
|
|
+ .jifen {
|
|
|
margin-left: 10rpx;
|
|
|
}
|
|
|
|
|
@@ -714,10 +536,12 @@
|
|
|
font-size: 26rpx;
|
|
|
color: #FF6F0F;
|
|
|
}
|
|
|
- .image{
|
|
|
+
|
|
|
+ .image {
|
|
|
height: 32rpx;
|
|
|
width: 32rpx;
|
|
|
}
|
|
|
+
|
|
|
.price {
|
|
|
font-size: $font-lg + 2rpx;
|
|
|
}
|
|
@@ -725,7 +549,7 @@
|
|
|
.m-price {
|
|
|
margin: 0 12rpx;
|
|
|
color: $font-color-light;
|
|
|
- text-decoration: line-through;
|
|
|
+ // text-decoration: line-through;
|
|
|
}
|
|
|
|
|
|
.coupon-tip {
|