index.vue 46 KB

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