index.vue 47 KB

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