transfer.vue 34 KB

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