index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485
  1. <template>
  2. <view class="container" :style="{ height: winHeight+ 'px' }">
  3. <!-- #ifdef MP -->
  4. <view class="cart_nav">
  5. <nav-bar iconColor='#fff' ref="navBarRef" navTitle="" backgroundColor="#FF6702" :isBackgroundColor="false">
  6. </nav-bar>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. // +----------------------------------------------------------------------
  12. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  13. // +----------------------------------------------------------------------
  14. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  15. // +----------------------------------------------------------------------
  16. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  17. // +----------------------------------------------------------------------
  18. // | Author: CRMEB Team <admin@crmeb.com>
  19. // +----------------------------------------------------------------------
  20. import {
  21. getCategoryCacheTree,
  22. getMerchantInfo,
  23. getMerchantProList
  24. } from '@/api/merchant.js';
  25. import {
  26. getProductDetail
  27. } from '@/api/product.js';
  28. import {
  29. orderCreate,
  30. preOrderApi
  31. } from '@/api/order.js';
  32. import navBar from '@/components/navBar';
  33. import {
  34. getAddressList
  35. } from '@/api/user.js';
  36. let app = getApp();
  37. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'rpx';
  38. export default {
  39. components: {
  40. navBar
  41. },
  42. data() {
  43. return {
  44. merId: 0,
  45. winHeight: 0,
  46. merchanInfo: {},
  47. statusBarHeight: app.globalData.statusBarHeight,
  48. navigationBarHeight: 112,
  49. goods: [], //所有商品
  50. loading: true,
  51. currentCateId: 1, //默认分类
  52. cateScrollTop: 0,
  53. lastScrollTop: 0,
  54. menuScrollIntoView: '',
  55. cart: [], //购物车
  56. goodDetailModalVisible: false, //是否饮品详情模态框
  57. good: {}, //当前饮品
  58. category: {}, //当前饮品所在分类
  59. cartPopupVisible: false,
  60. sizeCalcState: false,
  61. orderType: 'takeout',
  62. store: {
  63. min_price: 0.01
  64. },
  65. specifications: '', //点击的这一项菜品信息
  66. specificationsList: [], //点击的这一项菜品信息的大类
  67. selectble: false, //规格弹窗
  68. productValue: [], //规格数组
  69. productObj: {}, //规格对象
  70. productid: '', //选中规格的id
  71. lockcatble: false, // 购物车弹窗
  72. addressInfo: {}
  73. }
  74. },
  75. onLoad(options) {
  76. let that = this;
  77. uni.getSystemInfo({
  78. success: function(res) {
  79. that.winHeight = res.windowHeight
  80. },
  81. });
  82. this.merId = uni.getStorageSync('merId')
  83. //首页数据加载
  84. // 获取商家信息
  85. getMerchantInfo(this.merId).then(res => {
  86. this.merchanInfo = res.data
  87. });
  88. // 获取商品列表
  89. getCategoryCacheTree(this.merId).then(res => {
  90. console.log(res.data)
  91. this.goods = res.data
  92. // this.goods.unshift({
  93. // id: 9999,
  94. // name: '推荐'
  95. // })
  96. this.currentCateId = this.goods[0].id
  97. // this.menuScrollIntoView = `cate-${9999}`
  98. })
  99. // 获取用户默认地址
  100. this.getAddressList()
  101. // this.getIndexConfig();
  102. // #ifdef MP-WEIXIN
  103. // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
  104. const custom = wx.getMenuButtonBoundingClientRect()
  105. // 导航栏高度(标题栏高度) = 胶囊高度 + (顶部距离 - 状态栏高度) * 2
  106. // this.navigationBarHeight = custom.height + (custom.top - this.statusBarHeight) * 2
  107. // console.log("导航栏高度:"+this.globalData.navigationBarHeight)
  108. // #endif
  109. },
  110. computed: {
  111. goodCartNum() { //计算单个饮品添加到购物车的数量
  112. // this.good
  113. return (text) => this.cart.reduce((acc, cur) => {
  114. !text ? text = this.getGoodSelectedProps(this.good) : ''
  115. if (cur.props_text === text) {
  116. return acc += cur.number
  117. }
  118. return acc
  119. }, 0)
  120. },
  121. menuCartNum() {
  122. return (id) => this.cart.reduce((acc, cur) => {
  123. if (cur.cate_id === id) {
  124. return acc += cur.number
  125. }
  126. return acc
  127. }, 0)
  128. },
  129. getCartGoodsNumber() { //计算购物车总数
  130. return this.cart.reduce((acc, cur) => acc + cur.number, 0)
  131. },
  132. getCartGoodsPrice() { //计算购物车总价
  133. return this.cart.reduce((acc, cur) => acc + cur.number * cur.price, 0)
  134. },
  135. disabledPay() { //是否达到起送价
  136. return this.orderType == 'takeout' && (this.getCartGoodsPrice < this.store.min_price) ? true : false
  137. },
  138. spread() { //差多少元起送
  139. if (this.orderType != 'takeout') return
  140. return parseFloat((this.store.min_price - this.getCartGoodsPrice).toFixed(2))
  141. }
  142. },
  143. methods: {
  144. // 获取地址数据
  145. getAddressList() {
  146. getAddressList().then(res => {
  147. console.log('地址', res)
  148. if (res.code = 200) {
  149. this.addressInfo = res.data.find(item => item.isDefault === true);
  150. console.log('默认地址', this.addressInfo)
  151. }
  152. })
  153. },
  154. handBack() {
  155. uni.navigateBack({
  156. delta: 1
  157. })
  158. },
  159. handleMenuTap(id) { //点击菜单项事件
  160. this.menuScrollIntoView = `cate-${id}`
  161. if (!this.sizeCalcState) {
  162. this.calcSize()
  163. }
  164. this.$nextTick(() => this.cateScrollTop = this.goods.find(item => item.id == id).top)
  165. },
  166. handleGoodsScroll({
  167. detail
  168. }) { //商品列表滚动事件
  169. if (!this.sizeCalcState) {
  170. this.calcSize()
  171. }
  172. const {
  173. scrollTop
  174. } = detail
  175. let tabs = this.goods.filter(item => item.top <= scrollTop).reverse()
  176. if (tabs.length > 0) {
  177. this.currentCateId = tabs[0].id
  178. }
  179. },
  180. calcSize() {
  181. let h = 10
  182. this.goods.forEach(item => {
  183. let view = uni.createSelectorQuery().select(`#cate-${item.id}`)
  184. view.fields({
  185. size: true
  186. }, data => {
  187. // if (data.goodsList) {
  188. item.top = h
  189. h += data.height
  190. item.bottom = h
  191. // }
  192. }).exec()
  193. })
  194. this.sizeCalcState = true
  195. },
  196. showGoodDetailModal(item, good) {
  197. this.good = JSON.parse(JSON.stringify({ ...good
  198. }))
  199. this.category = JSON.parse(JSON.stringify(item))
  200. this.goodDetailModalVisible = true
  201. },
  202. handlePropertyAdd() {
  203. this.good.number += 1
  204. },
  205. handlePropertyReduce() {
  206. if (this.good.number === 1) return
  207. this.good.number -= 1
  208. },
  209. changePropertyDefault(index, key) { //改变默认属性值
  210. this.good.property[index].optionList.forEach(value => this.$set(value, 'is_default', 0))
  211. this.good.property[index].optionList[key].is_default = 1
  212. this.good.number = 1
  213. this.good = JSON.parse(JSON.stringify(this.good))
  214. },
  215. handleAddToCartInModal() {
  216. const product = Object.assign({}, this.good, {
  217. props_text: this.getGoodSelectedProps(this.good),
  218. props: this.getGoodSelectedProps(this.good, 'id')
  219. })
  220. this.handleAddToCart(this.category, product, this.good.number)
  221. // this.closeGoodDetailModal()
  222. },
  223. getGoodSelectedProps(good, type = 'text') { //计算当前饮品所选属性
  224. // if (good.use_property) {
  225. let props = []
  226. good.property.forEach(({
  227. optionList
  228. }) => {
  229. optionList.forEach(value => {
  230. if (value.is_default) {
  231. props.push(type === 'text' ? value.optionName : value.id)
  232. }
  233. })
  234. })
  235. return type === 'text' ? props.join(',') : props
  236. // }
  237. // return ''
  238. },
  239. handleReduceFromCart(item, good) {
  240. const goodText = this.getGoodSelectedProps(this.good) // 购物车当前选中的规格
  241. const index = this.cart.findIndex(item => item.id === good.id && item.props_text === goodText)
  242. this.cart[index].number -= 1
  243. if (this.cart[index].number <= 0) {
  244. this.cart.splice(index, 1)
  245. }
  246. },
  247. handleAddToCart(cate, good, num) { //添加到购物车
  248. const goodText = this.getGoodSelectedProps(this.good) // 购物车当前选中的规格
  249. const index = this.cart.findIndex(item => {
  250. // if (good.use_property) {
  251. // !good.props_text ? good.props_text = this.getGoodSelectedProps(good) : ''
  252. return (item.id === good.id) && (item.props_text === goodText)
  253. // } else {
  254. // return item.id === good.id
  255. // }
  256. })
  257. if (index > -1) {
  258. this.cart[index].number += num
  259. } else {
  260. this.cart.push({
  261. id: good.id,
  262. cate_id: cate.id,
  263. name: good.name,
  264. price: good.price,
  265. number: num,
  266. icon: good.icon,
  267. use_property: good.use_property,
  268. props_text: this.getGoodSelectedProps(this.good),
  269. props: this.getGoodSelectedProps(this.good, 'id'),
  270. productid: this.productObj[goodText].id,
  271. iconText: this.productObj[goodText].image,
  272. ...good
  273. })
  274. }
  275. console.log(this.cart, '购物车')
  276. },
  277. toPay() {
  278. // if(!this.isLogin) {
  279. // uni.navigateTo({url: '/pages/login/login'})
  280. // return
  281. // }
  282. uni.showLoading({
  283. title: '加载中'
  284. })
  285. let orderDetails = this.cart.map((item) => {
  286. return {
  287. attrValueId: item.productid, //商品规格属性id(立即购买、活动购买必填)
  288. groupBuyActivityId: null, //拼团活动id(拼团下单时必填)
  289. groupBuyRecordId: 0, // 拼团记录id,营销类型2=拼团 时必填 0=开团 实际
  290. productId: item.id, //商品id
  291. productNum: item.number //商品数量
  292. };
  293. });
  294. preOrderApi({
  295. "preOrderType": 'buyNow',
  296. //类型 预下单类型(“shoppingCart”:购物车下单,“buyNow”:
  297. // 立即购买,“video”: 视频号商品下单,“seckill”:秒杀下单,“group”:拼团下单)
  298. "orderDetails": orderDetails //购物车信息
  299. }).then(res => {
  300. console.log('预下单接口', res)
  301. if (res.code == 200) {
  302. let cartList = JSON.stringify(this.cart)
  303. // uni.setStorageSync('cart', JSON.parse(JSON.stringify(this.cart)))
  304. uni.navigateTo({
  305. // url: `/pages/goods/order_confirm/index?cartList=${cartList}`
  306. url: '/pages/goods/order_confirm/index?is_address=1&orderNo=' + res.data.orderNo +
  307. '&addressId=' + this.addressInfo.id
  308. })
  309. }
  310. })
  311. uni.setStorageSync('cart', JSON.parse(JSON.stringify(this.cart)))
  312. uni.hideLoading()
  313. },
  314. // 选规格打开
  315. Selectpox(item, itemInfo) {
  316. this.specifications = itemInfo //这一项信息
  317. this.specificationsList = item //这一项信息
  318. // this.good = Object.assign({}, this.good, itemInfo)
  319. getProductDetail(
  320. itemInfo.id,
  321. 0, 0, ''
  322. ).then((res) => {
  323. console.log('规格', res)
  324. if (res.code == 200) {
  325. this.good.property = res.data.productAttr.map(item => {
  326. item.optionList.forEach((items, index) => {
  327. index === 0 ? items.is_default = true : '' // 规格默认选中
  328. })
  329. return { ...item }
  330. })
  331. console.log(this.good)
  332. // this.productValue = res.data.productAttr //规格数组
  333. this.productObj = res.data.productValue //默认选择的id
  334. this.selectble = true
  335. }
  336. })
  337. },
  338. // 关闭规格
  339. Close() {
  340. this.specifications = '' //这一项信息
  341. this.specificationsList = [] //这一项信息
  342. this.selectble = false
  343. },
  344. }
  345. }
  346. </script>
  347. <style lang="scss" scoped>
  348. /* #ifdef H5 */
  349. page {
  350. min-height: 100%;
  351. }
  352. /* #endif */
  353. .bg-color {
  354. background-color: $bg-color-primary;
  355. }
  356. .order-nav {
  357. // height: 111rpx;
  358. position: relative;
  359. background-color: #FF6702;
  360. display: flex;
  361. align-items: center;
  362. justify-content: center;
  363. .back-button {
  364. position: absolute;
  365. left: 20rpx;
  366. }
  367. text {
  368. font-weight: 500;
  369. font-size: 35rpx;
  370. color: #FFFFFF;
  371. }
  372. }
  373. .container {
  374. display: flex;
  375. flex-direction: column;
  376. overflow: hidden;
  377. position: relative;
  378. }
  379. .loading {
  380. width: 100%;
  381. height: 100%;
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. image {
  386. width: 260rpx;
  387. height: 260rpx;
  388. position: relative;
  389. margin-top: -200rpx;
  390. /* #ifdef h5 */
  391. margin-top: 0;
  392. /* #endif */
  393. }
  394. }
  395. .stores {
  396. width: 100%;
  397. display: flex;
  398. flex-direction: column;
  399. justify-content: flex-start;
  400. margin-bottom: -40rpx;
  401. .store {
  402. width: 100%;
  403. background-color: $bg-color-grey;
  404. padding: 20rpx;
  405. display: flex;
  406. align-items: center;
  407. margin-bottom: 20rpx;
  408. border-radius: 6rpx;
  409. .iconfont {
  410. font-size: 50rpx;
  411. margin-right: 15rpx;
  412. &.iconradio-button-off {
  413. color: $text-color-assist;
  414. }
  415. &.iconradio-button-on {
  416. color: $color-primary;
  417. }
  418. }
  419. .infos {
  420. flex: 1;
  421. display: flex;
  422. flex-direction: column;
  423. color: $text-color-base;
  424. overflow: hidden;
  425. .name_and_distance {
  426. width: 100%;
  427. display: flex;
  428. justify-content: space-between;
  429. margin-bottom: 10rpx;
  430. overflow: hidden;
  431. .name {
  432. flex: 1;
  433. flex-shrink: 0;
  434. overflow: hidden;
  435. text-overflow: ellipsis;
  436. white-space: nowrap;
  437. font-size: $font-size-lg;
  438. }
  439. .distance {
  440. flex-shrink: 0;
  441. font-size: $font-size-lg;
  442. font-weight: bold;
  443. margin-left: 20rpx;
  444. }
  445. }
  446. .street {
  447. color: $text-color-assist;
  448. font-size: $font-size-sm;
  449. }
  450. }
  451. }
  452. }
  453. .main {
  454. overflow: hidden;
  455. width: 100%;
  456. display: flex;
  457. flex-direction: column;
  458. }
  459. .nav {
  460. width: 100%;
  461. flex-shrink: 0;
  462. display: flex;
  463. flex-direction: column;
  464. border-radius: 23rpx;
  465. padding: 19rpx 57rpx 38rpx 58rpx;
  466. background-color: #ffffff;
  467. .header {
  468. width: 100%;
  469. display: flex;
  470. align-items: center;
  471. justify-content: space-between;
  472. .left {
  473. flex: 1;
  474. display: flex;
  475. flex-direction: column;
  476. .store-name {
  477. display: flex;
  478. justify-content: flex-start;
  479. align-items: center;
  480. font-size: $font-size-lg;
  481. margin-bottom: 10rpx;
  482. .iconfont {
  483. margin-left: 10rpx;
  484. line-height: 100%;
  485. }
  486. }
  487. .store-tip {
  488. font-weight: 400;
  489. font-size: 21rpx;
  490. color: #858687;
  491. margin-top: 10rpx;
  492. background: #F8F9FB;
  493. border-radius: 4rpx;
  494. }
  495. }
  496. .right {
  497. background-color: $bg-color-grey;
  498. border-radius: 38rpx;
  499. display: flex;
  500. align-items: center;
  501. font-size: $font-size-sm;
  502. padding: 0 38rpx;
  503. color: $text-color-assist;
  504. .dinein,
  505. .takeout {
  506. position: relative;
  507. display: flex;
  508. align-items: center;
  509. &.active {
  510. padding: 14rpx 38rpx;
  511. color: #ffffff;
  512. background-color: $color-primary;
  513. border-radius: 38rpx;
  514. }
  515. }
  516. .takeout {
  517. margin-left: 20rpx;
  518. height: 100%;
  519. flex: 1;
  520. padding: 14rpx 0;
  521. }
  522. .dinein.active {
  523. margin-left: -38rpx;
  524. }
  525. .takeout.active {
  526. margin-right: -38rpx;
  527. }
  528. }
  529. }
  530. .coupon {
  531. flex: 1;
  532. width: 100%;
  533. background-color: $bg-color-primary;
  534. font-size: $font-size-base;
  535. color: $color-primary;
  536. padding: 0 20rpx;
  537. display: flex;
  538. align-items: center;
  539. overflow: hidden;
  540. .title {
  541. flex: 1;
  542. margin-left: 10rpx;
  543. overflow: hidden;
  544. white-space: nowrap;
  545. text-overflow: ellipsis;
  546. }
  547. .iconfont {
  548. line-height: 100%;
  549. }
  550. }
  551. }
  552. .content {
  553. flex: 1;
  554. overflow: hidden;
  555. width: 100%;
  556. display: flex;
  557. border-radius: 23rpx 23rpx 0rpx 0rpx;
  558. .menus {
  559. width: 200rpx;
  560. height: 100%;
  561. overflow: hidden;
  562. background-color: $bg-color-grey;
  563. .wrapper {
  564. width: 100%;
  565. height: 100%;
  566. .menu {
  567. display: flex;
  568. align-items: center;
  569. justify-content: flex-start;
  570. padding: 30rpx 20rpx;
  571. font-size: 26rpx;
  572. color: $text-color-assist;
  573. position: relative;
  574. display: flex;
  575. align-items: center;
  576. justify-content: center;
  577. &:nth-last-child(1) {
  578. margin-bottom: 230rpx;
  579. }
  580. &.current {
  581. background-color: #ffffff;
  582. color: $text-color-base;
  583. }
  584. .dot {
  585. position: absolute;
  586. width: 34rpx;
  587. height: 34rpx;
  588. line-height: 34rpx;
  589. font-size: 22rpx;
  590. background-color: $bg-color-primary;
  591. color: #ffffff;
  592. top: 16rpx;
  593. right: 10rpx;
  594. border-radius: 100%;
  595. text-align: center;
  596. }
  597. }
  598. }
  599. }
  600. .goods {
  601. flex: 1;
  602. height: 100%;
  603. overflow: hidden;
  604. background-color: #ffffff;
  605. .wrapper {
  606. width: 100%;
  607. height: 100%;
  608. padding: 20rpx;
  609. .ads {
  610. height: calc(300 / 550 * 510rpx);
  611. image {
  612. width: 100%;
  613. height: 100%;
  614. border-radius: 8rpx;
  615. }
  616. }
  617. .list {
  618. width: 100%;
  619. font-size: $font-size-base;
  620. padding-bottom: 800rpx;
  621. .category {
  622. width: 100%;
  623. .title {
  624. padding: 30rpx 0;
  625. display: flex;
  626. align-items: center;
  627. color: $text-color-base;
  628. .icon {
  629. width: 38rpx;
  630. height: 38rpx;
  631. margin-left: 10rpx;
  632. }
  633. }
  634. }
  635. .items {
  636. display: flex;
  637. flex-direction: column;
  638. padding-bottom: -30rpx;
  639. .good {
  640. display: flex;
  641. align-items: center;
  642. margin-bottom: 30rpx;
  643. .image {
  644. width: 160rpx;
  645. height: 160rpx;
  646. margin-right: 20rpx;
  647. border-radius: 8rpx;
  648. }
  649. .right {
  650. flex: 1;
  651. // height: 160rpx;
  652. overflow: hidden;
  653. display: flex;
  654. flex-direction: column;
  655. align-items: flex-start;
  656. justify-content: space-between;
  657. padding-right: 14rpx;
  658. .name {
  659. font-size: $font-size-base;
  660. margin-bottom: 10rpx;
  661. }
  662. .tips {
  663. width: 100%;
  664. height: 40rpx;
  665. line-height: 40rpx;
  666. overflow: hidden;
  667. text-overflow: ellipsis;
  668. white-space: nowrap;
  669. font-size: $font-size-sm;
  670. color: $text-color-assist;
  671. margin-bottom: 10rpx;
  672. }
  673. .price_and_action {
  674. width: 100%;
  675. display: flex;
  676. justify-content: space-between;
  677. align-items: center;
  678. .price {
  679. font-size: $font-size-base;
  680. font-weight: 600;
  681. color: $bg-color-primary;
  682. }
  683. .btn-group {
  684. display: flex;
  685. justify-content: space-between;
  686. align-items: center;
  687. position: relative;
  688. .btn {
  689. padding: 0 20rpx;
  690. box-sizing: border-box;
  691. font-size: $font-size-sm;
  692. height: 44rpx;
  693. line-height: 44rpx;
  694. &.property_btn {
  695. border-radius: 24rpx;
  696. }
  697. &.add_btn,
  698. &.reduce_btn {
  699. padding: 0;
  700. width: 44rpx;
  701. border-radius: 44rpx;
  702. }
  703. }
  704. .dot {
  705. position: absolute;
  706. background-color: #ffffff;
  707. border: 1px solid $bg-color-primary;
  708. color: $bg-color-primary;
  709. font-size: $font-size-sm;
  710. width: 36rpx;
  711. height: 36rpx;
  712. line-height: 36rpx;
  713. text-align: center;
  714. border-radius: 100%;
  715. right: -12rpx;
  716. top: -10rpx;
  717. }
  718. .number {
  719. width: 44rpx;
  720. height: 44rpx;
  721. line-height: 44rpx;
  722. text-align: center;
  723. }
  724. }
  725. }
  726. }
  727. }
  728. }
  729. }
  730. }
  731. }
  732. }
  733. .modal-box {
  734. max-height: 90vh;
  735. }
  736. .good-detail-modal {
  737. width: 100%;
  738. height: 100%;
  739. display: flex;
  740. flex-direction: column;
  741. .cover {
  742. height: 320rpx;
  743. padding: 30rpx 0;
  744. display: flex;
  745. justify-content: center;
  746. align-items: center;
  747. position: relative;
  748. .image {
  749. width: 260rpx;
  750. height: 260rpx;
  751. }
  752. .btn-group {
  753. position: absolute;
  754. right: 10rpx;
  755. top: 30rpx;
  756. display: flex;
  757. align-items: center;
  758. justify-content: space-around;
  759. image {
  760. width: 80rpx;
  761. height: 80rpx;
  762. }
  763. }
  764. }
  765. .detail {
  766. width: 100%;
  767. min-height: 1vh;
  768. max-height: calc(90vh - 320rpx - 80rpx - 120rpx);
  769. .wrapper {
  770. width: 100%;
  771. height: 100%;
  772. overflow: hidden;
  773. .basic {
  774. padding: 0 20rpx 30rpx;
  775. display: flex;
  776. flex-direction: column;
  777. .name {
  778. font-size: $font-size-base;
  779. color: $text-color-base;
  780. margin-bottom: 10rpx;
  781. }
  782. .tips {
  783. font-size: $font-size-sm;
  784. color: $text-color-grey;
  785. }
  786. }
  787. .properties {
  788. width: 100%;
  789. border-top: 2rpx solid $bg-color-grey;
  790. padding: 10rpx 30rpx 0;
  791. display: flex;
  792. flex-direction: column;
  793. .property {
  794. width: 100%;
  795. display: flex;
  796. flex-direction: column;
  797. margin-bottom: 30rpx;
  798. padding-bottom: -16rpx;
  799. .title {
  800. width: 100%;
  801. display: flex;
  802. justify-content: flex-start;
  803. align-items: center;
  804. margin-bottom: 20rpx;
  805. .name {
  806. font-size: 26rpx;
  807. color: $text-color-base;
  808. margin-right: 20rpx;
  809. }
  810. .desc {
  811. flex: 1;
  812. font-size: $font-size-sm;
  813. color: $color-primary;
  814. overflow: hidden;
  815. text-overflow: ellipsis;
  816. white-space: nowrap;
  817. }
  818. }
  819. .values {
  820. width: 100%;
  821. display: flex;
  822. flex-wrap: wrap;
  823. .value {
  824. border-radius: 8rpx;
  825. background-color: $bg-color-grey;
  826. padding: 16rpx 30rpx;
  827. font-size: 26rpx;
  828. color: $text-color-assist;
  829. margin-right: 16rpx;
  830. margin-bottom: 16rpx;
  831. &.default {
  832. background-color: $bg-color-primary;
  833. color: $text-color-white;
  834. }
  835. }
  836. }
  837. }
  838. }
  839. }
  840. }
  841. .action {
  842. display: flex;
  843. align-items: center;
  844. justify-content: space-between;
  845. background-color: $bg-color-grey;
  846. height: 120rpx;
  847. padding: 0 26rpx;
  848. .left {
  849. flex: 1;
  850. display: flex;
  851. flex-direction: column;
  852. justify-content: center;
  853. margin-right: 20rpx;
  854. overflow: hidden;
  855. .price {
  856. font-size: $font-size-lg;
  857. color: $text-color-base;
  858. }
  859. .props {
  860. color: $text-color-assist;
  861. font-size: 24rpx;
  862. width: 100%;
  863. overflow: hidden;
  864. text-overflow: ellipsis;
  865. white-space: nowrap;
  866. }
  867. }
  868. .btn-group {
  869. display: flex;
  870. align-items: center;
  871. justify-content: space-around;
  872. .number {
  873. font-size: $font-size-base;
  874. width: 44rpx;
  875. height: 44rpx;
  876. line-height: 44rpx;
  877. text-align: center;
  878. }
  879. .btn {
  880. padding: 0;
  881. font-size: $font-size-base;
  882. width: 44rpx;
  883. height: 44rpx;
  884. line-height: 44rpx;
  885. border-radius: 100%;
  886. }
  887. }
  888. }
  889. .add-to-cart-btn {
  890. display: flex;
  891. justify-content: center;
  892. align-items: center;
  893. background-color: $color-primary;
  894. color: $text-color-white;
  895. font-size: $font-size-base;
  896. height: 80rpx;
  897. border-radius: 0 0 12rpx 12rpx;
  898. }
  899. }
  900. .cart-box {
  901. // position: absolute;
  902. // bottom: 30rpx;
  903. // left: 30rpx;
  904. // right: 30rpx;
  905. height: 96rpx;
  906. border-radius: 48rpx;
  907. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  908. background-color: #000;
  909. display: flex;
  910. align-items: center;
  911. justify-content: space-between;
  912. z-index: 9999;
  913. .cart-img {
  914. width: 50rpx;
  915. height: 47rpx;
  916. position: relative;
  917. // margin-top: -48rpx;
  918. }
  919. .pay-btn {
  920. height: 100%;
  921. padding: 0 30rpx;
  922. color: #FFFFFF;
  923. border-radius: 0 50rpx 50rpx 0;
  924. display: flex;
  925. align-items: center;
  926. font-size: $font-size-base;
  927. }
  928. .mark {
  929. padding-left: 46rpx;
  930. margin-right: 30rpx;
  931. position: relative;
  932. .tag {
  933. background-color: $color-warning;
  934. color: $text-color-white;
  935. display: flex;
  936. justify-content: center;
  937. align-items: center;
  938. font-size: $font-size-sm;
  939. position: absolute;
  940. right: -13rpx;
  941. top: -20rpx;
  942. border-radius: 100%;
  943. padding: 4rpx;
  944. width: 27rpx;
  945. height: 27rpx;
  946. opacity: .9;
  947. }
  948. }
  949. .price {
  950. flex: 1;
  951. color: $text-color-base;
  952. }
  953. }
  954. .cart-popup {
  955. .top {
  956. background-color: $bg-color-primary;
  957. color: $color-primary;
  958. padding: 10rpx 30rpx;
  959. font-size: 24rpx;
  960. text-align: right;
  961. }
  962. .cart-list {
  963. background-color: #FFFFFF;
  964. width: 100%;
  965. overflow: hidden;
  966. min-height: 1vh;
  967. max-height: 60vh;
  968. .wrapper {
  969. height: 100%;
  970. display: flex;
  971. flex-direction: column;
  972. padding: 0 30rpx;
  973. margin-bottom: 156rpx;
  974. .item {
  975. display: flex;
  976. justify-content: space-between;
  977. align-items: center;
  978. padding: 30rpx 0;
  979. position: relative;
  980. &::after {
  981. content: ' ';
  982. position: absolute;
  983. bottom: 0;
  984. left: 0;
  985. width: 100%;
  986. background-color: $border-color;
  987. height: 2rpx;
  988. transform: scaleY(.6);
  989. }
  990. .left {
  991. flex: 1;
  992. display: flex;
  993. flex-direction: column;
  994. overflow: hidden;
  995. margin-right: 30rpx;
  996. .name {
  997. font-size: $font-size-sm;
  998. color: $text-color-base;
  999. }
  1000. .props {
  1001. color: $text-color-assist;
  1002. font-size: 24rpx;
  1003. overflow: hidden;
  1004. text-overflow: ellipsis;
  1005. white-space: nowrap;
  1006. }
  1007. }
  1008. .center {
  1009. margin-right: 120rpx;
  1010. font-size: $font-size-base;
  1011. }
  1012. .right {
  1013. display: flex;
  1014. align-items: center;
  1015. justify-content: space-between;
  1016. .btn {
  1017. width: 46rpx;
  1018. height: 46rpx;
  1019. border-radius: 100%;
  1020. padding: 0;
  1021. text-align: center;
  1022. line-height: 46rpx;
  1023. }
  1024. .number {
  1025. font-size: $font-size-base;
  1026. width: 46rpx;
  1027. height: 46rpx;
  1028. text-align: center;
  1029. line-height: 46rpx;
  1030. }
  1031. }
  1032. }
  1033. }
  1034. }
  1035. }
  1036. .back-button {
  1037. width: 30rpx;
  1038. height: 30rpx;
  1039. border-right: 4rpx solid #fff;
  1040. border-bottom: 4rpx solid #fff;
  1041. transform: rotate(135deg);
  1042. margin-left: 10rpx;
  1043. display: inline-block;
  1044. position: relative;
  1045. }
  1046. .newsTitle {
  1047. display: flex;
  1048. align-items: center;
  1049. }
  1050. .mode {
  1051. position: fixed;
  1052. width: 100%;
  1053. height: 100%;
  1054. left: 0;
  1055. top: 0;
  1056. background: rgba(33, 33, 33, 0.8);
  1057. z-index: 99999;
  1058. display: flex;
  1059. align-items: flex-end;
  1060. }
  1061. .mode-1 {
  1062. width: 100%;
  1063. height: 840rpx;
  1064. background: #FFF;
  1065. display: flex;
  1066. flex-direction: column;
  1067. gap: 20rpx;
  1068. // padding: 30rpx;
  1069. box-sizing: border-box;
  1070. overflow: auto;
  1071. /* 添加这个属性使容器可以滚动 */
  1072. }
  1073. // 规格弹窗
  1074. .sel-mode-1 {
  1075. width: 100%;
  1076. // height: 440rpx;
  1077. background: #FFF;
  1078. display: flex;
  1079. flex-direction: column;
  1080. gap: 20rpx;
  1081. box-sizing: border-box;
  1082. overflow: auto;
  1083. z-index: 99999;
  1084. padding: 20rpx 20rpx 60rpx 20rpx;
  1085. box-sizing: border-box;
  1086. position: relative;
  1087. }
  1088. .close {
  1089. text-align: right;
  1090. font-size: 40rpx;
  1091. }
  1092. .sel-2 {
  1093. display: flex;
  1094. align-items: center;
  1095. gap: 20rpx;
  1096. .nexbox1 {
  1097. flex: 1;
  1098. text-overflow: ellipsis;
  1099. white-space: nowrap;
  1100. color: $text-color-assist;
  1101. }
  1102. }
  1103. .sel-3 {
  1104. display: flex;
  1105. flex-direction: column;
  1106. gap: 10rpx;
  1107. }
  1108. .sel-4 {
  1109. display: flex;
  1110. align-items: center;
  1111. gap: 10rpx;
  1112. }
  1113. .sel-5 {
  1114. width: 80rpx;
  1115. height: 40rpx;
  1116. box-sizing: border-box;
  1117. display: flex;
  1118. align-items: center;
  1119. justify-content: center;
  1120. font-size: 24rpx;
  1121. background: #999999;
  1122. color: #FFF;
  1123. padding: 8rpx;
  1124. border-radius: 8rpx;
  1125. }
  1126. .sel-6 {
  1127. display: flex;
  1128. align-items: center;
  1129. justify-content: space-between;
  1130. }
  1131. .sel-btn {
  1132. display: flex;
  1133. align-items: center;
  1134. justify-content: flex-end;
  1135. }
  1136. .sel-btn1 {
  1137. width: 110px;
  1138. height: 60rpx;
  1139. display: flex;
  1140. align-items: center;
  1141. justify-content: center;
  1142. background: rgba(255, 103, 2, 1);
  1143. color: #FFF;
  1144. font-size: 30rpx;
  1145. border-radius: 10rpx;
  1146. }
  1147. .neximg {
  1148. width: 160rpx;
  1149. height: 160rpx;
  1150. margin-right: 20rpx;
  1151. border-radius: 8rpx;
  1152. /* 保持图片等比例缩放,并且不会裁切 */
  1153. }
  1154. .btn-group {
  1155. display: flex;
  1156. justify-content: space-between;
  1157. align-items: center;
  1158. position: relative;
  1159. .btn {
  1160. padding: 0 20rpx;
  1161. box-sizing: border-box;
  1162. font-size: $font-size-sm;
  1163. height: 44rpx;
  1164. line-height: 44rpx;
  1165. &.property_btn {
  1166. border-radius: 24rpx;
  1167. }
  1168. &.add_btn,
  1169. &.reduce_btn {
  1170. padding: 0;
  1171. width: 44rpx;
  1172. border-radius: 44rpx;
  1173. }
  1174. }
  1175. .dot {
  1176. position: absolute;
  1177. background-color: #ffffff;
  1178. border: 1px solid $bg-color-primary;
  1179. color: $bg-color-primary;
  1180. font-size: $font-size-sm;
  1181. width: 36rpx;
  1182. height: 36rpx;
  1183. line-height: 36rpx;
  1184. text-align: center;
  1185. border-radius: 100%;
  1186. right: -12rpx;
  1187. top: -10rpx;
  1188. }
  1189. .number {
  1190. width: 44rpx;
  1191. height: 44rpx;
  1192. line-height: 44rpx;
  1193. text-align: center;
  1194. }
  1195. }
  1196. .nexbox-txt3 {
  1197. color: $bg-color-primary;
  1198. }
  1199. .mode-box {
  1200. width: 100%;
  1201. display: flex;
  1202. flex-direction: column;
  1203. gap: 20rpx;
  1204. padding: 30rpx;
  1205. box-sizing: border-box;
  1206. }
  1207. .items {
  1208. display: flex;
  1209. flex-direction: column;
  1210. padding-bottom: -30rpx;
  1211. .good {
  1212. display: flex;
  1213. align-items: center;
  1214. margin-bottom: 30rpx;
  1215. .image {
  1216. width: 160rpx;
  1217. height: 160rpx;
  1218. margin-right: 20rpx;
  1219. border-radius: 8rpx;
  1220. }
  1221. .right {
  1222. flex: 1;
  1223. // height: 160rpx;
  1224. overflow: hidden;
  1225. display: flex;
  1226. flex-direction: column;
  1227. align-items: flex-start;
  1228. justify-content: space-between;
  1229. padding-right: 14rpx;
  1230. .name {
  1231. font-size: $font-size-base;
  1232. margin-bottom: 10rpx;
  1233. }
  1234. .tips {
  1235. width: 100%;
  1236. height: 40rpx;
  1237. line-height: 40rpx;
  1238. overflow: hidden;
  1239. text-overflow: ellipsis;
  1240. white-space: nowrap;
  1241. font-size: $font-size-sm;
  1242. color: $text-color-assist;
  1243. margin-bottom: 10rpx;
  1244. }
  1245. .price_and_action {
  1246. width: 100%;
  1247. display: flex;
  1248. justify-content: space-between;
  1249. align-items: center;
  1250. .price {
  1251. font-size: $font-size-base;
  1252. font-weight: 600;
  1253. color: $bg-color-primary;
  1254. }
  1255. .btn-group {
  1256. display: flex;
  1257. justify-content: space-between;
  1258. align-items: center;
  1259. position: relative;
  1260. .btn {
  1261. padding: 0 20rpx;
  1262. box-sizing: border-box;
  1263. font-size: $font-size-sm;
  1264. height: 44rpx;
  1265. line-height: 44rpx;
  1266. &.property_btn {
  1267. border-radius: 24rpx;
  1268. }
  1269. &.add_btn,
  1270. &.reduce_btn {
  1271. padding: 0;
  1272. width: 44rpx;
  1273. border-radius: 44rpx;
  1274. }
  1275. }
  1276. .dot {
  1277. position: absolute;
  1278. background-color: #ffffff;
  1279. border: 1px solid $bg-color-primary;
  1280. color: $bg-color-primary;
  1281. font-size: $font-size-sm;
  1282. width: 36rpx;
  1283. height: 36rpx;
  1284. line-height: 36rpx;
  1285. text-align: center;
  1286. border-radius: 100%;
  1287. right: -12rpx;
  1288. top: -10rpx;
  1289. }
  1290. .number {
  1291. width: 44rpx;
  1292. height: 44rpx;
  1293. line-height: 44rpx;
  1294. text-align: center;
  1295. }
  1296. }
  1297. }
  1298. }
  1299. }
  1300. }
  1301. .mode-clear {
  1302. padding: 30rpx;
  1303. box-sizing: border-box;
  1304. position: sticky;
  1305. z-index: 99;
  1306. top: 0;
  1307. display: flex;
  1308. justify-content: space-between;
  1309. align-items: center;
  1310. background: #FFF;
  1311. border-bottom: 1px solid burlywood;
  1312. }
  1313. .mode-txt {
  1314. display: flex;
  1315. align-items: center;
  1316. gap: 8rpx;
  1317. }
  1318. .mode-txt1 {
  1319. font-weight: 500;
  1320. font-size: 32rpx;
  1321. }
  1322. </style>