提交 b6a87f72 编写于 作者: M maguohua

confrim

上级 a8df5a43
......@@ -66,7 +66,13 @@ vue2 + vue-rotuer2 + vuex + webpack + ES6/7 + fetch + sass + flex + svg + http-p
| |-- city // 当前城市页
| |-- food // 食品筛选排序页
| |-- confirmOrder // 确认订单页
| |--children
| |--children
| |--chooseAddress // 选择地址页
| |--children
| |--addAddress // 添加地址页
| |--children
| |--searchAddress // 搜索地址页
| |--invoice // 选择发票页
| |--remark // 订单备注页
| |-- forget // 忘记密码,修改密码页
| |-- home // 首页
......@@ -83,9 +89,10 @@ vue2 + vue-rotuer2 + vuex + webpack + ES6/7 + fetch + sass + flex + svg + http-p
| |-- search // 搜索页
|       |-- shop                     // 商铺筛选页
| |-- children
| |-- foodDetail // 单个商铺信息页
| |-- shopDetail // 商铺信息页
| |-- shopSafe // 商铺认证信息页
| |-- foodDetail // 单个商铺信息页
| |-- children
| |-- shopSafe // 商铺认证信息页
| |-- shopDetail // 商铺信息页
| |-- vipcard // vip办理页
|
| |-- plugins // 引用的插件
......
......@@ -22,7 +22,7 @@
mounted(){
},
props: ['showHide','alertText'],
props: ['alertText'],
methods: {
closeTip(){
this.$emit('closeTip')
......
......@@ -24,7 +24,7 @@
</template>
<script>
import {mapState, mapMutations} from 'vuex'
import {mapState, mapActions} from 'vuex'
export default {
data(){
return{
......@@ -33,10 +33,12 @@
},
created(){
//获取本地存储的用户信息
this.GET_USERINFO();
if (this.signinUp) {
this.getUserInfo();
}
},
mounted(){
},
props: ['signinUp', 'headTitle', 'goBack'],
computed: {
......@@ -45,8 +47,8 @@
]),
},
methods: {
...mapMutations([
'GET_USERINFO',
...mapActions([
'getUserInfo'
]),
},
......
import {baseUrl} from './env'
import {
baseUrl
} from './env'
export default async (type = 'GET', url = '', data = {}) => {
export default async(type = 'GET', url = '', data = {}, method = 'fetch') => {
type = type.toUpperCase();
url = baseUrl + url;
......@@ -16,16 +18,16 @@ export default async (type = 'GET', url = '', data = {}) => {
}
}
if (window.fetch) {
if (window.fetch && method == 'fetch') {
let requestConfig = {
credentials: 'include',
method: type,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
mode: "cors",
cache: "only-if-cached"
method: type,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
mode: "cors",
cache: "only-if-cached"
}
if (type == 'POST') {
......@@ -37,12 +39,11 @@ export default async (type = 'GET', url = '', data = {}) => {
try {
var response = await fetch(url, requestConfig);
var responseJson = await response.json();
}catch (error){
} catch (error) {
throw new Error(error)
}
return responseJson
}else{
} else {
let requestObj;
if (window.XMLHttpRequest) {
requestObj = new XMLHttpRequest();
......@@ -62,12 +63,13 @@ export default async (type = 'GET', url = '', data = {}) => {
requestObj.onreadystatechange = () => {
if (requestObj.readyState == 4) {
if (requestObj.status == 200) {
let obj = requestObj.response
if (typeof obj !== 'object') {
obj = JSON.parse(obj);
}
return obj
}else {
} else {
throw new Error(requestObj)
}
}
......
<template>
<div class="address_page">
<head-top head-title="添加地址" go-back='true'></head-top>
<section class="page_text_container">
<section class="section_list">
<span class="section_left">联系人</span>
<section class="section_right">
<input type="text" name="name" placeholder="你的名字" v-model="name" class="input_style">
<div class="choose_sex">
<span class="choose_option">
<svg class="address_empty_right" @click="chooseSex(1)" :class="{choosed: sex == 1}">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#select"></use>
</svg>
<span>先生</span>
</span>
<span class="choose_option">
<svg class="address_empty_right" @click="chooseSex(2)" :class="{choosed: sex == 2}">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#select"></use>
</svg>
<span>女士</span>
</span>
</div>
</section>
</section>
<section class="section_list">
<span class="section_left">联系电话</span>
<section class="section_right">
<div class="phone_add">
<input type="text" name="phone" placeholder="你的手机号" v-model="phone" class="input_style">
<img src="../../../../images/add_phone.png" height="20" width="20" @click="phone_bk = true">
</div>
<input v-if="phone_bk" type="text" name="anntherPhoneNumber" placeholder="备选电话" v-model="anntherPhoneNumber" class="input_style phone_bk">
</section>
</section>
<section class="section_list">
<span class="section_left">送餐地址</span>
<section class="section_right">
<router-link to="/confirmOrder/chooseAddress/addAddress/searchAddress" tag="div" class="choose_address">{{searchAddress? searchAddress.name : '小区/写字楼/学校等'}}</router-link>
<input type="text" name="address_detail" placeholder="详细地址(如门牌号等)" v-model="address_detail" class="input_style">
</section>
</section>
<section class="section_list">
<span class="section_left">标签</span>
<section class="section_right">
<input type="text" name="tag" placeholder="无/家/学校/公司" v-model="tag" class="input_style">
</section>
</section>
</section>
<div class="determine" @click="addAddress">确定</div>
<alert-tip v-if="showAlert" @closeTip="showAlert = false" :alertText="alertText"></alert-tip>
<transition name="router-slid">
<router-view></router-view>
</transition>
</div>
</template>
<script>
import headTop from '../../../../components/header/head'
import {mapState, mapMutations} from 'vuex'
import {getAddress, getUser, postAddAddress} from '../../../../service/getData'
import alertTip from '../../../../components/common/alertTip'
export default {
data(){
return{
name: null,
sex: 1,
phone: null,
address_detail: null,
tag: '',
tag_type: 1,
phone_bk: false,
anntherPhoneNumber: '',
showAlert: false,
alertText: null,
poi_type: 0,
}
},
created(){
},
components: {
headTop,
alertTip,
},
computed: {
...mapState([
'searchAddress', 'geohash', 'userInfo',
]),
},
methods: {
...mapMutations([
]),
chooseSex(sex){
this.sex = sex;
},
async addAddress(){
if (!(this.userInfo && this.userInfo.user_id)) {
this.showAlert = true;
this.alertText = '请登陆'
}else if(!this.name){
this.showAlert = true;
this.alertText = '请输入姓名'
}else if(!this.phone){
this.showAlert = true;
this.alertText = '请输入电话号码'
}else if(!this.searchAddress){
this.showAlert = true;
this.alertText = '请选择地址'
}else if(!this.address_detail){
this.showAlert = true;
this.alertText = '请输入详细地址'
}
if (this.tag == '') {
this.tag_type = 2;
}else if(this.tag == '学校'){
this.tag_type = 3;
}else if(this.tag == '公司'){
this.tag_type = 4;
}
let res = await postAddAddress(this.userInfo.user_id, this.searchAddress.name, this.address_detail, this.geohash, this.name, this.phone, this.anntherPhoneNumber, 0, this.sex, this.tag, this.tag_type);
this.$router.go(-1);
},
}
}
</script>
<style lang="scss" scoped>
@import '../../../../style/mixin';
.address_page{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #f5f5f5;
z-index: 204;
padding-top: 1.95rem;
p, span, input{
font-family: Helvetica Neue,Tahoma,Arial;
}
}
.page_text_container{
background-color: #fff;
padding: 0 .7rem;
}
.section_list{
display: flex;
border-bottom: 0.025rem solid #f5f5f5;
.section_left{
@include sc(.7rem, #333);
flex: 2;
line-height: 2.5rem;
}
.section_right{
flex: 5;
.input_style{
width: 100%;
height: 2.5rem;
@include sc(.7rem, #999);
}
.phone_bk{
border-top: 0.025rem solid #f5f5f5;
}
.phone_add{
@include fj;
align-items: center;
}
.choose_sex{
display: flex;
line-height: 2.5rem;
border-top: 0.025rem solid #f5f5f5;
.choose_option{
@include sc(.7rem, #333);
display: flex;
align-items: center;
margin-right: .8rem;
svg{
margin-right: .3rem;
@include wh(.8rem, .8rem);
fill: #ccc;
}
.choosed{
fill: #4cd964;
}
}
}
.choose_address{
@include sc(.7rem, #999);
line-height: 2.5rem;
border-bottom: 0.025rem solid #f5f5f5;
}
}
}
.determine{
background-color: #4cd964;
@include sc(.7rem, #fff);
text-align: center;
margin: 0 .7rem;
line-height: 1.8rem;
border-radius: 0.2rem;
margin-top: .6rem;
}
.router-slid-enter-active, .router-slid-leave-active {
transition: all .4s;
}
.router-slid-enter, .router-slid-leave-active {
transform: translateX(100%);
}
</style>
<template>
<div class="search_address_page">
<section>
<head-top head-title="搜索" go-back='true'></head-top>
<form class="search_form">
<input type="search" name="search" placeholder="请输入小区/写字楼/学校等" v-model="searchValue">
<button @click.prevent="searchPlace()">搜索</button>
</form>
<ul class="address_list" v-if="searchData">
<li v-for="(item, index) in searchData" :key="index" @click="choooedAddress(item)">
<h4>{{item.name}}</h4>
<p>{{item.address}}</p>
</li>
</ul>
<div v-else class="empty_tips">
<p>找不到地址?</p>
<p>尝试输入小区、写字楼或学校名</p>
<p>详细地址(如门牌号等)可稍后输入哦</p>
</div>
</section>
</div>
</template>
<script>
import headTop from '../../../../../components/header/head'
import {searchNearby} from '../../../../../service/getData'
import {mapMutations} from 'vuex'
export default {
data(){
return{
searchValue: null,
searchData: null,
}
},
components: {
headTop,
},
props:[],
methods: {
...mapMutations([
'CHOOSE_SEARCH_ADDRESS'
]),
async searchPlace(){
if (this.searchValue) {
this.searchData = await searchNearby(this.searchValue);
}
},
choooedAddress(item){
this.CHOOSE_SEARCH_ADDRESS(item);
this.$router.go(-1);
},
}
}
</script>
<style lang="scss" scoped>
@import '../../../../../style/mixin';
.search_address_page{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #fff;
z-index: 204;
overflow-y: auto;
padding-top: 1.95rem;
p, span{
font-family: Helvetica Neue,Tahoma,Arial;
}
}
.search_form{
display: flex;
padding: .7rem;
input{
@include sc(.65rem, #999);
flex: 4;
background-color: #f1f1f1;
margin-right: .6rem;
height: 1.5rem;
border-radius: 0.15rem;
padding: 0 .4rem;
}
button{
flex: 1;
@include sc(.65rem, #fff);
background-color: $blue;
border-radius: 0.15rem;
}
}
.address_list{
padding: .7rem;
li{
padding: .7rem 0;
border-bottom: 0.025rem solid #f5f5f5;
line-height: 1rem;
h4{
@include sc(.75rem, #555);
}
p{
@include sc(.65rem, #999);
}
}
}
.empty_tips{
@include center;
width: 100%;
p{
@include sc(.5rem, #aaa);
line-height: .7rem;
text-align: center;
}
}
</style>
<template>
<div class="rating_page">
<head-top head-title="选择地址" go-back='true'></head-top>
<router-link to="/confirmOrder/chooseAddress/addAddress" class="add_icon_footer" >
<img src="../../../images/add_address.png" height="24" width="24">
<span>新增收货地址</span>
</router-link>
<ul class="deliverable_address">
<li v-for="(item,index) in deliverable" @click="chooseAddress(item, index)">
<svg class="choosed_address" :class="{default_address: defaultIndex == index}">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#select"></use>
</svg>
<div>
<header>
<span>{{item.name}}</span>
<span>{{item.sex == 1? '先生' : '女士'}}</span>
<span>{{item.phone}}</span>
</header>
<div class="address_detail ellipsis">
<span :style="{backgroundColor: iconColor(item.tag)}">{{item.tag}}</span>
<p>{{item.address_detail}}</p>
</div>
</div>
</li>
</ul>
<section id="out_delivery" v-if="deliverdisable.length">
<header class="out_header">以下地址超出配送范围</header>
<ul class="deliverable_address">
<li v-for="(item,index) in deliverdisable">
<svg class="choosed_address">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#select"></use>
</svg>
<div>
<header>
<span>{{item.name}}</span>
<span>{{item.sex == 1? '先生' : '女士'}}</span>
<span>{{item.phone}}</span>
</header>
<div class="address_detail ellipsis">
<span v-if="item.tag" :style="{backgroundColor: '#ccc'}">{{item.tag}}</span>
<p>{{item.address_detail}}</p>
</div>
</div>
</li>
</ul>
</section>
<alert-tip v-if="showAlert" @closeTip="showAlert = false" :alertText="alertText"></alert-tip>
<transition name="router-slid">
<router-view></router-view>
</transition>
</div>
</template>
<script>
import headTop from '../../../components/header/head'
import {mapState, mapMutations} from 'vuex'
import {getAddress} from '../../../service/getData'
import alertTip from '../../../components/common/alertTip'
export default {
data(){
return{
addressList: [],
deliverable: [],
deliverdisable: [],
id: null,
sig: null,
showAlert: false,
alertText: null,
}
},
created(){
this.id = this.$route.query.id;
this.sig = this.$route.query.sig;
// var date=new Date();
// date.setTime(date.getTime()-10000);
// document.cookie="USERID=186655961; expires=" + date.toGMTString() ;
// document.cookie="SID=euYTx4hkmHEa1HdhpbkvaxXLvuR7lb2WjlwQ; expires=" + date.toGMTString();
this.initData();
},
components: {
headTop,
alertTip,
},
props:[],
computed: {
...mapState([
'userInfo', 'addressIndex'
]),
defaultIndex: function (){
if (this.addressIndex) {
return this.addressIndex;
}else{
return 0;
}
}
},
methods: {
...mapMutations([
'CHOOSE_ADDRESS'
]),
async initData(){
if (!(this.userInfo && this.userInfo.user_id)) {
this.showAlert = true;
this.alertText = '请登陆'
return
}
this.addressList = await getAddress(this.id, this.sig);
this.addressList.forEach(item => {
if (item.is_deliverable) {
this.deliverable.push(item);
}else{
this.deliverdisable.push(item);
}
})
},
iconColor(name){
switch(name){
case '公司': return '#4cd964';
case '学校': return '#3190e8';
}
},
chooseAddress(address, index){
this.CHOOSE_ADDRESS({address, index});
this.$router.go(-1);
},
}
}
</script>
<style lang="scss" scoped>
@import '../../../style/mixin';
.rating_page{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #f5f5f5;
z-index: 204;
padding-top: 1.95rem;
p, span{
font-family: Helvetica Neue,Tahoma,Arial;
}
}
.add_icon_footer{
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 2.5rem;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
z-index: 204;
span{
@include sc(.7rem, $blue);
margin-left: .3rem;
}
}
.deliverable_address{
background-color: #fff;
li{
display: flex;
align-items: center;
border-bottom: 0.025rem solid #f5f5f5;
padding: .7rem;
line-height: 1rem;
.choosed_address{
@include wh(.8rem, .8rem);
fill: #4cd964;
margin-right: .4rem;
opacity: 0;
}
.default_address{
opacity: 1;
}
header{
@include sc(.75rem, #333);
span:nth-of-type(1){
font-size: .85rem;
font-weight: bold;
}
}
.address_detail{
width: 100%;
display: flex;
align-items: center;
span{
@include sc(.5rem, #fff);
border-radius: .15rem;
background-color: #ff5722;
height: .65rem;
line-height: .65rem;
padding: 0 .3rem;
margin-right: .3rem;
}
p{
@include sc(.65rem, #777);
}
}
}
}
#out_delivery{
.out_header{
@include sc(.6rem, #666);
line-height: 1.5rem;
padding-left: .5rem;
}
*{
color: #ccc;
}
}
.router-slid-enter-active, .router-slid-leave-active {
transition: all .4s;
}
.router-slid-enter, .router-slid-leave-active {
transform: translateX(100%);
}
</style>
<template>
<div class="rating_page">
<head-top head-title="选择发票抬头" go-back='true'></head-top>
<section class="choose_invoice">
<span>不需要开发票</span>
<svg @click="chooseInvoice" :class="{choosed: invoice}">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#select"></use>
</svg>
</section>
<div class="determine" @click="confrimInvoice">确定</div>
</div>
</template>
<script>
import headTop from '../../../components/header/head'
import {mapMutations} from 'vuex'
export default {
data(){
return{
invoice: false, //是否需要发票
}
},
components: {
headTop,
},
props:[],
methods: {
...mapMutations([
'CONFIRM_INVOICE'
]),
chooseInvoice(){
this.invoice = !this.invoice;
},
confrimInvoice(){
this.CONFIRM_INVOICE(this.invoice);
this.$router.go(-1);
},
}
}
</script>
<style lang="scss" scoped>
@import '../../../style/mixin';
.rating_page{
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #f5f5f5;
z-index: 204;
padding-top: 1.95rem;
p, span{
font-family: Helvetica Neue,Tahoma,Arial;
}
}
.choose_invoice{
@include fj;
align-items: center;
background-color: #fff;
line-height: 2.5rem;
margin-top: 0.5rem;
padding: 0 .7rem;
span{
@include sc(.75rem, #333);
}
svg{
@include wh(.8rem, .8rem);
fill: #999;
}
.choosed{
fill: #4cd964;
}
}
.determine{
background-color: #4cd964;
@include sc(.7rem, #fff);
text-align: center;
margin: 0 .7rem;
line-height: 1.8rem;
border-radius: 0.2rem;
margin-top: 0.5rem;
}
</style>
......@@ -2,17 +2,28 @@
<div class="confirmOrderContainer">
<section v-if="!showLoading">
<head-top head-title="确认订单" goBack="true" signin-up='confirmOrder'></head-top>
<section class="address_container">
<router-link :to='{path: "/confirmOrder/chooseAddress", query: {id: checkoutData.cart.id, sig: checkoutData.sig}}' class="address_container">
<div class="address_empty_left">
<svg class="location_icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#location"></use>
</svg>
<span class="add_address">请添加一个收获地址</span>
<div class="add_address" v-if="!choosedAddress">请添加一个收获地址</div>
<div v-else class="address_detail_container">
<header>
<span>{{choosedAddress.name}}</span>
<span>{{choosedAddress.sex == 1? '先生':'女士'}}</span>
<span>{{choosedAddress.phone}}</span>
</header>
<div class="address_detail ellipsis">
<span :style="{backgroundColor: iconColor(choosedAddress.tag)}">{{choosedAddress.tag}}</span>
<p>{{choosedAddress.address_detail}}</p>
</div>
</div>
</div>
<svg class="address_empty_right">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
</svg>
</section>
</router-link>
<section class="delivery_model container_style">
<p class="deliver_text">送达时间</p>
<section class="deliver_time">
......@@ -68,16 +79,21 @@
<router-link :to='{path: "/confirmOrder/remark", query: {id: checkoutData.cart.id, sig: checkoutData.sig}}' class="header_style">
<span>订单备注</span>
<div class="more_type">
<span class="ellipsis">{{remarkText||inputText? remarklist: '口味偏、好等'}}</span>
<span class="ellipsis">{{remarkText||inputText? remarklist: '口味、偏好等'}}</span>
<svg class="address_empty_right">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
</svg>
</div>
</router-link>
<section class="hongbo">
<router-link :to="checkoutData.invoice.is_available? '/confirmOrder/invoice': ''" class="hongbo" :class="{support_is_available: checkoutData.invoice.is_available}">
<span>发票抬头</span>
<span>商家不支持开发票</span>
</section>
<span>
{{checkoutData.invoice.status_text}}
<svg class="address_empty_right">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
</svg>
</span>
</router-link>
</section>
<section class="confrim_order">
<p>待支付 ¥{{checkoutData.cart.total}}</p>
......@@ -137,7 +153,10 @@
this.shopCart = this.cartList[this.shopId];
},
mounted(){
this.initData();
if (this.geohash) {
this.initData();
this.SAVE_GEOHASH(this.geohash);
}
},
components: {
headTop,
......@@ -146,21 +165,25 @@
},
computed: {
...mapState([
'cartList', 'remarkText', 'inputText'
'cartList', 'remarkText', 'inputText', 'invoice', 'choosedAddress'
]),
remarklist: function (){
if (this.remarkText&&this.inputText) {
let str = new String;
let str = new String;
if (this.remarkText) {
Object.values(this.remarkText).forEach(item => {
str += item[1] + '';
})
}
if (this.inputText) {
return str + this.inputText;
}else{
return str.substr(0, str.lastIndexOf('')) ;
}
}
},
},
methods: {
...mapMutations([
'INIT_BUYCART'
'INIT_BUYCART', 'SAVE_GEOHASH'
]),
async initData(){
let newArr = new Array;
......@@ -194,6 +217,12 @@
this.payWayId = id;
}
},
iconColor(name){
switch(name){
case '公司': return '#4cd964';
case '学校': return '#3190e8';
}
},
}
}
......@@ -233,12 +262,39 @@
.add_address{
@include sc(.7rem, #333);
}
}
.address_empty_right{
@include wh(.6rem, .6rem);
fill: #999;
.address_detail_container{
margin-left: .2rem;
header{
@include sc(.75rem, #333);
span:nth-of-type(1){
font-size: .85rem;
font-weight: bold;
}
}
.address_detail{
width: 100%;
display: flex;
align-items: center;
span{
@include sc(.5rem, #fff);
border-radius: .15rem;
background-color: #ff5722;
height: .65rem;
line-height: .65rem;
padding: 0 .3rem;
margin-right: .3rem;
}
p{
@include sc(.65rem, #777);
}
}
}
}
}
.address_empty_right{
@include wh(.6rem, .6rem);
fill: #999;
}
.delivery_model{
border-left: .2rem solid $blue;
min-height: 4rem;
......@@ -292,8 +348,21 @@
@include fj;
border-top: 0.025rem solid #f5f5f5;
span{
@include sc(.6rem, #ccc);
@include sc(.6rem, #aaa);
line-height: 2rem;
svg{
@include wh(.5rem, .5rem);
vertical-align: middle;
fill: #ccc;
}
}
span:nth-of-type(2){
color: #aaa;
}
}
.support_is_available{
span{
color: #666;
}
}
}
......
......@@ -109,7 +109,7 @@
clearInterval(this.timer)
}
}, 1000)
let exsis = await checkExsis(this.phoneNumber, this.accountType);
let exsis = await checkExsis(this.phoneNumber, 'mobile');
if (exsis.message) {
this.showAlert = true;
this.alertText = exsis.message;
......
......@@ -97,8 +97,8 @@
<script>
import {mapState} from 'vuex'
import headTop from '../../../components/header/head'
import {getImgPath} from '../../../components/common/mixin'
import headTop from '../../../../components/header/head'
import {getImgPath} from '../../../../components/common/mixin'
export default {
data(){
......@@ -128,16 +128,17 @@
</script>
<style lang="scss" scoped>
@import '../../../style/mixin';
@import '../../../../style/mixin';
.safe_shop{
position: absolute;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding-top: 1.95rem;
background-color: #ebebeb;
z-index: 102;
}
ul{
......
......@@ -13,9 +13,13 @@ const vipcard = r => require.ensure([], () => r(require('../page/vipcard/vipcard
const food = r => require.ensure([], () => r(require('../page/food/food')), 'food')
const confirmOrder = r => require.ensure([], () => r(require('../page/confirmOrder/confirmOrder')), 'confirmOrder')
const remark = r => require.ensure([], () => r(require('../page/confirmOrder/children/remark')), 'remark')
const invoice = r => require.ensure([], () => r(require('../page/confirmOrder/children/invoice')), 'invoice')
const chooseAddress = r => require.ensure([], () => r(require('../page/confirmOrder/children/chooseAddress')), 'chooseAddress')
const addAddress = r => require.ensure([], () => r(require('../page/confirmOrder/children/children/addAddress')), 'addAddress')
const searchAddress = r => require.ensure([], () => r(require('../page/confirmOrder/children/children/children/searchAddress')), 'searchAddress')
const foodDetail = r => require.ensure([], () => r(require('../page/shop/children/foodDetail')), 'foodDetail')
const shopDetail = r => require.ensure([], () => r(require('../page/shop/children/shopDetail')), 'shopDetail')
const shopSafe = r => require.ensure([], () => r(require('../page/shop/children/shopSafe')), 'shopSafe')
const shopSafe = r => require.ensure([], () => r(require('../page/shop/children/children/shopSafe')), 'shopSafe')
const info = r => require.ensure([], () => r(require('../page/profile/children/info')), 'info')
const balance = r => require.ensure([], () => r(require('../page/profile/children/balance')), 'balance')
const benefit = r => require.ensure([], () => r(require('../page/profile/children/benefit')), 'benefit')
......@@ -28,88 +32,115 @@ export default [{
path: '/',
component: App, //顶层路由,对应index.html
children: [ //二级路由。对应App.vue
//地址为空时跳转home页面
{
path: '',
redirect: '/home'
}, //地址为空时跳转home页面
},
//首页城市列表页
{
path: '/home',
component: home
}, //首页城市列表页
},
//当前选择城市页
{
path: '/city/:cityid',
component: city
}, //当前选择城市页
},
//所有商铺列表页
{
path: '/msite',
component: msite,
}, //所有商铺列表页
},
//特色商铺列表页
{
path: '/food',
component: food
}, //特色商铺列表页
},
//搜索页
{
path: '/search/:geohash',
component: search
}, //搜索页
},
//商铺详情页
{
path: '/shop',
component: shop,
children: [{
path: 'foodDetail',
path: 'foodDetail', //食品详情页
component: foodDetail,
}, {
path: 'shopDetail',
path: 'shopDetail', //商铺详情页
component: shopDetail,
children: [{
path: 'shopSafe',
path: 'shopSafe', //商铺安全认证页
component: shopSafe,
}, ]
}]
}, //商铺详情页
},
//确认订单页
{
path: '/confirmOrder',
component: confirmOrder,
children: [{
path: 'remark',
path: 'remark', //订单备注
component: remark,
}, {
path: 'invoice', //发票抬头
component: invoice,
}, {
path: 'chooseAddress', //选择地址
component: chooseAddress,
children: [{
path: 'addAddress', //添加地址
component: addAddress,
children: [{
path: 'searchAddress', //搜索地址
component: searchAddress,
}]
}, ]
}, ]
}, //确认订单页
},
//登陆注册页
{
path: '/login',
component: login
}, //登陆注册页
},
//个人信息页
{
path: '/profile',
component: profile,
children: [{
path: 'info',
path: 'info', //个人信息详情页
component: info,
}, {
path: 'balance',
path: 'balance', //余额
component: balance,
}, {
path: 'benefit',
path: 'benefit', //我的优惠页
component: benefit,
}, {
path: 'points',
path: 'points', //我的积分页
component: points,
}, {
path: 'service',
path: 'service', //服务中心
component: service,
}]
}, //个人信息页
},
//修改密码页
{
path: '/forget',
component: forget
}, //修改密码页
},
//订单列表页
{
path: '/order',
component: order
}, //订单列表页
},
//vip卡页
{
path: '/vipcard',
component: vipcard
}, //vip卡页
},
]
}]
\ No newline at end of file
......@@ -151,15 +151,19 @@ export const ratingTags = shopid => fetch('GET', '/ugc/v2/restaurants/' + shopid
/**
* 获取短信验证码
*/
// export const mobileCode = phone => fetch('POST', '/v4/mobile/verify_code/send', {
// mobile: phone,
// scene: 'login',
// type: 'sms'
// });
export const mobileCode = phone => fetch('POST', '/v4/mobile/verify_code/send', {
mobile: phone,
scene: 'login',
type: 'sms'
});
/**
* 手机号登陆
*/
//export const sendLogin = (code, mobile, validate_token) => fetch('POST', '/v1/login/app_mobile', {code, mobile, validate_token});
// export const sendLogin = (code, mobile, validate_token) => fetch('POST', '/v1/login/app_mobile', {
// code,
// mobile,
// validate_token
// });
/**
* 获取图片验证码
*/
......@@ -171,10 +175,10 @@ export const getcaptchas = () => fetch('POST', '/v1/captchas', {});
/**
* 检测帐号是否存在
*/
// export const checkExsis = (checkNumber, type) => fetch('GET', '/v1/users/exists', {
// [type]: checkNumber,
// type
// });
export const checkExsis = (checkNumber, type) => fetch('GET', '/v1/users/exists', {
[type]: checkNumber,
type
});
/**
* 发送帐号
*/
......@@ -201,6 +205,38 @@ export const getcaptchas = () => fetch('POST', '/v1/captchas', {});
// export const getRemark = (id, sig) => fetch('GET', '/v1/carts/' + id + '/remarks', {
// sig
// });
/**
* 获取地址列表
*/
// export const getAddress = (id, sig) => fetch('GET', '/v1/carts/' + id + '/addresses', {
// sig
// });
/**
* 获取用户信息
*/
//export const getUser = () => fetch('GET', '/v1/user', {});
/**
* 搜索地址
*/
// export const searchNearby = keyword => fetch('GET', '/v1/pois', {
// type: 'nearby',
// keyword
// });
/**
* 添加地址
*/
export const postAddAddress = (userId, address, address_detail, geohash, name, phone, phone_bk, poi_type, sex, tag, tag_type) => fetch('POST', '/v1/users/' + userId + '/addresses', {
address,
address_detail,
geohash,
name,
phone,
phone_bk,
poi_type,
sex,
tag,
tag_type,
});
......@@ -230,10 +266,14 @@ export const foodMenu = restaurant_id => setpromise(shop.shopMenu);
// export const getRatingList = (offset, tag_name = '') => setpromise(shop.ratingList);
// export const ratingScores = shopid => setpromise(shop.scores);
// export const ratingTags = shopid => setpromise(shop.tage);
export const mobileCode = phone => setpromise(login.validate_token);
//export const mobileCode = phone => setpromise(login.validate_token);
export const sendLogin = (code, mobile, validate_token) => setpromise(login.userInfo);
export const accountLogin = (username, password, captcha_code) => setpromise(login.userInfo);
export const checkExsis = (checkNumber, type) => setpromise(login.checkExsis);
//export const checkExsis = (checkNumber, type) => setpromise(login.checkExsis);
export const sendMobile = (sendData, captcha_code, type, password) => setpromise(login.send);
export const checkout = (geohash, entities) => setpromise(confirm.checkout);
export const getRemark = (id, sig) => setpromise(confirm.remark);
\ No newline at end of file
export const getRemark = (id, sig) => setpromise(confirm.remark);
export const getAddress = (id, sig) => setpromise(confirm.addressList);
export const getUser = () => setpromise(login.userInfo);
export const searchNearby = keyword => setpromise(confirm.searchAddress);
// export const postAddAddress = (userId, address, address_detail, geohash, name, phone, phone_bk, poi_type, sex, tag, tag_type) => setpromise(confirm.addAddress);
\ No newline at end of file
......@@ -1403,4 +1403,189 @@ export const remark = {
["\u591a\u70b9\u918b"],
["\u591a\u70b9\u8471"]
]
}
\ No newline at end of file
}
export const searchAddress = [{
"name": "\u4eba\u6c11\u5e7f\u573a[\u5730\u94c1\u7ad9] [\u5730\u94c1\u7ad9]",
"address": "\u5730\u94c11\u53f7\u7ebf,\u5730\u94c12\u53f7\u7ebf,\u5730\u94c18\u53f7\u7ebf",
"latitude": 31.23283,
"longitude": 121.472789,
"geohash": "wtw3sjvb3js2"
}, {
"name": "\u4e0a\u6d77\u4eba\u6c11\u5e7f\u573a",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u4eba\u6c11\u5927\u9053120\u53f7",
"latitude": 31.22967,
"longitude": 121.4762,
"geohash": "wtw3sm0q087"
}, {
"name": "\u4eba\u6c11\u5e7f\u573a[\u516c\u4ea4\u7ad9] [\u516c\u4ea4\u7ad9]",
"address": "112\u533a\u95f4,112,123,123(\u533a\u95f4),145,312,46\u533a\u95f4,49,952\u7b4912\u6761\u7ebf\u8def",
"latitude": 31.229015,
"longitude": 121.476929,
"geohash": "wtw3sm0f1w76"
}, {
"name": "\u4eba\u6c11\u516c\u56ed",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u5357\u4eac\u897f\u8def231\u53f7",
"latitude": 31.23223,
"longitude": 121.47322,
"geohash": "wtw3sjwhgjt"
}, {
"name": "\u4eba\u6c11\u5e7f\u573a-\u5317\u5e7f\u573a",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u4eba\u6c11\u5e7f\u573a\u5185",
"latitude": 31.23407,
"longitude": 121.47379,
"geohash": "wtw3sjyx8kw"
}, {
"name": "CAFE LUGO\u4eba\u6c11\u5e7f\u573a\u5e97",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u897f\u85cf\u4e2d\u8def336\u53f7\u534e\u65ed\u56fd\u9645\u5927\u53a6",
"latitude": 31.23379,
"longitude": 121.47602,
"geohash": "wtw3smbnh2m"
}, {
"name": "\u4eba\u6c11\u5927\u821e\u53f0",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u4e5d\u6c5f\u8def663~669",
"latitude": 31.23427,
"longitude": 121.47797,
"geohash": "wtw3sq18ccg"
}, {
"name": "\u4eba\u6c11\u5e7f\u573a(\u5e7f\u4e1c\u8def)[\u516c\u4ea4\u7ad9] [\u516c\u4ea4\u7ad9]",
"address": "454,108(\u533a\u95f4),167,312,318,108,537,\u96a7\u9053\u4e09\u7ebf,930,980,\u96a7\u9053\u591c\u5bb5\u7ebf",
"latitude": 31.23075,
"longitude": 121.476868,
"geohash": "wtw3sm2u21vb"
}, {
"name": "\u4eba\u6c11\u5e7f\u573a(\u798f\u5dde\u8def)[\u516c\u4ea4\u7ad9] [\u516c\u4ea4\u7ad9]",
"address": "805,18,312,318,451,49,\u96a7\u9053\u4e09\u7ebf,930,\u96a7\u9053\u591c\u5bb5\u7ebf,\u65b0\u5ddd\u4e13\u7ebf",
"latitude": 31.232605,
"longitude": 121.475833,
"geohash": "wtw3sm8p05d1"
}, {
"name": "YUMMIE HOUSE(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u4eba\u6c11\u5927\u90539-99\u53f7\u9999\u6e2f\u540d\u5e97\u885775\u53f7\u5e97\u94fa",
"latitude": 31.23011,
"longitude": 121.47568,
"geohash": "wtw3sjrbsd2"
}, {
"name": "SHOW SHOWS(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u4eba\u6c11\u5927\u90539-99\u53f7\u9999\u6e2f\u540d\u5e97\u8857B1\u5c42",
"latitude": 31.23038,
"longitude": 121.47596,
"geohash": "wtw3sm245hb"
}, {
"name": "\u660e\u5802\u4eba\u6c11\u5e7f\u573a\u9752\u5e74\u65c5\u820d",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u6c38\u5bff\u8def35\u53f7(\u5730\u94c11\u53f7\u7ebf\u5927\u4e16\u754c\u7ad9\u5411\u897f350\u7c73)",
"latitude": 31.22928,
"longitude": 121.48132,
"geohash": "wtw3sm5gxzt"
}, {
"name": "\u4e0a\u6d77\u4eba\u6c11\u5e7f\u573a\u4e0b\u6c89\u5f0f\u5e7f\u573a",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u5357\u4eac\u897f\u8def19",
"latitude": 31.23404,
"longitude": 121.47384,
"geohash": "wtw3sjyx3xh"
}, {
"name": "\u7f8e\u8054\u793e(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u5e7f\u897f\u5317\u8def248\u53f73\u697c338",
"latitude": 31.23329,
"longitude": 121.47863,
"geohash": "wtw3smf515r"
}, {
"name": "\u9ebb\u8fa3\u8bf1\u60d1(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u5357\u4eac\u897f\u8def58\u53f7\u65b0\u4e16\u754c\u57ce9\u5c42",
"latitude": 31.23468,
"longitude": 121.47383,
"geohash": "wtw3snne1qk"
}, {
"name": "dermes\u5149\u5b66\u8131\u6bdb(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u897f\u85cf\u4e2d\u8def336\u53f7\u534e\u65ed\u56fd\u9645\u5927\u53a65\u697c(\u8fd1\u4e5d\u6c5f\u8def)",
"latitude": 31.2338,
"longitude": 121.47616,
"geohash": "wtw3smbnpdq"
}, {
"name": "\u9c9c\u5899\u623f(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u4e5d\u6c5f\u8def600\u53f7\u6c38\u5b89\u767e\u8d274\/5\u5c42",
"latitude": 31.23459,
"longitude": 121.47814,
"geohash": "wtw3sq1dtvd"
}, {
"name": "\u5609\u5ef7\u9152\u5e97(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u65b0\u95f8\u8def126\u53f7(\u8fd1\u5730\u94c1\u4eba\u6c11\u5e7f\u573a\u7ad9)",
"latitude": 31.23875,
"longitude": 121.47132,
"geohash": "wtw3snudyvj"
}, {
"name": "\u7ea2\u76d4\u7532(\u4eba\u6c11\u5e7f\u573a\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u91d1\u9675\u4e1c\u8def500\u53f7\u4e9a\u9f99\u56fd\u9645\u5e7f\u573a2\u697c(\u8fd18\u53f7\u7ebf\u5927\u4e16\u754c\u7ad92\u53f7\u51fa\u53e3)",
"latitude": 31.22695,
"longitude": 121.47989,
"geohash": "wtw3skdynt7"
}, {
"name": "Moo Moo Cake(\u4eba\u6c11\u5e7f\u573a\u84dd\u5929\u767d\u5496\u5561\u5e97)",
"address": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u798f\u5dde\u8def523\u9644\u8fd1",
"latitude": 31.23312,
"longitude": 121.4807,
"geohash": "wtw3smgd17x"
}];
export const addAddress = {
"address_id": 275304983
};
export const addressList = [{
"id": 275355683,
"address": "\u4e0a\u6d77\u4eba\u6c11\u5e7f\u573a",
"phone": "13681711259",
"is_valid": 1,
"created_at": "2017-02-18T19:51:39+0800",
"phone_bk": "",
"name": "\u84dd",
"st_geohash": "wtw3sm0q087",
"address_detail": "907\u53f7",
"poi_type": 0,
"sex": 1,
"city_id": 1,
"tag": "\u5bb6",
"agent_fee": 5,
"deliver_amount": 20,
"is_deliverable": true,
"phone_had_bound": true,
"is_brand_member": false
}, {
"id": 275304983,
"address": "\u4e0a\u6d77\u4eba\u6c11\u5e7f\u573a",
"phone": "13681711289",
"is_valid": 1,
"created_at": "2017-02-18T18:40:03+0800",
"phone_bk": "",
"name": "\u9ec4",
"st_geohash": "wtw3sm0q087",
"address_detail": "\u4e0a\u6d77\u5e02\u9ec4\u6d66\u533a\u4eba\u6c11\u5927\u9053120\u53f7",
"poi_type": 0,
"sex": 2,
"city_id": 1,
"tag": "\u5bb6",
"agent_fee": 5,
"deliver_amount": 20,
"is_deliverable": true,
"phone_had_bound": true,
"is_brand_member": false
}, {
"id": 275190634,
"address": "563\u53f7",
"phone": "13681711255",
"is_valid": 1,
"created_at": "2017-02-18T15:58:36+0800",
"phone_bk": "",
"name": "\u767e",
"st_geohash": "wtw34e4ymr8q",
"address_detail": "\u83b2\u82b1\u8def[\u5730\u94c1\u7ad9] [\u5730\u94c1\u7ad9]",
"poi_type": 0,
"sex": 0,
"city_id": 1,
"tag": "",
"agent_fee": 5,
"deliver_amount": 20,
"is_deliverable": false,
"phone_had_bound": true,
"is_brand_member": false
}];
\ No newline at end of file
......@@ -17,15 +17,15 @@ export const userInfo = {
"current_invoice_id": 0,
"delivery_card_expire_days": 0,
"email": "",
"gift_amount": 1,
"id": 108758383,
"gift_amount": 0,
"id": 186335200,
"is_active": 1,
"is_email_valid": false,
"is_mobile_valid": true,
"mobile": "13681711254",
"point": 960,
"user_id": 109065163,
"username": "cangdu"
"is_mobile_valid": false,
"mobile": "",
"point": 0,
"user_id": 186655961,
"username": "cangdu666"
};
export const checkExsis = {
......
import {cityGuess} from '../service/getData'
import { GET_DATA } from './mutation-types.js'
import {
getUser
} from '../service/getData'
import {
GET_USERINFO
} from './mutation-types.js'
export default {
getData({ commit, state }) {
cityGuess().then(res => {
commit(GET_DATA, {data: res})
})
},
async getUserInfo({
commit,
state
}) {
let res = await getUser();
commit(GET_USERINFO, res)
},
}
\ No newline at end of file
......@@ -13,7 +13,12 @@ const state = {
shopDetail: null, //商家详情信息
userInfo: null, //用户信息
remarkText: null,
inputText: null,
inputText: '',
invoice: false,
searchAddress: null,
geohash: null,
choosedAddress: null,
addressIndex: null,
}
export default new Vuex.Store({
......
......@@ -6,4 +6,8 @@ export const CLEAR_CART = 'CLEAR_CART'
export const RECORD_SHOPDETAIL = 'RECORD_SHOPDETAIL'
export const RECORD_USERINFO = 'RECORD_USERINFO'
export const GET_USERINFO = 'GET_USERINFO'
export const CONFIRM_REMARK = 'CONFIRM_REMARK'
\ No newline at end of file
export const CONFIRM_REMARK = 'CONFIRM_REMARK'
export const CONFIRM_INVOICE = 'CONFIRM_INVOICE'
export const CHOOSE_SEARCH_ADDRESS = 'CHOOSE_SEARCH_ADDRESS'
export const SAVE_GEOHASH = 'SAVE_GEOHASH'
export const CHOOSE_ADDRESS = 'CHOOSE_ADDRESS'
\ No newline at end of file
......@@ -8,6 +8,10 @@ import {
RECORD_USERINFO,
GET_USERINFO,
CONFIRM_REMARK,
CONFIRM_INVOICE,
CHOOSE_SEARCH_ADDRESS,
SAVE_GEOHASH,
CHOOSE_ADDRESS,
} from './mutation-types.js'
import {
setStore,
......@@ -135,13 +139,19 @@ export default {
// 记录用户信息
[RECORD_USERINFO](state, info) {
state.userInfo = info;
setStore('useInfo', info);
let validity = 30;
let now = new Date();
now.setTime(now.getTime() + validity * 24 * 60 * 60 * 1000);
document.cookie = "USERID=" + info.user_id + ";expires=" + now.toGMTString();
document.cookie = "SID=huRyTRd9QLij7NkbpHJoj3PQrx1eRiO6bAiw" + ";expires=" + now.toGMTString();
},
//从本地获取用户信息
[GET_USERINFO](state) {
let info = getStore('useInfo');
if (info) {
state.userInfo = JSON.parse(info);
//获取用户信息存入vuex
[GET_USERINFO](state, info) {
if (!info.message) {
state.userInfo = info;
} else {
state.userInfo = null;
}
},
//记录订单页面用户选择的备注, 传递给订单确认页面
......@@ -151,5 +161,25 @@ export default {
}) {
state.remarkText = remarkText;
state.inputText = inputText;
},
//是否开发票
[CONFIRM_INVOICE](state, invoice) {
state.invoice = invoice;
},
//选择搜索的地址
[CHOOSE_SEARCH_ADDRESS](state, place) {
state.searchAddress = place;
},
//保存geohash
[SAVE_GEOHASH](state, geohash) {
state.geohash = geohash;
},
//选择的地址
[CHOOSE_ADDRESS](state, {
address,
index
}) {
state.choosedAddress = address;
state.addressIndex = index;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册