2020-06-15 08:49:26 +08:00
|
|
|
<template>
|
2020-07-06 10:25:54 +08:00
|
|
|
<view>
|
2020-07-24 19:48:57 +08:00
|
|
|
<!-- 普通商品 tool -->
|
|
|
|
<view class="tloos" v-if="type == 1">
|
2020-07-06 10:25:54 +08:00
|
|
|
<view class="navs">
|
2020-07-21 21:02:28 +08:00
|
|
|
<image src="/static/image/common/18.png"></image>
|
2020-07-06 10:25:54 +08:00
|
|
|
店铺
|
|
|
|
</view>
|
|
|
|
<view class="navs" style="margin-right:30rpx">
|
2020-07-21 21:02:28 +08:00
|
|
|
<image src="/static/image/common/19.png"></image>
|
2020-07-06 10:25:54 +08:00
|
|
|
客服
|
|
|
|
</view>
|
2020-07-23 14:56:20 +08:00
|
|
|
<view class="button" style="background:rgba(253,211,96,0.6);" v-if="info.goods_try == 1">试穿试送</view>
|
2020-07-06 10:25:54 +08:00
|
|
|
<view class="button" style="background:rgba(253,211,96,1);" @click="buy(2)">加入购物车</view>
|
|
|
|
<view class="button" style="background:rgba(255,120,15,1);" @click="buy(1)">立即购买</view>
|
2020-06-15 08:49:26 +08:00
|
|
|
</view>
|
2020-07-24 19:48:57 +08:00
|
|
|
<!-- 拼团 tool -->
|
|
|
|
<view class="group-tool" v-if="type==2">
|
|
|
|
<view class="launch" @click="settlementOrder">发起拼团</view>
|
|
|
|
<view class="involvement" @click="showGroupUser=true">参与拼团</view>
|
|
|
|
</view>
|
|
|
|
<!-- 秒杀 tool -->
|
|
|
|
<view class="spike-tool" v-if="type==3">
|
|
|
|
<view class="left">
|
|
|
|
<view>
|
|
|
|
<image src="/static/image/common/18.png"></image>
|
|
|
|
<text>店铺</text>
|
|
|
|
</view>
|
|
|
|
<view>
|
|
|
|
<image src="/static/image/common/19.png"></image>
|
|
|
|
<text>客服</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="btn" v-if="groupbuyInfo.groupbuy_state == 20 && groupbuyInfo.inventory > groupbuyInfo.groupbuy_buy_quantity" @click="spikeGoods">立即秒杀</view>
|
|
|
|
<view class="btn" :class="{'cannot': groupbuyInfo.groupbuy_state == 32 || groupbuyInfo.inventory == groupbuyInfo.groupbuy_buy_quantity}" v-else>
|
|
|
|
{{ groupbuyInfo.groupbuy_state == 32 ? '时间已结束' : (groupbuyInfo.inventory > groupbuyInfo.groupbuy_buy_quantity ? '立即秒杀' : '已售空') }}
|
|
|
|
</view>
|
|
|
|
</view>
|
2020-07-06 10:25:54 +08:00
|
|
|
<u-popup v-model="show" mode="bottom">
|
2020-07-23 14:56:20 +08:00
|
|
|
<scroll-view scroll-y="true" class="popup">
|
|
|
|
<view>
|
|
|
|
<view class="head">
|
|
|
|
<image class="image" :src="info.goods_image"></image>
|
|
|
|
<view class="info">
|
|
|
|
<text class="u-line-2">{{info.goods_name}}</text>
|
|
|
|
<text>¥{{info.goods_price}}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<guige @sel="self" ref="guige" v-for="(item,index) in info.spec_value" :key="index" :title="info.spec_name[index]" :item="item"></guige>
|
|
|
|
<view class="num">
|
|
|
|
<text>购买数量</text>
|
|
|
|
<u-number-box v-model="value" @change="valChange"></u-number-box>
|
|
|
|
</view>
|
|
|
|
<view style="height:100rpx"></view>
|
|
|
|
</view>
|
|
|
|
<u-toast ref="uToast" />
|
|
|
|
</scroll-view>
|
|
|
|
</u-popup>
|
2020-06-15 08:49:26 +08:00
|
|
|
</view>
|
2020-07-06 10:25:54 +08:00
|
|
|
|
2020-06-15 08:49:26 +08:00
|
|
|
</template>
|
|
|
|
<script>
|
2020-07-06 11:42:12 +08:00
|
|
|
import guige from "./guige"
|
2020-06-15 08:49:26 +08:00
|
|
|
export default {
|
2020-06-29 17:24:57 +08:00
|
|
|
name:"tloos",
|
2020-07-24 19:48:57 +08:00
|
|
|
props: ['id', 'info', 'type'],
|
2020-07-06 11:42:12 +08:00
|
|
|
components:{
|
2020-07-24 19:48:57 +08:00
|
|
|
guige,
|
2020-07-06 11:42:12 +08:00
|
|
|
},
|
2020-07-06 10:25:54 +08:00
|
|
|
data(){
|
|
|
|
return {
|
2020-07-23 14:56:20 +08:00
|
|
|
show: false,
|
|
|
|
value: 1,
|
|
|
|
sel: "",
|
|
|
|
quanxuan: false
|
2020-07-06 10:25:54 +08:00
|
|
|
}
|
2020-07-23 14:56:20 +08:00
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.show = false;
|
|
|
|
},
|
2020-06-29 17:24:57 +08:00
|
|
|
methods: {
|
2020-07-06 10:25:54 +08:00
|
|
|
buy(type){
|
2020-07-07 14:45:57 +08:00
|
|
|
let that = this;
|
|
|
|
if(this.show){
|
|
|
|
if(this.info.spec_value == null){
|
2020-07-23 14:56:20 +08:00
|
|
|
this.$emit("buy", { type, value: that.value })
|
2020-07-07 14:45:57 +08:00
|
|
|
}else if(this.quanxuan){
|
2020-07-23 14:56:20 +08:00
|
|
|
this.$emit("buy", { type, value: that.value })
|
2020-07-07 14:45:57 +08:00
|
|
|
}else{
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
title: '请选择规格',
|
|
|
|
type: 'warning',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}else{
|
2020-07-23 14:56:20 +08:00
|
|
|
this.show = true;
|
2020-07-07 14:45:57 +08:00
|
|
|
}
|
|
|
|
|
2020-07-06 10:25:54 +08:00
|
|
|
},
|
|
|
|
valChange(e) {
|
2020-07-07 14:45:57 +08:00
|
|
|
console.log(this.value)
|
|
|
|
},
|
|
|
|
self(){
|
|
|
|
// console.log(this.$refs.guige)
|
|
|
|
let index = 0;
|
|
|
|
let arr = [];
|
|
|
|
for(let i in this.info.spec_value){
|
|
|
|
// console.log(i)
|
|
|
|
// console.log(this.$refs.guige[index++].select)
|
|
|
|
// index++;
|
|
|
|
let sel = this.$refs.guige[index++].select
|
|
|
|
if(sel != 0){
|
|
|
|
arr.push(sel)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// console.log(arr.length)
|
|
|
|
if(arr.length == index){
|
|
|
|
this.sel = arr.join("|")
|
|
|
|
this.quanxuan = true
|
|
|
|
// console.log(this.sel)
|
|
|
|
}
|
2020-07-06 10:25:54 +08:00
|
|
|
}
|
2020-07-07 14:45:57 +08:00
|
|
|
},
|
|
|
|
watch:{
|
|
|
|
sel(){
|
2020-07-23 20:58:56 +08:00
|
|
|
console.log(this.sel)
|
|
|
|
this.$emit('xuanze', this.sel)
|
2020-07-07 14:45:57 +08:00
|
|
|
}
|
|
|
|
}
|
2020-06-15 08:49:26 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
2020-07-24 19:48:57 +08:00
|
|
|
.group-tool {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 98rpx;
|
|
|
|
display: flex;
|
|
|
|
font-size: 32rpx;
|
|
|
|
color: rgba(255,255,255,1);
|
|
|
|
z-index: 99;
|
|
|
|
.launch {
|
|
|
|
flex: 1;
|
|
|
|
background: rgba(253,211,96,1);
|
|
|
|
line-height: 98rpx;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.involvement {
|
|
|
|
flex: 1;
|
|
|
|
background: rgba(255,120,15,1);
|
|
|
|
line-height: 98rpx;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.spike-tool {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 98rpx;
|
|
|
|
display: flex;
|
|
|
|
z-index: 99;
|
|
|
|
.left {
|
|
|
|
width: 190rpx;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-around;
|
|
|
|
> view {
|
|
|
|
text-align: center;
|
|
|
|
> image {
|
|
|
|
width: 35rpx;
|
|
|
|
height: 35rpx;
|
|
|
|
margin-bottom: 15rpx;
|
|
|
|
}
|
|
|
|
> text {
|
|
|
|
display: block;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: rgba(102,102,102,1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.btn {
|
|
|
|
flex: 1;
|
|
|
|
height: 98rpx;
|
|
|
|
line-height: 98rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-size: 32rpx;
|
|
|
|
color: rgba(255,255,255,1);
|
|
|
|
background: rgba(255,120,15,1);
|
|
|
|
}
|
|
|
|
.cannot {
|
|
|
|
background: rgba(221,221,221,1);
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 08:49:26 +08:00
|
|
|
.tloos{
|
2020-06-29 17:24:57 +08:00
|
|
|
background-color: #fff;
|
2020-06-15 08:49:26 +08:00
|
|
|
display: flex;
|
|
|
|
position: fixed;
|
|
|
|
height: 98rpx;
|
|
|
|
width: 100%;
|
|
|
|
bottom:0;
|
|
|
|
border-top: 1rpx solid #ececec;
|
2020-07-06 10:25:54 +08:00
|
|
|
z-index: 1000000;
|
2020-06-15 08:49:26 +08:00
|
|
|
.navs{
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #666;
|
|
|
|
flex-shrink: 0;
|
|
|
|
margin-left: 30rpx;
|
|
|
|
>image{
|
|
|
|
width: 35rpx;
|
|
|
|
height: 35rpx;
|
|
|
|
margin-bottom: 15rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
.button{
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
line-height: 98rpx;
|
|
|
|
text-align: center;
|
|
|
|
color: #fff;
|
|
|
|
|
|
|
|
}
|
2020-07-06 10:25:54 +08:00
|
|
|
|
2020-06-15 08:49:26 +08:00
|
|
|
}
|
2020-07-24 19:48:57 +08:00
|
|
|
.popup{
|
|
|
|
padding: 30rpx;
|
|
|
|
box-sizing: border-box;
|
|
|
|
max-height: 750rpx;
|
|
|
|
.head{
|
|
|
|
display: flex;
|
|
|
|
margin-bottom: 30rpx;
|
|
|
|
.image{
|
|
|
|
width: 195rpx;
|
|
|
|
height: 195rpx;
|
|
|
|
border-radius: 10rpx;
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
.info{
|
|
|
|
display: flex;
|
|
|
|
padding: 21rpx 0;
|
|
|
|
justify-content: space-between;
|
|
|
|
margin-left: 27rpx;
|
|
|
|
flex-direction: column;
|
|
|
|
>text:first-child{
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
>text:last-child{
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #ff3131;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.num{
|
|
|
|
height: 84rpx;
|
|
|
|
display: flex;
|
|
|
|
border-bottom: #ececec solid 2rpx;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
>text{
|
|
|
|
font-size: 26rpx;
|
|
|
|
color: #666;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 08:49:26 +08:00
|
|
|
</style>
|