transfer.vue 37 KB

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