index.vue 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. <template>
  2. <view class="container">
  3. <up-navbar class="inde-nav-bar" :bgColor="navBgColor">
  4. <template #left>
  5. <view></view>
  6. </template>
  7. <template #center>
  8. <view class="page-title">我的</view>
  9. </template>
  10. </up-navbar>
  11. <!-- 顶部用户信息 -->
  12. <view class="user-header jianbianBG">
  13. <view class="user-info">
  14. <view class="user-main">
  15. <view>
  16. <image
  17. class="avatar"
  18. :src="isHttpsImage(appStore.$userInfo?.avatar)"
  19. ></image>
  20. </view>
  21. <view class="user-detail">
  22. <view class="name-vip" v-if="appStore.isLogin">
  23. <text class="name">{{ appStore.$userInfo?.nickname }}</text>
  24. <image
  25. class="vip-tag"
  26. v-if="
  27. appStore.$userInfo?.svip &&
  28. !appStore?.$wxConfig?.storeAuditModeEnabled
  29. "
  30. mode="widthFix"
  31. :src="HTTP_REQUEST_URL_IMG + 'sviplogo.png'"
  32. ></image>
  33. </view>
  34. <view
  35. class="name-vip"
  36. v-else
  37. @click="navigateTo('/pages/users/login/index')"
  38. >
  39. <text class="name">未登录</text>
  40. </view>
  41. <text class="vip-expire" v-if="appStore.$userInfo?.svip"
  42. >到期时间:{{ appStore.$userInfo?.svipExpireTime }}</text
  43. >
  44. <view class="intro">
  45. <view class="item" @click="handleFaceDetect">
  46. {{ appStore.$userInfo?.realNameVerified ? "已实名" : "未实名" }}
  47. </view>
  48. <view class="item" v-if="userInfoAddres !== ''"
  49. >IP:
  50. {{ userInfoAddres }}
  51. </view>
  52. <view
  53. class="item"
  54. v-if="appStore.$userInfo?.sex && appStore.$userInfo?.sex !== 0"
  55. >{{ sexMap[appStore.$userInfo?.sex] }}·{{
  56. appStore.$userInfo?.age
  57. }}岁</view
  58. >
  59. </view>
  60. </view>
  61. </view>
  62. <view class="btn-content" @click="handleEdit()">
  63. <image
  64. class="setting"
  65. :src="HTTP_REQUEST_URL_IMG + 'setting.png'"
  66. mode="widthFix"
  67. ></image>
  68. <text class="btn-text">编辑资料</text>
  69. </view>
  70. </view>
  71. <!-- 会员开通提示 v-if="!userInfo.isVip"-->
  72. <view
  73. class="vip-promote"
  74. v-if="!appStore?.$wxConfig?.storeAuditModeEnabled"
  75. >
  76. <image
  77. class="vipBG"
  78. :src="HTTP_REQUEST_URL_IMG + 'vipBG.png'"
  79. mode="scaleToFill"
  80. ></image>
  81. <view class="vip-text">
  82. <view class="title">
  83. <image
  84. class="vipIcon"
  85. :src="HTTP_REQUEST_URL_IMG + 'setting/vipIcon.png'"
  86. mode="widthFix"
  87. ></image>
  88. <text v-if="!appStore.$userInfo?.svip"
  89. >开通<text class="bigText">会员</text>享受更多<text
  90. class="bigText"
  91. >权益</text
  92. ></text
  93. >
  94. <text v-else>前往查看<text class="bigText">权益</text></text>
  95. </view>
  96. <button class="open-vip" @click="goVIP">
  97. {{ appStore.$userInfo?.svip ? "去查看" : "去开通"
  98. }}<image
  99. class="bofang"
  100. :src="HTTP_REQUEST_URL_IMG + 'setting/bofang.png'"
  101. mode="widthFix"
  102. ></image>
  103. </button>
  104. </view>
  105. </view>
  106. </view>
  107. <!-- 钱包余额 -->
  108. <view
  109. class="wallet-section"
  110. v-if="!appStore?.$wxConfig?.storeAuditModeEnabled"
  111. >
  112. <!-- <view class="wallet-header">
  113. <view>
  114. <view class="wallet-title">钱包余额</view>
  115. </view>
  116. <view class="transaction-detail" @click="viewTransactionDetail">
  117. <text style="margin-right: 10rpx">进入钱包</text>
  118. <uni-icons type="right" size="16" color="#666666"></uni-icons>
  119. </view>
  120. </view>
  121. <up-line color="#F1F3F8"></up-line> -->
  122. <!--
  123. <view class="assets">
  124. <view
  125. v-for="(asset, index) in wallet.assets"
  126. :key="asset.name"
  127. class="asset-container"
  128. >
  129. <view class="asset-item">
  130. <text class="asset-name">{{ asset.name }}</text>
  131. <text class="asset-amount"
  132. >{{ asset.balance }}{{ asset.unit }}</text
  133. >
  134. </view>
  135. <up-line
  136. v-if="index < wallet.assets.length - 1"
  137. color="#F1F3F8"
  138. direction="col"
  139. length="80rpx"
  140. style="margin: 0 20rpx"
  141. ></up-line>
  142. </view>
  143. </view> -->
  144. <!-- <view
  145. class="wallet-actions"
  146. v-if="tradeList && tradeList.length > 0 && showIcons"
  147. >
  148. <view
  149. class="wallet-btn withdraw"
  150. @click="goDetail(tradeList[0].jumpUrl)"
  151. >{{ tradeList[0].iconName }}</view
  152. >
  153. <view
  154. class="wallet-btn recharge"
  155. @click="goDetail(tradeList[1].jumpUrl)"
  156. >{{ tradeList[1].iconName }}</view
  157. >
  158. </view> -->
  159. <view
  160. class="functions-useList"
  161. v-if="useList && useList.length > 0"
  162. :style="{
  163. gridTemplateColumns: `repeat(${
  164. useList.length <= 4 ? useList.length : 4
  165. },1fr`,
  166. }"
  167. >
  168. <view
  169. class="function-item"
  170. v-for="item in useList"
  171. :key="item.iconName"
  172. @click="goDetail(item.jumpUrl)"
  173. >
  174. <view class="function-icon">
  175. <image
  176. :src="item.iconUrl"
  177. mode="widthFix"
  178. :style="{
  179. width: (item.iconSize || '60') + 'rpx',
  180. height: (item.iconSize || '60') + 'rpx',
  181. }"
  182. ></image>
  183. </view>
  184. <text class="function-name">{{ item.iconName }}</text>
  185. </view>
  186. </view>
  187. </view>
  188. <!-- 最近访问 -->
  189. <view class="recent-visit" v-if="recentStores.length > 0">
  190. <view class="section-header">
  191. <text class="section-title">最近访问</text>
  192. <view
  193. class="more"
  194. @click="
  195. handleFunctionClick({
  196. pageUrl: '/pages/users/browsing_history/index',
  197. })
  198. "
  199. >查看更多<uni-icons
  200. style="margin-left: 10rpx"
  201. type="right"
  202. size="16"
  203. color="#666666"
  204. ></uni-icons
  205. ></view>
  206. </view>
  207. <view class="store-list">
  208. <template v-for="(store, storeIndex) in recentStores" :key="store.id">
  209. <view
  210. class="store-item"
  211. v-if="storeIndex == 0"
  212. @click="viewStore(store)"
  213. >
  214. <view class="store-logo">
  215. <image
  216. class="img"
  217. :src="store.merchantLogo"
  218. mode="aspectFill"
  219. ></image>
  220. </view>
  221. <view class="store-info">
  222. <text class="store-name">{{ store.merchantName }}</text>
  223. <text class="store-desc">{{ store.merchantDescribe }}</text>
  224. </view>
  225. <uni-icons
  226. style="margin-left: auto"
  227. type="right"
  228. size="16"
  229. color="#666666"
  230. ></uni-icons>
  231. </view>
  232. </template>
  233. </view>
  234. </view>
  235. <!-- 订单状态 -->
  236. <view class="order-section">
  237. <view class="section-header">
  238. <text class="section-title">我的订单</text>
  239. <view class="more" @click="viewAllOrders"
  240. >全部订单<uni-icons
  241. style="margin-left: 10rpx"
  242. type="right"
  243. size="16"
  244. color="#666666"
  245. ></uni-icons
  246. ></view>
  247. </view>
  248. <view class="order-status">
  249. <view
  250. class="status-item"
  251. v-for="order in orderStatus"
  252. :key="order.name"
  253. @click="viewOrders(order.id)"
  254. >
  255. <view class="status-icon">
  256. <image class="img" :src="order.src"></image>
  257. </view>
  258. <text class="status-name">{{ order.name }}</text>
  259. </view>
  260. </view>
  261. </view>
  262. <!-- 常用功能 -->
  263. <view class="common-functions">
  264. <view class="section-header">
  265. <text class="section-title">常用功能</text>
  266. </view>
  267. <view class="functions">
  268. <template v-for="func in commonFunctions" :key="func.name">
  269. <view
  270. class="function-item"
  271. @click="handleFunctionClick(func)"
  272. v-if="func.show"
  273. >
  274. <view class="function-icon">
  275. <image class="img" :src="func.src" mode="widthFix"></image>
  276. </view>
  277. <text class="function-name">{{ func.name }}</text>
  278. </view>
  279. </template>
  280. </view>
  281. </view>
  282. <!-- 企微客服弹窗 -->
  283. <up-popup
  284. :show="showCallList"
  285. closeOnClickOverlay
  286. mode="bottom"
  287. @close="showCallList = false"
  288. >
  289. <view class="callService">
  290. <view class="list-box">
  291. <view
  292. v-for="(item, index) in callList"
  293. :key="index"
  294. class="list-item"
  295. @click="callService(item)"
  296. >
  297. <view class="item-left">
  298. <view class="item-name">{{ item.serviceName }}</view>
  299. </view>
  300. </view>
  301. </view>
  302. </view>
  303. </up-popup>
  304. <!-- 自定义 tabBar -->
  305. <customTabBar :current="3" :showBackTop="false" />
  306. </view>
  307. </template>
  308. <script setup>
  309. import { ref, reactive, watch, computed } from "vue";
  310. import { onLoad, onShow, onPageScroll } from "@dcloudio/uni-app";
  311. import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
  312. import { HTTP_REQUEST_URL_IMG } from "@/config/app";
  313. import { isHttpsImage } from "@/utils/util";
  314. import { useAppStore } from "@/stores/app";
  315. import { useToast } from "@/hooks/useToast";
  316. import { getMetalBalance } from "@/api/vault";
  317. import { footprintList } from "@/api/merchant.js";
  318. import { getCustomerServiceList } from "@/api/user";
  319. import { toLogin } from "@/libs/login.js";
  320. import customTabBar from "@/components/customTabBar/index.vue";
  321. const showIcons = ref(false);
  322. const appStore = useAppStore();
  323. const { Toast } = useToast();
  324. const isLogin = appStore.isLogin;
  325. const callList = ref([]);
  326. const showCallList = ref(false);
  327. const navBgColor = ref("rgba(255,255,255,0)");
  328. // 钱包信息
  329. const wallet = ref({
  330. balance: appStore.userInfo?.nowMoney || "0.00",
  331. assets: [
  332. { name: "黄金资产", balance: "0.00", unit: "g", type: 1 },
  333. { name: "铂金资产", balance: "0.00", unit: "g", type: 2 },
  334. { name: "白银资产", balance: "0.00", unit: "g", type: 3 },
  335. ],
  336. });
  337. // 主要功能列表
  338. const mainFunctions = ref([
  339. {
  340. src: `${HTTP_REQUEST_URL_IMG}setting/mailiao.png`,
  341. name: "买料",
  342. pageUrl: "/pages/users/vault/rechargeGold",
  343. },
  344. {
  345. src: `${HTTP_REQUEST_URL_IMG}setting/mailiao2.png`,
  346. name: "卖料",
  347. pageUrl: "/pages/users/vault/storeMetal/index",
  348. },
  349. {
  350. src: `${HTTP_REQUEST_URL_IMG}setting/cunliao.png`,
  351. name: "存料",
  352. pageUrl: "/pages/users/vault/storeMetal/goldBullionStock",
  353. },
  354. {
  355. src: `${HTTP_REQUEST_URL_IMG}setting/tiliao.png`,
  356. name: "提料",
  357. pageUrl: "/pages/users/vault/storeMetal/metalExchange",
  358. },
  359. ]);
  360. // 最近访问的商家
  361. const recentStores = ref([]);
  362. // 订单状态
  363. const orderStatus = ref([
  364. {
  365. src: `${HTTP_REQUEST_URL_IMG}setting/daifukuan.png`,
  366. name: "待付款",
  367. id: 0,
  368. },
  369. { src: `${HTTP_REQUEST_URL_IMG}setting/daifahuo.png`, name: "待发货", id: 1 },
  370. {
  371. src: `${HTTP_REQUEST_URL_IMG}setting/daishouhuo.png`,
  372. name: "待收货",
  373. id: 2,
  374. },
  375. {
  376. src: `${HTTP_REQUEST_URL_IMG}setting/tuikuan.png`,
  377. name: "退款/换货",
  378. id: -3,
  379. },
  380. {
  381. src: `${HTTP_REQUEST_URL_IMG}setting/yiwancheng.png`,
  382. name: "已完成",
  383. id: 4,
  384. },
  385. ]);
  386. const merchantZYShow = ref(false);
  387. const lxsjShow = ref(false);
  388. const logoutShow = ref(false);
  389. // 常用功能
  390. const commonFunctions = computed(() => {
  391. const baseFunctions = [
  392. {
  393. src: `${HTTP_REQUEST_URL_IMG}setting/zuji.png`,
  394. name: "浏览足迹",
  395. pageUrl: "/pages/users/browsing_history/index",
  396. show: true,
  397. },
  398. {
  399. src: `${HTTP_REQUEST_URL_IMG}setting/shoucang.png`,
  400. name: "我的收藏",
  401. pageUrl: "/pages/users/user_goods_collection/index",
  402. show: true,
  403. },
  404. {
  405. src: `${HTTP_REQUEST_URL_IMG}setting/dingwei.png`,
  406. name: "收货地址",
  407. pageUrl: "/pages/users/user_address_list/index",
  408. show: true,
  409. },
  410. {
  411. src: `${HTTP_REQUEST_URL_IMG}setting/dianpu.png`,
  412. name: "联系商家",
  413. pageUrl: "/pages/users/my_merchant/index",
  414. show: lxsjShow.value,
  415. },
  416. {
  417. src: `${HTTP_REQUEST_URL_IMG}setting/dianpu.png`,
  418. name: "门店主页",
  419. pageUrl: "/pages/merchantCenter/index",
  420. show: merchantZYShow.value,
  421. },
  422. // { src: `${HTTP_REQUEST_URL_IMG}setting/xiazaiapp.png`, name: '下载APP', pageUrl: 'download', show: true },
  423. {
  424. src: `${HTTP_REQUEST_URL_IMG}setting/lianxikefu.png`,
  425. name: "平台客服",
  426. show: true,
  427. },
  428. {
  429. src: `${HTTP_REQUEST_URL_IMG}setting/logout.png`,
  430. name: "退出登录",
  431. pageUrl: "logout",
  432. show: logoutShow.value,
  433. },
  434. ];
  435. // 根据 show 值过滤
  436. return baseFunctions.filter((func) => func.show);
  437. });
  438. const params = ref({
  439. page: 1,
  440. limit: 10,
  441. });
  442. const sexMap = {
  443. 0: "未知",
  444. 1: "男",
  445. 2: "女",
  446. 3: "保密",
  447. };
  448. const userInfoAddres = computed(() => {
  449. let address = appStore.userInfo?.addres || "";
  450. const list = address.split("-");
  451. return list[0] || "";
  452. });
  453. // 页面加载
  454. onShow(async () => {
  455. // 隐藏原生 tabBar
  456. uni.hideTabBar();
  457. if (appStore.isLogin) {
  458. await appStore.USERINFO();
  459. logoutShow.value = true;
  460. wallet.value.balance = appStore.userInfo?.nowMoney || "0.00";
  461. if (appStore.userInfo?.merchant?.id) {
  462. merchantZYShow.value = true;
  463. } else {
  464. merchantZYShow.value = false;
  465. }
  466. if (appStore.merchantId || appStore.userInfo?.merchant?.id) {
  467. lxsjShow.value = true;
  468. } else {
  469. lxsjShow.value = false;
  470. }
  471. } else {
  472. logoutShow.value = false;
  473. }
  474. fetchMetalBalance();
  475. getHistoryList();
  476. });
  477. onLoad(async () => {
  478. await getServiceList();
  479. });
  480. onPageScroll((e) => {
  481. if (e.scrollTop > 0) {
  482. navBgColor.value = "#ffe079";
  483. } else {
  484. navBgColor.value = "rgba(252,255,255,0)";
  485. }
  486. });
  487. const wxConfig = ref({});
  488. const tradeList = ref([]);
  489. const useList = ref([]);
  490. const isOwner = ref(true);
  491. watch(
  492. () => appStore.wxConfig,
  493. (newVal) => {
  494. const configDate = newVal || appStore.$wxConfig;
  495. wxConfig.value = configDate;
  496. const list = JSON.parse(configDate.storeCommonTools || "[]");
  497. console.log("list", list);
  498. // 过滤list中status为false的项
  499. useList.value = list.filter((item) => item.status);
  500. // if (list[0].status == false) {
  501. // showIcons.value = false;
  502. // } else {
  503. // showIcons.value = true;
  504. // }
  505. // tradeList.value = [list[0], list[1]];
  506. // useList.value = [
  507. // {
  508. // ...list[2],
  509. // src: `${HTTP_REQUEST_URL_IMG}setting/mailiao.png`,
  510. // },
  511. // {
  512. // ...list[3],
  513. // src: `${HTTP_REQUEST_URL_IMG}setting/mailiao2.png`,
  514. // },
  515. // {
  516. // ...list[4],
  517. // src: `${HTTP_REQUEST_URL_IMG}setting/cunliao.png`,
  518. // iconName: "存料",
  519. // },
  520. // {
  521. // ...list[5],
  522. // src: `${HTTP_REQUEST_URL_IMG}setting/tiliao.png`,
  523. // },
  524. // ];
  525. console.log(tradeList.value);
  526. },
  527. { deep: true, immediate: true }
  528. );
  529. // 编辑资料
  530. const editProfile = () => {
  531. uni.showToast({
  532. title: "编辑资料",
  533. icon: "none",
  534. });
  535. };
  536. // 开通会员
  537. const openVip = () => {
  538. uni.showToast({
  539. title: "开通会员",
  540. icon: "none",
  541. });
  542. };
  543. // 查看会员权益
  544. const goVIP = () => {
  545. // uni.navigateTo({ url: "/pages/users/VIP/VIP" });
  546. goDetail("/pages/users/VIP/VIP");
  547. };
  548. // 查看交易明细
  549. const viewTransactionDetail = () => {
  550. console.log(isLogin);
  551. if (!appStore.isLogin) {
  552. toLogin();
  553. } else {
  554. // uni.navigateTo({ url: "/pages/users/vault/index" });
  555. goDetail("/pages/users/vault/index1");
  556. }
  557. };
  558. // 充值
  559. const recharge = () => {
  560. if (!appStore.isLogin) {
  561. toLogin();
  562. } else {
  563. uni.navigateTo({
  564. url: `/pages/webview/index?path=${"/pages/users/vault/rechargeRmb"}`,
  565. });
  566. }
  567. };
  568. // 提现
  569. const withdraw = () => {
  570. if (!appStore.isLogin) {
  571. toLogin();
  572. } else {
  573. uni.navigateTo({
  574. url: `/pages/webview/index?path=${"/pages/users/vault/withdraw"}`,
  575. });
  576. }
  577. };
  578. const goDetail = (url) => {
  579. console.log(url);
  580. const webviewPageUrl = `/pages/webview/index?path=${url}`;
  581. uni.navigateTo({
  582. url: webviewPageUrl,
  583. fail: (err) => {
  584. console.error("跳转到webview页面失败:", err);
  585. uni.showToast({
  586. title: "跳转失败,请重试",
  587. icon: "none",
  588. duration: 1500,
  589. });
  590. },
  591. });
  592. };
  593. function handleLogOut() {
  594. uni.showModal({
  595. title: "提示",
  596. content: "确认退出登录吗?",
  597. success: function (res) {
  598. if (res.confirm) {
  599. // 清除全局定时器
  600. if (getApp().globalData?.messageTimer) {
  601. clearInterval(getApp().globalData.messageTimer);
  602. getApp().globalData.messageTimer = null;
  603. }
  604. appStore.LOGOUT();
  605. uni.reLaunch({ url: "/pages/users/login/index" });
  606. }
  607. },
  608. });
  609. }
  610. // 功能点击
  611. const handleFunctionClick = (item) => {
  612. const url = item.pageUrl;
  613. console.log(url);
  614. if (item.name === "平台客服") return (showCallList.value = true);
  615. if (!url) return;
  616. // 买料、卖料、消费需要通过webview跳转
  617. if (
  618. [
  619. "/pages/users/vault/rechargeGold",
  620. "/pages/users/vault/storeMetal/index",
  621. "/pages/users/vault/storeMetal/order",
  622. ].includes(url)
  623. ) {
  624. const webviewPageUrl = `/pages/webview/index?path=${url}`;
  625. uni.navigateTo({
  626. url: webviewPageUrl,
  627. fail: (err) => {
  628. console.error("跳转到webview页面失败:", err);
  629. uni.showToast({
  630. title: "跳转失败,请重试",
  631. icon: "none",
  632. duration: 1500,
  633. });
  634. },
  635. });
  636. return; // 阻止继续执行后续跳转逻辑
  637. } else if (url === "download") {
  638. uni.setClipboardData({
  639. data: "https://a.app.qq.com/o/simple.jsp?pkgname=uni.app.UNI9DE338F",
  640. showToast: false,
  641. success: function () {
  642. uni.showToast({
  643. title: "下载链接复制成功,请打开内置手机浏览器访问下载。",
  644. icon: "none",
  645. });
  646. console.log("success");
  647. },
  648. });
  649. return;
  650. } else if (url === "logout") {
  651. handleLogOut();
  652. } else {
  653. console.log(url);
  654. uni.navigateTo({ url });
  655. }
  656. };
  657. // 获取客服列表
  658. const getServiceList = async (url) => {
  659. const res = await getCustomerServiceList();
  660. callList.value = res.data.list;
  661. };
  662. // 跳转企微客服
  663. const callService = async (item) => {
  664. wx.openCustomerServiceChat({
  665. corpId: item.enterpriseId,
  666. extInfo: {
  667. url: item.serviceLink,
  668. },
  669. fail: (err) => {
  670. console.error("跳转企微客服失败:", err);
  671. },
  672. });
  673. };
  674. // 查看商家
  675. const viewStore = (store) => {
  676. if (!store.merchantId) {
  677. return;
  678. }
  679. uni.navigateTo({
  680. url: "/pages/merchantCenters/merchant?merchantId=" + store.merchantId,
  681. });
  682. };
  683. // 查看全部订单
  684. const viewAllOrders = () => {
  685. uni.navigateTo({ url: "/pages/order_list/index" });
  686. };
  687. // 查看订单
  688. const viewOrders = (status) => {
  689. uni.navigateTo({ url: "/pages/order_list/index?status=" + status });
  690. };
  691. const navigateTo = (url) => {
  692. if (!url) return;
  693. uni.navigateTo({ url });
  694. };
  695. // 用户面板事件处理
  696. function handleEdit() {
  697. // console.log("编辑资料");
  698. uni.navigateTo({ url: "/pages/users/personal_info/personal_info" });
  699. }
  700. async function fetchMetalBalance() {
  701. // 若appStore.uid为空,则请求失败
  702. if (!appStore?.uid) {
  703. // Toast({ title: "未登录,请前往登录后访问" });
  704. return;
  705. }
  706. const params = { userId: appStore.uid };
  707. const { data } = await getMetalBalance(params);
  708. wallet.value.assets = wallet.value.assets.map((metal) => {
  709. const metalValue = data[metal.type];
  710. return metalValue !== undefined ? { ...metal, balance: metalValue } : metal;
  711. });
  712. }
  713. const getHistoryList = async () => {
  714. const { data } = await footprintList(params.value);
  715. recentStores.value = data.records;
  716. };
  717. //人脸识别
  718. function handleFaceDetect() {
  719. // #ifndef APP-PLUS
  720. if (appStore.userInfo.realNameVerified || !isOwner.value) return;
  721. uni.navigateTo({
  722. url: "/pages/users/face_detect/index",
  723. });
  724. // #endif
  725. }
  726. </script>
  727. <style scoped lang="scss">
  728. .container {
  729. background-color: #f5f5f5;
  730. min-height: 100vh;
  731. padding-bottom: 180rpx;
  732. }
  733. /* 顶部用户信息 */
  734. .user-header {
  735. height: 600rpx;
  736. //background-image: linear-gradient(200deg, #fcd965 0%, #ffffff 90%) !important;
  737. background-size: 100% 100%;
  738. padding: 150rpx 20rpx 20rpx;
  739. color: #fff;
  740. border-radius: 0 0 20rpx 20rpx;
  741. box-sizing: border-box;
  742. }
  743. .user-info {
  744. display: flex;
  745. justify-content: space-between;
  746. align-items: center;
  747. margin: 24rpx 0;
  748. }
  749. .user-detail {
  750. display: flex;
  751. flex-direction: column;
  752. justify-content: center;
  753. }
  754. .user-main {
  755. display: flex;
  756. align-items: center;
  757. }
  758. .avatar {
  759. width: 140rpx;
  760. height: 140rpx;
  761. border-radius: 50%;
  762. background-color: #fff;
  763. margin-right: 30rpx;
  764. }
  765. .name-vip {
  766. display: flex;
  767. align-items: center;
  768. margin-bottom: 14rpx;
  769. }
  770. .name {
  771. font-size: 32rpx;
  772. color: #333;
  773. }
  774. .vip-tag {
  775. width: 100rpx;
  776. height: 36rpx;
  777. margin-left: 16rpx;
  778. }
  779. .vip-expire {
  780. font-size: 28rpx;
  781. color: #666;
  782. margin-bottom: 14rpx;
  783. }
  784. .btn-content {
  785. display: flex;
  786. flex-direction: column;
  787. align-items: center;
  788. justify-content: center;
  789. .setting {
  790. width: 40rpx;
  791. height: 40rpx;
  792. }
  793. .btn-text {
  794. font-size: 24rpx;
  795. color: #333;
  796. line-height: 1.5;
  797. }
  798. }
  799. /* 会员开通提示 */
  800. .vip-promote {
  801. height: 108rpx;
  802. width: 100%;
  803. height: 108rpx;
  804. // padding: 0 30rpx;
  805. box-sizing: border-box;
  806. .vipBG {
  807. width: 100%;
  808. height: 100%;
  809. border-radius: 48rpx 48rpx 0 0;
  810. }
  811. .vip-text {
  812. margin-top: -108rpx;
  813. display: flex;
  814. width: 100%;
  815. justify-content: space-between;
  816. align-items: center;
  817. padding: 20rpx;
  818. box-sizing: border-box;
  819. .title {
  820. font-size: 28rpx;
  821. color: #bdad8e;
  822. display: flex;
  823. justify-content: flex-start;
  824. align-items: center;
  825. .vipIcon {
  826. width: 70rpx;
  827. height: 60rpx;
  828. margin-right: 10rpx;
  829. }
  830. .bigText {
  831. font-size: 32rpx;
  832. color: #facd8d;
  833. margin: 0 10rpx;
  834. }
  835. }
  836. .open-vip {
  837. width: 144rpx;
  838. height: 60rpx;
  839. font-size: 24rpx;
  840. color: #5d3d03;
  841. background: linear-gradient(270deg, #fee2a3 0%, #fdebcc 100%);
  842. border-radius: 16rpx 16rpx 16rpx 16rpx;
  843. display: flex;
  844. justify-content: center;
  845. align-items: center;
  846. .bofang {
  847. width: 24rpx;
  848. height: 24rpx;
  849. margin-left: 10rpx;
  850. }
  851. }
  852. }
  853. }
  854. .desc {
  855. font-size: 22rpx;
  856. opacity: 0.9;
  857. }
  858. /* 钱包余额 */
  859. .wallet-section {
  860. background: #fff;
  861. margin: -150rpx 20rpx 20rpx;
  862. border-radius: 24rpx;
  863. border-top-left-radius: 0;
  864. border-top-right-radius: 0;
  865. padding: 32rpx;
  866. }
  867. .wallet-header {
  868. display: flex;
  869. justify-content: space-between;
  870. align-items: center;
  871. margin-bottom: 20rpx;
  872. }
  873. .wallet-title {
  874. font-size: 28rpx;
  875. color: #333;
  876. }
  877. .transaction-detail {
  878. color: #666;
  879. font-size: 24rpx;
  880. display: flex;
  881. align-items: center;
  882. }
  883. .balance {
  884. font-size: 48rpx;
  885. font-weight: bold;
  886. text-align: center;
  887. margin: 10rpx 0;
  888. color: #333;
  889. }
  890. .assets {
  891. display: flex;
  892. justify-content: space-between;
  893. align-items: center;
  894. margin-top: 40rpx;
  895. flex-wrap: nowrap; /* 确保不换行 */
  896. }
  897. .asset-container {
  898. display: flex;
  899. align-items: center;
  900. flex: 1;
  901. justify-content: center;
  902. position: relative;
  903. }
  904. .asset-item {
  905. display: flex;
  906. flex-direction: column;
  907. align-items: center;
  908. flex: 1;
  909. padding: 0 20rpx;
  910. }
  911. .asset-name {
  912. font-size: 24rpx;
  913. color: #333;
  914. margin-bottom: 16rpx;
  915. text-align: center;
  916. }
  917. .asset-amount {
  918. font-size: 40rpx;
  919. font-weight: bold;
  920. color: #333;
  921. text-align: center;
  922. }
  923. .wallet-actions {
  924. display: flex;
  925. justify-content: space-between;
  926. margin-top: 50rpx;
  927. }
  928. .wallet-btn {
  929. flex: 1;
  930. font-weight: bold;
  931. text-align: center;
  932. height: 88rpx;
  933. line-height: 88rpx;
  934. margin: 0 10rpx;
  935. border-radius: 16rpx;
  936. font-size: 32rpx;
  937. }
  938. .recharge {
  939. background: #f8c008;
  940. color: #333;
  941. }
  942. .withdraw {
  943. background: rgba(248, 192, 8, 0.1);
  944. color: #333;
  945. }
  946. /* 功能入口 */
  947. .function-grid {
  948. background: #fff;
  949. margin: 30rpx;
  950. border-radius: 24rpx;
  951. padding: 40rpx;
  952. }
  953. .functions {
  954. display: grid;
  955. // grid-template-columns: repeat(4, 1fr);
  956. gap: 40rpx;
  957. margin-top: 40rpx;
  958. }
  959. .functions-useList {
  960. display: grid;
  961. // grid-template-columns: repeat(4, 1fr);
  962. gap: 40rpx;
  963. margin-top: 40rpx;
  964. }
  965. .function-item {
  966. text-align: center;
  967. }
  968. .function-icon {
  969. .img {
  970. width: 60rpx;
  971. height: 60rpx;
  972. }
  973. }
  974. .function-name {
  975. font-size: 24rpx;
  976. color: #333;
  977. }
  978. /* 最近访问 */
  979. .recent-visit,
  980. .order-section,
  981. .common-functions {
  982. background: #fff;
  983. margin: 16rpx;
  984. border-radius: 16rpx;
  985. padding: 20rpx;
  986. }
  987. .section-header {
  988. display: flex;
  989. justify-content: space-between;
  990. align-items: center;
  991. margin-bottom: 20rpx;
  992. }
  993. .section-title {
  994. font-size: 32rpx;
  995. color: #333;
  996. }
  997. .more {
  998. font-size: 24rpx;
  999. color: #666;
  1000. }
  1001. .store-item {
  1002. display: flex;
  1003. align-items: center;
  1004. justify-content: flex-start;
  1005. padding: 16rpx;
  1006. // border-bottom: 2rpx solid #f0f0f0;
  1007. background-color: #f9f7f0;
  1008. border-radius: 16rpx;
  1009. }
  1010. .store-item:last-child {
  1011. border-bottom: none;
  1012. }
  1013. .store-logo {
  1014. width: 100rpx;
  1015. height: 100rpx;
  1016. margin-right: 16rpx;
  1017. .img {
  1018. width: 100rpx;
  1019. height: 100rpx;
  1020. border-radius: 8rpx;
  1021. }
  1022. }
  1023. .store-name {
  1024. font-size: 32rpx;
  1025. font-weight: bold;
  1026. color: #333;
  1027. margin-bottom: 10rpx;
  1028. display: block;
  1029. }
  1030. .store-desc {
  1031. font-size: 24rpx;
  1032. color: #666;
  1033. display: block;
  1034. }
  1035. /* 订单状态 */
  1036. .order-status {
  1037. display: flex;
  1038. justify-content: space-between;
  1039. }
  1040. .status-item {
  1041. text-align: center;
  1042. flex: 1;
  1043. }
  1044. .status-icon {
  1045. .img {
  1046. width: 60rpx;
  1047. height: 60rpx;
  1048. }
  1049. }
  1050. .status-name {
  1051. font-size: 24rpx;
  1052. color: #333;
  1053. }
  1054. /* 常用功能 */
  1055. .common-functions .functions {
  1056. grid-template-columns: repeat(4, 1fr);
  1057. }
  1058. .page-title {
  1059. font-size: 36rpx;
  1060. color: #333;
  1061. }
  1062. .callService {
  1063. padding: 20px 10px 0px;
  1064. // background-color: #ddcca3;
  1065. display: flex;
  1066. justify-content: center;
  1067. flex-direction: column;
  1068. font-size: 16px;
  1069. margin-bottom: 30rpx;
  1070. .list-box {
  1071. background: #fff;
  1072. border-radius: 20px;
  1073. .list-item {
  1074. width: 100%;
  1075. height: 100rpx;
  1076. display: flex;
  1077. justify-content: center;
  1078. align-items: center;
  1079. border-bottom: 1px solid #e1e1e1;
  1080. }
  1081. }
  1082. }
  1083. .intro {
  1084. display: flex;
  1085. align-items: center;
  1086. .item {
  1087. color: #333;
  1088. font-size: 24rpx;
  1089. padding: 0 16rpx;
  1090. line-height: 40rpx;
  1091. margin-right: 16rpx;
  1092. background: #fef8e6;
  1093. border-radius: 8rpx;
  1094. &:last-child {
  1095. margin-right: 0;
  1096. }
  1097. }
  1098. }
  1099. </style>