提交 734f742c 编写于 作者: M maguohua

upate scss

上级 b7e4051c
...@@ -29,6 +29,8 @@ vue2 + vue-rotuer2 + vuex + webpack + ES6/7 + fetch + sass + flex + svg + http-p ...@@ -29,6 +29,8 @@ vue2 + vue-rotuer2 + vuex + webpack + ES6/7 + fetch + sass + flex + svg + http-p
- [x] 修改密码 -- 完成 - [x] 修改密码 -- 完成
- [x] 个人中心 -- 完成 - [x] 个人中心 -- 完成
- [ ] 帐户信息 - [ ] 帐户信息
- [ ] 上传头像,修改用户名
- [ ] 积分商城
- [ ] 服务中心 - [ ] 服务中心
- [ ] 添加、删除、修改收货地址 - [ ] 添加、删除、修改收货地址
- [ ] 订单列表 - [ ] 订单列表
......
...@@ -60,4 +60,4 @@ ...@@ -60,4 +60,4 @@
"node": ">= 4.0.0", "node": ">= 4.0.0",
"npm": ">= 3.0.0" "npm": ">= 3.0.0"
} }
} }
\ No newline at end of file
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<script> <script>
export default { export default {
} }
</script> </script>
<style lang="scss"> <style lang="scss">
@import './style/common.scss'; @import './style/common';
.router-fade-enter-active, .router-fade-leave-active { .router-fade-enter-active, .router-fade-leave-active {
transition: opacity .4s; transition: opacity .4s;
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
@keyframes tipMove{ @keyframes tipMove{
0% { transform: scale(1) } 0% { transform: scale(1) }
35% { transform: scale(.8) } 35% { transform: scale(.8) }
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
margin-left: -6rem; margin-left: -6rem;
width: 12rem; width: 12rem;
animation: tipMove .4s ; animation: tipMove .4s ;
background-color: #fff; background-color: rgba(255,255,255,1);
border: 1px; border: 1px;
padding-top: .6rem; padding-top: .6rem;
display: flex; display: flex;
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
<section class="cart_module"> <section class="cart_module">
<section v-if="!foods.specifications.length" class="cart_button"> <section v-if="!foods.specifications.length" class="cart_button">
<transition name="showReduce"> <transition name="showReduce">
<svg @click="removeOutCart(foods.category_id, foods.item_id, foods.specfoods[0].food_id, foods.specfoods[0].name, foods.specfoods[0].price, '')" v-if="foodNum"> <svg @click="removeOutCart(foods.category_id, foods.item_id, foods.specfoods[0].food_id, foods.specfoods[0].name, foods.specfoods[0].price, '', foods.specfoods[0].packing_fee, foods.specfoods[0].sku_id, foods.specfoods[0].stock)" v-if="foodNum">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cart-minus"></use> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cart-minus"></use>
</svg> </svg>
</transition> </transition>
<transition name="fade"> <transition name="fade">
<span class="cart_num" v-if="foodNum">{{foodNum}}</span> <span class="cart_num" v-if="foodNum">{{foodNum}}</span>
</transition> </transition>
<svg @click="addToCart(foods.category_id, foods.item_id, foods.specfoods[0].food_id, foods.specfoods[0].name, foods.specfoods[0].price, '', $event)"> <svg @click="addToCart(foods.category_id, foods.item_id, foods.specfoods[0].food_id, foods.specfoods[0].name, foods.specfoods[0].price, '', foods.specfoods[0].packing_fee, foods.specfoods[0].sku_id, foods.specfoods[0].stock, $event)">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cart-add"></use> <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cart-add"></use>
</svg> </svg>
<transition <transition
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<span>¥ </span> <span>¥ </span>
<span>{{foods.specfoods[specsIndex].price}}</span> <span>{{foods.specfoods[specsIndex].price}}</span>
</div> </div>
<div class="specs_addto_cart" @click="addSpecs(foods.category_id, foods.item_id, foods.specfoods[specsIndex].food_id, foods.specfoods[specsIndex].name, foods.specfoods[specsIndex].price, foods.specifications[0].values[specsIndex])">加入购物车</div> <div class="specs_addto_cart" @click="addSpecs(foods.category_id, foods.item_id, foods.specfoods[specsIndex].food_id, foods.specfoods[specsIndex].name, foods.specfoods[specsIndex].price, foods.specifications[0].values[specsIndex], foods.specfoods[specsIndex].packing_fee, foods.specfoods[specsIndex].sku_id, foods.specfoods[specsIndex].stock)">加入购物车</div>
</footer> </footer>
</div> </div>
</transition> </transition>
...@@ -123,14 +123,14 @@ ...@@ -123,14 +123,14 @@
'ADD_CART','REDUCE_CART', 'ADD_CART','REDUCE_CART',
]), ]),
//移出购物车 //移出购物车
removeOutCart(category_id, item_id, food_id, name, price, specs){ removeOutCart(category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock){
if (this.foodNum > 0) { if (this.foodNum > 0) {
this.REDUCE_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs}); this.REDUCE_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock});
} }
}, },
//加入购物车,计算按钮位置。 //加入购物车,计算按钮位置。
addToCart(category_id, item_id, food_id, name, price, specs, event){ addToCart(category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock, event){
this.ADD_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs}); this.ADD_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock});
this.elLeft = event.target.getBoundingClientRect().left; this.elLeft = event.target.getBoundingClientRect().left;
this.elBottom = event.target.getBoundingClientRect().bottom; this.elBottom = event.target.getBoundingClientRect().bottom;
this.showMoveDot.push(true); this.showMoveDot.push(true);
...@@ -146,8 +146,8 @@ ...@@ -146,8 +146,8 @@
this.specsIndex = index; this.specsIndex = index;
}, },
//多规格商品加入购物车 //多规格商品加入购物车
addSpecs(category_id, item_id, food_id, name, price, specs){ addSpecs(category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock){
this.ADD_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs}); this.ADD_CART({shopid: this.shopId, category_id, item_id, food_id, name, price, specs, packing_fee, sku_id, stock});
this.showChooseList(); this.showChooseList();
}, },
//点击多规格商品的减按钮,弹出提示 //点击多规格商品的减按钮,弹出提示
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
.cart_module{ .cart_module{
.cart_button{ .cart_button{
display: flex; display: flex;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
@keyframes load{ @keyframes load{
0% {transform: translateY(0px);} 0% {transform: translateY(0px);}
50% {transform: translateY(-50px);} 50% {transform: translateY(-50px);}
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
.rating_container{ .rating_container{
position: relative; position: relative;
@include wh(2rem, .4rem); @include wh(2rem, .4rem);
......
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
.shoplist_container{ .shoplist_container{
background-color: #fff; background-color: #fff;
} }
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
#head_top{ #head_top{
background-color: $blue; background-color: $blue;
......
<template> <template>
<div> <div class="confirmOrderContainer">
<head-top head-title="确认订单" goBack="true"></head-top> <section v-if="!showLoading">
<div class="confirmOrderContainer">确认订单页</div> <head-top head-title="确认订单" goBack="true" signin-up='confirmOrder'></head-top>
<section 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>
<svg class="address_empty_right">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
</svg>
</section>
<section class="delivery_model container_style">
<p class="deliver_text">送达时间</p>
<section class="deliver_time">
<p>尽快送达 | 预计{{checkoutData.delivery_reach_time}}</p>
<p v-if="checkoutData.cart.is_deliver_by_fengniao">蜂鸟专送</p>
</section>
</section>
<section class="pay_way container_style">
<header class="header_style">
<span>支付方式</span>
<div class="more_type">
<span>在线支付</span>
<svg class="address_empty_right">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
</svg>
</div>
</header>
<section class="hongbo">
<span>红包</span>
<span>暂时只在饿了么 APP 中支持</span>
</section>
</section>
<section class="food_list">
<header>
<img :src="imgBaseUrl + checkoutData.cart.restaurant_info.image_path">
<span>{{checkoutData.cart.restaurant_info.name}}</span>
</header>
<ul class="food_list_ul">
<li v-for="item in checkoutData.cart.groups[0]" :key="item.id" class="food_item_style">
<p class="food_name ellipsis">{{item.name}}</p>
<div class="num_price">
<span>x {{item.quantity}}</span>
<span>¥{{item.price}}</span>
</div>
</li>
</ul>
<div class="food_item_style">
<p class="food_name ellipsis">{{checkoutData.cart.extra[0].name}}</p>
<div class="num_price">
<span></span>
<span>¥ {{checkoutData.cart.extra[0].price}}</span>
</div>
</div>
<div class="food_item_style total_price">
<p class="food_name ellipsis">订单 ¥{{checkoutData.cart.total}}</p>
<div class="num_price">
<span></span>
<span>待支付 ¥{{checkoutData.cart.total}}</span>
</div>
</div>
</section>
<section class="pay_way container_style">
<header class="header_style">
<span>订单备注</span>
<div class="more_type">
<span>口味偏、好等</span>
<svg class="address_empty_right">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
</svg>
</div>
</header>
<section class="hongbo">
<span>发票抬头</span>
<span>商家不支持开发票</span>
</section>
</section>
<section class="confrim_order">
<p>待支付 ¥{{checkoutData.cart.total}}</p>
<p>确认下单</p>
</section>
<transition name="fade">
<div></div>
</transition>
</section>
<loading v-if="showLoading"></loading>
</div> </div>
</template> </template>
<script> <script>
import {mapState, mapMutations} from 'vuex'
import headTop from '../../components/header/head' import headTop from '../../components/header/head'
import alertTip from '../../components/common/alertTip'
import loading from '../../components/common/loading'
import {checkout} from '../../service/getData'
import {imgBaseUrl} from '../../config/env'
export default { export default {
data(){ data(){
return { return {
geohash: '', //geohash位置信息
shopId: null, //商店id值
showLoading: true,
checkoutData: null,
shopCart: null,
imgBaseUrl,
} }
}, },
created(){
//获取上个页面传递过来的geohash值
this.geohash = this.$route.query.geohash;
//获取上个页面传递过来的shopid值
this.shopId = this.$route.query.shopId;
this.INIT_BUYCART();
this.shopCart = this.cartList[this.shopId];
},
mounted(){
this.initData();
},
components: { components: {
headTop, headTop,
alertTip,
loading,
},
computed: {
...mapState([
'cartList'
]),
}, },
methods: {
...mapMutations([
'INIT_BUYCART'
]),
async initData(){
let newArr = new Array;
Object.values(this.shopCart).forEach(categoryItem => {
Object.values(categoryItem).forEach(itemValue=> {
Object.values(itemValue).forEach(item => {
newArr.push({
attrs: [],
extra: {},
id: item.id,
name: item.name,
packing_fee: item.packing_fee,
price: item.price,
quantity: item.num,
sku_id: item.sku_id,
specs: [item.specs],
stock: item.stock,
})
})
})
})
this.checkoutData = await checkout(this.geohash, [newArr]);
this.showLoading = false;
},
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
.confirmOrderContainer{ .confirmOrderContainer{
padding-top: 1.95rem; padding-top: 1.95rem;
padding-bottom: 3rem;
p, span{
font-family: Helvetica Neue,Tahoma,Arial;
}
}
.container_style{
background-color: #fff;
margin-top: .4rem;
padding: 0 .7rem;
}
.address_container{
min-height: 3.5rem;
@include fj;
align-items: center;
padding: 0 0.6rem;
background: url(../../images/address_bottom.png) left bottom repeat-x;
background-color: #fff;
background-size: auto .12rem;
.address_empty_left{
display: flex;
align-items: center;
.location_icon{
@include wh(.8rem, .8rem);
fill: $blue;
margin-right: .2rem;
}
.add_address{
@include sc(.7rem, #333);
}
}
.address_empty_right{
@include wh(.6rem, .6rem);
fill: #999;
}
}
.delivery_model{
border-left: .2rem solid $blue;
min-height: 4rem;
@include fj;
align-items: center;
.deliver_text{
@include sc(.8rem, #333);
font-weight: bold;
padding-left: .3rem;
}
.deliver_time{
display: flex;
flex-direction: column;
align-items: flex-end;
p:nth-of-type(1){
@include sc(.7rem, $blue);
}
p:nth-of-type(2){
@include sc(.5rem, #fff);
background-color: $blue;
width: 2.4rem;
margin-top: .5rem;
text-align: center;
border-radius: 0.12rem;
padding: .1rem;
}
}
}
.pay_way{
.header_style{
@include fj;
line-height: 2rem;
span:nth-of-type(1){
@include sc(.7rem, #666);
}
.more_type{
span:nth-of-type(1){
@include sc(.6rem, #aaa);
}
svg{
@include wh(.5rem, .5rem);
fill: #ccc;
}
}
}
.hongbo{
@include fj;
border-top: 0.025rem solid #f5f5f5;
span{
@include sc(.6rem, #ccc);
line-height: 2rem;
}
}
}
.food_list{
background-color: #fff;
margin-top: .4rem;
header{
padding: .7rem;
border-bottom: 0.025rem solid #f5f5f5;
img{
@include wh(1.2rem, 1.2rem);
vertical-align: middle;
}
span{
@include sc(.8rem, #333);
}
}
.food_list_ul{
padding-top: .5rem;
}
.food_item_style{
@include fj;
line-height: 1.8rem;
padding: 0 .7rem;
span,p{
@include sc(.65rem, #666);
}
.food_name{
width: 11rem;
}
.num_price{
flex: 1;
@include fj;
span:nth-of-type(2){
color: #f60;
}
}
}
.total_price{
border-top: 0.025rem solid #f5f5f5;
}
}
.confrim_order{
display: flex;
position: fixed;
bottom: 0;
width: 100%;
height: 2rem;
p{
line-height: 2rem;
@include sc(.75rem, #fff);
}
p:nth-of-type(1){
background-color: #3c3c3c;
flex: 5;
padding-left: .7rem;
}
p:nth-of-type(2){
flex: 2;
background-color: #56d176;
text-align: center;
}
}
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-active {
opacity: 0;
} }
</style> </style>
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
.restContainer{ .restContainer{
padding-top: 1.95rem; padding-top: 1.95rem;
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
.loginContainer{ .loginContainer{
padding-top: 1.95rem; padding-top: 1.95rem;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.rating_page{ .rating_page{
position: absolute; position: absolute;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.rating_page{ .rating_page{
position: absolute; position: absolute;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.rating_page{ .rating_page{
position: absolute; position: absolute;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.rating_page{ .rating_page{
position: absolute; position: absolute;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.rating_page{ .rating_page{
position: absolute; position: absolute;
......
...@@ -142,7 +142,7 @@ export default { ...@@ -142,7 +142,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
.search_form{ .search_form{
background-color: #fff; background-color: #fff;
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.rating_page{ .rating_page{
position: absolute; position: absolute;
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.rating_page{ .rating_page{
position: absolute; position: absolute;
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../../style/mixin.scss'; @import '../../../style/mixin';
.safe_shop{ .safe_shop{
position: absolute; position: absolute;
......
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
</section> </section>
<section class="gotopay" :class="{gotopay_acitvity: minimumOrderAmount < 0}"> <section class="gotopay" :class="{gotopay_acitvity: minimumOrderAmount < 0}">
<span class="gotopay_button_style" v-if="minimumOrderAmount > 0">还差¥{{minimumOrderAmount}}起送</span> <span class="gotopay_button_style" v-if="minimumOrderAmount > 0">还差¥{{minimumOrderAmount}}起送</span>
<router-link to="/confirmOrder" class="gotopay_button_style" v-else >去结算</router-link> <router-link :to="{path:'/confirmOrder', query:{geohash, shopId}}" class="gotopay_button_style" v-else >去结算</router-link>
</section> </section>
</section> </section>
<transition name="toggle-cart"> <transition name="toggle-cart">
...@@ -253,7 +253,6 @@ ...@@ -253,7 +253,6 @@
<script> <script>
import {mapState, mapMutations} from 'vuex' import {mapState, mapMutations} from 'vuex'
import {imgBaseUrl} from '../../config/env'
import {msiteAdress, shopDetails, foodMenu, getRatingList, ratingScores, ratingTags} from '../../service/getData' import {msiteAdress, shopDetails, foodMenu, getRatingList, ratingScores, ratingTags} from '../../service/getData'
import loading from '../../components/common/loading' import loading from '../../components/common/loading'
import buyCart from '../../components/common/buyCart' import buyCart from '../../components/common/buyCart'
...@@ -556,7 +555,7 @@ ...@@ -556,7 +555,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '../../style/mixin.scss'; @import '../../style/mixin';
@keyframes mymove{ @keyframes mymove{
0% { transform: scale(1) } 0% { transform: scale(1) }
25% { transform: scale(.8) } 25% { transform: scale(.8) }
......
...@@ -6,6 +6,7 @@ import * as search from './tempdata/search' ...@@ -6,6 +6,7 @@ import * as search from './tempdata/search'
import * as food from './tempdata/food' import * as food from './tempdata/food'
import * as shop from './tempdata/shop' import * as shop from './tempdata/shop'
import * as login from './tempdata/login' import * as login from './tempdata/login'
import * as confirm from './tempdata/confirm'
/** /**
* 获取首页默认地址 * 获取首页默认地址
...@@ -120,16 +121,16 @@ export const foodActivity = (latitude, longitude) => fetch('GET', '/shopping/v1/ ...@@ -120,16 +121,16 @@ export const foodActivity = (latitude, longitude) => fetch('GET', '/shopping/v1/
/** /**
* 获取shop页面商铺详情 * 获取shop页面商铺详情
*/ */
export const shopDetails = (shopid, latitude, longitude) => fetch('GET', '/shopping/restaurant/' + shopid, { // export const shopDetails = (shopid, latitude, longitude) => fetch('GET', '/shopping/restaurant/' + shopid, {
latitude, // latitude,
longitude: longitude + '&extras[]=activities&extras[]=album&extras[]=license&extras[]=identification&extras[]=statistics' // longitude: longitude + '&extras[]=activities&extras[]=album&extras[]=license&extras[]=identification&extras[]=statistics'
}); // });
/** /**
* 获取food页面的商家属性活动列表 * 获取food页面的商家属性活动列表
*/ */
export const foodMenu = restaurant_id => fetch('GET', '/shopping/v2/menu', { // export const foodMenu = restaurant_id => fetch('GET', '/shopping/v2/menu', {
restaurant_id // restaurant_id
}); // });
/** /**
* 获取商铺评价列表 * 获取商铺评价列表
*/ */
...@@ -150,11 +151,11 @@ export const ratingTags = shopid => fetch('GET', '/ugc/v2/restaurants/' + shopid ...@@ -150,11 +151,11 @@ export const ratingTags = shopid => fetch('GET', '/ugc/v2/restaurants/' + shopid
/** /**
* 获取短信验证码 * 获取短信验证码
*/ */
export const mobileCode = phone => fetch('POST', '/v4/mobile/verify_code/send', { // export const mobileCode = phone => fetch('POST', '/v4/mobile/verify_code/send', {
mobile: phone, // mobile: phone,
scene: 'login', // scene: 'login',
type: 'sms' // type: 'sms'
}); // });
/** /**
* 手机号登陆 * 手机号登陆
*/ */
...@@ -170,21 +171,30 @@ export const getcaptchas = () => fetch('POST', '/v1/captchas', {}); ...@@ -170,21 +171,30 @@ export const getcaptchas = () => fetch('POST', '/v1/captchas', {});
/** /**
* 检测帐号是否存在 * 检测帐号是否存在
*/ */
export const checkExsis = (checkNumber, type) => fetch('GET', '/v1/users/exists', { // export const checkExsis = (checkNumber, type) => fetch('GET', '/v1/users/exists', {
[type]: checkNumber, // [type]: checkNumber,
type // type
}); // });
/** /**
* 发送帐号 * 发送帐号
*/ */
export const sendMobile = (sendData, captcha_code, type, password) => fetch('POST', '/v1/mobile/verify_code/send', { // export const sendMobile = (sendData, captcha_code, type, password) => fetch('POST', '/v1/mobile/verify_code/send', {
action: "send", // action: "send",
captcha_code, // captcha_code,
[type]: sendData, // [type]: sendData,
type: "sms", // type: "sms",
way: type, // way: type,
password, // password,
}); // });
/**
* 确认订单
*/
// export const checkout = (geohash, entities) => fetch('POST', '/v1/carts/checkout', {
// come_from: "web",
// geohash,
// entities,
// });
...@@ -209,11 +219,14 @@ const setpromise = data => { ...@@ -209,11 +219,14 @@ const setpromise = data => {
// export const foodCategory = (latitude, longitude) => setpromise(food.category); // export const foodCategory = (latitude, longitude) => setpromise(food.category);
// export const foodDelivery = (latitude, longitude) => setpromise(food.delivery); // export const foodDelivery = (latitude, longitude) => setpromise(food.delivery);
// export const foodActivity = (latitude, longitude) => setpromise(food.activity); // export const foodActivity = (latitude, longitude) => setpromise(food.activity);
// export const shopDetails = (shopid, latitude, longitude) => setpromise(shop.shopDetails); export const shopDetails = (shopid, latitude, longitude) => setpromise(shop.shopDetails);
// export const foodMenu = restaurant_id => setpromise(shop.shopMenu); export const foodMenu = restaurant_id => setpromise(shop.shopMenu);
// export const getRatingList = (offset, tag_name = '') => setpromise(shop.ratingList); // export const getRatingList = (offset, tag_name = '') => setpromise(shop.ratingList);
// export const ratingScores = shopid => setpromise(shop.scores); // export const ratingScores = shopid => setpromise(shop.scores);
// export const ratingTags = shopid => setpromise(shop.tage); // 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 sendLogin = (code, mobile, validate_token) => setpromise(login.userInfo);
export const accountLogin = (username, password, captcha_code) => setpromise(login.userInfo); export const accountLogin = (username, password, captcha_code) => setpromise(login.userInfo);
\ No newline at end of file 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);
\ No newline at end of file
此差异已折叠。
...@@ -26,4 +26,14 @@ export const userInfo = { ...@@ -26,4 +26,14 @@ export const userInfo = {
"point": 960, "point": 960,
"user_id": 109065163, "user_id": 109065163,
"username": "cangdu" "username": "cangdu"
};
export const checkExsis = {
"message": "\u8bf7\u68c0\u67e5\u624b\u673a\u53f7\u7801\u683c\u5f0f\u662f\u5426\u6709\u8bef",
"name": "VALIDATION_FAILED"
};
export const send = {
"message": "\u9a8c\u8bc1\u7801\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u586b\u5199",
"name": "CAPTCHA_CODE_ERROR"
}; };
\ No newline at end of file
import { RECORD_ADDRESS, ADD_CART, REDUCE_CART, INIT_BUYCART, CLEAR_CART, RECORD_SHOPDETAIL, RECORD_USERINFO, GET_USERINFO} from './mutation-types.js' import {
import {setStore, getStore} from '../config/mUtils' RECORD_ADDRESS,
ADD_CART,
REDUCE_CART,
INIT_BUYCART,
CLEAR_CART,
RECORD_SHOPDETAIL,
RECORD_USERINFO,
GET_USERINFO,
} from './mutation-types.js'
import {
setStore,
getStore,
} from '../config/mUtils'
export default { export default {
// 记录当前经度纬度 // 记录当前经度纬度
[RECORD_ADDRESS] (state, {latitude, longitude}) { [RECORD_ADDRESS](state, {
latitude,
longitude
}) {
state.latitude = latitude; state.latitude = latitude;
state.longitude = longitude; state.longitude = longitude;
}, },
[RECORD_SHOPDETAIL](state, detail){
[RECORD_SHOPDETAIL](state, detail) {
state.shopDetail = detail; state.shopDetail = detail;
}, },
// 加入购物车 // 加入购物车
[ADD_CART] (state, {shopid, category_id, item_id, food_id, name, price, specs}) { [ADD_CART](state, {
shopid,
category_id,
item_id,
food_id,
name,
price,
specs,
packing_fee,
sku_id,
stock
}) {
let cart = state.cartList; let cart = state.cartList;
if (cart[shopid]&&cart[shopid][category_id]&&cart[shopid][category_id][item_id]&&cart[shopid][category_id][item_id][food_id]) { if (cart[shopid] && cart[shopid][category_id] && cart[shopid][category_id][item_id] && cart[shopid][category_id][item_id][food_id]) {
cart[shopid][category_id][item_id][food_id]['num'] ++; cart[shopid][category_id][item_id][food_id]['num']++;
}else if(cart[shopid]&&cart[shopid][category_id]&&cart[shopid][category_id][item_id]){ } else if (cart[shopid] && cart[shopid][category_id] && cart[shopid][category_id][item_id]) {
cart[shopid][category_id][item_id][food_id] = {}; cart[shopid][category_id][item_id][food_id] = {};
cart[shopid][category_id][item_id][food_id]['num'] = 1; cart[shopid][category_id][item_id][food_id]['num'] = 1;
cart[shopid][category_id][item_id][food_id]['id'] = food_id;
cart[shopid][category_id][item_id][food_id]['name'] = name; cart[shopid][category_id][item_id][food_id]['name'] = name;
cart[shopid][category_id][item_id][food_id]['price'] = price; cart[shopid][category_id][item_id][food_id]['price'] = price;
cart[shopid][category_id][item_id][food_id]['specs'] = specs; cart[shopid][category_id][item_id][food_id]['specs'] = specs;
}else if(cart[shopid]&&cart[shopid][category_id]){ cart[shopid][category_id][item_id][food_id]['packing_fee'] = packing_fee;
cart[shopid][category_id][item_id][food_id]['sku_id'] = sku_id;
cart[shopid][category_id][item_id][food_id]['stock'] = stock;
} else if (cart[shopid] && cart[shopid][category_id]) {
cart[shopid][category_id][item_id] = {}; cart[shopid][category_id][item_id] = {};
cart[shopid][category_id][item_id][food_id] = {}; cart[shopid][category_id][item_id][food_id] = {};
cart[shopid][category_id][item_id][food_id]['num'] = 1; cart[shopid][category_id][item_id][food_id]['num'] = 1;
cart[shopid][category_id][item_id][food_id]['id'] = food_id;
cart[shopid][category_id][item_id][food_id]['name'] = name; cart[shopid][category_id][item_id][food_id]['name'] = name;
cart[shopid][category_id][item_id][food_id]['price'] = price; cart[shopid][category_id][item_id][food_id]['price'] = price;
cart[shopid][category_id][item_id][food_id]['specs'] = specs; cart[shopid][category_id][item_id][food_id]['specs'] = specs;
}else if(cart[shopid]){ cart[shopid][category_id][item_id][food_id]['packing_fee'] = packing_fee;
cart[shopid][category_id][item_id][food_id]['sku_id'] = sku_id;
cart[shopid][category_id][item_id][food_id]['stock'] = stock;
} else if (cart[shopid]) {
cart[shopid][category_id] = {}; cart[shopid][category_id] = {};
cart[shopid][category_id][item_id] = {}; cart[shopid][category_id][item_id] = {};
cart[shopid][category_id][item_id][food_id] = {}; cart[shopid][category_id][item_id][food_id] = {};
cart[shopid][category_id][item_id][food_id]['num'] = 1; cart[shopid][category_id][item_id][food_id]['num'] = 1;
cart[shopid][category_id][item_id][food_id]['id'] = food_id;
cart[shopid][category_id][item_id][food_id]['name'] = name; cart[shopid][category_id][item_id][food_id]['name'] = name;
cart[shopid][category_id][item_id][food_id]['price'] = price; cart[shopid][category_id][item_id][food_id]['price'] = price;
cart[shopid][category_id][item_id][food_id]['specs'] = specs; cart[shopid][category_id][item_id][food_id]['specs'] = specs;
}else{ cart[shopid][category_id][item_id][food_id]['packing_fee'] = packing_fee;
cart[shopid][category_id][item_id][food_id]['sku_id'] = sku_id;
cart[shopid][category_id][item_id][food_id]['stock'] = stock;
} else {
cart[shopid] = {}; cart[shopid] = {};
cart[shopid][category_id] = {}; cart[shopid][category_id] = {};
cart[shopid][category_id][item_id] = {}; cart[shopid][category_id][item_id] = {};
cart[shopid][category_id][item_id][food_id] = {}; cart[shopid][category_id][item_id][food_id] = {};
cart[shopid][category_id][item_id][food_id]['num'] = 1; cart[shopid][category_id][item_id][food_id]['num'] = 1;
cart[shopid][category_id][item_id][food_id]['id'] = food_id;
cart[shopid][category_id][item_id][food_id]['name'] = name; cart[shopid][category_id][item_id][food_id]['name'] = name;
cart[shopid][category_id][item_id][food_id]['price'] = price; cart[shopid][category_id][item_id][food_id]['price'] = price;
cart[shopid][category_id][item_id][food_id]['specs'] = specs; cart[shopid][category_id][item_id][food_id]['specs'] = specs;
cart[shopid][category_id][item_id][food_id]['packing_fee'] = packing_fee;
cart[shopid][category_id][item_id][food_id]['sku_id'] = sku_id;
cart[shopid][category_id][item_id][food_id]['stock'] = stock;
} }
//返回一个新的对象,否则计算属性无法监听到数据的变化 //返回一个新的对象,否则计算属性无法监听到数据的变化
state.cartList = Object.assign({}, cart); state.cartList = Object.assign({}, cart);
...@@ -52,39 +95,49 @@ export default { ...@@ -52,39 +95,49 @@ export default {
setStore('buyCart', state.cartList); setStore('buyCart', state.cartList);
}, },
// 移出购物车 // 移出购物车
[REDUCE_CART] (state, {shopid, category_id, item_id, food_id, name, price, specs}) { [REDUCE_CART](state, {
shopid,
category_id,
item_id,
food_id,
name,
price,
specs
}) {
let cart = state.cartList; let cart = state.cartList;
if (cart[shopid]&&cart[shopid][category_id]&&cart[shopid][category_id][item_id]&&cart[shopid][category_id][item_id][food_id]) { if (cart[shopid] && cart[shopid][category_id] && cart[shopid][category_id][item_id] && cart[shopid][category_id][item_id][food_id]) {
if (cart[shopid][category_id][item_id][food_id]['num'] > 0) { if (cart[shopid][category_id][item_id][food_id]['num'] > 0) {
cart[shopid][category_id][item_id][food_id]['num'] --; cart[shopid][category_id][item_id][food_id]['num']--;
//返回一个新的对象,否则计算属性无法监听到数据的变化 //返回一个新的对象,否则计算属性无法监听到数据的变化
state.cartList = Object.assign({}, cart); state.cartList = Object.assign({}, cart);
//存入localStorage //存入localStorage
setStore('buyCart', state.cartList); setStore('buyCart', state.cartList);
}else{ } else {
//商品数量为0,则清空当前商品的信息 //商品数量为0,则清空当前商品的信息
cart[shopid][category_id][item_id][food_id] = null; cart[shopid][category_id][item_id][food_id] = null;
} }
} }
}, },
//网页初始化时从本地缓存获取购物车数据 //网页初始化时从本地缓存获取购物车数据
[INIT_BUYCART](state){ [INIT_BUYCART](state) {
let initCart = getStore('buyCart'); let initCart = getStore('buyCart');
if (initCart) { if (initCart) {
state.cartList = JSON.parse(initCart); state.cartList = JSON.parse(initCart);
} }
}, },
//清空当前商品的购物车信息 //清空当前商品的购物车信息
[CLEAR_CART](state,shopid){ [CLEAR_CART](state, shopid) {
state.cartList[shopid] = null; state.cartList[shopid] = null;
state.cartList = Object.assign({}, state.cartList); state.cartList = Object.assign({}, state.cartList);
setStore('buyCart', state.cartList); setStore('buyCart', state.cartList);
}, },
[RECORD_USERINFO](state, info){
[RECORD_USERINFO](state, info) {
state.userInfo = info; state.userInfo = info;
setStore('useInfo', info); setStore('useInfo', info);
}, },
[GET_USERINFO](state){
[GET_USERINFO](state) {
let info = getStore('useInfo'); let info = getStore('useInfo');
if (info) { if (info) {
state.userInfo = JSON.parse(info); state.userInfo = JSON.parse(info);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册