transfer.vue 37 KB

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