transfer.vue 37 KB

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