From 2910af7bd752e55e4bebfdc61ad744cb4855fb8c Mon Sep 17 00:00:00 2001
From: luyuan <1162963624@qq.com>
Date: Tue, 7 Jul 2020 14:45:57 +0800
Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/api/shop.js | 5 ++
manifest.json | 2 +-
pageB/components/sdetails/guige.vue | 19 +++++--
pageB/components/sdetails/tloos.vue | 86 +++++++++++++++++++----------
pageB/sdetails/index.vue | 40 ++++++++++++--
5 files changed, 110 insertions(+), 42 deletions(-)
diff --git a/common/api/shop.js b/common/api/shop.js
index e244e90..93b1fd7 100644
--- a/common/api/shop.js
+++ b/common/api/shop.js
@@ -119,6 +119,11 @@ export default {
return vm.$u.post('Store/getStoreImgVideoList', {
id: id
});
+ },
+ goodsInfo({id}){
+ return vm.$u.post('goods/goodsInfo', {
+ goods_id: id
+ });
}
}
}
diff --git a/manifest.json b/manifest.json
index 8abe36e..a49d78f 100644
--- a/manifest.json
+++ b/manifest.json
@@ -91,7 +91,7 @@
"https" : false
},
"router" : {
- "base" : "history"
+ "base" : ""
}
}
}
diff --git a/pageB/components/sdetails/guige.vue b/pageB/components/sdetails/guige.vue
index 8f9be4a..d37f122 100644
--- a/pageB/components/sdetails/guige.vue
+++ b/pageB/components/sdetails/guige.vue
@@ -1,12 +1,14 @@
- 选择尺码
+ {{title}}
- 均码
- S
- M
+
+ {{i}}
+
+
+
@@ -48,7 +50,14 @@ export default {
name:"guige",
data(){
return {
- select:true
+ select:0
+ }
+ },
+ props:['item','title'],
+ watch:{
+ select(){
+ // console.log(this.select)
+ this.$emit("sel",this.select)
}
}
}
diff --git a/pageB/components/sdetails/tloos.vue b/pageB/components/sdetails/tloos.vue
index 26bc0e2..354cfe0 100644
--- a/pageB/components/sdetails/tloos.vue
+++ b/pageB/components/sdetails/tloos.vue
@@ -12,33 +12,27 @@
试穿试送
加入购物车
立即购买
-
@@ -48,36 +42,68 @@
import guige from "./guige"
export default {
name:"tloos",
- props: ['id'],
+ props: ['id','info'],
components:{
guige
},
data(){
return {
- show:true,
- value:1
+ show:false,
+ value:1,
+ sel:"",
+ quanxuan:false
}
},
methods: {
- //添加购物车
- addCart() {
- this.$u.api.addCart({
- goods_id: this.id,
- quantity: 1,
- }).then(res => {
- this.$refs.uToast.show({
- title: res.message,
- type: res.errCode == 0 ? 'success' : 'warning',
- })
- })
- },
buy(type){
- this.show = true
+ 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
+ }
+
},
valChange(e) {
- console.log('当前值为: ' + e.value)
+ 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)
+ }
}
- },
+ },
+ watch:{
+ sel(){
+ // console.log(this.sel)
+ this.$emit('xuanze',this.sel)
+ }
+ }
}