From e7193773b90d652bf9d14f98f7e50d1ca10198d0 Mon Sep 17 00:00:00 2001 From: liuxiaoyan Date: Fri, 30 Sep 2016 15:13:32 +0800 Subject: [PATCH] address --- pages/address/address.js | 12 ++++++++++++ pages/address/address.wxml | 18 ++++++++++++++---- pages/index/index.js | 3 --- pages/show_product/show_product.js | 2 +- pages/show_product/show_product.wxml | 9 +++------ 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/pages/address/address.js b/pages/address/address.js index 9489bf4..aaeb27d 100644 --- a/pages/address/address.js +++ b/pages/address/address.js @@ -1,6 +1,18 @@ const address = require('../../utils/address.js') Page({ + data: { + arraySheng: ['美国', '中国', '巴西', '日本'], + indexSheng: 0, + }, + + bindPickerChange: function(e) { + console.log('picker发送选择改变,携带值为', e.detail.value) + this.setData({ + indexSheng: e.detail.value + }) + }, + formSubmit: function(e) { address.postAddress(e.detail.value) console.log('form 发生了 submit 事件,携带数据为:', e.detail.value) diff --git a/pages/address/address.wxml b/pages/address/address.wxml index eb8de70..42c008a 100644 --- a/pages/address/address.wxml +++ b/pages/address/address.wxml @@ -1,10 +1,20 @@
- - 省 + + + + + 当前选择:{{arraySheng[indexSheng]}} + + - - 市 + + + + + 当前选择:{{array[index]}} + + diff --git a/pages/index/index.js b/pages/index/index.js index d2316fb..786cdf2 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -4,9 +4,6 @@ const product = require('../../utils/product.js') Page({ data: {items: []}, - bindViewTap: function() { - }, - onLoad: function() { var that = this diff --git a/pages/show_product/show_product.js b/pages/show_product/show_product.js index 2677db9..6688971 100644 --- a/pages/show_product/show_product.js +++ b/pages/show_product/show_product.js @@ -20,7 +20,6 @@ Page({ wx.getNetworkType({ success: function(res) { var networkType = res.networkType // 返回网络类型2g,3g,4g,wifi - debugger if (networkType) { product.getProduct(params.id).then(function(result) { console.log(result) @@ -51,6 +50,7 @@ Page({ }, formSubmit: function(e) { + e.detail.value['sku'] = e.target.dataset['sku'] // address.postBuyProduct(e.detail.value) console.log('form发生了submit事件,携带数据为:', e.detail.value) }, diff --git a/pages/show_product/show_product.wxml b/pages/show_product/show_product.wxml index cda05a6..6c6bcba 100644 --- a/pages/show_product/show_product.wxml +++ b/pages/show_product/show_product.wxml @@ -1,6 +1,6 @@ - {{product.attributes.name}} + {{product.attributes.name}} {{address}} @@ -11,16 +11,13 @@ - + 数量 - sku:{{product.attributes.sku || '无法获取sku'}} - - - {{product.attributes.price || '无法获取价格'}} + ¥{{product.attributes.price || '无法获取价格'}}