From 658107c8a09e2ef74bab1ad7114eeaf367848a25 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期一, 06 七月 2026 18:14:16 +0800
Subject: [PATCH] Merge branch '3.0.1' of http://139.186.142.91:10010/r/productDev/parkBike into 3.0.1
---
bicycle/pages/couponRedemption/couponRedemption.vue | 85 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 76 insertions(+), 9 deletions(-)
diff --git a/bicycle/pages/couponRedemption/couponRedemption.vue b/bicycle/pages/couponRedemption/couponRedemption.vue
index e51444e..a6dc715 100644
--- a/bicycle/pages/couponRedemption/couponRedemption.vue
+++ b/bicycle/pages/couponRedemption/couponRedemption.vue
@@ -4,27 +4,94 @@
<image class="logo" src="/static/images/title_duihuan@2x.png" mode="widthFix"></image>
<view class="title">鍥㈣喘鑷姪楠屽埜</view>
<view class="shuru">
- <input type="text" placeholder="杈撳叆鍒哥爜" />
- <image src="/static/icon/ic_saoma@2x.png" mode="widthFix"></image>
+ <input v-model="code" type="text" placeholder="杈撳叆鍒哥爜" />
+ <image src="/static/icon/ic_saoma@2x.png" mode="widthFix" @click="scanCoupon"></image>
</view>
<view class="btn" @click="jump">鍏戞崲</view>
- <view class="tips">璇疯緭鍏ユ纭殑鍒哥爜</view>
+ <!-- <view v-if="errorText" class="tips">{{ errorText }}</view> -->
</view>
</view>
</template>
<script>
+ const VERIFY_PACKAGE_INFO_KEY = 'verifyPackageInfo'
+
export default {
data() {
return {
-
+ code: '',
+ errorText: '',
+ submitting: false
};
},
methods: {
- jump() {
- uni.navigateTo({
- url: '/pages/success/success'
- })
+ async jump() {
+ const code = this.code.trim()
+
+ if (!code) {
+ this.errorText = '璇疯緭鍏ユ纭殑鍒哥爜'
+ uni.showToast({
+ title: '璇疯緭鍏ュ埜鐮�',
+ icon: 'none',
+ duration: 2000
+ })
+ return
+ }
+
+ await this.submitVerify({ code })
+ },
+ async scanCoupon() {
+ if (this.submitting) {
+ return
+ }
+
+ try {
+ const res = await uni.scanCode({
+ scanType: ['qrCode', 'barCode']
+ })
+
+ if (!res.result) {
+ uni.showToast({
+ title: '鏈瘑鍒埌鍒哥爜',
+ icon: 'none',
+ duration: 2000
+ })
+ return
+ }
+ await this.submitVerify({ qrContent: res.result })
+ } catch (error) {
+ if (error && (error.errMsg || '').includes('cancel')) {
+ return
+ }
+
+ uni.showToast({
+ title: '鎵爜澶辫触锛岃閲嶈瘯',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ },
+ async submitVerify(payload) {
+
+ if (this.submitting) {
+ return
+ }
+
+ this.submitting = true
+
+ try {
+ const res = await this.$u.api.scanVerify(payload)
+
+ if (res.code === 200 && res.data && res.data.packageInfo) {
+ uni.setStorageSync(VERIFY_PACKAGE_INFO_KEY, res.data.packageInfo)
+ uni.navigateTo({
+ url: '/pages/success/success'
+ })
+ return
+ }
+ } finally {
+ this.submitting = false
+ }
}
}
}
@@ -104,4 +171,4 @@
}
}
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3