index.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  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. classifyList.value = res.data.sort((a, b) => a.sort - b.sort);
  533. })
  534. }
  535. const toBrowsingHistory = () => {
  536. uni.navigateTo({ url: `/pages/users/browsing_history/index?merchantId=${merchantId.value}` });
  537. }
  538. const toMerchant = (merchantId) => {
  539. uni.navigateTo({ url:"/pages/merchantCenters/merchant?merchantId="+merchantId });
  540. }
  541. const toGoodsCate = (item) => {
  542. uni.setStorageSync('goods_cate', { id: item.id }); // 存储参数
  543. uni.switchTab({url:`/pages/goods_cate/goods_cate`})
  544. }
  545. const merchantNameShow = () => {
  546. if(!appStore.userInfo ||((appStore.userInfo && !appStore.userInfo.merchant && !appStore.merchantId))){
  547. return true;
  548. }else{
  549. return false;
  550. }
  551. }
  552. </script>
  553. <style>
  554. page {
  555. display: flex;
  556. flex-direction: column;
  557. height: 100%;
  558. }
  559. </style>
  560. <style lang="scss" scoped>
  561. .Hoverball {
  562. display: flex;
  563. justify-content: center;
  564. align-items: center;
  565. flex-direction: column;
  566. background: linear-gradient(180deg, #fefcf9 0%, #fff2df 100%);
  567. box-shadow: 0rpx 3rpx 12rpx 0rpx rgba(0, 0, 0, 0.16);
  568. width: 105upx;
  569. height: 105upx;
  570. border-radius: 50%; // 圆形按钮
  571. position: fixed; // 固定定位(不随页面滚动)
  572. z-index: 999999; // 最高层级,避免被其他元素遮挡
  573. top: 0%;
  574. right: 0%;
  575. .title {
  576. font-size: 19rpx;
  577. color: #000000;
  578. margin-bottom: 4rpx; // 文本与价格间距
  579. }
  580. .price {
  581. font-size: 26rpx;
  582. color: #cc0000;
  583. font-weight: bold;
  584. }
  585. // 贴边/停止拖拽时的过渡动画
  586. &.transition {
  587. transition: left 0.3s ease, top 0.3s ease;
  588. }
  589. }
  590. .couponIndex {
  591. width: auto;
  592. height: 238rpx;
  593. //background-image: url("~@/static/images/yhjsy.png");
  594. background-size: 100% 100%;
  595. padding-left: 42rpx;
  596. margin-bottom: 30rpx;
  597. .titBox {
  598. padding: 47rpx 0;
  599. text-align: center;
  600. height: 100%;
  601. .tit1 {
  602. color: #ffebd2;
  603. font-size: 34rpx;
  604. font-weight: 600;
  605. }
  606. .tit2 {
  607. color: #ffebd2;
  608. font-size: 22rpx;
  609. margin: 10rpx 0 26rpx 0;
  610. }
  611. .tit3 {
  612. color: #ffdaaf;
  613. font-size: 24rpx;
  614. .iconfont {
  615. font-size: 20rpx;
  616. }
  617. }
  618. }
  619. }
  620. .sticky-box {
  621. // display: flex;
  622. // position: -webkit-sticky;
  623. // position: sticky;
  624. z-index: 99;
  625. flex-direction: row;
  626. // margin: 0px;
  627. // background: #fff;
  628. padding-bottom: 30rpx;
  629. background: #fff;
  630. margin-top: 30rpx;
  631. .active {
  632. color: #000;
  633. }
  634. .nav-bd {
  635. display: flex;
  636. align-items: center;
  637. justify-content: space-between;
  638. padding: 0 20rpx;
  639. .item {
  640. display: flex;
  641. flex-direction: column;
  642. align-items: center;
  643. justify-content: center;
  644. border-bottom: 3rpx solid #e6e6e6;
  645. box-sizing: border-box;
  646. .txt {
  647. font-size: 28rpx;
  648. color: #282828;
  649. }
  650. .label {
  651. display: flex;
  652. align-items: center;
  653. justify-content: center;
  654. width: 124rpx;
  655. height: 32rpx;
  656. margin-top: 5rpx;
  657. font-size: 24rpx;
  658. color: #999;
  659. }
  660. &.active {
  661. color: $theme-color;
  662. border-bottom: 2rpx solid #000;
  663. .txt {
  664. color: $theme-color;
  665. }
  666. .label {
  667. background: linear-gradient(90deg, $bg-star 0%, $bg-end 100%);
  668. border-radius: 16rpx;
  669. color: #fff;
  670. }
  671. }
  672. }
  673. }
  674. .second-nav {
  675. width: 100%;
  676. display: flex;
  677. flex-wrap: nowrap;
  678. overflow-x: auto;
  679. &::-webkit-scrollbar {
  680. display: none;
  681. }
  682. -webkit-overflow-scrolling: touch;
  683. padding: 0 50rpx;
  684. box-sizing: border-box;
  685. .second-nav-item {
  686. font-size: 26rpx;
  687. padding: 15rpx 0;
  688. margin: 0 10rpx 0 0;
  689. color: #000;
  690. white-space: nowrap;
  691. // flex: 1;
  692. width: 33%;
  693. display: flex;
  694. justify-content: center;
  695. align-items: center;
  696. &.active {
  697. color: #ef4800;
  698. }
  699. }
  700. }
  701. }
  702. .swiper-box {
  703. &::v-deep uni-image {
  704. width: 100%;
  705. }
  706. }
  707. // 活动专区
  708. .active-contanier {
  709. width: 100%;
  710. box-sizing: border-box;
  711. padding: 0 30rpx;
  712. .active-scroll {
  713. width: 100%;
  714. white-space: nowrap;
  715. .active-scroll-content {
  716. margin: 30rpx 0;
  717. display: flex;
  718. flex-direction: row;
  719. white-space: nowrap;
  720. }
  721. }
  722. .active-item {
  723. // width: 335rpx;
  724. width: 48.99%;
  725. background: #ffffff;
  726. height: 180rpx;
  727. box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
  728. border-radius: 20rpx;
  729. padding: 13rpx 20rpx;
  730. box-sizing: border-box;
  731. display: flex;
  732. flex-direction: column;
  733. margin-right: 20rpx;
  734. flex-shrink: 0;
  735. .title-box {
  736. height: 33rpx;
  737. display: flex;
  738. font-size: 22rpx;
  739. align-items: center;
  740. .title {
  741. // width: 50%;
  742. font-weight: bold;
  743. text-align: center;
  744. }
  745. }
  746. .active-box {
  747. flex: 1;
  748. display: flex;
  749. .active-item-left {
  750. flex: 1;
  751. display: flex;
  752. flex-direction: column;
  753. .image-box {
  754. flex: 1;
  755. // width: 115rpx;
  756. display: flex;
  757. align-items: center;
  758. image {
  759. border-radius: 5rpx;
  760. width: 115rpx;
  761. height: 110rpx;
  762. }
  763. .da-jin-tiao {
  764. width: 51rpx;
  765. }
  766. }
  767. }
  768. .active-item-right {
  769. display: flex;
  770. flex-direction: column;
  771. justify-content: space-between;
  772. flex: 1;
  773. min-width: 0;
  774. width: 0;
  775. .ms {
  776. font-size: 16rpx;
  777. color: #000000;
  778. width: 100%;
  779. overflow: hidden;
  780. text-overflow: ellipsis;
  781. white-space: nowrap;
  782. display: block;
  783. max-width: 100%;
  784. box-sizing: border-box;
  785. }
  786. .tag {
  787. display: flex;
  788. .tag-text {
  789. color: #acacac;
  790. background-color: #ebebeb;
  791. border-radius: 5rpx;
  792. font-size: 16rpx;
  793. text-align: center;
  794. padding: 0rpx 5rpx;
  795. }
  796. }
  797. .price-box {
  798. display: flex;
  799. justify-content: space-between;
  800. .price {
  801. font-size: 18rpx;
  802. font-weight: bold;
  803. color: #000000;
  804. margin-right: 10rpx;
  805. }
  806. .btn {
  807. width: 77rpx;
  808. height: 26rpx;
  809. background-image: linear-gradient(270deg, #fc962c 0%, #f0470d 100%);
  810. border-radius: 100rpx;
  811. display: flex;
  812. justify-content: center;
  813. align-items: center;
  814. font-size: 14rpx;
  815. color: #ffffff;
  816. }
  817. }
  818. }
  819. }
  820. }
  821. }
  822. .listAll {
  823. width: 20%;
  824. text-indent: 62rpx;
  825. font-size: 30rpx;
  826. border-left: 1px #eee solid;
  827. margin: 1% 0;
  828. padding: 5rpx;
  829. position: relative;
  830. image {
  831. position: absolute;
  832. left: 20rpx;
  833. top: 8rpx;
  834. }
  835. }
  836. .tab {
  837. position: relative;
  838. display: flex;
  839. font-size: 28rpx;
  840. white-space: nowrap;
  841. &__item {
  842. flex: 1;
  843. padding: 0 20rpx;
  844. text-align: center;
  845. height: 60rpx;
  846. line-height: 60rpx;
  847. color: #666;
  848. &.active {
  849. color: #09c2c9;
  850. }
  851. }
  852. }
  853. .tab__line {
  854. display: block;
  855. height: 6rpx;
  856. position: absolute;
  857. bottom: 0;
  858. left: 0;
  859. z-index: 1;
  860. border-radius: 3rpx;
  861. position: relative;
  862. background: #2fc6cd;
  863. }
  864. .scroll-view_H {
  865. width: 100%;
  866. display: flex;
  867. overflow-x: auto;
  868. padding: 12rpx 0;
  869. background-color: #fff;
  870. box-sizing: border-box;
  871. &::-webkit-scrollbar {
  872. display: none;
  873. }
  874. -webkit-overflow-scrolling: touch;
  875. .tab.nav-bd {
  876. display: flex;
  877. align-items: center;
  878. width: 100%;
  879. }
  880. #tab_item.item {
  881. display: flex;
  882. flex-direction: column;
  883. align-items: center;
  884. // margin: 0 24rpx;
  885. padding: 8rpx 0;
  886. cursor: pointer;
  887. flex: 1;
  888. transition: all 0.3s ease;
  889. .uni-icons {
  890. font-size: 44rpx;
  891. margin-bottom: 6rpx;
  892. }
  893. .txt {
  894. font-size: 26rpx;
  895. color: #333;
  896. }
  897. }
  898. #tab_list:first-of-type .item.active {
  899. .uni-icons {
  900. color: #000;
  901. }
  902. .txt {
  903. color: #000;
  904. font-weight: bold;
  905. }
  906. }
  907. .privacy-wrapper {
  908. z-index: 999;
  909. position: fixed;
  910. left: 0;
  911. top: 0;
  912. width: 100%;
  913. height: 100%;
  914. background: #7f7f7f;
  915. .privacy-box {
  916. position: absolute;
  917. left: 50%;
  918. top: 50%;
  919. transform: translate(-50%, -50%);
  920. width: 560rpx;
  921. padding: 50rpx 45rpx 0;
  922. background: #fff;
  923. border-radius: 20rpx;
  924. .title {
  925. text-align: center;
  926. font-size: 32rpx;
  927. text-align: center;
  928. color: #333;
  929. font-weight: 700;
  930. }
  931. .content {
  932. margin-top: 20rpx;
  933. line-height: 1.5;
  934. font-size: 26rpx;
  935. color: #666;
  936. text-indent: 54rpx;
  937. i {
  938. font-style: normal;
  939. color: $theme-color;
  940. }
  941. }
  942. .btn-box {
  943. margin-top: 40rpx;
  944. text-align: center;
  945. font-size: 30rpx;
  946. .btn-item {
  947. height: 82rpx;
  948. line-height: 82rpx;
  949. background: linear-gradient(90deg, #f67a38 0%, #f11b09 100%);
  950. color: #fff;
  951. border-radius: 41rpx;
  952. }
  953. .btn {
  954. padding: 30rpx 0;
  955. }
  956. }
  957. }
  958. }
  959. }
  960. .page-index {
  961. position: relative;
  962. z-index: 1;
  963. height: 100%;
  964. padding-bottom: 200rpx;
  965. box-sizing: border-box;
  966. .top-box {
  967. padding-top: 168rpx;
  968. //background: linear-gradient(180deg, #ffe079 0%, #ffffff 100%);
  969. //background-image: url("https://sb-admin.oss-cn-shenzhen.aliyuncs.com/shuibei-mini/new-mini/jianbianBG.png");
  970. background-size: 100% 100%;
  971. }
  972. }
  973. .header {
  974. //position: sticky;
  975. //top: 0;
  976. //z-index: 200000;
  977. width: 100%;
  978. padding: 28rpx 20rpx 10rpx;
  979. .serch-wrapper {
  980. //margin-top: var(--status-bar-height);
  981. margin-bottom: 30rpx;
  982. display: flex;
  983. justify-content: center;
  984. align-items: center;
  985. /* #ifdef MP-WEIXIN */
  986. width: 100%;
  987. /* #endif */
  988. .logo {
  989. width: 154rpx;
  990. height: 47rpx;
  991. margin-right: 24rpx;
  992. }
  993. image {
  994. width: 118rpx;
  995. height: 42rpx;
  996. }
  997. .input {
  998. display: flex;
  999. align-items: center;
  1000. width: 100%;
  1001. height: 80rpx;
  1002. background-color: #ffffff;
  1003. border-radius: 20rpx;
  1004. font-size: 28rpx;
  1005. color: #868686;
  1006. .iconfont {
  1007. margin: 0 10rpx;
  1008. font-size: 26rpx;
  1009. color: #666666;
  1010. }
  1011. .searchImg{
  1012. width: 32rpx;
  1013. height: 32rpx;
  1014. margin: 0 20rpx;
  1015. }
  1016. }
  1017. }
  1018. .tabNav {
  1019. padding-top: 24rpx;
  1020. }
  1021. }
  1022. .page_content {
  1023. padding: 0 30rpx;
  1024. }
  1025. .index-product-wrapper {
  1026. padding: 0 30rpx;
  1027. margin-bottom: 200rpx; /* 为自定义 tabBar 留出空间 */
  1028. min-height: 700rpx;
  1029. //background: #fff;
  1030. &.on {
  1031. min-height: 1500rpx;
  1032. }
  1033. .list-box {
  1034. display: flex;
  1035. flex-wrap: wrap;
  1036. justify-content: space-between;
  1037. .item {
  1038. width: 48.99%;
  1039. //height: 490rpx;
  1040. background-color: #ffffff;
  1041. box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
  1042. border-radius: 20rpx;
  1043. margin-bottom: 20rpx;
  1044. overflow: hidden;
  1045. display: flex;
  1046. flex-direction: column;
  1047. justify-content: space-between;
  1048. .pictrue {
  1049. position: relative;
  1050. image {
  1051. width: 100%;
  1052. height: 330rpx;
  1053. }
  1054. }
  1055. .text-info {
  1056. padding: 10rpx 20rpx 15rpx;
  1057. .title {
  1058. color: #222222;
  1059. display: flex;
  1060. align-items: center;
  1061. justify-items: space-between;
  1062. .tip {
  1063. width: 61rpx;
  1064. height: auto;
  1065. font-size: 22rpx;
  1066. display: flex;
  1067. justify-content: center;
  1068. align-items: center;
  1069. color: #ffffff;
  1070. position: relative;
  1071. margin-right: 5rpx;
  1072. background-color: #ef4800;
  1073. border-radius: 5rpx;
  1074. }
  1075. .text{
  1076. width: 80%;
  1077. }
  1078. .weight{
  1079. background-color: rgba(197, 128, 3, 0.10);
  1080. color: #C58003;
  1081. font-size: 24rpx;
  1082. padding: 8rpx 16rpx;
  1083. border-radius: 8rpx;
  1084. float: right;
  1085. }
  1086. }
  1087. .bottom-row {
  1088. color: $theme-color;
  1089. display: flex;
  1090. justify-content: space-between;
  1091. align-items: center;
  1092. font-size: 28rpx;
  1093. margin: 10rpx 0 0;
  1094. .price {
  1095. padding-bottom: 4rpx;
  1096. font-weight: 800;
  1097. white-space: nowrap;
  1098. font-size: 28rpx;
  1099. color: #f16327;
  1100. }
  1101. .sales {
  1102. font-size: 22rpx;
  1103. white-space: nowrap;
  1104. color: #999999;
  1105. }
  1106. }
  1107. .merchantInfo{
  1108. display: flex;
  1109. align-items: center;
  1110. height: 60rpx;
  1111. }
  1112. .merchantLogo{
  1113. width: 40rpx;
  1114. height: 40rpx;
  1115. border-radius: 50%;
  1116. margin-right: 20rpx;
  1117. }
  1118. .merchantName{
  1119. font-size: 24rpx;
  1120. color: #333;
  1121. }
  1122. }
  1123. }
  1124. &.on {
  1125. display: flex;
  1126. }
  1127. }
  1128. }
  1129. .top-bg-box2 {
  1130. overflow: hidden;
  1131. padding: 20rpx;
  1132. box-sizing: border-box;
  1133. .title{
  1134. font-size: 32rpx;
  1135. color: #333333;
  1136. font-weight: bold;
  1137. line-height: 60rpx;
  1138. }
  1139. }
  1140. .top-bg-box {
  1141. overflow: hidden;
  1142. padding: 20rpx;
  1143. box-sizing: border-box;
  1144. // background-image: linear-gradient(
  1145. // to bottom,
  1146. // $header-color 0%,
  1147. // $header-color 10%,
  1148. // #ffe9a1 50%,
  1149. // transparent 100%
  1150. // );
  1151. .card{
  1152. background-color: #fff;
  1153. padding: 4rpx;
  1154. box-sizing: border-box;
  1155. border-radius: 20rpx;
  1156. .cardbgLinear{
  1157. padding: 20rpx 16rpx;
  1158. box-sizing: border-box;
  1159. border-radius: 20rpx;
  1160. background: linear-gradient(to bottom,
  1161. rgba(255, 240, 200, 0.7) 0%,
  1162. rgba(255, 240, 200, 0.4) 8%,
  1163. rgba(255, 255, 255, 1) 20%,
  1164. rgba(255, 255, 255, 1) 100%);
  1165. }
  1166. }
  1167. }
  1168. .top-bg-box {
  1169. .title {
  1170. display: flex;
  1171. justify-content: space-between; // 左右两端对齐
  1172. align-items: center; // 垂直居中
  1173. .title-left {
  1174. display: flex;
  1175. align-items: center;
  1176. .ssjj {
  1177. width: 150rpx;
  1178. height: 36rpx;
  1179. vertical-align: middle;
  1180. }
  1181. .updateTime {
  1182. font-size: 24rpx;
  1183. color: #666666;
  1184. padding: 0 20rpx;
  1185. box-sizing: border-box;
  1186. }
  1187. }
  1188. .more {
  1189. display: flex;
  1190. align-items: center;
  1191. .txt {
  1192. font-size: 28rpx;
  1193. color: #666666;
  1194. }
  1195. .right {
  1196. width: 40rpx;
  1197. vertical-align: middle;
  1198. margin-left: 10rpx; // 添加一些间距
  1199. }
  1200. }
  1201. }
  1202. }
  1203. .nav-list {
  1204. width: 100%;
  1205. display: flex;
  1206. justify-content: space-between;
  1207. align-items: center;
  1208. padding: 0 40rpx 0;
  1209. margin-top: 30rpx;
  1210. .item {
  1211. text-align: center;
  1212. .price{
  1213. font-size: 44rpx;
  1214. color: #FD5B37;
  1215. font-weight: bold;
  1216. .unit{
  1217. font-size: 28rpx;
  1218. }
  1219. }
  1220. .txt{
  1221. font-size: 28rpx;
  1222. color: #666666;
  1223. line-height: 60rpx;
  1224. }
  1225. }
  1226. }
  1227. .no-data {
  1228. margin: 150rpx auto 0;
  1229. text-align: center;
  1230. img {
  1231. width: 65%;
  1232. height: auto;
  1233. }
  1234. }
  1235. .inde-nav-bar{
  1236. .page-title{
  1237. color: #fff;
  1238. }
  1239. }
  1240. // 分类卡片区域样式
  1241. .classify-section {
  1242. background: #fff;
  1243. margin: 0 20rpx;
  1244. border-radius: 16rpx;
  1245. padding: 30rpx 0 10rpx;
  1246. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.06);
  1247. }
  1248. .classify-scroll {
  1249. width: 100%;
  1250. white-space: nowrap;
  1251. }
  1252. .classify-container {
  1253. width: 100%;
  1254. display: inline-flex;
  1255. flex-wrap: nowrap;
  1256. min-width: 100%;
  1257. }
  1258. .classify-item {
  1259. display: inline-flex;
  1260. flex-direction: column;
  1261. align-items: center;
  1262. justify-content: center;
  1263. width: 175rpx;
  1264. flex-shrink: 0;
  1265. box-sizing: border-box;
  1266. .classify-img {
  1267. width: 100rpx;
  1268. height: 100rpx;
  1269. }
  1270. .classify-txt {
  1271. font-size: 24rpx;
  1272. color: #666;
  1273. margin-top: 8rpx;
  1274. text-align: center;
  1275. white-space: nowrap;
  1276. overflow: hidden;
  1277. text-overflow: ellipsis;
  1278. max-width: 120rpx;
  1279. }
  1280. }
  1281. .nav-slot{
  1282. //width: 60%;
  1283. display: flex;
  1284. justify-content: space-between;
  1285. align-items: center;
  1286. .dianpu{
  1287. width: 32rpx;
  1288. }
  1289. .zhankai{
  1290. width: 20rpx;
  1291. }
  1292. .storeName{
  1293. width: 60%;
  1294. font-size: 28rpx;
  1295. color: #333;
  1296. }
  1297. }
  1298. .no-data {
  1299. margin: 150rpx auto 0;
  1300. text-align: center;
  1301. img {
  1302. width: 65%;
  1303. height: auto;
  1304. }
  1305. }
  1306. .mores-txt {
  1307. width: 100%;
  1308. align-items: center;
  1309. justify-content: center;
  1310. height: 70rpx;
  1311. color: #999;
  1312. font-size: 24rpx;
  1313. .iconfont {
  1314. margin-top: 2rpx;
  1315. font-size: 20rpx;
  1316. }
  1317. }
  1318. :deep(.page-title){
  1319. font-size: 36rpx;
  1320. }
  1321. </style>