index.vue 27 KB

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