Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8d8f0f7c5f | ||
|
9dfa21bfdd | ||
|
d6ae812e27 | ||
|
87a1eac740 | ||
|
d7737a9fe1 | ||
|
a6a65c8107 | ||
|
acbfb9d567 | ||
|
28c4297e80 | ||
|
d65fdc8f92 |
12
app/app.js
12
app/app.js
@ -43,18 +43,16 @@ App({
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCurrentAddress(address => {
|
getCurrentAddress(address => {
|
||||||
|
address = that.setCurrentAddress(address)
|
||||||
|
cb(address)
|
||||||
this.getLoginInfo(loginInfo => {
|
this.getLoginInfo(loginInfo => {
|
||||||
if (loginInfo.is_login) {
|
if (loginInfo.is_login) {
|
||||||
this.findNearbyUserAddr(userAddress => {
|
this.findNearbyUserAddr(userAddress => {
|
||||||
if (userAddress) {
|
if (!userAddress) {
|
||||||
address = userAddress
|
return
|
||||||
}
|
}
|
||||||
address = that.setCurrentAddress(address)
|
that.setCurrentAddress(userAddress)
|
||||||
cb(address)
|
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
address = that.setCurrentAddress(address)
|
|
||||||
cb(address)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
11
app/app.json
11
app/app.json
@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [
|
||||||
"pages/index/index",
|
"pages/index/index",
|
||||||
"pages/order/show",
|
"pages/address/select",
|
||||||
"pages/order/quasi",
|
|
||||||
"pages/mine/coupon",
|
|
||||||
"pages/shop/show",
|
|
||||||
"pages/mine/mine",
|
"pages/mine/mine",
|
||||||
|
"pages/order/quasi",
|
||||||
|
"pages/order/show",
|
||||||
|
"pages/shop/show",
|
||||||
"pages/order/list",
|
"pages/order/list",
|
||||||
|
"pages/order/content",
|
||||||
|
"pages/mine/coupon",
|
||||||
"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",
|
||||||
|
@ -53,6 +53,14 @@ 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({
|
||||||
|
@ -12,6 +12,12 @@
|
|||||||
<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>
|
||||||
|
103
app/pages/order/content.js
Normal file
103
app/pages/order/content.js
Normal 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,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
3
app/pages/order/content.json
Normal file
3
app/pages/order/content.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "附加信息"
|
||||||
|
}
|
15
app/pages/order/content.wxml
Normal file
15
app/pages/order/content.wxml
Normal 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>
|
1
app/pages/order/content.wxss
Normal file
1
app/pages/order/content.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* pages/order/content.wxss */
|
@ -5,15 +5,16 @@ import {
|
|||||||
} from '../../utils/apis'
|
} from '../../utils/apis'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
alert,
|
||||||
requestPayment, getCurrentPage
|
requestPayment, getCurrentPage
|
||||||
} from '../../utils/util'
|
} from '../../utils/util'
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
|
content: ''
|
||||||
},
|
},
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
// 页面初始化 options为页面跳转所带来的参数
|
// 页面初始化 options为页面跳转所带来的参数
|
||||||
this.id = options.id || '2825'
|
this.id = options.id || '2908'
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
onReady: function () {
|
onReady: function () {
|
||||||
@ -116,17 +117,26 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
callbackContent(content) {
|
||||||
|
this.setData({
|
||||||
|
content
|
||||||
|
})
|
||||||
|
},
|
||||||
onAddOrder(e) {
|
onAddOrder(e) {
|
||||||
var that = this
|
var that = this
|
||||||
var {id} = this
|
var {id} = this
|
||||||
var {loading} = this.data
|
var {loading, content, info} = this.data
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!info.receiver_addr_id) {
|
||||||
|
return alert('请选择收货地址')
|
||||||
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
loading: true
|
loading: true
|
||||||
})
|
})
|
||||||
addOrder({
|
addOrder({
|
||||||
|
remark: content,
|
||||||
quasi_order_id: id,
|
quasi_order_id: id,
|
||||||
success(data) {
|
success(data) {
|
||||||
var order_id = data['order']['order_id']
|
var order_id = data['order']['order_id']
|
||||||
|
@ -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>
|
||||||
@ -19,6 +19,7 @@
|
|||||||
<view class="weui-cell__bd">支付方式</view>
|
<view class="weui-cell__bd">支付方式</view>
|
||||||
<view class="">在线支付</view>
|
<view class="">在线支付</view>
|
||||||
</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">
|
<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__bd">红包</view>
|
||||||
<view class="weui-cell__ft_in-access">¥{{info.coupon_money}}</view>
|
<view class="weui-cell__ft_in-access">¥{{info.coupon_money}}</view>
|
||||||
@ -28,6 +29,7 @@
|
|||||||
<view class="weui-cell__ft">暂无可用</view>
|
<view class="weui-cell__ft">暂无可用</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="quasi-goods">
|
<view class="quasi-goods">
|
||||||
<view class="quasi-goods__hd">
|
<view class="quasi-goods__hd">
|
||||||
<image class="quasi-goods__img" src="/images/shop-512.png"></image>
|
<image class="quasi-goods__img" src="/images/shop-512.png"></image>
|
||||||
@ -75,6 +77,15 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</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>
|
||||||
<view class="quasi-actions">
|
<view class="quasi-actions">
|
||||||
<view class="quasi-actions__cut">已优惠¥{{info.cut_money_total}}</view>
|
<view class="quasi-actions__cut">已优惠¥{{info.cut_money_total}}</view>
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
.weui-media-box_address::after {
|
.weui-media-box_address::after {
|
||||||
right: 15px;
|
right: 15px;
|
||||||
}
|
}
|
||||||
|
.weui-cell__bd_content {
|
||||||
|
min-width: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
/* quasi-goods */
|
/* quasi-goods */
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ Page({
|
|||||||
},
|
},
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
// 页面初始化 options为页面跳转所带来的参数
|
// 页面初始化 options为页面跳转所带来的参数
|
||||||
this.id = options.id || 1488
|
this.id = options.id || 1497
|
||||||
this.loadData()
|
this.loadData()
|
||||||
},
|
},
|
||||||
onReady: function () {
|
onReady: function () {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<!--pages/order/show.wxml-->
|
<!--pages/order/show.wxml-->
|
||||||
<view class="order-show-tab tab">
|
<view class="order-show-tab tab">
|
||||||
<view class="tab__navbar">
|
<view class="tab__navbar">
|
||||||
@ -33,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">
|
||||||
<navigator url="/pages/shop/show?id={{info.seller_id}}" class=" trangle">
|
<view>
|
||||||
<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}}
|
||||||
</navigator>
|
</view>
|
||||||
<view class=" weui-flex__item"></view>
|
<view class=" weui-flex__item"></view>
|
||||||
<view class="grey-color">爱跑腿专送</view>
|
<view class="grey-color">爱跑腿专送</view>
|
||||||
</view>
|
</view>
|
||||||
@ -110,6 +109,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="weui-cell">
|
<view class="weui-cell">
|
||||||
<view class="weui-cell__hd">
|
<view class="weui-cell__hd">
|
||||||
配送服务
|
配送服务
|
||||||
@ -118,6 +118,14 @@
|
|||||||
爱跑腿专送
|
爱跑腿专送
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="weui-cell">
|
||||||
|
<view class="weui-cell__hd">
|
||||||
|
备注
|
||||||
|
</view>
|
||||||
|
<view class="weui-cell__bd">
|
||||||
|
{{info.remark || '无'}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="weui-cells__title">订单信息</view>
|
<view class="weui-cells__title">订单信息</view>
|
||||||
<view class="weui-cells weui-cells_after-title">
|
<view class="weui-cells weui-cells_after-title">
|
||||||
|
@ -87,15 +87,21 @@ 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'])
|
||||||
@ -251,7 +257,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_name,
|
district_name: address.district,
|
||||||
},
|
},
|
||||||
success, error
|
success, error
|
||||||
})
|
})
|
||||||
@ -397,7 +403,7 @@ export function updateOrderCoupon(options) {
|
|||||||
// 添加订单
|
// 添加订单
|
||||||
export function addOrder(options) {
|
export function addOrder(options) {
|
||||||
var {
|
var {
|
||||||
quasi_order_id,
|
quasi_order_id, remark,
|
||||||
success, error
|
success, error
|
||||||
} = options
|
} = options
|
||||||
getApp().getLoginInfo(loginInfo => {
|
getApp().getLoginInfo(loginInfo => {
|
||||||
@ -409,7 +415,7 @@ export function addOrder(options) {
|
|||||||
url: 'index.php?m=Mall&c=Order&a=addOrder',
|
url: 'index.php?m=Mall&c=Order&a=addOrder',
|
||||||
data: {
|
data: {
|
||||||
user_id, user_token,
|
user_id, user_token,
|
||||||
quasi_order_id
|
quasi_order_id, remark
|
||||||
},
|
},
|
||||||
success, error
|
success, error
|
||||||
})
|
})
|
||||||
|
@ -57,8 +57,29 @@ 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('获取用户地址失败')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,14 +222,15 @@ export function alert(content, callback) {
|
|||||||
// 确认框
|
// 确认框
|
||||||
export function confirm(options) {
|
export function confirm(options) {
|
||||||
var {
|
var {
|
||||||
content, confirmText,
|
content, confirmText, cancelText,
|
||||||
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()
|
||||||
@ -308,8 +330,29 @@ 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('获取用户信息失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user