Compare commits

...

9 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
Kiyan
a6a65c8107 fix 订单详情商店链接 2017-05-31 14:50:44 +08:00
Kiyan
acbfb9d567 fix 选择用户地址 2017-05-31 14:36:05 +08:00
Kiyan
28c4297e80 优化 获取用户地址 2017-05-31 08:54:45 +08:00
Kiyan
d65fdc8f92 添加 订单备注 2017-05-26 15:27:39 +08:00
15 changed files with 253 additions and 37 deletions

View File

@ -43,18 +43,16 @@ App({
}
getCurrentAddress(address => {
address = that.setCurrentAddress(address)
cb(address)
this.getLoginInfo(loginInfo => {
if (loginInfo.is_login) {
this.findNearbyUserAddr(userAddress => {
if (userAddress) {
address = userAddress
if (!userAddress) {
return
}
address = that.setCurrentAddress(address)
cb(address)
that.setCurrentAddress(userAddress)
})
} else {
address = that.setCurrentAddress(address)
cb(address)
}
})
})

View File

@ -1,16 +1,17 @@
{
"pages": [
"pages/index/index",
"pages/order/show",
"pages/order/quasi",
"pages/mine/coupon",
"pages/shop/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/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>

103
app/pages/order/content.js Normal file
View File

@ -0,0 +1,103 @@
// pages/order/content.js
import {
getPrevPage
} from '../../utils/util'
const limit = 50
Page({
/**
* 页面的初始数据
*/
data: {
limit,
content: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.callback = options.callback || 'callback'
var content = options.content
var that = this
if (content) {
// fix textarea value not work
setTimeout(function () {
that.setData({
content
})
}, 200)
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onContentInput(e) {
var {value} = e.detail
var {content} = this.data
if (value.length <= limit) {
this.setData({
content: value
})
} else {
this.setData({
content
})
}
},
onSaveTap(e) {
var {content} = this.data
var cb = getPrevPage()[this.callback]
cb && cb(content)
wx.navigateBack({
delta: 1,
})
}
})

View File

@ -0,0 +1,3 @@
{
"navigationBarTitleText": "附加信息"
}

View File

@ -0,0 +1,15 @@
<!--pages/order/content.wxml-->
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell">
<view class="weui-cell__bd">
<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>
<view class="button-sp-area">
<button bindtap="onSaveTap" disabled="{{disabled}}" class="weui-btn" type="primary" loading="{{loading}}">
确定
</button>
</view>

View File

@ -0,0 +1 @@
/* pages/order/content.wxss */

View File

@ -5,15 +5,16 @@ import {
} from '../../utils/apis'
import {
alert,
requestPayment, getCurrentPage
} from '../../utils/util'
Page({
data: {
content: ''
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
this.id = options.id || '2825'
this.id = options.id || '2908'
this.loadData()
},
onReady: function () {
@ -116,17 +117,26 @@ Page({
}
})
},
callbackContent(content) {
this.setData({
content
})
},
onAddOrder(e) {
var that = this
var {id} = this
var {loading} = this.data
var {loading, content, info} = this.data
if (loading) {
return
}
if (!info.receiver_addr_id) {
return alert('请选择收货地址')
}
this.setData({
loading: true
})
addOrder({
remark: content,
quasi_order_id: id,
success(data) {
var order_id = data['order']['order_id']

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>
@ -19,6 +19,7 @@
<view class="weui-cell__bd">支付方式</view>
<view class="">在线支付</view>
</view>
<navigator url="/pages/mine/coupon?id={{info.user_coupon_id}}&callback=callbackCoupon" wx:if="{{info.user_coupon_id}}" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__bd">红包</view>
<view class="weui-cell__ft_in-access">¥{{info.coupon_money}}</view>
@ -28,6 +29,7 @@
<view class="weui-cell__ft">暂无可用</view>
</view>
</view>
<view class="quasi-goods">
<view class="quasi-goods__hd">
<image class="quasi-goods__img" src="/images/shop-512.png"></image>
@ -75,6 +77,15 @@
</view>
</view>
</view>
<view class="weui-cells">
<navigator url="./content?callback=callbackContent&content={{content}}" class="weui-cell weui-cell_access" hover-class="weui-cell_active">
<view class="weui-cell__bd weui-cell__bd_content">备注</view>
<view>{{content}}</view>
<view class="weui-cell__ft weui-cell__ft_in-access">{{content ? '' : '口味, 偏好等要求'}}</view>
</navigator>
</view>
</view>
<view class="quasi-actions">
<view class="quasi-actions__cut">已优惠¥{{info.cut_money_total}}</view>

View File

@ -7,6 +7,9 @@
.weui-media-box_address::after {
right: 15px;
}
.weui-cell__bd_content {
min-width: 4em;
}
/* quasi-goods */
@ -95,4 +98,4 @@
}
.menu-cart__btn::after {
content: none;
}
}

View File

@ -24,7 +24,7 @@ Page({
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
this.id = options.id || 1488
this.id = options.id || 1497
this.loadData()
},
onReady: function () {

View File

@ -1,11 +1,10 @@
<!--pages/order/show.wxml-->
<view class="order-show-tab tab">
<view class="tab__navbar">
<view bindtap="navChange" id="{{index}}" wx:for="{{tabNavs}}" wx:key="{{index}}" class="tab__navbar-item {{index == activeNavIndex? 'tab__navbar-item_active': ''}} ">
订单状态
</view>
<view bindtap="onPhoneTap" class="phone">
<view bindtap="onPhoneTap" class="phone">
<image class="phone__icon" src="/images/chat_phone_normal.png"></image>
</view>
</view>
@ -33,10 +32,10 @@
<view class="weui-cells__title">订单详情</view>
<view class="quasi-goods">
<view class="quasi-goods__hd weui-flex">
<navigator url="/pages/shop/show?id={{info.seller_id}}" class=" trangle">
<view>
<image class="quasi-goods__img" src="/images/shop-512.png"></image>
{{info.seller_name}}
</navigator>
</view>
<view class=" weui-flex__item"></view>
<view class="grey-color">爱跑腿专送</view>
</view>
@ -110,6 +109,7 @@
</view>
</view>
</view>
<view class="weui-cell">
<view class="weui-cell__hd">
配送服务
@ -118,6 +118,14 @@
爱跑腿专送
</view>
</view>
<view class="weui-cell">
<view class="weui-cell__hd">
备注
</view>
<view class="weui-cell__bd">
{{info.remark || '无'}}
</view>
</view>
</view>
<view class="weui-cells__title">订单信息</view>
<view class="weui-cells weui-cells_after-title">

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
})
@ -397,7 +403,7 @@ export function updateOrderCoupon(options) {
// 添加订单
export function addOrder(options) {
var {
quasi_order_id,
quasi_order_id, remark,
success, error
} = options
getApp().getLoginInfo(loginInfo => {
@ -409,7 +415,7 @@ export function addOrder(options) {
url: 'index.php?m=Mall&c=Order&a=addOrder',
data: {
user_id, user_token,
quasi_order_id
quasi_order_id, remark
},
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('获取用户信息失败')
}
}
})
}