Compare commits

..

No commits in common. "master" and "v1.0.3" have entirely different histories.

11 changed files with 31 additions and 101 deletions

View File

@ -48,10 +48,11 @@ App({
this.getLoginInfo(loginInfo => { this.getLoginInfo(loginInfo => {
if (loginInfo.is_login) { if (loginInfo.is_login) {
this.findNearbyUserAddr(userAddress => { this.findNearbyUserAddr(userAddress => {
if (!userAddress) { if (userAddress) {
return address = userAddress
} }
that.setCurrentAddress(userAddress) address = that.setCurrentAddress(address)
cb(address)
}) })
} }
}) })

View File

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

View File

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

View File

@ -12,12 +12,6 @@
<view class="grey-color"> <view class="grey-color">
{{item.addr}} {{item.detail}} {{item.addr}} {{item.detail}}
</view> </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>
</view> </view>

View File

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

View File

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

View File

@ -5,7 +5,6 @@ import {
} from '../../utils/apis' } from '../../utils/apis'
import { import {
alert,
requestPayment, getCurrentPage requestPayment, getCurrentPage
} from '../../utils/util' } from '../../utils/util'
Page({ Page({
@ -14,7 +13,7 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数 // 页面初始化 options为页面跳转所带来的参数
this.id = options.id || '2908' this.id = options.id || '2843'
this.loadData() this.loadData()
}, },
onReady: function () { onReady: function () {
@ -125,13 +124,10 @@ Page({
onAddOrder(e) { onAddOrder(e) {
var that = this var that = this
var {id} = this var {id} = this
var {loading, content, info} = this.data var {loading, content} = this.data
if (loading) { if (loading) {
return return
} }
if (!info.receiver_addr_id) {
return alert('请选择收货地址')
}
this.setData({ this.setData({
loading: true loading: true
}) })

View File

@ -10,7 +10,7 @@
</view> </view>
</navigator> </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 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> </navigator>
</view> </view>
</view> </view>

View File

@ -32,10 +32,10 @@
<view class="weui-cells__title">订单详情</view> <view class="weui-cells__title">订单详情</view>
<view class="quasi-goods"> <view class="quasi-goods">
<view class="quasi-goods__hd weui-flex"> <view class="quasi-goods__hd weui-flex">
<view> <navigator url="/pages/shop/show?id={{info.seller_id}}" class=" trangle">
<image class="quasi-goods__img" src="/images/shop-512.png"></image> <image class="quasi-goods__img" src="/images/shop-512.png"></image>
{{info.seller_name}} {{info.seller_name}}
</view> </navigator>
<view class=" weui-flex__item"></view> <view class=" weui-flex__item"></view>
<view class="grey-color">爱跑腿专送</view> <view class="grey-color">爱跑腿专送</view>
</view> </view>

View File

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

View File

@ -57,29 +57,8 @@ export function getCurrentAddressList(options) {
}, },
fail(res) { fail(res) {
console.log(res.errMsg) console.log(res.errMsg)
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('获取用户地址失败') alert('获取用户地址失败')
} }
}
})
}
})
} else {
alert('获取用户地址失败')
}
}
}) })
} }
@ -222,15 +201,14 @@ export function alert(content, callback) {
// 确认框 // 确认框
export function confirm(options) { export function confirm(options) {
var { var {
content, confirmText, cancelText, content, confirmText,
ok, ok,
} = options } = options
confirmText = confirmText || '确定' confirmText = confirmText || '确定'
cancelText = cancelText || '关闭'
wx.showModal({ wx.showModal({
content, content,
confirmText, confirmText,
cancelText, cancelText: '关闭',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
ok && ok() ok && ok()
@ -330,29 +308,8 @@ export function getUserInfo(cb) {
}, },
fail(res) { fail(res) {
console.log(res) console.log(res)
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('获取用户信息失败') alert('获取用户信息失败')
} }
}
})
}
})
} else {
alert('获取用户信息失败')
}
}
}) })
} }
} }