dapan.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. <template>
  2. <view class="container">
  3. <view class="status">
  4. <uni-icons
  5. customPrefix="iconfont"
  6. color="#fff"
  7. type="icon-24gf-clockCircle"
  8. size="18"
  9. ></uni-icons>
  10. <span class="time" style="margin-left: 10px">
  11. {{ timeFormat(timestamp, "yyyy-mm-dd hh:MM:ss") }}
  12. </span>
  13. <span
  14. class="status-right"
  15. style="margin-left: 10px"
  16. :class="{ active: isWeekend }"
  17. >
  18. {{ isWeekend ? "闭盘" : "开盘" }}
  19. </span>
  20. </view>
  21. <view class="notice-box">
  22. <view class="iconfont icon-tixing"></view>
  23. <up-notice-bar
  24. icon=""
  25. :text="text1"
  26. :step="true"
  27. bgColor="#fff"
  28. color="#000"
  29. ></up-notice-bar>
  30. </view>
  31. <view class="home">
  32. <view class="page">
  33. <view class="tab_header">
  34. <view class="col col-one">商品</view>
  35. <view class="col" style="width: calc(100% / 13 * 3)">回购</view>
  36. <view class="col" style="width: calc(100% / 13 * 3)">销售</view>
  37. <view class="col col-four" style="width: calc(100% / 13 * 3)"
  38. >高/低</view
  39. >
  40. </view>
  41. <view class="tab_content">
  42. <!-- VIP 区域 -->
  43. <view class="theme-container">
  44. <view class="horizontal-title">VIP</view>
  45. <view class="theme-item">
  46. <!-- 黄金 -->
  47. <view class="price-table-row">
  48. <view class="col" style="width: calc(100% / 13 * 3)">
  49. <view class="name symbol-name">黄金</view>
  50. </view>
  51. <!-- 回购价(动态颜色) -->
  52. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  53. <view
  54. class="sall symbol-name"
  55. :class="{
  56. 'symbol-price-rise': vipGoldRecycleStatus === 'rise',
  57. 'symbol-price-fall': vipGoldRecycleStatus === 'down',
  58. }"
  59. >
  60. {{ vipRealGoldRecyclePrice.toFixed(2) }}
  61. </view>
  62. </view>
  63. <!-- 销售价(动态颜色) -->
  64. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  65. <view
  66. class="back symbol-name"
  67. :class="{
  68. 'symbol-price-rise': vipGoldSellStatus === 'rise',
  69. 'symbol-price-fall': vipGoldSellStatus === 'down',
  70. }"
  71. >
  72. {{ viprealGoldprice.toFixed(2) }}
  73. </view>
  74. </view>
  75. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  76. <view class="symbole-price">
  77. <view class="symbol-price-rise">{{
  78. vipGoldTodayHigh.toFixed(2)
  79. }}</view>
  80. <view class="symbol-price-fall fall">{{
  81. vipGoldTodayLow.toFixed(2)
  82. }}</view>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- K金 -->
  87. <view class="price-table-row">
  88. <view class="col" style="width: calc(100% / 13 * 3)">
  89. <view class="name symbol-name">K金</view>
  90. </view>
  91. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  92. <view
  93. class="sall symbol-name"
  94. :class="{
  95. 'symbol-price-rise': vipKGoldRecycleStatus === 'rise',
  96. 'symbol-price-fall': vipKGoldRecycleStatus === 'down',
  97. }"
  98. >
  99. {{ viprealKGoldRecyclePrice.toFixed(2) }}
  100. </view>
  101. </view>
  102. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  103. <view
  104. class="back symbol-name"
  105. :class="{
  106. 'symbol-price-rise': vipKGoldSellStatus === 'rise',
  107. 'symbol-price-fall': vipKGoldSellStatus === 'down',
  108. }"
  109. >
  110. {{ viprealKGoldprice.toFixed(2) }}
  111. </view>
  112. </view>
  113. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  114. <view class="symbole-price">
  115. <view class="symbol-price-rise">{{
  116. vipkGoldTodayHigh.toFixed(2)
  117. }}</view>
  118. <view class="symbol-price-fall fall">{{
  119. vipkGoldTodayLow.toFixed(2)
  120. }}</view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 铂金 -->
  125. <view class="price-table-row">
  126. <view class="col" style="width: calc(100% / 13 * 3)">
  127. <view class="name symbol-name">铂金</view>
  128. </view>
  129. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  130. <view
  131. class="sall symbol-name"
  132. :class="{
  133. 'symbol-price-rise': vipPtRecycleStatus === 'rise',
  134. 'symbol-price-fall': vipPtRecycleStatus === 'down',
  135. }"
  136. >
  137. {{ viprealPtRecyclePrice.toFixed(2) }}
  138. </view>
  139. </view>
  140. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  141. <view
  142. class="back symbol-name"
  143. :class="{
  144. 'symbol-price-rise': vipPtSellStatus === 'rise',
  145. 'symbol-price-fall': vipPtSellStatus === 'down',
  146. }"
  147. >
  148. {{ viprealPtprice.toFixed(2) }}
  149. </view>
  150. </view>
  151. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  152. <view class="symbole-price">
  153. <view class="symbol-price-rise">{{
  154. vipptTodayHigh.toFixed(2)
  155. }}</view>
  156. <view class="symbol-price-fall fall">{{
  157. vipptTodayLow.toFixed(2)
  158. }}</view>
  159. </view>
  160. </view>
  161. </view>
  162. <!-- 白银 -->
  163. <view class="price-table-row">
  164. <view class="col" style="width: calc(100% / 13 * 3)">
  165. <view class="name symbol-name">白银</view>
  166. </view>
  167. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  168. <view
  169. class="sall symbol-name"
  170. :class="{
  171. 'symbol-price-rise': vipAgRecycleStatus === 'rise',
  172. 'symbol-price-fall': vipAgRecycleStatus === 'down',
  173. }"
  174. >
  175. {{ viprealAgRecyclePrice.toFixed(2) }}
  176. </view>
  177. </view>
  178. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  179. <view
  180. class="back symbol-name"
  181. :class="{
  182. 'symbol-price-rise': vipAgSellStatus === 'rise',
  183. 'symbol-price-fall': vipAgSellStatus === 'down',
  184. }"
  185. >
  186. {{ viprealAgprice.toFixed(2) }}
  187. </view>
  188. </view>
  189. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  190. <view class="symbole-price">
  191. <view class="symbol-price-rise">{{
  192. vipagTodayHigh.toFixed(2)
  193. }}</view>
  194. <view class="symbol-price-fall fall">{{
  195. vipagTodayLow.toFixed(2)
  196. }}</view>
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. </view>
  202. <!-- SVIP 区域 -->
  203. <view class="theme-container">
  204. <view class="horizontal-title">SVIP</view>
  205. <view class="theme-item">
  206. <!-- 黄金 -->
  207. <view class="price-table-row">
  208. <view class="col" style="width: calc(100% / 13 * 3)">
  209. <view class="name symbol-name">黄金</view>
  210. </view>
  211. <!-- SVIP回购价(动态颜色) -->
  212. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  213. <view
  214. class="sall symbol-name"
  215. :class="{
  216. 'symbol-price-rise': svipGoldRecycleStatus === 'rise',
  217. 'symbol-price-fall': svipGoldRecycleStatus === 'down',
  218. }"
  219. >
  220. {{ svipRealGoldRecyclePrice.toFixed(2) }}
  221. </view>
  222. </view>
  223. <!-- SVIP销售价(复用VIP销售价状态) -->
  224. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  225. <view
  226. class="back symbol-name"
  227. :class="{
  228. 'symbol-price-rise': vipGoldSellStatus === 'rise',
  229. 'symbol-price-fall': vipGoldSellStatus === 'down',
  230. }"
  231. >
  232. {{ viprealGoldprice.toFixed(2) }}
  233. </view>
  234. </view>
  235. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  236. <view class="symbole-price">
  237. <view class="symbol-price-rise">{{
  238. vipGoldTodayHigh.toFixed(2)
  239. }}</view>
  240. <view class="symbol-price-fall fall">{{
  241. vipGoldTodayLow.toFixed(2)
  242. }}</view>
  243. </view>
  244. </view>
  245. </view>
  246. <!-- K金 -->
  247. <view class="price-table-row">
  248. <view class="col" style="width: calc(100% / 13 * 3)">
  249. <view class="name symbol-name">K金</view>
  250. </view>
  251. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  252. <view
  253. class="sall symbol-name"
  254. :class="{
  255. 'symbol-price-rise': svipKGoldRecycleStatus === 'rise',
  256. 'symbol-price-fall': svipKGoldRecycleStatus === 'down',
  257. }"
  258. >
  259. {{ sviprealKGoldRecyclePrice.toFixed(2) }}
  260. </view>
  261. </view>
  262. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  263. <view
  264. class="back symbol-name"
  265. :class="{
  266. 'symbol-price-rise': vipKGoldSellStatus === 'rise',
  267. 'symbol-price-fall': vipKGoldSellStatus === 'down',
  268. }"
  269. >
  270. {{ viprealKGoldprice.toFixed(2) }}
  271. </view>
  272. </view>
  273. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  274. <view class="symbole-price">
  275. <view class="symbol-price-rise">{{
  276. vipkGoldTodayHigh.toFixed(2)
  277. }}</view>
  278. <view class="symbol-price-fall fall">{{
  279. vipkGoldTodayLow.toFixed(2)
  280. }}</view>
  281. </view>
  282. </view>
  283. </view>
  284. <!-- 铂金 -->
  285. <view class="price-table-row">
  286. <view class="col" style="width: calc(100% / 13 * 3)">
  287. <view class="name symbol-name">铂金</view>
  288. </view>
  289. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  290. <view
  291. class="sall symbol-name"
  292. :class="{
  293. 'symbol-price-rise': svipPtRecycleStatus === 'rise',
  294. 'symbol-price-fall': svipPtRecycleStatus === 'down',
  295. }"
  296. >
  297. {{ sviprealPtRecyclePrice.toFixed(2) }}
  298. </view>
  299. </view>
  300. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  301. <view
  302. class="back symbol-name"
  303. :class="{
  304. 'symbol-price-rise': vipPtSellStatus === 'rise',
  305. 'symbol-price-fall': vipPtSellStatus === 'down',
  306. }"
  307. >
  308. {{ viprealPtprice.toFixed(2) }}
  309. </view>
  310. </view>
  311. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  312. <view class="symbole-price">
  313. <view class="symbol-price-rise">{{
  314. vipptTodayHigh.toFixed(2)
  315. }}</view>
  316. <view class="symbol-price-fall fall">{{
  317. vipptTodayLow.toFixed(2)
  318. }}</view>
  319. </view>
  320. </view>
  321. </view>
  322. <!-- 白银 -->
  323. <view class="price-table-row">
  324. <view class="col" style="width: calc(100% / 13 * 3)">
  325. <view class="name symbol-name">白银</view>
  326. </view>
  327. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  328. <view
  329. class="sall symbol-name"
  330. :class="{
  331. 'symbol-price-rise': svipAgRecycleStatus === 'rise',
  332. 'symbol-price-fall': svipAgRecycleStatus === 'down',
  333. }"
  334. >
  335. {{ sviprealAgRecyclePrice.toFixed(2) }}
  336. </view>
  337. </view>
  338. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  339. <view
  340. class="back symbol-name"
  341. :class="{
  342. 'symbol-price-rise': vipAgSellStatus === 'rise',
  343. 'symbol-price-fall': vipAgSellStatus === 'down',
  344. }"
  345. >
  346. {{ viprealAgprice.toFixed(2) }}
  347. </view>
  348. </view>
  349. <view class="col" style="width: calc(100% / 13 * (10 / 3))">
  350. <view class="symbole-price">
  351. <view class="symbol-price-rise">{{
  352. vipagTodayHigh.toFixed(2)
  353. }}</view>
  354. <view class="symbol-price-fall fall">{{
  355. vipagTodayLow.toFixed(2)
  356. }}</view>
  357. </view>
  358. </view>
  359. </view>
  360. </view>
  361. </view>
  362. <view class="tips">
  363. <view>会员等级在此基础上有优惠,等级越高,</view>
  364. <view>买卖金价格越划算,以上数据仅供参考!</view>
  365. <!-- <view @click="navigate">点击查看详情</view> -->
  366. </view>
  367. <view class="pageFooter">
  368. <view class="item">
  369. <view class="address">
  370. <view
  371. >{{ appStore.$wxConfig.mailerName }} :{{
  372. appStore.$wxConfig.mailerPhone
  373. }}</view
  374. >
  375. <view class="address-detail" style="margin-top: 4px">
  376. <text class="receive-address">地址:</text>
  377. {{ appStore.$wxConfig.mailingAddress }}
  378. </view>
  379. </view>
  380. </view>
  381. </view>
  382. </view>
  383. </view>
  384. </view>
  385. </view>
  386. </template>
  387. <script setup>
  388. import { ref, computed, watch, nextTick } from "vue";
  389. import { onLoad } from "@dcloudio/uni-app";
  390. import { timeFormat } from "@/uni_modules/uview-plus";
  391. import { useRealtimeTimestamp } from "@/utils/useRealtimeTimestamp.js";
  392. import { useAppStore } from "@/stores/app";
  393. import { getUserLevelInfo } from "@/api/user";
  394. import useRealGoldPrice from "@/hooks/useRealGoldPrice";
  395. import { useToast } from "@/hooks/useToast";
  396. const { Toast } = useToast();
  397. // 全局状态和时间
  398. const appStore = useAppStore();
  399. const { timestamp } = useRealtimeTimestamp();
  400. const contactHandle = () => {
  401. uni.navigateTo({ url: "/pages/message_create/message_create" });
  402. };
  403. // 点击查看详情
  404. const navigate = () => {
  405. uni.navigateTo({ url: "/pages/VIP/VIP" });
  406. };
  407. // 配置滚动文字
  408. const text1 = ref(["以下行情仅供参考", "更多详情咨询与客服联系"]);
  409. // 实时价格处理
  410. const {
  411. realGoldprice, // 黄金实时销售价(基础)
  412. goldTodayHigh, // 黄金最高价
  413. goldTodayLow, // 黄金最低价
  414. realPtprice, // 铂金实时销售价(基础)
  415. ptTodayHigh, // 铂金最高价
  416. ptTodayLow, // 铂金最低价
  417. realAgprice, // 白银实时销售价(基础)
  418. agTodayHigh, // 白银最高价
  419. agTodayLow, // 白银最低价
  420. realKGoldprice, // K金实时销售价(基础)
  421. kGoldTodayHigh, // K金最高价
  422. kGoldTodayLow, // K金最低价
  423. realGoldRecyclePrice, // 黄金实时回收价(基础)
  424. realPtRecyclePrice, // 铂金实时回收价(基础)
  425. realAgRecyclePrice, // 白银实时回收价(基础)
  426. realKGoldRecyclePrice, // K金实时回收价(基础)
  427. } = useRealGoldPrice({});
  428. // 用户权益数据
  429. const userBenefits = ref({});
  430. const adjustGoldPrice = ref({});
  431. const adjustKgoldPrice = ref({});
  432. const adjustPtPrice = ref({});
  433. const adjustAgPrice = ref({});
  434. onLoad(() => {
  435. getUserBenefits();
  436. });
  437. const getUserBenefits = async () => {
  438. try {
  439. const res = await getUserLevelInfo(appStore?.userInfo?.userId || 0);
  440. userBenefits.value = res.data || { sold: 0, buy: 0 }; // 默认权益为0,避免NaN
  441. if (
  442. userBenefits?.value?.nobleMeta &&
  443. userBenefits.value.nobleMeta.length > 0
  444. ) {
  445. const nobleMeta = userBenefits.value.nobleMeta;
  446. nobleMeta.forEach((item) => {
  447. switch (item.name) {
  448. case "黄金":
  449. adjustGoldPrice.value = item;
  450. break;
  451. case "K金":
  452. adjustKgoldPrice.value = item;
  453. break;
  454. case "铂金":
  455. adjustPtPrice.value = item;
  456. break;
  457. case "白银":
  458. adjustAgPrice.value = item;
  459. break;
  460. default:
  461. break;
  462. }
  463. });
  464. }
  465. } catch (error) {
  466. console.error("获取用户权益失败:", error);
  467. userBenefits.value = { sold: 0, buy: 0 }; // 出错时默认权益为0
  468. }
  469. };
  470. // VIP 价格计算
  471. const vipRealGoldRecyclePrice = computed(() => {
  472. // console.log("vipRealGoldRecyclePrice", realGoldRecyclePrice.value);
  473. // console.log("userBenefits", userBenefits.value.sold);
  474. // console.log("adjustGoldPrice", adjustGoldPrice.value.buyPriceAdjust);
  475. return (
  476. Number(realGoldRecyclePrice.value) +
  477. Number(userBenefits.value.sold) -
  478. Number(adjustGoldPrice.value.buyPriceAdjust)
  479. );
  480. });
  481. const viprealGoldprice = computed(
  482. () =>
  483. Number(realGoldprice.value) -
  484. Number(userBenefits.value.buy) +
  485. Number(adjustGoldPrice.value.sellPriceAdjust)
  486. );
  487. const viprealKGoldRecyclePrice = computed(
  488. () =>
  489. Number(realKGoldRecyclePrice.value) +
  490. Number(userBenefits.value.sold) -
  491. Number(adjustKgoldPrice.value.buyPriceAdjust)
  492. );
  493. const viprealKGoldprice = computed(
  494. () =>
  495. Number(realKGoldprice.value) -
  496. Number(userBenefits.value.buy) +
  497. Number(adjustKgoldPrice.value.sellPriceAdjust)
  498. );
  499. const viprealPtRecyclePrice = computed(
  500. () =>
  501. Number(realPtRecyclePrice.value) +
  502. Number(userBenefits.value.sold) -
  503. Number(adjustPtPrice.value.buyPriceAdjust)
  504. );
  505. const viprealPtprice = computed(
  506. () =>
  507. Number(realPtprice.value) -
  508. Number(userBenefits.value.buy) +
  509. Number(adjustPtPrice.value.sellPriceAdjust)
  510. );
  511. const viprealAgRecyclePrice = computed(
  512. () =>
  513. Number(realAgRecyclePrice.value) +
  514. Number(userBenefits.value.sold) -
  515. Number(adjustAgPrice.value.buyPriceAdjust)
  516. );
  517. const viprealAgprice = computed(
  518. () =>
  519. Number(realAgprice.value) -
  520. Number(userBenefits.value.buy) +
  521. Number(adjustAgPrice.value.sellPriceAdjust)
  522. );
  523. // SVIP 价格计算(回购价多+0.3,销售价复用VIP)
  524. const svipRealGoldRecyclePrice = computed(
  525. () => vipRealGoldRecyclePrice.value + 0.3
  526. );
  527. const sviprealKGoldRecyclePrice = computed(
  528. () => viprealKGoldRecyclePrice.value + 0.3
  529. );
  530. const sviprealPtRecyclePrice = computed(
  531. () => viprealPtRecyclePrice.value + 0.3
  532. );
  533. const sviprealAgRecyclePrice = computed(
  534. () => viprealAgRecyclePrice.value + 0.3
  535. );
  536. // 高低价计算
  537. const vipGoldTodayHigh = computed(
  538. () =>
  539. Number(goldTodayHigh.value) -
  540. Number(userBenefits.value.buy) +
  541. Number(adjustGoldPrice.value.sellPriceAdjust)
  542. );
  543. const vipGoldTodayLow = computed(
  544. () =>
  545. Number(goldTodayLow.value) -
  546. Number(userBenefits.value.buy) +
  547. Number(adjustGoldPrice.value.sellPriceAdjust)
  548. );
  549. const vipkGoldTodayHigh = computed(
  550. () =>
  551. Number(kGoldTodayHigh.value) -
  552. Number(userBenefits.value.buy) +
  553. Number(adjustKgoldPrice.value.sellPriceAdjust)
  554. );
  555. const vipkGoldTodayLow = computed(
  556. () =>
  557. Number(kGoldTodayLow.value) -
  558. Number(userBenefits.value.buy) +
  559. Number(adjustKgoldPrice.value.sellPriceAdjust)
  560. );
  561. const vipptTodayHigh = computed(
  562. () =>
  563. Number(ptTodayHigh.value) -
  564. Number(userBenefits.value.buy) +
  565. Number(adjustPtPrice.value.sellPriceAdjust)
  566. );
  567. const vipptTodayLow = computed(
  568. () =>
  569. Number(ptTodayLow.value) -
  570. Number(userBenefits.value.buy) +
  571. Number(adjustPtPrice.value.sellPriceAdjust)
  572. );
  573. const vipagTodayHigh = computed(
  574. () =>
  575. Number(agTodayHigh.value) -
  576. Number(userBenefits.value.buy) +
  577. Number(adjustAgPrice.value.sellPriceAdjust)
  578. );
  579. const vipagTodayLow = computed(
  580. () =>
  581. Number(agTodayLow.value) -
  582. Number(userBenefits.value.buy) +
  583. Number(adjustAgPrice.value.sellPriceAdjust)
  584. );
  585. // 判断是否为周末(周六6/周日0)
  586. const isWeekend = computed(() => {
  587. const date = new Date(timestamp.value);
  588. const day = date.getDay();
  589. return day === 0 || day === 6;
  590. });
  591. // 历史价格记录(用于对比变动)
  592. // VIP 历史价
  593. const vipGoldRecyclePrev = ref(0); // VIP黄金回购价-历史
  594. const vipGoldSellPrev = ref(0); // VIP黄金销售价-历史
  595. const vipKGoldRecyclePrev = ref(0); // VIP K金回购价-历史
  596. const vipKGoldSellPrev = ref(0); // VIP K金销售价-历史
  597. const vipPtRecyclePrev = ref(0); // VIP 铂金回购价-历史
  598. const vipPtSellPrev = ref(0); // VIP 铂金销售价-历史
  599. const vipAgRecyclePrev = ref(0); // VIP 白银回购价-历史
  600. const vipAgSellPrev = ref(0); // VIP 白银销售价-历史
  601. // SVIP 历史价(仅回购价,销售价复用VIP)
  602. const svipGoldRecyclePrev = ref(0);
  603. const svipKGoldRecyclePrev = ref(0);
  604. const svipPtRecyclePrev = ref(0);
  605. const svipAgRecyclePrev = ref(0);
  606. // 监听实时价格更新,用nextTick延迟更新历史价(关键修复)
  607. // VIP 价格监听
  608. watch(vipRealGoldRecyclePrice, async (newVal, oldVal) => {
  609. if (newVal === 0) return; // 排除初始0值
  610. await nextTick(); // 等待状态计算完成后再更新历史值
  611. vipGoldRecyclePrev.value = oldVal;
  612. });
  613. watch(viprealGoldprice, async (newVal, oldVal) => {
  614. if (newVal === 0) return;
  615. await nextTick();
  616. vipGoldSellPrev.value = oldVal;
  617. });
  618. watch(viprealKGoldRecyclePrice, async (newVal, oldVal) => {
  619. if (newVal === 0) return;
  620. await nextTick();
  621. vipKGoldRecyclePrev.value = oldVal;
  622. });
  623. watch(viprealKGoldprice, async (newVal, oldVal) => {
  624. if (newVal === 0) return;
  625. await nextTick();
  626. vipKGoldSellPrev.value = oldVal;
  627. });
  628. watch(viprealPtRecyclePrice, async (newVal, oldVal) => {
  629. if (newVal === 0) return;
  630. await nextTick();
  631. vipPtRecyclePrev.value = oldVal;
  632. });
  633. watch(viprealPtprice, async (newVal, oldVal) => {
  634. if (newVal === 0) return;
  635. await nextTick();
  636. vipPtSellPrev.value = oldVal;
  637. });
  638. watch(viprealAgRecyclePrice, async (newVal, oldVal) => {
  639. if (newVal === 0) return;
  640. await nextTick();
  641. vipAgRecyclePrev.value = oldVal;
  642. });
  643. watch(viprealAgprice, async (newVal, oldVal) => {
  644. if (newVal === 0) return;
  645. await nextTick();
  646. vipAgSellPrev.value = oldVal;
  647. });
  648. // SVIP 价格监听(仅回购价)
  649. watch(svipRealGoldRecyclePrice, async (newVal, oldVal) => {
  650. // 排除初始无权益时的0.3
  651. if (Math.abs(newVal - 0.3) < 0.001) return;
  652. await nextTick();
  653. svipGoldRecyclePrev.value = oldVal;
  654. });
  655. watch(sviprealKGoldRecyclePrice, async (newVal, oldVal) => {
  656. if (Math.abs(newVal - 0.3) < 0.001) return;
  657. await nextTick();
  658. svipKGoldRecyclePrev.value = oldVal;
  659. });
  660. watch(sviprealPtRecyclePrice, async (newVal, oldVal) => {
  661. if (Math.abs(newVal - 0.3) < 0.001) return;
  662. await nextTick();
  663. svipPtRecyclePrev.value = oldVal;
  664. });
  665. watch(sviprealAgRecyclePrice, async (newVal, oldVal) => {
  666. if (Math.abs(newVal - 0.3) < 0.001) return;
  667. await nextTick();
  668. svipAgRecyclePrev.value = oldVal;
  669. });
  670. // 计算价格变动状态(rise=上升红,down=下降绿,unchanged=不变保持原色)
  671. // VIP 状态
  672. const vipGoldRecycleStatus = computed(() => {
  673. const curr = vipRealGoldRecyclePrice.value;
  674. const prev = vipGoldRecyclePrev.value;
  675. // console.log(curr, prev);
  676. if (prev === 0) return "unchanged"; // 初始状态不显示颜色
  677. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  678. });
  679. const vipGoldSellStatus = computed(() => {
  680. const curr = viprealGoldprice.value;
  681. const prev = vipGoldSellPrev.value;
  682. if (prev === 0) return "unchanged";
  683. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  684. });
  685. const vipKGoldRecycleStatus = computed(() => {
  686. const curr = viprealKGoldRecyclePrice.value;
  687. const prev = vipKGoldRecyclePrev.value;
  688. if (prev === 0) return "unchanged";
  689. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  690. });
  691. const vipKGoldSellStatus = computed(() => {
  692. const curr = viprealKGoldprice.value;
  693. const prev = vipKGoldSellPrev.value;
  694. if (prev === 0) return "unchanged";
  695. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  696. });
  697. const vipPtRecycleStatus = computed(() => {
  698. const curr = viprealPtRecyclePrice.value;
  699. const prev = vipPtRecyclePrev.value;
  700. if (prev === 0) return "unchanged";
  701. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  702. });
  703. const vipPtSellStatus = computed(() => {
  704. const curr = viprealPtprice.value;
  705. const prev = vipPtSellPrev.value;
  706. if (prev === 0) return "unchanged";
  707. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  708. });
  709. const vipAgRecycleStatus = computed(() => {
  710. const curr = viprealAgRecyclePrice.value;
  711. const prev = vipAgRecyclePrev.value;
  712. if (prev === 0) return "unchanged";
  713. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  714. });
  715. const vipAgSellStatus = computed(() => {
  716. const curr = viprealAgprice.value;
  717. const prev = vipAgSellPrev.value;
  718. if (prev === 0) return "unchanged";
  719. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  720. });
  721. // SVIP 状态(仅回购价)
  722. const svipGoldRecycleStatus = computed(() => {
  723. const curr = svipRealGoldRecyclePrice.value;
  724. const prev = svipGoldRecyclePrev.value;
  725. if (prev === 0) return "unchanged";
  726. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  727. });
  728. const svipKGoldRecycleStatus = computed(() => {
  729. const curr = sviprealKGoldRecyclePrice.value;
  730. const prev = svipKGoldRecyclePrev.value;
  731. if (prev === 0) return "unchanged";
  732. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  733. });
  734. const svipPtRecycleStatus = computed(() => {
  735. const curr = sviprealPtRecyclePrice.value;
  736. const prev = svipPtRecyclePrev.value;
  737. if (prev === 0) return "unchanged";
  738. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  739. });
  740. const svipAgRecycleStatus = computed(() => {
  741. const curr = sviprealAgRecyclePrice.value;
  742. const prev = svipAgRecyclePrev.value;
  743. if (prev === 0) return "unchanged";
  744. return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
  745. });
  746. </script>
  747. <style lang="scss" scoped>
  748. page {
  749. height: 100%;
  750. background: #252525 !important;
  751. }
  752. .callService {
  753. padding: 20px 10px 0px;
  754. // background-color: #ddcca3;
  755. display: flex;
  756. justify-content: center;
  757. flex-direction: column;
  758. font-size: 16px;
  759. // margin-bottom: 30rpx;
  760. .list-box {
  761. background: #fff;
  762. border-radius: 20px;
  763. .list-item {
  764. width: 100%;
  765. height: 100rpx;
  766. display: flex;
  767. justify-content: center;
  768. align-items: center;
  769. border-bottom: 1px solid #e1e1e1;
  770. }
  771. }
  772. }
  773. .notice-box {
  774. width: 98%;
  775. margin: 0 auto;
  776. background: #ffffff;
  777. display: flex;
  778. padding: 8rpx 30rpx;
  779. border-radius: 10rpx;
  780. // height: ;
  781. align-items: center;
  782. .iconfont {
  783. width: 44rpx;
  784. height: 44rpx;
  785. border-radius: 50%;
  786. text-align: center;
  787. line-height: 44rpx;
  788. // background-color: #fe960f;
  789. color: #000;
  790. font-size: 30rpx;
  791. margin-right: 15rpx;
  792. &.icon-wechat {
  793. background-color: #41b035;
  794. }
  795. &.icon-zhifubao {
  796. background-color: #06b4fd;
  797. }
  798. }
  799. }
  800. .status {
  801. margin: 20rpx 0;
  802. .time {
  803. font-size: 26rpx;
  804. }
  805. .status-right {
  806. font-size: 30rpx;
  807. color: #33cc33;
  808. &.active {
  809. color: red;
  810. }
  811. }
  812. }
  813. .address-container {
  814. display: flex;
  815. .address {
  816. width: 100rpx;
  817. }
  818. }
  819. .tips {
  820. font-size: 26rpx;
  821. color: #d8bb7d;
  822. text-align: center;
  823. line-height: 1.8;
  824. margin-top: 20rpx;
  825. }
  826. .price-table-row-not {
  827. display: none !important;
  828. }
  829. ::v-deep .center {
  830. height: 100%;
  831. display: flex;
  832. flex-direction: column;
  833. justify-content: center;
  834. align-items: center;
  835. }
  836. .divider {
  837. width: 100%;
  838. line-height: 1px;
  839. height: 1px;
  840. background-color: #999;
  841. }
  842. .divider2 {
  843. width: 100%;
  844. height: 3px;
  845. background-color: #000;
  846. }
  847. .container {
  848. height: 100%;
  849. max-width: 100% !important;
  850. display: flex;
  851. flex-direction: column;
  852. background: #252525 !important;
  853. .status {
  854. text-align: right;
  855. padding-top: 3px;
  856. padding-right: 10px;
  857. display: inline-block;
  858. color: red !important;
  859. background: #252525 !important;
  860. font-size: 15px;
  861. }
  862. }
  863. .header {
  864. display: flex;
  865. align-items: center;
  866. padding: 4px;
  867. }
  868. .page,
  869. .header {
  870. background: #fff !important;
  871. }
  872. .home {
  873. height: 100%;
  874. flex-grow: 1;
  875. overflow: auto;
  876. color: #fff;
  877. margin-top: 5px;
  878. .page {
  879. background: #18293a;
  880. overflow: auto;
  881. box-sizing: border-box;
  882. position: relative;
  883. .tab_header {
  884. display: flex;
  885. background: #b5aa90;
  886. font-size: 16px;
  887. width: 100%;
  888. justify-content: space-between;
  889. align-items: center;
  890. box-sizing: border-box;
  891. &.white {
  892. background-color: #fff;
  893. }
  894. .col {
  895. text-align: center;
  896. padding: 24rpx 0;
  897. line-height: 23px;
  898. }
  899. .col-one {
  900. width: 245rpx;
  901. box-sizing: border-box;
  902. padding-left: 46rpx;
  903. }
  904. }
  905. .theme-container {
  906. display: flex;
  907. border-bottom: 4rpx solid #000;
  908. .horizontal-title {
  909. color: #000;
  910. background-color: #e6e6e6;
  911. font-size: 14px;
  912. width: 86rpx;
  913. text-align: center;
  914. word-break: break-all;
  915. -webkit-box-sizing: border-box;
  916. box-sizing: border-box;
  917. display: flex;
  918. justify-content: center;
  919. align-items: center;
  920. border-right: 2rpx solid #999;
  921. font-weight: 500;
  922. }
  923. .theme-item {
  924. flex-grow: 1;
  925. flex-shrink: 1;
  926. .ditem {
  927. &.greywhite {
  928. background: #e6e6e6;
  929. }
  930. }
  931. }
  932. }
  933. }
  934. }
  935. .tab_header .col {
  936. border-bottom: 1px solid #999;
  937. }
  938. .tab_content .col {
  939. border-right: 1px solid #999;
  940. text-align: center;
  941. &:last-child {
  942. border: none;
  943. }
  944. }
  945. .tab_content {
  946. overflow-y: auto;
  947. .price-table-row {
  948. display: flex;
  949. justify-content: center;
  950. color: #808080;
  951. height: 55px;
  952. &:nth-child(2n) {
  953. background: #e6e6e6 !important;
  954. }
  955. }
  956. .name {
  957. color: #000 !important;
  958. }
  959. .col {
  960. padding: 3px 0;
  961. line-height: 23px;
  962. display: flex;
  963. justify-content: center;
  964. align-items: center;
  965. color: #000;
  966. }
  967. .symbol-name {
  968. font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
  969. font-size: 30rpx;
  970. color: #ff0000;
  971. }
  972. .symbole-price {
  973. width: 100%;
  974. font-size: 30rpx;
  975. }
  976. }
  977. .btn-container {
  978. display: flex;
  979. align-items: center;
  980. justify-content: center;
  981. height: 60rpx;
  982. width: 40%;
  983. font-size: 30rpx;
  984. background-color: #cc9931;
  985. color: #ffffff;
  986. border-radius: 100rpx;
  987. margin: 60rpx auto 20rpx;
  988. .btn-image {
  989. width: 30rpx;
  990. margin-left: 10rpx;
  991. }
  992. /* 移除button默认样式 */
  993. button::after {
  994. border: none;
  995. }
  996. /* 自定义按钮样式 */
  997. .btn {
  998. -webkit-appearance: none;
  999. width: 164rpx;
  1000. height: 60rpx;
  1001. font-size: 26rpx;
  1002. display: flex;
  1003. align-items: center;
  1004. justify-content: center;
  1005. background-color: #cc9931;
  1006. color: #fff;
  1007. border: none;
  1008. /* 移除点击后的轮廓线 */
  1009. outline: none;
  1010. ::after {
  1011. border: 0rpx solid #cc9931;
  1012. /* 移除点击后的轮廓线 */
  1013. outline: none;
  1014. }
  1015. }
  1016. button[open-type="contact"] {
  1017. outline: none;
  1018. border: none;
  1019. box-shadow: none;
  1020. }
  1021. }
  1022. /* 价格变动颜色(上升红、下降绿,优先级确保覆盖默认色) */
  1023. .symbol-price-rise {
  1024. color: #ff0000 !important;
  1025. }
  1026. .symbol-price-fall {
  1027. color: #33cc33 !important;
  1028. }
  1029. .fall {
  1030. border-top: 2rpx solid #999;
  1031. }
  1032. .pageFooter {
  1033. background: #2c3031 !important;
  1034. padding: 35rpx 50rpx 50rpx 50rpx;
  1035. font-size: 28rpx;
  1036. }
  1037. </style>