【类 型】:factor

【原  因】:防止 重复点击按钮
【过  程】:给支付按钮加一个标记 点击之后改变按钮样式 并且标记点击过 点击过 则不继续执行pay 函数
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
sszdot 2024-12-18 18:35:51 +08:00
parent 5b6787aa49
commit 6abfd95c8a
2 changed files with 7 additions and 3 deletions

View File

@ -51,7 +51,7 @@
})
} else if (name === 2) {
uni.redirectTo({
uni.navigateTo({
url: '/pages/main/index'
})
}

View File

@ -27,8 +27,7 @@
</view>
</view>
</view>
<view @click="pay" class="butBox fci bg-m rad8 fb fz36 flex mc p-24 m-l-24 m-r-24">确认支付</view>
<!-- <button @click="pay" type="primary">确认支付</button> -->
<view @click="pay" class="butBox fci bg-m rad8 fb fz36 flex mc p-24 m-l-24 m-r-24" :class="isPressed?'bg-g':'bg-m'">确认支付</view>
</view>
</view>
@ -48,6 +47,7 @@
order_time: -1, //
countdown: '', //
timer: null, //
isPressed: false, //
}
},
onLoad(options) {
@ -113,6 +113,10 @@
formatSeconds,
//
pay() {
if (this.isPressed) { //
return
}
this.isPressed = true
uni.$u.http.post('/Api/Pay/pay', {
order_sn: this.order_sn
}, {