index.vue 34 KB

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