benefitSingleItem.vue 26 KB

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