Compare commits

..

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

28 changed files with 40 additions and 371 deletions

0
.gitignore vendored
View File

21
LICENSE
View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2017 Kiyan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,47 +1 @@
# 微信小程序-爱跑腿外卖
## 配置
### 接口域名切换, 默认为正式接口域名
```javascript
// 测试域名
wx.setStorageSync('debug', true)
// 正式域名
wx.removeStorageSync('debug')
```
### request合法域名
```text
https://apis.map.qq.com
https://api.ipaotui.com
https://apitest.ipaotui.com
```
## 预览
### 首页
![index](/images/index.png)
### 商店详情
![shop](/images/shop.png)
### 订单列表
![order list](/images/order-list.png)
### 订单详情
![order show](/images/order-show.png)
### 我的
![mine](/images/mine.png)
### 小程序二维码
![qrcode](/images/gh_d4b22dcbcbad_430.jpg)
#ipaotui-mall

View File

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

View File

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

View File

@ -53,14 +53,6 @@ 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,12 +12,6 @@
<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

@ -1,3 +1 @@
{
"navigationBarTitleText": "选择地址"
}
{}

View File

@ -1,38 +1,7 @@
<import src="/templates/star-rate.wxml" />
<template name="shop">
<view wx:if="{{is_rest == 1}}" class="weui-media-box weui-media-box_appmsg shop__item">
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
<image class="weui-media-box__thumb" src="{{pic_url}}" />
<view class="shop__rest">休息中</view>
</view>
<view class="weui-media-box__bd weui-media-box__bd_in-appmsg">
<view class="weui-media-box__title">{{seller_name}}</view>
<view class="weui-media-box__desc shop__desc">
<view class="shop__sales">
<view class="shop__star">
<template is="star-rate" data="{{value: overall}}" />
</view>
<view>月售 {{sales}} 单</view>
</view>
<view class="shop__misc weui-flex">
<view class="shop__fee weui-flex__item">
起送 ¥{{min_price}}
</view>
<text class="shop__reach-time grey-color">{{distanceFormat}}km</text> |
<text class="shop__reach-time primary-color">{{reach_time}}分钟</text>
</view>
</view>
<view wx:if="{{promotion.length > 0}}" class="shop__promotion">
<view wx:for="{{promotion}}" wx:key="index" class="shop__promotion-item">
<image class="shop__promotion-icon" src="{{item.pic_url}}"></image>
{{item.info}}
</view>
</view>
</view>
</view>
<navigator wx:else url="/pages/shop/show?id={{seller_id}}" class="weui-media-box weui-media-box_appmsg shop__item" hover-class="weui-cell_active">
<navigator url="/pages/shop/show?id={{seller_id}}" class="weui-media-box weui-media-box_appmsg shop__item" hover-class="weui-cell_active">
<view class="weui-media-box__hd weui-media-box__hd_in-appmsg">
<image class="weui-media-box__thumb" src="{{pic_url}}" />
</view>

View File

@ -1,20 +1,5 @@
@import '/templates/star-rate.wxss';
.weui-media-box__hd {
position: relative;
}
.shop__rest {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
line-height: 1.5;
color: #fff;
font-size: 0.8em;
background-color: #999;
}
.shop__item {
align-items: flex-start;
background-color: #fff;

View File

@ -1,103 +0,0 @@
// 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

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

View File

@ -1,15 +0,0 @@
<!--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

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

View File

@ -5,16 +5,15 @@ import {
} from '../../utils/apis'
import {
alert,
requestPayment, getCurrentPage
} from '../../utils/util'
Page({
data: {
content: ''
},
onLoad: function (options) {
// 页面初始化 options为页面跳转所带来的参数
this.id = options.id || '2908'
this.id = options.id || '2825'
this.loadData()
},
onReady: function () {
@ -117,26 +116,17 @@ Page({
}
})
},
callbackContent(content) {
this.setData({
content
})
},
onAddOrder(e) {
var that = this
var {id} = this
var {loading, content, info} = this.data
var {loading} = 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,7 +19,6 @@
<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>
@ -29,7 +28,6 @@
<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>
@ -77,15 +75,6 @@
</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,9 +7,6 @@
.weui-media-box_address::after {
right: 15px;
}
.weui-cell__bd_content {
min-width: 4em;
}
/* quasi-goods */
@ -98,4 +95,4 @@
}
.menu-cart__btn::after {
content: none;
}
}

View File

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

View File

@ -1,10 +1,11 @@
<!--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>
@ -32,10 +33,10 @@
<view class="weui-cells__title">订单详情</view>
<view class="quasi-goods">
<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>
{{info.seller_name}}
</view>
</navigator>
<view class=" weui-flex__item"></view>
<view class="grey-color">爱跑腿专送</view>
</view>
@ -109,7 +110,6 @@
</view>
</view>
</view>
<view class="weui-cell">
<view class="weui-cell__hd">
配送服务
@ -118,14 +118,6 @@
爱跑腿专送
</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,20 +87,14 @@ export function login(options) {
} = options
wx.login({
success(res) {
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
})
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
})
},
error(res) {
@ -257,7 +251,7 @@ export function updateUserAddr(options) {
city_id: address.city_id,
city_name: address.city,
district_id: address.district_id,
district_name: address.district,
district_name: address.district_name,
},
success, error
})
@ -403,7 +397,7 @@ export function updateOrderCoupon(options) {
// 添加订单
export function addOrder(options) {
var {
quasi_order_id, remark,
quasi_order_id,
success, error
} = options
getApp().getLoginInfo(loginInfo => {
@ -415,7 +409,7 @@ export function addOrder(options) {
url: 'index.php?m=Mall&c=Order&a=addOrder',
data: {
user_id, user_token,
quasi_order_id, remark
quasi_order_id
},
success, error
})

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 KiB