transfer.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  1. <template>
  2. <cwg-page-wrapper class="create-page" :isHeaderFixed="true">
  3. <cwg-header :title="title" />
  4. <uni-loading v-if="loading" />
  5. <view id="custom_IbTransfer" class="transfer-page" v-else>
  6. <view class="main-content">
  7. <!-- 步骤1:选择转出账户 -->
  8. <cwg-asset-tabs v-model="activeTab" :tabs="tabsConfig" />
  9. <!-- 步骤2:转账表单 -->
  10. <view class="box box-step2">
  11. <view class="b-card">
  12. <view class="card-top">
  13. <view class="tit">
  14. <text>
  15. <text v-t="'Label.AgentNumber'"></text>
  16. :{{ ibInfo.ibNo }}
  17. </text>
  18. <text class="balance-kg"></text>
  19. <text>
  20. <text v-t="'Label.CommissionBalance'"></text>
  21. <text>:$</text>
  22. <text>{{ balanceInt }}</text>
  23. <text>.{{ balanceDecimal }}</text>
  24. </text>
  25. </view>
  26. <uni-forms ref="formRef" :model="form" :rules="rules" label-width="300" label-position="top"
  27. validate-trigger="submit">
  28. <view class="form-row">
  29. <view class="form-col">
  30. <!-- 转入账户 -->
  31. <uni-forms-item :label="toLabel" name="to"
  32. :error-message="deposittoErrorMessage">
  33. <cwg-combox v-model:value="form.to" :clearable="false"
  34. :options="depositDisplayList" :placeholder="t('placeholder.choose')" />
  35. </uni-forms-item>
  36. </view>
  37. </view>
  38. <view class="form-row">
  39. <view class="form-col amount-box">
  40. <!-- 转账金额 -->
  41. <uni-forms-item :label="t('Custom.Transfer.Amount')" name="amount"
  42. :error-message="amountErrorMessage" class="amount-input">
  43. <uni-easyinput v-model="form.amount" :placeholder="t('placeholder.input')"
  44. @blur="validateAmount" />
  45. </uni-forms-item>
  46. <view class="btn" v-t="'State.All'" @click="setAllAmount"></view>
  47. </view>
  48. </view>
  49. <template v-if="activeTab != 3">
  50. <!-- 20%赠金-年中赠金 -->
  51. <view class="form-row" v-if="tableData4TwoFlag">
  52. <uni-forms-item class="agree">
  53. <checkbox-group :value="form.agree5 ? ['1'] : []" @change="onAgree5Change">
  54. <label class="checkbox">
  55. <checkbox value="1" :checked="form.agree5" />
  56. <text>{{ t('news_add_field1.activitiesNZTwo.itemDeposit1')
  57. }}</text>
  58. <view style="margin-top: 10px;line-height: 1.5; font-size: 14px">
  59. <text class="crm-cursor" @click.stop="dialogCheckTip = true">{{
  60. t('Custom.Withdraw.Des') }}</text>
  61. <text>{{ t('news_add_field1.activitiesNZTwo.itemDeposit2')
  62. }}</text>
  63. <text class="clause crm-cursor"
  64. style="text-decoration: underline;"
  65. @click.stop="dialogClauseNZTwo = true">{{
  66. t('news_add_field1.activitiesNZTwo.itemDeposit3') }}</text>
  67. <text>{{ t('news_add_field1.activitiesNZTwo.itemDeposit4')
  68. }}</text>
  69. </view>
  70. </label>
  71. </checkbox-group>
  72. </uni-forms-item>
  73. </view>
  74. <!-- 赠送活动 -->
  75. <view class="form-row" v-if="tableDataNewListFlag">
  76. <view class="form-col-full">
  77. <uni-forms-item name="agree6">
  78. <checkbox-group :value="form.agree6 ? ['1'] : []"
  79. @change="onAgree6Change">
  80. <label class="checkbox">
  81. <checkbox value="1" :checked="form.agree6" />
  82. <text @click.stop="dialogClauseNewList = true"
  83. style="text-decoration: underline;">{{
  84. tableDataNewList.title }}</text>
  85. <view
  86. style="margin-top: 10px; line-height: 1.5; font-size: 14px">
  87. <text> {{
  88. t('news_add_field1.activitiesNewList.item1') }}{{
  89. t('news_add_field1.activitiesNewList.item2') }}</text>
  90. </view>
  91. </label>
  92. </checkbox-group>
  93. </uni-forms-item>
  94. </view>
  95. </view>
  96. </template>
  97. <view class="form-row">
  98. <button class="s-btn reselect" type="primary" @click="toTransfer">{{ locale === 'es'
  99. ?
  100. 'Enviar solicitud' : t('Btn.Submit') }}</button>
  101. </view>
  102. </uni-forms>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <!-- 失败弹窗 -->
  108. <cwg-error-popup v-model:visible="dialogError" @confirm="closeDia" :responseMessage="RES" />
  109. <!-- 成功弹窗 -->
  110. <cwg-success-popup v-model:visible="dialogSuccess" @confirm="closeDia" />
  111. <!-- 等待弹窗 -->
  112. <cwg-wait-popup v-model:visible="dialogCheckWait" :showFooters="false" />
  113. <!-- 不参加活动弹出框 -->
  114. <cwg-dont-active-popup v-model:visible="dialogDontActive" :showFooters="true" @confirm="tosubmitConfirm" />
  115. <!-- 功能关闭弹出 -->
  116. <cwg-function-disabled-popup v-model:visible="InfoStatus5" :showFooters="false" @confirm="toHome" />
  117. <!-- 赠金协议20年中 -->
  118. <BonusAgreementPopup v-model:visible="dialogClauseNZTwo" :title="t('news_add_field1.activitiesNZTwo.item6')"
  119. type="nzTwo" :tableData4Two="tableData4Two" />
  120. <!-- 赠送活动协议 -->
  121. <BonusAgreementPopup v-model:visible="dialogClauseNewList" :title="tableDataNewList.title"
  122. :content="tableDataNewList.content" type="newList" />
  123. </view>
  124. <cwg-confirm-popup />
  125. </cwg-page-wrapper>
  126. </template>
  127. <script setup>
  128. import { ref, reactive, computed, onMounted, watch, nextTick } from 'vue'
  129. import { useI18n } from 'vue-i18n'
  130. import { onLoad } from '@dcloudio/uni-app'
  131. import { getCurrentInstance } from 'vue'
  132. import { ibApi } from '@/service/ib'
  133. import { activityApi } from '@/service/activity'
  134. import Config from '@/config/index'
  135. import useUserStore from '@/stores/use-user-store'
  136. import BonusAgreementPopup from './components/BonusAgreementPopup.vue'
  137. import { useFilters } from '@/composables/useFilters'
  138. const { numberFormat } = useFilters()
  139. const userStore = useUserStore()
  140. import { isAfterJuly28 } from '@/utils/dateUtils'
  141. const ibInfo = computed(() => {
  142. return userStore?.userInfo?.ibInfo || {}
  143. })
  144. const { Code } = Config
  145. const { t, locale } = useI18n()
  146. const activeTab = ref(1)
  147. const tabsConfig = computed(() => [
  148. { text: t('Ib.Transfer.CommissionTransfer'), value: 1, type: 'commission' },
  149. { text: t('Ib.Transfer.CommissionIssue'), value: 2, type: 'commissionIssue' },
  150. { text: t('Ib.Transfer.IbAccountTransfer'), value: 3, type: 'ib' },
  151. ])
  152. const title = computed(() => tabsConfig.value.find(item => item.value == activeTab.value)?.text || '')
  153. const toLabel = computed(() => activeTab.value == '1' || activeTab.value == '2' ? t('Label.IntoAccount') : t('Ib.Transfer.IntoAgentAccount'))
  154. // 获取全局实例(用于访问 Session、$pigeon 等)
  155. const { proxy } = getCurrentInstance()
  156. const $pigeon = proxy?.$pigeon
  157. import { useConfirm } from '@/hooks/useConfirm'
  158. const confirm = useConfirm()
  159. // 响应式数据
  160. const loginValue = ref('')
  161. const flag = ref(false)
  162. const RES = ref('') // 弹窗响应信息
  163. const giveLoginJoin = ref(null)
  164. const step2 = ref(false)
  165. const amountLimits = reactive({
  166. minAmount: '',
  167. maxAmount: '',
  168. })
  169. const form = reactive({
  170. currency: 'USD',
  171. depositLogin: null,
  172. to: null,
  173. amount: '',
  174. agree5: false,
  175. agree6: false,
  176. })
  177. const resetForm = async () => {
  178. await nextTick();
  179. formRef.value?.clearValidate(); // 再次清除可能因数据重置产生的新错误
  180. form.customBankCode = ""
  181. form.depositLogin = ""
  182. form.withdrawLogin = ""
  183. form.to = ""
  184. form.amount = ""
  185. form.agree5 = false
  186. form.agree6 = false
  187. amountErrorMessage.value = ""
  188. submitting.value = false
  189. flag.value = false
  190. }
  191. const dialogSuccess = computed(() => dialogCheck.value && dialogVisible.value)
  192. const dialogError = computed(() => dialogCheck.value && !dialogVisible.value)
  193. const dialogCheck = ref(false)
  194. const dialogVisible = ref(false)
  195. const dialogCheckWait = ref(false)
  196. const InfoStatus5 = ref(false)
  197. const dialogClauseNZTwo = ref(false)
  198. const tableData4TwoFlag = ref(false)
  199. const tableData4Two = ref({})
  200. const dialogClauseNewList = ref(false)
  201. const tableDataNewListFlag = ref(false)
  202. const tableDataNewList = ref({})
  203. const dialogDontActive = ref(false)
  204. const submitting = ref(false)
  205. // 错误信息
  206. const depositErrorMessage = ref('')
  207. const depositLogin1ErrorMessage = ref('')
  208. const amountErrorMessage = ref('')
  209. // 表单验证规则
  210. const rules = {
  211. withdrawLogin: {
  212. rules: [
  213. {
  214. required: true,
  215. errorMessage: t('vaildate.select.empty')
  216. },
  217. ],
  218. },
  219. to: {
  220. rules: [
  221. {
  222. required: true,
  223. errorMessage: t('vaildate.select.empty')
  224. },
  225. ],
  226. },
  227. amount: {
  228. rules: [
  229. {
  230. required: true,
  231. errorMessage: t('vaildate.amount.format'),
  232. },
  233. {
  234. validateFunction: (rule, value, data, callback) => {
  235. if (!value) {
  236. callback(t('vaildate.amount.format'))
  237. } else if (
  238. amountLimits.minAmount &&
  239. amountLimits.maxAmount &&
  240. (parseFloat(amountLimits.minAmount) > parseFloat(value) ||
  241. parseFloat(amountLimits.maxAmount) < parseFloat(value))
  242. ) {
  243. callback(t('vaildate.amount.amount') +
  244. amountLimits.minAmount +
  245. '-' +
  246. amountLimits.maxAmount)
  247. } else if (!/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
  248. callback(t('vaildate.amount.format'))
  249. }
  250. return true
  251. }
  252. },
  253. ],
  254. },
  255. agree5: {
  256. rules: [
  257. {
  258. validateFunction: (rule, value, data, callback) => {
  259. if (form.agree5) {
  260. return true;
  261. } else {
  262. callback(t('vaildate.agree.empty'));
  263. return false;
  264. }
  265. },
  266. trigger: 'change',
  267. },
  268. ],
  269. },
  270. }
  271. const onAgree5Change = (e) => {
  272. form.agree5 = e.detail.value.length > 0
  273. }
  274. const onAgree6Change = (e) => {
  275. form.agree6 = e.detail.value.length > 0
  276. }
  277. const balanceInt = computed(() => {
  278. return numberFormat(balance.value || 0, true)[0]
  279. })
  280. const balanceDecimal = computed(() => {
  281. return numberFormat(balance.value || 0, true)[1] || '00'
  282. })
  283. const balance = ref(0)
  284. //获取基础信息
  285. const getDateList = async () => {
  286. let res = await ibApi.IbData({});
  287. if (res.code == Code.StatusOK) {
  288. if (res.data != null) {
  289. balance.value = res.data.balance
  290. }
  291. } else {
  292. uni.showToast({ title: res.msg, icon: 'none' })
  293. }
  294. }
  295. const setAllAmount = () => {
  296. form.amount = balance.value
  297. validateAmount()
  298. }
  299. function validateAmount() {
  300. const amount = form.amount
  301. if (!amount) {
  302. amountErrorMessage.value = t('vaildate.amount.format')
  303. return false
  304. }
  305. const numValue = parseFloat(amount)
  306. if (isNaN(numValue)) {
  307. amountErrorMessage.value = t('vaildate.amount.format')
  308. return false
  309. }
  310. if (amountLimits.minAmount && numValue < parseFloat(amountLimits.minAmount)) {
  311. amountErrorMessage.value = t('vaildate.amount.amount') + amountLimits.minAmount + '-' + amountLimits.maxAmount
  312. return false
  313. }
  314. if (amountLimits.maxAmount && numValue > parseFloat(amountLimits.maxAmount)) {
  315. amountErrorMessage.value = t('vaildate.amount.amount') + amountLimits.minAmount + '-' + amountLimits.maxAmount
  316. return false
  317. }
  318. if (!/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(amount)) {
  319. amountErrorMessage.value = t('vaildate.amount.format')
  320. return false
  321. }
  322. amountErrorMessage.value = ''
  323. return true
  324. }
  325. // 模板引用
  326. const formRef = ref(null)
  327. // 计算属性
  328. const getInfoStatus5 = computed(() => {
  329. if (ibInfo.value?.closeFunctions) {
  330. return ibInfo.value.closeFunctions.indexOf('5') !== -1
  331. }
  332. return false
  333. })
  334. // 单位类型
  335. function groupCurrency(type) {
  336. const map = { GBP: ': £', USD: ': $', EUR: ': €', USC: ': ¢' }
  337. return map[type] || ': $'
  338. }
  339. // 单位类型
  340. function groupCurrency1(type) {
  341. const map = { GBP: '£', USD: '$', EUR: '€', USC: '¢' }
  342. return map[type] || '$'
  343. }
  344. // 账户类型
  345. function groupTypeName(type) {
  346. const typeMap = {
  347. '1': t('AccountType.ClassicAccount'),
  348. '2': t('AccountType.SeniorAccount'),
  349. '3': isAfterJuly28() ? '--' : t('AccountType.AgencyAccount'),
  350. '5': t('AccountType.SpeedAccount'),
  351. '6': t('AccountType.SpeedAccount'),
  352. '7': t('AccountType.StandardAccount'),
  353. '8': t('AccountType.CentAccount')
  354. }
  355. return typeMap[type] || ''
  356. }
  357. // 转入账户列表
  358. const depositDisplayList = computed(() => {
  359. if (activeTab.value != 3) {
  360. return toInfo.value.map(item => ({
  361. text: `${item.login} - ${groupTypeName(item.type)} - ${t('Custom.Deposit.AvailableBalance')}${groupCurrency(item.currency)}${item.balance}`,
  362. value: item.login,
  363. disabled: item.status
  364. }))
  365. } else {
  366. return agentInfo.value.map(item => ({
  367. text: `${item.ibNo} - ${item.name}`,
  368. value: item.id
  369. }))
  370. }
  371. })
  372. const fromInfo = ref('')
  373. const toInfo = ref([])
  374. const agentInfo = ref([])
  375. const loading = ref(false)
  376. //转出账户信息
  377. const ransferInfo = async function () {
  378. loading.value = true
  379. let res = await ibApi.agentBalanceTransferFrom({});
  380. if (res.code == Code.StatusOK) {
  381. fromInfo.value =
  382. res.data.ibNo +
  383. " - " +
  384. t("Custom.Deposit.AvailableBalance") +
  385. ": $" +
  386. (res.data.balance ? res.data.balance : 0);
  387. } else {
  388. uni.showToast({ title: res.msg, icon: 'none' })
  389. }
  390. loading.value = false
  391. }
  392. //转入账户信息
  393. const ransferToInfo = async function () {
  394. let res;
  395. // 佣金内转使用新接口 /account/dropdown
  396. if (activeTab.value == 1) {
  397. res = await ibApi.CustomDropdown({ platform: "" });
  398. } else {
  399. // 佣金下发和其他情况使用原接口
  400. res = await ibApi.agentTransferToList({});
  401. }
  402. if (res.code == Code.StatusOK) {
  403. toInfo.value = res.data || [];
  404. toInfo.value.forEach((item) => {
  405. if (item.closeFunctions && item.closeFunctions.length > 0) {
  406. const targetValues = ["7", "5", "9"];
  407. const hasTargetValue = item.closeFunctions.some(func => targetValues.includes(func));
  408. if (hasTargetValue) {
  409. item.status = true;
  410. }
  411. }
  412. })
  413. } else {
  414. uni.showToast({ title: res.msg, icon: 'none' })
  415. }
  416. }
  417. //获取代理账户信息
  418. const getAgentInfo = async function () {
  419. let res = await ibApi.ibTreeForTransfer({});
  420. if (res.code == Code.StatusOK) {
  421. agentInfo.value = res.data || [];
  422. } else {
  423. uni.showToast({ title: res.msg, icon: 'none' })
  424. }
  425. }
  426. const currencyOptions = ref([{ value: 'USD', text: 'USD' }])
  427. function toHome() {
  428. uni.navigateTo({ url: '/pages/ib/index' })
  429. InfoStatus5.value = false
  430. }
  431. function closeDia() {
  432. resetForm()
  433. formRef.value?.resetFields?.()
  434. step2.value = false
  435. loginValue.value = ''
  436. dialogCheck.value = false
  437. dialogVisible.value = false
  438. tableData4TwoFlag.value = false
  439. tableDataNewListFlag.value = false
  440. }
  441. // 内转
  442. async function toTransfer() {
  443. if (submitting.value) return
  444. try {
  445. const valid = await formRef.value?.validate()
  446. if (!valid) {
  447. console.log('表单验证失败')
  448. return
  449. }
  450. openDontActive()
  451. } catch (error) {
  452. console.error('验证失败:', error)
  453. }
  454. }
  455. // 打开不参加活动弹窗
  456. function openDontActive() {
  457. tosubmitConfirm()
  458. }
  459. function tosubmitConfirm() {
  460. dialogDontActive.value = false
  461. transferConfig()
  462. }
  463. async function transferConfig() {
  464. if (submitting.value) return
  465. submitting.value = true
  466. try {
  467. if (flag.value) {
  468. return
  469. }
  470. flag.value = true
  471. form.activityTwoPercentGive = form.agree5 ? 1 : 0
  472. form.activityGive = form.agree6 ? 1 : 0
  473. dialogCheckWait.value = true
  474. let api
  475. if (activeTab.value != 3) {
  476. api = ibApi.agentBalanceTransfer
  477. } else {
  478. api = ibApi.agentBalanceCommissionAdd
  479. }
  480. const res = await api({ ...form })
  481. dialogCheckWait.value = false
  482. if (res.code == Code.StatusOK) {
  483. dialogCheck.value = true
  484. dialogVisible.value = true
  485. flag.value = false
  486. } else {
  487. RES.value = res.msg
  488. dialogCheck.value = true
  489. dialogVisible.value = false
  490. flag.value = false
  491. }
  492. } catch (error) {
  493. console.error('转账失败:', error)
  494. RES.value = error.msg || t('Msg.Fail')
  495. dialogCheck.value = true
  496. dialogVisible.value = false
  497. } finally {
  498. submitting.value = false
  499. flag.value = false
  500. resetForm()
  501. if (dialogCheckWait.value) dialogCheckWait.value = false
  502. getDateList()
  503. uni.$emit('updatePayment')
  504. }
  505. }
  506. async function Activity24nianzhongTwoInfo() {
  507. const res = await activityApi.Activity23nianzhongTwoInfo({})
  508. if (res.code == Code.StatusOK) {
  509. tableData4Two.value = res.data
  510. } else {
  511. uni.showToast({ title: res.msg, icon: 'none' })
  512. }
  513. }
  514. // 活动相关方法
  515. function togetActivity() {
  516. get23nianzhongTwoLogin()
  517. getActivityExtensionGiveLogin()
  518. getActivityExtensionGiveLoginJoin()
  519. }
  520. async function get23nianzhongTwoLogin() {
  521. const res = await activityApi.Activity23nianzhongTwoLogin({
  522. login: form.to,
  523. })
  524. if (res.code == Code.StatusOK) {
  525. tableData4Two.value = res.data
  526. if (tableData4Two.value.show == 1) {
  527. tableData4TwoFlag.value = true
  528. } else if (tableData4Two.value.show == 0) {
  529. tableData4TwoFlag.value = false
  530. }
  531. } else {
  532. uni.showToast({ title: res.msg, icon: 'none' })
  533. }
  534. }
  535. async function getActivityExtensionGiveLogin() {
  536. const res = await activityApi.ActivityExtensionGiveLogin({
  537. login: form.to,
  538. })
  539. if (res.code == Code.StatusOK) {
  540. tableDataNewList.value = res.data
  541. if (tableDataNewList.value.show == 1) {
  542. tableDataNewListFlag.value = true
  543. } else if (tableDataNewList.value.show == 0) {
  544. tableDataNewListFlag.value = false
  545. }
  546. } else {
  547. uni.showToast({ title: res.msg, icon: 'none' })
  548. }
  549. }
  550. async function getActivityExtensionGiveLoginJoin() {
  551. const res = await activityApi.ActivityExtensionGiveLoginJoin({
  552. login: form.to,
  553. })
  554. if (res.code == Code.StatusOK) {
  555. giveLoginJoin.value = res.data
  556. } else {
  557. uni.showToast({ title: res.msg, icon: 'none' })
  558. giveLoginJoin.value = ''
  559. }
  560. }
  561. // 监听 activeTab 变化
  562. watch(activeTab, (newVal) => {
  563. if (newVal) {
  564. console.log(newVal, 1212);
  565. if (newVal == 3) {
  566. getAgentInfo()
  567. } else {
  568. ransferToInfo()
  569. }
  570. resetForm()
  571. }
  572. })
  573. //
  574. watch(loginValue, (newVal) => {
  575. if (newVal) {
  576. step2.value = true
  577. form.withdrawLogin = newVal
  578. }
  579. })
  580. watch(() => form.to, (newVal) => {
  581. if (activeTab.value == 3) {
  582. getAgentInfo()
  583. } else {
  584. togetActivity()
  585. }
  586. })
  587. // 监听 agree6 变化
  588. watch(
  589. () => form.agree6,
  590. async (newVal) => {
  591. if (newVal && giveLoginJoin.value?.flag === false) {
  592. let tips = "";
  593. if (giveLoginJoin.value.promptType == 1) {
  594. tips = t("surplusList.item10");
  595. } else {
  596. tips = t("surplusList.item11");
  597. }
  598. // 根据 activityCategory 显示不同的操作按钮
  599. if (giveLoginJoin.value.activityCategory == 1) {
  600. try {
  601. // 第一次弹窗:取消活动
  602. await confirm({
  603. title: t("Msg.SystemPrompt"),
  604. content: tips,
  605. confirmText: t("surplusList.item12"),
  606. cancelText: t("Home.msg.item3"),
  607. });
  608. await new Promise((resolve) => {
  609. setTimeout(() => {
  610. resolve(true);
  611. }, 300);
  612. });
  613. await confirm({
  614. title: t("Msg.SystemPrompt"),
  615. content: t("surplusList.item13"),
  616. confirmText: t("Btn.Confirm"),
  617. cancelText: t("Btn.Cancel"),
  618. });
  619. // 调用取消接口
  620. const res = await activityApi.ActivityGiveCancel({
  621. login: loginValue.value,
  622. });
  623. if (res.code == Code.StatusOK) {
  624. MessageOK(res.msg || t("Msg.Success"));
  625. } else {
  626. MessageError(res.msg);
  627. }
  628. } catch (error) {
  629. // 任意一步取消 → 取消勾选
  630. form.agree6 = false;
  631. }
  632. } else if (giveLoginJoin.value.activityCategory == 2) {
  633. try {
  634. // 第一次弹窗:跳转
  635. await confirm({
  636. title: t("Msg.SystemPrompt"),
  637. content: tips,
  638. confirmText: "跳转",
  639. cancelText: t("Btn.Cancel"),
  640. showCancelButton: false,
  641. });
  642. await new Promise((resolve) => {
  643. setTimeout(() => {
  644. resolve(true);
  645. }, 300);
  646. });
  647. await confirm({
  648. title: t("Msg.SystemPrompt"),
  649. content: "是否跳转到对应活动取消",
  650. confirmText: t("Btn.Confirm"),
  651. cancelText: t("Btn.Cancel"),
  652. });
  653. // 跳转到月盈活动
  654. uni.navigateTo({
  655. path: "/pages/activity/monthly-list",
  656. });
  657. } catch (error) {
  658. // 取消 → 取消勾选
  659. form.agree6 = false;
  660. }
  661. } else {
  662. // 默认情况
  663. try {
  664. await confirm({
  665. title: t("Msg.SystemPrompt"),
  666. content: tips,
  667. confirmText: t("Btn.Confirm"),
  668. cancelText: t("Btn.Cancel"),
  669. });
  670. } catch (error) {
  671. form.agree6 = false;
  672. }
  673. }
  674. }
  675. }
  676. );
  677. onMounted(() => {
  678. if (getInfoStatus5.value) {
  679. InfoStatus5.value = true
  680. }
  681. getDateList()
  682. ransferInfo();
  683. ransferToInfo();
  684. // Activity24nianzhongTwoInfo()
  685. })
  686. onLoad((options) => {
  687. if (options?.login) {
  688. loginValue.value = options.login
  689. step2.value = true
  690. form.withdrawLogin = options.login
  691. }
  692. if (options?.tab) {
  693. activeTab.value = options?.tab
  694. }
  695. })
  696. </script>
  697. <style lang="scss" scoped>
  698. @import "@/uni.scss";
  699. .transfer-page {
  700. width: 100%;
  701. padding-bottom: px2rpx(20);
  702. .main-content {
  703. text-align: left;
  704. .box {
  705. padding-top: px2rpx(5);
  706. color: #303133;
  707. .b-card {
  708. border: 1px solid var(--bs-border-color);
  709. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  710. margin-bottom: px2rpx(10);
  711. border-radius: px2rpx(6);
  712. box-shadow: 0 px2rpx(1) px2rpx(6) 0 rgba(0, 0, 0, 0.05);
  713. &:hover {
  714. box-shadow: 0 px2rpx(2) px2rpx(8) 0 rgba(0, 0, 0, 0.1);
  715. }
  716. .card-top {
  717. padding: px2rpx(15) px2rpx(20);
  718. box-sizing: border-box;
  719. .card-row {
  720. margin-bottom: px2rpx(12);
  721. &:last-child {
  722. margin-bottom: 0;
  723. }
  724. }
  725. .tit {
  726. font-size: px2rpx(16);
  727. font-weight: 600;
  728. margin-bottom: px2rpx(16);
  729. display: flex;
  730. align-items: center;
  731. color: var(--bs-heading-color);
  732. position: relative;
  733. padding-left: 20px;
  734. &:after {
  735. content: '';
  736. position: absolute;
  737. left: 0;
  738. top: 50%;
  739. transform: translateY(-50%);
  740. width: 0;
  741. height: 0;
  742. border-top: 6px solid transparent;
  743. border-bottom: 6px solid transparent;
  744. border-left: 8px solid currentColor;
  745. }
  746. .iconfont {
  747. margin-right: px2rpx(8);
  748. color: var(--color-primary);
  749. font-size: px2rpx(18);
  750. }
  751. }
  752. .balance-kg {
  753. width: px2rpx(20);
  754. }
  755. .title-wrapper {
  756. display: flex;
  757. justify-content: space-between;
  758. align-items: center;
  759. }
  760. }
  761. }
  762. }
  763. .box-step2 {
  764. .form-row {
  765. display: flex;
  766. flex-wrap: wrap;
  767. margin-bottom: px2rpx(12);
  768. gap: px2rpx(12);
  769. &:last-child {
  770. margin-bottom: 0;
  771. }
  772. .form-col {
  773. flex: 1;
  774. min-width: px2rpx(140);
  775. @media screen and (max-width: 991px) {
  776. flex: 0 0 100%;
  777. width: 100%;
  778. }
  779. }
  780. .amount-box {
  781. display: flex;
  782. align-items: center;
  783. gap: px2rpx(12);
  784. .amount-input {
  785. flex: 1;
  786. }
  787. .btn {
  788. display: flex;
  789. align-items: center;
  790. justify-content: center;
  791. font-size: px2rpx(14);
  792. color: var(--color-zinc-600);
  793. margin-bottom: px2rpx(20);
  794. height: px2rpx(35);
  795. background-color: #cf1322;
  796. color: var(--bs-emphasis-color);
  797. border-radius: px2rpx(4);
  798. font-weight: 600;
  799. display: flex;
  800. align-items: center;
  801. justify-content: center;
  802. border: none;
  803. padding: 0 px2rpx(20);
  804. cursor: pointer;
  805. margin-top: px2rpx(34);
  806. }
  807. }
  808. .form-col-full {
  809. width: 100%;
  810. padding: 0 px2rpx(5);
  811. }
  812. }
  813. .tips {
  814. line-height: 1.8;
  815. font-size: px2rpx(12);
  816. color: var(--bs-heading-color);
  817. background-color: rgba(var(--bs-body-bg-rgb), 1) !important;
  818. padding: px2rpx(12);
  819. border-radius: px2rpx(4);
  820. border-left: px2rpx(2) solid #cf1322;
  821. .title {
  822. font-weight: 600;
  823. margin-bottom: px2rpx(6);
  824. color: var(--bs-heading-color);
  825. }
  826. }
  827. }
  828. }
  829. .picker-select {
  830. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  831. border: 1px solid #dcdfe6;
  832. border-radius: px2rpx(4);
  833. padding: px2rpx(12) px2rpx(14);
  834. font-size: px2rpx(14);
  835. color: #606266;
  836. line-height: 1.4;
  837. width: 100%;
  838. box-sizing: border-box;
  839. &:hover {
  840. border-color: #409eff;
  841. }
  842. &.picker-disabled {
  843. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  844. color: #c0c4cc;
  845. cursor: not-allowed;
  846. }
  847. }
  848. .disabled-input {
  849. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  850. border: 1px solid #dcdfe6;
  851. border-radius: px2rpx(4);
  852. padding: px2rpx(12) px2rpx(14);
  853. font-size: px2rpx(14);
  854. color: #606266;
  855. width: 100%;
  856. box-sizing: border-box;
  857. }
  858. .m-input {
  859. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  860. border: 1px solid #dcdfe6;
  861. border-radius: px2rpx(4);
  862. padding: px2rpx(12) px2rpx(14);
  863. font-size: px2rpx(14);
  864. width: 100%;
  865. box-sizing: border-box;
  866. &:focus {
  867. border-color: #409eff;
  868. outline: none;
  869. box-shadow: 0 0 0 px2rpx(1) rgba(64, 158, 255, 0.2);
  870. }
  871. }
  872. }
  873. // 动画
  874. @keyframes popupFadeIn {
  875. from {
  876. opacity: 0;
  877. transform: scale(0.9);
  878. }
  879. to {
  880. opacity: 1;
  881. transform: scale(1);
  882. }
  883. }
  884. @keyframes fadeIn {
  885. from {
  886. opacity: 0;
  887. transform: translateY(px2rpx(10));
  888. }
  889. to {
  890. opacity: 1;
  891. transform: translateY(0);
  892. }
  893. }
  894. @keyframes pulse {
  895. 0% {
  896. transform: scale(1);
  897. }
  898. 50% {
  899. transform: scale(1.05);
  900. }
  901. 100% {
  902. transform: scale(1);
  903. }
  904. }
  905. @keyframes spin {
  906. from {
  907. transform: rotate(0deg);
  908. }
  909. to {
  910. transform: rotate(360deg);
  911. }
  912. }
  913. // 表单错误信息样式
  914. .uni-forms-item__error {
  915. font-size: px2rpx(12);
  916. color: #f56c6c;
  917. margin-top: px2rpx(4);
  918. }
  919. // 适配不同屏幕尺寸(媒体查询中的 750rpx 保持不变)
  920. @media (max-width: 750rpx) {
  921. .transfer-page {
  922. .main-content {
  923. padding: px2rpx(8);
  924. .box {
  925. .b-card {
  926. .card-top {
  927. padding: px2rpx(12) px2rpx(16);
  928. .tit {
  929. font-size: px2rpx(14);
  930. .iconfont {
  931. font-size: px2rpx(16);
  932. }
  933. }
  934. }
  935. }
  936. }
  937. }
  938. .s-btn {
  939. font-size: px2rpx(14);
  940. padding: px2rpx(10) px2rpx(16);
  941. }
  942. }
  943. }
  944. </style>