index.vue 27 KB

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