index.vue 48 KB

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