Compare commits
5 Commits
2e4184429a
...
b409210546
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b409210546 | ||
![]() |
b3a0c1bd0e | ||
![]() |
1cb1a23327 | ||
![]() |
242b5b5fee | ||
![]() |
1645e9c70b |
11
pages.json
11
pages.json
@ -42,7 +42,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/shop/pay",
|
"path": "pages/shop/pay",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "收银台"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -53,9 +53,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/main/login",
|
"path" : "pages/main/login",
|
||||||
"style" :
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"navigationBarTitleText" : ""
|
"path" : "pages/main/order",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
27
pages/main/order.vue
Normal file
27
pages/main/order.vue
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<!-- topbar -->
|
||||||
|
<u-navbar title="订单查询" bgColor="#d43030" :titleStyle="{ color: '#FFF'}" :autoBack="true" placeholder>
|
||||||
|
<view class="u-nav-slot" slot="left">
|
||||||
|
<u-icon name="arrow-left" color="#fff" size="19"></u-icon>
|
||||||
|
</view>
|
||||||
|
</u-navbar>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
@ -72,10 +72,11 @@
|
|||||||
<view v-else class="bg-m rad16 flex" style="height: 108rpx;">
|
<view v-else class="bg-m rad16 flex" style="height: 108rpx;">
|
||||||
<view class="flex md p-b-12">
|
<view class="flex md p-b-12">
|
||||||
<u--image src="/static/icons/planeBox-100.svg" width="136rpx" height="136rpx"
|
<u--image src="/static/icons/planeBox-100.svg" width="136rpx" height="136rpx"
|
||||||
@click="$store.state.cartShow = !$store.state.cartShow" />
|
@click="$store.commit('setCartShow',!$store.state.cartShow)" />
|
||||||
</view>
|
</view>
|
||||||
<view class="fci fz36 flex1 flex msb">
|
<view class="fci fz36 flex1 flex msb">
|
||||||
<view class="flex1 p-l-12 flex column mc" @click="$store.state.cartShow = !$store.state.cartShow">
|
<view class="flex1 p-l-12 flex column mc"
|
||||||
|
@click="$store.commit('setCartShow',!$store.state.cartShow)">
|
||||||
<view class="fz36 fb">¥{{total | formatPrice}}</view>
|
<view class="fz36 fb">¥{{total | formatPrice}}</view>
|
||||||
<view class="fz24" v-if="minimumOrderDifference>0">还差¥{{minimumOrderDifference | formatPrice}}起送
|
<view class="fz24" v-if="minimumOrderDifference>0">还差¥{{minimumOrderDifference | formatPrice}}起送
|
||||||
</view>
|
</view>
|
||||||
@ -186,13 +187,13 @@
|
|||||||
// 如果节点尚未生成,res值为null,循环调用执行
|
// 如果节点尚未生成,res值为null,循环调用执行
|
||||||
if (!res) {
|
if (!res) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getElRect(elClass);
|
this.getElRect(elClass)
|
||||||
}, 10)
|
}, 10)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this[dataVal] = res.height;
|
this[dataVal] = res.height
|
||||||
resolve()
|
resolve()
|
||||||
}).exec();
|
}).exec()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 观测元素相交状态
|
// 观测元素相交状态
|
||||||
@ -262,21 +263,22 @@
|
|||||||
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
|
// 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
|
||||||
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
|
if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
|
||||||
this.leftMenuStatus(i)
|
this.leftMenuStatus(i)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 10)
|
}, 10)
|
||||||
},
|
},
|
||||||
//"选好了"执行
|
//"选好了"执行
|
||||||
handleSeled() {
|
handleSeled() {
|
||||||
if (!this.$store.state.userInfo.tel) { //没有手机号 跳转到手机获取
|
const regex = /^(\+?\d{1,4}[\s-]?)?\d{3}\*{4}\d{4}$/
|
||||||
uni.navigateTo({
|
if (regex.test(this.$store.state.userInfo.tel)) { //手机号合法
|
||||||
url: '/pages/main/getTel'
|
uni.navigateTo({ //跳转到订单页面
|
||||||
})
|
|
||||||
} else { //跳转到 确认订单页面
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/shop/order'
|
url: '/pages/shop/order'
|
||||||
})
|
})
|
||||||
|
} else { //手机号不合法 获取为空
|
||||||
|
uni.navigateTo({ //跳转到获取手机号页面
|
||||||
|
url: '/pages/main/getTel'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
<text class="fz24">合计:</text>
|
<text class="fz24">合计:</text>
|
||||||
<text class="fz44">¥{{total | formatPrice}}</text>
|
<text class="fz44">¥{{total | formatPrice}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="fz32 bg-m flex column mac mc fci rad16 m-r-24" style="width:220rpx;height:100rpx;"
|
<view class="fz32 flex column mac mc fci rad16 m-r-24" style="width:220rpx;height:100rpx;"
|
||||||
@click="handleCheckout">
|
@click="handleCheckout" :class="isPressed?'bg-g':'bg-m'">
|
||||||
<view>提交订单</view>
|
<view>提交订单</view>
|
||||||
<view>Checkout</view>
|
<view>Checkout</view>
|
||||||
</view>
|
</view>
|
||||||
@ -64,6 +64,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
isPressed: false, //提交按钮是否锁定
|
||||||
remark: '' //用户备注
|
remark: '' //用户备注
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -90,6 +91,10 @@
|
|||||||
totalPrice,
|
totalPrice,
|
||||||
//提交订单
|
//提交订单
|
||||||
handleCheckout() {
|
handleCheckout() {
|
||||||
|
if (this.isPressed) {//防止提交订单按钮重复点击
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.isPressed = true
|
||||||
//提交订单
|
//提交订单
|
||||||
uni.$u.http.post('/Api/Check/checkout', {
|
uni.$u.http.post('/Api/Check/checkout', {
|
||||||
cartList: JSON.stringify(this.cartList), //购物车列表
|
cartList: JSON.stringify(this.cartList), //购物车列表
|
||||||
@ -105,9 +110,11 @@
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
//订单添加成功
|
//订单添加成功
|
||||||
if (res.data.status === 1) {
|
if (res.data.status === 1) {
|
||||||
const order_sn = res.data.order_sn;
|
//清空购物车
|
||||||
|
this.$store.commit('clearCartList')
|
||||||
|
//跳转到支付页面
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/shop/pay?order_sn=${order_sn}`
|
url: `/pages/shop/pay?order_sn=${res.data.order_sn}`
|
||||||
});
|
});
|
||||||
} else if (res.data.status === -1) {
|
} else if (res.data.status === -1) {
|
||||||
uni.removeStorage({ //清除用户信息 跳转首页
|
uni.removeStorage({ //清除用户信息 跳转首页
|
||||||
@ -124,6 +131,7 @@
|
|||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
|
this.isPressed = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -133,7 +141,12 @@
|
|||||||
formatPrice, //格式化价格
|
formatPrice, //格式化价格
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
//购物车没有信息 跳转到订单查询页面
|
||||||
|
if (this.$store.state.cartList.length === 0) {
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/main/order'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<button @click="pay">确认支付</button>
|
<!-- topbar -->
|
||||||
|
<u-navbar title="收银台" bgColor="#d43030" :titleStyle="{ color: '#FFF'}" :autoBack="true" placeholder>
|
||||||
|
<view class="u-nav-slot" slot="left">
|
||||||
|
<u-icon name="arrow-left" color="#fff" size="19"></u-icon>
|
||||||
|
</view>
|
||||||
|
</u-navbar>
|
||||||
|
<button @click="pay" type="primary" style="margin-top:200rpx;">确认支付</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -43,6 +43,10 @@ const store = new Vuex.Store({
|
|||||||
},
|
},
|
||||||
//修改状态
|
//修改状态
|
||||||
mutations: {
|
mutations: {
|
||||||
|
//设置 列表页 购物车折叠显隐
|
||||||
|
setCartShow(state,val){
|
||||||
|
Vue.set(state,'cartShow', val)
|
||||||
|
},
|
||||||
//设置 标记用户登录状态
|
//设置 标记用户登录状态
|
||||||
setMqttState(state,val){
|
setMqttState(state,val){
|
||||||
Vue.set(state,'mqttState', val)
|
Vue.set(state,'mqttState', val)
|
||||||
@ -89,6 +93,10 @@ const store = new Vuex.Store({
|
|||||||
setShopCon(state, obj) {
|
setShopCon(state, obj) {
|
||||||
state.shopCon = obj
|
state.shopCon = obj
|
||||||
},
|
},
|
||||||
|
//清空购物车
|
||||||
|
clearCartList(state){
|
||||||
|
Vue.set(state,'cartList', [])
|
||||||
|
},
|
||||||
// 设置购物车列表
|
// 设置购物车列表
|
||||||
setCartList(state, obj) {
|
setCartList(state, obj) {
|
||||||
let isExisting = false
|
let isExisting = false
|
||||||
|
Loading…
Reference in New Issue
Block a user