index.vue 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  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. height: 36rpx;
  689. margin-left: 16rpx;
  690. }
  691. .vip-expire{
  692. font-size: 28rpx;
  693. color: #666;
  694. margin-bottom: 14rpx;
  695. }
  696. .btn-content {
  697. display: flex;
  698. flex-direction: column;
  699. align-items: center;
  700. justify-content: center;
  701. .setting {
  702. width: 40rpx;
  703. height: 40rpx;
  704. }
  705. .btn-text {
  706. font-size: 24rpx;
  707. color: #333;
  708. line-height: 1.5;
  709. }
  710. }
  711. /* 会员开通提示 */
  712. .vip-promote {
  713. height: 108rpx;
  714. width: 100%;
  715. height: 108rpx;
  716. padding: 0 30rpx;
  717. box-sizing: border-box;
  718. .vipBG {
  719. width: 100%;
  720. height: 100%;
  721. border-radius: 48rpx 48rpx 0 0;
  722. }
  723. .vip-text {
  724. margin-top: -108rpx;
  725. display: flex;
  726. width: 100%;
  727. justify-content: space-between;
  728. align-items: center;
  729. padding: 20rpx;
  730. box-sizing: border-box;
  731. .title {
  732. font-size: 28rpx;
  733. color: #bdad8e;
  734. display: flex;
  735. justify-content: flex-start;
  736. align-items: center;
  737. .vipIcon {
  738. width: 70rpx;
  739. height: 60rpx;
  740. margin-right: 10rpx;
  741. }
  742. .bigText {
  743. font-size: 32rpx;
  744. color: #facd8d;
  745. margin: 0 10rpx;
  746. }
  747. }
  748. .open-vip {
  749. width: 144rpx;
  750. height: 60rpx;
  751. font-size: 24rpx;
  752. color: #5d3d03;
  753. background: linear-gradient(270deg, #fee2a3 0%, #fdebcc 100%);
  754. border-radius: 16rpx 16rpx 16rpx 16rpx;
  755. display: flex;
  756. justify-content: center;
  757. align-items: center;
  758. .bofang {
  759. width: 24rpx;
  760. height: 24rpx;
  761. margin-left: 10rpx;
  762. }
  763. }
  764. }
  765. }
  766. .desc {
  767. font-size: 22rpx;
  768. opacity: 0.9;
  769. }
  770. /* 钱包余额 */
  771. .wallet-section {
  772. background: #fff;
  773. margin: -176rpx 20rpx 20rpx;
  774. border-radius: 24rpx;
  775. padding: 32rpx;
  776. }
  777. .wallet-header {
  778. display: flex;
  779. justify-content: space-between;
  780. align-items: center;
  781. margin-bottom: 20rpx;
  782. }
  783. .wallet-title {
  784. font-size: 28rpx;
  785. color: #333;
  786. }
  787. .transaction-detail {
  788. color: #666;
  789. font-size: 24rpx;
  790. display: flex;
  791. align-items: center;
  792. }
  793. .balance {
  794. font-size: 48rpx;
  795. font-weight: bold;
  796. text-align: center;
  797. margin: 10rpx 0;
  798. color: #333;
  799. }
  800. .assets {
  801. display: flex;
  802. justify-content: space-between;
  803. align-items: center;
  804. margin-top: 40rpx;
  805. flex-wrap: nowrap; /* 确保不换行 */
  806. }
  807. .asset-container {
  808. display: flex;
  809. align-items: center;
  810. flex: 1;
  811. justify-content: center;
  812. position: relative;
  813. }
  814. .asset-item {
  815. display: flex;
  816. flex-direction: column;
  817. align-items: center;
  818. flex: 1;
  819. padding: 0 20rpx;
  820. }
  821. .asset-name {
  822. font-size: 24rpx;
  823. color: #333;
  824. margin-bottom: 16rpx;
  825. text-align: center;
  826. }
  827. .asset-amount {
  828. font-size: 40rpx;
  829. font-weight: bold;
  830. color: #333;
  831. text-align: center;
  832. }
  833. .wallet-actions {
  834. display: flex;
  835. justify-content: space-between;
  836. margin-top: 50rpx;
  837. }
  838. .wallet-btn {
  839. flex: 1;
  840. font-weight: bold;
  841. text-align: center;
  842. height: 88rpx;
  843. line-height: 88rpx;
  844. margin: 0 10rpx;
  845. border-radius: 16rpx;
  846. font-size: 32rpx;
  847. }
  848. .recharge {
  849. background: #f8c008;
  850. color: #333;
  851. }
  852. .withdraw {
  853. background: rgba(248, 192, 8, 0.1);
  854. color: #333;
  855. }
  856. /* 功能入口 */
  857. .function-grid {
  858. background: #fff;
  859. margin: 30rpx;
  860. border-radius: 24rpx;
  861. padding: 40rpx;
  862. }
  863. .functions {
  864. display: grid;
  865. grid-template-columns: repeat(4, 1fr);
  866. gap: 40rpx;
  867. margin-top: 40rpx;
  868. }
  869. .function-item {
  870. text-align: center;
  871. }
  872. .function-icon {
  873. .img {
  874. width: 60rpx;
  875. height: 60rpx;
  876. }
  877. }
  878. .function-name {
  879. font-size: 24rpx;
  880. color: #333;
  881. }
  882. /* 最近访问 */
  883. .recent-visit,
  884. .order-section,
  885. .common-functions {
  886. background: #fff;
  887. margin: 16rpx;
  888. border-radius: 16rpx;
  889. padding: 20rpx;
  890. }
  891. .section-header {
  892. display: flex;
  893. justify-content: space-between;
  894. align-items: center;
  895. margin-bottom: 20rpx;
  896. }
  897. .section-title {
  898. font-size: 32rpx;
  899. color: #333;
  900. }
  901. .more {
  902. font-size: 24rpx;
  903. color: #666;
  904. }
  905. .store-item {
  906. display: flex;
  907. align-items: center;
  908. justify-content: flex-start;
  909. padding: 16rpx;
  910. // border-bottom: 2rpx solid #f0f0f0;
  911. background-color: #f9f7f0;
  912. border-radius: 16rpx;
  913. }
  914. .store-item:last-child {
  915. border-bottom: none;
  916. }
  917. .store-logo {
  918. width: 100rpx;
  919. height: 100rpx;
  920. margin-right: 16rpx;
  921. .img {
  922. width: 100rpx;
  923. height: 100rpx;
  924. border-radius: 8rpx;
  925. }
  926. }
  927. .store-name {
  928. font-size: 32rpx;
  929. font-weight: bold;
  930. color: #333;
  931. margin-bottom: 10rpx;
  932. display: block;
  933. }
  934. .store-desc {
  935. font-size: 24rpx;
  936. color: #666;
  937. display: block;
  938. }
  939. /* 订单状态 */
  940. .order-status {
  941. display: flex;
  942. justify-content: space-between;
  943. }
  944. .status-item {
  945. text-align: center;
  946. flex: 1;
  947. }
  948. .status-icon {
  949. .img {
  950. width: 60rpx;
  951. height: 60rpx;
  952. }
  953. }
  954. .status-name {
  955. font-size: 24rpx;
  956. color: #333;
  957. }
  958. /* 常用功能 */
  959. .common-functions .functions {
  960. grid-template-columns: repeat(4, 1fr);
  961. }
  962. .page-title {
  963. font-size: 36rpx;
  964. color: #333;
  965. }
  966. .callService {
  967. padding: 20px 10px 0px;
  968. // background-color: #ddcca3;
  969. display: flex;
  970. justify-content: center;
  971. flex-direction: column;
  972. font-size: 16px;
  973. margin-bottom: 30rpx;
  974. .list-box {
  975. background: #fff;
  976. border-radius: 20px;
  977. .list-item {
  978. width: 100%;
  979. height: 100rpx;
  980. display: flex;
  981. justify-content: center;
  982. align-items: center;
  983. border-bottom: 1px solid #e1e1e1;
  984. }
  985. }
  986. }
  987. .intro {
  988. display: flex;
  989. align-items: center;
  990. .item {
  991. color: #333;
  992. font-size: 24rpx;
  993. padding: 0 16rpx;
  994. line-height: 40rpx;
  995. margin-right: 16rpx;
  996. background: #FEF8E6;
  997. border-radius: 8rpx;
  998. &:last-child {
  999. margin-right: 0;
  1000. }
  1001. }
  1002. }
  1003. </style>