From 4a6e489ef040a8cae6366a0de552543620f23d1f Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: Wed, 4 Nov 2020 19:23:11 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/vc-sku/vc-sku.vue | 38 +++++++++--------
pages/goodDetail/goodDetail.vue | 74 ++++++++++++++++-----------------
2 files changed, 57 insertions(+), 55 deletions(-)
diff --git a/components/vc-sku/vc-sku.vue b/components/vc-sku/vc-sku.vue
index c273291..dfb0d0f 100644
--- a/components/vc-sku/vc-sku.vue
+++ b/components/vc-sku/vc-sku.vue
@@ -78,7 +78,7 @@
currentSkuArray: [],
goodsNum: 1,
confirmGoodsInfo: {},
- type: this.buyType
+ type: this.buyType,
};
},
props: {
@@ -107,9 +107,7 @@
},
mounted() {
// 单规格选项
- if (!this.goodsInfo.is_sku) {
- this.currentSkuPrice = this.skuPrice[0];
- }
+
},
watch: {
type(nweVal, oldVal) {
@@ -147,11 +145,11 @@
},
methods: {
- jump(path, parmas) {
+ jump:function(path, parmas) {
},
// 选择规格
- chooseSku(sc, skuList) {
+ chooseSku:function(sc, skuList) {
this.$emit('chooseSku', sc);
},
@@ -199,18 +197,25 @@
},
// 立即购买
- confirmBuy() {
- let that = this;
-
- let confirmGoodsList = [];
- confirmGoodsList.push(that.confirmGoodsInfo);
+ confirmBuy:function() {
+ let _that = this;
+ let valueId = '';
+ _that.goodsInfo.productSpecValues.forEach(item =>{
+ if(item.isDefault == 'T'){
+ valueId = item.valueId
+ }
+ });
this.vc.navigateTo({
- url: '/pages/goodsConfirm/goodsConfirm'
+ url: '/pages/goodsConfirm/goodsConfirm?productId='
+ +_that.goodsInfo.productId
+ +"&valueId="+valueId
+ +"&goodsNum="+_that.goodsNum
+ +"&storeId="+_that.goodsInfo.storeId
})
},
// 确定
- confirm() {
+ confirm:function() {
switch (this.buyType) {
case 'cart':
this.addCartGoods();
@@ -246,10 +251,9 @@
}).then((data)=>{
if(data.code == 0){
_that.showModal = false;
- _that.vc.showToast({
- title:'添加成功',
- icon:'none'
- });
+
+
+ _that.$emit('changeBalance',true)
}
},(reject)=>{
diff --git a/pages/goodDetail/goodDetail.vue b/pages/goodDetail/goodDetail.vue
index 626c0b3..2493821 100644
--- a/pages/goodDetail/goodDetail.vue
+++ b/pages/goodDetail/goodDetail.vue
@@ -31,7 +31,10 @@
@@ -83,7 +86,8 @@
-
+
+
@@ -121,9 +125,9 @@
import {
getProduct
- } from '../../api/goods/goodsApi.js'
+ } from '../../api/goods/goodsApi.js';
- import conf from '../../conf/config.js'
+ import conf from '../../conf/config.js';
import {
mapMutations,
mapActions,
@@ -175,49 +179,48 @@
id: 'tab2',
title: '用户评价'
}
- ]
+ ],
+ balance:false
+
};
},
- computed: {},
+ computed: {
+
+ },
onLoad(options) {
this.productId = options.productId;
-
this.getGoodsDetail();
},
onReady() {},
methods: {
- getActivityRules(e) {
+ getActivityRules:function(e) {
if (e) {
this.activityRules = JSON.parse(e);
}
},
// 检测
- checkActivity(data, type) {
+ checkActivity:function(data, type) {
if (data) {
return !data.includes(type);
}
return true;
},
// 路由跳转
- jump(path, parmas) {
+ jump:function(path, parmas) {
this.showShare = false;
- this.$Router.push({
- path: path,
- query: parmas
- });
},
// 轮播图切换
- swiperChange(e) {
+ swiperChange:function(e) {
const index = e.detail.current;
this.swiperCurrent = index;
},
// 选项卡
- onTab(id) {
+ onTab:function(id) {
this.tabCurrent = id;
},
// 商品详情
- getGoodsDetail() {
+ getGoodsDetail:function() {
let that = this;
let _data = {
page: 1,
@@ -238,28 +241,17 @@
})
});
that.getCommentList();
-
},
// 商品评论
- getCommentList() {
+ getCommentList:function() {
let that = this;
- // that.$api('goods_comment.list', {
- // goods_id: that.goodsInfo.id,
- // per_page: 3,
- // type: 'all'
- // }).then(res => {
- // if (res.code === 1) {
- // that.commentList = res.data.data;
- // that.commentNum = res.data.total;
- // }
- // });
},
// 组件返回的type;
- changeType(e) {
+ changeType:function(e) {
this.buyType = e;
},
// 组件返回的规格;
- getSkuText(e) {
+ getSkuText:function(e) {
this.currentSkuText = e;
},
_chooseSku:function(sc){
@@ -270,15 +262,13 @@
this.goodsInfo.defaultSpecValue = item;
}
});
-
- console.log('sc',sc);
},
// 分享
- onShare() {
+ onShare:function() {
this.showShare = true;
},
// 加入购物车
- addCart() {
+ addCart:function() {
if (this.vc.hasLogin()) {
this.buyType = 'cart';
this.showSku = true;
@@ -289,7 +279,7 @@
}
},
// 立即购买
- goPay() {
+ goPay:function() {
if (this.vc.hasLogin()) {
this.buyType = 'buy';
this.showSku = true;
@@ -299,8 +289,13 @@
})
}
},
+ goBalance:function(){
+ this.vc.navigateTo({
+ url: '/pages/goodsConfirm/goodsConfirm'
+ })
+ },
// 拼团购买
- payGroupon(type) {
+ payGroupon:function(type) {
if (Boolean(uni.getStorageSync('token'))) {
if (type === 'groupon') {
this.grouponBuyType = 'groupon';
@@ -314,7 +309,7 @@
}
},
// 立即秒杀。
- goSeckill() {
+ goSeckill:function() {
if (Boolean(uni.getStorageSync('token'))) {
if (this.activityRules.status !== 'waiting') {
this.buyType = 'buy';
@@ -326,6 +321,9 @@
} else {
this.$store.commit('LOGIN_TIP', true);
}
+ },
+ changeBalance:function(e){
+ this.balance = e;
}
}
};