index.vue 34 KB

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