index.vue 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067
  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="openCart"></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="clearCart" 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" plain class="btn reduce_btn" size="mini"
  163. hover-class="none" @tap="handleReduceFromCart(good.category, good)">
  164. <view class="iconfont iconsami-select">-</view>
  165. </button>
  166. <view class="number" >{{ good.number }}</view>
  167. <button type="primary" class="btn add_btn bg-color" size="min" hover-class="none" @tap="handleAddToCart(good.category, 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. clearCart(){
  446. this.cart = []
  447. this.lockcatble = false
  448. },
  449. openCart(){
  450. console.log(this.cart,'this.cart')
  451. this.cart.length !== 0 ? this.lockcatble = !this.lockcatble : ''
  452. },
  453. getFormattedSales(value) {
  454. // 转换成字符串,然后截取前三位,并添加“+”
  455. return value.length>3?`${String(value).slice(0, 3)}+`:value;
  456. },
  457. getMerchantInfoData() {
  458. getMerchantInfo(this.merId).then(res => {
  459. this.merchanInfo = res.data
  460. this.$store.commit('MERCHANTJINFO', res.data);
  461. });
  462. },
  463. // 跳转详情
  464. getOrderdetils(item, val) {
  465. this.orderdetilsOjb = {
  466. good: item,
  467. category: val
  468. }
  469. console.log(this.orderdetilsOjb)
  470. uni.navigateTo({
  471. url: `/pages/goods/goods_details/index?id=${item.id}&mt=0&cart=${JSON.stringify(this.cart)}`
  472. })
  473. },
  474. // 设置是否关注
  475. followToggle: function() {
  476. if (this.isLogin === false) {
  477. toLogin();
  478. } else {
  479. if (this.merchanInfo.isCollect) {
  480. getMerCollectCancelApi(this.merId).then(res => {
  481. console.log()
  482. if (res.code == 200) {
  483. this.$util.Tips({
  484. title: "取消收藏",
  485. });
  486. this.getMerchantInfoData() //商家信息
  487. }
  488. })
  489. } else {
  490. getMerCollectAddApi(this.merId).then(res => {
  491. console.log('收藏', res)
  492. if (res.code == 200) {
  493. this.$util.Tips({
  494. title: "收藏成功",
  495. });
  496. this.getMerchantInfoData() //商家信息
  497. }
  498. })
  499. }
  500. }
  501. },
  502. // 获取地址数据
  503. getAddressList() {
  504. getAddressList().then(res => {
  505. console.log('地址', res)
  506. if (res.code = 200) {
  507. this.addressInfo = res.data.find(item => item.isDefault === true);
  508. console.log('默认地址', this.addressInfo)
  509. }
  510. })
  511. },
  512. handBack() {
  513. uni.navigateBack({
  514. delta: 1
  515. })
  516. },
  517. handleMenuTap(id) { //点击菜单项事件
  518. this.menuScrollIntoView = `cate-${id}`
  519. if (!this.sizeCalcState) {
  520. this.calcSize()
  521. }
  522. this.$nextTick(() => this.cateScrollTop = this.goods.find(item => item.id == id).top)
  523. },
  524. handleGoodsScroll({
  525. detail
  526. }) { //商品列表滚动事件
  527. if (!this.sizeCalcState) {
  528. this.calcSize()
  529. }
  530. const {
  531. scrollTop
  532. } = detail
  533. let tabs = this.goods.filter(item => item.top <= scrollTop).reverse()
  534. if (tabs.length > 0) {
  535. this.currentCateId = tabs[0].id
  536. }
  537. },
  538. calcSize() {
  539. let h = 10
  540. this.goods.forEach(item => {
  541. let view = uni.createSelectorQuery().select(`#cate-${item.id}`)
  542. view.fields({
  543. size: true
  544. }, data => {
  545. // if (data.goodsList) {
  546. item.top = h
  547. h += data.height
  548. item.bottom = h
  549. // }
  550. }).exec()
  551. })
  552. this.sizeCalcState = true
  553. },
  554. showGoodDetailModal(item, good) {
  555. this.good = JSON.parse(JSON.stringify({ ...good
  556. }))
  557. this.category = JSON.parse(JSON.stringify(item))
  558. this.goodDetailModalVisible = true
  559. },
  560. handlePropertyAdd() {
  561. this.good.number += 1
  562. },
  563. handlePropertyReduce() {
  564. if (this.good.number === 1) return
  565. this.good.number -= 1
  566. },
  567. changePropertyDefault(index, key) { //改变默认属性值
  568. this.good.property[index].optionList.forEach(value => this.$set(value, 'is_default', 0))
  569. this.good.property[index].optionList[key].is_default = 1
  570. this.good.number = 1
  571. this.good = JSON.parse(JSON.stringify(this.good))
  572. },
  573. handleAddToCartInModal() {
  574. const product = Object.assign({}, this.good, {
  575. props_text: this.getGoodSelectedProps(this.good),
  576. props: this.getGoodSelectedProps(this.good, 'id')
  577. })
  578. this.handleAddToCart(this.category, product, this.good.number)
  579. // this.closeGoodDetailModal()
  580. },
  581. getGoodSelectedProps(good, type = 'text') { //计算当前饮品所选属性
  582. // if (good.use_property) {
  583. let props = []
  584. good.property.forEach(({
  585. optionList
  586. }) => {
  587. optionList.forEach(value => {
  588. if (value.is_default) {
  589. props.push(type === 'text' ? value.optionName : value.id)
  590. }
  591. })
  592. })
  593. return type === 'text' ? props.join(',') : props
  594. // }
  595. // return ''
  596. },
  597. handleReduceFromCart(item, good) {
  598. const goodText = this.getGoodSelectedProps(this.good?.id ? this.good : good) // 购物车当前选中的规格
  599. const index = this.cart.findIndex(item => item.id === good.id && item.props_text === goodText)
  600. this.cart[index].number -= 1
  601. if (this.cart[index].number <= 0) {
  602. this.cart.splice(index, 1)
  603. }
  604. },
  605. handleAddToCart(cate, good, num) { //添加到购物车
  606. const goodText = this.getGoodSelectedProps(this.good?.id ? this.good : good) // 购物车当前选中的规格
  607. const index = this.cart.findIndex(item => {
  608. // if (good.use_property) {
  609. // !good.props_text ? good.props_text = this.getGoodSelectedProps(good) : ''
  610. return (item.id === good.id) && (item.props_text === goodText)
  611. // } else {
  612. // return item.id === good.id
  613. // }
  614. })
  615. if (index > -1) {
  616. this.cart[index].number += num
  617. } else {
  618. this.cart.push({
  619. id: good.id,
  620. cate_id: cate.id,
  621. name: good.name,
  622. price: good.price,
  623. number: num,
  624. icon: good.icon,
  625. use_property: good.use_property || goodText,
  626. props_text: this.getGoodSelectedProps(this.good?.id ? this.good : good),
  627. props: this.getGoodSelectedProps(this.good?.id ? this.good : good, 'id'),
  628. productid: this.productObj[goodText].id,
  629. iconText: this.productObj[goodText].image,
  630. ...good
  631. })
  632. }
  633. // let q = {
  634. // productId: parseFloat(good.id),
  635. // cartNum: parseFloat(index > -1 ? num+this.cart[index].number : num),
  636. // isNew: false,
  637. // productAttrUnique: this.productObj[goodText].id,
  638. // };
  639. // let that = this
  640. // postCartAdd(q)
  641. // .then(function(res) {
  642. // that.$util.Tips({
  643. // title: "添加购物车成功",
  644. // success: () => {
  645. // },
  646. // });
  647. // })
  648. // console.log(this.cart, '购物车')
  649. },
  650. toPay() {
  651. // if(!this.isLogin) {
  652. // uni.navigateTo({url: '/pages/login/login'})
  653. // return
  654. // }
  655. uni.showLoading({
  656. title: '加载中'
  657. })
  658. let orderDetails = this.cart.map((item) => {
  659. return {
  660. attrValueId: item.productid, //商品规格属性id(立即购买、活动购买必填)
  661. groupBuyActivityId: null, //拼团活动id(拼团下单时必填)
  662. groupBuyRecordId: 0, // 拼团记录id,营销类型2=拼团 时必填 0=开团 实际
  663. productId: item.id, //商品id
  664. productNum: item.number //商品数量
  665. };
  666. });
  667. preOrderApi({
  668. "preOrderType": 'buyNow',
  669. //类型 预下单类型(“shoppingCart”:购物车下单,“buyNow”:
  670. // 立即购买,“video”: 视频号商品下单,“seckill”:秒杀下单,“group”:拼团下单)
  671. "orderDetails": orderDetails //购物车信息
  672. }).then(res => {
  673. console.log('预下单接口', res)
  674. if (res.code == 200) {
  675. // uni.setStorageSync('cart', JSON.parse(JSON.stringify(this.cart)))
  676. uni.navigateTo({
  677. // url: `/pages/goods/order_confirm/index?cartList=${cartList}`
  678. url: '/pages/goods/order_confirm/index?is_address=1&orderNo=' + res.data.orderNo +
  679. '&addressId=' + this.addressInfo.id
  680. })
  681. }
  682. }).catch(err => {
  683. uni.showToast({
  684. title: err,
  685. icon: 'none'
  686. })
  687. })
  688. uni.setStorageSync('cart', JSON.parse(JSON.stringify(this.cart)))
  689. uni.hideLoading()
  690. },
  691. // 选规格打开
  692. Selectpox(item, itemInfo) {
  693. this.specifications = itemInfo //这一项信息
  694. this.specificationsList = item //这一项信息
  695. this.good = {...itemInfo}
  696. this.good.category = item
  697. let that = this
  698. getProductDetail(
  699. itemInfo.id,
  700. 0, 0, ''
  701. ).then((res) => {
  702. console.log('规格', res)
  703. if (res.code == 200) {
  704. that.good.property = res.data.productAttr.map(item => {
  705. item.optionList.forEach((items, index) => {
  706. index === 0 ? items.is_default = true : '' // 规格默认选中
  707. })
  708. return { ...item
  709. }
  710. })
  711. console.log(that.good)
  712. // this.productValue = res.data.productAttr //规格数组
  713. that.productObj = res.data.productValue //默认选择的id
  714. that.selectble = true
  715. }
  716. })
  717. },
  718. // 关闭规格
  719. Close() {
  720. this.specifications = '' //这一项信息
  721. this.specificationsList = [] //这一项信息
  722. this.good = {}
  723. this.selectble = false
  724. },
  725. onTabChang(id) {
  726. if (this.tabindex === id) return
  727. this.tabindex = id
  728. if (id == 1) {
  729. this.getProductReplyList()
  730. this.getProductReplyCount()
  731. }
  732. },
  733. /**
  734. * 分页获取评论
  735. */
  736. getProductReplyList: function() {
  737. let that = this;
  738. if (that.loadend) return;
  739. if (that.loading) return;
  740. that.loading = true;
  741. that.loadTitle = '';
  742. getMerchantReply(that.merId, {
  743. page: that.page,
  744. limit: that.limit,
  745. type: that.type,
  746. }).then(res => {
  747. let list = res.data.list,
  748. loadend = list.length < that.limit;
  749. that.reply = that.$util.SplitArray(list, that.reply);
  750. that.$set(that, 'reply', that.reply);
  751. that.loading = false;
  752. that.loadend = loadend;
  753. if (that.reply.length) {
  754. that.loadTitle = loadend ? "??人家是有底线的~~" : "加载更多";
  755. }
  756. that.page = that.page + 1;
  757. }).catch(err => {
  758. that.loading = false,
  759. that.loadTitle = '加载更多'
  760. });
  761. },
  762. /*
  763. * 点击事件切换
  764. * */
  765. changeType: function(e) {
  766. let type = parseInt(e);
  767. if (type == this.type) return;
  768. this.type = type;
  769. this.page = 1;
  770. this.loadend = false;
  771. this.$set(this, 'reply', []);
  772. this.getProductReplyList();
  773. },
  774. /**
  775. * 获取评论统计数据
  776. *
  777. */
  778. getProductReplyCount: function() {
  779. let that = this;
  780. getMerchantReplyConfig(that.merId).then(res => {
  781. that.$set(that, 'replyData', res.data);
  782. });
  783. },
  784. }
  785. }
  786. </script>
  787. <style lang="scss" scoped>
  788. /* #ifdef H5 */
  789. page {
  790. min-height: 100%;
  791. }
  792. /* #endif */
  793. .bg-color {
  794. background-color: $bg-color-primary;
  795. }
  796. .care {
  797. color: #666666 !important;
  798. border: 1px solid #CCCCCC;
  799. background: inherit !important;
  800. }
  801. .order-nav {
  802. // height: 111rpx;
  803. position: relative;
  804. background-color: #FF6702;
  805. display: flex;
  806. align-items: center;
  807. justify-content: center;
  808. .back-button {
  809. position: absolute;
  810. left: 20rpx;
  811. }
  812. text {
  813. font-weight: 500;
  814. font-size: 35rpx;
  815. color: #FFFFFF;
  816. }
  817. }
  818. .container {
  819. display: flex;
  820. flex-direction: column;
  821. overflow: hidden;
  822. position: relative;
  823. }
  824. .loading {
  825. width: 100%;
  826. height: 100%;
  827. display: flex;
  828. align-items: center;
  829. justify-content: center;
  830. image {
  831. width: 260rpx;
  832. height: 260rpx;
  833. position: relative;
  834. margin-top: -200rpx;
  835. /* #ifdef h5 */
  836. margin-top: 0;
  837. /* #endif */
  838. }
  839. }
  840. .stores {
  841. width: 100%;
  842. display: flex;
  843. flex-direction: column;
  844. justify-content: flex-start;
  845. margin-bottom: -40rpx;
  846. .store {
  847. width: 100%;
  848. background-color: $bg-color-grey;
  849. padding: 20rpx;
  850. display: flex;
  851. align-items: center;
  852. margin-bottom: 20rpx;
  853. border-radius: 6rpx;
  854. .iconfont {
  855. font-size: 50rpx;
  856. margin-right: 15rpx;
  857. &.iconradio-button-off {
  858. color: $text-color-assist;
  859. }
  860. &.iconradio-button-on {
  861. color: $color-primary;
  862. }
  863. }
  864. .infos {
  865. flex: 1;
  866. display: flex;
  867. flex-direction: column;
  868. color: $text-color-base;
  869. overflow: hidden;
  870. .name_and_distance {
  871. width: 100%;
  872. display: flex;
  873. justify-content: space-between;
  874. margin-bottom: 10rpx;
  875. overflow: hidden;
  876. .name {
  877. flex: 1;
  878. flex-shrink: 0;
  879. overflow: hidden;
  880. text-overflow: ellipsis;
  881. white-space: nowrap;
  882. font-size: $font-size-lg;
  883. }
  884. .distance {
  885. flex-shrink: 0;
  886. font-size: $font-size-lg;
  887. font-weight: bold;
  888. margin-left: 20rpx;
  889. }
  890. }
  891. .street {
  892. color: $text-color-assist;
  893. font-size: $font-size-sm;
  894. }
  895. }
  896. }
  897. }
  898. .main {
  899. overflow: hidden;
  900. width: 100%;
  901. display: flex;
  902. flex-direction: column;
  903. }
  904. .nav {
  905. width: 100%;
  906. flex-shrink: 0;
  907. display: flex;
  908. flex-direction: column;
  909. border-radius: 23rpx;
  910. padding: 19rpx 45rpx 38rpx 45rpx;
  911. background-color: #ffffff;
  912. .header {
  913. width: 100%;
  914. display: flex;
  915. align-items: center;
  916. justify-content: space-between;
  917. .left {
  918. flex: 1;
  919. display: flex;
  920. flex-direction: column;
  921. .store-name {
  922. display: flex;
  923. justify-content: space-between;
  924. align-items: center;
  925. font-size: $font-size-lg;
  926. margin-bottom: 10rpx;
  927. .iconfont {
  928. margin-left: 10rpx;
  929. line-height: 100%;
  930. }
  931. .icon-img {
  932. width: 40rpx;
  933. height: 40rpx;
  934. flex-shrink: 0;
  935. }
  936. }
  937. .store-tip {
  938. font-weight: 400;
  939. font-size: 21rpx;
  940. color: #858687;
  941. margin-top: 10rpx;
  942. background: #F8F9FB;
  943. border-radius: 4rpx;
  944. }
  945. }
  946. .right {
  947. background-color: $bg-color-grey;
  948. border-radius: 38rpx;
  949. display: flex;
  950. align-items: center;
  951. font-size: $font-size-sm;
  952. padding: 0 38rpx;
  953. color: $text-color-assist;
  954. .dinein,
  955. .takeout {
  956. position: relative;
  957. display: flex;
  958. align-items: center;
  959. &.active {
  960. padding: 14rpx 38rpx;
  961. color: #ffffff;
  962. background-color: $color-primary;
  963. border-radius: 38rpx;
  964. }
  965. }
  966. .takeout {
  967. margin-left: 20rpx;
  968. height: 100%;
  969. flex: 1;
  970. padding: 14rpx 0;
  971. }
  972. .dinein.active {
  973. margin-left: -38rpx;
  974. }
  975. .takeout.active {
  976. margin-right: -38rpx;
  977. }
  978. }
  979. }
  980. .coupon {
  981. flex: 1;
  982. width: 100%;
  983. background-color: $bg-color-primary;
  984. font-size: $font-size-base;
  985. color: $color-primary;
  986. padding: 0 20rpx;
  987. display: flex;
  988. align-items: center;
  989. overflow: hidden;
  990. .title {
  991. flex: 1;
  992. margin-left: 10rpx;
  993. overflow: hidden;
  994. white-space: nowrap;
  995. text-overflow: ellipsis;
  996. }
  997. .iconfont {
  998. line-height: 100%;
  999. }
  1000. }
  1001. }
  1002. .content {
  1003. flex: 1;
  1004. overflow: hidden;
  1005. width: 100%;
  1006. display: flex;
  1007. border-radius: 23rpx 23rpx 0rpx 0rpx;
  1008. .menus {
  1009. width: 200rpx;
  1010. height: 100%;
  1011. overflow: hidden;
  1012. background-color: $bg-color-grey;
  1013. .wrapper {
  1014. width: 100%;
  1015. height: 100%;
  1016. .menu {
  1017. display: flex;
  1018. align-items: center;
  1019. justify-content: flex-start;
  1020. padding: 30rpx 20rpx;
  1021. font-size: 26rpx;
  1022. color: $text-color-assist;
  1023. position: relative;
  1024. display: flex;
  1025. align-items: center;
  1026. justify-content: center;
  1027. &:nth-last-child(1) {
  1028. margin-bottom: 230rpx;
  1029. }
  1030. &.current {
  1031. background-color: #ffffff;
  1032. color: $text-color-base;
  1033. }
  1034. .dot {
  1035. position: absolute;
  1036. width: 34rpx;
  1037. height: 34rpx;
  1038. line-height: 34rpx;
  1039. font-size: 22rpx;
  1040. background-color: $bg-color-primary;
  1041. color: #ffffff;
  1042. top: 16rpx;
  1043. right: 10rpx;
  1044. border-radius: 100%;
  1045. text-align: center;
  1046. }
  1047. }
  1048. }
  1049. }
  1050. .goods {
  1051. flex: 1;
  1052. height: 100%;
  1053. overflow: hidden;
  1054. background-color: #ffffff;
  1055. .wrapper {
  1056. width: 100%;
  1057. height: 100%;
  1058. padding: 20rpx;
  1059. .ads {
  1060. height: calc(300 / 550 * 510rpx);
  1061. image {
  1062. width: 100%;
  1063. height: 100%;
  1064. border-radius: 8rpx;
  1065. }
  1066. }
  1067. .list {
  1068. width: 100%;
  1069. font-size: $font-size-base;
  1070. padding-bottom: 800rpx;
  1071. .category {
  1072. width: 100%;
  1073. .title {
  1074. padding: 30rpx 0;
  1075. display: flex;
  1076. align-items: center;
  1077. color: $text-color-base;
  1078. .icon {
  1079. width: 38rpx;
  1080. height: 38rpx;
  1081. margin-left: 10rpx;
  1082. }
  1083. }
  1084. }
  1085. .items {
  1086. display: flex;
  1087. flex-direction: column;
  1088. padding-bottom: -30rpx;
  1089. .good {
  1090. display: flex;
  1091. align-items: center;
  1092. margin-bottom: 30rpx;
  1093. .image {
  1094. width: 160rpx;
  1095. height: 160rpx;
  1096. margin-right: 20rpx;
  1097. border-radius: 8rpx;
  1098. }
  1099. .right {
  1100. flex: 1;
  1101. // height: 160rpx;
  1102. overflow: hidden;
  1103. display: flex;
  1104. flex-direction: column;
  1105. align-items: flex-start;
  1106. justify-content: space-between;
  1107. padding-right: 14rpx;
  1108. .name {
  1109. font-size: $font-size-base;
  1110. margin-bottom: 10rpx;
  1111. }
  1112. .tips {
  1113. width: 100%;
  1114. height: 40rpx;
  1115. line-height: 40rpx;
  1116. overflow: hidden;
  1117. text-overflow: ellipsis;
  1118. white-space: nowrap;
  1119. font-size: $font-size-sm;
  1120. color: $text-color-assist;
  1121. margin-bottom: 10rpx;
  1122. }
  1123. .price_and_action {
  1124. width: 100%;
  1125. display: flex;
  1126. justify-content: space-between;
  1127. align-items: center;
  1128. .price {
  1129. font-size: $font-size-base;
  1130. font-weight: 600;
  1131. color: $bg-color-primary;
  1132. }
  1133. .btn-group {
  1134. display: flex;
  1135. justify-content: space-between;
  1136. align-items: center;
  1137. position: relative;
  1138. .btn {
  1139. padding: 0 20rpx;
  1140. box-sizing: border-box;
  1141. font-size: $font-size-sm;
  1142. height: 44rpx;
  1143. line-height: 44rpx;
  1144. &.property_btn {
  1145. border-radius: 24rpx;
  1146. }
  1147. &.add_btn,
  1148. &.reduce_btn {
  1149. padding: 0;
  1150. width: 44rpx;
  1151. border-radius: 44rpx;
  1152. }
  1153. }
  1154. .dot {
  1155. position: absolute;
  1156. background-color: #ffffff;
  1157. border: 1px solid $bg-color-primary;
  1158. color: $bg-color-primary;
  1159. font-size: $font-size-sm;
  1160. width: 36rpx;
  1161. height: 36rpx;
  1162. line-height: 36rpx;
  1163. text-align: center;
  1164. border-radius: 100%;
  1165. right: -12rpx;
  1166. top: -10rpx;
  1167. }
  1168. .number {
  1169. width: 44rpx;
  1170. height: 44rpx;
  1171. line-height: 44rpx;
  1172. text-align: center;
  1173. }
  1174. }
  1175. }
  1176. }
  1177. }
  1178. }
  1179. }
  1180. }
  1181. }
  1182. }
  1183. .modal-box {
  1184. max-height: 90vh;
  1185. }
  1186. .good-detail-modal {
  1187. width: 100%;
  1188. height: 100%;
  1189. display: flex;
  1190. flex-direction: column;
  1191. .cover {
  1192. height: 320rpx;
  1193. padding: 30rpx 0;
  1194. display: flex;
  1195. justify-content: center;
  1196. align-items: center;
  1197. position: relative;
  1198. .image {
  1199. width: 260rpx;
  1200. height: 260rpx;
  1201. }
  1202. .btn-group {
  1203. position: absolute;
  1204. right: 10rpx;
  1205. top: 30rpx;
  1206. display: flex;
  1207. align-items: center;
  1208. justify-content: space-around;
  1209. image {
  1210. width: 80rpx;
  1211. height: 80rpx;
  1212. }
  1213. }
  1214. }
  1215. .detail {
  1216. width: 100%;
  1217. min-height: 1vh;
  1218. max-height: calc(90vh - 320rpx - 80rpx - 120rpx);
  1219. .wrapper {
  1220. width: 100%;
  1221. height: 100%;
  1222. overflow: hidden;
  1223. .basic {
  1224. padding: 0 20rpx 30rpx;
  1225. display: flex;
  1226. flex-direction: column;
  1227. .name {
  1228. font-size: $font-size-base;
  1229. color: $text-color-base;
  1230. margin-bottom: 10rpx;
  1231. }
  1232. .tips {
  1233. font-size: $font-size-sm;
  1234. color: $text-color-grey;
  1235. }
  1236. }
  1237. .properties {
  1238. width: 100%;
  1239. border-top: 2rpx solid $bg-color-grey;
  1240. padding: 10rpx 30rpx 0;
  1241. display: flex;
  1242. flex-direction: column;
  1243. .property {
  1244. width: 100%;
  1245. display: flex;
  1246. flex-direction: column;
  1247. margin-bottom: 30rpx;
  1248. padding-bottom: -16rpx;
  1249. .title {
  1250. width: 100%;
  1251. display: flex;
  1252. justify-content: flex-start;
  1253. align-items: center;
  1254. margin-bottom: 20rpx;
  1255. .name {
  1256. font-size: 26rpx;
  1257. color: $text-color-base;
  1258. margin-right: 20rpx;
  1259. }
  1260. .desc {
  1261. flex: 1;
  1262. font-size: $font-size-sm;
  1263. color: $color-primary;
  1264. overflow: hidden;
  1265. text-overflow: ellipsis;
  1266. white-space: nowrap;
  1267. }
  1268. }
  1269. .values {
  1270. width: 100%;
  1271. display: flex;
  1272. flex-wrap: wrap;
  1273. .value {
  1274. border-radius: 8rpx;
  1275. background-color: $bg-color-grey;
  1276. padding: 16rpx 30rpx;
  1277. font-size: 26rpx;
  1278. color: $text-color-assist;
  1279. margin-right: 16rpx;
  1280. margin-bottom: 16rpx;
  1281. &.default {
  1282. background-color: $bg-color-primary;
  1283. color: $text-color-white;
  1284. }
  1285. }
  1286. }
  1287. }
  1288. }
  1289. }
  1290. }
  1291. .action {
  1292. display: flex;
  1293. align-items: center;
  1294. justify-content: space-between;
  1295. background-color: $bg-color-grey;
  1296. height: 120rpx;
  1297. padding: 0 26rpx;
  1298. .left {
  1299. flex: 1;
  1300. display: flex;
  1301. flex-direction: column;
  1302. justify-content: center;
  1303. margin-right: 20rpx;
  1304. overflow: hidden;
  1305. .price {
  1306. font-size: $font-size-lg;
  1307. color: $text-color-base;
  1308. }
  1309. .props {
  1310. color: $text-color-assist;
  1311. font-size: 24rpx;
  1312. width: 100%;
  1313. overflow: hidden;
  1314. text-overflow: ellipsis;
  1315. white-space: nowrap;
  1316. }
  1317. }
  1318. .btn-group {
  1319. display: flex;
  1320. align-items: center;
  1321. justify-content: space-around;
  1322. .number {
  1323. font-size: $font-size-base;
  1324. width: 44rpx;
  1325. height: 44rpx;
  1326. line-height: 44rpx;
  1327. text-align: center;
  1328. }
  1329. .btn {
  1330. padding: 0;
  1331. font-size: $font-size-base;
  1332. width: 44rpx;
  1333. height: 44rpx;
  1334. line-height: 44rpx;
  1335. border-radius: 100%;
  1336. }
  1337. }
  1338. }
  1339. .add-to-cart-btn {
  1340. display: flex;
  1341. justify-content: center;
  1342. align-items: center;
  1343. background-color: $color-primary;
  1344. color: $text-color-white;
  1345. font-size: $font-size-base;
  1346. height: 80rpx;
  1347. border-radius: 0 0 12rpx 12rpx;
  1348. }
  1349. }
  1350. .cart-box {
  1351. // position: absolute;
  1352. // bottom: 30rpx;
  1353. // left: 30rpx;
  1354. // right: 30rpx;
  1355. height: 96rpx;
  1356. border-radius: 48rpx;
  1357. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  1358. background-color: #000;
  1359. display: flex;
  1360. align-items: center;
  1361. justify-content: space-between;
  1362. z-index: 9999;
  1363. .cart-img {
  1364. width: 50rpx;
  1365. height: 47rpx;
  1366. position: relative;
  1367. // margin-top: -48rpx;
  1368. }
  1369. .pay-btn {
  1370. height: 100%;
  1371. padding: 0 30rpx;
  1372. color: #FFFFFF;
  1373. border-radius: 0 50rpx 50rpx 0;
  1374. display: flex;
  1375. align-items: center;
  1376. font-size: $font-size-base;
  1377. }
  1378. .mark {
  1379. padding-left: 46rpx;
  1380. margin-right: 30rpx;
  1381. position: relative;
  1382. .tag {
  1383. background-color: $color-warning;
  1384. color: $text-color-white;
  1385. display: flex;
  1386. justify-content: center;
  1387. align-items: center;
  1388. font-size: $font-size-sm;
  1389. position: absolute;
  1390. right: -13rpx;
  1391. top: -20rpx;
  1392. border-radius: 100%;
  1393. padding: 4rpx;
  1394. width: 27rpx;
  1395. height: 27rpx;
  1396. opacity: .9;
  1397. }
  1398. }
  1399. .price {
  1400. flex: 1;
  1401. color: $text-color-base;
  1402. }
  1403. }
  1404. .cart-popup {
  1405. .top {
  1406. background-color: $bg-color-primary;
  1407. color: $color-primary;
  1408. padding: 10rpx 30rpx;
  1409. font-size: 24rpx;
  1410. text-align: right;
  1411. }
  1412. .cart-list {
  1413. background-color: #FFFFFF;
  1414. width: 100%;
  1415. overflow: hidden;
  1416. min-height: 1vh;
  1417. max-height: 60vh;
  1418. .wrapper {
  1419. height: 100%;
  1420. display: flex;
  1421. flex-direction: column;
  1422. padding: 0 30rpx;
  1423. margin-bottom: 156rpx;
  1424. .item {
  1425. display: flex;
  1426. justify-content: space-between;
  1427. align-items: center;
  1428. padding: 30rpx 0;
  1429. position: relative;
  1430. &::after {
  1431. content: ' ';
  1432. position: absolute;
  1433. bottom: 0;
  1434. left: 0;
  1435. width: 100%;
  1436. background-color: $border-color;
  1437. height: 2rpx;
  1438. transform: scaleY(.6);
  1439. }
  1440. .left {
  1441. flex: 1;
  1442. display: flex;
  1443. flex-direction: column;
  1444. overflow: hidden;
  1445. margin-right: 30rpx;
  1446. .name {
  1447. font-size: $font-size-sm;
  1448. color: $text-color-base;
  1449. }
  1450. .props {
  1451. color: $text-color-assist;
  1452. font-size: 24rpx;
  1453. overflow: hidden;
  1454. text-overflow: ellipsis;
  1455. white-space: nowrap;
  1456. }
  1457. }
  1458. .center {
  1459. margin-right: 120rpx;
  1460. font-size: $font-size-base;
  1461. }
  1462. .right {
  1463. display: flex;
  1464. align-items: center;
  1465. justify-content: space-between;
  1466. .btn {
  1467. width: 46rpx;
  1468. height: 46rpx;
  1469. border-radius: 100%;
  1470. padding: 0;
  1471. text-align: center;
  1472. line-height: 46rpx;
  1473. }
  1474. .number {
  1475. font-size: $font-size-base;
  1476. width: 46rpx;
  1477. height: 46rpx;
  1478. text-align: center;
  1479. line-height: 46rpx;
  1480. }
  1481. }
  1482. }
  1483. }
  1484. }
  1485. }
  1486. .back-button {
  1487. width: 30rpx;
  1488. height: 30rpx;
  1489. border-right: 4rpx solid #fff;
  1490. border-bottom: 4rpx solid #fff;
  1491. transform: rotate(135deg);
  1492. margin-left: 10rpx;
  1493. display: inline-block;
  1494. position: relative;
  1495. }
  1496. .newsTitle {
  1497. display: flex;
  1498. align-items: center;
  1499. }
  1500. .mode {
  1501. position: fixed;
  1502. width: 100%;
  1503. height: 100%;
  1504. left: 0;
  1505. top: 0;
  1506. background: rgba(33, 33, 33, 0.8);
  1507. z-index: 99999;
  1508. display: flex;
  1509. align-items: flex-end;
  1510. }
  1511. .mode-1 {
  1512. width: 100%;
  1513. height: 840rpx;
  1514. background: #FFF;
  1515. display: flex;
  1516. flex-direction: column;
  1517. gap: 20rpx;
  1518. // padding: 30rpx;
  1519. box-sizing: border-box;
  1520. overflow: auto;
  1521. /* 添加这个属性使容器可以滚动 */
  1522. }
  1523. // 规格弹窗
  1524. .sel-mode-1 {
  1525. width: 100%;
  1526. // height: 440rpx;
  1527. background: #FFF;
  1528. display: flex;
  1529. flex-direction: column;
  1530. gap: 20rpx;
  1531. box-sizing: border-box;
  1532. overflow: auto;
  1533. z-index: 99999;
  1534. padding: 20rpx 20rpx 60rpx 20rpx;
  1535. box-sizing: border-box;
  1536. position: relative;
  1537. }
  1538. .close {
  1539. text-align: right;
  1540. font-size: 40rpx;
  1541. }
  1542. .sel-2 {
  1543. display: flex;
  1544. align-items: center;
  1545. gap: 20rpx;
  1546. .nexbox1 {
  1547. flex: 1;
  1548. text-overflow: ellipsis;
  1549. white-space: nowrap;
  1550. color: $text-color-assist;
  1551. }
  1552. }
  1553. .sel-3 {
  1554. display: flex;
  1555. flex-direction: column;
  1556. gap: 10rpx;
  1557. }
  1558. .sel-4 {
  1559. display: flex;
  1560. align-items: center;
  1561. gap: 10rpx;
  1562. }
  1563. .sel-5 {
  1564. width: 80rpx;
  1565. height: 40rpx;
  1566. box-sizing: border-box;
  1567. display: flex;
  1568. align-items: center;
  1569. justify-content: center;
  1570. font-size: 24rpx;
  1571. background: #999999;
  1572. color: #FFF;
  1573. padding: 8rpx;
  1574. border-radius: 8rpx;
  1575. }
  1576. .sel-6 {
  1577. display: flex;
  1578. align-items: center;
  1579. justify-content: space-between;
  1580. }
  1581. .sel-btn {
  1582. display: flex;
  1583. align-items: center;
  1584. justify-content: flex-end;
  1585. }
  1586. .sel-btn1 {
  1587. width: 110px;
  1588. height: 60rpx;
  1589. display: flex;
  1590. align-items: center;
  1591. justify-content: center;
  1592. background: rgba(255, 103, 2, 1);
  1593. color: #FFF;
  1594. font-size: 30rpx;
  1595. border-radius: 10rpx;
  1596. }
  1597. .neximg {
  1598. width: 160rpx;
  1599. height: 160rpx;
  1600. margin-right: 20rpx;
  1601. border-radius: 8rpx;
  1602. /* 保持图片等比例缩放,并且不会裁切 */
  1603. }
  1604. .btn-group {
  1605. display: flex;
  1606. justify-content: space-between;
  1607. align-items: center;
  1608. position: relative;
  1609. .btn {
  1610. padding: 0 20rpx;
  1611. box-sizing: border-box;
  1612. font-size: $font-size-sm;
  1613. height: 44rpx;
  1614. line-height: 44rpx;
  1615. &.property_btn {
  1616. border-radius: 24rpx;
  1617. }
  1618. &.add_btn,
  1619. &.reduce_btn {
  1620. padding: 0;
  1621. width: 44rpx;
  1622. border-radius: 44rpx;
  1623. }
  1624. }
  1625. .dot {
  1626. position: absolute;
  1627. background-color: #ffffff;
  1628. border: 1px solid $bg-color-primary;
  1629. color: $bg-color-primary;
  1630. font-size: $font-size-sm;
  1631. width: 36rpx;
  1632. height: 36rpx;
  1633. line-height: 36rpx;
  1634. text-align: center;
  1635. border-radius: 100%;
  1636. right: -12rpx;
  1637. top: -10rpx;
  1638. }
  1639. .number {
  1640. width: 44rpx;
  1641. height: 44rpx;
  1642. line-height: 44rpx;
  1643. text-align: center;
  1644. }
  1645. }
  1646. .nexbox-txt3 {
  1647. color: $bg-color-primary;
  1648. }
  1649. .mode-box {
  1650. width: 100%;
  1651. display: flex;
  1652. flex-direction: column;
  1653. gap: 20rpx;
  1654. padding: 30rpx;
  1655. box-sizing: border-box;
  1656. }
  1657. .items {
  1658. display: flex;
  1659. flex-direction: column;
  1660. padding-bottom: -30rpx;
  1661. .good {
  1662. display: flex;
  1663. align-items: center;
  1664. margin-bottom: 30rpx;
  1665. .image {
  1666. width: 160rpx;
  1667. height: 160rpx;
  1668. margin-right: 20rpx;
  1669. border-radius: 8rpx;
  1670. }
  1671. .right {
  1672. flex: 1;
  1673. // height: 160rpx;
  1674. overflow: hidden;
  1675. display: flex;
  1676. flex-direction: column;
  1677. align-items: flex-start;
  1678. justify-content: space-between;
  1679. padding-right: 14rpx;
  1680. .name {
  1681. font-size: $font-size-base;
  1682. margin-bottom: 10rpx;
  1683. }
  1684. .tips {
  1685. width: 100%;
  1686. height: 40rpx;
  1687. line-height: 40rpx;
  1688. overflow: hidden;
  1689. text-overflow: ellipsis;
  1690. white-space: nowrap;
  1691. font-size: $font-size-sm;
  1692. color: $text-color-assist;
  1693. margin-bottom: 10rpx;
  1694. }
  1695. .price_and_action {
  1696. width: 100%;
  1697. display: flex;
  1698. justify-content: space-between;
  1699. align-items: center;
  1700. .price {
  1701. font-size: $font-size-base;
  1702. font-weight: 600;
  1703. color: $bg-color-primary;
  1704. }
  1705. .btn-group {
  1706. display: flex;
  1707. justify-content: space-between;
  1708. align-items: center;
  1709. position: relative;
  1710. .btn {
  1711. padding: 0 20rpx;
  1712. box-sizing: border-box;
  1713. font-size: $font-size-sm;
  1714. height: 44rpx;
  1715. line-height: 44rpx;
  1716. &.property_btn {
  1717. border-radius: 24rpx;
  1718. }
  1719. &.add_btn,
  1720. &.reduce_btn {
  1721. padding: 0;
  1722. width: 44rpx;
  1723. border-radius: 44rpx;
  1724. }
  1725. }
  1726. .dot {
  1727. position: absolute;
  1728. background-color: #ffffff;
  1729. border: 1px solid $bg-color-primary;
  1730. color: $bg-color-primary;
  1731. font-size: $font-size-sm;
  1732. width: 36rpx;
  1733. height: 36rpx;
  1734. line-height: 36rpx;
  1735. text-align: center;
  1736. border-radius: 100%;
  1737. right: -12rpx;
  1738. top: -10rpx;
  1739. }
  1740. .number {
  1741. width: 44rpx;
  1742. height: 44rpx;
  1743. line-height: 44rpx;
  1744. text-align: center;
  1745. }
  1746. }
  1747. }
  1748. }
  1749. }
  1750. }
  1751. .mode-clear {
  1752. padding: 30rpx;
  1753. box-sizing: border-box;
  1754. position: sticky;
  1755. z-index: 99;
  1756. top: 0;
  1757. display: flex;
  1758. justify-content: space-between;
  1759. align-items: center;
  1760. background: #FFF;
  1761. border-bottom: 1px solid burlywood;
  1762. }
  1763. .mode-txt {
  1764. display: flex;
  1765. align-items: center;
  1766. gap: 8rpx;
  1767. }
  1768. .mode-txt1 {
  1769. font-weight: 500;
  1770. font-size: 32rpx;
  1771. }
  1772. // 点菜评价切换
  1773. .let-box {
  1774. display: flex;
  1775. align-items: center;
  1776. gap: 60rpx;
  1777. padding: 20rpx;
  1778. box-sizing: border-box;
  1779. }
  1780. .let-box1 {
  1781. display: flex;
  1782. flex-direction: column;
  1783. align-items: center;
  1784. justify-content: center;
  1785. gap: 10rpx;
  1786. }
  1787. .let-line {
  1788. border-radius: 6rpx;
  1789. width: 40rpx;
  1790. height: 10rpx;
  1791. }
  1792. .let-txt {
  1793. overflow-wrap: break-word;
  1794. color: rgba(20, 20, 20, 1);
  1795. font-size: 28rpx;
  1796. font-weight: normal;
  1797. text-align: left;
  1798. white-space: nowrap;
  1799. line-height: 40rpx;
  1800. }
  1801. .actave {
  1802. background-color: rgba(255, 103, 2, 1);
  1803. }
  1804. .actave1 {
  1805. color: rgba(255, 103, 2, 1);
  1806. }
  1807. .font_color {
  1808. color: $bg-color-primary;
  1809. }
  1810. .evaluate-list {
  1811. padding: 30rpx 0 0 0;
  1812. background-color: #fff;
  1813. }
  1814. .evaluate-list .nav-tab1 {
  1815. font-size: 24rpx;
  1816. color: #282828;
  1817. padding: 30rpx;
  1818. background-color: #fff;
  1819. border-bottom: 1rpx solid #f5f5f5;
  1820. }
  1821. .evaluate-list .generalComment {
  1822. padding: 0 30rpx;
  1823. margin-top: 1rpx;
  1824. background-color: #fff;
  1825. font-size: 28rpx;
  1826. color: #808080;
  1827. }
  1828. .evaluate-list .generalComment .evaluate {
  1829. margin-right: 7rpx;
  1830. color: #333333;
  1831. font-size: 28rpx;
  1832. }
  1833. .evaluate-list .nav-tab1 .item {
  1834. font-size: 24rpx;
  1835. color: #282828;
  1836. border-radius: 27rpx;
  1837. height: 54rpx;
  1838. padding: 0 20rpx;
  1839. background-color: #f4f4f4;
  1840. line-height: 54rpx;
  1841. margin-right: 17rpx;
  1842. }
  1843. .evaluate-list .nav-tab1 .item.bg-color {
  1844. color: #fff;
  1845. background-color: $bg-color-primary;
  1846. }
  1847. .noCommodity {
  1848. margin-top: 32%;
  1849. }
  1850. .default_txt {
  1851. font-size: 26rpx;
  1852. color: #999;
  1853. text-align: center;
  1854. }
  1855. .swiper {
  1856. display: flex;
  1857. /* 使用flex布局 */
  1858. animation: scrollRight 10s linear infinite;
  1859. /* 应用动画 */
  1860. }
  1861. .swiper-item {
  1862. flex-shrink: 0;
  1863. /* 不允许缩小 */
  1864. width: 100%;
  1865. /* 每个item占满一行 */
  1866. }
  1867. @keyframes scrollRight {
  1868. from {
  1869. transform: translateX(100%);
  1870. }
  1871. /* 从右向左移动 */
  1872. to {
  1873. transform: translateX(-100%);
  1874. }
  1875. /* 移出视图 */
  1876. }
  1877. </style>