index.vue 47 KB

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