index.vue 50 KB

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