index.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  1. <template>
  2. <view class="container" :style="{ height: winHeight+ 'px' }">
  3. <!-- 状态栏高度 -->
  4. <view :style="{ height: `${statusBarHeight}px` }"></view>
  5. <!-- 导航栏 -->
  6. <view :style="{ height: `${navigationBarHeight}rpx`,lineHeight: `${navigationBarHeight}rpx`}" class="order-nav">
  7. <view class="back-button" @tap="handBack()"></view>
  8. <text>{{merchanInfo.name}}</text>
  9. </view>
  10. <view class="main">
  11. <view class="nav">
  12. <view class="header">
  13. <view class="left">
  14. <view class="store-name">
  15. <text style="font-weight: 600;font-size: 35rpx;color: #141414;">{{ merchanInfo.name }}</text>
  16. <view class="iconfont iconarrow-right"></view>
  17. </view>
  18. <view class="store-score" style="margin: 7rpx 0;">
  19. <text style="font-weight: 600;font-size: 27rpx;color: #FD6716;">{{ merchanInfo.starLevel }}分</text>
  20. <text style="font-size: 21rpx;color: #999999;margin-left: 6rpx;">月销 {{ merchanInfo.sales || 0 }}</text>
  21. </view>
  22. <view class="store-addr">
  23. <text style="font-size: 23rpx;color: #141414;">商家地址:{{ merchanInfo.addressDetail }}</text>
  24. </view>
  25. <view class="store-tip" style="padding: 10rpx 30rpx 10rpx 15px ;height: 48rpx;">
  26. <swiper :indicator-dots="false" :autoplay="true" interval="2500" :duration="500" vertical="true" circular="true">
  27. <block v-for="(item,index) in merchanInfo.headline" :key='index'>
  28. <swiper-item catchtouchmove='catchTouchMove'>
  29. <view class='text acea-row row-between-wrapper'>
  30. <view class='newsTitle'>
  31. <text class='iconfont icon-laba ' style="font-size: 24rpx;margin-right: 10rpx;"></text>
  32. <text>{{item.title}}</text>
  33. </view>
  34. </view>
  35. </swiper-item>
  36. </block>
  37. </swiper>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view style="width: 100%;height: 10rpx; background-color: #F8F9FD;"></view>
  43. </view>
  44. <view class="content">
  45. <scroll-view style="height: 950rpx" class="menus" scroll-with-animation scroll-y>
  46. <view class="wrapper">
  47. <view class="menu" :id="`menu-${item.id}`" :class="{'current': item.id === currentCateId}" v-for="(item, index) in goods"
  48. :key="index" @tap="handleMenuTap(item.id)">
  49. <text>{{ item.name }}</text>
  50. <view class="dot" v-show="menuCartNum(item.id)">{{ menuCartNum(item.id) }}</view>
  51. </view>
  52. </view>
  53. </scroll-view>
  54. <!-- goods list begin -->
  55. <scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="cateScrollTop" @scroll="handleGoodsScroll"
  56. :scroll-into-view="menuScrollIntoView">
  57. <view class="wrapper">
  58. <view class="list">
  59. <!-- category begin -->
  60. <view style="font-weight: 400;font-size: 21rpx;color: #999999;text-align: center;margin-bottom: 19rpx;">————温馨提示:湿度选择,避免浪费
  61. ————</view>
  62. <view class="category" v-for="(item, index) in goods" :key="index" :id="`cate-${item.id}`">
  63. <view class="items">
  64. <!-- 商品 begin -->
  65. <!-- <view v-if="!item.goodsList">无商品</view> -->
  66. <view class="good" v-for="(good, key) in item.childList" :key="key">
  67. <image :src="good.image" class="image" @tap="console.log('点击图片')"></image>
  68. <view class="right">
  69. <text class="name">{{ good.name }}</text>
  70. <text class="tips">{{ good.content }}</text>
  71. <view class="price_and_action">
  72. <text class="price">¥{{ good.otPrice }}</text>
  73. <view class="btn-group" v-if="good.use_property">
  74. <button type="primary" class="btn property_btn bg-color" hover-class="none" size="mini" @tap="console.log('选规格')">
  75. 选规格
  76. </button>
  77. <view class="dot" v-show="goodCartNum(good.id)">{{ goodCartNum(good.id) }}</view>
  78. </view>
  79. <view class="btn-group" v-else>
  80. <button type="default" v-show="goodCartNum(good.id)" plain class="btn reduce_btn" size="mini" hover-class="none"
  81. @tap="handleReduceFromCart(item, good)">
  82. <view class="iconfont iconsami-select">-</view>
  83. </button>
  84. <view class="number" v-show="goodCartNum(good.id)">{{ goodCartNum(good.id) }}</view>
  85. <button type="primary" class="btn add_btn bg-color" size="min" hover-class="none" @tap="handleAddToCart(item, good, 1)">
  86. <view class="iconfont iconadd-select">+</view>
  87. </button>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <!-- 商品 end -->
  93. </view>
  94. </view>
  95. <!-- category end -->
  96. </view>
  97. </view>
  98. </scroll-view>
  99. <!-- goods list end -->
  100. </view>
  101. <!-- content end -->
  102. <!-- 购物车栏 begin -->
  103. <view class="cart-box" style="bottom: 77rpx">
  104. <view class="mark">
  105. <image src="/static/img/ic-security-settings.png" class="cart-img" @tap=""></image>
  106. <view class="tag" v-if="cart.length > 0">{{ getCartGoodsNumber }}</view>
  107. </view>
  108. <view style="font-weight: 500;font-size: 27rpx;color: #999999;" class="price" v-if="cart.length === 0">配送费2元</view>
  109. <view style="font-weight: 600;font-size: 27rpx;color: #FFFFFF;" class="price" v-else>¥{{ getCartGoodsPrice || 0 }}</view>
  110. <button :style="{backgroundColor: disabledPay ? '#000' : ''}" type="primary" class="pay-btn bg-color" @tap="toPay"
  111. :disabled="disabledPay">
  112. {{ disabledPay ? `差${spread}元起送` : '去结算' }}
  113. </button>
  114. </view>
  115. <!-- 购物车栏 end -->
  116. </view>
  117. </template>
  118. <script>
  119. // +----------------------------------------------------------------------
  120. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  121. // +----------------------------------------------------------------------
  122. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  123. // +----------------------------------------------------------------------
  124. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  125. // +----------------------------------------------------------------------
  126. // | Author: CRMEB Team <admin@crmeb.com>
  127. // +----------------------------------------------------------------------
  128. import {
  129. getCategoryCacheTree,
  130. getMerchantInfo,
  131. getMerchantProList
  132. } from '@/api/merchant.js';
  133. let app = getApp();
  134. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'rpx';
  135. export default {
  136. data() {
  137. return {
  138. merId: 0,
  139. winHeight: 0,
  140. merchanInfo: {},
  141. statusBarHeight: app.globalData.statusBarHeight,
  142. navigationBarHeight: 112,
  143. goods: [], //所有商品
  144. loading: true,
  145. currentCateId: 1, //默认分类
  146. cateScrollTop: 0,
  147. lastScrollTop: 0,
  148. menuScrollIntoView: '',
  149. cart: [], //购物车
  150. goodDetailModalVisible: false, //是否饮品详情模态框
  151. good: {}, //当前饮品
  152. category: {}, //当前饮品所在分类
  153. cartPopupVisible: false,
  154. sizeCalcState: false,
  155. orderType: 'takeout',
  156. store: {
  157. min_price: 8
  158. }
  159. }
  160. },
  161. onLoad(options) {
  162. let that = this;
  163. uni.getSystemInfo({
  164. success: function(res) {
  165. that.winHeight = res.windowHeight
  166. },
  167. });
  168. this.merId = uni.getStorageSync('merId')
  169. //首页数据加载
  170. // 获取商家信息
  171. getMerchantInfo(this.merId).then(res => {
  172. this.merchanInfo = res.data
  173. });
  174. // 获取商品列表
  175. getCategoryCacheTree(this.merId).then(res => {
  176. console.log(res.data)
  177. this.goods = res.data
  178. // this.goods.unshift({
  179. // id: 9999,
  180. // name: '推荐'
  181. // })
  182. this.currentCateId = this.goods[0].id
  183. // this.menuScrollIntoView = `cate-${9999}`
  184. })
  185. // this.getIndexConfig();
  186. // #ifdef MP-WEIXIN
  187. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  188. const custom = wx.getMenuButtonBoundingClientRect()
  189. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  190. // this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  191. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  192. // #endif
  193. },
  194. computed: {
  195. goodCartNum() { //计算单个饮品添加到购物车的数量
  196. return (id) => this.cart.reduce((acc, cur) => {
  197. if (cur.id === id) {
  198. return acc += cur.number
  199. }
  200. return acc
  201. }, 0)
  202. },
  203. menuCartNum() {
  204. return (id) => this.cart.reduce((acc, cur) => {
  205. if (cur.cate_id === id) {
  206. return acc += cur.number
  207. }
  208. return acc
  209. }, 0)
  210. },
  211. getCartGoodsNumber() { //计算购物车总数
  212. return this.cart.reduce((acc, cur) => acc + cur.number, 0)
  213. },
  214. getCartGoodsPrice() { //计算购物车总价
  215. return this.cart.reduce((acc, cur) => acc + cur.number * cur.price, 0)
  216. },
  217. disabledPay() { //是否达到起送价
  218. return this.orderType == 'takeout' && (this.getCartGoodsPrice < this.store.min_price) ? true : false
  219. },
  220. spread() { //差多少元起送
  221. if (this.orderType != 'takeout') return
  222. return parseFloat((this.store.min_price - this.getCartGoodsPrice).toFixed(2))
  223. }
  224. },
  225. methods: {
  226. handBack() {
  227. uni.navigateBack({
  228. delta: 1
  229. })
  230. },
  231. handleMenuTap(id) { //点击菜单项事件
  232. this.menuScrollIntoView = `cate-${id}`
  233. if (!this.sizeCalcState) {
  234. this.calcSize()
  235. }
  236. this.$nextTick(() => this.cateScrollTop = this.goods.find(item => item.id == id).top)
  237. },
  238. handleGoodsScroll({
  239. detail
  240. }) { //商品列表滚动事件
  241. if (!this.sizeCalcState) {
  242. this.calcSize()
  243. }
  244. const {
  245. scrollTop
  246. } = detail
  247. let tabs = this.goods.filter(item => item.top <= scrollTop).reverse()
  248. if (tabs.length > 0) {
  249. this.currentCateId = tabs[0].id
  250. }
  251. },
  252. handleFoot($event) {
  253. const nextItems = this.findNextAll(this.goods, item => item.id === this.currentCateId);
  254. if (nextItems.id) {
  255. this.currentCateId = nextItems.id
  256. }
  257. },
  258. findNextAll(arr, condition) {
  259. const index = arr.findIndex(condition);
  260. if (index !== -1) {
  261. return arr[index + 1] || {}; // 返回符合条件之后的记录
  262. }
  263. return {}; // 如果没有找到符合条件的记录,返回空对象
  264. },
  265. calcSize() {
  266. let h = 10
  267. this.goods.forEach(item => {
  268. let view = uni.createSelectorQuery().select(`#cate-${item.id}`)
  269. view.fields({
  270. size: true
  271. }, data => {
  272. // if (data.goodsList) {
  273. item.top = h
  274. h += data.height
  275. item.bottom = h
  276. // }
  277. }).exec()
  278. })
  279. this.sizeCalcState = true
  280. },
  281. showGoodDetailModal(item, good) {
  282. this.good = JSON.parse(JSON.stringify({ ...good,
  283. number: 1
  284. }))
  285. this.category = JSON.parse(JSON.stringify(item))
  286. this.goodDetailModalVisible = true
  287. },
  288. handlePropertyAdd() {
  289. this.good.number += 1
  290. },
  291. handlePropertyReduce() {
  292. if (this.good.number === 1) return
  293. this.good.number -= 1
  294. },
  295. handleAddToCartInModal() {
  296. const product = Object.assign({}, this.good, {
  297. props_text: this.getGoodSelectedProps(this.good),
  298. props: this.getGoodSelectedProps(this.good, 'id')
  299. })
  300. this.handleAddToCart(this.category, product, this.good.number)
  301. this.closeGoodDetailModal()
  302. },
  303. getGoodSelectedProps(good, type = 'text') { //计算当前饮品所选属性
  304. if (good.use_property) {
  305. let props = []
  306. good.property.forEach(({
  307. values
  308. }) => {
  309. values.forEach(value => {
  310. if (value.is_default) {
  311. props.push(type === 'text' ? value.value : value.id)
  312. }
  313. })
  314. })
  315. return type === 'text' ? props.join(',') : props
  316. }
  317. return ''
  318. },
  319. handleReduceFromCart(item, good) {
  320. const index = this.cart.findIndex(item => item.id === good.id)
  321. this.cart[index].number -= 1
  322. if (this.cart[index].number <= 0) {
  323. this.cart.splice(index, 1)
  324. }
  325. },
  326. handleAddToCart(cate, good, num) { //添加到购物车
  327. const index = this.cart.findIndex(item => {
  328. if (good.use_property) {
  329. return (item.id === good.id) && (item.props_text === good.props_text)
  330. } else {
  331. return item.id === good.id
  332. }
  333. })
  334. if (index > -1) {
  335. this.cart[index].number += num
  336. } else {
  337. this.cart.push({
  338. id: good.id,
  339. cate_id: cate.id,
  340. name: good.name,
  341. price: good.price,
  342. number: num,
  343. image: good.images,
  344. use_property: good.use_property,
  345. props_text: good.props_text,
  346. props: good.props
  347. })
  348. }
  349. },
  350. toPay() {
  351. // if(!this.isLogin) {
  352. // uni.navigateTo({url: '/pages/login/login'})
  353. // return
  354. // }
  355. uni.showLoading({
  356. title: '加载中'
  357. })
  358. uni.setStorageSync('cart', JSON.parse(JSON.stringify(this.cart)))
  359. uni.navigateTo({
  360. url: '/pages/goods/order_confirm/index'
  361. })
  362. uni.hideLoading()
  363. }
  364. }
  365. }
  366. </script>
  367. <style lang="scss" scoped>
  368. /* #ifdef H5 */
  369. page {
  370. min-height: 100%;
  371. }
  372. /* #endif */
  373. .bg-color {
  374. background-color: $bg-color-primary;
  375. }
  376. .order-nav {
  377. // height: 111rpx;
  378. position: relative;
  379. background-color: #FF6702;
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. .back-button {
  384. position: absolute;
  385. left: 20rpx;
  386. }
  387. text {
  388. font-weight: 500;
  389. font-size: 35rpx;
  390. color: #FFFFFF;
  391. }
  392. }
  393. .container {
  394. display: flex;
  395. flex-direction: column;
  396. overflow: hidden;
  397. position: relative;
  398. }
  399. .loading {
  400. width: 100%;
  401. height: 100%;
  402. display: flex;
  403. align-items: center;
  404. justify-content: center;
  405. image {
  406. width: 260rpx;
  407. height: 260rpx;
  408. position: relative;
  409. margin-top: -200rpx;
  410. /* #ifdef h5 */
  411. margin-top: 0;
  412. /* #endif */
  413. }
  414. }
  415. .stores {
  416. width: 100%;
  417. display: flex;
  418. flex-direction: column;
  419. justify-content: flex-start;
  420. margin-bottom: -40rpx;
  421. .store {
  422. width: 100%;
  423. background-color: $bg-color-grey;
  424. padding: 20rpx;
  425. display: flex;
  426. align-items: center;
  427. margin-bottom: 20rpx;
  428. border-radius: 6rpx;
  429. .iconfont {
  430. font-size: 50rpx;
  431. margin-right: 15rpx;
  432. &.iconradio-button-off {
  433. color: $text-color-assist;
  434. }
  435. &.iconradio-button-on {
  436. color: $color-primary;
  437. }
  438. }
  439. .infos {
  440. flex: 1;
  441. display: flex;
  442. flex-direction: column;
  443. color: $text-color-base;
  444. overflow: hidden;
  445. .name_and_distance {
  446. width: 100%;
  447. display: flex;
  448. justify-content: space-between;
  449. margin-bottom: 10rpx;
  450. overflow: hidden;
  451. .name {
  452. flex: 1;
  453. flex-shrink: 0;
  454. overflow: hidden;
  455. text-overflow: ellipsis;
  456. white-space: nowrap;
  457. font-size: $font-size-lg;
  458. }
  459. .distance {
  460. flex-shrink: 0;
  461. font-size: $font-size-lg;
  462. font-weight: bold;
  463. margin-left: 20rpx;
  464. }
  465. }
  466. .street {
  467. color: $text-color-assist;
  468. font-size: $font-size-sm;
  469. }
  470. }
  471. }
  472. }
  473. .main {
  474. overflow: hidden;
  475. width: 100%;
  476. display: flex;
  477. flex-direction: column;
  478. }
  479. .nav {
  480. width: 100%;
  481. flex-shrink: 0;
  482. display: flex;
  483. flex-direction: column;
  484. border-radius: 23rpx;
  485. padding: 19rpx 57rpx 38rpx 58rpx;
  486. background-color: #ffffff;
  487. .header {
  488. width: 100%;
  489. display: flex;
  490. align-items: center;
  491. justify-content: space-between;
  492. .left {
  493. flex: 1;
  494. display: flex;
  495. flex-direction: column;
  496. .store-name {
  497. display: flex;
  498. justify-content: flex-start;
  499. align-items: center;
  500. font-size: $font-size-lg;
  501. margin-bottom: 10rpx;
  502. .iconfont {
  503. margin-left: 10rpx;
  504. line-height: 100%;
  505. }
  506. }
  507. .store-tip {
  508. font-weight: 400;
  509. font-size: 21rpx;
  510. color: #858687;
  511. margin-top: 10rpx;
  512. background: #F8F9FB;
  513. border-radius: 4rpx;
  514. }
  515. }
  516. .right {
  517. background-color: $bg-color-grey;
  518. border-radius: 38rpx;
  519. display: flex;
  520. align-items: center;
  521. font-size: $font-size-sm;
  522. padding: 0 38rpx;
  523. color: $text-color-assist;
  524. .dinein,
  525. .takeout {
  526. position: relative;
  527. display: flex;
  528. align-items: center;
  529. &.active {
  530. padding: 14rpx 38rpx;
  531. color: #ffffff;
  532. background-color: $color-primary;
  533. border-radius: 38rpx;
  534. }
  535. }
  536. .takeout {
  537. margin-left: 20rpx;
  538. height: 100%;
  539. flex: 1;
  540. padding: 14rpx 0;
  541. }
  542. .dinein.active {
  543. margin-left: -38rpx;
  544. }
  545. .takeout.active {
  546. margin-right: -38rpx;
  547. }
  548. }
  549. }
  550. .coupon {
  551. flex: 1;
  552. width: 100%;
  553. background-color: $bg-color-primary;
  554. font-size: $font-size-base;
  555. color: $color-primary;
  556. padding: 0 20rpx;
  557. display: flex;
  558. align-items: center;
  559. overflow: hidden;
  560. .title {
  561. flex: 1;
  562. margin-left: 10rpx;
  563. overflow: hidden;
  564. white-space: nowrap;
  565. text-overflow: ellipsis;
  566. }
  567. .iconfont {
  568. line-height: 100%;
  569. }
  570. }
  571. }
  572. .content {
  573. flex: 1;
  574. overflow: hidden;
  575. width: 100%;
  576. display: flex;
  577. border-radius: 23rpx 23rpx 0rpx 0rpx;
  578. .menus {
  579. width: 200rpx;
  580. height: 100%;
  581. overflow: hidden;
  582. background-color: $bg-color-grey;
  583. .wrapper {
  584. width: 100%;
  585. height: 100%;
  586. .menu {
  587. display: flex;
  588. align-items: center;
  589. justify-content: flex-start;
  590. padding: 30rpx 20rpx;
  591. font-size: 26rpx;
  592. color: $text-color-assist;
  593. position: relative;
  594. display: flex;
  595. align-items: center;
  596. justify-content: center;
  597. &:nth-last-child(1) {
  598. margin-bottom: 230rpx;
  599. }
  600. &.current {
  601. background-color: #ffffff;
  602. color: $text-color-base;
  603. }
  604. .dot {
  605. position: absolute;
  606. width: 34rpx;
  607. height: 34rpx;
  608. line-height: 34rpx;
  609. font-size: 22rpx;
  610. background-color: $bg-color-primary;
  611. color: #ffffff;
  612. top: 16rpx;
  613. right: 10rpx;
  614. border-radius: 100%;
  615. text-align: center;
  616. }
  617. }
  618. }
  619. }
  620. .goods {
  621. flex: 1;
  622. height: 100%;
  623. overflow: hidden;
  624. background-color: #ffffff;
  625. .wrapper {
  626. width: 100%;
  627. height: 100%;
  628. padding: 20rpx;
  629. .ads {
  630. height: calc(300 / 550 * 510rpx);
  631. image {
  632. width: 100%;
  633. height: 100%;
  634. border-radius: 8rpx;
  635. }
  636. }
  637. .list {
  638. width: 100%;
  639. font-size: $font-size-base;
  640. padding-bottom: 800rpx;
  641. .category {
  642. width: 100%;
  643. .title {
  644. padding: 30rpx 0;
  645. display: flex;
  646. align-items: center;
  647. color: $text-color-base;
  648. .icon {
  649. width: 38rpx;
  650. height: 38rpx;
  651. margin-left: 10rpx;
  652. }
  653. }
  654. }
  655. .items {
  656. display: flex;
  657. flex-direction: column;
  658. padding-bottom: -30rpx;
  659. .good {
  660. display: flex;
  661. align-items: center;
  662. margin-bottom: 30rpx;
  663. .image {
  664. width: 160rpx;
  665. height: 160rpx;
  666. margin-right: 20rpx;
  667. border-radius: 8rpx;
  668. }
  669. .right {
  670. flex: 1;
  671. // height: 160rpx;
  672. overflow: hidden;
  673. display: flex;
  674. flex-direction: column;
  675. align-items: flex-start;
  676. justify-content: space-between;
  677. padding-right: 14rpx;
  678. .name {
  679. font-size: $font-size-base;
  680. margin-bottom: 10rpx;
  681. }
  682. .tips {
  683. width: 100%;
  684. height: 40rpx;
  685. line-height: 40rpx;
  686. overflow: hidden;
  687. text-overflow: ellipsis;
  688. white-space: nowrap;
  689. font-size: $font-size-sm;
  690. color: $text-color-assist;
  691. margin-bottom: 10rpx;
  692. }
  693. .price_and_action {
  694. width: 100%;
  695. display: flex;
  696. justify-content: space-between;
  697. align-items: center;
  698. .price {
  699. font-size: $font-size-base;
  700. font-weight: 600;
  701. }
  702. .btn-group {
  703. display: flex;
  704. justify-content: space-between;
  705. align-items: center;
  706. position: relative;
  707. .btn {
  708. padding: 0 20rpx;
  709. box-sizing: border-box;
  710. font-size: $font-size-sm;
  711. height: 44rpx;
  712. line-height: 44rpx;
  713. &.property_btn {
  714. border-radius: 24rpx;
  715. }
  716. &.add_btn,
  717. &.reduce_btn {
  718. padding: 0;
  719. width: 44rpx;
  720. border-radius: 44rpx;
  721. }
  722. }
  723. .dot {
  724. position: absolute;
  725. background-color: #ffffff;
  726. border: 1px solid $bg-color-primary;
  727. color: $bg-color-primary;
  728. font-size: $font-size-sm;
  729. width: 36rpx;
  730. height: 36rpx;
  731. line-height: 36rpx;
  732. text-align: center;
  733. border-radius: 100%;
  734. right: -12rpx;
  735. top: -10rpx;
  736. }
  737. .number {
  738. width: 44rpx;
  739. height: 44rpx;
  740. line-height: 44rpx;
  741. text-align: center;
  742. }
  743. }
  744. }
  745. }
  746. }
  747. }
  748. }
  749. }
  750. }
  751. }
  752. .modal-box {
  753. max-height: 90vh;
  754. }
  755. .good-detail-modal {
  756. width: 100%;
  757. height: 100%;
  758. display: flex;
  759. flex-direction: column;
  760. .cover {
  761. height: 320rpx;
  762. padding: 30rpx 0;
  763. display: flex;
  764. justify-content: center;
  765. align-items: center;
  766. position: relative;
  767. .image {
  768. width: 260rpx;
  769. height: 260rpx;
  770. }
  771. .btn-group {
  772. position: absolute;
  773. right: 10rpx;
  774. top: 30rpx;
  775. display: flex;
  776. align-items: center;
  777. justify-content: space-around;
  778. image {
  779. width: 80rpx;
  780. height: 80rpx;
  781. }
  782. }
  783. }
  784. .detail {
  785. width: 100%;
  786. min-height: 1vh;
  787. max-height: calc(90vh - 320rpx - 80rpx - 120rpx);
  788. .wrapper {
  789. width: 100%;
  790. height: 100%;
  791. overflow: hidden;
  792. .basic {
  793. padding: 0 20rpx 30rpx;
  794. display: flex;
  795. flex-direction: column;
  796. .name {
  797. font-size: $font-size-base;
  798. color: $text-color-base;
  799. margin-bottom: 10rpx;
  800. }
  801. .tips {
  802. font-size: $font-size-sm;
  803. color: $text-color-grey;
  804. }
  805. }
  806. .properties {
  807. width: 100%;
  808. border-top: 2rpx solid $bg-color-grey;
  809. padding: 10rpx 30rpx 0;
  810. display: flex;
  811. flex-direction: column;
  812. .property {
  813. width: 100%;
  814. display: flex;
  815. flex-direction: column;
  816. margin-bottom: 30rpx;
  817. padding-bottom: -16rpx;
  818. .title {
  819. width: 100%;
  820. display: flex;
  821. justify-content: flex-start;
  822. align-items: center;
  823. margin-bottom: 20rpx;
  824. .name {
  825. font-size: 26rpx;
  826. color: $text-color-base;
  827. margin-right: 20rpx;
  828. }
  829. .desc {
  830. flex: 1;
  831. font-size: $font-size-sm;
  832. color: $color-primary;
  833. overflow: hidden;
  834. text-overflow: ellipsis;
  835. white-space: nowrap;
  836. }
  837. }
  838. .values {
  839. width: 100%;
  840. display: flex;
  841. flex-wrap: wrap;
  842. .value {
  843. border-radius: 8rpx;
  844. background-color: $bg-color-grey;
  845. padding: 16rpx 30rpx;
  846. font-size: 26rpx;
  847. color: $text-color-assist;
  848. margin-right: 16rpx;
  849. margin-bottom: 16rpx;
  850. &.default {
  851. background-color: $color-primary;
  852. color: $text-color-white;
  853. }
  854. }
  855. }
  856. }
  857. }
  858. }
  859. }
  860. .action {
  861. display: flex;
  862. align-items: center;
  863. justify-content: space-between;
  864. background-color: $bg-color-grey;
  865. height: 120rpx;
  866. padding: 0 26rpx;
  867. .left {
  868. flex: 1;
  869. display: flex;
  870. flex-direction: column;
  871. justify-content: center;
  872. margin-right: 20rpx;
  873. overflow: hidden;
  874. .price {
  875. font-size: $font-size-lg;
  876. color: $text-color-base;
  877. }
  878. .props {
  879. color: $text-color-assist;
  880. font-size: 24rpx;
  881. width: 100%;
  882. overflow: hidden;
  883. text-overflow: ellipsis;
  884. white-space: nowrap;
  885. }
  886. }
  887. .btn-group {
  888. display: flex;
  889. align-items: center;
  890. justify-content: space-around;
  891. .number {
  892. font-size: $font-size-base;
  893. width: 44rpx;
  894. height: 44rpx;
  895. line-height: 44rpx;
  896. text-align: center;
  897. }
  898. .btn {
  899. padding: 0;
  900. font-size: $font-size-base;
  901. width: 44rpx;
  902. height: 44rpx;
  903. line-height: 44rpx;
  904. border-radius: 100%;
  905. }
  906. }
  907. }
  908. .add-to-cart-btn {
  909. display: flex;
  910. justify-content: center;
  911. align-items: center;
  912. background-color: $color-primary;
  913. color: $text-color-white;
  914. font-size: $font-size-base;
  915. height: 80rpx;
  916. border-radius: 0 0 12rpx 12rpx;
  917. }
  918. }
  919. .cart-box {
  920. position: absolute;
  921. // bottom: 30rpx;
  922. left: 30rpx;
  923. right: 30rpx;
  924. height: 96rpx;
  925. border-radius: 48rpx;
  926. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  927. background-color: #000;
  928. display: flex;
  929. align-items: center;
  930. justify-content: space-between;
  931. z-index: 9999;
  932. .cart-img {
  933. width: 50rpx;
  934. height: 47rpx;
  935. position: relative;
  936. // margin-top: -48rpx;
  937. }
  938. .pay-btn {
  939. height: 100%;
  940. padding: 0 30rpx;
  941. color: #FFFFFF;
  942. border-radius: 0 50rpx 50rpx 0;
  943. display: flex;
  944. align-items: center;
  945. font-size: $font-size-base;
  946. }
  947. .mark {
  948. padding-left: 46rpx;
  949. margin-right: 30rpx;
  950. position: relative;
  951. .tag {
  952. background-color: $color-warning;
  953. color: $text-color-white;
  954. display: flex;
  955. justify-content: center;
  956. align-items: center;
  957. font-size: $font-size-sm;
  958. position: absolute;
  959. right: -13rpx;
  960. top: -20rpx;
  961. border-radius: 100%;
  962. padding: 4rpx;
  963. width: 27rpx;
  964. height: 27rpx;
  965. opacity: .9;
  966. }
  967. }
  968. .price {
  969. flex: 1;
  970. color: $text-color-base;
  971. }
  972. }
  973. .cart-popup {
  974. .top {
  975. background-color: $bg-color-primary;
  976. color: $color-primary;
  977. padding: 10rpx 30rpx;
  978. font-size: 24rpx;
  979. text-align: right;
  980. }
  981. .cart-list {
  982. background-color: #FFFFFF;
  983. width: 100%;
  984. overflow: hidden;
  985. min-height: 1vh;
  986. max-height: 60vh;
  987. .wrapper {
  988. height: 100%;
  989. display: flex;
  990. flex-direction: column;
  991. padding: 0 30rpx;
  992. margin-bottom: 156rpx;
  993. .item {
  994. display: flex;
  995. justify-content: space-between;
  996. align-items: center;
  997. padding: 30rpx 0;
  998. position: relative;
  999. &::after {
  1000. content: ' ';
  1001. position: absolute;
  1002. bottom: 0;
  1003. left: 0;
  1004. width: 100%;
  1005. background-color: $border-color;
  1006. height: 2rpx;
  1007. transform: scaleY(.6);
  1008. }
  1009. .left {
  1010. flex: 1;
  1011. display: flex;
  1012. flex-direction: column;
  1013. overflow: hidden;
  1014. margin-right: 30rpx;
  1015. .name {
  1016. font-size: $font-size-sm;
  1017. color: $text-color-base;
  1018. }
  1019. .props {
  1020. color: $text-color-assist;
  1021. font-size: 24rpx;
  1022. overflow: hidden;
  1023. text-overflow: ellipsis;
  1024. white-space: nowrap;
  1025. }
  1026. }
  1027. .center {
  1028. margin-right: 120rpx;
  1029. font-size: $font-size-base;
  1030. }
  1031. .right {
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: space-between;
  1035. .btn {
  1036. width: 46rpx;
  1037. height: 46rpx;
  1038. border-radius: 100%;
  1039. padding: 0;
  1040. text-align: center;
  1041. line-height: 46rpx;
  1042. }
  1043. .number {
  1044. font-size: $font-size-base;
  1045. width: 46rpx;
  1046. height: 46rpx;
  1047. text-align: center;
  1048. line-height: 46rpx;
  1049. }
  1050. }
  1051. }
  1052. }
  1053. }
  1054. }
  1055. .back-button {
  1056. width: 30rpx;
  1057. height: 30rpx;
  1058. border-right: 4rpx solid #fff;
  1059. border-bottom: 4rpx solid #fff;
  1060. transform: rotate(135deg);
  1061. margin-left: 10rpx;
  1062. display: inline-block;
  1063. position: relative;
  1064. }
  1065. .newsTitle {
  1066. display: flex;
  1067. align-items: center;
  1068. }
  1069. </style>