index.vue 27 KB

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