diff --git a/app.js b/app.js
index 6ddb996..c5cd544 100644
--- a/app.js
+++ b/app.js
@@ -22,7 +22,7 @@ App({
unique_key: "wechatxcx"
}).then(res => {
let data = JSON.parse(res.data);
- data.isTest = data.isTest29?true:false;
+ data.isTest = data.isTest30?true:false;
this.globalData.configJson = data
})
diff --git a/app.wxss b/app.wxss
index 960acbe..6469318 100644
--- a/app.wxss
+++ b/app.wxss
@@ -31,7 +31,7 @@ page{
position: relative;
z-index: 1;
width: 80%;
- max-height: 100%;
+ max-height: 1000rpx;
background: white;
border-radius: 12rpx;
overflow-y: auto;
diff --git a/pages/index/index.js b/pages/index/index.js
index 9e70108..bfadf57 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -248,6 +248,7 @@ Page({
util.gotoDetail(item)
},
gotoPath: function (e) {
+ console.log(e)
if (e.currentTarget.dataset.event) {
this.pagePoint({ event: e.currentTarget.dataset.event }, 1)
}
diff --git a/pages/info/museumInfo/index.wxss b/pages/info/museumInfo/index.wxss
index b1f467c..5b7184c 100644
--- a/pages/info/museumInfo/index.wxss
+++ b/pages/info/museumInfo/index.wxss
@@ -70,6 +70,7 @@
display: flex;
align-items: center;
justify-content: space-around;
+ z-index: 3;
}
.fixed-btn .btn {
diff --git a/pages/info/postProductInfo/index.js b/pages/info/postProductInfo/index.js
index f5a2632..8aed12b 100644
--- a/pages/info/postProductInfo/index.js
+++ b/pages/info/postProductInfo/index.js
@@ -45,6 +45,7 @@ Page({
})
// 获取购物车按钮的位置
wx.createSelectorQuery().select('#cart').boundingClientRect(function (res) {
+ console.log(res)
that.setData({
cartTop: res.top
})
diff --git a/pages/info/postProductInfo/index.wxml b/pages/info/postProductInfo/index.wxml
index 595326b..7166da8 100644
--- a/pages/info/postProductInfo/index.wxml
+++ b/pages/info/postProductInfo/index.wxml
@@ -3,7 +3,7 @@
+ class="headimg{{aniSkuIndex==index?' active':''}}" src="{{info.headimg}}" mode="aspectFill">
diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js
index 0e12985..1cd11a6 100644
--- a/pages/info/sceneProductInfo/index.js
+++ b/pages/info/sceneProductInfo/index.js
@@ -24,6 +24,14 @@ Page({
showShareFlag: false,
showAllowance: false,
allowance_data:null,
+ //购物车数量
+ producNum: 1,
+ skuIndex: 0,
+ aniSkuIndex: -1,
+ cartCount: 0,
+ cartImgInfo: null,
+ cartTop: 0,
+ top: 0
},
/**
@@ -155,7 +163,6 @@ Page({
scene_id: id
}).then(res => {
if (res.code == 1) {
- console.log(isLike)
wx.showToast({
title: '操作成功',
})
@@ -197,24 +204,83 @@ Page({
})
},
order: function (e) {
- if (e.currentTarget.dataset.disable == 1) return;
- util.pagePoint({
- event: 'scene_order',
- param: {
- type: this.data.info.type,
- id: this.data.info.id
- }
- }, 1)
- wx.setStorageSync('login_from', 'scene_order_login')
- wx.setStorageSync('order_from', 'scene_order_submit')
- app.globalData.couponInfo = null;
- app.globalData.retailId = this.data.retailId;
- // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product;
- app.globalData.product = e.currentTarget.dataset;
- wx.navigateTo({
- url: '/pages/order/scene/index',
- })
+ console.log(this.data.info,this.data.skuFlag)
+ if (e.currentTarget.dataset.disable == 1) return;
+ util.pagePoint({
+ event: 'scene_order',
+ param: {
+ type: this.data.info.type,
+ id: this.data.info.id
+ }
+ }, 1)
+ wx.setStorageSync('login_from', 'scene_order_login')
+ wx.setStorageSync('order_from', 'scene_order_submit')
+ app.globalData.couponInfo = null;
+ app.globalData.retailId = this.data.retailId;
+ // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product;
+ app.globalData.product = e.currentTarget.dataset;
+ wx.navigateTo({
+ url: '/pages/order/scene/index',
+ })
},
+ // order: function (e) {
+ // console.log(this.data.info,this.data.skuFlag)
+ // if (this.data.skuFlag == 'order'){
+ // if (e.currentTarget.dataset.disable == 1) return;
+ // util.pagePoint({
+ // event: 'scene_order',
+ // param: {
+ // type: this.data.info.type,
+ // id: this.data.info.id
+ // }
+ // }, 1)
+ // wx.setStorageSync('login_from', 'scene_order_login')
+ // wx.setStorageSync('order_from', 'scene_order_submit')
+ // app.globalData.couponInfo = null;
+ // app.globalData.retailId = this.data.retailId;
+ // // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product;
+ // app.globalData.product = e.currentTarget.dataset;
+ // wx.navigateTo({
+ // url: '/pages/order/scene/index',
+ // })
+ // }else {
+ // commonApi.user_post("cart/add_sku", {
+ // sku_id: this.data.info.product[0].sku[this.data.skuIndex].id,
+ // num: this.data.producNum
+ // }).then(res => {
+ // if (res.code == 1) {
+ // commonApi.user_post('cart/get_list', {}).then(res => {
+ // this.setData({
+ // cartCount: res.data.length
+ // })
+ // })
+ // // 加动效
+ // console.log(this.data.skuIndex)
+ // this.setData({
+ // skuFlag: null,
+ // aniSkuIndex: this.data.skuIndex,
+ // cartImgInfo: null
+ // })
+ // setTimeout(() => {
+ // this.setData({
+ // aniSkuIndex: -1
+ // })
+ // wx.showModal({
+ // title: "提示",
+ // content: "去购物车结算?",
+ // success: function (res) {
+ // if (res.confirm) {
+ // wx.navigateTo({
+ // url: '/pages/user/cartlist/list',
+ // })
+ // }
+ // }
+ // })
+ // }, 650)
+ // }
+ // })
+ // }
+ // },
pagePoint: function (e) {
util.pagePoint({
event: e.currentTarget.dataset.event,
@@ -480,6 +546,65 @@ Page({
ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth);
}
},
+ //加入购物车
+ showCart: function () {
+ console.log(this.data)
+ if (this.data.info.product[0].sku.length == 0) {
+ wx.showToast({
+ title: '该产品未设置规格,不能加购',
+ icon: 'none'
+ })
+ return;
+ }
+ this.setData({
+ skuFlag: "cart"
+ })
+ let that = this
+ wx.createSelectorQuery().select('#skuImg').boundingClientRect(function (res) {
+ console.log(res)
+ that.setData({
+ cartImgInfo: 'top:' + res.top + 'px;left:' + res.left + 'px;'
+ })
+ }).exec()
+
+ },
+ hideSku: function () {
+ this.setData({
+ skuFlag: null,
+ cartImgInfo: null
+ })
+ },
+ //加减数量
+ minus: function () {
+ if (this.data.producNum == 1) return;
+ this.setData({
+ producNum: this.data.producNum - 1
+ })
+ },
+ add: function () {
+ this.setData({
+ producNum: this.data.producNum + 1
+ })
+ },
+ //立即预定
+ showOrder: function () {
+ if (this.data.info.product[0].sku.length == 0) {
+ wx.showToast({
+ title: '该产品未设置规格,不能购买',
+ icon: 'none'
+ })
+ return;
+ }
+ this.setData({
+ skuFlag: 'order'
+ })
+ },
+ selectSku: function (e) {
+ let index = e.currentTarget.dataset.index;
+ this.setData({
+ skuIndex: index
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
@@ -539,6 +664,12 @@ Page({
}
})
}
+ commonApi.user_post('cart/get_list', {}).then(res => {
+ console.log(res,res.data)
+ this.setData({
+ cartCount: res.data.length
+ })
+ })
}
else {
setTimeout(() => {
diff --git a/pages/info/sceneProductInfo/index.wxml b/pages/info/sceneProductInfo/index.wxml
index 678e2ba..2279ba9 100644
--- a/pages/info/sceneProductInfo/index.wxml
+++ b/pages/info/sceneProductInfo/index.wxml
@@ -1,7 +1,10 @@
+
-
+
+
+
+
+ {{cartCount}}
+
+
+
+
+
+
+
+
+ {{info.product[0].sku[skuIndex].price/100}}
+
+ 补贴价:¥{{ (1 - allowance_data.discount_rate / 100) * info.sku[skuIndex].price / 100 }}
+
+ 已选择:{{info.product[0].sku[skuIndex].sku_name}}
+
+
+
+ {{item.sku_name}}
+
+
+ 数量
+
+ {{producNum}}
+
+
+
+
+ {{skuFlag=='cart'?'确认':'立即购买'}}
+
+ 该商品已下架
+
+
+