transfer.vue 34 KB

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