user.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. <template>
  2. <div class="page flex-col">
  3. <s-header :name="sys ? sys.title : $t('user.personalCenter')" :noback="true" :isFixed="false"></s-header>
  4. <div class="userPageBox">
  5. <div class="userBaseBox">
  6. <div class="baseRow flex-row justify-between">
  7. <div class="group2 flex-col"></div>
  8. <span class="baseText">{{ $t("user.essentialInformation") }}</span>
  9. </div>
  10. <div class="userMessage flex-row justify-between">
  11. <div class="userId">
  12. <p class="userText">{{ accountDetail.managerId }}</p>
  13. <p class="userText">{{ $t("user.systemId") }}</p>
  14. </div>
  15. <div class="userLine"></div>
  16. <div class="userId">
  17. <p class="userText">{{ accountDetail.username }}</p>
  18. <p class="userText">{{ $t("user.myAccount") }}</p>
  19. </div>
  20. <div class="userLine"></div>
  21. <div class="userId">
  22. <p class="userText">{{ accountDetail.name }}</p>
  23. <p class="userText">{{ $t("user.myName") }}</p>
  24. </div>
  25. </div>
  26. <div class="userInfoBox">
  27. <!-- 地区 -->
  28. <div v-if="isInland">
  29. <div v-if="!areaShow" class="userInfo l-flex-between">
  30. <span class="userInfoLeft">{{ $t("user.region") }}: </span>
  31. <div class="cust_vantBorder">
  32. <div class="filedInpPad">
  33. <van-field @click-input="fieldValueInpClk" readonly clearable v-model="fieldValue"
  34. :placeholder="$t('user.regionPlace')">
  35. <template #right-icon>
  36. <div class="l-flex-RC">
  37. <van-icon v-if="fieldValue" @click="
  38. fieldValue = '';
  39. accountDetail.areaId = '';
  40. " class="o-mr-6" name="clear" />
  41. <van-icon @click="fieldValueInpClk" name="arrow-down" />
  42. </div>
  43. </template>
  44. </van-field>
  45. </div>
  46. </div>
  47. <van-icon name="edit" class="editIcon" @click="editClk(4)" />
  48. </div>
  49. <div v-else class="userInfo l-flex-between">
  50. <span class="userInfoLeft">{{ $t("user.region") }}: </span>
  51. <span>{{ fieldValue }}</span>
  52. <van-icon name="edit" class="editIcon" @click="editClk(4)" />
  53. </div>
  54. </div>
  55. <!-- 手机号 -->
  56. <div v-if="!phoneNumberShow" class="userInfo l-flex-between">
  57. <span class="userInfoLeft">{{ $t("user.phoneNumber") }}: </span>
  58. <div class="cust_vantBorder">
  59. <van-field class="relationClass" v-model="cofficentForm.phone" :placeholder="$t('user.phoneNumberPlace')">
  60. <template #button>
  61. <van-button type="primary" @click="mailboxChg(cofficentForm.phone, 3)">{{ $t("user.confirmLog") }}
  62. </van-button>
  63. </template>
  64. </van-field>
  65. </div>
  66. <van-icon name="edit" class="editIcon" @click="editClk(3)" />
  67. </div>
  68. <div v-else class="userInfo l-flex-between">
  69. <span class="userInfoLeft">{{ $t("user.phoneNumber") }}: </span>
  70. <span>{{ accountDetail.phone }}</span>
  71. <van-icon name="edit" class="editIcon" @click="editClk(3)" />
  72. </div>
  73. <!-- 邮箱 -->
  74. <div v-if="!mailboxShow" class="userInfo l-flex-between">
  75. <span class="userInfoLeft">{{ $t("user.mailbox") }}: </span>
  76. <div class="cust_vantBorder">
  77. <van-field class="relationClass" v-model="cofficentForm.mailBox" :placeholder="$t('user.mailboxPlace')">
  78. <template #button>
  79. <van-button type="primary" @click="mailboxChg(cofficentForm.mailBox, 2)">{{ $t("user.confirmLog") }}
  80. </van-button>
  81. </template>
  82. </van-field>
  83. </div>
  84. <van-icon name="edit" class="editIcon" @click="editClk(2)" />
  85. </div>
  86. <div v-else class="userInfo l-flex-between">
  87. <span class="userInfoLeft">{{ $t("user.mailbox") }}: </span>
  88. <span>{{ accountDetail.email }}</span>
  89. <van-icon name="edit" class="editIcon" @click="editClk(2)" />
  90. </div>
  91. <!-- 关联上级 -->
  92. <div v-if="isInland">
  93. <div v-if="!relationType" class="userInfo l-flex-between">
  94. <span class="userInfoLeft">{{ $t("user.associateParent") }}: </span>
  95. <div class="cust_vantBorder">
  96. <van-field class="relationClass" v-model="cofficentForm.associateParent"
  97. :placeholder="$t('user.associateParentPlace')">
  98. <template #button>
  99. <van-button type="primary" @click="mailboxChg(cofficentForm.associateParent, 1)">{{
  100. $t("user.confirmLog") }}
  101. </van-button>
  102. </template>
  103. </van-field>
  104. </div>
  105. <van-icon name="edit" class="editIcon" @click="editClk(1)" />
  106. </div>
  107. <div v-else class="userInfo l-flex-between">
  108. <span class="userInfoLeft">{{ $t("user.associateParent") }}: </span>
  109. <span>{{ relationAdminName }}</span>
  110. <van-icon name="edit" class="editIcon" @click="editClk(1)" />
  111. </div>
  112. </div>
  113. <!-- 自定义货币符号 -->
  114. <div v-if="!symbolShow" class="userInfo l-flex-between">
  115. <span class="userInfoLeft">{{ $t("user.currencySymbol") }}: </span>
  116. <div class="cust_vantBorder">
  117. <van-field class="relationClass" v-model="cofficentForm.currencySymbol"
  118. :placeholder="$t('user.currencySymbolPlace')">
  119. <template #button>
  120. <van-button type="primary" @click="mailboxChg(cofficentForm.currencySymbol, 5)">{{
  121. $t("user.confirmLog") }}
  122. </van-button>
  123. </template>
  124. </van-field>
  125. </div>
  126. <van-icon name="edit" class="editIcon" @click="editClk(5)" />
  127. </div>
  128. <div v-else class="userInfo l-flex-between">
  129. <span class="userInfoLeft">{{ $t("user.currencySymbol") }}: </span>
  130. <span>{{ accountDetail.currencySymbol }}</span>
  131. <van-icon name="edit" class="editIcon" @click="editClk(5)" />
  132. </div>
  133. <!-- 切换支付平台 -->
  134. <div v-if="chaSzPayShow" class="userInfo l-flex-between">
  135. <span class="userInfoLeft">{{ $t("user.szPayType") }}: </span>
  136. <div class="cust_vantBorder o-pl-15">
  137. <van-switch :model-value="sunzeePay" active-color="#0090fa" inactive-color="#30c25c" size="21px"
  138. @update:model-value="changeSunzeePay" />
  139. </div>
  140. <span class="o-pl-50">{{ $t("user.currentChoose") }}: {{ sunzeePay ? "汇付" : "汇聚" }}</span>
  141. </div>
  142. <div v-if="chaScPayShow" class="userInfo l-flex-between">
  143. <span class="userInfoLeft">{{ $t("user.scPayType") }}: </span>
  144. <div class="cust_vantBorder o-pl-15">
  145. <van-switch :model-value="sevencloudPay" active-color="#0090fa" inactive-color="#30c25c" size="21px"
  146. @update:model-value="changeSevenCloudPay" />
  147. </div>
  148. <span class="o-pl-50">{{ $t("user.currentChoose") }}: {{ sevencloudPay ? "汇付" : "汇聚" }}</span>
  149. </div>
  150. </div>
  151. </div>
  152. <div class="lineBox"></div>
  153. <div class="commonOperBox">
  154. <!-- 常用操作 -->
  155. <div class="baseRow flex-row justify-between">
  156. <div class="group2 flex-col"></div>
  157. <span class="baseText">{{ $t("user.commonOperations") }}</span>
  158. </div>
  159. <div class="operListBox">
  160. <!-- 任务消息 -->
  161. <div v-if="roleCheck()" class="taskListRow flex-col" @click="pushPageList('/taskMessage')">
  162. <div class="taskIcon taskMessageIcon"></div>
  163. <div class="taskRight">
  164. <div class="taskTitle">{{ $t("user.taskMessage") }}</div>
  165. </div>
  166. </div>
  167. <!-- 提现帐号 -->
  168. <div v-if="isInland" class="taskListRow flex-col" @click="pushPageList('/settlement')">
  169. <div class="taskIcon joinPayMchIcon"></div>
  170. <div class="taskRight">
  171. <div class="taskTitle">{{ $t("user.settlementAccount") }}</div>
  172. </div>
  173. </div>
  174. <!-- 提现帐号 -->
  175. <!-- <div v-if="isInland" class="taskListRow flex-col" @click="pushPageList('/joinpayMch')">
  176. <div class="taskIcon joinPayMchIcon"></div>
  177. <div class="taskRight">
  178. <div class="taskTitle">{{ $t("user.withdrawalAccountNo") }}</div>
  179. </div>
  180. </div> -->
  181. <!-- Airwallex 钱包 -->
  182. <div v-if="isAbroad && user.companyType != '1'" class="taskListRow flex-col"
  183. @click="pushPageList('/airwallex')">
  184. <div class="taskIcon airwallexIcon"></div>
  185. <div class="taskRight">
  186. <div class="taskTitle">{{ $t("user.airwallex") }}</div>
  187. </div>
  188. </div>
  189. <!-- 备用提现账号 -->
  190. <!-- <div v-if="isInland" class="taskListRow flex-col" @click="pushPageList('/huifuMch')">
  191. <div class="taskIcon shandeMchIcon"></div>
  192. <div class="taskRight">
  193. <div class="taskTitle">
  194. {{ $t("user.standbyWithdrawalAccountNo") }}
  195. </div>
  196. </div>
  197. </div> -->
  198. <!-- <div class="taskListRow flex-col" @click="pushPageList('/shandeMch')">
  199. <div class="taskIcon shandeMchIcon"></div>
  200. <div class="taskRight">
  201. <div class="taskTitle">
  202. {{ $t("user.standbyWithdrawalAccountNo") }}
  203. </div>
  204. </div>
  205. </div>-->
  206. <!-- 绑定微信 -->
  207. <div v-if="isInWeChat" class="taskListRow flex-col" @click="pushPageList('/bindWechat')">
  208. <!-- <div class="taskListRow flex-col" @click="pushPageList('/bindWechat')">-->
  209. <div class="taskIcon bindWechatIcon"></div>
  210. <div class="taskRight">
  211. <div class="taskTitle">
  212. {{ $t("user.bindWechat") }}
  213. </div>
  214. </div>
  215. </div>
  216. <!-- 修改密码 -->
  217. <div class="taskListRow flex-col" @click="pushPageList('/changepassword')">
  218. <div class="taskIcon changePasswordIcon"></div>
  219. <div class="taskRight">
  220. <div class="taskTitle">{{ $t("user.changePassword") }}</div>
  221. </div>
  222. </div>
  223. <!-- 自动充值 -->
  224. <!-- <div v-if="isInland" class="taskListRow flex-col" @click="operUnipay()">
  225. <div class="taskIcon selfPayIcon"></div>
  226. <div class="taskRight">
  227. <div class="taskTitle">{{ $t("user.selfRecharging") }}</div>
  228. </div>
  229. </div> -->
  230. <div class="taskListRow flex-col" @click="onperExitSys()">
  231. <div class="taskIcon loginOutIcon"></div>
  232. <div class="taskRight">
  233. <div class="taskTitle">{{ $t("user.logOut") }}</div>
  234. </div>
  235. </div>
  236. </div>
  237. </div>
  238. </div>
  239. <nav-bar></nav-bar>
  240. <!-- 退出登录弹窗 -->
  241. <kDialog :dialogTitle="$t('user.logOutTips')" :cancelBtnTxt="$t('user.cancelLog')"
  242. :confirmBtnTxt="$t('user.confirmLog')" ref="kDialogRef" :dialogContent="$t('user.logOutContent')"
  243. @confirmclk="confirmClk">
  244. </kDialog>
  245. <!-- 地区弹窗 -->
  246. <kCascader @getareaname="getAreaName" :selectId="accountDetail.areaId" @areapopfinish="areaPopFinish"
  247. ref="kCascaderRef"></kCascader>
  248. </div>
  249. </template>
  250. <script>
  251. // 导入地区弹窗
  252. import kCascader from "@/components/commom/kCascader/index.vue";
  253. // 导入接口
  254. import { getAdmin } from "@/service/merchantManage";
  255. import { updateAdmin } from "@/service/merchantManage";
  256. // 引入弹窗
  257. import kDialog from "@/components/commom/kDialog/index.vue";
  258. import { onMounted, reactive, ref } from "vue";
  259. import sHeader from "@/components/SimpleHeader";
  260. import navBar from "@/components/NavBar";
  261. import {
  262. getLoginUser,
  263. $M_EmailAvailable,
  264. $M_PhoneTest,
  265. } from "@/common/js/utils";
  266. import { useRouter } from "vue-router";
  267. import { tAdminGetRelation, tAdminSetRelationAdmin, updatePayPlatform } from "@/service/user";
  268. import { Toast, Dialog } from "vant";
  269. import { useI18n } from "vue-i18n";
  270. import { styleUrl } from "../common/js/utils";
  271. export default {
  272. components: { sHeader, navBar, kDialog, kCascader },
  273. setup() {
  274. // 引入语言
  275. const { t } = useI18n();
  276. // 账户信息
  277. const accountDetail = ref({});
  278. // 控制地区显示隐藏
  279. const areaShow = ref(true);
  280. // 控制手机显示隐藏
  281. const phoneNumberShow = ref(true);
  282. // 控制邮箱显示隐藏
  283. const mailboxShow = ref(true);
  284. // 控制货币显示隐藏 货币符号,默认“¥”
  285. const symbolShow = ref(true);
  286. // 控制切换支付平台按钮显示隐藏
  287. const chaSzPayShow = ref(false);
  288. const chaScPayShow = ref(false);
  289. const sunzeePay = ref(false);
  290. const sevencloudPay = ref(false);
  291. const user = getLoginUser();
  292. const router = useRouter();
  293. const relationAdminName = ref("");
  294. const relationType = ref(true);
  295. const sys = ref(null);
  296. // 修改的个人信息
  297. const cofficentForm = reactive({
  298. associateParent: relationAdminName.value,
  299. mailBox: accountDetail.value.email,
  300. phone: accountDetail.value.phone,
  301. area: "",
  302. currencySymbol: accountDetail.value.currencySymbol,
  303. });
  304. //
  305. const params = reactive({
  306. id: '', // 用户ID
  307. payPlatform: '', //支付平台
  308. });
  309. // 点击修改图标
  310. const editClk = (idx) => {
  311. switch (idx) {
  312. case 1:
  313. cofficentForm.associateParent = relationAdminName.value;
  314. relationType.value = !relationType.value;
  315. mailboxShow.value = true;
  316. phoneNumberShow.value = true;
  317. areaShow.value = true;
  318. symbolShow.value = true;
  319. break;
  320. case 2:
  321. cofficentForm.mailBox = accountDetail.value.email;
  322. relationType.value = true;
  323. mailboxShow.value = !mailboxShow.value;
  324. phoneNumberShow.value = true;
  325. areaShow.value = true;
  326. symbolShow.value = true;
  327. break;
  328. case 3:
  329. cofficentForm.phone = accountDetail.value.phone;
  330. relationType.value = true;
  331. mailboxShow.value = true;
  332. phoneNumberShow.value = !phoneNumberShow.value;
  333. areaShow.value = true;
  334. symbolShow.value = true;
  335. break;
  336. case 4:
  337. cofficentForm.area = accountDetail.value.area;
  338. relationType.value = true;
  339. mailboxShow.value = true;
  340. phoneNumberShow.value = true;
  341. areaShow.value = !areaShow.value;
  342. symbolShow.value = true;
  343. break;
  344. case 5:
  345. cofficentForm.currencySymbol = accountDetail.value.currencySymbol;
  346. relationType.value = true;
  347. mailboxShow.value = true;
  348. phoneNumberShow.value = true;
  349. areaShow.value = true;
  350. symbolShow.value = !symbolShow.value;
  351. break;
  352. }
  353. };
  354. // 点击邮箱的确定按钮
  355. const mailboxChg = async (e, idx) => {
  356. switch (idx) {
  357. case 1:
  358. if (!e) {
  359. Toast(t("user.associateParentPlace"));
  360. } else {
  361. const { data } = await tAdminSetRelationAdmin({
  362. adminId: user.id,
  363. username: e,
  364. });
  365. relationType.value = true;
  366. if (data.code === "00000") {
  367. Toast(data.message);
  368. setTimeout(() => {
  369. gettAdminGetRelation();
  370. }, 500);
  371. }
  372. }
  373. break;
  374. case 2:
  375. if (!e) {
  376. Toast(t("user.mailboxPlace"));
  377. } else if (!$M_EmailAvailable(e)) {
  378. Toast(t("user.corrEmailPlace"));
  379. } else {
  380. const params = {
  381. id: user.id,
  382. email: e,
  383. };
  384. const { data } = await updateAdmin(params);
  385. mailboxShow.value = true;
  386. if (data.code === "00000") {
  387. Toast(data.message);
  388. setTimeout(() => {
  389. getAcccountDetail();
  390. }, 500);
  391. }
  392. }
  393. break;
  394. case 3:
  395. if (!e) {
  396. Toast(t("user.phoneNumberPlace"));
  397. } else if (!$M_PhoneTest(e)) {
  398. Toast(t("user.corrPhonePlace"));
  399. } else {
  400. const params = {
  401. id: user.id,
  402. phone: e,
  403. };
  404. const { data } = await updateAdmin(params);
  405. phoneNumberShow.value = true;
  406. if (data.code === "00000") {
  407. Toast(data.message);
  408. setTimeout(() => {
  409. getAcccountDetail();
  410. }, 500);
  411. }
  412. }
  413. break;
  414. case 5:
  415. if (!e) {
  416. Toast(t("user.currencySymbolPlace"));
  417. } else {
  418. const params = {
  419. id: user.id,
  420. currencySymbol: e,
  421. };
  422. const { data } = await updateAdmin(params);
  423. symbolShow.value = true;
  424. if (data.code === "00000") {
  425. Toast(data.message);
  426. // 更新本地存储缓存中的currencySymbol的值
  427. user.currencySymbol = e; // 将新的currencySymbol的值赋值给user
  428. localStorage.setItem("loginUser", JSON.stringify(user));
  429. setTimeout(() => {
  430. getAcccountDetail();
  431. }, 500);
  432. }
  433. }
  434. break;
  435. }
  436. };
  437. // 获取账户详情
  438. const getAcccountDetail = () => {
  439. getAdmin({ id: user.id }).then((res) => {
  440. accountDetail.value = res.data.data;
  441. // 查询地址回显
  442. kCascaderRef.value.init(accountDetail.value.areaId);
  443. });
  444. };
  445. // 获取申泽支付平台
  446. const getSunzeeDetail = () => {
  447. getAdmin({ id: 2738 }).then((res) => {
  448. // sunzeePay.value = res.data.data.payPlatform;
  449. if (res.data.data.payPlatform == '1') {
  450. sunzeePay.value = true;
  451. }
  452. console.log("sunzeePay", sunzeePay.value)
  453. });
  454. };
  455. // 获取七云支付平台
  456. const getSevenCloudDetail = () => {
  457. getAdmin({ id: 2739 }).then((res) => {
  458. // sevencloudPay.value = res.data.data.payPlatform;
  459. if (res.data.data.payPlatform == '1') {
  460. sevencloudPay.value = true;
  461. }
  462. console.log("sevencloudPay", sevencloudPay.value)
  463. });
  464. };
  465. // 退出登录弹窗
  466. const kDialogRef = ref(null);
  467. // 点击右侧按钮
  468. const confirmClk = () => {
  469. // 获取缓存的语言
  470. const curLang = localStorage.getItem("curLang");
  471. // 清空缓存
  472. localStorage.clear();
  473. localStorage.setItem("curLang", curLang);
  474. if (sys.value) {
  475. setTimeout(() => {
  476. router.push({
  477. path: "login",
  478. query: { relation_admin_id: sys.value.relationAdminId },
  479. });
  480. }, 200);
  481. } else {
  482. setTimeout(() => {
  483. router.push({ path: "login" });
  484. }, 200);
  485. }
  486. };
  487. //切换申泽支付平台
  488. const changeSunzeePay = (value) => {
  489. Dialog.confirm({
  490. title: t('user.tips'),
  491. message: t('user.changeTips'),
  492. }).then(() => {
  493. // checked.value = newValue;
  494. console.log(value);
  495. params.id = 2738;
  496. if (value) {
  497. params.payPlatform = '1';
  498. } else {
  499. params.payPlatform = '0';
  500. }
  501. const { data } = updatePayPlatform(params);
  502. if (data.code) {
  503. Toast.success(t('user.changeSuccess'));
  504. sunzeePay.value = value;
  505. } else {
  506. Toast.fail(data.message);
  507. }
  508. }).catch((error) => {
  509. console.error(error);
  510. })
  511. }
  512. //切换七云支付平台
  513. const changeSevenCloudPay = (value) => {
  514. Dialog.confirm({
  515. title: t('user.tips'),
  516. message: t('user.changeTips'),
  517. }).then(() => {
  518. // checked.value = newValue;
  519. console.log(value);
  520. params.id = 2739;
  521. if (value) {
  522. params.payPlatform = '1';
  523. } else {
  524. params.payPlatform = '0';
  525. }
  526. const { data } = updatePayPlatform(params);
  527. if (data.code) {
  528. Toast.success(t('user.changeSuccess'));
  529. sunzeePay.value = value;
  530. } else {
  531. Toast.fail(data.message);
  532. }
  533. }).catch((error) => {
  534. console.error(error);
  535. })
  536. }
  537. // 初始化页面获取列表
  538. onMounted(async () => {
  539. // 加载样式
  540. styleUrl('user');
  541. if (localStorage.getItem("loginSys")) {
  542. const loginSysString = localStorage.getItem("loginSys");
  543. sys.value = JSON.parse(loginSysString);
  544. }
  545. // 获取关联上级
  546. gettAdminGetRelation();
  547. // 获取账户
  548. getAcccountDetail();
  549. if (user.id == 1 ) {
  550. chaSzPayShow.value = true;
  551. chaScPayShow.value = true;
  552. getSunzeeDetail();
  553. getSevenCloudDetail();
  554. }
  555. // else if (user.id == 2738) {
  556. // chaSzPayShow.value = true;
  557. // getSunzeeDetail();
  558. // } else if (user.id == 2739) {
  559. // chaScPayShow.value = true;
  560. // getSevenCloudDetail();
  561. // }
  562. });
  563. const gettAdminGetRelation = async () => {
  564. const { data } = await tAdminGetRelation({
  565. relationAdminId: user.relationAdminId,
  566. });
  567. if (typeof data === "string") {
  568. relationAdminName.value = data;
  569. }
  570. };
  571. const operUnipay = () => {
  572. router.push({ path: "uniPay" });
  573. };
  574. const onperExitSys = () => {
  575. kDialogRef.value.openDialog();
  576. };
  577. const pushPageList = (url) => {
  578. router.push({ path: url });
  579. };
  580. const roleCheck = () => {
  581. if (user.isAdmined) {
  582. return true;
  583. } else {
  584. const menuList = user.menuCodeList.filter((item) => item === "M6");
  585. return menuList.length > 0;
  586. }
  587. };
  588. // 地区弹窗
  589. const fieldValue = ref("");
  590. const kCascaderRef = ref(null);
  591. // 点击地区输入框
  592. const fieldValueInpClk = () => {
  593. kCascaderRef.value.openPop();
  594. };
  595. // 选择地区完成
  596. const areaPopFinish = async (e) => {
  597. console.log("e", e);
  598. fieldValue.value = e.selectName;
  599. accountDetail.value.areaId = e.selectId;
  600. const params = {
  601. id: user.id,
  602. areaId: e.selectId,
  603. };
  604. const { data } = await updateAdmin(params);
  605. areaShow.value = true;
  606. if (data.code === "00000") {
  607. Toast(data.message);
  608. setTimeout(() => {
  609. getAcccountDetail();
  610. }, 500);
  611. }
  612. };
  613. const isInWeChat = ref(false);
  614. const checkInWechat = () => {
  615. const ua = window.navigator.userAgent.toLowerCase();
  616. // 如果是在微信中打开
  617. if (/MicroMessenger/i.test(ua)) {
  618. isInWeChat.value = true;
  619. }
  620. };
  621. // 是否内陆或海外
  622. const isInland = ref(true);
  623. const isAbroad = ref(false);
  624. // const checkIsAbroad = async () => {
  625. // try {
  626. // const { data } = await getIfForeign(user.id);
  627. // console.log("isAbroad >>> ", data);
  628. // if (data.data === '1') {
  629. // // TODO: 这里先把isAbroad设置为fasle,等开发完成再改成true;
  630. // isAbroad.value = false;
  631. // isInland.value = false;
  632. // }
  633. // } catch (error) {
  634. // console.error(error);
  635. // }
  636. // };
  637. const checkIsAbroad = async () => {
  638. try {
  639. const userInfo = localStorage.getItem("loginUser");
  640. const userIfForeign = JSON.parse(userInfo);
  641. // console.log("用户的海内外信息" + userIfForeign.ifForeign);
  642. // console.log("看下user是什么***" + user.menuCodeList);
  643. if (userIfForeign.ifForeign === '1') {
  644. isAbroad.value = true;
  645. isInland.value = false;
  646. }
  647. } catch (error) {
  648. console.error(error);
  649. }
  650. };
  651. onMounted(() => {
  652. checkInWechat();
  653. checkIsAbroad();
  654. })
  655. // 获取回显的值
  656. const getAreaName = (e) => {
  657. fieldValue.value = e;
  658. };
  659. return {
  660. user,
  661. operUnipay,
  662. onperExitSys,
  663. relationAdminName,
  664. relationType,
  665. pushPageList,
  666. roleCheck,
  667. sys,
  668. kDialogRef,
  669. confirmClk,
  670. mailboxShow,
  671. mailboxChg,
  672. phoneNumberShow,
  673. editClk,
  674. cofficentForm,
  675. params,
  676. areaShow,
  677. accountDetail,
  678. fieldValue,
  679. kCascaderRef,
  680. fieldValueInpClk,
  681. areaPopFinish,
  682. isInWeChat,
  683. getAreaName,
  684. isAbroad,
  685. checkIsAbroad,
  686. isInland,
  687. symbolShow,
  688. chaSzPayShow,
  689. chaScPayShow,
  690. sunzeePay,
  691. sevencloudPay,
  692. changeSunzeePay,
  693. changeSevenCloudPay,
  694. };
  695. }
  696. };
  697. </script>
  698. <style lang="less" scoped>
  699. @import "../common/style/mixin.less";
  700. </style>