transfer.vue 37 KB

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