transfer.vue 39 KB

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