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. :
  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 } = 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 = {
  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. const onAgree5Change = (e) => {
  327. form.agree5 = e.detail.value.length > 0
  328. }
  329. const onAgree6Change = (e) => {
  330. form.agree6 = e.detail.value.length > 0
  331. }
  332. const balanceInt = computed(() => {
  333. return numberFormat(balance.value || 0, true)[0]
  334. })
  335. const balanceDecimal = computed(() => {
  336. return numberFormat(balance.value || 0, true)[1] || '00'
  337. })
  338. const balance = ref(0)
  339. //获取基础信息
  340. const getDateList = async () => {
  341. let res = await ibApi.IbData({});
  342. if (res.code == Code.StatusOK) {
  343. if (res.data != null) {
  344. balance.value = res.data.balance
  345. }
  346. } else {
  347. uni.showToast({ title: res.msg, icon: 'none' })
  348. }
  349. }
  350. const setAllAmount = () => {
  351. form.amount = balance.value
  352. validateAmount()
  353. }
  354. function validateAmount() {
  355. const amount = Number(form.amount)
  356. if (!amount) {
  357. amountErrorMessage.value = t('vaildate.amount.format')
  358. return false
  359. }
  360. const numValue = parseFloat(amount)
  361. if (isNaN(numValue)) {
  362. amountErrorMessage.value = t('vaildate.amount.format')
  363. return false
  364. }
  365. if (amountLimits.minAmount && numValue < parseFloat(amountLimits.minAmount)) {
  366. amountErrorMessage.value = t('vaildate.amount.amount') + amountLimits.minAmount + '-' + amountLimits.maxAmount
  367. return false
  368. }
  369. if (amountLimits.maxAmount && numValue > parseFloat(amountLimits.maxAmount)) {
  370. amountErrorMessage.value = t('vaildate.amount.amount') + amountLimits.minAmount + '-' + amountLimits.maxAmount
  371. return false
  372. }
  373. if (!/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(amount)) {
  374. amountErrorMessage.value = t('vaildate.amount.format')
  375. return false
  376. }
  377. if (amount > balance.value) {
  378. amountErrorMessage.value = t('Label.LoginBalance') + ':$' + balance.value
  379. return false
  380. }
  381. amountErrorMessage.value = ''
  382. return true
  383. }
  384. // 模板引用
  385. const formRef = ref(null)
  386. // 计算属性
  387. const getInfoStatus5 = computed(() => {
  388. if (ibInfo.value?.closeFunctions) {
  389. return ibInfo.value.closeFunctions.indexOf('5') !== -1
  390. }
  391. return false
  392. })
  393. // 单位类型
  394. function groupCurrency(type) {
  395. const map = { GBP: ': £', USD: ': $', EUR: ': €', USC: ': ¢' }
  396. return map[type] || ': $'
  397. }
  398. // 单位类型
  399. function groupCurrency1(type) {
  400. const map = { GBP: '£', USD: '$', EUR: '€', USC: '¢' }
  401. return map[type] || '$'
  402. }
  403. // 账户类型
  404. function groupTypeName(type) {
  405. const typeMap = {
  406. '1': t('AccountType.ClassicAccount'),
  407. '2': t('AccountType.SeniorAccount'),
  408. '3': isAfterJuly28() ? '--' : t('AccountType.AgencyAccount'),
  409. '5': t('AccountType.SpeedAccount'),
  410. '6': t('AccountType.SpeedAccount'),
  411. '7': t('AccountType.StandardAccount'),
  412. '8': t('AccountType.CentAccount')
  413. }
  414. return typeMap[type] || ''
  415. }
  416. // 转入账户列表
  417. const depositDisplayList = computed(() => {
  418. if (activeTab.value != 3) {
  419. return toInfo.value.map(item => ({
  420. text: `${item.login} - ${groupTypeName(item.type)} - ${t('Custom.Deposit.AvailableBalance')}${groupCurrency(item.currency)}${item.balance}`,
  421. value: item.login,
  422. disable: item.status
  423. }))
  424. } else {
  425. return agentInfo.value.map(item => ({
  426. text: `${item.ibNo} - ${item.name}`,
  427. value: item.id
  428. }))
  429. }
  430. })
  431. const fromInfo = ref('')
  432. const toInfo = ref([])
  433. const agentInfo = ref([])
  434. const loading = ref(false)
  435. //转出账户信息
  436. const ransferInfo = async function () {
  437. loading.value = true
  438. let res = await ibApi.agentBalanceTransferFrom({});
  439. if (res.code == Code.StatusOK) {
  440. fromInfo.value =
  441. res.data.ibNo +
  442. " - " +
  443. t("Custom.Deposit.AvailableBalance") +
  444. ": $" +
  445. (res.data.balance ? res.data.balance : 0);
  446. } else {
  447. uni.showToast({ title: res.msg, icon: 'none' })
  448. }
  449. loading.value = false
  450. }
  451. //转入账户信息
  452. const ransferToInfo = async function () {
  453. let res;
  454. // 佣金内转使用新接口 /account/dropdown
  455. if (activeTab.value == 1) {
  456. res = await ibApi.CustomDropdown({ platform: "" });
  457. } else {
  458. // 佣金下发和其他情况使用原接口
  459. res = await ibApi.agentTransferToList({});
  460. }
  461. if (res.code == Code.StatusOK) {
  462. toInfo.value = res.data || [];
  463. toInfo.value.forEach((item) => {
  464. if (item.closeFunctions && item.closeFunctions.length > 0) {
  465. const targetValues = ["7", "5", "9"];
  466. const hasTargetValue = item.closeFunctions.some(func => targetValues.includes(func));
  467. if (hasTargetValue) {
  468. item.status = true;
  469. }
  470. }
  471. })
  472. } else {
  473. uni.showToast({ title: res.msg, icon: 'none' })
  474. }
  475. }
  476. //获取代理账户信息
  477. const getAgentInfo = async function () {
  478. let res = await ibApi.ibTreeForTransfer({});
  479. if (res.code == Code.StatusOK) {
  480. agentInfo.value = res.data || [];
  481. } else {
  482. uni.showToast({ title: res.msg, icon: 'none' })
  483. }
  484. }
  485. const currencyOptions = ref([{ value: 'USD', text: 'USD' }])
  486. function toHome() {
  487. uni.navigateTo({ url: '/pages/ib/index' })
  488. InfoStatus5.value = false
  489. }
  490. function closeDia() {
  491. resetForm()
  492. formRef.value?.resetFields?.()
  493. step2.value = false
  494. loginValue.value = ''
  495. dialogCheck.value = false
  496. dialogVisible.value = false
  497. tableData4TwoFlag.value = false
  498. tableDataNewListFlag.value = false
  499. }
  500. // 内转
  501. async function toTransfer() {
  502. if (submitting.value) return
  503. try {
  504. const valid = await formRef.value?.validate()
  505. if (!valid) {
  506. console.log('表单验证失败')
  507. return
  508. }
  509. openDontActive()
  510. } catch (error) {
  511. console.error('验证失败:', error)
  512. }
  513. }
  514. const showCentAccountTransferTip = (login) => {
  515. const list = activeTab.value != 3 ? toInfo.value : agentInfo.value
  516. const selectedAccount = list.find(
  517. (item) => item.login == login,
  518. );
  519. if (!selectedAccount) {
  520. return;
  521. }
  522. const isCentAccount =
  523. selectedAccount.type == "8" || selectedAccount.currency === "USC";
  524. if (isCentAccount) {
  525. confirm({
  526. title: t("Msg.SystemPrompt"),
  527. content: t("vu.item14") + t("vu.item15") + t("vu.item16"),
  528. confirmText: t("Btn.Confirm"),
  529. cancelText: t("Btn.Cancel"),
  530. })
  531. }
  532. }
  533. // 打开不参加活动弹窗
  534. function openDontActive() {
  535. tosubmitConfirm()
  536. }
  537. function tosubmitConfirm() {
  538. dialogDontActive.value = false
  539. transferConfig()
  540. }
  541. async function transferConfig() {
  542. if (submitting.value) return
  543. submitting.value = true
  544. try {
  545. if (flag.value) {
  546. return
  547. }
  548. flag.value = true
  549. form.activityTwoPercentGive = form.agree5 ? 1 : 0
  550. form.activityGive = form.agree6 ? 1 : 0
  551. dialogCheckWait.value = true
  552. let api
  553. if (activeTab.value != 3) {
  554. api = ibApi.agentBalanceTransfer
  555. } else {
  556. api = ibApi.agentBalanceCommissionAdd
  557. }
  558. const res = await api({ ...form })
  559. dialogCheckWait.value = false
  560. if (res.code == Code.StatusOK) {
  561. dialogCheck.value = true
  562. dialogVisible.value = true
  563. flag.value = false
  564. } else {
  565. RES.value = res.msg
  566. dialogCheck.value = true
  567. dialogVisible.value = false
  568. flag.value = false
  569. }
  570. } catch (error) {
  571. console.error('转账失败:', error)
  572. RES.value = error.msg || t('Msg.Fail')
  573. dialogCheck.value = true
  574. dialogVisible.value = false
  575. } finally {
  576. submitting.value = false
  577. flag.value = false
  578. resetForm()
  579. if (dialogCheckWait.value) dialogCheckWait.value = false
  580. getDateList()
  581. uni.$emit('updatePayment')
  582. }
  583. }
  584. async function Activity24nianzhongTwoInfo() {
  585. const res = await activityApi.Activity23nianzhongTwoInfo({})
  586. if (res.code == Code.StatusOK) {
  587. tableData4Two.value = res.data
  588. } else {
  589. uni.showToast({ title: res.msg, icon: 'none' })
  590. }
  591. }
  592. // 活动相关方法
  593. function togetActivity() {
  594. get23nianzhongTwoLogin()
  595. getActivityExtensionGiveLogin()
  596. getActivityExtensionGiveLoginJoin()
  597. }
  598. async function get23nianzhongTwoLogin() {
  599. const res = await activityApi.Activity23nianzhongTwoLogin({
  600. login: form.to,
  601. })
  602. if (res.code == Code.StatusOK) {
  603. tableData4Two.value = res.data
  604. if (tableData4Two.value.show == 1) {
  605. tableData4TwoFlag.value = true
  606. } else if (tableData4Two.value.show == 0) {
  607. tableData4TwoFlag.value = false
  608. }
  609. } else {
  610. uni.showToast({ title: res.msg, icon: 'none' })
  611. }
  612. }
  613. async function getActivityExtensionGiveLogin() {
  614. const res = await activityApi.ActivityExtensionGiveLogin({
  615. login: form.to,
  616. })
  617. if (res.code == Code.StatusOK) {
  618. tableDataNewList.value = res.data
  619. if (tableDataNewList.value.show == 1) {
  620. tableDataNewListFlag.value = true
  621. } else if (tableDataNewList.value.show == 0) {
  622. tableDataNewListFlag.value = false
  623. }
  624. } else {
  625. uni.showToast({ title: res.msg, icon: 'none' })
  626. }
  627. }
  628. async function getActivityExtensionGiveLoginJoin() {
  629. const res = await activityApi.ActivityExtensionGiveLoginJoin({
  630. login: form.to,
  631. })
  632. if (res.code == Code.StatusOK) {
  633. giveLoginJoin.value = res.data
  634. } else {
  635. uni.showToast({ title: res.msg, icon: 'none' })
  636. giveLoginJoin.value = ''
  637. }
  638. }
  639. // 监听 activeTab 变化
  640. watch(activeTab, (newVal) => {
  641. if (newVal) {
  642. console.log(newVal, 1212);
  643. if (newVal == 3) {
  644. getAgentInfo()
  645. } else {
  646. ransferToInfo()
  647. }
  648. resetForm()
  649. }
  650. })
  651. //
  652. watch(loginValue, (newVal) => {
  653. if (newVal) {
  654. step2.value = true
  655. form.withdrawLogin = newVal
  656. }
  657. })
  658. watch(() => form.to, (newVal) => {
  659. if (activeTab.value == 3) {
  660. getAgentInfo()
  661. } else {
  662. togetActivity()
  663. }
  664. })
  665. // 监听 agree6 变化
  666. watch(
  667. () => form.agree6,
  668. async (newVal) => {
  669. if (newVal && giveLoginJoin.value?.flag === false) {
  670. let tips = "";
  671. if (giveLoginJoin.value.promptType == 1) {
  672. tips = t("surplusList.item10");
  673. } else {
  674. tips = t("surplusList.item11");
  675. }
  676. // 根据 activityCategory 显示不同的操作按钮
  677. if (giveLoginJoin.value.activityCategory == 1) {
  678. try {
  679. // 第一次弹窗:取消活动
  680. await confirm({
  681. title: t("Msg.SystemPrompt"),
  682. content: tips,
  683. confirmText: t("surplusList.item12"),
  684. cancelText: t("Home.msg.item3"),
  685. });
  686. await new Promise((resolve) => {
  687. setTimeout(() => {
  688. resolve(true);
  689. }, 300);
  690. });
  691. await confirm({
  692. title: t("Msg.SystemPrompt"),
  693. content: t("surplusList.item13"),
  694. confirmText: t("Btn.Confirm"),
  695. cancelText: t("Btn.Cancel"),
  696. });
  697. // 调用取消接口
  698. const res = await activityApi.ActivityGiveCancel({
  699. login: loginValue.value,
  700. });
  701. if (res.code == Code.StatusOK) {
  702. MessageOK(res.msg || t("Msg.Success"));
  703. } else {
  704. MessageError(res.msg);
  705. }
  706. } catch (error) {
  707. // 任意一步取消 → 取消勾选
  708. form.agree6 = false;
  709. }
  710. } else if (giveLoginJoin.value.activityCategory == 2) {
  711. try {
  712. // 第一次弹窗:跳转
  713. await confirm({
  714. title: t("Msg.SystemPrompt"),
  715. content: tips,
  716. confirmText: "跳转",
  717. cancelText: t("Btn.Cancel"),
  718. showCancelButton: false,
  719. });
  720. await new Promise((resolve) => {
  721. setTimeout(() => {
  722. resolve(true);
  723. }, 300);
  724. });
  725. await confirm({
  726. title: t("Msg.SystemPrompt"),
  727. content: "是否跳转到对应活动取消",
  728. confirmText: t("Btn.Confirm"),
  729. cancelText: t("Btn.Cancel"),
  730. });
  731. // 跳转到月盈活动
  732. uni.navigateTo({
  733. path: "/pages/activity/monthly-list",
  734. });
  735. } catch (error) {
  736. // 取消 → 取消勾选
  737. form.agree6 = false;
  738. }
  739. } else {
  740. // 默认情况
  741. try {
  742. await confirm({
  743. title: t("Msg.SystemPrompt"),
  744. content: tips,
  745. confirmText: t("Btn.Confirm"),
  746. cancelText: t("Btn.Cancel"),
  747. });
  748. } catch (error) {
  749. form.agree6 = false;
  750. }
  751. }
  752. }
  753. }
  754. );
  755. onMounted(() => {
  756. if (getInfoStatus5.value) {
  757. InfoStatus5.value = true
  758. }
  759. getDateList()
  760. ransferInfo();
  761. ransferToInfo();
  762. // Activity24nianzhongTwoInfo()
  763. })
  764. onLoad((options) => {
  765. if (options?.login) {
  766. loginValue.value = options.login
  767. step2.value = true
  768. form.withdrawLogin = options.login
  769. }
  770. if (options?.tab) {
  771. activeTab.value = options?.tab
  772. }
  773. })
  774. </script>
  775. <style lang="scss" scoped>
  776. @import "@/uni.scss";
  777. .bg-dark1 {
  778. background-color: var(--table-th-color) !important;
  779. }
  780. .amount-box {
  781. display: flex;
  782. align-items: center;
  783. gap: px2rpx(12);
  784. .amount-input {
  785. flex: 1;
  786. }
  787. .btn {
  788. margin-bottom: px2rpx(20);
  789. }
  790. }
  791. .transfer-page {
  792. width: 100%;
  793. padding-bottom: px2rpx(20);
  794. .main-content {
  795. text-align: left;
  796. .box {
  797. padding-top: px2rpx(5);
  798. color: #303133;
  799. .b-card {
  800. border: 1px solid var(--bs-border-color);
  801. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  802. margin-bottom: px2rpx(10);
  803. border-radius: px2rpx(6);
  804. box-shadow: 0 px2rpx(1) px2rpx(6) 0 rgba(0, 0, 0, 0.05);
  805. &:hover {
  806. box-shadow: 0 px2rpx(2) px2rpx(8) 0 rgba(0, 0, 0, 0.1);
  807. }
  808. .card-top {
  809. padding: px2rpx(15) px2rpx(20);
  810. box-sizing: border-box;
  811. .card-row {
  812. margin-bottom: px2rpx(12);
  813. &:last-child {
  814. margin-bottom: 0;
  815. }
  816. }
  817. .tit {
  818. font-size: px2rpx(16);
  819. font-weight: 600;
  820. margin-bottom: px2rpx(16);
  821. display: flex;
  822. align-items: center;
  823. color: var(--bs-heading-color);
  824. position: relative;
  825. padding-left: 20px;
  826. &:after {
  827. content: '';
  828. position: absolute;
  829. left: 0;
  830. top: 50%;
  831. transform: translateY(-50%);
  832. width: 0;
  833. height: 0;
  834. border-top: 6px solid transparent;
  835. border-bottom: 6px solid transparent;
  836. border-left: 8px solid currentColor;
  837. }
  838. .iconfont {
  839. margin-right: px2rpx(8);
  840. color: var(--color-primary);
  841. font-size: px2rpx(18);
  842. }
  843. }
  844. .balance-kg {
  845. width: px2rpx(20);
  846. }
  847. .title-wrapper {
  848. display: flex;
  849. justify-content: space-between;
  850. align-items: center;
  851. }
  852. }
  853. }
  854. }
  855. .box-step2 {
  856. .form-row {
  857. display: flex;
  858. flex-wrap: wrap;
  859. margin-bottom: px2rpx(12);
  860. gap: px2rpx(12);
  861. &:last-child {
  862. margin-bottom: 0;
  863. }
  864. .form-col {
  865. flex: 1;
  866. min-width: px2rpx(140);
  867. @media screen and (max-width: 991px) {
  868. flex: 0 0 100%;
  869. width: 100%;
  870. }
  871. }
  872. .form-col-full {
  873. width: 100%;
  874. padding: 0 px2rpx(5);
  875. }
  876. }
  877. .tips {
  878. line-height: 1.8;
  879. font-size: px2rpx(12);
  880. color: var(--bs-heading-color);
  881. background-color: rgba(var(--bs-body-bg-rgb), 1) !important;
  882. padding: px2rpx(12);
  883. border-radius: px2rpx(4);
  884. border-left: px2rpx(2) solid #cf1322;
  885. .title {
  886. font-weight: 600;
  887. margin-bottom: px2rpx(6);
  888. color: var(--bs-heading-color);
  889. }
  890. }
  891. }
  892. }
  893. .picker-select {
  894. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  895. border: 1px solid #dcdfe6;
  896. border-radius: px2rpx(4);
  897. padding: px2rpx(12) px2rpx(14);
  898. font-size: px2rpx(14);
  899. color: #606266;
  900. line-height: 1.4;
  901. width: 100%;
  902. box-sizing: border-box;
  903. &:hover {
  904. border-color: #409eff;
  905. }
  906. &.picker-disabled {
  907. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  908. color: #c0c4cc;
  909. cursor: not-allowed;
  910. }
  911. }
  912. .disabled-input {
  913. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  914. border: 1px solid #dcdfe6;
  915. border-radius: px2rpx(4);
  916. padding: px2rpx(12) px2rpx(14);
  917. font-size: px2rpx(14);
  918. color: #606266;
  919. width: 100%;
  920. box-sizing: border-box;
  921. }
  922. .m-input {
  923. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  924. border: 1px solid #dcdfe6;
  925. border-radius: px2rpx(4);
  926. padding: px2rpx(12) px2rpx(14);
  927. font-size: px2rpx(14);
  928. width: 100%;
  929. box-sizing: border-box;
  930. &:focus {
  931. border-color: #409eff;
  932. outline: none;
  933. box-shadow: 0 0 0 px2rpx(1) rgba(64, 158, 255, 0.2);
  934. }
  935. }
  936. }
  937. // 动画
  938. @keyframes popupFadeIn {
  939. from {
  940. opacity: 0;
  941. transform: scale(0.9);
  942. }
  943. to {
  944. opacity: 1;
  945. transform: scale(1);
  946. }
  947. }
  948. @keyframes fadeIn {
  949. from {
  950. opacity: 0;
  951. transform: translateY(px2rpx(10));
  952. }
  953. to {
  954. opacity: 1;
  955. transform: translateY(0);
  956. }
  957. }
  958. @keyframes pulse {
  959. 0% {
  960. transform: scale(1);
  961. }
  962. 50% {
  963. transform: scale(1.05);
  964. }
  965. 100% {
  966. transform: scale(1);
  967. }
  968. }
  969. @keyframes spin {
  970. from {
  971. transform: rotate(0deg);
  972. }
  973. to {
  974. transform: rotate(360deg);
  975. }
  976. }
  977. // 表单错误信息样式
  978. .uni-forms-item__error {
  979. font-size: px2rpx(12);
  980. color: #f56c6c;
  981. margin-top: px2rpx(4);
  982. }
  983. // 适配不同屏幕尺寸(媒体查询中的 750rpx 保持不变)
  984. @media (max-width: 750rpx) {
  985. .transfer-page {
  986. .main-content {
  987. padding: px2rpx(8);
  988. .box {
  989. .b-card {
  990. .card-top {
  991. padding: px2rpx(12) px2rpx(16);
  992. .tit {
  993. font-size: px2rpx(14);
  994. .iconfont {
  995. font-size: px2rpx(16);
  996. }
  997. }
  998. }
  999. }
  1000. }
  1001. }
  1002. .s-btn {
  1003. font-size: px2rpx(14);
  1004. padding: px2rpx(10) px2rpx(16);
  1005. }
  1006. }
  1007. }
  1008. .pdlr-1{
  1009. padding: 0 px2rpx(10);
  1010. }
  1011. </style>