Compare commits

...

5 Commits

Author SHA1 Message Date
tk
b409210546 【类 型】:test
【主	题】:调整一下支付页面的ui
【描	述】:
	[原因]:
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-06-05 19:15:26 +08:00
tk
b3a0c1bd0e 【类 型】:fix
【主	题】:提交订单按钮 防止重复提交
【描	述】:
	[原因]:跳转页面时异步的 狂点按钮会致 添加多条订单记录
	[过程]:给按钮加状态 处于按过的状态 不再提交订单
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-06-05 19:00:42 +08:00
tk
1cb1a23327 【类 型】:feat
【主	题】:选好 商品提交订单时 清空购物车缓存 商品提交页检测不到购物车时 跳转到 订单查询页面
【描	述】:
	[原因]:
	[过程]:清空购物车缓存 商品提交页检测不到购物车时 跳转到 订单查询页面
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-06-05 18:44:33 +08:00
tk
242b5b5fee 【类 型】:refactor
【主	题】:订单提交时候 判断手机号
【描	述】:
	[原因]:改为正则匹配判断手机号合法性  而不是值判断是否为空
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-06-05 18:14:46 +08:00
tk
1645e9c70b 【类 型】:refactor
【主	题】:vux 用comit形式赋值
【描	述】:
	[原因]:符合vue代码规范
	[过程]:
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
2024-06-05 17:57:46 +08:00
6 changed files with 83 additions and 22 deletions

View File

@ -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
View 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>

View File

@ -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 @@
// resnull // resnull
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'
})
} }
} }
}, },

View File

@ -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>

View File

@ -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>

View File

@ -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