【类 型】:fix
【主 题】:提交订单按钮 防止重复提交 【描 述】: [原因]:跳转页面时异步的 狂点按钮会致 添加多条订单记录 [过程]:给按钮加状态 处于按过的状态 不再提交订单 [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
1cb1a23327
commit
b3a0c1bd0e
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>
|
@ -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), //购物车列表
|
||||||
@ -126,6 +131,7 @@
|
|||||||
title: res.data.msg,
|
title: res.data.msg,
|
||||||
icon: 'error'
|
icon: 'error'
|
||||||
})
|
})
|
||||||
|
this.isPressed = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user