| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134 |
- <template>
- <view class="container">
- <view class="status">
- <uni-icons
- customPrefix="iconfont"
- color="#fff"
- type="icon-24gf-clockCircle"
- size="18"
- ></uni-icons>
- <span class="time" style="margin-left: 10px">
- {{ timeFormat(timestamp, "yyyy-mm-dd hh:MM:ss") }}
- </span>
- <span
- class="status-right"
- style="margin-left: 10px"
- :class="{ active: isWeekend }"
- >
- {{ isWeekend ? "闭盘" : "开盘" }}
- </span>
- </view>
- <view class="notice-box">
- <view class="iconfont icon-tixing"></view>
- <up-notice-bar
- icon=""
- :text="text1"
- :step="true"
- bgColor="#fff"
- color="#000"
- ></up-notice-bar>
- </view>
- <view class="home">
- <view class="page">
- <view class="tab_header">
- <view class="col col-one">商品</view>
- <view class="col" style="width: calc(100% / 13 * 3)">回购</view>
- <view class="col" style="width: calc(100% / 13 * 3)">销售</view>
- <view class="col col-four" style="width: calc(100% / 13 * 3)"
- >高/低</view
- >
- </view>
- <view class="tab_content">
- <!-- VIP 区域 -->
- <view class="theme-container">
- <view class="horizontal-title">VIP</view>
- <view class="theme-item">
- <!-- 黄金 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">黄金</view>
- </view>
- <!-- 回购价(动态颜色) -->
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': vipGoldRecycleStatus === 'rise',
- 'symbol-price-fall': vipGoldRecycleStatus === 'down',
- }"
- >
- {{ vipRealGoldRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <!-- 销售价(动态颜色) -->
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipGoldSellStatus === 'rise',
- 'symbol-price-fall': vipGoldSellStatus === 'down',
- }"
- >
- {{ viprealGoldprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipGoldTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipGoldTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- <!-- K金 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">K金</view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': vipKGoldRecycleStatus === 'rise',
- 'symbol-price-fall': vipKGoldRecycleStatus === 'down',
- }"
- >
- {{ viprealKGoldRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipKGoldSellStatus === 'rise',
- 'symbol-price-fall': vipKGoldSellStatus === 'down',
- }"
- >
- {{ viprealKGoldprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipkGoldTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipkGoldTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- <!-- 铂金 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">铂金</view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': vipPtRecycleStatus === 'rise',
- 'symbol-price-fall': vipPtRecycleStatus === 'down',
- }"
- >
- {{ viprealPtRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipPtSellStatus === 'rise',
- 'symbol-price-fall': vipPtSellStatus === 'down',
- }"
- >
- {{ viprealPtprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipptTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipptTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- <!-- 白银 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">白银</view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': vipAgRecycleStatus === 'rise',
- 'symbol-price-fall': vipAgRecycleStatus === 'down',
- }"
- >
- {{ viprealAgRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipAgSellStatus === 'rise',
- 'symbol-price-fall': vipAgSellStatus === 'down',
- }"
- >
- {{ viprealAgprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipagTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipagTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- SVIP 区域 -->
- <view class="theme-container">
- <view class="horizontal-title">SVIP</view>
- <view class="theme-item">
- <!-- 黄金 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">黄金</view>
- </view>
- <!-- SVIP回购价(动态颜色) -->
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': svipGoldRecycleStatus === 'rise',
- 'symbol-price-fall': svipGoldRecycleStatus === 'down',
- }"
- >
- {{ svipRealGoldRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <!-- SVIP销售价(复用VIP销售价状态) -->
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipGoldSellStatus === 'rise',
- 'symbol-price-fall': vipGoldSellStatus === 'down',
- }"
- >
- {{ viprealGoldprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipGoldTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipGoldTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- <!-- K金 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">K金</view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': svipKGoldRecycleStatus === 'rise',
- 'symbol-price-fall': svipKGoldRecycleStatus === 'down',
- }"
- >
- {{ sviprealKGoldRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipKGoldSellStatus === 'rise',
- 'symbol-price-fall': vipKGoldSellStatus === 'down',
- }"
- >
- {{ viprealKGoldprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipkGoldTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipkGoldTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- <!-- 铂金 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">铂金</view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': svipPtRecycleStatus === 'rise',
- 'symbol-price-fall': svipPtRecycleStatus === 'down',
- }"
- >
- {{ sviprealPtRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipPtSellStatus === 'rise',
- 'symbol-price-fall': vipPtSellStatus === 'down',
- }"
- >
- {{ viprealPtprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipptTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipptTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- <!-- 白银 -->
- <view class="price-table-row">
- <view class="col" style="width: calc(100% / 13 * 3)">
- <view class="name symbol-name">白银</view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="sall symbol-name"
- :class="{
- 'symbol-price-rise': svipAgRecycleStatus === 'rise',
- 'symbol-price-fall': svipAgRecycleStatus === 'down',
- }"
- >
- {{ sviprealAgRecyclePrice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view
- class="back symbol-name"
- :class="{
- 'symbol-price-rise': vipAgSellStatus === 'rise',
- 'symbol-price-fall': vipAgSellStatus === 'down',
- }"
- >
- {{ viprealAgprice.toFixed(2) }}
- </view>
- </view>
- <view class="col" style="width: calc(100% / 13 * (10 / 3))">
- <view class="symbole-price">
- <view class="symbol-price-rise">{{
- vipagTodayHigh.toFixed(2)
- }}</view>
- <view class="symbol-price-fall fall">{{
- vipagTodayLow.toFixed(2)
- }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="tips">
- <view>会员等级在此基础上有优惠,等级越高,</view>
- <view>买卖金价格越划算,以上数据仅供参考!</view>
- <!-- <view @click="navigate">点击查看详情</view> -->
- </view>
- <view class="pageFooter">
- <view class="item">
- <view class="address">
- <view
- >{{ appStore.$wxConfig.mailerName }} :{{
- appStore.$wxConfig.mailerPhone
- }}</view
- >
- <view class="address-detail" style="margin-top: 4px">
- <text class="receive-address">地址:</text>
- {{ appStore.$wxConfig.mailingAddress }}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref, computed, watch, nextTick } from "vue";
- import { onLoad } from "@dcloudio/uni-app";
- import { timeFormat } from "@/uni_modules/uview-plus";
- import { useRealtimeTimestamp } from "@/utils/useRealtimeTimestamp.js";
- import { useAppStore } from "@/stores/app";
- import { getUserLevelInfo } from "@/api/user";
- import useRealGoldPrice from "@/hooks/useRealGoldPrice";
- import { useToast } from "@/hooks/useToast";
- const { Toast } = useToast();
- // 全局状态和时间
- const appStore = useAppStore();
- const { timestamp } = useRealtimeTimestamp();
- const contactHandle = () => {
- uni.navigateTo({ url: "/pages/message_create/message_create" });
- };
- // 点击查看详情
- const navigate = () => {
- uni.navigateTo({ url: "/pages/VIP/VIP" });
- };
- // 配置滚动文字
- const text1 = ref(["以下行情仅供参考", "更多详情咨询与客服联系"]);
- // 实时价格处理
- const {
- realGoldprice, // 黄金实时销售价(基础)
- goldTodayHigh, // 黄金最高价
- goldTodayLow, // 黄金最低价
- realPtprice, // 铂金实时销售价(基础)
- ptTodayHigh, // 铂金最高价
- ptTodayLow, // 铂金最低价
- realAgprice, // 白银实时销售价(基础)
- agTodayHigh, // 白银最高价
- agTodayLow, // 白银最低价
- realKGoldprice, // K金实时销售价(基础)
- kGoldTodayHigh, // K金最高价
- kGoldTodayLow, // K金最低价
- realGoldRecyclePrice, // 黄金实时回收价(基础)
- realPtRecyclePrice, // 铂金实时回收价(基础)
- realAgRecyclePrice, // 白银实时回收价(基础)
- realKGoldRecyclePrice, // K金实时回收价(基础)
- } = useRealGoldPrice({});
- // 用户权益数据
- const userBenefits = ref({});
- const adjustGoldPrice = ref({});
- const adjustKgoldPrice = ref({});
- const adjustPtPrice = ref({});
- const adjustAgPrice = ref({});
- onLoad(() => {
- getUserBenefits();
- });
- const getUserBenefits = async () => {
- try {
- const res = await getUserLevelInfo(appStore?.userInfo?.userId || 0);
- userBenefits.value = res.data || { sold: 0, buy: 0 }; // 默认权益为0,避免NaN
- if (
- userBenefits?.value?.nobleMeta &&
- userBenefits.value.nobleMeta.length > 0
- ) {
- const nobleMeta = userBenefits.value.nobleMeta;
- nobleMeta.forEach((item) => {
- switch (item.name) {
- case "黄金":
- adjustGoldPrice.value = item;
- break;
- case "K金":
- adjustKgoldPrice.value = item;
- break;
- case "铂金":
- adjustPtPrice.value = item;
- break;
- case "白银":
- adjustAgPrice.value = item;
- break;
- default:
- break;
- }
- });
- }
- } catch (error) {
- console.error("获取用户权益失败:", error);
- userBenefits.value = { sold: 0, buy: 0 }; // 出错时默认权益为0
- }
- };
- // VIP 价格计算
- const vipRealGoldRecyclePrice = computed(() => {
- // console.log("vipRealGoldRecyclePrice", realGoldRecyclePrice.value);
- // console.log("userBenefits", userBenefits.value.sold);
- // console.log("adjustGoldPrice", adjustGoldPrice.value.buyPriceAdjust);
- return (
- Number(realGoldRecyclePrice.value) +
- Number(userBenefits.value.sold) -
- Number(adjustGoldPrice.value.buyPriceAdjust)
- );
- });
- const viprealGoldprice = computed(
- () =>
- Number(realGoldprice.value) -
- Number(userBenefits.value.buy) +
- Number(adjustGoldPrice.value.sellPriceAdjust)
- );
- const viprealKGoldRecyclePrice = computed(
- () =>
- Number(realKGoldRecyclePrice.value) +
- Number(userBenefits.value.sold) -
- Number(adjustKgoldPrice.value.buyPriceAdjust)
- );
- const viprealKGoldprice = computed(
- () =>
- Number(realKGoldprice.value) -
- Number(userBenefits.value.buy) +
- Number(adjustKgoldPrice.value.sellPriceAdjust)
- );
- const viprealPtRecyclePrice = computed(
- () =>
- Number(realPtRecyclePrice.value) +
- Number(userBenefits.value.sold) -
- Number(adjustPtPrice.value.buyPriceAdjust)
- );
- const viprealPtprice = computed(
- () =>
- Number(realPtprice.value) -
- Number(userBenefits.value.buy) +
- Number(adjustPtPrice.value.sellPriceAdjust)
- );
- const viprealAgRecyclePrice = computed(
- () =>
- Number(realAgRecyclePrice.value) +
- Number(userBenefits.value.sold) -
- Number(adjustAgPrice.value.buyPriceAdjust)
- );
- const viprealAgprice = computed(
- () =>
- Number(realAgprice.value) -
- Number(userBenefits.value.buy) +
- Number(adjustAgPrice.value.sellPriceAdjust)
- );
- // SVIP 价格计算(回购价多+0.3,销售价复用VIP)
- const svipRealGoldRecyclePrice = computed(
- () => vipRealGoldRecyclePrice.value + 0.3
- );
- const sviprealKGoldRecyclePrice = computed(
- () => viprealKGoldRecyclePrice.value + 0.3
- );
- const sviprealPtRecyclePrice = computed(
- () => viprealPtRecyclePrice.value + 0.3
- );
- const sviprealAgRecyclePrice = computed(
- () => viprealAgRecyclePrice.value + 0.3
- );
- // 高低价计算
- const vipGoldTodayHigh = computed(
- () =>
- Number(goldTodayHigh.value) -
- Number(userBenefits.value.buy) +
- Number(adjustGoldPrice.value.sellPriceAdjust)
- );
- const vipGoldTodayLow = computed(
- () =>
- Number(goldTodayLow.value) -
- Number(userBenefits.value.buy) +
- Number(adjustGoldPrice.value.sellPriceAdjust)
- );
- const vipkGoldTodayHigh = computed(
- () =>
- Number(kGoldTodayHigh.value) -
- Number(userBenefits.value.buy) +
- Number(adjustKgoldPrice.value.sellPriceAdjust)
- );
- const vipkGoldTodayLow = computed(
- () =>
- Number(kGoldTodayLow.value) -
- Number(userBenefits.value.buy) +
- Number(adjustKgoldPrice.value.sellPriceAdjust)
- );
- const vipptTodayHigh = computed(
- () =>
- Number(ptTodayHigh.value) -
- Number(userBenefits.value.buy) +
- Number(adjustPtPrice.value.sellPriceAdjust)
- );
- const vipptTodayLow = computed(
- () =>
- Number(ptTodayLow.value) -
- Number(userBenefits.value.buy) +
- Number(adjustPtPrice.value.sellPriceAdjust)
- );
- const vipagTodayHigh = computed(
- () =>
- Number(agTodayHigh.value) -
- Number(userBenefits.value.buy) +
- Number(adjustAgPrice.value.sellPriceAdjust)
- );
- const vipagTodayLow = computed(
- () =>
- Number(agTodayLow.value) -
- Number(userBenefits.value.buy) +
- Number(adjustAgPrice.value.sellPriceAdjust)
- );
- // 判断是否为周末(周六6/周日0)
- const isWeekend = computed(() => {
- const date = new Date(timestamp.value);
- const day = date.getDay();
- return day === 0 || day === 6;
- });
- // 历史价格记录(用于对比变动)
- // VIP 历史价
- const vipGoldRecyclePrev = ref(0); // VIP黄金回购价-历史
- const vipGoldSellPrev = ref(0); // VIP黄金销售价-历史
- const vipKGoldRecyclePrev = ref(0); // VIP K金回购价-历史
- const vipKGoldSellPrev = ref(0); // VIP K金销售价-历史
- const vipPtRecyclePrev = ref(0); // VIP 铂金回购价-历史
- const vipPtSellPrev = ref(0); // VIP 铂金销售价-历史
- const vipAgRecyclePrev = ref(0); // VIP 白银回购价-历史
- const vipAgSellPrev = ref(0); // VIP 白银销售价-历史
- // SVIP 历史价(仅回购价,销售价复用VIP)
- const svipGoldRecyclePrev = ref(0);
- const svipKGoldRecyclePrev = ref(0);
- const svipPtRecyclePrev = ref(0);
- const svipAgRecyclePrev = ref(0);
- // 监听实时价格更新,用nextTick延迟更新历史价(关键修复)
- // VIP 价格监听
- watch(vipRealGoldRecyclePrice, async (newVal, oldVal) => {
- if (newVal === 0) return; // 排除初始0值
- await nextTick(); // 等待状态计算完成后再更新历史值
- vipGoldRecyclePrev.value = oldVal;
- });
- watch(viprealGoldprice, async (newVal, oldVal) => {
- if (newVal === 0) return;
- await nextTick();
- vipGoldSellPrev.value = oldVal;
- });
- watch(viprealKGoldRecyclePrice, async (newVal, oldVal) => {
- if (newVal === 0) return;
- await nextTick();
- vipKGoldRecyclePrev.value = oldVal;
- });
- watch(viprealKGoldprice, async (newVal, oldVal) => {
- if (newVal === 0) return;
- await nextTick();
- vipKGoldSellPrev.value = oldVal;
- });
- watch(viprealPtRecyclePrice, async (newVal, oldVal) => {
- if (newVal === 0) return;
- await nextTick();
- vipPtRecyclePrev.value = oldVal;
- });
- watch(viprealPtprice, async (newVal, oldVal) => {
- if (newVal === 0) return;
- await nextTick();
- vipPtSellPrev.value = oldVal;
- });
- watch(viprealAgRecyclePrice, async (newVal, oldVal) => {
- if (newVal === 0) return;
- await nextTick();
- vipAgRecyclePrev.value = oldVal;
- });
- watch(viprealAgprice, async (newVal, oldVal) => {
- if (newVal === 0) return;
- await nextTick();
- vipAgSellPrev.value = oldVal;
- });
- // SVIP 价格监听(仅回购价)
- watch(svipRealGoldRecyclePrice, async (newVal, oldVal) => {
- // 排除初始无权益时的0.3
- if (Math.abs(newVal - 0.3) < 0.001) return;
- await nextTick();
- svipGoldRecyclePrev.value = oldVal;
- });
- watch(sviprealKGoldRecyclePrice, async (newVal, oldVal) => {
- if (Math.abs(newVal - 0.3) < 0.001) return;
- await nextTick();
- svipKGoldRecyclePrev.value = oldVal;
- });
- watch(sviprealPtRecyclePrice, async (newVal, oldVal) => {
- if (Math.abs(newVal - 0.3) < 0.001) return;
- await nextTick();
- svipPtRecyclePrev.value = oldVal;
- });
- watch(sviprealAgRecyclePrice, async (newVal, oldVal) => {
- if (Math.abs(newVal - 0.3) < 0.001) return;
- await nextTick();
- svipAgRecyclePrev.value = oldVal;
- });
- // 计算价格变动状态(rise=上升红,down=下降绿,unchanged=不变保持原色)
- // VIP 状态
- const vipGoldRecycleStatus = computed(() => {
- const curr = vipRealGoldRecyclePrice.value;
- const prev = vipGoldRecyclePrev.value;
- // console.log(curr, prev);
- if (prev === 0) return "unchanged"; // 初始状态不显示颜色
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const vipGoldSellStatus = computed(() => {
- const curr = viprealGoldprice.value;
- const prev = vipGoldSellPrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const vipKGoldRecycleStatus = computed(() => {
- const curr = viprealKGoldRecyclePrice.value;
- const prev = vipKGoldRecyclePrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const vipKGoldSellStatus = computed(() => {
- const curr = viprealKGoldprice.value;
- const prev = vipKGoldSellPrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const vipPtRecycleStatus = computed(() => {
- const curr = viprealPtRecyclePrice.value;
- const prev = vipPtRecyclePrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const vipPtSellStatus = computed(() => {
- const curr = viprealPtprice.value;
- const prev = vipPtSellPrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const vipAgRecycleStatus = computed(() => {
- const curr = viprealAgRecyclePrice.value;
- const prev = vipAgRecyclePrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const vipAgSellStatus = computed(() => {
- const curr = viprealAgprice.value;
- const prev = vipAgSellPrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- // SVIP 状态(仅回购价)
- const svipGoldRecycleStatus = computed(() => {
- const curr = svipRealGoldRecyclePrice.value;
- const prev = svipGoldRecyclePrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const svipKGoldRecycleStatus = computed(() => {
- const curr = sviprealKGoldRecyclePrice.value;
- const prev = svipKGoldRecyclePrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const svipPtRecycleStatus = computed(() => {
- const curr = sviprealPtRecyclePrice.value;
- const prev = svipPtRecyclePrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- const svipAgRecycleStatus = computed(() => {
- const curr = sviprealAgRecyclePrice.value;
- const prev = svipAgRecyclePrev.value;
- if (prev === 0) return "unchanged";
- return curr > prev ? "rise" : curr < prev ? "down" : "unchanged";
- });
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- background: #252525 !important;
- }
- .callService {
- padding: 20px 10px 0px;
- // background-color: #ddcca3;
- display: flex;
- justify-content: center;
- flex-direction: column;
- font-size: 16px;
- // margin-bottom: 30rpx;
- .list-box {
- background: #fff;
- border-radius: 20px;
- .list-item {
- width: 100%;
- height: 100rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- border-bottom: 1px solid #e1e1e1;
- }
- }
- }
- .notice-box {
- width: 98%;
- margin: 0 auto;
- background: #ffffff;
- display: flex;
- padding: 8rpx 30rpx;
- border-radius: 10rpx;
- // height: ;
- align-items: center;
- .iconfont {
- width: 44rpx;
- height: 44rpx;
- border-radius: 50%;
- text-align: center;
- line-height: 44rpx;
- // background-color: #fe960f;
- color: #000;
- font-size: 30rpx;
- margin-right: 15rpx;
- &.icon-wechat {
- background-color: #41b035;
- }
- &.icon-zhifubao {
- background-color: #06b4fd;
- }
- }
- }
- .status {
- margin: 20rpx 0;
- .time {
- font-size: 26rpx;
- }
- .status-right {
- font-size: 30rpx;
- color: #33cc33;
- &.active {
- color: red;
- }
- }
- }
- .address-container {
- display: flex;
- .address {
- width: 100rpx;
- }
- }
- .tips {
- font-size: 26rpx;
- color: #d8bb7d;
- text-align: center;
- line-height: 1.8;
- margin-top: 20rpx;
- }
- .price-table-row-not {
- display: none !important;
- }
- ::v-deep .center {
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- .divider {
- width: 100%;
- line-height: 1px;
- height: 1px;
- background-color: #999;
- }
- .divider2 {
- width: 100%;
- height: 3px;
- background-color: #000;
- }
- .container {
- height: 100%;
- max-width: 100% !important;
- display: flex;
- flex-direction: column;
- background: #252525 !important;
- .status {
- text-align: right;
- padding-top: 3px;
- padding-right: 10px;
- display: inline-block;
- color: red !important;
- background: #252525 !important;
- font-size: 15px;
- }
- }
- .header {
- display: flex;
- align-items: center;
- padding: 4px;
- }
- .page,
- .header {
- background: #fff !important;
- }
- .home {
- height: 100%;
- flex-grow: 1;
- overflow: auto;
- color: #fff;
- margin-top: 5px;
- .page {
- background: #18293a;
- overflow: auto;
- box-sizing: border-box;
- position: relative;
- .tab_header {
- display: flex;
- background: #b5aa90;
- font-size: 16px;
- width: 100%;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- &.white {
- background-color: #fff;
- }
- .col {
- text-align: center;
- padding: 24rpx 0;
- line-height: 23px;
- }
- .col-one {
- width: 245rpx;
- box-sizing: border-box;
- padding-left: 46rpx;
- }
- }
- .theme-container {
- display: flex;
- border-bottom: 4rpx solid #000;
- .horizontal-title {
- color: #000;
- background-color: #e6e6e6;
- font-size: 14px;
- width: 86rpx;
- text-align: center;
- word-break: break-all;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- display: flex;
- justify-content: center;
- align-items: center;
- border-right: 2rpx solid #999;
- font-weight: 500;
- }
- .theme-item {
- flex-grow: 1;
- flex-shrink: 1;
- .ditem {
- &.greywhite {
- background: #e6e6e6;
- }
- }
- }
- }
- }
- }
- .tab_header .col {
- border-bottom: 1px solid #999;
- }
- .tab_content .col {
- border-right: 1px solid #999;
- text-align: center;
- &:last-child {
- border: none;
- }
- }
- .tab_content {
- overflow-y: auto;
- .price-table-row {
- display: flex;
- justify-content: center;
- color: #808080;
- height: 55px;
- &:nth-child(2n) {
- background: #e6e6e6 !important;
- }
- }
- .name {
- color: #000 !important;
- }
- .col {
- padding: 3px 0;
- line-height: 23px;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #000;
- }
- .symbol-name {
- font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
- font-size: 30rpx;
- color: #ff0000;
- }
- .symbole-price {
- width: 100%;
- font-size: 30rpx;
- }
- }
- .btn-container {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 60rpx;
- width: 40%;
- font-size: 30rpx;
- background-color: #cc9931;
- color: #ffffff;
- border-radius: 100rpx;
- margin: 60rpx auto 20rpx;
- .btn-image {
- width: 30rpx;
- margin-left: 10rpx;
- }
- /* 移除button默认样式 */
- button::after {
- border: none;
- }
- /* 自定义按钮样式 */
- .btn {
- -webkit-appearance: none;
- width: 164rpx;
- height: 60rpx;
- font-size: 26rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #cc9931;
- color: #fff;
- border: none;
- /* 移除点击后的轮廓线 */
- outline: none;
- ::after {
- border: 0rpx solid #cc9931;
- /* 移除点击后的轮廓线 */
- outline: none;
- }
- }
- button[open-type="contact"] {
- outline: none;
- border: none;
- box-shadow: none;
- }
- }
- /* 价格变动颜色(上升红、下降绿,优先级确保覆盖默认色) */
- .symbol-price-rise {
- color: #ff0000 !important;
- }
- .symbol-price-fall {
- color: #33cc33 !important;
- }
- .fall {
- border-top: 2rpx solid #999;
- }
- .pageFooter {
- background: #2c3031 !important;
- padding: 35rpx 50rpx 50rpx 50rpx;
- font-size: 28rpx;
- }
- </style>
|