|
@@ -1,18 +1,20 @@
|
|
|
// template/carts/index.js
|
|
// template/carts/index.js
|
|
|
Page({
|
|
Page({
|
|
|
dever: getApp().dever,
|
|
dever: getApp().dever,
|
|
|
- addrObj: null,
|
|
|
|
|
|
|
+ authdialog: null,
|
|
|
data: {
|
|
data: {
|
|
|
-
|
|
|
|
|
|
|
+ isUseAddress: false
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
|
// 初始化购物车
|
|
// 初始化购物车
|
|
|
//self.dever.carts(self, 'carts.save', 'carts/index');
|
|
//self.dever.carts(self, 'carts.save', 'carts/index');
|
|
|
|
|
|
|
|
|
|
+ this.authdialog = this.selectComponent("#authdialog");
|
|
|
|
|
+
|
|
|
//test - begin
|
|
//test - begin
|
|
|
var list = new Array();
|
|
var list = new Array();
|
|
|
- for(var i=1; i<10; i++){
|
|
|
|
|
|
|
+ for(var i=1; i<2; i++){
|
|
|
var item = new Object();
|
|
var item = new Object();
|
|
|
item.name = i+'盒有机韭菜';
|
|
item.name = i+'盒有机韭菜';
|
|
|
item.price = i*20;
|
|
item.price = i*20;
|
|
@@ -37,14 +39,6 @@ Page({
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
|
|
- */
|
|
|
|
|
- onReachBottom: function () {
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 使用微信地址
|
|
* 使用微信地址
|
|
|
*/
|
|
*/
|
|
@@ -54,8 +48,8 @@ Page({
|
|
|
wx.chooseAddress({
|
|
wx.chooseAddress({
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
that.dever.log('wx.chooseAddress', res);
|
|
that.dever.log('wx.chooseAddress', res);
|
|
|
- that.addrObj = res;
|
|
|
|
|
- that.sets(that, res);
|
|
|
|
|
|
|
+ that.dever.set(that,'addrObj', res);
|
|
|
|
|
+ that.dever.set(that,'isUseAddress', true);
|
|
|
},
|
|
},
|
|
|
fail: function (res) {
|
|
fail: function (res) {
|
|
|
that.dever.log('wx.chooseAddress', 'fail');
|
|
that.dever.log('wx.chooseAddress', 'fail');
|
|
@@ -71,6 +65,9 @@ Page({
|
|
|
scope: 'scope.address',
|
|
scope: 'scope.address',
|
|
|
success: function () {
|
|
success: function () {
|
|
|
success();
|
|
success();
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function(res){
|
|
|
|
|
+ that.authdialog.showDialog();
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|