transfer.vue 38 KB

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