index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  1. <template>
  2. <view class="page-container">
  3. <up-navbar
  4. class="inde-nav-bar"
  5. :bgColor="navBgColor"
  6. >
  7. <template #left>
  8. <view class="nav-slot" v-if="!merchantNameShow()" @click="toBrowsingHistory()">
  9. <image class="dianpu" src="@/static/images/dianpu.png" mode="widthFix"></image>
  10. <view class="storeName line1">{{ merchantInfo.merchantName }}</view>
  11. <image class="zhankai" src="@/static/images/zhankai.png" mode="widthFix"></image>
  12. </view>
  13. </template>
  14. <template #center>
  15. <view class="page-title">首页</view>
  16. </template>
  17. <template #right></template>
  18. </up-navbar>
  19. <!-- 自定义 tabBar -->
  20. <customTabBar
  21. :current="0"
  22. :showBackTop="showBackTop"
  23. @backTop="scrollToTop"
  24. />
  25. <!-- <view class="page-index" :class="{ bgf: navIndex > 0 }"> -->
  26. <view class="page-index">
  27. <view class="top-box jianbianBG">
  28. <view class="header">
  29. <view class="serch-wrapper">
  30. <!-- <view class="logo" @click="goBack">-->
  31. <!-- <image src="@/static/logo1.png" mode=""></image>-->
  32. <!-- </view>-->
  33. <navigator
  34. url="/pages/goods/goods_search/index"
  35. class="input"
  36. hover-class="none"
  37. ><image class="searchImg" src="@/static/images/search.png"></image> 搜索商品</navigator
  38. >
  39. </view>
  40. <!-- 轮播图 -->
  41. <up-swiper
  42. class="swiper-box"
  43. :list="list1"
  44. :height="160"
  45. image-fit="cover"
  46. indicator
  47. :radius="10"
  48. indicatorMode="line"
  49. :circular="true"
  50. keyName="url"
  51. @click="clickSwiper"
  52. ></up-swiper>
  53. </view>
  54. </view>
  55. <!-- 实时金价 -->
  56. <view class="top-bg-box">
  57. <view class="card">
  58. <view class="cardbgLinear">
  59. <view class="title" @click="btnClick">
  60. <view class="title-left">
  61. <image class="ssjj" :src="HTTP_REQUEST_URL_IMG+'shishijinjia.png'" mode="widthFix"></image>
  62. <text class="updateTime">{{ timeFormat(timestamp, "yyyy-mm-dd hh:MM:ss") }}更新</text>
  63. </view>
  64. <view class="more">
  65. <text class="txt">更多金价</text>
  66. <image class="right" src="@/static/images/right.png" mode="widthFix"></image>
  67. </view>
  68. </view>
  69. <view class="nav-list">
  70. <view class="item">
  71. <view class="price">{{ viprealGoldprice }}<text class="unit">/克</text></view>
  72. <view class="txt">黄金</view>
  73. </view>
  74. <view class="item">
  75. <view class="price">{{ viprealPtprice }}<text class="unit">/克</text></view>
  76. <view class="txt">铂金</view>
  77. </view>
  78. <view class="item">
  79. <view class="price">{{ viprealAgprice }}<text class="unit">/克</text></view>
  80. <view class="txt">白银</view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 分类卡片 -->
  87. <view class="classify-section">
  88. <up-scroll-list class="classify-scroll" :indicator="classifyList.length > 4" :scrollX="true" indicatorActiveColor="#F8C008">
  89. <view class="classify-container">
  90. <view
  91. class="classify-item"
  92. v-for="(item, index) in classifyList"
  93. :key="'item-' + index"
  94. @click="toGoodsCate(item)"
  95. >
  96. <image class="classify-img" :src="item.extra" mode="widthFix"></image>
  97. <view class="classify-txt">{{ item.name }}</view>
  98. </view>
  99. </view>
  100. </up-scroll-list>
  101. </view>
  102. <view class="top-bg-box2">
  103. <view class="title">
  104. 精选商品
  105. </view>
  106. </view>
  107. <!-- 首发新品 -->
  108. <view class="index-product-wrapper">
  109. <view
  110. class="list-box animated"
  111. :class="goodsList.length > 0 ? 'fadeIn on' : ''"
  112. >
  113. <view
  114. class="item"
  115. v-for="(item, index) in calculatedProducts"
  116. :key="index"
  117. @click="goDetail(item)"
  118. >
  119. <view class="pictrue">
  120. <image :src="item.image" mode=""></image>
  121. </view>
  122. <view class="text-info">
  123. <view class="title" >
  124. <view class="text line1">{{ item.storeName }}</view>
  125. <view class="weight">{{ item.weight }}g</view>
  126. </view>
  127. <view class="bottom-row">
  128. <!-- <text class="price">工费: {{ item.price }}/克</text> -->
  129. <text class="price">¥ {{ item.totalPrice }}</text>
  130. <text class="sales">
  131. 销量:{{ Number(item.sales || 0) + Number(item.ficti || 0) }}件
  132. </text>
  133. <!-- <view class="txt">券</view> -->
  134. </view>
  135. <view class="bottom-row">
  136. <!-- <text class="price">工费: {{ item.price }}/克</text> -->
  137. <text class="sales">工费: {{ item.totalLaborCost }}</text>
  138. <text class="sales">
  139. 附加费: {{ item.additionalAmount }}
  140. </text>
  141. <!-- <view class="txt">券</view> -->
  142. </view>
  143. <template v-if="item?.merchant?.id && merchantNameShow()">
  144. <view class="merchantInfo" @click.stop="toMerchant(item.merchant.id)">
  145. <image class="merchantLogo" :src="item.merchant.merchantLogo" mode="scaleToFill"></image>
  146. <text class="merchantName">{{item.merchant.merchantName}}</text>
  147. <uni-icons style="margin-left: 10rpx;" type="right" size="16" color="#999999"></uni-icons>
  148. </view>
  149. </template>
  150. </view>
  151. </view>
  152. </view>
  153. <view class="loadingicon acea-row row-center-wrapper" v-if="goodScroll">
  154. <text
  155. class="loading iconfont icon-jiazai"
  156. :hidden="loading == false"
  157. ></text>
  158. </view>
  159. <view class="no-data" v-if="isNoDataState">
  160. <image
  161. src="https://my-go-easy-im.oss-cn-shenzhen.aliyuncs.com/goeasy-im-%E6%B0%B4%E8%B4%9D%E5%95%86%E5%9F%8E/zhanwu_20250827104005_1720_6.png"
  162. />
  163. </view>
  164. <view class="mores-txt flex" v-if="!goodScroll && !isNoDataState">
  165. <text>我是有底线的</text>
  166. </view>
  167. </view>
  168. </view>
  169. <!-- 上半部分 -->
  170. </view>
  171. </template>
  172. <script setup>
  173. // 获取实时金价
  174. import useRealGoldPrice from "@/hooks/useRealGoldPrice";
  175. import { onLoad, onShow, onReachBottom,onPageScroll } from "@dcloudio/uni-app";
  176. import {ref, onMounted, reactive, computed, getCurrentInstance, watch, nextTick} from "vue";
  177. import { getIndexData, getCoupons, setCouponReceive, getMerchantBannerList } from "@/api/api.js";
  178. import {
  179. getSbmerchantInfo
  180. } from "@/api/merchant.js";
  181. import { getProductListAPI } from "@/api/factory.js";
  182. import { useStoreRights } from "@/stores/rights";
  183. import { useRealtimeTimestamp } from "@/utils/useRealtimeTimestamp.js";
  184. import { getUserLevelInfo } from "@/api/user";
  185. import { useAppStore } from "@/stores/app";
  186. import { useTabbarStore } from "@/stores/tabbar";
  187. import { goShopDetail } from "@/libs/order.js";
  188. import { HTTP_REQUEST_URL_IMG } from "@/config/app";
  189. import customTabBar from "@/components/customTabBar/index.vue";
  190. // 全局状态和时间
  191. const appStore = useAppStore();
  192. const tabbarStore = useTabbarStore();
  193. const rightsStore = useStoreRights();
  194. import {
  195. getGroomList as getGroomListApi,
  196. getProductByCategoryId,
  197. getCategoryList
  198. } from "@/api/store.js";
  199. import { timeFormat } from "@/uni_modules/uview-plus";
  200. import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue";
  201. import { getSceneInfo } from '@/utils/util.js';
  202. import { toLogin } from "@/libs/login.js";
  203. // 获取实时金价
  204. // 实时价格处理
  205. const {
  206. realGoldprice, // 黄金实时销售价(基础)
  207. realPtprice, // 铂金实时销售价(基础)
  208. realAgprice, // 白银实时销售价(基础)
  209. } = useRealGoldPrice({});
  210. const { timestamp } = useRealtimeTimestamp();
  211. const uid = appStore.uidComputed;
  212. console.log(uid)
  213. // 轮播图数据
  214. const list1 = ref([]);
  215. const site_name = ref("");
  216. const loading = ref(false);
  217. const goodScroll = ref(true);
  218. const classifyList = ref([])
  219. // 用户权益数据
  220. const userBenefits = ref({});
  221. const adjustPtPrice = ref({});
  222. const adjustAgPrice = ref({});
  223. const adjustGoldpriceNew = ref({});
  224. const adjustKgoldPrice = ref({});
  225. const merchantInfo = ref({});
  226. const merchantId = ref('');
  227. const goodsList = ref([]);
  228. const goodType = ref(1);
  229. // Pagination
  230. const params = ref({
  231. page: 1,
  232. limit: 10,
  233. });
  234. const isFirstLoad = ref(true);
  235. const navBgColor = ref('rgba(255,255,255,0)');
  236. // 是否显示回到顶部
  237. const showBackTop = ref(false);
  238. // 滚动阈值
  239. const SCROLL_THRESHOLD = 300;
  240. const calculatedProducts = computed(() => {
  241. // 计算逻辑与原代码一致,但基于响应式数据 products
  242. return goodsList.value.map((product) => {
  243. // 1. 将price字符串转为数字
  244. const price = Number(product.price);
  245. // 2. 计算乘积
  246. const total = (price + product.sales) * realGoldprice.value;
  247. // 3. 向上取整到两位小数(先放大100倍取整,再缩小100倍)
  248. const roundedTotal = Math.ceil(total * 100) / 100;
  249. // 4. 格式化保留两位小数
  250. const formattedTotal = roundedTotal.toFixed(2);
  251. const totalLaborCost = Number(product.totalLaborCost);
  252. const additionalAmount = Number(product.additionalAmount);
  253. const totalPrice = (totalLaborCost+additionalAmount).toFixed(2);
  254. return {
  255. ...product,
  256. calculatedTotal: formattedTotal, // 新增计算结果字段
  257. totalPrice
  258. };
  259. });
  260. });
  261. onLoad(async (options) => {
  262. console.log('onLOAD')
  263. const params = await getSceneInfo(options,'index');
  264. // 2. 设置商户ID
  265. const isLogin = appStore.isLogin;
  266. if (appStore.merchantId && appStore.merchantId !== '') {
  267. merchantId.value = appStore.merchantId;
  268. if (!isLogin) {
  269. toLogin();
  270. return; // 登录后页面会刷新,避免继续执行
  271. }
  272. } else if (appStore?.userInfo?.merchant?.id) {
  273. merchantId.value = appStore.userInfo.merchant.id;
  274. } else {
  275. merchantId.value = '';
  276. }
  277. // if(isFirstLoad.value){
  278. await initPageData();
  279. // isFirstLoad.value = false;
  280. // }
  281. });
  282. onShow(async () => {
  283. // 隐藏原生 tabBar,使用自定义 tabBar
  284. uni.hideTabBar();
  285. const isLogin = appStore.isLogin;
  286. if(isLogin){
  287. rightsStore.getUserBenefits(appStore.userInfo?.userId);
  288. getUserBenefits();
  289. }
  290. if (appStore.merchantId && appStore.merchantId !== '') {
  291. merchantId.value = appStore.merchantId;
  292. if (!isLogin) {
  293. toLogin();
  294. return; // 登录后页面会刷新,避免继续执行
  295. }
  296. } else if (appStore?.userInfo?.merchant?.id) {
  297. merchantId.value = appStore.userInfo.merchant.id;
  298. if(!merchantInfo.merchantName){
  299. getSbmerchantInfoFn()
  300. }
  301. } else {
  302. merchantId.value = '';
  303. }
  304. // if(!isFirstLoad.value){
  305. // await initPageData();
  306. // }
  307. uni.setNavigationBarTitle({ title: site_name.value });
  308. });
  309. const initPageData = async () => {
  310. try {
  311. loading.value = true;
  312. goodScroll.value = true;
  313. goodsList.value = [];
  314. goodType.value = 1;
  315. params.value = {
  316. page: 1,
  317. limit: 10,
  318. };
  319. // 并行执行不依赖的数据获取
  320. const promises = [];
  321. if (merchantId.value && merchantId.value !== '') {
  322. promises.push(getSbmerchantInfoFn());
  323. promises.push(getMerchantBannerListFn());
  324. } else {
  325. promises.push(getIndexConfig());
  326. }
  327. promises.push(getGroomList());
  328. promises.push(getAllCategory());
  329. // 等待所有数据获取完成
  330. await Promise.all(promises);
  331. } catch (error) {
  332. console.error('初始化页面数据失败:', error);
  333. uni.showToast({
  334. title: '数据加载失败',
  335. icon: 'none'
  336. });
  337. } finally {
  338. loading.value = false;
  339. }
  340. };
  341. const getMerchantBannerListFn = async () => {
  342. try {
  343. let obj = {
  344. merchantId:merchantId.value
  345. }
  346. const res = await getMerchantBannerList(obj);
  347. uni.setNavigationBarTitle({ title: "首页" });
  348. site_name.value = "首页";
  349. list1.value = res.data.map((v) => {
  350. return {
  351. url: v.bannerUrl,
  352. title: "",
  353. type: "image",
  354. navUrl: v.bannerValue,
  355. };
  356. });
  357. } catch (err) {
  358. console.error(err);
  359. }
  360. }
  361. const getSbmerchantInfoFn = async () => {
  362. try {
  363. let obj = {
  364. merchantId:merchantId.value
  365. }
  366. const res = await getSbmerchantInfo(obj);
  367. merchantInfo.value = res.data;
  368. } catch (err) {
  369. console.error(err);
  370. }
  371. }
  372. const goBack = () => {
  373. uni.switchTab({ url: "/pages/index/index" });
  374. };
  375. async function clickSwiper(index) {
  376. const imgItem = list1.value[index];
  377. try {
  378. if (imgItem.navUrl !== "#") {
  379. await uni.navigateTo({ url: imgItem.navUrl });
  380. } else {
  381. uni.previewImage({
  382. current: index,
  383. urls: list1.value.map((item) => item.url) || [],
  384. });
  385. }
  386. } catch (err) {
  387. uni.previewImage({
  388. current: index,
  389. urls: list1.value.map((item) => item.url) || [],
  390. });
  391. return;
  392. }
  393. }
  394. const getIndexConfig = async () => {
  395. try {
  396. loading.value = true;
  397. const res = await getIndexData();
  398. uni.setNavigationBarTitle({ title: "首页" });
  399. site_name.value = "首页";
  400. list1.value = res.data.banner.map((v) => {
  401. return {
  402. url: v.pic,
  403. title: "",
  404. type: "image",
  405. navUrl: v.url,
  406. };
  407. });
  408. } catch (err) {
  409. console.error(err);
  410. } finally {
  411. loading.value = false;
  412. }
  413. };
  414. const getUserBenefits = async () => {
  415. try {
  416. const res = await getUserLevelInfo(appStore?.userInfo?.userId || 0);
  417. userBenefits.value = res.data || { sold: 0, buy: 0 }; // 默认权益为0,避免NaN
  418. if (
  419. userBenefits?.value?.nobleMeta &&
  420. userBenefits.value.nobleMeta.length > 0
  421. ) {
  422. const nobleMeta = userBenefits.value.nobleMeta;
  423. nobleMeta.forEach((item) => {
  424. switch (item.name) {
  425. case "黄金":
  426. adjustGoldpriceNew.value = item;
  427. break;
  428. case "K金":
  429. adjustKgoldPrice.value = item;
  430. break;
  431. case "铂金":
  432. adjustPtPrice.value = item;
  433. break;
  434. case "白银":
  435. adjustAgPrice.value = item;
  436. break;
  437. default:
  438. break;
  439. }
  440. });
  441. }
  442. } catch (error) {
  443. console.error("获取用户权益失败:", error);
  444. userBenefits.value = { sold: 0, buy: 0 }; // 出错时默认权益为0
  445. }
  446. };
  447. // 黄金调整价
  448. const viprealGoldprice = computed(() => {
  449. const res =
  450. Number(realGoldprice.value) -
  451. Number(userBenefits.value.buy) +
  452. Number(adjustGoldpriceNew.value.sellPriceAdjust) || 0;
  453. if(appStore.uid){
  454. return Number(res).toFixed(2);
  455. }else{
  456. return Number(realGoldprice.value).toFixed(2);
  457. }
  458. });
  459. const viprealPtprice = computed(() =>{
  460. const res =
  461. Number(realPtprice.value) -
  462. Number(userBenefits.value.buy) +
  463. Number(adjustPtPrice.value.sellPriceAdjust) || 0;
  464. if(appStore.uid){
  465. return Number(res).toFixed(2);
  466. }else{
  467. return Number(realPtprice.value).toFixed(2);
  468. }
  469. });
  470. const viprealAgprice = computed(() =>{
  471. const res =
  472. Number(realAgprice.value) -
  473. Number(userBenefits.value.buy) +
  474. Number(adjustAgPrice.value.sellPriceAdjust) || 0;
  475. if(appStore.uid){
  476. return Number(res).toFixed(2);
  477. }else{
  478. return Number(realAgprice.value).toFixed(2);
  479. }
  480. });
  481. const btnClick = () => {
  482. uni.navigateTo({
  483. url: "/pages/mall/dapan",
  484. });
  485. };
  486. const isNoDataState = computed(() => {
  487. return goodsList.value.length === 0 && !loading.value;
  488. });
  489. // Product Lists
  490. const getGroomList = async () => {
  491. if (!goodScroll.value) return;
  492. try {
  493. loading.value = true;
  494. merchantId.value!='' ? params.value.merchantId = merchantId.value:'';
  495. const { data } = await getGroomListApi(goodType.value, params.value);
  496. goodsList.value = [...goodsList.value, ...data.productList.list] || [];
  497. goodScroll.value = data.productList.list.length >= params.value.limit;
  498. params.value.page++;
  499. } catch (err) {
  500. console.error(err);
  501. } finally {
  502. loading.value = false;
  503. }
  504. };
  505. onPageScroll((e) => {
  506. if(e.scrollTop > 0){
  507. navBgColor.value ='#ffe079';
  508. }else{
  509. navBgColor.value ='rgba(252,255,255,0)';
  510. }
  511. // 判断是否显示回到顶部
  512. if (e.scrollTop > SCROLL_THRESHOLD) {
  513. showBackTop.value = true;
  514. } else {
  515. showBackTop.value = false;
  516. }
  517. })
  518. // 回到顶部
  519. const scrollToTop = () => {
  520. uni.pageScrollTo({
  521. scrollTop: 0,
  522. duration: 350
  523. });
  524. showBackTop.value = false;
  525. };
  526. onReachBottom(() => {
  527. getGroomList();
  528. });
  529. // Product Details
  530. const goDetail = async (item) => {
  531. // await goShopDetail(item, uid);
  532. uni.navigateTo({ url: `/pages/goods/goods_details/index?id=${item.id}` });
  533. };
  534. function getAllCategory() {
  535. getCategoryList().then((res) => {
  536. const list = [];
  537. res.data.forEach((item) => {
  538. if (item.name !== "贝币商城") return list.push(item);
  539. });
  540. classifyList.value = list.sort((a, b) => a.sort - b.sort);
  541. });
  542. }
  543. const toBrowsingHistory = () => {
  544. uni.navigateTo({ url: `/pages/users/browsing_history/index?merchantId=${merchantId.value}` });
  545. }
  546. const toMerchant = (merchantId) => {
  547. uni.navigateTo({ url:"/pages/merchantCenters/merchant?merchantId="+merchantId });
  548. }
  549. const toGoodsCate = (item) => {
  550. uni.setStorageSync('goods_cate', { id: item.id }); // 存储参数
  551. uni.switchTab({url:`/pages/goods_cate/goods_cate`})
  552. }
  553. const merchantNameShow = () => {
  554. if(!appStore.userInfo ||((appStore.userInfo && !appStore.userInfo.merchant && !appStore.merchantId))){
  555. return true;
  556. }else{
  557. return false;
  558. }
  559. }
  560. </script>
  561. <style>
  562. page {
  563. display: flex;
  564. flex-direction: column;
  565. height: 100%;
  566. }
  567. </style>
  568. <style lang="scss" scoped>
  569. .Hoverball {
  570. display: flex;
  571. justify-content: center;
  572. align-items: center;
  573. flex-direction: column;
  574. background: linear-gradient(180deg, #fefcf9 0%, #fff2df 100%);
  575. box-shadow: 0rpx 3rpx 12rpx 0rpx rgba(0, 0, 0, 0.16);
  576. width: 105upx;
  577. height: 105upx;
  578. border-radius: 50%; // 圆形按钮
  579. position: fixed; // 固定定位(不随页面滚动)
  580. z-index: 999999; // 最高层级,避免被其他元素遮挡
  581. top: 0%;
  582. right: 0%;
  583. .title {
  584. font-size: 19rpx;
  585. color: #000000;
  586. margin-bottom: 4rpx; // 文本与价格间距
  587. }
  588. .price {
  589. font-size: 26rpx;
  590. color: #cc0000;
  591. font-weight: bold;
  592. }
  593. // 贴边/停止拖拽时的过渡动画
  594. &.transition {
  595. transition: left 0.3s ease, top 0.3s ease;
  596. }
  597. }
  598. .couponIndex {
  599. width: auto;
  600. height: 238rpx;
  601. //background-image: url("~@/static/images/yhjsy.png");
  602. background-size: 100% 100%;
  603. padding-left: 42rpx;
  604. margin-bottom: 30rpx;
  605. .titBox {
  606. padding: 47rpx 0;
  607. text-align: center;
  608. height: 100%;
  609. .tit1 {
  610. color: #ffebd2;
  611. font-size: 34rpx;
  612. font-weight: 600;
  613. }
  614. .tit2 {
  615. color: #ffebd2;
  616. font-size: 22rpx;
  617. margin: 10rpx 0 26rpx 0;
  618. }
  619. .tit3 {
  620. color: #ffdaaf;
  621. font-size: 24rpx;
  622. .iconfont {
  623. font-size: 20rpx;
  624. }
  625. }
  626. }
  627. }
  628. .sticky-box {
  629. // display: flex;
  630. // position: -webkit-sticky;
  631. // position: sticky;
  632. z-index: 99;
  633. flex-direction: row;
  634. // margin: 0px;
  635. // background: #fff;
  636. padding-bottom: 30rpx;
  637. background: #fff;
  638. margin-top: 30rpx;
  639. .active {
  640. color: #000;
  641. }
  642. .nav-bd {
  643. display: flex;
  644. align-items: center;
  645. justify-content: space-between;
  646. padding: 0 20rpx;
  647. .item {
  648. display: flex;
  649. flex-direction: column;
  650. align-items: center;
  651. justify-content: center;
  652. border-bottom: 3rpx solid #e6e6e6;
  653. box-sizing: border-box;
  654. .txt {
  655. font-size: 28rpx;
  656. color: #282828;
  657. }
  658. .label {
  659. display: flex;
  660. align-items: center;
  661. justify-content: center;
  662. width: 124rpx;
  663. height: 32rpx;
  664. margin-top: 5rpx;
  665. font-size: 24rpx;
  666. color: #999;
  667. }
  668. &.active {
  669. color: $theme-color;
  670. border-bottom: 2rpx solid #000;
  671. .txt {
  672. color: $theme-color;
  673. }
  674. .label {
  675. background: linear-gradient(90deg, $bg-star 0%, $bg-end 100%);
  676. border-radius: 16rpx;
  677. color: #fff;
  678. }
  679. }
  680. }
  681. }
  682. .second-nav {
  683. width: 100%;
  684. display: flex;
  685. flex-wrap: nowrap;
  686. overflow-x: auto;
  687. &::-webkit-scrollbar {
  688. display: none;
  689. }
  690. -webkit-overflow-scrolling: touch;
  691. padding: 0 50rpx;
  692. box-sizing: border-box;
  693. .second-nav-item {
  694. font-size: 26rpx;
  695. padding: 15rpx 0;
  696. margin: 0 10rpx 0 0;
  697. color: #000;
  698. white-space: nowrap;
  699. // flex: 1;
  700. width: 33%;
  701. display: flex;
  702. justify-content: center;
  703. align-items: center;
  704. &.active {
  705. color: #ef4800;
  706. }
  707. }
  708. }
  709. }
  710. .swiper-box {
  711. &::v-deep uni-image {
  712. width: 100%;
  713. }
  714. }
  715. // 活动专区
  716. .active-contanier {
  717. width: 100%;
  718. box-sizing: border-box;
  719. padding: 0 30rpx;
  720. .active-scroll {
  721. width: 100%;
  722. white-space: nowrap;
  723. .active-scroll-content {
  724. margin: 30rpx 0;
  725. display: flex;
  726. flex-direction: row;
  727. white-space: nowrap;
  728. }
  729. }
  730. .active-item {
  731. // width: 335rpx;
  732. width: 48.99%;
  733. background: #ffffff;
  734. height: 180rpx;
  735. box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
  736. border-radius: 20rpx;
  737. padding: 13rpx 20rpx;
  738. box-sizing: border-box;
  739. display: flex;
  740. flex-direction: column;
  741. margin-right: 20rpx;
  742. flex-shrink: 0;
  743. .title-box {
  744. height: 33rpx;
  745. display: flex;
  746. font-size: 22rpx;
  747. align-items: center;
  748. .title {
  749. // width: 50%;
  750. font-weight: bold;
  751. text-align: center;
  752. }
  753. }
  754. .active-box {
  755. flex: 1;
  756. display: flex;
  757. .active-item-left {
  758. flex: 1;
  759. display: flex;
  760. flex-direction: column;
  761. .image-box {
  762. flex: 1;
  763. // width: 115rpx;
  764. display: flex;
  765. align-items: center;
  766. image {
  767. border-radius: 5rpx;
  768. width: 115rpx;
  769. height: 110rpx;
  770. }
  771. .da-jin-tiao {
  772. width: 51rpx;
  773. }
  774. }
  775. }
  776. .active-item-right {
  777. display: flex;
  778. flex-direction: column;
  779. justify-content: space-between;
  780. flex: 1;
  781. min-width: 0;
  782. width: 0;
  783. .ms {
  784. font-size: 16rpx;
  785. color: #000000;
  786. width: 100%;
  787. overflow: hidden;
  788. text-overflow: ellipsis;
  789. white-space: nowrap;
  790. display: block;
  791. max-width: 100%;
  792. box-sizing: border-box;
  793. }
  794. .tag {
  795. display: flex;
  796. .tag-text {
  797. color: #acacac;
  798. background-color: #ebebeb;
  799. border-radius: 5rpx;
  800. font-size: 16rpx;
  801. text-align: center;
  802. padding: 0rpx 5rpx;
  803. }
  804. }
  805. .price-box {
  806. display: flex;
  807. justify-content: space-between;
  808. .price {
  809. font-size: 18rpx;
  810. font-weight: bold;
  811. color: #000000;
  812. margin-right: 10rpx;
  813. }
  814. .btn {
  815. width: 77rpx;
  816. height: 26rpx;
  817. background-image: linear-gradient(270deg, #fc962c 0%, #f0470d 100%);
  818. border-radius: 100rpx;
  819. display: flex;
  820. justify-content: center;
  821. align-items: center;
  822. font-size: 14rpx;
  823. color: #ffffff;
  824. }
  825. }
  826. }
  827. }
  828. }
  829. }
  830. .listAll {
  831. width: 20%;
  832. text-indent: 62rpx;
  833. font-size: 30rpx;
  834. border-left: 1px #eee solid;
  835. margin: 1% 0;
  836. padding: 5rpx;
  837. position: relative;
  838. image {
  839. position: absolute;
  840. left: 20rpx;
  841. top: 8rpx;
  842. }
  843. }
  844. .tab {
  845. position: relative;
  846. display: flex;
  847. font-size: 28rpx;
  848. white-space: nowrap;
  849. &__item {
  850. flex: 1;
  851. padding: 0 20rpx;
  852. text-align: center;
  853. height: 60rpx;
  854. line-height: 60rpx;
  855. color: #666;
  856. &.active {
  857. color: #09c2c9;
  858. }
  859. }
  860. }
  861. .tab__line {
  862. display: block;
  863. height: 6rpx;
  864. position: absolute;
  865. bottom: 0;
  866. left: 0;
  867. z-index: 1;
  868. border-radius: 3rpx;
  869. position: relative;
  870. background: #2fc6cd;
  871. }
  872. .scroll-view_H {
  873. width: 100%;
  874. display: flex;
  875. overflow-x: auto;
  876. padding: 12rpx 0;
  877. background-color: #fff;
  878. box-sizing: border-box;
  879. &::-webkit-scrollbar {
  880. display: none;
  881. }
  882. -webkit-overflow-scrolling: touch;
  883. .tab.nav-bd {
  884. display: flex;
  885. align-items: center;
  886. width: 100%;
  887. }
  888. #tab_item.item {
  889. display: flex;
  890. flex-direction: column;
  891. align-items: center;
  892. // margin: 0 24rpx;
  893. padding: 8rpx 0;
  894. cursor: pointer;
  895. flex: 1;
  896. transition: all 0.3s ease;
  897. .uni-icons {
  898. font-size: 44rpx;
  899. margin-bottom: 6rpx;
  900. }
  901. .txt {
  902. font-size: 26rpx;
  903. color: #333;
  904. }
  905. }
  906. #tab_list:first-of-type .item.active {
  907. .uni-icons {
  908. color: #000;
  909. }
  910. .txt {
  911. color: #000;
  912. font-weight: bold;
  913. }
  914. }
  915. .privacy-wrapper {
  916. z-index: 999;
  917. position: fixed;
  918. left: 0;
  919. top: 0;
  920. width: 100%;
  921. height: 100%;
  922. background: #7f7f7f;
  923. .privacy-box {
  924. position: absolute;
  925. left: 50%;
  926. top: 50%;
  927. transform: translate(-50%, -50%);
  928. width: 560rpx;
  929. padding: 50rpx 45rpx 0;
  930. background: #fff;
  931. border-radius: 20rpx;
  932. .title {
  933. text-align: center;
  934. font-size: 32rpx;
  935. text-align: center;
  936. color: #333;
  937. font-weight: 700;
  938. }
  939. .content {
  940. margin-top: 20rpx;
  941. line-height: 1.5;
  942. font-size: 26rpx;
  943. color: #666;
  944. text-indent: 54rpx;
  945. i {
  946. font-style: normal;
  947. color: $theme-color;
  948. }
  949. }
  950. .btn-box {
  951. margin-top: 40rpx;
  952. text-align: center;
  953. font-size: 30rpx;
  954. .btn-item {
  955. height: 82rpx;
  956. line-height: 82rpx;
  957. background: linear-gradient(90deg, #f67a38 0%, #f11b09 100%);
  958. color: #fff;
  959. border-radius: 41rpx;
  960. }
  961. .btn {
  962. padding: 30rpx 0;
  963. }
  964. }
  965. }
  966. }
  967. }
  968. .page-index {
  969. position: relative;
  970. z-index: 1;
  971. height: 100%;
  972. padding-bottom: 200rpx;
  973. box-sizing: border-box;
  974. .top-box {
  975. padding-top: 168rpx;
  976. //background: linear-gradient(180deg, #ffe079 0%, #ffffff 100%);
  977. //background-image: url("https://sb-admin.oss-cn-shenzhen.aliyuncs.com/shuibei-mini/new-mini/jianbianBG.png");
  978. background-size: 100% 100%;
  979. }
  980. }
  981. .header {
  982. //position: sticky;
  983. //top: 0;
  984. //z-index: 200000;
  985. width: 100%;
  986. padding: 28rpx 20rpx 10rpx;
  987. .serch-wrapper {
  988. //margin-top: var(--status-bar-height);
  989. margin-bottom: 30rpx;
  990. display: flex;
  991. justify-content: center;
  992. align-items: center;
  993. /* #ifdef MP-WEIXIN */
  994. width: 100%;
  995. /* #endif */
  996. .logo {
  997. width: 154rpx;
  998. height: 47rpx;
  999. margin-right: 24rpx;
  1000. }
  1001. image {
  1002. width: 118rpx;
  1003. height: 42rpx;
  1004. }
  1005. .input {
  1006. display: flex;
  1007. align-items: center;
  1008. width: 100%;
  1009. height: 80rpx;
  1010. background-color: #ffffff;
  1011. border-radius: 20rpx;
  1012. font-size: 28rpx;
  1013. color: #868686;
  1014. .iconfont {
  1015. margin: 0 10rpx;
  1016. font-size: 26rpx;
  1017. color: #666666;
  1018. }
  1019. .searchImg{
  1020. width: 32rpx;
  1021. height: 32rpx;
  1022. margin: 0 20rpx;
  1023. }
  1024. }
  1025. }
  1026. .tabNav {
  1027. padding-top: 24rpx;
  1028. }
  1029. }
  1030. .page_content {
  1031. padding: 0 30rpx;
  1032. }
  1033. .index-product-wrapper {
  1034. padding: 0 30rpx;
  1035. margin-bottom: 200rpx; /* 为自定义 tabBar 留出空间 */
  1036. min-height: 700rpx;
  1037. //background: #fff;
  1038. &.on {
  1039. min-height: 1500rpx;
  1040. }
  1041. .list-box {
  1042. display: flex;
  1043. flex-wrap: wrap;
  1044. justify-content: space-between;
  1045. .item {
  1046. width: 48.99%;
  1047. //height: 490rpx;
  1048. background-color: #ffffff;
  1049. box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
  1050. border-radius: 20rpx;
  1051. margin-bottom: 20rpx;
  1052. overflow: hidden;
  1053. display: flex;
  1054. flex-direction: column;
  1055. justify-content: space-between;
  1056. .pictrue {
  1057. position: relative;
  1058. image {
  1059. width: 100%;
  1060. height: 330rpx;
  1061. }
  1062. }
  1063. .text-info {
  1064. padding: 10rpx 20rpx 15rpx;
  1065. .title {
  1066. color: #222222;
  1067. display: flex;
  1068. align-items: center;
  1069. justify-items: space-between;
  1070. .tip {
  1071. width: 61rpx;
  1072. height: auto;
  1073. font-size: 22rpx;
  1074. display: flex;
  1075. justify-content: center;
  1076. align-items: center;
  1077. color: #ffffff;
  1078. position: relative;
  1079. margin-right: 5rpx;
  1080. background-color: #ef4800;
  1081. border-radius: 5rpx;
  1082. }
  1083. .text{
  1084. width: 80%;
  1085. }
  1086. .weight{
  1087. background-color: rgba(197, 128, 3, 0.10);
  1088. color: #C58003;
  1089. font-size: 24rpx;
  1090. padding: 8rpx 16rpx;
  1091. border-radius: 8rpx;
  1092. float: right;
  1093. }
  1094. }
  1095. .bottom-row {
  1096. color: $theme-color;
  1097. display: flex;
  1098. justify-content: space-between;
  1099. align-items: center;
  1100. font-size: 28rpx;
  1101. margin: 10rpx 0 0;
  1102. .price {
  1103. padding-bottom: 4rpx;
  1104. font-weight: 800;
  1105. white-space: nowrap;
  1106. font-size: 28rpx;
  1107. color: #f16327;
  1108. }
  1109. .sales {
  1110. font-size: 22rpx;
  1111. white-space: nowrap;
  1112. color: #999999;
  1113. }
  1114. }
  1115. .merchantInfo{
  1116. display: flex;
  1117. align-items: center;
  1118. height: 60rpx;
  1119. }
  1120. .merchantLogo{
  1121. width: 40rpx;
  1122. height: 40rpx;
  1123. border-radius: 50%;
  1124. margin-right: 20rpx;
  1125. }
  1126. .merchantName{
  1127. font-size: 24rpx;
  1128. color: #333;
  1129. }
  1130. }
  1131. }
  1132. &.on {
  1133. display: flex;
  1134. }
  1135. }
  1136. }
  1137. .top-bg-box2 {
  1138. overflow: hidden;
  1139. padding: 20rpx;
  1140. box-sizing: border-box;
  1141. .title{
  1142. font-size: 32rpx;
  1143. color: #333333;
  1144. font-weight: bold;
  1145. line-height: 60rpx;
  1146. }
  1147. }
  1148. .top-bg-box {
  1149. overflow: hidden;
  1150. padding: 20rpx;
  1151. box-sizing: border-box;
  1152. // background-image: linear-gradient(
  1153. // to bottom,
  1154. // $header-color 0%,
  1155. // $header-color 10%,
  1156. // #ffe9a1 50%,
  1157. // transparent 100%
  1158. // );
  1159. .card{
  1160. background-color: #fff;
  1161. padding: 4rpx;
  1162. box-sizing: border-box;
  1163. border-radius: 20rpx;
  1164. .cardbgLinear{
  1165. padding: 20rpx 16rpx;
  1166. box-sizing: border-box;
  1167. border-radius: 20rpx;
  1168. background: linear-gradient(to bottom,
  1169. rgba(255, 240, 200, 0.7) 0%,
  1170. rgba(255, 240, 200, 0.4) 8%,
  1171. rgba(255, 255, 255, 1) 20%,
  1172. rgba(255, 255, 255, 1) 100%);
  1173. }
  1174. }
  1175. }
  1176. .top-bg-box {
  1177. .title {
  1178. display: flex;
  1179. justify-content: space-between; // 左右两端对齐
  1180. align-items: center; // 垂直居中
  1181. .title-left {
  1182. display: flex;
  1183. align-items: center;
  1184. .ssjj {
  1185. width: 150rpx;
  1186. height: 36rpx;
  1187. vertical-align: middle;
  1188. }
  1189. .updateTime {
  1190. font-size: 24rpx;
  1191. color: #666666;
  1192. padding: 0 20rpx;
  1193. box-sizing: border-box;
  1194. }
  1195. }
  1196. .more {
  1197. display: flex;
  1198. align-items: center;
  1199. .txt {
  1200. font-size: 28rpx;
  1201. color: #666666;
  1202. }
  1203. .right {
  1204. width: 40rpx;
  1205. vertical-align: middle;
  1206. margin-left: 10rpx; // 添加一些间距
  1207. }
  1208. }
  1209. }
  1210. }
  1211. .nav-list {
  1212. width: 100%;
  1213. display: flex;
  1214. justify-content: space-between;
  1215. align-items: center;
  1216. padding: 0 40rpx 0;
  1217. margin-top: 30rpx;
  1218. .item {
  1219. text-align: center;
  1220. .price{
  1221. font-size: 44rpx;
  1222. color: #FD5B37;
  1223. font-weight: bold;
  1224. .unit{
  1225. font-size: 28rpx;
  1226. }
  1227. }
  1228. .txt{
  1229. font-size: 28rpx;
  1230. color: #666666;
  1231. line-height: 60rpx;
  1232. }
  1233. }
  1234. }
  1235. .no-data {
  1236. margin: 150rpx auto 0;
  1237. text-align: center;
  1238. img {
  1239. width: 65%;
  1240. height: auto;
  1241. }
  1242. }
  1243. .inde-nav-bar{
  1244. .page-title{
  1245. color: #fff;
  1246. }
  1247. }
  1248. // 分类卡片区域样式
  1249. .classify-section {
  1250. background: #fff;
  1251. margin: 0 20rpx;
  1252. border-radius: 16rpx;
  1253. padding: 30rpx 0 10rpx;
  1254. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
  1255. }
  1256. .classify-scroll {
  1257. width: 100%;
  1258. white-space: nowrap;
  1259. }
  1260. .classify-container {
  1261. width: 100%;
  1262. display: inline-flex;
  1263. flex-wrap: nowrap;
  1264. min-width: 100%;
  1265. }
  1266. .classify-item {
  1267. display: inline-flex;
  1268. flex-direction: column;
  1269. align-items: center;
  1270. justify-content: center;
  1271. width: 175rpx;
  1272. flex-shrink: 0;
  1273. box-sizing: border-box;
  1274. .classify-img {
  1275. width: 100rpx;
  1276. height: 100rpx;
  1277. }
  1278. .classify-txt {
  1279. font-size: 24rpx;
  1280. color: #666;
  1281. margin-top: 8rpx;
  1282. text-align: center;
  1283. white-space: nowrap;
  1284. overflow: hidden;
  1285. text-overflow: ellipsis;
  1286. max-width: 120rpx;
  1287. }
  1288. }
  1289. .nav-slot{
  1290. //width: 60%;
  1291. display: flex;
  1292. justify-content: space-between;
  1293. align-items: center;
  1294. .dianpu{
  1295. width: 32rpx;
  1296. }
  1297. .zhankai{
  1298. width: 20rpx;
  1299. }
  1300. .storeName{
  1301. width: 60%;
  1302. font-size: 28rpx;
  1303. color: #333;
  1304. }
  1305. }
  1306. .no-data {
  1307. margin: 150rpx auto 0;
  1308. text-align: center;
  1309. img {
  1310. width: 65%;
  1311. height: auto;
  1312. }
  1313. }
  1314. .mores-txt {
  1315. width: 100%;
  1316. align-items: center;
  1317. justify-content: center;
  1318. height: 70rpx;
  1319. color: #999;
  1320. font-size: 24rpx;
  1321. .iconfont {
  1322. margin-top: 2rpx;
  1323. font-size: 20rpx;
  1324. }
  1325. }
  1326. :deep(.page-title){
  1327. font-size: 36rpx;
  1328. }
  1329. </style>