transfer.vue 39 KB

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