index.vue 49 KB

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