index.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993
  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. }).catch(err => {
  640. uni.showToast({
  641. title: err,
  642. icon: 'none'
  643. })
  644. })
  645. uni.setStorageSync('cart', JSON.parse(JSON.stringify(this.cart)))
  646. uni.hideLoading()
  647. },
  648. // 选规格打开
  649. Selectpox(item, itemInfo) {
  650. this.specifications = itemInfo //这一项信息
  651. this.specificationsList = item //这一项信息
  652. // this.good = Object.assign({}, this.good, itemInfo)
  653. getProductDetail(
  654. itemInfo.id,
  655. 0, 0, ''
  656. ).then((res) => {
  657. console.log('规格', res)
  658. if (res.code == 200) {
  659. this.good.property = res.data.productAttr.map(item => {
  660. item.optionList.forEach((items, index) => {
  661. index === 0 ? items.is_default = true : '' // 规格默认选中
  662. })
  663. return { ...item
  664. }
  665. })
  666. console.log(this.good)
  667. // this.productValue = res.data.productAttr //规格数组
  668. this.productObj = res.data.productValue //默认选择的id
  669. this.selectble = true
  670. }
  671. })
  672. },
  673. // 关闭规格
  674. Close() {
  675. this.specifications = '' //这一项信息
  676. this.specificationsList = [] //这一项信息
  677. this.selectble = false
  678. },
  679. onTabChang(id) {
  680. if (this.tabindex === id) return
  681. this.tabindex = id
  682. if (id == 1) {
  683. this.getProductReplyList()
  684. this.getProductReplyCount()
  685. }
  686. },
  687. /**
  688. * 分页获取评论
  689. */
  690. getProductReplyList: function() {
  691. let that = this;
  692. if (that.loadend) return;
  693. if (that.loading) return;
  694. that.loading = true;
  695. that.loadTitle = '';
  696. getMerchantReply(that.merId, {
  697. page: that.page,
  698. limit: that.limit,
  699. type: that.type,
  700. }).then(res => {
  701. let list = res.data.list,
  702. loadend = list.length < that.limit;
  703. that.reply = that.$util.SplitArray(list, that.reply);
  704. that.$set(that, 'reply', that.reply);
  705. that.loading = false;
  706. that.loadend = loadend;
  707. if (that.reply.length) {
  708. that.loadTitle = loadend ? "??人家是有底线的~~" : "加载更多";
  709. }
  710. that.page = that.page + 1;
  711. }).catch(err => {
  712. that.loading = false,
  713. that.loadTitle = '加载更多'
  714. });
  715. },
  716. /*
  717. * 点击事件切换
  718. * */
  719. changeType: function(e) {
  720. let type = parseInt(e);
  721. if (type == this.type) return;
  722. this.type = type;
  723. this.page = 1;
  724. this.loadend = false;
  725. this.$set(this, 'reply', []);
  726. this.getProductReplyList();
  727. },
  728. /**
  729. * 获取评论统计数据
  730. *
  731. */
  732. getProductReplyCount: function() {
  733. let that = this;
  734. getMerchantReplyConfig(that.merId).then(res => {
  735. that.$set(that, 'replyData', res.data);
  736. });
  737. },
  738. }
  739. }
  740. </script>
  741. <style lang="scss" scoped>
  742. /* #ifdef H5 */
  743. page {
  744. min-height: 100%;
  745. }
  746. /* #endif */
  747. .bg-color {
  748. background-color: $bg-color-primary;
  749. }
  750. .care {
  751. color: #666666 !important;
  752. border: 1px solid #CCCCCC;
  753. background: inherit !important;
  754. }
  755. .order-nav {
  756. // height: 111rpx;
  757. position: relative;
  758. background-color: #FF6702;
  759. display: flex;
  760. align-items: center;
  761. justify-content: center;
  762. .back-button {
  763. position: absolute;
  764. left: 20rpx;
  765. }
  766. text {
  767. font-weight: 500;
  768. font-size: 35rpx;
  769. color: #FFFFFF;
  770. }
  771. }
  772. .container {
  773. display: flex;
  774. flex-direction: column;
  775. overflow: hidden;
  776. position: relative;
  777. }
  778. .loading {
  779. width: 100%;
  780. height: 100%;
  781. display: flex;
  782. align-items: center;
  783. justify-content: center;
  784. image {
  785. width: 260rpx;
  786. height: 260rpx;
  787. position: relative;
  788. margin-top: -200rpx;
  789. /* #ifdef h5 */
  790. margin-top: 0;
  791. /* #endif */
  792. }
  793. }
  794. .stores {
  795. width: 100%;
  796. display: flex;
  797. flex-direction: column;
  798. justify-content: flex-start;
  799. margin-bottom: -40rpx;
  800. .store {
  801. width: 100%;
  802. background-color: $bg-color-grey;
  803. padding: 20rpx;
  804. display: flex;
  805. align-items: center;
  806. margin-bottom: 20rpx;
  807. border-radius: 6rpx;
  808. .iconfont {
  809. font-size: 50rpx;
  810. margin-right: 15rpx;
  811. &.iconradio-button-off {
  812. color: $text-color-assist;
  813. }
  814. &.iconradio-button-on {
  815. color: $color-primary;
  816. }
  817. }
  818. .infos {
  819. flex: 1;
  820. display: flex;
  821. flex-direction: column;
  822. color: $text-color-base;
  823. overflow: hidden;
  824. .name_and_distance {
  825. width: 100%;
  826. display: flex;
  827. justify-content: space-between;
  828. margin-bottom: 10rpx;
  829. overflow: hidden;
  830. .name {
  831. flex: 1;
  832. flex-shrink: 0;
  833. overflow: hidden;
  834. text-overflow: ellipsis;
  835. white-space: nowrap;
  836. font-size: $font-size-lg;
  837. }
  838. .distance {
  839. flex-shrink: 0;
  840. font-size: $font-size-lg;
  841. font-weight: bold;
  842. margin-left: 20rpx;
  843. }
  844. }
  845. .street {
  846. color: $text-color-assist;
  847. font-size: $font-size-sm;
  848. }
  849. }
  850. }
  851. }
  852. .main {
  853. overflow: hidden;
  854. width: 100%;
  855. display: flex;
  856. flex-direction: column;
  857. }
  858. .nav {
  859. width: 100%;
  860. flex-shrink: 0;
  861. display: flex;
  862. flex-direction: column;
  863. border-radius: 23rpx;
  864. padding: 19rpx 45rpx 38rpx 45rpx;
  865. background-color: #ffffff;
  866. .header {
  867. width: 100%;
  868. display: flex;
  869. align-items: center;
  870. justify-content: space-between;
  871. .left {
  872. flex: 1;
  873. display: flex;
  874. flex-direction: column;
  875. .store-name {
  876. display: flex;
  877. justify-content: space-between;
  878. align-items: center;
  879. font-size: $font-size-lg;
  880. margin-bottom: 10rpx;
  881. .iconfont {
  882. margin-left: 10rpx;
  883. line-height: 100%;
  884. }
  885. .icon-img {
  886. width: 40rpx;
  887. height: 40rpx;
  888. flex-shrink: 0;
  889. }
  890. }
  891. .store-tip {
  892. font-weight: 400;
  893. font-size: 21rpx;
  894. color: #858687;
  895. margin-top: 10rpx;
  896. background: #F8F9FB;
  897. border-radius: 4rpx;
  898. }
  899. }
  900. .right {
  901. background-color: $bg-color-grey;
  902. border-radius: 38rpx;
  903. display: flex;
  904. align-items: center;
  905. font-size: $font-size-sm;
  906. padding: 0 38rpx;
  907. color: $text-color-assist;
  908. .dinein,
  909. .takeout {
  910. position: relative;
  911. display: flex;
  912. align-items: center;
  913. &.active {
  914. padding: 14rpx 38rpx;
  915. color: #ffffff;
  916. background-color: $color-primary;
  917. border-radius: 38rpx;
  918. }
  919. }
  920. .takeout {
  921. margin-left: 20rpx;
  922. height: 100%;
  923. flex: 1;
  924. padding: 14rpx 0;
  925. }
  926. .dinein.active {
  927. margin-left: -38rpx;
  928. }
  929. .takeout.active {
  930. margin-right: -38rpx;
  931. }
  932. }
  933. }
  934. .coupon {
  935. flex: 1;
  936. width: 100%;
  937. background-color: $bg-color-primary;
  938. font-size: $font-size-base;
  939. color: $color-primary;
  940. padding: 0 20rpx;
  941. display: flex;
  942. align-items: center;
  943. overflow: hidden;
  944. .title {
  945. flex: 1;
  946. margin-left: 10rpx;
  947. overflow: hidden;
  948. white-space: nowrap;
  949. text-overflow: ellipsis;
  950. }
  951. .iconfont {
  952. line-height: 100%;
  953. }
  954. }
  955. }
  956. .content {
  957. flex: 1;
  958. overflow: hidden;
  959. width: 100%;
  960. display: flex;
  961. border-radius: 23rpx 23rpx 0rpx 0rpx;
  962. .menus {
  963. width: 200rpx;
  964. height: 100%;
  965. overflow: hidden;
  966. background-color: $bg-color-grey;
  967. .wrapper {
  968. width: 100%;
  969. height: 100%;
  970. .menu {
  971. display: flex;
  972. align-items: center;
  973. justify-content: flex-start;
  974. padding: 30rpx 20rpx;
  975. font-size: 26rpx;
  976. color: $text-color-assist;
  977. position: relative;
  978. display: flex;
  979. align-items: center;
  980. justify-content: center;
  981. &:nth-last-child(1) {
  982. margin-bottom: 230rpx;
  983. }
  984. &.current {
  985. background-color: #ffffff;
  986. color: $text-color-base;
  987. }
  988. .dot {
  989. position: absolute;
  990. width: 34rpx;
  991. height: 34rpx;
  992. line-height: 34rpx;
  993. font-size: 22rpx;
  994. background-color: $bg-color-primary;
  995. color: #ffffff;
  996. top: 16rpx;
  997. right: 10rpx;
  998. border-radius: 100%;
  999. text-align: center;
  1000. }
  1001. }
  1002. }
  1003. }
  1004. .goods {
  1005. flex: 1;
  1006. height: 100%;
  1007. overflow: hidden;
  1008. background-color: #ffffff;
  1009. .wrapper {
  1010. width: 100%;
  1011. height: 100%;
  1012. padding: 20rpx;
  1013. .ads {
  1014. height: calc(300 / 550 * 510rpx);
  1015. image {
  1016. width: 100%;
  1017. height: 100%;
  1018. border-radius: 8rpx;
  1019. }
  1020. }
  1021. .list {
  1022. width: 100%;
  1023. font-size: $font-size-base;
  1024. padding-bottom: 800rpx;
  1025. .category {
  1026. width: 100%;
  1027. .title {
  1028. padding: 30rpx 0;
  1029. display: flex;
  1030. align-items: center;
  1031. color: $text-color-base;
  1032. .icon {
  1033. width: 38rpx;
  1034. height: 38rpx;
  1035. margin-left: 10rpx;
  1036. }
  1037. }
  1038. }
  1039. .items {
  1040. display: flex;
  1041. flex-direction: column;
  1042. padding-bottom: -30rpx;
  1043. .good {
  1044. display: flex;
  1045. align-items: center;
  1046. margin-bottom: 30rpx;
  1047. .image {
  1048. width: 160rpx;
  1049. height: 160rpx;
  1050. margin-right: 20rpx;
  1051. border-radius: 8rpx;
  1052. }
  1053. .right {
  1054. flex: 1;
  1055. // height: 160rpx;
  1056. overflow: hidden;
  1057. display: flex;
  1058. flex-direction: column;
  1059. align-items: flex-start;
  1060. justify-content: space-between;
  1061. padding-right: 14rpx;
  1062. .name {
  1063. font-size: $font-size-base;
  1064. margin-bottom: 10rpx;
  1065. }
  1066. .tips {
  1067. width: 100%;
  1068. height: 40rpx;
  1069. line-height: 40rpx;
  1070. overflow: hidden;
  1071. text-overflow: ellipsis;
  1072. white-space: nowrap;
  1073. font-size: $font-size-sm;
  1074. color: $text-color-assist;
  1075. margin-bottom: 10rpx;
  1076. }
  1077. .price_and_action {
  1078. width: 100%;
  1079. display: flex;
  1080. justify-content: space-between;
  1081. align-items: center;
  1082. .price {
  1083. font-size: $font-size-base;
  1084. font-weight: 600;
  1085. color: $bg-color-primary;
  1086. }
  1087. .btn-group {
  1088. display: flex;
  1089. justify-content: space-between;
  1090. align-items: center;
  1091. position: relative;
  1092. .btn {
  1093. padding: 0 20rpx;
  1094. box-sizing: border-box;
  1095. font-size: $font-size-sm;
  1096. height: 44rpx;
  1097. line-height: 44rpx;
  1098. &.property_btn {
  1099. border-radius: 24rpx;
  1100. }
  1101. &.add_btn,
  1102. &.reduce_btn {
  1103. padding: 0;
  1104. width: 44rpx;
  1105. border-radius: 44rpx;
  1106. }
  1107. }
  1108. .dot {
  1109. position: absolute;
  1110. background-color: #ffffff;
  1111. border: 1px solid $bg-color-primary;
  1112. color: $bg-color-primary;
  1113. font-size: $font-size-sm;
  1114. width: 36rpx;
  1115. height: 36rpx;
  1116. line-height: 36rpx;
  1117. text-align: center;
  1118. border-radius: 100%;
  1119. right: -12rpx;
  1120. top: -10rpx;
  1121. }
  1122. .number {
  1123. width: 44rpx;
  1124. height: 44rpx;
  1125. line-height: 44rpx;
  1126. text-align: center;
  1127. }
  1128. }
  1129. }
  1130. }
  1131. }
  1132. }
  1133. }
  1134. }
  1135. }
  1136. }
  1137. .modal-box {
  1138. max-height: 90vh;
  1139. }
  1140. .good-detail-modal {
  1141. width: 100%;
  1142. height: 100%;
  1143. display: flex;
  1144. flex-direction: column;
  1145. .cover {
  1146. height: 320rpx;
  1147. padding: 30rpx 0;
  1148. display: flex;
  1149. justify-content: center;
  1150. align-items: center;
  1151. position: relative;
  1152. .image {
  1153. width: 260rpx;
  1154. height: 260rpx;
  1155. }
  1156. .btn-group {
  1157. position: absolute;
  1158. right: 10rpx;
  1159. top: 30rpx;
  1160. display: flex;
  1161. align-items: center;
  1162. justify-content: space-around;
  1163. image {
  1164. width: 80rpx;
  1165. height: 80rpx;
  1166. }
  1167. }
  1168. }
  1169. .detail {
  1170. width: 100%;
  1171. min-height: 1vh;
  1172. max-height: calc(90vh - 320rpx - 80rpx - 120rpx);
  1173. .wrapper {
  1174. width: 100%;
  1175. height: 100%;
  1176. overflow: hidden;
  1177. .basic {
  1178. padding: 0 20rpx 30rpx;
  1179. display: flex;
  1180. flex-direction: column;
  1181. .name {
  1182. font-size: $font-size-base;
  1183. color: $text-color-base;
  1184. margin-bottom: 10rpx;
  1185. }
  1186. .tips {
  1187. font-size: $font-size-sm;
  1188. color: $text-color-grey;
  1189. }
  1190. }
  1191. .properties {
  1192. width: 100%;
  1193. border-top: 2rpx solid $bg-color-grey;
  1194. padding: 10rpx 30rpx 0;
  1195. display: flex;
  1196. flex-direction: column;
  1197. .property {
  1198. width: 100%;
  1199. display: flex;
  1200. flex-direction: column;
  1201. margin-bottom: 30rpx;
  1202. padding-bottom: -16rpx;
  1203. .title {
  1204. width: 100%;
  1205. display: flex;
  1206. justify-content: flex-start;
  1207. align-items: center;
  1208. margin-bottom: 20rpx;
  1209. .name {
  1210. font-size: 26rpx;
  1211. color: $text-color-base;
  1212. margin-right: 20rpx;
  1213. }
  1214. .desc {
  1215. flex: 1;
  1216. font-size: $font-size-sm;
  1217. color: $color-primary;
  1218. overflow: hidden;
  1219. text-overflow: ellipsis;
  1220. white-space: nowrap;
  1221. }
  1222. }
  1223. .values {
  1224. width: 100%;
  1225. display: flex;
  1226. flex-wrap: wrap;
  1227. .value {
  1228. border-radius: 8rpx;
  1229. background-color: $bg-color-grey;
  1230. padding: 16rpx 30rpx;
  1231. font-size: 26rpx;
  1232. color: $text-color-assist;
  1233. margin-right: 16rpx;
  1234. margin-bottom: 16rpx;
  1235. &.default {
  1236. background-color: $bg-color-primary;
  1237. color: $text-color-white;
  1238. }
  1239. }
  1240. }
  1241. }
  1242. }
  1243. }
  1244. }
  1245. .action {
  1246. display: flex;
  1247. align-items: center;
  1248. justify-content: space-between;
  1249. background-color: $bg-color-grey;
  1250. height: 120rpx;
  1251. padding: 0 26rpx;
  1252. .left {
  1253. flex: 1;
  1254. display: flex;
  1255. flex-direction: column;
  1256. justify-content: center;
  1257. margin-right: 20rpx;
  1258. overflow: hidden;
  1259. .price {
  1260. font-size: $font-size-lg;
  1261. color: $text-color-base;
  1262. }
  1263. .props {
  1264. color: $text-color-assist;
  1265. font-size: 24rpx;
  1266. width: 100%;
  1267. overflow: hidden;
  1268. text-overflow: ellipsis;
  1269. white-space: nowrap;
  1270. }
  1271. }
  1272. .btn-group {
  1273. display: flex;
  1274. align-items: center;
  1275. justify-content: space-around;
  1276. .number {
  1277. font-size: $font-size-base;
  1278. width: 44rpx;
  1279. height: 44rpx;
  1280. line-height: 44rpx;
  1281. text-align: center;
  1282. }
  1283. .btn {
  1284. padding: 0;
  1285. font-size: $font-size-base;
  1286. width: 44rpx;
  1287. height: 44rpx;
  1288. line-height: 44rpx;
  1289. border-radius: 100%;
  1290. }
  1291. }
  1292. }
  1293. .add-to-cart-btn {
  1294. display: flex;
  1295. justify-content: center;
  1296. align-items: center;
  1297. background-color: $color-primary;
  1298. color: $text-color-white;
  1299. font-size: $font-size-base;
  1300. height: 80rpx;
  1301. border-radius: 0 0 12rpx 12rpx;
  1302. }
  1303. }
  1304. .cart-box {
  1305. // position: absolute;
  1306. // bottom: 30rpx;
  1307. // left: 30rpx;
  1308. // right: 30rpx;
  1309. height: 96rpx;
  1310. border-radius: 48rpx;
  1311. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  1312. background-color: #000;
  1313. display: flex;
  1314. align-items: center;
  1315. justify-content: space-between;
  1316. z-index: 9999;
  1317. .cart-img {
  1318. width: 50rpx;
  1319. height: 47rpx;
  1320. position: relative;
  1321. // margin-top: -48rpx;
  1322. }
  1323. .pay-btn {
  1324. height: 100%;
  1325. padding: 0 30rpx;
  1326. color: #FFFFFF;
  1327. border-radius: 0 50rpx 50rpx 0;
  1328. display: flex;
  1329. align-items: center;
  1330. font-size: $font-size-base;
  1331. }
  1332. .mark {
  1333. padding-left: 46rpx;
  1334. margin-right: 30rpx;
  1335. position: relative;
  1336. .tag {
  1337. background-color: $color-warning;
  1338. color: $text-color-white;
  1339. display: flex;
  1340. justify-content: center;
  1341. align-items: center;
  1342. font-size: $font-size-sm;
  1343. position: absolute;
  1344. right: -13rpx;
  1345. top: -20rpx;
  1346. border-radius: 100%;
  1347. padding: 4rpx;
  1348. width: 27rpx;
  1349. height: 27rpx;
  1350. opacity: .9;
  1351. }
  1352. }
  1353. .price {
  1354. flex: 1;
  1355. color: $text-color-base;
  1356. }
  1357. }
  1358. .cart-popup {
  1359. .top {
  1360. background-color: $bg-color-primary;
  1361. color: $color-primary;
  1362. padding: 10rpx 30rpx;
  1363. font-size: 24rpx;
  1364. text-align: right;
  1365. }
  1366. .cart-list {
  1367. background-color: #FFFFFF;
  1368. width: 100%;
  1369. overflow: hidden;
  1370. min-height: 1vh;
  1371. max-height: 60vh;
  1372. .wrapper {
  1373. height: 100%;
  1374. display: flex;
  1375. flex-direction: column;
  1376. padding: 0 30rpx;
  1377. margin-bottom: 156rpx;
  1378. .item {
  1379. display: flex;
  1380. justify-content: space-between;
  1381. align-items: center;
  1382. padding: 30rpx 0;
  1383. position: relative;
  1384. &::after {
  1385. content: ' ';
  1386. position: absolute;
  1387. bottom: 0;
  1388. left: 0;
  1389. width: 100%;
  1390. background-color: $border-color;
  1391. height: 2rpx;
  1392. transform: scaleY(.6);
  1393. }
  1394. .left {
  1395. flex: 1;
  1396. display: flex;
  1397. flex-direction: column;
  1398. overflow: hidden;
  1399. margin-right: 30rpx;
  1400. .name {
  1401. font-size: $font-size-sm;
  1402. color: $text-color-base;
  1403. }
  1404. .props {
  1405. color: $text-color-assist;
  1406. font-size: 24rpx;
  1407. overflow: hidden;
  1408. text-overflow: ellipsis;
  1409. white-space: nowrap;
  1410. }
  1411. }
  1412. .center {
  1413. margin-right: 120rpx;
  1414. font-size: $font-size-base;
  1415. }
  1416. .right {
  1417. display: flex;
  1418. align-items: center;
  1419. justify-content: space-between;
  1420. .btn {
  1421. width: 46rpx;
  1422. height: 46rpx;
  1423. border-radius: 100%;
  1424. padding: 0;
  1425. text-align: center;
  1426. line-height: 46rpx;
  1427. }
  1428. .number {
  1429. font-size: $font-size-base;
  1430. width: 46rpx;
  1431. height: 46rpx;
  1432. text-align: center;
  1433. line-height: 46rpx;
  1434. }
  1435. }
  1436. }
  1437. }
  1438. }
  1439. }
  1440. .back-button {
  1441. width: 30rpx;
  1442. height: 30rpx;
  1443. border-right: 4rpx solid #fff;
  1444. border-bottom: 4rpx solid #fff;
  1445. transform: rotate(135deg);
  1446. margin-left: 10rpx;
  1447. display: inline-block;
  1448. position: relative;
  1449. }
  1450. .newsTitle {
  1451. display: flex;
  1452. align-items: center;
  1453. }
  1454. .mode {
  1455. position: fixed;
  1456. width: 100%;
  1457. height: 100%;
  1458. left: 0;
  1459. top: 0;
  1460. background: rgba(33, 33, 33, 0.8);
  1461. z-index: 99999;
  1462. display: flex;
  1463. align-items: flex-end;
  1464. }
  1465. .mode-1 {
  1466. width: 100%;
  1467. height: 840rpx;
  1468. background: #FFF;
  1469. display: flex;
  1470. flex-direction: column;
  1471. gap: 20rpx;
  1472. // padding: 30rpx;
  1473. box-sizing: border-box;
  1474. overflow: auto;
  1475. /* 添加这个属性使容器可以滚动 */
  1476. }
  1477. // 规格弹窗
  1478. .sel-mode-1 {
  1479. width: 100%;
  1480. // height: 440rpx;
  1481. background: #FFF;
  1482. display: flex;
  1483. flex-direction: column;
  1484. gap: 20rpx;
  1485. box-sizing: border-box;
  1486. overflow: auto;
  1487. z-index: 99999;
  1488. padding: 20rpx 20rpx 60rpx 20rpx;
  1489. box-sizing: border-box;
  1490. position: relative;
  1491. }
  1492. .close {
  1493. text-align: right;
  1494. font-size: 40rpx;
  1495. }
  1496. .sel-2 {
  1497. display: flex;
  1498. align-items: center;
  1499. gap: 20rpx;
  1500. .nexbox1 {
  1501. flex: 1;
  1502. text-overflow: ellipsis;
  1503. white-space: nowrap;
  1504. color: $text-color-assist;
  1505. }
  1506. }
  1507. .sel-3 {
  1508. display: flex;
  1509. flex-direction: column;
  1510. gap: 10rpx;
  1511. }
  1512. .sel-4 {
  1513. display: flex;
  1514. align-items: center;
  1515. gap: 10rpx;
  1516. }
  1517. .sel-5 {
  1518. width: 80rpx;
  1519. height: 40rpx;
  1520. box-sizing: border-box;
  1521. display: flex;
  1522. align-items: center;
  1523. justify-content: center;
  1524. font-size: 24rpx;
  1525. background: #999999;
  1526. color: #FFF;
  1527. padding: 8rpx;
  1528. border-radius: 8rpx;
  1529. }
  1530. .sel-6 {
  1531. display: flex;
  1532. align-items: center;
  1533. justify-content: space-between;
  1534. }
  1535. .sel-btn {
  1536. display: flex;
  1537. align-items: center;
  1538. justify-content: flex-end;
  1539. }
  1540. .sel-btn1 {
  1541. width: 110px;
  1542. height: 60rpx;
  1543. display: flex;
  1544. align-items: center;
  1545. justify-content: center;
  1546. background: rgba(255, 103, 2, 1);
  1547. color: #FFF;
  1548. font-size: 30rpx;
  1549. border-radius: 10rpx;
  1550. }
  1551. .neximg {
  1552. width: 160rpx;
  1553. height: 160rpx;
  1554. margin-right: 20rpx;
  1555. border-radius: 8rpx;
  1556. /* 保持图片等比例缩放,并且不会裁切 */
  1557. }
  1558. .btn-group {
  1559. display: flex;
  1560. justify-content: space-between;
  1561. align-items: center;
  1562. position: relative;
  1563. .btn {
  1564. padding: 0 20rpx;
  1565. box-sizing: border-box;
  1566. font-size: $font-size-sm;
  1567. height: 44rpx;
  1568. line-height: 44rpx;
  1569. &.property_btn {
  1570. border-radius: 24rpx;
  1571. }
  1572. &.add_btn,
  1573. &.reduce_btn {
  1574. padding: 0;
  1575. width: 44rpx;
  1576. border-radius: 44rpx;
  1577. }
  1578. }
  1579. .dot {
  1580. position: absolute;
  1581. background-color: #ffffff;
  1582. border: 1px solid $bg-color-primary;
  1583. color: $bg-color-primary;
  1584. font-size: $font-size-sm;
  1585. width: 36rpx;
  1586. height: 36rpx;
  1587. line-height: 36rpx;
  1588. text-align: center;
  1589. border-radius: 100%;
  1590. right: -12rpx;
  1591. top: -10rpx;
  1592. }
  1593. .number {
  1594. width: 44rpx;
  1595. height: 44rpx;
  1596. line-height: 44rpx;
  1597. text-align: center;
  1598. }
  1599. }
  1600. .nexbox-txt3 {
  1601. color: $bg-color-primary;
  1602. }
  1603. .mode-box {
  1604. width: 100%;
  1605. display: flex;
  1606. flex-direction: column;
  1607. gap: 20rpx;
  1608. padding: 30rpx;
  1609. box-sizing: border-box;
  1610. }
  1611. .items {
  1612. display: flex;
  1613. flex-direction: column;
  1614. padding-bottom: -30rpx;
  1615. .good {
  1616. display: flex;
  1617. align-items: center;
  1618. margin-bottom: 30rpx;
  1619. .image {
  1620. width: 160rpx;
  1621. height: 160rpx;
  1622. margin-right: 20rpx;
  1623. border-radius: 8rpx;
  1624. }
  1625. .right {
  1626. flex: 1;
  1627. // height: 160rpx;
  1628. overflow: hidden;
  1629. display: flex;
  1630. flex-direction: column;
  1631. align-items: flex-start;
  1632. justify-content: space-between;
  1633. padding-right: 14rpx;
  1634. .name {
  1635. font-size: $font-size-base;
  1636. margin-bottom: 10rpx;
  1637. }
  1638. .tips {
  1639. width: 100%;
  1640. height: 40rpx;
  1641. line-height: 40rpx;
  1642. overflow: hidden;
  1643. text-overflow: ellipsis;
  1644. white-space: nowrap;
  1645. font-size: $font-size-sm;
  1646. color: $text-color-assist;
  1647. margin-bottom: 10rpx;
  1648. }
  1649. .price_and_action {
  1650. width: 100%;
  1651. display: flex;
  1652. justify-content: space-between;
  1653. align-items: center;
  1654. .price {
  1655. font-size: $font-size-base;
  1656. font-weight: 600;
  1657. color: $bg-color-primary;
  1658. }
  1659. .btn-group {
  1660. display: flex;
  1661. justify-content: space-between;
  1662. align-items: center;
  1663. position: relative;
  1664. .btn {
  1665. padding: 0 20rpx;
  1666. box-sizing: border-box;
  1667. font-size: $font-size-sm;
  1668. height: 44rpx;
  1669. line-height: 44rpx;
  1670. &.property_btn {
  1671. border-radius: 24rpx;
  1672. }
  1673. &.add_btn,
  1674. &.reduce_btn {
  1675. padding: 0;
  1676. width: 44rpx;
  1677. border-radius: 44rpx;
  1678. }
  1679. }
  1680. .dot {
  1681. position: absolute;
  1682. background-color: #ffffff;
  1683. border: 1px solid $bg-color-primary;
  1684. color: $bg-color-primary;
  1685. font-size: $font-size-sm;
  1686. width: 36rpx;
  1687. height: 36rpx;
  1688. line-height: 36rpx;
  1689. text-align: center;
  1690. border-radius: 100%;
  1691. right: -12rpx;
  1692. top: -10rpx;
  1693. }
  1694. .number {
  1695. width: 44rpx;
  1696. height: 44rpx;
  1697. line-height: 44rpx;
  1698. text-align: center;
  1699. }
  1700. }
  1701. }
  1702. }
  1703. }
  1704. }
  1705. .mode-clear {
  1706. padding: 30rpx;
  1707. box-sizing: border-box;
  1708. position: sticky;
  1709. z-index: 99;
  1710. top: 0;
  1711. display: flex;
  1712. justify-content: space-between;
  1713. align-items: center;
  1714. background: #FFF;
  1715. border-bottom: 1px solid burlywood;
  1716. }
  1717. .mode-txt {
  1718. display: flex;
  1719. align-items: center;
  1720. gap: 8rpx;
  1721. }
  1722. .mode-txt1 {
  1723. font-weight: 500;
  1724. font-size: 32rpx;
  1725. }
  1726. // 点菜评价切换
  1727. .let-box {
  1728. display: flex;
  1729. align-items: center;
  1730. gap: 60rpx;
  1731. padding: 20rpx;
  1732. box-sizing: border-box;
  1733. }
  1734. .let-box1 {
  1735. display: flex;
  1736. flex-direction: column;
  1737. align-items: center;
  1738. justify-content: center;
  1739. gap: 10rpx;
  1740. }
  1741. .let-line {
  1742. border-radius: 6rpx;
  1743. width: 40rpx;
  1744. height: 10rpx;
  1745. }
  1746. .let-txt {
  1747. overflow-wrap: break-word;
  1748. color: rgba(20, 20, 20, 1);
  1749. font-size: 28rpx;
  1750. font-weight: normal;
  1751. text-align: left;
  1752. white-space: nowrap;
  1753. line-height: 40rpx;
  1754. }
  1755. .actave {
  1756. background-color: rgba(255, 103, 2, 1);
  1757. }
  1758. .actave1 {
  1759. color: rgba(255, 103, 2, 1);
  1760. }
  1761. .font_color {
  1762. color: $bg-color-primary;
  1763. }
  1764. .evaluate-list {
  1765. padding: 30rpx 0 0 0;
  1766. background-color: #fff;
  1767. }
  1768. .evaluate-list .nav-tab1 {
  1769. font-size: 24rpx;
  1770. color: #282828;
  1771. padding: 30rpx;
  1772. background-color: #fff;
  1773. border-bottom: 1rpx solid #f5f5f5;
  1774. }
  1775. .evaluate-list .generalComment {
  1776. padding: 0 30rpx;
  1777. margin-top: 1rpx;
  1778. background-color: #fff;
  1779. font-size: 28rpx;
  1780. color: #808080;
  1781. }
  1782. .evaluate-list .generalComment .evaluate {
  1783. margin-right: 7rpx;
  1784. color: #333333;
  1785. font-size: 28rpx;
  1786. }
  1787. .evaluate-list .nav-tab1 .item {
  1788. font-size: 24rpx;
  1789. color: #282828;
  1790. border-radius: 27rpx;
  1791. height: 54rpx;
  1792. padding: 0 20rpx;
  1793. background-color: #f4f4f4;
  1794. line-height: 54rpx;
  1795. margin-right: 17rpx;
  1796. }
  1797. .evaluate-list .nav-tab1 .item.bg-color {
  1798. color: #fff;
  1799. background-color: $bg-color-primary;
  1800. }
  1801. .noCommodity {
  1802. margin-top: 32%;
  1803. }
  1804. .default_txt {
  1805. font-size: 26rpx;
  1806. color: #999;
  1807. text-align: center;
  1808. }
  1809. </style>