benefitSingleItem.vue 26 KB

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