Compare commits

...

5 Commits

Author SHA1 Message Date
Kiyan
8d8f0f7c5f fix issue 地址选择页面删除操作无效 2017-06-08 11:31:43 +08:00
Kiyan
9dfa21bfdd 重新提示用户授权地理位置和用户信息 2017-06-08 11:25:42 +08:00
Kiyan
d6ae812e27 fix issue update address 2017-06-08 10:08:48 +08:00
Kiyan
87a1eac740 跳转新增地址 2017-06-08 09:52:42 +08:00
Kiyan
d7737a9fe1 fix issue textarea value not work 2017-06-02 10:01:46 +08:00
9 changed files with 91 additions and 24 deletions

View File

@ -1,17 +1,17 @@
{
"pages": [
"pages/index/index",
"pages/order/show",
"pages/address/select",
"pages/mine/mine",
"pages/order/quasi",
"pages/order/show",
"pages/shop/show",
"pages/order/list",
"pages/order/content",
"pages/mine/coupon",
"pages/mine/mine",
"pages/order/review",
"pages/index/search",
"pages/index/category",
"pages/address/select",
"pages/address/list",
"pages/index/address",
"pages/address/add",

View File

@ -53,6 +53,14 @@ Page({
})
wx.hideNavigationBarLoading()
cb && cb()
if(data.length === 0) {
wx.navigateTo({
url: '/pages/address/add',
success: function(res) {},
fail: function(res) {},
complete: function(res) {},
})
}
},
error() {
that.setData({

View File

@ -12,6 +12,12 @@
<view class="grey-color">
{{item.addr}} {{item.detail}}
</view>
<view class="address-actions">
<navigator url="/pages/address/add?id={{item.addr_id}}&callback=callback" class="address-actions__item">
<image class="address-actions__item-img" src="/images/address_edit_white.png">
</image>
</navigator>
</view>
</view>
</view>
</view>

View File

@ -18,11 +18,15 @@ Page({
*/
onLoad: function (options) {
this.callback = options.callback || 'callback'
var {content} = options
var content = options.content
var that = this
if (content) {
this.setData({
content
})
// fix textarea value not work
setTimeout(function () {
that.setData({
content
})
}, 200)
}
},

View File

@ -2,7 +2,7 @@
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__bd">
<textarea bindinput="onContentInput" value="{{content}}" class="weui-textarea" placeholder="口味, 偏好等要求" style="height: 3.3em" />
<textarea bindinput="onContentInput" auto-focus="true" value="{{content}}" class="weui-textarea" placeholder="口味, 偏好等要求" style="height: 3.3em" />
<view class="weui-textarea-counter">{{content.length}}/{{limit}}</view>
</view>
</view>

View File

@ -14,7 +14,7 @@ Page({
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
this.id = options.id || '2853'
this.id = options.id || '2908'
this.loadData()
},
onReady: function () {
@ -130,7 +130,7 @@ Page({
return
}
if (!info.receiver_addr_id) {
return alert('请选择用户地址')
return alert('请选择收货地址')
}
this.setData({
loading: true

View File

@ -10,7 +10,7 @@
</view>
</navigator>
<navigator wx:else url="/pages/address/select?callback=callbackAddress" class=" weui-media-box weui-media-box_text weui-cell__ft_in-access weui-media-box_address primary-color text-large">
选择地址
选择收货地址
</navigator>
</view>
</view>

View File

@ -87,14 +87,20 @@ export function login(options) {
} = options
wx.login({
success(res) {
fetch({
url: 'index.php?m=Api&c=WeixinMall&a=login',
data: {
phone, code,
wx_code: res['code'],
session_3rd: wx.getStorageSync('session_3rd')
},
success, error
getApp().getCurrentAddress(address => {
fetch({
url: 'index.php?m=Api&c=WeixinMall&a=login',
data: {
phone, code,
wx_code: res['code'],
session_3rd: wx.getStorageSync('session_3rd'),
city_id: address.city_id,
city_name: address.city,
district_id: address.district_id,
district_name: address.district,
},
success, error
})
})
},
error(res) {
@ -251,7 +257,7 @@ export function updateUserAddr(options) {
city_id: address.city_id,
city_name: address.city,
district_id: address.district_id,
district_name: address.district_name,
district_name: address.district,
},
success, error
})

View File

@ -57,7 +57,28 @@ export function getCurrentAddressList(options) {
},
fail(res) {
console.log(res.errMsg)
alert('获取用户地址失败')
if (res.errMsg == 'getLocation:fail auth deny' && wx.openSetting) {
confirm({
content: '若不授权地理位置权限, 则无法正常使用爱跑腿外卖, 请重新授权地理位置权限',
cancelText: '不授权',
confirmText: '授权',
ok() {
wx.openSetting({
success(res) {
console.log(res)
if (res.authSetting['scope.userLocation']) {
getCurrentAddressList(options)
} else {
alert('获取用户地址失败')
}
}
})
}
})
} else {
alert('获取用户地址失败')
}
}
})
}
@ -201,14 +222,15 @@ export function alert(content, callback) {
// 确认框
export function confirm(options) {
var {
content, confirmText,
content, confirmText, cancelText,
ok,
} = options
confirmText = confirmText || '确定'
cancelText = cancelText || '关闭'
wx.showModal({
content,
confirmText,
cancelText: '关闭',
cancelText,
success(res) {
if (res.confirm) {
ok && ok()
@ -308,7 +330,28 @@ export function getUserInfo(cb) {
},
fail(res) {
console.log(res)
alert('获取用户信息失败')
if (res.errMsg == 'getUserInfo:fail auth deny' && wx.openSetting) {
confirm({
content: '若不授用户信息权限, 则无法正常显示用户头像和昵称, 请重新授权用户信息权限',
cancelText: '不授权',
confirmText: '授权',
ok() {
wx.openSetting({
success(res) {
console.log(res)
if (res.authSetting['scope.userInfo']) {
getUserInfo(cb)
} else {
alert('获取用户信息失败')
}
}
})
}
})
} else {
alert('获取用户信息失败')
}
}
})
}