index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  1. <template>
  2. <view>
  3. <view class="page-index" :class="{ bgf: navIndex > 0 }">
  4. </view>
  5. <drag-button
  6. :isDock="true"
  7. :price="viprealGoldprice"
  8. :existTabBar="true"
  9. @btnClick="btnClick"
  10. />
  11. </view>
  12. </template>
  13. <script setup>
  14. // 获取实时金价
  15. import useRealGoldPrice from "@/hooks/useRealGoldPrice";
  16. // 测试拖拽
  17. import dragButton from "@/components/drag-button/drag-button.vue";
  18. import { onLoad, onShow, onReachBottom } from "@dcloudio/uni-app";
  19. import { ref, onMounted, reactive, computed, getCurrentInstance } from "vue";
  20. import Auth from "@/libs/wechat";
  21. import Cache from "@/utils/cache";
  22. import { getIndexData, getCoupons, setCouponReceive } from "@/api/api.js";
  23. import { getProductListAPI } from "@/api/factory.js";
  24. import { getShare, kefuConfig } from "@/api/public.js";
  25. import {
  26. getGroomList as getGroomListApi,
  27. getProductByCategoryId,
  28. } from "@/api/store.js";
  29. import {goShopDetail} from "@/libs/order.js";
  30. import {silenceBindingSpread} from "@/utils";
  31. import {getUserLevelInfo} from "@/api/user";
  32. import {useStoreRights} from "@/stores/rights";
  33. const userBenefits = ref({});
  34. // 获取用户权益
  35. const rightsStore = useStoreRights();
  36. // 获取实时金价
  37. const {realGoldprice, fetchGoldPrice} = useRealGoldPrice("RTJ_Au");
  38. const getUserBenefits = async () => {
  39. try {
  40. const res = await getUserLevelInfo(appStore.userInfo.userId);
  41. userBenefits.value = res.data || {sold: 0, buy: 0}; // 默认权益为0,避免NaN
  42. } catch (error) {
  43. console.error("获取用户权益失败:", error);
  44. userBenefits.value = {sold: 0, buy: 0}; // 出错时默认权益为0
  45. }
  46. };
  47. // 黄金调整价
  48. const adjustGoldprice = computed(() => {
  49. const res = rightsStore.userBenefits.nobleMeta?.find(
  50. (gold) => gold.name == "黄金"
  51. );
  52. return res;
  53. });
  54. const viprealGoldprice = computed(() => {
  55. const res =
  56. Number(realGoldprice.value) -
  57. Number(rightsStore.userBenefits.buy) +
  58. Number(adjustGoldprice.value?.sellPriceAdjust) || 0;
  59. return Number(res).toFixed(2);
  60. });
  61. const btnClick = () => {
  62. uni.navigateTo({
  63. url: "/pages/mall/dapan",
  64. });
  65. };
  66. // };
  67. import {useAppStore} from "@/stores/app";
  68. const appStore = useAppStore();
  69. const app = getApp();
  70. const instance = getCurrentInstance();
  71. const navH = ref("");
  72. const marTop = ref(0);
  73. const searchH = ref(0);
  74. const loading = ref(false);
  75. // Authorization
  76. const isShowAuth = ref(false);
  77. const iShidden = ref(false);
  78. const window = ref(false);
  79. // Navigation and Tabs
  80. const navIndex = ref(0);
  81. const ProductNavindex = ref(0);
  82. const listActive = ref(0);
  83. const tabsScrollLeft = ref(0);
  84. const scrollLeft = ref(0);
  85. const lineStyle = ref({});
  86. const duration = ref(0.2);
  87. // Home Page Data
  88. const logoUrl = ref("");
  89. const site_name = ref("");
  90. const imgUrls = ref([]);
  91. const menus = ref([]);
  92. const roll = ref([]);
  93. const explosiveMoney = ref([]);
  94. const goodType = ref(1);
  95. const goodScroll = ref(true);
  96. const iSshowH = ref(false);
  97. const stickyTop = ref(0);
  98. const navMenus = ref([
  99. {
  100. name: "商城订单",
  101. icon: "icon-wodedingdan1",
  102. type: 1,
  103. url: "/pages/order_list/index",
  104. size: 25,
  105. },
  106. {
  107. name: "购物车",
  108. icon: "icon-gouwuche",
  109. type: 2,
  110. url: "/pages/order_addcart/order_addcart",
  111. size: 26,
  112. },
  113. {
  114. name: "卡卷包",
  115. icon: "icon-kabao",
  116. type: 3,
  117. url: "/pages/users/user_coupon/index",
  118. size: 28,
  119. },
  120. {
  121. name: "客服消息",
  122. icon: "icon-xiaoxi",
  123. type: 4,
  124. url: "/pages/message_create/message_create",
  125. size: 26,
  126. },
  127. ]);
  128. // 轮播图数据
  129. const list1 = ref([]);
  130. // Product Lists
  131. const sortProduct = ref([]);
  132. const goodsList = ref([]);
  133. const goodsTwoList = ref([]);
  134. const currentSecondCategoryId = ref(null);
  135. const goodsNavs = ref([
  136. {name: "新品推荐", type: 1, icon: "icon-xinpintuijian", size: 25},
  137. {name: "黄金金条", type: 2, icon: "icon-touzijintiao1", size: 25},
  138. {name: "黄金首饰", type: 3, icon: "icon-huangjinshoushi", size: 25},
  139. {name: "其他", type: 4, icon: "icon-a-ziyuan97", size: 25},
  140. ]);
  141. const skillPro = ref({});
  142. const factoryPro = ref({});
  143. // 前往福利秒杀
  144. const goFlashSale = () => {
  145. uni.navigateTo({
  146. url: "/pages/users/utils/flashSale/newIndex",
  147. });
  148. };
  149. // 前往团购
  150. const goGroupBuying = () => {
  151. uni.navigateTo({
  152. url: "/pages/group_buying/index",
  153. });
  154. };
  155. // Pagination
  156. const params = ref({
  157. page: 1,
  158. limit: 10,
  159. });
  160. const hotScroll = ref(false);
  161. const headerHeight = ref(0);
  162. // Other
  163. const couponList = ref([]);
  164. const configApi = ref({});
  165. // pinia
  166. const isLogin = appStore.isLogin;
  167. const uid = appStore.uidComputed;
  168. const arrTemp = [
  169. "beforePay",
  170. "afterPay",
  171. "refundApply",
  172. "beforeRecharge",
  173. "createBargain",
  174. "pink",
  175. ];
  176. // 前往定制工厂
  177. const goFactory = () => {
  178. uni.navigateTo({
  179. url: "/pages/users/utils/factory/index",
  180. });
  181. };
  182. // Coupon Functions
  183. const getCoupon = async (id, index) => {
  184. try {
  185. await setCouponReceive(id);
  186. couponList.value[index].isUse = true;
  187. uni.showToast({title: "领取成功"});
  188. } catch (err) {
  189. uni.showToast({title: err.message, icon: "none"});
  190. }
  191. };
  192. // Tab Navigation Functions
  193. const clickSort = (index) => {
  194. listActive.value = index;
  195. };
  196. const scroll = (e) => {
  197. scrollLeft.value = e.detail.scrollLeft;
  198. };
  199. // Home Page Data Functions
  200. const getIndexConfig = async () => {
  201. try {
  202. loading.value = true;
  203. const res = await getIndexData();
  204. uni.setNavigationBarTitle({title: "首页"});
  205. skillPro.value = res.data.storeSeckillProductDetailResponse;
  206. const factoryProRes = await getProductListAPI(0);
  207. factoryPro.value = factoryProRes.data[0];
  208. logoUrl.value = res.data.logoUrl;
  209. site_name.value = "首页";
  210. list1.value = res.data.banner.map((v) => {
  211. return {
  212. url: v.pic,
  213. title: "",
  214. type: "image",
  215. navUrl: v.url,
  216. };
  217. });
  218. // console.log("list1==========>", list1.value);
  219. menus.value = res.data.menus;
  220. roll.value = res.data.roll || [];
  221. // #ifdef H5
  222. appStore.SET_CHATURL(res.data.yzfUrl);
  223. Cache.set("chatUrl", res.data.yzfUrl);
  224. // #endif
  225. const iconTypes = [
  226. "icon-shouye",
  227. "icon-shouye",
  228. "icon-shouye",
  229. "icon-shouye",
  230. ];
  231. explosiveMoney.value = res.data.explosiveMoney.map((v, i) => ({
  232. ...v,
  233. icon: iconTypes[i] || "icon-shouye",
  234. }));
  235. await getGroomList();
  236. await shareApi();
  237. await getcouponList();
  238. } catch (err) {
  239. console.error(err);
  240. } finally {
  241. loading.value = false;
  242. }
  243. };
  244. const getcouponList = async () => {
  245. try {
  246. const res = await getCoupons({page: 1, limit: 6});
  247. couponList.value = res.data;
  248. // #ifdef MP
  249. uni.getSetting({
  250. success(res) {
  251. window.value =
  252. !res.authSetting["scope.userInfo"] && couponList.value.length
  253. ? true
  254. : false;
  255. iShidden.value = res.authSetting["scope.userInfo"];
  256. },
  257. });
  258. // #endif
  259. // #ifndef MP
  260. window.value = isLogin ? false : res.data.length ? true : false;
  261. // #endif
  262. } catch (err) {
  263. uni.showToast({title: err.message, icon: "none"});
  264. }
  265. };
  266. const shareApi = async () => {
  267. try {
  268. const res = await getShare();
  269. configApi.value = res.data;
  270. // #ifdef H5
  271. setOpenShare(res.data);
  272. // #endif
  273. } catch (err) {
  274. console.error(err);
  275. }
  276. };
  277. const getChatUrL = async () => {
  278. try {
  279. const res = await kefuConfig();
  280. appStore.SET_CHATURL(res.data.yzfUrl);
  281. Cache.set("chatUrl", res.data.yzfUrl);
  282. } catch (err) {
  283. console.error(err);
  284. }
  285. };
  286. const setOpenShare = (data) => {
  287. if (Auth.isWeixin()) {
  288. const configAppMessage = {
  289. desc: data.synopsis,
  290. title: data.title,
  291. link: location.href,
  292. imgUrl: data.img,
  293. };
  294. Auth.wechatEvevt(
  295. ["updateAppMessageShareData", "updateTimelineShareData"],
  296. configAppMessage
  297. );
  298. }
  299. };
  300. // Authorization
  301. const authColse = (e) => {
  302. isShowAuth.value = e;
  303. };
  304. // Product Navigation
  305. const ProductNavTab = (item, index) => {
  306. goodsList.value = [];
  307. goodsTwoList.value = [];
  308. listActive.value = index;
  309. goodType.value = item.type;
  310. ProductNavindex.value = index;
  311. params.value.page = 1;
  312. goodScroll.value = true;
  313. currentSecondCategoryId.value = null;
  314. getGroomList(true);
  315. };
  316. // Product Details
  317. const goDetail = async (item) => {
  318. if (item.activityH5 && item.activityH5.type === "2" && !isLogin) {
  319. toLogin();
  320. } else {
  321. await goShopDetail(item, uid);
  322. uni.navigateTo({url: `/pages/goods_details/index?id=${item.id}`});
  323. }
  324. };
  325. const godDetail = async (item) => {
  326. await goShopDetail(item, uid);
  327. uni.navigateTo({url: `/pages/goods_details/index?id=${item.id}`});
  328. };
  329. const isNoDataState = computed(() => {
  330. return goodsList.value.length === 0 && !loading.value;
  331. });
  332. // Product Lists
  333. const getGroomList = async (onloadH = false) => {
  334. if (!goodScroll.value) return;
  335. if (onloadH) iSshowH.value = true;
  336. try {
  337. loading.value = true;
  338. const {data} = await getGroomListApi(goodType.value, params.value);
  339. iSshowH.value = false;
  340. goodsList.value = [...goodsList.value, ...data.productList.list] || [];
  341. goodsTwoList.value = data.secondLevelCategories || [];
  342. goodScroll.value = data.productList.list.length >= params.value.limit;
  343. params.value.page++;
  344. currentSecondCategoryId.value = null;
  345. } catch (err) {
  346. console.error(err);
  347. } finally {
  348. loading.value = false;
  349. }
  350. };
  351. async function clickSwiper(index) {
  352. const imgItem = list1.value[index];
  353. try {
  354. if (imgItem.navUrl !== "#") {
  355. await uni.navigateTo({url: imgItem.navUrl});
  356. } else {
  357. uni.previewImage({
  358. current: index,
  359. urls: list1.value.map((item) => item.url) || [],
  360. });
  361. }
  362. } catch (err) {
  363. uni.previewImage({
  364. current: index,
  365. urls: list1.value.map((item) => item.url) || [],
  366. });
  367. return;
  368. }
  369. }
  370. const handleSecondCategoryClick = async (categoryId) => {
  371. currentSecondCategoryId.value = categoryId;
  372. params.value.page = 1;
  373. goodsList.value = [];
  374. goodScroll.value = false;
  375. try {
  376. loading.value = true;
  377. const {data} = await getProductByCategoryId(categoryId, params.value);
  378. goodsList.value = data.list;
  379. goodScroll.value = data.list.length >= params.value.limit;
  380. params.value.page++;
  381. } catch (err) {
  382. console.error(err);
  383. } finally {
  384. loading.value = false;
  385. }
  386. };
  387. const get_host_product = async () => {
  388. if (hotScroll.value) return;
  389. try {
  390. loading.onMounted(() => {
  391. });
  392. } catch (err) {
  393. console.error(err);
  394. } finally {
  395. loading.value = false;
  396. }
  397. };
  398. onLoad((option) => {
  399. getUserBenefits();
  400. uni.getSystemInfo({
  401. success(res) {
  402. appStore.SYSTEM_PLATFORM(res.platform);
  403. },
  404. });
  405. // uni.getLocation({
  406. // type: "gcj02",
  407. // altitude: true,
  408. // geocode: true,
  409. // success: (res) => {
  410. // try {
  411. // uni.setStorageSync("user_latitude", res.latitude);
  412. // uni.setStorageSync("user_longitude", res.longitude);
  413. // } catch {}
  414. // },
  415. // });
  416. navH.value = app.globalData.navHeight;
  417. // #ifndef MP
  418. navH.value = 0;
  419. // #endif
  420. isLogin && silenceBindingSpread();
  421. });
  422. onShow(() => {
  423. getIndexConfig();
  424. uni.setNavigationBarTitle({title: site_name.value});
  425. });
  426. onMounted(() => {
  427. // #ifdef H5
  428. const appSearchH = uni.createSelectorQuery().select(".serch-wrapper");
  429. appSearchH
  430. .boundingClientRect((data) => {
  431. searchH.value = data.height;
  432. })
  433. .exec();
  434. // #endif
  435. const query = uni.createSelectorQuery().in(instance.proxy);
  436. query.select(".header").boundingClientRect((data) => {
  437. headerHeight.value = Math.ceil(data.height);
  438. });
  439. query
  440. .select(".sticky-box")
  441. .boundingClientRect((data) => {
  442. // marTop.value = Util.pxToRpx(data.height);
  443. // stickyTop.value = data.height;
  444. console.log({data});
  445. marTop.value = data.height + 5;
  446. })
  447. .exec();
  448. });
  449. // #ifdef MP
  450. const onShareAppMessage = () => {
  451. return {
  452. title: configApi.value.title,
  453. imageUrl: configApi.value.img,
  454. desc: configApi.value.synopsis,
  455. path: "/pages/index/index",
  456. };
  457. };
  458. // #endif
  459. onReachBottom(() => {
  460. if (navIndex.value === 0) {
  461. if (currentSecondCategoryId.value) {
  462. if (goodScroll.value) {
  463. getProductByCategoryId(currentSecondCategoryId.value, params.value)
  464. .then(({data}) => {
  465. // console.log("11111=>", data);
  466. goodsList.value =
  467. [...goodsList.value, ...data.productList.list] || [];
  468. goodScroll.value =
  469. data.productList.list.length >= params.value.limit;
  470. params.value.page++;
  471. })
  472. .catch(console.error);
  473. }
  474. } else {
  475. if (params.value.page !== 1) {
  476. getGroomList();
  477. }
  478. }
  479. } else {
  480. }
  481. });
  482. // 定义 onChange 方法
  483. const onChange = (e) => {
  484. timeData.value = e;
  485. };
  486. const timeData = ref({});
  487. const calculatedProducts = computed(() => {
  488. // 计算逻辑与原代码一致,但基于响应式数据 products
  489. return goodsList.value.map((product) => {
  490. // 1. 将price字符串转为数字
  491. const price = Number(product.price);
  492. // 2. 计算乘积
  493. const total = (price + product.sales) * realGoldprice.value;
  494. // 3. 向上取整到两位小数(先放大100倍取整,再缩小100倍)
  495. const roundedTotal = Math.ceil(total * 100) / 100;
  496. // 4. 格式化保留两位小数
  497. const formattedTotal = roundedTotal.toFixed(2);
  498. return {
  499. ...product,
  500. calculatedTotal: formattedTotal, // 新增计算结果字段
  501. };
  502. });
  503. });
  504. const goBack = () => {
  505. uni.switchTab({url: "/pages/index/index"});
  506. };
  507. // 解析商品规格信息
  508. const switchTagName = (jsonStr) => {
  509. // console.log("jsonStr", jsonStr);
  510. if (!jsonStr || typeof jsonStr !== "string") {
  511. return [];
  512. }
  513. try {
  514. const attrObj = JSON.parse(jsonStr);
  515. if (typeof attrObj !== "object" || attrObj === null) {
  516. return [];
  517. }
  518. return Object.entries(attrObj).map(([key, value]) => ({
  519. key: String(key),
  520. value: String(value),
  521. }));
  522. } catch (err) {
  523. console.error("解析商品规格失败:", err);
  524. return [];
  525. }
  526. };
  527. // 价格
  528. const totalPrice = (pro) => {
  529. return (
  530. Number(pro.weight) * Number(pro.price) +
  531. Number(pro.additionalAmount)
  532. ).toFixed(2);
  533. };
  534. </script>
  535. <style>
  536. page {
  537. display: flex;
  538. flex-direction: column;
  539. height: 100%;
  540. /* #ifdef H5 */
  541. background-color: #fff;
  542. /* #endif */
  543. }
  544. </style>
  545. <style lang="scss" scoped>
  546. .Hoverball {
  547. display: flex;
  548. justify-content: center;
  549. align-items: center;
  550. flex-direction: column;
  551. background: linear-gradient(180deg, #fefcf9 0%, #fff2df 100%);
  552. box-shadow: 0rpx 3rpx 12rpx 0rpx rgba(0, 0, 0, 0.16);
  553. width: 105upx;
  554. height: 105upx;
  555. border-radius: 50%; // 圆形按钮
  556. position: fixed; // 固定定位(不随页面滚动)
  557. z-index: 999999; // 最高层级,避免被其他元素遮挡
  558. top: 0%;
  559. right: 0%;
  560. .title {
  561. font-size: 19rpx;
  562. color: #000000;
  563. margin-bottom: 4rpx; // 文本与价格间距
  564. }
  565. .price {
  566. font-size: 26rpx;
  567. color: #cc0000;
  568. font-weight: bold;
  569. }
  570. // 贴边/停止拖拽时的过渡动画
  571. &.transition {
  572. transition: left 0.3s ease, top 0.3s ease;
  573. }
  574. }
  575. .couponIndex {
  576. width: auto;
  577. height: 238rpx;
  578. background-image: url("~@/static/images/yhjsy.png");
  579. background-size: 100% 100%;
  580. padding-left: 42rpx;
  581. margin-bottom: 30rpx;
  582. .titBox {
  583. padding: 47rpx 0;
  584. text-align: center;
  585. height: 100%;
  586. .tit1 {
  587. color: #ffebd2;
  588. font-size: 34rpx;
  589. font-weight: 600;
  590. }
  591. .tit2 {
  592. color: #ffebd2;
  593. font-size: 22rpx;
  594. margin: 10rpx 0 26rpx 0;
  595. }
  596. .tit3 {
  597. color: #ffdaaf;
  598. font-size: 24rpx;
  599. .iconfont {
  600. font-size: 20rpx;
  601. }
  602. }
  603. }
  604. .listBox {
  605. padding: 14rpx 0;
  606. .listActive {
  607. background-image: url("~@/static/images/lingyhj.png");
  608. background-size: 100% 100%;
  609. }
  610. .listHui {
  611. background-image: url("~@/static/images/weiling.png");
  612. background-size: 100% 100%;
  613. }
  614. .list {
  615. width: 170rpx;
  616. height: 210rpx;
  617. padding: 16rpx 0;
  618. text-align: center;
  619. margin-left: 24rpx;
  620. .tit {
  621. font-size: 18rpx;
  622. padding: 0 26rpx;
  623. }
  624. .titActive {
  625. color: #c99959;
  626. }
  627. .price {
  628. font-size: 46rpx;
  629. font-weight: 900;
  630. margin-top: 4rpx;
  631. }
  632. .pricehui {
  633. color: #b2b2b2;
  634. }
  635. .fonthui {
  636. background-color: #f5f5f5 !important;
  637. }
  638. .yuan {
  639. font-size: 24rpx;
  640. }
  641. .ling {
  642. font-size: 24rpx;
  643. margin-top: 9.5rpx;
  644. width: 102rpx;
  645. height: 36rpx;
  646. line-height: 36rpx;
  647. background-color: #ffe5c7;
  648. border-radius: 28rpx;
  649. margin: auto;
  650. }
  651. .priceM {
  652. color: #ffdaaf;
  653. font-size: 22rpx;
  654. margin-top: 14rpx;
  655. }
  656. }
  657. }
  658. }
  659. .sticky-box {
  660. // display: flex;
  661. // position: -webkit-sticky;
  662. // position: sticky;
  663. z-index: 99;
  664. flex-direction: row;
  665. // margin: 0px;
  666. // background: #fff;
  667. padding-bottom: 30rpx;
  668. background: #fff;
  669. margin-top: 30rpx;
  670. .active {
  671. color: #000;
  672. }
  673. .nav-bd {
  674. display: flex;
  675. align-items: center;
  676. justify-content: space-between;
  677. padding: 0 20rpx;
  678. .item {
  679. display: flex;
  680. flex-direction: column;
  681. align-items: center;
  682. justify-content: center;
  683. border-bottom: 3rpx solid #e6e6e6;
  684. box-sizing: border-box;
  685. .txt {
  686. font-size: 28rpx;
  687. color: #282828;
  688. }
  689. .label {
  690. display: flex;
  691. align-items: center;
  692. justify-content: center;
  693. width: 124rpx;
  694. height: 32rpx;
  695. margin-top: 5rpx;
  696. font-size: 24rpx;
  697. color: #999;
  698. }
  699. &.active {
  700. color: $theme-color;
  701. border-bottom: 2rpx solid #000;
  702. .txt {
  703. color: $theme-color;
  704. }
  705. .label {
  706. background: linear-gradient(90deg, $bg-star 0%, $bg-end 100%);
  707. border-radius: 16rpx;
  708. color: #fff;
  709. }
  710. }
  711. }
  712. }
  713. .second-nav {
  714. width: 100%;
  715. display: flex;
  716. flex-wrap: nowrap;
  717. overflow-x: auto;
  718. &::-webkit-scrollbar {
  719. display: none;
  720. }
  721. -webkit-overflow-scrolling: touch;
  722. padding: 0 50rpx;
  723. box-sizing: border-box;
  724. .second-nav-item {
  725. font-size: 26rpx;
  726. padding: 15rpx 0;
  727. margin: 0 10rpx 0 0;
  728. color: #000;
  729. white-space: nowrap;
  730. // flex: 1;
  731. width: 33%;
  732. display: flex;
  733. justify-content: center;
  734. align-items: center;
  735. &.active {
  736. color: #ef4800;
  737. }
  738. }
  739. }
  740. }
  741. .swiper-box {
  742. margin: 0 30rpx;
  743. &::v-deep uni-image {
  744. width: 100%;
  745. }
  746. }
  747. // 活动专区
  748. .active-contanier {
  749. width: 100%;
  750. box-sizing: border-box;
  751. padding: 0 30rpx;
  752. .active-scroll {
  753. width: 100%;
  754. white-space: nowrap;
  755. .active-scroll-content {
  756. margin: 30rpx 0;
  757. display: flex;
  758. flex-direction: row;
  759. white-space: nowrap;
  760. }
  761. }
  762. .active-item {
  763. // width: 335rpx;
  764. width: 48.99%;
  765. background: #ffffff;
  766. height: 180rpx;
  767. box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
  768. border-radius: 20rpx;
  769. padding: 13rpx 20rpx;
  770. box-sizing: border-box;
  771. display: flex;
  772. flex-direction: column;
  773. margin-right: 20rpx;
  774. flex-shrink: 0;
  775. .title-box {
  776. height: 33rpx;
  777. display: flex;
  778. font-size: 22rpx;
  779. align-items: center;
  780. .title {
  781. // width: 50%;
  782. font-weight: bold;
  783. text-align: center;
  784. }
  785. }
  786. .active-box {
  787. flex: 1;
  788. display: flex;
  789. .active-item-left {
  790. flex: 1;
  791. display: flex;
  792. flex-direction: column;
  793. .image-box {
  794. flex: 1;
  795. // width: 115rpx;
  796. display: flex;
  797. align-items: center;
  798. image {
  799. border-radius: 5rpx;
  800. width: 115rpx;
  801. height: 110rpx;
  802. }
  803. .da-jin-tiao {
  804. width: 51rpx;
  805. }
  806. }
  807. }
  808. .active-item-right {
  809. display: flex;
  810. flex-direction: column;
  811. justify-content: space-between;
  812. flex: 1;
  813. min-width: 0;
  814. width: 0;
  815. .ms {
  816. font-size: 16rpx;
  817. color: #000000;
  818. width: 100%;
  819. overflow: hidden;
  820. text-overflow: ellipsis;
  821. white-space: nowrap;
  822. display: block;
  823. max-width: 100%;
  824. box-sizing: border-box;
  825. }
  826. .tag {
  827. display: flex;
  828. .tag-text {
  829. color: #acacac;
  830. background-color: #ebebeb;
  831. border-radius: 5rpx;
  832. font-size: 16rpx;
  833. text-align: center;
  834. padding: 0rpx 5rpx;
  835. }
  836. }
  837. .price-box {
  838. display: flex;
  839. justify-content: space-between;
  840. .price {
  841. font-size: 18rpx;
  842. font-weight: bold;
  843. color: #000000;
  844. margin-right: 10rpx;
  845. }
  846. .btn {
  847. width: 77rpx;
  848. height: 26rpx;
  849. background-image: linear-gradient(270deg, #fc962c 0%, #f0470d 100%);
  850. border-radius: 100rpx;
  851. display: flex;
  852. justify-content: center;
  853. align-items: center;
  854. font-size: 14rpx;
  855. color: #ffffff;
  856. }
  857. }
  858. }
  859. }
  860. }
  861. }
  862. .listAll {
  863. width: 20%;
  864. text-indent: 62rpx;
  865. font-size: 30rpx;
  866. border-left: 1px #eee solid;
  867. margin: 1% 0;
  868. padding: 5rpx;
  869. position: relative;
  870. image {
  871. position: absolute;
  872. left: 20rpx;
  873. top: 8rpx;
  874. }
  875. }
  876. .tab {
  877. position: relative;
  878. display: flex;
  879. font-size: 28rpx;
  880. white-space: nowrap;
  881. &__item {
  882. flex: 1;
  883. padding: 0 20rpx;
  884. text-align: center;
  885. height: 60rpx;
  886. line-height: 60rpx;
  887. color: #666;
  888. &.active {
  889. color: #09c2c9;
  890. }
  891. }
  892. }
  893. .tab__line {
  894. display: block;
  895. height: 6rpx;
  896. position: absolute;
  897. bottom: 0;
  898. left: 0;
  899. z-index: 1;
  900. border-radius: 3rpx;
  901. position: relative;
  902. background: #2fc6cd;
  903. }
  904. .scroll-view_H {
  905. width: 100%;
  906. display: flex;
  907. overflow-x: auto;
  908. padding: 12rpx 0;
  909. background-color: #fff;
  910. box-sizing: border-box;
  911. &::-webkit-scrollbar {
  912. display: none;
  913. }
  914. -webkit-overflow-scrolling: touch;
  915. .tab.nav-bd {
  916. display: flex;
  917. align-items: center;
  918. width: 100%;
  919. }
  920. #tab_item.item {
  921. display: flex;
  922. flex-direction: column;
  923. align-items: center;
  924. // margin: 0 24rpx;
  925. padding: 8rpx 0;
  926. cursor: pointer;
  927. flex: 1;
  928. transition: all 0.3s ease;
  929. .uni-icons {
  930. font-size: 44rpx;
  931. margin-bottom: 6rpx;
  932. }
  933. .txt {
  934. font-size: 26rpx;
  935. color: #333;
  936. }
  937. }
  938. #tab_list:first-of-type .item.active {
  939. .uni-icons {
  940. color: #000;
  941. }
  942. .txt {
  943. color: #000;
  944. font-weight: bold;
  945. }
  946. }
  947. .privacy-wrapper {
  948. z-index: 999;
  949. position: fixed;
  950. left: 0;
  951. top: 0;
  952. width: 100%;
  953. height: 100%;
  954. background: #7f7f7f;
  955. .privacy-box {
  956. position: absolute;
  957. left: 50%;
  958. top: 50%;
  959. transform: translate(-50%, -50%);
  960. width: 560rpx;
  961. padding: 50rpx 45rpx 0;
  962. background: #fff;
  963. border-radius: 20rpx;
  964. .title {
  965. text-align: center;
  966. font-size: 32rpx;
  967. text-align: center;
  968. color: #333;
  969. font-weight: 700;
  970. }
  971. .content {
  972. margin-top: 20rpx;
  973. line-height: 1.5;
  974. font-size: 26rpx;
  975. color: #666;
  976. text-indent: 54rpx;
  977. i {
  978. font-style: normal;
  979. color: $theme-color;
  980. }
  981. }
  982. .btn-box {
  983. margin-top: 40rpx;
  984. text-align: center;
  985. font-size: 30rpx;
  986. .btn-item {
  987. height: 82rpx;
  988. line-height: 82rpx;
  989. background: linear-gradient(90deg, #f67a38 0%, #f11b09 100%);
  990. color: #fff;
  991. border-radius: 41rpx;
  992. }
  993. .btn {
  994. padding: 30rpx 0;
  995. }
  996. }
  997. }
  998. }
  999. }
  1000. .page-index {
  1001. position: relative;
  1002. z-index: 1;
  1003. height: 100%;
  1004. .top-box {
  1005. background: linear-gradient(180deg, #ffe079 0%, #ffffff 100%);
  1006. }
  1007. }
  1008. .header {
  1009. position: sticky;
  1010. top: 0;
  1011. z-index: 200000;
  1012. width: 100%;
  1013. padding: 28rpx 30rpx;
  1014. .serch-wrapper {
  1015. margin-top: var(--status-bar-height);
  1016. display: flex;
  1017. justify-content: center;
  1018. align-items: center;
  1019. /* #ifdef MP-WEIXIN */
  1020. width: 75%;
  1021. /* #endif */
  1022. .logo {
  1023. width: 154rpx;
  1024. height: 47rpx;
  1025. margin-right: 24rpx;
  1026. }
  1027. image {
  1028. width: 118rpx;
  1029. height: 42rpx;
  1030. }
  1031. .input {
  1032. display: flex;
  1033. align-items: center;
  1034. width: 447rpx;
  1035. height: 58rpx;
  1036. background-color: #ffffff;
  1037. border-radius: 10rpx;
  1038. font-size: 22rpx;
  1039. color: #868686;
  1040. .iconfont {
  1041. margin: 0 10rpx;
  1042. font-size: 26rpx;
  1043. color: #666666;
  1044. }
  1045. }
  1046. }
  1047. .tabNav {
  1048. padding-top: 24rpx;
  1049. }
  1050. }
  1051. .page_content {
  1052. padding: 0 30rpx;
  1053. }
  1054. .index-product-wrapper {
  1055. padding: 0 30rpx;
  1056. margin-bottom: 110rpx;
  1057. min-height: 700rpx;
  1058. background: #fff;
  1059. &.on {
  1060. min-height: 1500rpx;
  1061. }
  1062. .list-box {
  1063. display: flex;
  1064. flex-wrap: wrap;
  1065. justify-content: space-between;
  1066. .item {
  1067. width: 48.99%;
  1068. height: 463rpx;
  1069. background-color: #ffffff;
  1070. box-shadow: 0rpx 3rpx 13rpx 0rpx rgba(0, 0, 0, 0.13);
  1071. border-radius: 20rpx;
  1072. margin-bottom: 20rpx;
  1073. overflow: hidden;
  1074. display: flex;
  1075. flex-direction: column;
  1076. justify-content: space-between;
  1077. .pictrue {
  1078. position: relative;
  1079. image {
  1080. width: 100%;
  1081. height: 330rpx;
  1082. }
  1083. }
  1084. .text-info {
  1085. padding: 10rpx 20rpx 15rpx;
  1086. .title {
  1087. color: #222222;
  1088. display: flex;
  1089. align-items: center;
  1090. .tip {
  1091. width: 61rpx;
  1092. height: auto;
  1093. font-size: 22rpx;
  1094. display: flex;
  1095. justify-content: center;
  1096. align-items: center;
  1097. color: #ffffff;
  1098. position: relative;
  1099. margin-right: 5rpx;
  1100. background-color: #ef4800;
  1101. border-radius: 5rpx;
  1102. }
  1103. }
  1104. .bottom-row {
  1105. color: $theme-color;
  1106. display: flex;
  1107. justify-content: space-between;
  1108. align-items: center;
  1109. font-size: 28rpx;
  1110. margin: 10rpx 0 0;
  1111. .price {
  1112. padding-bottom: 4rpx;
  1113. font-weight: 800;
  1114. white-space: nowrap;
  1115. font-size: 28rpx;
  1116. color: #f16327;
  1117. }
  1118. .sales {
  1119. color: #b4b4b4;
  1120. font-size: 22rpx;
  1121. white-space: nowrap;
  1122. color: #6e6e6e;
  1123. }
  1124. }
  1125. }
  1126. }
  1127. &.on {
  1128. display: flex;
  1129. }
  1130. }
  1131. }
  1132. .top-bg-box {
  1133. overflow: hidden;
  1134. // background-image: linear-gradient(
  1135. // to bottom,
  1136. // $header-color 0%,
  1137. // $header-color 10%,
  1138. // #ffe9a1 50%,
  1139. // transparent 100%
  1140. // );
  1141. }
  1142. .nav-list {
  1143. width: 100%;
  1144. display: flex;
  1145. justify-content: space-between;
  1146. align-items: center;
  1147. padding: 0 40rpx 0;
  1148. margin: 25rpx 0;
  1149. .item {
  1150. text-align: center;
  1151. }
  1152. }
  1153. .no-data {
  1154. margin: 150rpx auto 0;
  1155. text-align: center;
  1156. img {
  1157. width: 65%;
  1158. height: auto;
  1159. }
  1160. }
  1161. .mores-txt {
  1162. width: 100%;
  1163. align-items: center;
  1164. justify-content: center;
  1165. height: 70rpx;
  1166. color: #999;
  1167. font-size: 24rpx;
  1168. .iconfont {
  1169. margin-top: 2rpx;
  1170. font-size: 20rpx;
  1171. }
  1172. }
  1173. .menu-txt {
  1174. font-size: 24rpx;
  1175. color: #454545;
  1176. }
  1177. .stats {
  1178. position: absolute;
  1179. left: 0px;
  1180. top: 0px;
  1181. z-index: 2000000;
  1182. width: 750rpx;
  1183. height: var(--status-bar-height);
  1184. background: #ffffff;
  1185. }
  1186. // 倒计时样式
  1187. .time {
  1188. @include flex;
  1189. align-items: center;
  1190. &__custom {
  1191. // margin-top: 4px;
  1192. width: 24rpx;
  1193. height: 24rpx;
  1194. background-color: #ef4800;
  1195. border-radius: 4px;
  1196. /* #ifndef APP-NVUE */
  1197. display: flex;
  1198. /* #endif */
  1199. justify-content: center;
  1200. align-items: center;
  1201. font-size: 12rpx;
  1202. border-radius: 50%;
  1203. margin-left: 10rpx;
  1204. &__item {
  1205. color: #fff;
  1206. font-size: 12rpx;
  1207. text-align: center;
  1208. }
  1209. }
  1210. &__doc {
  1211. color: #ef4800;
  1212. padding: 0px 4rpx;
  1213. margin-bottom: 4rpx;
  1214. }
  1215. &__item {
  1216. color: #606266;
  1217. font-size: 15px;
  1218. margin-right: 4px;
  1219. }
  1220. }
  1221. .live {
  1222. width: 59rpx;
  1223. height: 20rpx;
  1224. background-color: #ef4800;
  1225. border-radius: 5rpx;
  1226. font-size: 12rpx;
  1227. display: flex;
  1228. justify-content: center;
  1229. align-items: center;
  1230. margin-left: 10rpx;
  1231. color: #ffffff;
  1232. }
  1233. .weixia {
  1234. width: 24rpx;
  1235. height: 24rpx;
  1236. background-color: #ef4800;
  1237. border-radius: 50%;
  1238. }
  1239. </style>
  1240. v