transfer.vue 39 KB

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