index.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  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. classifyList.value = res.data.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>