Преглед изворни кода

修改微信提现的弹窗

JXDS18FUJT пре 2 година
родитељ
комит
70e7ca31aa
1 измењених фајлова са 63 додато и 28 уклоњено
  1. 63 28
      src/views/cashout/index.vue

+ 63 - 28
src/views/cashout/index.vue

@@ -1,7 +1,12 @@
 <template>
 	<div class="bg">
 		<m-nav-bar mode="white" title="提现"></m-nav-bar>
+		<van-dialog @confirm="cashToWx" v-model:show="cashToWxShow">
+			<template #title>
+				确定提现<span style="color:red">{{ (Number(amount)) }}元</span>到微信零钱吗?
 
+			</template>
+		</van-dialog>
 		<img class="bg-img" :src="bgImgIcon">
 		<div class="text">
 			<div>可提现金额(元)</div>
@@ -28,7 +33,9 @@
 					cashToCardShow = true
 				}" class="cash-button" color="#498EF5" round icon="credit-pay" type="primary">提现到银行卡
 				</van-button>
-				<van-button @click="cashToWx" class="cash-button" color="#01C18D" round icon="wechat" type="primary">
+				<van-button  @click="() => {
+					cashToWxShow = true
+				}" class="cash-button" color="#01C18D" round icon="wechat" type="primary">
 					提现到微信</van-button>
 			</div>
 			<van-dialog @confirm="cashToCard" v-model:show="cashToCardShow" title="银行卡信息" show-cancel-button>
@@ -98,6 +105,7 @@ export default defineComponent({
 		})
 		const wxCashoutList = ref<any[]>([])
 		const cashToCardShow = ref(false)
+		const cashToWxShow = ref(false)
 		const bankPickerShow = ref(false)
 		const bankCode = ref<number>()
 		const bankName = ref('')
@@ -123,7 +131,7 @@ export default defineComponent({
 		})
 		const cashToCard = () => {
 			if (Number(amount.value) < 0.3) {
-				Toast.fail('提现金额需要0.3元以上')
+				Toast.fail('银行卡提现金额需要0.3元以上')
 
 				return
 			}
@@ -141,6 +149,7 @@ export default defineComponent({
 				}
 				Toast.success('提现成功,到账有延迟')
 				store.dispatch('getUserInfo');
+				amount.value = ''
 				api.wx.studentWxExtractlist({
 					pageNum: 1,
 					pageSize: 1000
@@ -158,37 +167,63 @@ export default defineComponent({
 
 		}
 		const cashToWx = () => {
-			Dialog.confirm({
-				title: '提现到微信',
-			})
-				.then(() => {
-					if (Number(amount.value) < 1) {
-						Toast.fail('提现金额需要大于1元')
+			if (Number(amount.value) < 1) {
+				Toast.fail('微信提现金额需要1元以上')
+				api.wx.studentWxExtractWithdraw({
+					amount: Number(amount.value) * 100
+				}).then(res => {
+					if (res.data.code !== 200) {
+						Toast.fail(res.data.msg)
 						return
 					}
-					api.wx.studentWxExtractWithdraw({
-						amount: Number(amount.value) * 100
+					Toast.success('提现成功,到账有延迟')
+					store.dispatch('getUserInfo');
+					amount.value = ''
+					api.wx.studentWxExtractlist({
+						pageNum: 1,
+						pageSize: 1000
 					}).then(res => {
-						if (res.data.code !== 200) {
-							Toast.fail(res.data.msg)
-							return
-						}
-						Toast.success('提现成功,到账有延迟')
-						store.dispatch('getUserInfo');
-						api.wx.studentWxExtractlist({
-							pageNum: 1,
-							pageSize: 1000
-						}).then(res => {
-							wxCashoutList.value = res.data.rows
-
-						})
+						wxCashoutList.value = res.data.rows
 
 					})
-					// on confirm
+
 				})
-				.catch(() => {
-					// on cancel
-				});
+
+				return
+			}
+
+			// Dialog.confirm({
+			// 	title: '确定提现'+(Number(amount.value))+'元到微信零钱吗?',
+			// })
+			// 	.then(() => {
+			// 		if (Number(amount.value) < 1) {
+			// 			Toast.fail('提现金额需要大于1元')
+			// 			return
+			// 		}
+			// 		api.wx.studentWxExtractWithdraw({
+			// 			amount: Number(amount.value) * 100
+			// 		}).then(res => {
+			// 			if (res.data.code !== 200) {
+			// 				Toast.fail(res.data.msg)
+			// 				return
+			// 			}
+			// 			Toast.success('提现成功,到账有延迟')
+			// 			store.dispatch('getUserInfo');
+			// 			amount.value=''
+			// 			api.wx.studentWxExtractlist({
+			// 				pageNum: 1,
+			// 				pageSize: 1000
+			// 			}).then(res => {
+			// 				wxCashoutList.value = res.data.rows
+
+			// 			})
+
+			// 		})
+			// 		// on confirm
+			// 	})
+			// 	.catch(() => {
+			// 		// on cancel
+			// 	});
 
 
 
@@ -216,7 +251,7 @@ export default defineComponent({
 			encBankNo,
 			encTrueName,
 			wxCashoutList,
-
+			cashToWxShow,
 			userInfo,
 			searchValue: "",
 			profitPrice: "0.00",