transfer.vue 38 KB

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