2020-06-15 08:49:26 +08:00
|
|
|
<template>
|
2020-07-06 10:25:54 +08:00
|
|
|
<view>
|
|
|
|
<view class="tloos">
|
|
|
|
<view class="navs">
|
|
|
|
<image></image>
|
|
|
|
店铺
|
|
|
|
</view>
|
|
|
|
<view class="navs" style="margin-right:30rpx">
|
|
|
|
<image></image>
|
|
|
|
客服
|
|
|
|
</view>
|
|
|
|
<view class="button" style="background:rgba(253,211,96,0.6);">试穿试送</view>
|
|
|
|
<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-06 10:25:54 +08:00
|
|
|
<u-popup v-model="show" mode="bottom">
|
2020-07-06 11:42:12 +08:00
|
|
|
<scroll-view scroll-y="true" class="popup">
|
|
|
|
<view>
|
2020-07-06 10:25:54 +08:00
|
|
|
<view class="head">
|
2020-07-07 14:45:57 +08:00
|
|
|
<image class="image" :src="info.goods_image"></image>
|
2020-07-06 10:25:54 +08:00
|
|
|
<view class="info">
|
2020-07-07 14:45:57 +08:00
|
|
|
<text class="u-line-2">{{info.goods_name}}</text>
|
|
|
|
<text>¥{{info.goods_price}}</text>
|
2020-07-06 10:25:54 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
2020-07-07 14:45:57 +08:00
|
|
|
<guige @sel="self" ref="guige" v-for="(item,index) in info.spec_value" :key="index" :title="info.spec_name[index]" :item="item"></guige>
|
2020-07-06 10:25:54 +08:00
|
|
|
<view class="num">
|
|
|
|
<text>购买数量</text>
|
|
|
|
<u-number-box v-model="value" @change="valChange"></u-number-box>
|
|
|
|
</view>
|
2020-07-06 11:42:12 +08:00
|
|
|
<view style="height:180rpx"></view>
|
|
|
|
</view>
|
2020-07-07 14:45:57 +08:00
|
|
|
<u-toast ref="uToast" />
|
|
|
|
|
2020-07-06 11:42:12 +08:00
|
|
|
</scroll-view>
|
2020-07-06 10:25:54 +08:00
|
|
|
</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-07 14:45:57 +08:00
|
|
|
props: ['id','info'],
|
2020-07-06 11:42:12 +08:00
|
|
|
components:{
|
|
|
|
guige
|
|
|
|
},
|
2020-07-06 10:25:54 +08:00
|
|
|
data(){
|
|
|
|
return {
|
2020-07-07 14:45:57 +08:00
|
|
|
show:false,
|
|
|
|
value:1,
|
|
|
|
sel:"",
|
|
|
|
quanxuan:false
|
2020-07-06 10:25:54 +08:00
|
|
|
}
|
|
|
|
},
|
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){
|
|
|
|
this.$emit("buy",{type,value:that.value})
|
|
|
|
}else if(this.quanxuan){
|
|
|
|
this.$emit("buy",{type,value:that.value})
|
|
|
|
}else{
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
title: '请选择规格',
|
|
|
|
type: 'warning',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
this.show = true
|
|
|
|
}
|
|
|
|
|
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(){
|
|
|
|
// console.log(this.sel)
|
|
|
|
this.$emit('xuanze',this.sel)
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 08:49:26 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.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-06 10:25:54 +08:00
|
|
|
.popup{
|
|
|
|
padding: 30rpx;
|
2020-07-06 11:42:12 +08:00
|
|
|
box-sizing: border-box;
|
|
|
|
max-height: 750rpx;
|
2020-07-06 10:25:54 +08:00
|
|
|
.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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-06 11:42:12 +08:00
|
|
|
|
2020-07-06 10:25:54 +08:00
|
|
|
.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>
|