index.vue 33 KB

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