diff --git a/wexin/icons/cart_logo.png b/wexin/icons/cart_logo.png new file mode 100644 index 00000000..c679067e Binary files /dev/null and b/wexin/icons/cart_logo.png differ diff --git a/wexin/icons/check.png b/wexin/icons/check.png new file mode 100644 index 00000000..c376876d Binary files /dev/null and b/wexin/icons/check.png differ diff --git a/wexin/icons/uncheck.png b/wexin/icons/uncheck.png new file mode 100644 index 00000000..f1c00816 Binary files /dev/null and b/wexin/icons/uncheck.png differ diff --git a/wexin/pages/cart/cart.js b/wexin/pages/cart/cart.js index 29624727..5a9811ac 100644 --- a/wexin/pages/cart/cart.js +++ b/wexin/pages/cart/cart.js @@ -1,10 +1,37 @@ +var config = require('../../config/config.js'); + Page({ data: { - name: 'test' + appName: config.name, + carts: [] }, onLoad: function() { + var carts = [ + { + id: 1, + name: "【爱宝宝母婴微商城】防腹泻奶粉——赋儿嘉", + image: { + url: "/upload/img/2017/05/28/4ad4c6f6-fc95-4a1e-940b-81f2e6bceaee.jpg" + }, + price: 198, + count: 2 + }, + { + id: 2, + name: "【爱宝宝母婴微商城】防腹泻奶粉", + image: { + url: "/upload/img/2017/05/28/4ad4c6f6-fc95-4a1e-940b-81f2e6bceaee.jpg" + }, + price: 298, + count: 3 + } + ] + for (var i = 0; i < carts.length; i++) { + carts[i].image.url = config.static.imageDomain + carts[i].image.url; + carts[i].checked = true; + } this.setData({ - name: 'xxx' - }) + carts: carts + }); } }) \ No newline at end of file diff --git a/wexin/pages/cart/cart.json b/wexin/pages/cart/cart.json new file mode 100644 index 00000000..e2c6d2a7 --- /dev/null +++ b/wexin/pages/cart/cart.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "购物车" +} \ No newline at end of file diff --git a/wexin/pages/cart/cart.wxml b/wexin/pages/cart/cart.wxml index 19948be5..d20d6e83 100644 --- a/wexin/pages/cart/cart.wxml +++ b/wexin/pages/cart/cart.wxml @@ -1,4 +1,35 @@ - - - 我的购物车 + + + + + + + + + + + + {{appName}} + + + 编辑 + + + + + + + + + + + + {{item.name}} + + ¥ {{item.price}} + X{{item.count}} + + + + \ No newline at end of file diff --git a/wexin/pages/cart/cart.wxss b/wexin/pages/cart/cart.wxss index e69de29b..a63d3b89 100644 --- a/wexin/pages/cart/cart.wxss +++ b/wexin/pages/cart/cart.wxss @@ -0,0 +1,114 @@ +page { + width: 100%; + height: 100%; + font-size: 0; +} + +.cart-box { + background-color: #f9f9f9; + width: 100%; + height: 100%; +} + +.cart-box-scroll { + width: 100%; + padding-bottom: 120rpx; + background-color: #fff; +} + +.cart-wemall-header { + font-size: 0; + margin-top: 30rpx; + height: 80rpx; + display: flex; + flex-direction: row; + justify-content: flex-start; + background-color: #fff; +} + +.cart-wemall-logo-name { + display: flex; + flex-direction: row; + justify-content: flex-start; +} + +.cart-wemall-logo { + width: 40rpx; + height: 40rpx; + display: inline-block; + vertical-align: top; +} + +.cart-wemall-name { + padding-left: 10rpx; + font-size: 40rpx; + line-height: 40rpx; + color: #222; +} + +.wemall-action { + display: flex; + flex: 1; + text-align: right; + padding-right: 30rpx; +} + +.wemall-action-edit { + flex: 1; + color: #666; + font-size: 32rpx; + line-height: 32rpx; +} + +.wemall-checkbox-container { + text-align: center; + width: 90rpx; + height: 90rpx; +} + +.wemall-checkbox { + width: 48rpx; + height: 48rpx; +} + +.cart-item { + padding-top: 20rpx; + display: flex; + flex-direction: row; + margin-bottom: 36rpx; + background-color: #f9f9f9; +} + +.product-image { + width: 200rpx; + height: 200rpx; +} + +.product-info { + margin-left: 20rpx; + flex: 1; + display: flex; + flex-direction: column; + margin-right: 30rpx; +} + +.product-name { + font-size: 36rpx; + color: #222; + line-height: 50rpx; +} + +.product-price-box { + display: flex; + flex-direction: row; +} + +.product-price { + font-size: 36rpx; +} + +.product-count { + font-size: 36rpx; + flex: 1; + text-align: right; +} \ No newline at end of file diff --git a/wexin/pages/index/index.js b/wexin/pages/index/index.js index 806fba86..741d2a4b 100644 --- a/wexin/pages/index/index.js +++ b/wexin/pages/index/index.js @@ -6,13 +6,16 @@ Page({ categories: [], categoryIndex: 0, itemWidth: '', - products: [] + products: [], + + + niaoBuShiColor: '', }, onCategoryTap: function() { - testinAB.track('click', 1, function() { + testinAB.track('nbsbtnclick', 1, function() { wx.showModal({ title: '提示', - content: 'click指标上报成功' + content: 'nbsbtnclick 指标上报成功' }) }); }, @@ -30,13 +33,6 @@ Page({ self.setData({ itemWidth: (res.screenWidth - 40) / 2 + 'px' }); - console.log((res.screenWidth - 60) / 2) - console.log(res.pixelRatio) - console.log(res.windowWidth) - console.log(res.screenWidth) - console.log(res.pixelRatio) - console.log(res.version) - console.log(res.platform) } }); @@ -66,15 +62,20 @@ Page({ }); var self = this; - testinAB.init('TESTIN_h7b3111f2-e238-441b-8951-24c4e2121c58'); + testinAB.init('TESTIN_h793c3619-8bac-4ddb-b541-df2c3d7aa1b7'); testinAB.setDefVars({ selectedColor: '#e4393c' }); - testinAB.getVars(function(vars) { - console.log(vars.get('selectedColor')); + testinAB.getVars(function getVars(vars) { + var color = vars.get('color'); + if (color == 'yellow') { + color = '#ff0'; + } else if (color == 'red') { + color = '#f00'; + } self.setData({ - //selectedColor: vars.get('selectedColor') + niaoBuShiColor: color }); }); } diff --git a/wexin/pages/index/index.wxml b/wexin/pages/index/index.wxml index 8f35a611..15df1a59 100644 --- a/wexin/pages/index/index.wxml +++ b/wexin/pages/index/index.wxml @@ -4,9 +4,11 @@ - - {{item.name}} + + {{item.name}} + diff --git a/wexin/pages/product/product.js b/wexin/pages/product/product.js index ba28299f..bac82fc9 100644 --- a/wexin/pages/product/product.js +++ b/wexin/pages/product/product.js @@ -1,4 +1,5 @@ -var config = require('../../config/config.js'); +var config = require('../../config/config.js'); +var testinAB = require('../../sdk/sdk.js'); Page({ data: { @@ -6,6 +7,14 @@ Page({ product : null, swiperHeight : '', }, + onPriceTap: function() { + testinAB.track('pricebtnclick', 1, function() { + wx.showModal({ + title: '提示', + content: 'pricebtnclick 指标上报成功' + }) + }); + }, onLoad: function(options) { var self = this; this.setData({ @@ -42,5 +51,12 @@ Page({ }); } }); + + var self = this; + testinAB.getVars(function(vars) { + self.setData({ + price: vars.get('price') + }); + }); } }) \ No newline at end of file diff --git a/wexin/pages/product/product.wxml b/wexin/pages/product/product.wxml index 31d90594..df7f36cd 100644 --- a/wexin/pages/product/product.wxml +++ b/wexin/pages/product/product.wxml @@ -14,7 +14,7 @@ ¥ - {{product.price}} + {{price ? price : product.price}}