index.vue 41 KB

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