benefitSingleItem.vue 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  1. <template>
  2. <view class="page">
  3. <!-- 头部切换 -->
  4. <u-sticky zIndex="999" customNavHeight="0" style="position: relative;">
  5. <uni-NavBar headerTitle="权益单品" background="#fff" :isSlot="false" :rightSlot="true"
  6. borderBottom="1rpx solid #eee">
  7. </uni-NavBar>
  8. <uni-dropdown :close-on-click-mask="mask" ref="uDropdown" :activeColor="activeColor" border-radius="10"
  9. menuIcon="arrow-down-fill" :borderBottom="borderBottom" @menuClick="menuClick">
  10. <uni-dropdown-item :title="location.cityName || '地区'"></uni-dropdown-item>
  11. <uni-dropdown-item title="价格区间">
  12. <view class="slotArea">
  13. <view class="p-3">
  14. <!-- 双边滑动选择器 -->
  15. <view class="slider-header dis a-c j-s ">
  16. <text>价值</text>
  17. <text>{{ queryInfo.minPrice }}-{{ queryInfo.maxPrice }}元</text>
  18. </view>
  19. <view style="padding: 0 40rpx;">
  20. <uni-tianzai-slider-range :step="50" :min="0" :max="1000"
  21. :value="[queryInfo.minPrice, queryInfo.maxPrice]" @change="onChange" @end="onEnd">
  22. </uni-tianzai-slider-range>
  23. </view>
  24. <view class="options dis a-c f-wrap mt-3">
  25. <view class="options-card dis a-c j-c"
  26. :class="item.label == priceRangeName ? 'active' : ''"
  27. v-for="(item, index) in priceRangeOptions" :key="index"
  28. @click="filterCriteriaClick(item)">
  29. {{ item.label }}
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 按钮 -->
  34. <view class="slider-btn dis a-c j-s">
  35. <view class="btn dis a-c j-c mr-3" @click="clearForm">
  36. 清空
  37. </view>
  38. <view class="btn btns dis a-c j-c" @click="querySearch">
  39. 确定
  40. </view>
  41. </view>
  42. </view>
  43. </uni-dropdown-item>
  44. <uni-dropdown-item title="默认排序">
  45. <view class="slotArea">
  46. <view class="sort">
  47. <view class="item dis a-c " @click="sortItem(item.value)"
  48. v-for="(item, index) in sortOrderOptions" :key="index">
  49. <text class="text" :class="{ 'sort-active': item.value === queryInfo.sortType }">{{
  50. item.label }}</text>
  51. <view class="slice dis a-c j-c " v-if="item.value === queryInfo.sortType">
  52. <u-icon name="checkmark" color="#333" size="11" :bold="true"></u-icon>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </uni-dropdown-item>
  58. </uni-dropdown>
  59. <view class="tabView">
  60. <u-tabs :list="tabsList" @click="tabClick" :current="statusCurrent" :scrollable="true" lineWidth="32"
  61. :activeStyle="{ color: '#333', fontWeight: 'bold', fontSize: '30rpx' }"
  62. :inactiveStyle="{ color: '#999', fontSize: '30rpx' }" :itemStyle="{ height: '48rpx' }">
  63. <view slot="right" class="moreFilters dis a-c j-c" @tap="toggleFilterPanel">
  64. <text>更多</text>
  65. <u-icon name="list" size="21" color="#999"></u-icon>
  66. </view>
  67. </u-tabs>
  68. </view>
  69. <!-- 下拉筛选内容 -->
  70. <view class="dropdown-content" :class="{ 'show': showFilterPanel }">
  71. <view class="p-3" style="position: relative;">
  72. <!-- 筛选条件 -->
  73. <view class="overflow-content">
  74. <view class="filterCriteria-item mb-3" v-for="(item, index) in tabsList" :key="index">
  75. <view class="header dis a-c ">
  76. <image src="/static/icon/equity/Tabler.png" mode=""></image>
  77. <text class="title">{{ item.name }}</text>
  78. </view>
  79. <view class="content">
  80. <view class="options dis a-c f-wrap mt-3" :class="{ 'collapsed': !item.isExpanded }">
  81. <view class="options-card dis a-c j-c" :class="childrenitem.active ? 'active' : ''"
  82. v-for="(childrenitem, childrenindex) in item.children" :key="childrenindex"
  83. @click="filterOptionClick(childrenitem)">
  84. {{ childrenitem.name }}
  85. </view>
  86. </view>
  87. <view class="Collapse dis a-c j-c" @click="toggleExpand(item)">
  88. <image src="/static/icon/equity/Vector.png" mode=""
  89. :style="{ transform: `rotate(${item.isExpanded ? 180 : 0}deg)` }"></image>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="backgroundBlur"></view>
  95. </view>
  96. <view class="dropdown-footer">
  97. <view class="btn btns dis a-c j-c" @click="confirmFilter">
  98. 确认
  99. </view>
  100. </view>
  101. </view>
  102. <!-- 下拉遮罩 -->
  103. <view class="overlay-mask" :class="{ 'show': showFilterPanel }" @click="closeFilterPanel"></view>
  104. </u-sticky>
  105. <!-- 内容 -->
  106. <view class="content-body">
  107. <!-- 权益列表 -->
  108. <view class="view-card dis f-c " v-for="(item, index) in privilegeItem" :key="index"
  109. v-if="privilegeItem.length">
  110. <!-- 权益信息 -->
  111. <view class="dis view-header" @click="rightsDetails(item)">
  112. <!-- 图片 -->
  113. <image class="image" :src="item.rightsPicture" mode=""></image>
  114. <view class="content dis f-c j-s">
  115. <u--text :lines="1" :text="item.rightsName" color="#333" size="16" :bold="true"
  116. style="line-height: 1;flex:0 auto;"></u--text>
  117. <view class="sum dis a-c ">
  118. <!-- 市场价/ 券数量 -->
  119. <text class="marketPrice">市场价 {{ item.marketPrice }}</text>
  120. <u-number-box v-model="item.rightsCount" :min="0" style="margin-left: auto;"
  121. @change="val => onRightsCountChange(val, index, 'privilegeItem', 'contractRate')"
  122. :asyncChange="true">
  123. <view slot="minus" class="numberBoxMinus dis a-c j-c ">
  124. <u-icon name="minus" size="12" color="#333" bold></u-icon>
  125. </view>
  126. <text slot="input" class="numberBoxInput">
  127. {{ item.rightsCount }}
  128. </text>
  129. <view slot="plus" class="numberBoxPlus dis a-c j-c ">
  130. <u-icon name="plus" color="#333" size="12" bold></u-icon>
  131. </view>
  132. </u-number-box>
  133. </view>
  134. <view class=" dis a-c j-s ">
  135. <text class="plice">¥{{ item.contractRate }}</text>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. <u-empty v-if="privilegeItem.length == 0" mode="car" icon="/static/image/Empty1.png" text="没有可用的权益券,换个地区试试~"
  142. width="120" height="120">
  143. </u-empty>
  144. <!-- 底部样式 -->
  145. <view class="footer dis a-c">
  146. <!-- 图标 -->
  147. <view class="icon-view dis f-c a-c ">
  148. <view class="">
  149. <image src="/static/icon/balance/balance.png" mode=""></image>
  150. <u-badge numberType="overflow" :max="99" :value="selectedCount" :absolute="true" color="#fff"
  151. bgColor="#FF4545" :offset="[-5, -5]" style="font-size: 18rpx;"></u-badge>
  152. </view>
  153. <text>已选</text>
  154. </view>
  155. <!-- 价格 -->
  156. <view class="dis f-c a-start">
  157. <view class="price">
  158. <text>¥</text>
  159. <text>{{ totalPriceCount }}</text>
  160. </view>
  161. <text class="marketPrice">市场价:{{ totalMarketPriceCount }}</text>
  162. </view>
  163. <view class="footer-btn" @click="userRightsSubmit">
  164. 立即发放
  165. </view>
  166. </view>
  167. <!-- 省市区组件 -->
  168. <uni-areaCascadePicker :show="addressPickershow" @confirm="addressConfirm" @close="areaCascadeClose"
  169. @cancel="addressPickershow = false"></uni-areaCascadePicker>
  170. <!-- 自定义加载动画 -->
  171. <u-overlay :show="loadingShow" style="background-color: rgba(255, 255, 255, 0.6);">
  172. <view class="dis f-c a-c j-c " style="height: 100%;">
  173. <u-loading-icon></u-loading-icon>
  174. <text style="color: #909399;" class="mt-1">{{ loadingText }}</text>
  175. </view>
  176. </u-overlay>
  177. </view>
  178. </template>
  179. <script>
  180. import LocationService from '@/utils/location';
  181. import Decimal from 'decimal.js';
  182. export default {
  183. data() {
  184. return {
  185. availableAmount: 0, //可用金额
  186. loadingShow: true, //加载
  187. loadingText: '加载中', //加载提示文字
  188. vehicleTaxIsExpanded: false, //明细 展开收起
  189. // 位置信息
  190. location: {
  191. cityName: "",
  192. },
  193. privilegeItem: [], //权益单品列表
  194. // 页面初始化查询信息
  195. queryInfo: {
  196. countryAll: "", //省市区
  197. minPrice: 0,
  198. maxPrice: 1000,
  199. sortType: 0, //排序 0 默认 1低价 2高价
  200. classifyList: [],
  201. pageNo: 1,
  202. pageSize: 20,
  203. },
  204. addressPickershow: false, //省市区组件
  205. mask: true, //点遮罩关闭
  206. borderBottom: true,
  207. activeColor: '#333', //下拉菜单选中激活项
  208. doubleResult: null,
  209. singleResult: null,
  210. statusCurrent: 0, //状态tabs切换
  211. showFilterPanel: false, //更多筛选面板显示控制
  212. // 筛选选项
  213. filterOptions: [{
  214. label: '选项1',
  215. value: 1,
  216. active: false
  217. },
  218. {
  219. label: '选项2',
  220. value: 2,
  221. active: false
  222. },
  223. {
  224. label: '选项3',
  225. value: 3,
  226. active: false
  227. },
  228. {
  229. label: '选项4',
  230. value: 4,
  231. active: false
  232. },
  233. ],
  234. // 分类tab列表
  235. tabsList: [],
  236. // 排序
  237. sortOrderOptions: [{
  238. label: '默认排序',
  239. value: 0,
  240. },
  241. {
  242. label: '低价优先',
  243. value: 1,
  244. },
  245. {
  246. label: '高价优先',
  247. value: 2,
  248. }
  249. ],
  250. priceRangeName: "", //区间选中
  251. // 价格区间列表
  252. priceRangeOptions: [{
  253. label: "100元以下",
  254. value: [0, 100]
  255. },
  256. {
  257. label: "100-200元",
  258. value: [100, 200]
  259. },
  260. {
  261. label: "200-300元",
  262. value: [200, 300]
  263. },
  264. {
  265. label: "300-400元",
  266. value: [300, 400]
  267. },
  268. {
  269. label: "400-500元",
  270. value: [400, 500]
  271. },
  272. {
  273. label: "500-1000元",
  274. value: [500, 1000]
  275. },
  276. ],
  277. }
  278. },
  279. onShow() {
  280. },
  281. async onLoad(options) {
  282. this.loadingShow = true;
  283. try {
  284. if (options) {
  285. this.availableAmount = options.availableAmount;
  286. }
  287. // 获取定位城市信息
  288. const locationData = await LocationService.initLocation();
  289. console.log(locationData);
  290. if (locationData.provinceCode) {
  291. this.queryInfo.countryAll =
  292. `${locationData.provinceCode},${locationData.cityCode},${locationData.districtCode}`; //
  293. this.location.cityName =
  294. `${locationData.provinceName}-${locationData.cityName}-${locationData.districtName}`;
  295. }
  296. await this.getequityClassification(); //权益分类
  297. await this.getprivilegeItem(); //权益单品列表
  298. console.log();
  299. this.loadingShow = false;
  300. } catch (error) {
  301. this.loadingShow = false;
  302. }
  303. },
  304. computed: {
  305. selectedCount() {
  306. const total = this.privilegeItem.reduce(
  307. (sum, item) => sum.plus(new Decimal(item.rightsCount)),
  308. new Decimal(0)
  309. );
  310. const sum = new Decimal(total);
  311. return sum.toString();
  312. },
  313. //选中售价总和
  314. totalPriceCount() {
  315. const total = this.privilegeItem.reduce(
  316. (sum, item) => {
  317. // 计算当前项的 packagePrice * quantity(高精度乘法)
  318. const itemTotal = new Decimal(item.contractRate).times(new Decimal(item.rightsCount));
  319. // 累加到总和
  320. return sum.plus(itemTotal);
  321. },
  322. new Decimal(0) // 初始值
  323. );
  324. const sum = new Decimal(total);
  325. return sum.toString(); // 返回字符串
  326. },
  327. //选中市场价总和
  328. totalMarketPriceCount() {
  329. const total = this.privilegeItem.reduce(
  330. (sum, item) => {
  331. // 计算当前项的 packagePrice * quantity(高精度乘法)
  332. const itemTotal = new Decimal(item.marketPrice).times(new Decimal(item.rightsCount));
  333. // 累加到总和
  334. return sum.plus(itemTotal);
  335. },
  336. new Decimal(0) // 初始值
  337. );
  338. const sum = new Decimal(total);
  339. return sum.toString(); // 返回字符串
  340. }
  341. },
  342. methods: {
  343. //权益商品详情
  344. async rightsDetails(item) {
  345. await this.$http.post('/rightsGrant/get/product', {
  346. rightsId: item.id
  347. }).then(res => {
  348. if (res.code == 200) {}
  349. });
  350. },
  351. // 获取权益分类
  352. async getequityClassification() {
  353. // 递归添加 active 字段
  354. const addActiveField = (data) => {
  355. if (!data || !Array.isArray(data)) return;
  356. data.forEach(item => {
  357. item.active = false;
  358. item.isExpanded = false;
  359. if (item.children && Array.isArray(item.children)) {
  360. addActiveField(item.children);
  361. }
  362. });
  363. };
  364. await this.$http.post('/rightsGrant/get/category').then(res => {
  365. if (res.code == 200) {
  366. addActiveField(res.data);
  367. this.tabsList = res.data;
  368. this.queryInfo.classifyList = [this.tabsList[0].id];
  369. }
  370. });
  371. },
  372. // 权益数量变化监听
  373. onRightsCountChange(e, index, name, field) {
  374. // 获取当前项
  375. const item = this[name][index];
  376. // 获取当前数量和新数量
  377. const currentCount = item.rightsCount;
  378. const newCount = e.value;
  379. // 计算价格
  380. const price = parseFloat(item[field]);
  381. // 计算当前总价
  382. const currentTotalPrice = parseFloat(this.totalPriceCount);
  383. // 计算数量变化和价格变化
  384. const countChange = newCount - currentCount;
  385. const priceChange = countChange * price;
  386. // 计算新总价
  387. const newTotalPrice = currentTotalPrice + priceChange;
  388. // 如果是增加数量,检查是否超过可用金额
  389. if (countChange > 0 && newTotalPrice > this.availableAmount) {
  390. uni.showToast({
  391. title: `权益总价不能超过可用金额${this.availableAmount}元`,
  392. icon: 'none'
  393. });
  394. } else {
  395. // 无论是减少数量还是增加数量且未超过限制,都允许更新
  396. item.rightsCount = newCount;
  397. }
  398. },
  399. // 确认选择
  400. async userRightsSubmit() {
  401. // 验证是否有选择权益
  402. if (parseInt(this.selectedCount) === 0) {
  403. uni.showToast({
  404. title: '请至少选择一项权益',
  405. icon: 'none'
  406. });
  407. return;
  408. }
  409. // 收集选择的权益单品
  410. const selectedItems = this.privilegeItem
  411. .filter(item => item.rightsCount > 0)
  412. let pages = getCurrentPages(); //获取所有页面栈实例列表
  413. let prevPage = pages[pages.length - 2]; //上一页页面实例
  414. console.log(selectedItems);
  415. prevPage.$vm.insOrderRightsList = selectedItems; //选中权益列表
  416. uni.navigateBack({ //uni.navigateTo跳转的返回,默认1为返回上一级
  417. delta: 1
  418. });
  419. },
  420. //获取权益单品列表
  421. async getprivilegeItem() {
  422. let res = await this.$http.post('/rightsGrant/rights/list', this.queryInfo);
  423. if (res.code == 200) {
  424. this.privilegeItem = res.data.records;
  425. }
  426. },
  427. // 省市区选择回调
  428. async addressConfirm(e) {
  429. console.log(e);
  430. this.queryInfo.countryAll = e.codes.join(',') || "";
  431. this.location.cityName = e.fullAddress;
  432. this.addressPickershow = false;
  433. this.$refs.uDropdown.close();
  434. await this.getprivilegeItem();
  435. },
  436. // 查看明细
  437. detailClick() {
  438. },
  439. async querySearch() {
  440. this.$refs.uDropdown.close();
  441. await this.getprivilegeItem();
  442. },
  443. //清空价格区间
  444. async clearForm() {
  445. this.queryInfo.minPrice = 0;
  446. this.queryInfo.maxPrice = 1000;
  447. this.priceRangeName = "";
  448. this.$refs.uDropdown.close();
  449. await this.getprivilegeItem();
  450. },
  451. filterCriteriaClick(item) {
  452. this.priceRangeName = item.label;
  453. this.queryInfo.minPrice = item.value[0];
  454. this.queryInfo.maxPrice = item.value[1];
  455. },
  456. //排序选择
  457. async sortItem(value) {
  458. this.queryInfo.sortType = value;
  459. this.$refs.uDropdown.close();
  460. await this.getprivilegeItem();
  461. },
  462. // 价格区间选择
  463. onChange(values) {
  464. this.queryInfo.minPrice = values[0];
  465. this.queryInfo.maxPrice = values[1];
  466. },
  467. // 下拉菜单选项事件
  468. menuClick(value) {
  469. if (value == 0) {
  470. this.addressPickershow = true;
  471. }
  472. },
  473. onEnd(event) {
  474. console.log('最终选择:', event.values);
  475. },
  476. areaCascadeClose() {
  477. this.addressPickershow = false;
  478. this.$refs.uDropdown.close();
  479. },
  480. // tabs状态切换
  481. async tabClick(e) {
  482. console.log(e);
  483. this.statusCurrent = e.index;
  484. this.queryInfo.classifyList = [e.id];
  485. await this.getprivilegeItem();
  486. if (this.scrollTop > 0) {
  487. uni.pageScrollTo({
  488. selector: 'content-body', // 滚动到顶部
  489. duration: 100, // 动画时长(ms)
  490. });
  491. }
  492. },
  493. // 切换筛选面板
  494. toggleFilterPanel() {
  495. this.showFilterPanel = !this.showFilterPanel;
  496. },
  497. // 关闭筛选面板
  498. closeFilterPanel() {
  499. this.showFilterPanel = false;
  500. },
  501. // 筛选选项点击
  502. filterOptionClick(item) {
  503. item.active = !item.active;
  504. if (item.active) {
  505. // 选中:添加到 classifyList
  506. if (!this.queryInfo.classifyList.includes(item.id)) {
  507. this.queryInfo.classifyList.push(item.id);
  508. }
  509. } else {
  510. // 取消选中:从 classifyList 中删除
  511. const index = this.queryInfo.classifyList.indexOf(item.id);
  512. if (index > -1) {
  513. this.queryInfo.classifyList.splice(index, 1);
  514. }
  515. }
  516. },
  517. // 展开收起
  518. toggleExpand(item) {
  519. console.log(item);
  520. item.isExpanded = !item.isExpanded;
  521. },
  522. // 重置筛选
  523. resetFilter() {
  524. this.filterOptions.forEach(item => {
  525. item.active = false;
  526. });
  527. this.$u.toast('已重置筛选条件');
  528. },
  529. // 确认筛选
  530. async confirmFilter() {
  531. // 获取选中的筛选项
  532. const selectedFilters = this.filterOptions.filter(item => item.active);
  533. console.log('选中的筛选条件:', selectedFilters);
  534. this.closeFilterPanel();
  535. await this.getprivilegeItem();
  536. this.$u.toast('筛选成功');
  537. },
  538. }
  539. }
  540. </script>
  541. <style lang="scss" scoped>
  542. page {
  543. background-color: #F8F8F8;
  544. height: 100vh;
  545. }
  546. .container {
  547. padding: 20rpx;
  548. }
  549. .dropdown-title {
  550. font-size: 32rpx;
  551. color: #333;
  552. }
  553. .reward-tabs {
  554. margin-right: 48rpx;
  555. flex: 1;
  556. }
  557. /* 自定义tab滑块样式 */
  558. ::v-deep .u-tabs__wrapper__nav__line {
  559. background-color: transparent !important;
  560. font-size: 30px;
  561. }
  562. ::v-deep .u-tabs__wrapper__nav__item__text {
  563. font-size: 32rpx;
  564. }
  565. /* 自定义tab滑块样式 */
  566. ::v-deep .u-tabs__wrapper__nav__line {
  567. background: linear-gradient(90deg, #FDE935 10%, rgba(253, 233, 53, 0.1) 100%) !important;
  568. border-radius: 6rpx;
  569. }
  570. .slotArea {
  571. background-color: #FFFFFF;
  572. border-top: 1rpx solid #eee;
  573. .slider-header {
  574. text:first-child {
  575. font-size: 30rpx;
  576. color: #333;
  577. font-weight: bold;
  578. }
  579. text:last-child {
  580. font-size: 28rpx;
  581. color: #333;
  582. }
  583. }
  584. .slider-btn {
  585. background: #FFFFFF;
  586. border-radius: 0rpx 0rpx 20rpx 20rpx;
  587. border-top: 1rpx solid #EEEEEE;
  588. padding: 30rpx 44rpx;
  589. box-sizing: border-box;
  590. .btn {
  591. padding: 18rpx 30rpx;
  592. box-sizing: border-box;
  593. width: 50%;
  594. border-radius: 50rpx 50rpx 50rpx 50rpx;
  595. border: 1rpx solid #FDE935;
  596. font-size: 30rpx;
  597. color: #333;
  598. }
  599. .btns {
  600. width: 50%;
  601. background: #FDE935;
  602. border-radius: 50rpx 50rpx 50rpx 50rpx;
  603. }
  604. }
  605. .sort {
  606. padding: 30rpx;
  607. box-sizing: border-box;
  608. display: grid;
  609. grid-template-columns: repeat(1, 1fr);
  610. grid-template-rows: auto;
  611. row-gap: 30rpx;
  612. .item {
  613. text {
  614. font-size: 30rpx;
  615. color: #333;
  616. }
  617. .slice {
  618. margin-left: auto;
  619. width: 32rpx;
  620. height: 32rpx;
  621. background: #FDE935;
  622. border-radius: 20rpx 20rpx 20rpx 20rpx;
  623. }
  624. }
  625. .sort-active {
  626. font-weight: bold;
  627. }
  628. }
  629. .item-box {
  630. margin-bottom: 50rpx;
  631. display: flex;
  632. flex-wrap: wrap;
  633. justify-content: space-between;
  634. .item {
  635. border: 1px solid #f2f2f2;
  636. color: #333;
  637. padding: 8rpx 40rpx;
  638. border-radius: 100rpx;
  639. margin-top: 30rpx;
  640. }
  641. .active {
  642. color: #FFFFFF;
  643. background-color: #000;
  644. }
  645. }
  646. .options {
  647. display: grid;
  648. /* 启用网格布局 */
  649. grid-template-columns: repeat(3, 1fr);
  650. /* 3 列,每列等宽 */
  651. grid-template-rows: auto;
  652. /* 行高自适应 */
  653. row-gap: 30rpx;
  654. /* 只设置行间距(上下) */
  655. column-gap: 20rpx;
  656. /* 列间距设为 0(可选) */
  657. }
  658. .options-card {
  659. padding: 11rpx 24rpx;
  660. box-sizing: border-box;
  661. border-radius: 4rpx 4rpx 4rpx 4rpx;
  662. border: 1rpx solid #EEEEEE;
  663. font-size: 28rpx;
  664. color: #666;
  665. }
  666. .active {
  667. background-color: rgba(253, 233, 53, 0.2);
  668. border: 1rpx solid #FDE935;
  669. color: #333;
  670. }
  671. }
  672. .content-body {
  673. padding: 20rpx 30rpx 166rpx;
  674. box-sizing: border-box;
  675. position: relative;
  676. .view-card {
  677. background-color: #fff;
  678. border-radius: 10rpx;
  679. margin-bottom: 20rpx;
  680. .view-header {
  681. padding: 25rpx 30rpx;
  682. box-sizing: border-box;
  683. .image {
  684. width: 136rpx;
  685. height: 136rpx;
  686. border-radius: 10rpx;
  687. flex-shrink: 0;
  688. margin-right: 20rpx;
  689. }
  690. .content {
  691. flex: 1;
  692. min-width: 0;
  693. line-height: 1;
  694. .sum {
  695. text {
  696. font-size: 24rpx;
  697. color: #666;
  698. }
  699. }
  700. .plice {
  701. font-size: 30rpx;
  702. color: #FF540A;
  703. font-weight: bold;
  704. line-height: 1;
  705. }
  706. .Detail {
  707. font-size: 26rpx;
  708. color: #FFAC1D;
  709. line-height: 1.4;
  710. text {
  711. margin-right: 5rpx;
  712. }
  713. }
  714. }
  715. }
  716. .Detail-list {
  717. padding: 0 30rpx 25rpx;
  718. box-sizing: border-box;
  719. .Detail-header {
  720. width: 100%;
  721. height: 30rpx;
  722. background: linear-gradient(0deg, #FFFCEA 0%, #FFFFFF 100%);
  723. border-radius: 6rpx 6rpx 0rpx 0rpx;
  724. border-top: 1rpx solid #FFE1A4;
  725. }
  726. .Detail-footer {
  727. width: 100%;
  728. height: 30rpx;
  729. background: linear-gradient(0deg, #FFFCEA 0%, #FFFFFF 100%);
  730. border-radius: 6rpx 6rpx 0rpx 0rpx;
  731. border-bottom: 1rpx solid #FFE1A4;
  732. }
  733. .view {
  734. .view-header {
  735. padding: 0 20rpx 20rpx;
  736. box-sizing: border-box;
  737. border-bottom: 1rpx solid #eee;
  738. margin: 20rpx 0;
  739. }
  740. .view-header:last-child {
  741. border-bottom: none;
  742. }
  743. }
  744. }
  745. }
  746. }
  747. // 步进器自定义样式
  748. .numberBoxMinus {
  749. width: 32rpx;
  750. height: 32rpx;
  751. border-radius: 20rpx 20rpx 20rpx 20rpx;
  752. border: 1rpx solid #FDE935;
  753. }
  754. .numberBoxInput {
  755. font-size: 30rpx;
  756. color: #333;
  757. padding: 0 20rpx;
  758. box-sizing: border-box;
  759. text-align: center;
  760. }
  761. .numberBoxPlus {
  762. width: 32rpx;
  763. height: 32rpx;
  764. border-radius: 20rpx 20rpx 20rpx 20rpx;
  765. background-color: #FDE935;
  766. border: 1rpx solid #FDE935;
  767. }
  768. .footer {
  769. position: fixed;
  770. bottom: 0;
  771. left: 0;
  772. right: 0;
  773. padding: 25rpx 30rpx 55rpx;
  774. box-sizing: border-box;
  775. background: linear-gradient(0deg, #FFFFFF 0%, rgba(255, 254, 245, 0.7) 100%);
  776. border-radius: 0rpx 0rpx 0rpx 0rpx;
  777. backdrop-filter: blur(12rpx);
  778. .icon-view {
  779. margin-right: 30rpx;
  780. >view {
  781. position: relative;
  782. image {
  783. width: 48rpx;
  784. height: 48rpx;
  785. }
  786. }
  787. text {
  788. font-size: 20rpx;
  789. color: #333;
  790. }
  791. }
  792. .price {
  793. text:nth-child(1) {
  794. font-size: 28rpx;
  795. color: #FF540A;
  796. }
  797. text:nth-child(2) {
  798. font-size: 42rpx;
  799. color: #FF540A;
  800. }
  801. }
  802. .marketPrice {
  803. font-size: 20rpx;
  804. color: #999;
  805. letter-spacing: 1rpx;
  806. margin-left: 4rpx;
  807. }
  808. .footer-btn {
  809. padding: 20rpx 68rpx;
  810. box-sizing: border-box;
  811. background: #FDE935;
  812. border-radius: 58rpx 58rpx 58rpx 58rpx;
  813. font-size: 36rpx;
  814. color: #1F1F1F;
  815. font-weight: bold;
  816. margin-left: auto;
  817. }
  818. }
  819. .tabView {
  820. padding: 13rpx 30rpx;
  821. box-sizing: border-box;
  822. background-color: #fff;
  823. }
  824. .u-empty {
  825. position: absolute;
  826. top: 50%;
  827. left: 50%;
  828. transform: translate(-50%, -50%);
  829. /* 反向偏移自身宽高的50% */
  830. }
  831. .moreFilters {
  832. font-size: 30rpx;
  833. color: #999;
  834. }
  835. /* 下拉筛选内容 */
  836. .dropdown-content {
  837. position: fixed;
  838. top: 182rpx;
  839. left: 0;
  840. right: 0;
  841. height: 0px;
  842. background: white;
  843. overflow: hidden;
  844. z-index: 100;
  845. transition: height 0.4s ease;
  846. border-radius: 0 0 20rpx 20rpx;
  847. .overflow-content {
  848. overflow-y: auto;
  849. height: 926rpx;
  850. padding-bottom: 45rpx;
  851. box-sizing: border-box;
  852. }
  853. .backgroundBlur {
  854. position: absolute;
  855. bottom: 0;
  856. left: 0;
  857. right: 0;
  858. width: 100%;
  859. height: 115rpx;
  860. background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 40%, #FFFFFF 100%);
  861. backdrop-filter: blur(12rpx);
  862. -webkit-backdrop-filter: blur(12rpx);
  863. mask-image: linear-gradient(to top,
  864. rgba(0, 0, 0, 1) 0%,
  865. rgba(0, 0, 0, 0.6) 60%,
  866. rgba(0, 0, 0, 0) 100%);
  867. -webkit-mask-image: linear-gradient(to top,
  868. rgba(0, 0, 0, 1) 0%,
  869. rgba(0, 0, 0, 0.6) 60%,
  870. rgba(0, 0, 0, 0) 100%);
  871. }
  872. // 筛选条件
  873. .filterCriteria-item {
  874. >.header {
  875. image {
  876. width: 32rpx;
  877. height: 32rpx;
  878. margin-right: 6rpx;
  879. }
  880. .title {
  881. flex: 1;
  882. font-size: 30rpx;
  883. color: #333;
  884. font-weight: bold;
  885. }
  886. }
  887. .content {
  888. display: flex;
  889. align-items: start;
  890. justify-content: space-between;
  891. .options {
  892. display: grid;
  893. grid-template-columns: repeat(3, 1fr);
  894. grid-template-rows: auto;
  895. row-gap: 30rpx;
  896. column-gap: 20rpx;
  897. transition: all 0.3s ease; // 添加这行
  898. &.collapsed {
  899. // 添加这个嵌套样式
  900. overflow: hidden;
  901. max-height: 160rpx; // 两行的高度,可以根据实际效果调整
  902. }
  903. >.options-card {
  904. padding: 11rpx 40rpx;
  905. box-sizing: border-box;
  906. background: #F5F5F5;
  907. border-radius: 4rpx;
  908. font-size: 28rpx;
  909. color: #333;
  910. }
  911. .active {
  912. background: #FDE935;
  913. }
  914. }
  915. .Collapse {
  916. margin-top: 30rpx;
  917. width: 50rpx;
  918. height: 50rpx;
  919. background: #F5F5F5;
  920. border-radius: 50%;
  921. image {
  922. width: 20rpx;
  923. height: 12rpx;
  924. }
  925. }
  926. }
  927. }
  928. // 底部按钮
  929. .footer {
  930. padding: 30rpx 0;
  931. border-top: 1rpx solid #eee;
  932. .btn {
  933. padding: 18rpx 30rpx;
  934. box-sizing: border-box;
  935. width: 50%;
  936. border-radius: 50rpx;
  937. border: 1rpx solid #FDE935;
  938. font-size: 30rpx;
  939. color: #333;
  940. }
  941. .btns {
  942. width: 50%;
  943. background: #FDE935;
  944. border-radius: 50rpx;
  945. }
  946. }
  947. }
  948. .dropdown-content.show {
  949. opacity: 1;
  950. height: 1126rpx;
  951. overflow: auto;
  952. }
  953. /* 下拉区域底部按钮 */
  954. .dropdown-footer {
  955. position: absolute;
  956. bottom: 0;
  957. left: 0;
  958. right: 0;
  959. padding: 30rpx 44rpx;
  960. box-sizing: border-box;
  961. border-top: 1rpx solid #eee;
  962. background-color: #fff;
  963. display: flex;
  964. align-items: center;
  965. justify-content: space-between;
  966. .btn {
  967. padding: 18rpx 30rpx;
  968. box-sizing: border-box;
  969. width: 100%;
  970. border-radius: 50rpx;
  971. border: 1rpx solid #FDE935;
  972. font-size: 30rpx;
  973. color: #1f1f1f;
  974. background: #FDE935;
  975. }
  976. }
  977. /* 遮罩层 */
  978. .overlay-mask {
  979. position: fixed;
  980. top: 0;
  981. left: 0;
  982. right: 0;
  983. bottom: 0;
  984. background: rgba(0, 0, 0, 0.6);
  985. display: none;
  986. z-index: 99;
  987. }
  988. .overlay-mask.show {
  989. display: block;
  990. }
  991. </style>