index.vue 25 KB

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