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