index.vue 27 KB

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