transfer.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  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">${{ balance }}</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')" @change="showCentAccountTransferTip"/>
  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-gray 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. const showCentAccountTransferTip = (login) => {
  495. const list = activeTab.value != 3 ? toInfo.value:agentInfo.value
  496. const selectedAccount = list.find(
  497. (item) => item.login == login,
  498. );
  499. if (!selectedAccount) {
  500. return;
  501. }
  502. const isCentAccount =
  503. selectedAccount.type == "8" || selectedAccount.currency === "USC";
  504. if (isCentAccount) {
  505. confirm({
  506. title: t("Msg.SystemPrompt"),
  507. content: t("vu.item14") + t("vu.item15") + t("vu.item16"),
  508. confirmText: t("Btn.Confirm"),
  509. cancelText: t("Btn.Cancel"),
  510. })
  511. }
  512. }
  513. // 打开不参加活动弹窗
  514. function openDontActive() {
  515. tosubmitConfirm()
  516. }
  517. function tosubmitConfirm() {
  518. dialogDontActive.value = false
  519. transferConfig()
  520. }
  521. async function transferConfig() {
  522. if (submitting.value) return
  523. submitting.value = true
  524. try {
  525. if (flag.value) {
  526. return
  527. }
  528. flag.value = true
  529. form.activityTwoPercentGive = form.agree5 ? 1 : 0
  530. form.activityGive = form.agree6 ? 1 : 0
  531. dialogCheckWait.value = true
  532. let api
  533. if (activeTab.value != 3) {
  534. api = ibApi.agentBalanceTransfer
  535. } else {
  536. api = ibApi.agentBalanceCommissionAdd
  537. }
  538. const res = await api({ ...form })
  539. dialogCheckWait.value = false
  540. if (res.code == Code.StatusOK) {
  541. dialogCheck.value = true
  542. dialogVisible.value = true
  543. flag.value = false
  544. } else {
  545. RES.value = res.msg
  546. dialogCheck.value = true
  547. dialogVisible.value = false
  548. flag.value = false
  549. }
  550. } catch (error) {
  551. console.error('转账失败:', error)
  552. RES.value = error.msg || t('Msg.Fail')
  553. dialogCheck.value = true
  554. dialogVisible.value = false
  555. } finally {
  556. submitting.value = false
  557. flag.value = false
  558. resetForm()
  559. if (dialogCheckWait.value) dialogCheckWait.value = false
  560. getDateList()
  561. uni.$emit('updatePayment')
  562. }
  563. }
  564. async function Activity24nianzhongTwoInfo() {
  565. const res = await activityApi.Activity23nianzhongTwoInfo({})
  566. if (res.code == Code.StatusOK) {
  567. tableData4Two.value = res.data
  568. } else {
  569. uni.showToast({ title: res.msg, icon: 'none' })
  570. }
  571. }
  572. // 活动相关方法
  573. function togetActivity() {
  574. get23nianzhongTwoLogin()
  575. getActivityExtensionGiveLogin()
  576. getActivityExtensionGiveLoginJoin()
  577. }
  578. async function get23nianzhongTwoLogin() {
  579. const res = await activityApi.Activity23nianzhongTwoLogin({
  580. login: form.to,
  581. })
  582. if (res.code == Code.StatusOK) {
  583. tableData4Two.value = res.data
  584. if (tableData4Two.value.show == 1) {
  585. tableData4TwoFlag.value = true
  586. } else if (tableData4Two.value.show == 0) {
  587. tableData4TwoFlag.value = false
  588. }
  589. } else {
  590. uni.showToast({ title: res.msg, icon: 'none' })
  591. }
  592. }
  593. async function getActivityExtensionGiveLogin() {
  594. const res = await activityApi.ActivityExtensionGiveLogin({
  595. login: form.to,
  596. })
  597. if (res.code == Code.StatusOK) {
  598. tableDataNewList.value = res.data
  599. if (tableDataNewList.value.show == 1) {
  600. tableDataNewListFlag.value = true
  601. } else if (tableDataNewList.value.show == 0) {
  602. tableDataNewListFlag.value = false
  603. }
  604. } else {
  605. uni.showToast({ title: res.msg, icon: 'none' })
  606. }
  607. }
  608. async function getActivityExtensionGiveLoginJoin() {
  609. const res = await activityApi.ActivityExtensionGiveLoginJoin({
  610. login: form.to,
  611. })
  612. if (res.code == Code.StatusOK) {
  613. giveLoginJoin.value = res.data
  614. } else {
  615. uni.showToast({ title: res.msg, icon: 'none' })
  616. giveLoginJoin.value = ''
  617. }
  618. }
  619. // 监听 activeTab 变化
  620. watch(activeTab, (newVal) => {
  621. if (newVal) {
  622. console.log(newVal, 1212);
  623. if (newVal == 3) {
  624. getAgentInfo()
  625. } else {
  626. ransferToInfo()
  627. }
  628. resetForm()
  629. }
  630. })
  631. //
  632. watch(loginValue, (newVal) => {
  633. if (newVal) {
  634. step2.value = true
  635. form.withdrawLogin = newVal
  636. }
  637. })
  638. watch(() => form.to, (newVal) => {
  639. if (activeTab.value == 3) {
  640. getAgentInfo()
  641. } else {
  642. togetActivity()
  643. }
  644. })
  645. // 监听 agree6 变化
  646. watch(
  647. () => form.agree6,
  648. async (newVal) => {
  649. if (newVal && giveLoginJoin.value?.flag === false) {
  650. let tips = "";
  651. if (giveLoginJoin.value.promptType == 1) {
  652. tips = t("surplusList.item10");
  653. } else {
  654. tips = t("surplusList.item11");
  655. }
  656. // 根据 activityCategory 显示不同的操作按钮
  657. if (giveLoginJoin.value.activityCategory == 1) {
  658. try {
  659. // 第一次弹窗:取消活动
  660. await confirm({
  661. title: t("Msg.SystemPrompt"),
  662. content: tips,
  663. confirmText: t("surplusList.item12"),
  664. cancelText: t("Home.msg.item3"),
  665. });
  666. await new Promise((resolve) => {
  667. setTimeout(() => {
  668. resolve(true);
  669. }, 300);
  670. });
  671. await confirm({
  672. title: t("Msg.SystemPrompt"),
  673. content: t("surplusList.item13"),
  674. confirmText: t("Btn.Confirm"),
  675. cancelText: t("Btn.Cancel"),
  676. });
  677. // 调用取消接口
  678. const res = await activityApi.ActivityGiveCancel({
  679. login: loginValue.value,
  680. });
  681. if (res.code == Code.StatusOK) {
  682. MessageOK(res.msg || t("Msg.Success"));
  683. } else {
  684. MessageError(res.msg);
  685. }
  686. } catch (error) {
  687. // 任意一步取消 → 取消勾选
  688. form.agree6 = false;
  689. }
  690. } else if (giveLoginJoin.value.activityCategory == 2) {
  691. try {
  692. // 第一次弹窗:跳转
  693. await confirm({
  694. title: t("Msg.SystemPrompt"),
  695. content: tips,
  696. confirmText: "跳转",
  697. cancelText: t("Btn.Cancel"),
  698. showCancelButton: false,
  699. });
  700. await new Promise((resolve) => {
  701. setTimeout(() => {
  702. resolve(true);
  703. }, 300);
  704. });
  705. await confirm({
  706. title: t("Msg.SystemPrompt"),
  707. content: "是否跳转到对应活动取消",
  708. confirmText: t("Btn.Confirm"),
  709. cancelText: t("Btn.Cancel"),
  710. });
  711. // 跳转到月盈活动
  712. uni.navigateTo({
  713. path: "/pages/activity/monthly-list",
  714. });
  715. } catch (error) {
  716. // 取消 → 取消勾选
  717. form.agree6 = false;
  718. }
  719. } else {
  720. // 默认情况
  721. try {
  722. await confirm({
  723. title: t("Msg.SystemPrompt"),
  724. content: tips,
  725. confirmText: t("Btn.Confirm"),
  726. cancelText: t("Btn.Cancel"),
  727. });
  728. } catch (error) {
  729. form.agree6 = false;
  730. }
  731. }
  732. }
  733. }
  734. );
  735. onMounted(() => {
  736. if (getInfoStatus5.value) {
  737. InfoStatus5.value = true
  738. }
  739. getDateList()
  740. ransferInfo();
  741. ransferToInfo();
  742. // Activity24nianzhongTwoInfo()
  743. })
  744. onLoad((options) => {
  745. if (options?.login) {
  746. loginValue.value = options.login
  747. step2.value = true
  748. form.withdrawLogin = options.login
  749. }
  750. if (options?.tab) {
  751. activeTab.value = options?.tab
  752. }
  753. })
  754. </script>
  755. <style lang="scss" scoped>
  756. @import "@/uni.scss";
  757. .bg-dark1 {
  758. background-color: var(--table-th-color) !important;
  759. }
  760. .amount-box {
  761. display: flex;
  762. align-items: center;
  763. gap: px2rpx(12);
  764. .amount-input {
  765. flex: 1;
  766. }
  767. .btn {
  768. margin-bottom: px2rpx(20);
  769. }
  770. }
  771. .transfer-page {
  772. width: 100%;
  773. padding-bottom: px2rpx(20);
  774. .main-content {
  775. text-align: left;
  776. .box {
  777. padding-top: px2rpx(5);
  778. color: #303133;
  779. .b-card {
  780. border: 1px solid var(--bs-border-color);
  781. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  782. margin-bottom: px2rpx(10);
  783. border-radius: px2rpx(6);
  784. box-shadow: 0 px2rpx(1) px2rpx(6) 0 rgba(0, 0, 0, 0.05);
  785. &:hover {
  786. box-shadow: 0 px2rpx(2) px2rpx(8) 0 rgba(0, 0, 0, 0.1);
  787. }
  788. .card-top {
  789. padding: px2rpx(15) px2rpx(20);
  790. box-sizing: border-box;
  791. .card-row {
  792. margin-bottom: px2rpx(12);
  793. &:last-child {
  794. margin-bottom: 0;
  795. }
  796. }
  797. .tit {
  798. font-size: px2rpx(16);
  799. font-weight: 600;
  800. margin-bottom: px2rpx(16);
  801. display: flex;
  802. align-items: center;
  803. color: var(--bs-heading-color);
  804. position: relative;
  805. padding-left: 20px;
  806. &:after {
  807. content: '';
  808. position: absolute;
  809. left: 0;
  810. top: 50%;
  811. transform: translateY(-50%);
  812. width: 0;
  813. height: 0;
  814. border-top: 6px solid transparent;
  815. border-bottom: 6px solid transparent;
  816. border-left: 8px solid currentColor;
  817. }
  818. .iconfont {
  819. margin-right: px2rpx(8);
  820. color: var(--color-primary);
  821. font-size: px2rpx(18);
  822. }
  823. }
  824. .balance-kg {
  825. width: px2rpx(20);
  826. }
  827. .title-wrapper {
  828. display: flex;
  829. justify-content: space-between;
  830. align-items: center;
  831. }
  832. }
  833. }
  834. }
  835. .box-step2 {
  836. .form-row {
  837. display: flex;
  838. flex-wrap: wrap;
  839. margin-bottom: px2rpx(12);
  840. gap: px2rpx(12);
  841. &:last-child {
  842. margin-bottom: 0;
  843. }
  844. .form-col {
  845. flex: 1;
  846. min-width: px2rpx(140);
  847. @media screen and (max-width: 991px) {
  848. flex: 0 0 100%;
  849. width: 100%;
  850. }
  851. }
  852. .form-col-full {
  853. width: 100%;
  854. padding: 0 px2rpx(5);
  855. }
  856. }
  857. .tips {
  858. line-height: 1.8;
  859. font-size: px2rpx(12);
  860. color: var(--bs-heading-color);
  861. background-color: rgba(var(--bs-body-bg-rgb), 1) !important;
  862. padding: px2rpx(12);
  863. border-radius: px2rpx(4);
  864. border-left: px2rpx(2) solid #cf1322;
  865. .title {
  866. font-weight: 600;
  867. margin-bottom: px2rpx(6);
  868. color: var(--bs-heading-color);
  869. }
  870. }
  871. }
  872. }
  873. .picker-select {
  874. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  875. border: 1px solid #dcdfe6;
  876. border-radius: px2rpx(4);
  877. padding: px2rpx(12) px2rpx(14);
  878. font-size: px2rpx(14);
  879. color: #606266;
  880. line-height: 1.4;
  881. width: 100%;
  882. box-sizing: border-box;
  883. &:hover {
  884. border-color: #409eff;
  885. }
  886. &.picker-disabled {
  887. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  888. color: #c0c4cc;
  889. cursor: not-allowed;
  890. }
  891. }
  892. .disabled-input {
  893. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  894. border: 1px solid #dcdfe6;
  895. border-radius: px2rpx(4);
  896. padding: px2rpx(12) px2rpx(14);
  897. font-size: px2rpx(14);
  898. color: #606266;
  899. width: 100%;
  900. box-sizing: border-box;
  901. }
  902. .m-input {
  903. background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
  904. border: 1px solid #dcdfe6;
  905. border-radius: px2rpx(4);
  906. padding: px2rpx(12) px2rpx(14);
  907. font-size: px2rpx(14);
  908. width: 100%;
  909. box-sizing: border-box;
  910. &:focus {
  911. border-color: #409eff;
  912. outline: none;
  913. box-shadow: 0 0 0 px2rpx(1) rgba(64, 158, 255, 0.2);
  914. }
  915. }
  916. }
  917. // 动画
  918. @keyframes popupFadeIn {
  919. from {
  920. opacity: 0;
  921. transform: scale(0.9);
  922. }
  923. to {
  924. opacity: 1;
  925. transform: scale(1);
  926. }
  927. }
  928. @keyframes fadeIn {
  929. from {
  930. opacity: 0;
  931. transform: translateY(px2rpx(10));
  932. }
  933. to {
  934. opacity: 1;
  935. transform: translateY(0);
  936. }
  937. }
  938. @keyframes pulse {
  939. 0% {
  940. transform: scale(1);
  941. }
  942. 50% {
  943. transform: scale(1.05);
  944. }
  945. 100% {
  946. transform: scale(1);
  947. }
  948. }
  949. @keyframes spin {
  950. from {
  951. transform: rotate(0deg);
  952. }
  953. to {
  954. transform: rotate(360deg);
  955. }
  956. }
  957. // 表单错误信息样式
  958. .uni-forms-item__error {
  959. font-size: px2rpx(12);
  960. color: #f56c6c;
  961. margin-top: px2rpx(4);
  962. }
  963. // 适配不同屏幕尺寸(媒体查询中的 750rpx 保持不变)
  964. @media (max-width: 750rpx) {
  965. .transfer-page {
  966. .main-content {
  967. padding: px2rpx(8);
  968. .box {
  969. .b-card {
  970. .card-top {
  971. padding: px2rpx(12) px2rpx(16);
  972. .tit {
  973. font-size: px2rpx(14);
  974. .iconfont {
  975. font-size: px2rpx(16);
  976. }
  977. }
  978. }
  979. }
  980. }
  981. }
  982. .s-btn {
  983. font-size: px2rpx(14);
  984. padding: px2rpx(10) px2rpx(16);
  985. }
  986. }
  987. }
  988. </style>