index.vue 48 KB

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