|
|
@@ -37,13 +37,6 @@
|
|
|
<ie-button type="primary" :loading="loading" @click="handlePay">{{ `确认支付 ¥${formatPrice}` }}</ie-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <ie-popup ref="popupRef" mode="center">
|
|
|
- <view class="w-[70vw] px-50 pt-50 pb-80">
|
|
|
- <view class="text-center text-30 text-fore-title font-bold mb-50">请先绑定微信</view>
|
|
|
- <uv-button type="primary" icon-color="white" @click="handleBindWechat" icon-size="24"
|
|
|
- icon="weixin-fill">点击绑定微信</uv-button>
|
|
|
- </view>
|
|
|
- </ie-popup>
|
|
|
</ie-page>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
@@ -65,26 +58,24 @@ async function getWxCode() {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-const popupRef = ref();
|
|
|
-const handleBindWechat = async (e: any) => {
|
|
|
- uni.$ie.showLoading();
|
|
|
- const code = await getWxCode();
|
|
|
- if (code) {
|
|
|
- bindOpenId(code).then(async res => {
|
|
|
- popupRef.value?.close();
|
|
|
- await userStore.getUserInfo();
|
|
|
- uni.$ie.hideLoading();
|
|
|
- handlePay();
|
|
|
- }).catch(err => {
|
|
|
- console.error(err);
|
|
|
- uni.$ie.hideLoading();
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-const handlePay = () => {
|
|
|
+const handlePay = async () => {
|
|
|
if (!userStore.isBindWechat) {
|
|
|
- popupRef.value?.open();
|
|
|
+ uni.$ie.showLoading();
|
|
|
+ const code = await getWxCode();
|
|
|
+ if (code) {
|
|
|
+ bindOpenId(code).then(async res => {
|
|
|
+ await userStore.getUserInfo();
|
|
|
+ uni.$ie.hideLoading();
|
|
|
+ handlePay();
|
|
|
+ }).catch(err => {
|
|
|
+ console.error(err);
|
|
|
+ uni.$ie.hideLoading();
|
|
|
+ uni.$ie.showToast('绑定失败');
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.$ie.hideLoading();
|
|
|
+ uni.$ie.showToast('绑定失败');
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
loading.value = true
|