index.vue 48 KB

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