menu.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504
  1. <template>
  2. <view class="u-wrap">
  3. <login ref="login" @signIn="signIn"></login>
  4. <view class="u-search-box">
  5. <view class="nav" >
  6. <view class="header">
  7. <view class="left overflow-hidden">
  8. <view class="flex align-center overflow-hidden" v-if="takeType == takeTypeGlobal.delivery">
  9. <image src="/pagesD/static/icon/location1.png" style="width: 30rpx; height: 30rpx;"
  10. class="margin-right-10">
  11. </image>
  12. <text v-if="$isEmpty(vuex_userId)" @tap="showLogin">去登录</text>
  13. <view class="" v-else @click="$jump('/pagesD/pages/address/address')">
  14. <text v-if="$isEmpty(address)">请完善地址信息</text>
  15. <view style="margin-right: 20rpx;" v-else >
  16. <text class="text-cut-1">{{address.address}}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="flex align-center overflow-hidden" v-else>
  21. <image src="/pagesD/static/icon/shop2.png" style="width: 30rpx; height: 30rpx;"
  22. class="margin-right-10">
  23. </image>
  24. <text style="font-size: 36rpx;font-weight: 800;">杨国福麻辣烫</text>
  25. </view>
  26. </view>
  27. <view @click="modalCheckedShow" class="cu-btn round bg-red sm" style="font-size: 24rpx;">
  28. <text class="center">{{takeType.substring(2,4)}}</text>
  29. <text class="cuIcon-order center text-bold" style="transform: rotate(90deg);margin-left: 6rpx;"></text>
  30. </view>
  31. </view>
  32. <view class="bg-white">
  33. <u-notice-bar mode="horizontal" :list="appProperties.shopNotice"></u-notice-bar>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="u-menu-wrap">
  38. <scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view" :scroll-top="scrollTop"
  39. :scroll-into-view="itemId">
  40. <view v-for="(item,index) in goods" :key="index" class="u-tab-item"
  41. :class="[current == index ? 'u-tab-item-active' : '']" @tap.stop="swichMenu(index)">
  42. <text class="u-line-1">{{item.goodsCategoryName}}</text>
  43. </view>
  44. </scroll-view>
  45. <scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box"
  46. @scroll="rightScroll">
  47. <view class="page-view">
  48. <view class="class-item" :id="'item' + index" v-for="(item , index) in goods" :key="index">
  49. <view class="item-title" >
  50. <text>{{item.goodsCategoryName}}</text>
  51. </view>
  52. <view class="item-container" >
  53. <view class="thumb-box" v-for="(goods, index1) in item.goodsList" :key="index1">
  54. <image class="item-menu-image" :src="goods.image" mode=""></image>
  55. <view class="item-content" >
  56. <view class="name">{{goods.name}}</view>
  57. <view class="tips">
  58. {{ goods.description && goods.description != '' ? goods.description : goods.name }}
  59. </view>
  60. <view class="price_and_action">
  61. <text class="price">¥{{ goods.defaultPrice / 100 }}</text>
  62. <!-- 商品没有下架 -->
  63. <view v-if="goods.isSell">
  64. <!-- 要选商品规格详细信息 -->
  65. <view class="btn-group"
  66. v-if="goods.goodsPropertyVos && goods.goodsPropertyVos.length">
  67. <button type="primary" class="btn property_btn" hover-class="none"
  68. size="mini" @tap="showGoodDetailModal(goods)">
  69. 选规格
  70. </button>
  71. <view class="dot" v-show="goodsCartNum(goods.id)">
  72. {{ goodsCartNum(goods.id) }}
  73. </view>
  74. </view>
  75. <!-- 可以直接添加,不用选择商品属性 -->
  76. <view class="btn-group" v-else>
  77. <button type="default" v-show="goodsCartNum(goods.id)" plain
  78. class="btn reduce_btn" size="mini" hover-class="none"
  79. @tap="handleReduceFromCart(goods)">
  80. <view class="iconfont iconsami-select"></view>
  81. </button>
  82. <view class="number" v-show="goodsCartNum(goods.id)">
  83. {{ goodsCartNum(goods.id) }}
  84. </view>
  85. <button type="primary" class="btn add_btn" size="min" hover-class="none"
  86. @tap="handleAddToCart(goods)">
  87. <view class="iconfont iconadd-select"></view>
  88. </button>
  89. </view>
  90. </view>
  91. <!-- 已经下架了 -->
  92. <view v-else>
  93. <view class="btn-group">
  94. <button type="primary" disabled class="btn property_btn"
  95. style="text-decoration: line-through;background-color: rgba(255, 148, 71,.6);" size="mini">
  96. 已售空
  97. </button>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </scroll-view>
  107. <view class="">
  108. <!-- 购物车栏 begin -->
  109. <view class="cart-box" v-if="cart && cart.length">
  110. <view class="mark" @tap="cartPopupVisible = !cartPopupVisible">
  111. <image src="/pagesD/static/icon/cart1.png" class="cart-img"></image>
  112. <view class="tag">{{ getCartGoodsNumber }}</view>
  113. </view>
  114. <view class="price" @tap="cartPopupVisible = !cartPopupVisible">¥{{ getCartGoodsPrice / 100 }}</view>
  115. <view v-if="!appProperties.shopStatus"><button type="primary" class="pay-btn" disabled>商家休息中</button>
  116. </view>
  117. <view v-else-if="isBusinessTime">
  118. <button :style="!disabledPay?'background-color: #FF9447;':''" type="primary" class="pay-btn" @tap="toPay()"
  119. :disabled="disabledPay">{{ disabledPay ? `差${spread / 100}元起送` : '去结算' }}</button>
  120. </view>
  121. <view v-else><button type="primary" class="pay-btn" disabled>未在营业时段</button></view>
  122. </view>
  123. <!-- 购物车栏 end -->
  124. <!-- 商品详情模态框 begin -->
  125. <modal :show="goodDetailModalVisible" class="good-detail-modal" color="#5A5B5C" width="90%" custom
  126. padding="0rpx" radius="12rpx">
  127. <view class="cover">
  128. <image v-if="currentGoods.image" :src="currentGoods.image" class="image"></image>
  129. <view class="btn-group">
  130. <image src="/pagesD/static/icon/close.png" @tap="closeGoodDetailModal"></image>
  131. </view>
  132. </view>
  133. <scroll-view class="detail" scroll-y style="padding-bottom: 100px;">
  134. <view class="wrapper">
  135. <view class="basic">
  136. <view class="name">{{ currentGoods.name }}</view>
  137. <view class="tips">{{ currentGoods.description }}</view>
  138. </view>
  139. <!-- 商品的额外属性 -->
  140. <view class="properties"
  141. v-if="currentGoods.goodsPropertyVos && currentGoods.goodsPropertyVos.length">
  142. <view class="property" v-for="(goodsPropertyVo, index) in currentGoods.goodsPropertyVos"
  143. :key="index">
  144. <view class="title">
  145. <text class="name">
  146. <text v-if="goodsPropertyVo.required" style="color: red">*</text>
  147. {{ goodsPropertyVo.category }}
  148. </text>
  149. </view>
  150. <view class="values">
  151. <view class="value" v-for="(property, index2) in goodsPropertyVo.propertyList"
  152. :key="index2" :class="{ default: property.isDefault }"
  153. @tap="changePropertyDefault(index, index2)">
  154. {{ property.propertyOption }}
  155. {{ property.rebasePrice && property.rebasePrice >=0 ? '¥' + property.rebasePrice / 100 : property.extraPrice / 100 ? '¥' + property.extraPrice / 100 : '' }}
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. </scroll-view>
  162. <view class="action">
  163. <!-- 价格和属性 -->
  164. <view class="left">
  165. <view class="price">¥{{ currentGoods.realPrice / 100 }}</view>
  166. <view class="props" v-if="getGoodSelectedProps(currentGoods)">
  167. {{ getGoodSelectedProps(currentGoods) }}
  168. </view>
  169. </view>
  170. <!-- 模态窗里面增减商品 -->
  171. <view class="btn-group">
  172. <button type="default" plain class="btn" size="mini" hover-class="none"
  173. @tap="changeCurrentGoodsNumber(-1)">
  174. <view class="iconfont iconsami-select"></view>
  175. </button>
  176. <view class="number">{{ currentGoods.number }}</view>
  177. <button type="primary" class="btn" size="min" hover-class="none" @tap="changeCurrentGoodsNumber(1)">
  178. <view class="iconfont iconadd-select"></view>
  179. </button>
  180. </view>
  181. </view>
  182. <view class="add-to-cart-btn" @tap="addCurrentGoodsToCart()">
  183. <view>确认</view>
  184. </view>
  185. </modal>
  186. <!-- 商品详情模态框 end -->
  187. <!-- 购物车详情popup -->
  188. <u-popup z-index="99" v-model="cartPopupVisible" mode="bottom">
  189. <view class="cart-popup">
  190. <view class="top"><text @tap="handleCartClear">清空</text></view>
  191. <scroll-view class="cart-list" scroll-y>
  192. <view class="wrapper">
  193. <view class="item" v-for="(goods, index) in cart" :key="index">
  194. <view class="left">
  195. <view class="name">{{ goods.name }}</view>
  196. <view class="props">{{ getGoodSelectedProps(goods) }}</view>
  197. </view>
  198. <view class="center">
  199. <text>¥{{ goods.realPrice / 100 }}</text>
  200. </view>
  201. <view class="right">
  202. <!-- 购物车里添加数量 -->
  203. <button type="default" plain size="mini" class="btn" hover-class="none"
  204. @tap="handleCartItemReduce(index)">
  205. <view class="iconfont iconsami-select"></view>
  206. </button>
  207. <view class="number">{{ goods.number }}</view>
  208. <!-- 购物车里减少数量 -->
  209. <button type="primary" class="btn" size="min" hover-class="none"
  210. @tap="handleCartItemAdd(index)">
  211. <view class="iconfont iconadd-select"></view>
  212. </button>
  213. </view>
  214. </view>
  215. <view class="item" v-if="takeType == takeTypeGlobal.package">
  216. <view class="left">
  217. <view class="name">包装费</view>
  218. </view>
  219. <view class="center">
  220. <text>¥{{ appProperties.packingPrice / 100 }}</text>
  221. </view>
  222. </view>
  223. <view class="item" v-if="takeType == takeTypeGlobal.delivery">
  224. <view class="left">
  225. <view class="name">包装费</view>
  226. </view>
  227. <view class="center">
  228. <text>¥{{ appProperties.packingPrice / 100 }}</text>
  229. </view>
  230. <view class="left">
  231. <view class="name">配送费</view>
  232. </view>
  233. <view class="center">
  234. <text>¥{{ appProperties.sendingPrice / 100 }}</text>
  235. </view>
  236. </view>
  237. </view>
  238. </scroll-view>
  239. </view>
  240. </u-popup>
  241. <!-- 购物车详情popup -->
  242. <modal-checked @confirm="modalConfirm" ref="modalChecked" :list="checkList"></modal-checked>
  243. <login ref="login" @signIn="signIn"></login>
  244. </view>
  245. </view>
  246. </view>
  247. </template>
  248. <script>
  249. import login from "../../comps/login.vue"
  250. import modal from '../../comps/modal/modal.vue';
  251. import modalChecked from "../../comps/modal-checked.vue"
  252. import popupLayer from '../../comps/popup-layer/popup-layer.vue';
  253. import global from "@/assets/http/global.js"
  254. let _this = this
  255. export default {
  256. components: {
  257. modal,
  258. popupLayer,
  259. login,
  260. modalChecked
  261. },
  262. data() {
  263. return {
  264. shopId:'',
  265. address: {},
  266. cart: [],
  267. takeType: "店内堂食",
  268. takeTypeGlobal:global.takeType,
  269. appProperties: {
  270. "shopName": "杨国福麻辣烫",
  271. "sendingPrice": 100, // 商家配送费
  272. "packingPrice": 100, // 包装费
  273. "sendingNeedLeastPrice": 2000, // 起送需要的最低价格
  274. "businessStartTime": '09:00:00', // 营业开始时间, 开始的点必须在结束之前
  275. "businessEndTime": '22:00:00', // 营业结束时间
  276. "shopStatus": true, // 商家营业状态
  277. "shopNotice": ['10点到22点可以送餐~'], // 公告
  278. },
  279. goods: {},
  280. currentCategoryName: '', // 默认分类
  281. goodDetailModalVisible: false, //是否饮品详情模态框
  282. currentGoods: {}, // 当前商品
  283. selectedPropertyList: [], // 当前商品的属性
  284. cartPopupVisible: false,
  285. /**
  286. * uview菜单begin
  287. */
  288. scrollTop: 0, //tab标题的滚动条位置
  289. oldScrollTop: 0,
  290. current: 0, // 预设当前项的值
  291. menuHeight: 0, // 左边菜单的高度
  292. menuItemHeight: 0, // 左边菜单item的高度
  293. itemId: '', // 栏目右边scroll-view用于滚动的id
  294. goods: [],
  295. menuItemPos: [],
  296. arr: [],
  297. scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
  298. timer: null, // 定时器
  299. /**
  300. * u-view菜单end
  301. */
  302. checkList:[
  303. {
  304. name:global.takeType.dine_in,
  305. icon:"/pagesD/static/icon/order.png",
  306. },
  307. {
  308. name:global.takeType.package,
  309. icon:"/pagesD/static/icon/pickup.png",
  310. },
  311. {
  312. name:global.takeType.delivery,
  313. icon:"/pagesD/static/icon/delivery2.png",
  314. }
  315. ]
  316. }
  317. },
  318. onLoad(options) {
  319. _this = this
  320. if (!options.shopId) {
  321. this.$dialog.showModalAndBack('系统错误')
  322. return
  323. }
  324. this.shopId=options.shopId
  325. this.init()
  326. },
  327. onShow() {
  328. this.address = this.$util.getBackParams('addressData')
  329. if (this.$isEmpty(this.address)) {
  330. this.fetchAddress()
  331. }
  332. },
  333. onReady() {
  334. this.getMenuItemTop()
  335. },
  336. computed: {
  337. isBusinessTime:{
  338. get(){
  339. return this.timeRange(this.appProperties.businessStartTime,this.appProperties.businessEndTime)
  340. }
  341. },
  342. // 计算单个饮品添加到购物车的数量
  343. goodsCartNum() {
  344. return id =>
  345. this.cart.reduce((acc, cur) => {
  346. if (cur.id === id) {
  347. return (acc += cur.number);
  348. }
  349. return acc;
  350. }, 0);
  351. },
  352. // 计算该类商品的购买总数
  353. menuCartNum() {
  354. return goodsCategoryName =>
  355. this.cart.reduce((acc, cur) => {
  356. if (cur.goodsCategoryName === goodsCategoryName) {
  357. return (acc += cur.number);
  358. }
  359. return acc;
  360. }, 0);
  361. },
  362. // 计算购物车总数
  363. getCartGoodsNumber() {
  364. return this.cart.reduce((acc, cur) => acc + cur.number, 0);
  365. },
  366. // 计算购物车总价,
  367. getCartGoodsPrice() {
  368. let totalPrice = 0;
  369. this.cart.forEach(goods => {
  370. totalPrice += goods.realPrice * goods.number;
  371. });
  372. //如果是到店自取,要计算包装费
  373. if (this.takeType == this.takeTypeGlobal.package) {
  374. totalPrice += this.appProperties.packingPrice
  375. }
  376. //如果是商家配送,要计算配送费和包装费
  377. if (this.takeType == this.takeTypeGlobal.delivery) {
  378. totalPrice += this.appProperties.packingPrice + this.appProperties.sendingPrice;
  379. }
  380. return totalPrice;
  381. }, // 是否达到起送价
  382. disabledPay() {
  383. return this.takeType == this.takeTypeGlobal.delivery && this.getCartGoodsPrice < this.appProperties
  384. .sendingNeedLeastPrice ? true : false;
  385. }, // 差多少元起送
  386. spread() {
  387. if (this.takeType != this.takeTypeGlobal.delivery) return;
  388. return this.appProperties.sendingNeedLeastPrice - this.getCartGoodsPrice;
  389. }
  390. },
  391. watch: {
  392. cart: {
  393. handler: (newV, oldV) => {
  394. _this.putCart()
  395. },
  396. deep: true,
  397. }
  398. },
  399. methods: {
  400. modalCheckedShow(){
  401. this.$refs.modalChecked.showModal()
  402. },
  403. timeRange(beginTime, endTime) {//判断是否在缴费查询时间
  404. var strb = beginTime.split (":");
  405. if (strb.length != 3) {
  406. return false;
  407. }
  408. var stre = endTime.split (":");
  409. if (stre.length != 3) {
  410. return false;
  411. }
  412. var b = new Date ();
  413. var e = new Date ();
  414. var n = new Date ();
  415. if (parseInt(strb[0])>=parseInt(stre[0])) {
  416. b.setDate(b.getDate() - 1)
  417. }
  418. console.log(b,",,,");
  419. console.log(e,",,,");
  420. console.log(n,",,,");
  421. b.setHours (strb[0]);
  422. b.setMinutes (strb[1]);
  423. b.setSeconds(strb[2]);
  424. e.setHours (stre[0]);
  425. e.setMinutes (stre[1]);
  426. e.setSeconds(stre[2]);
  427. if (n.getTime () - b.getTime () > 0 && n.getTime () - e.getTime () < 0) {
  428. return true;
  429. } else {
  430. return false;
  431. }
  432. },
  433. //页面初始化
  434. async init() {
  435. this.initMenu()
  436. this.initCart()
  437. },
  438. initMenu(){
  439. this.$api.goods.menu({
  440. shopId: this.shopId
  441. }).then(res => {
  442. this.goods = res.data;
  443. })
  444. },
  445. //初始化购物车
  446. initCart() {
  447. this.cartKey = this.$global.cart_prefix + this.shopId
  448. if (!this.$isEmpty(this.$cache.get(this.cartKey))) {
  449. this.cart = this.$cache.get(this.cartKey)
  450. }
  451. },
  452. putCart() {
  453. this.$cache.put(this.cartKey, this.cart)
  454. },
  455. modalConfirm(index){
  456. this.takeType=this.checkList[index].name
  457. if (this.takeType==this.takeTypeGlobal.delivery) {
  458. this.takeout()
  459. }
  460. },
  461. // 选择商家配送的方式下单
  462. takeout() {
  463. if (this.$isEmpty(this.vuex_userId)) {
  464. this.showLogin()
  465. return
  466. }
  467. if (this.$isEmpty(this.address) && this.$isNotEmpty(this.vuex_userId)) {
  468. uni.navigateTo({
  469. url:"../address/address"
  470. })
  471. }
  472. },
  473. // 显示当前商品的详情信息
  474. showGoodDetailModal(currentGoods) {
  475. currentGoods.number = 1;
  476. currentGoods.realPrice = this.getGoodsRealPrice(currentGoods);
  477. currentGoods.propertyStr = this.getGoodSelectedProps(currentGoods);
  478. this.currentGoods = JSON.parse(JSON.stringify(currentGoods)); // 深拷贝
  479. this.goodDetailModalVisible = true;
  480. this.selectedPropertyList = [];
  481. console.log('显示当前商品的详情信息', this.currentGoods);
  482. },
  483. // 获取商品具体价格,如大杯商品,小杯商品价格不同
  484. getGoodsRealPrice(goods) {
  485. console.log(goods);
  486. let realPrice = goods.realPrice;
  487. if (goods.goodsPropertyVos && goods.goodsPropertyVos.length) {
  488. let vos = goods.goodsPropertyVos;
  489. for (let i = 0; i < vos.length; i++) {
  490. let propertyList = vos[i].propertyList;
  491. for (let j = 0; j < propertyList.length; j++) {
  492. if (propertyList[j].isDefault && propertyList[j].realPrice) {
  493. realPrice = propertyList[j].realPrice;
  494. break;
  495. }
  496. }
  497. }
  498. }
  499. return realPrice;
  500. },
  501. // 显示当前商品的详情信息
  502. showGoodDetailModal(currentGoods) {
  503. currentGoods.number = 1;
  504. currentGoods.realPrice = this.getGoodsRealPrice(currentGoods);
  505. currentGoods.propertyStr = this.getGoodSelectedProps(currentGoods);
  506. this.currentGoods = JSON.parse(JSON.stringify(currentGoods)); // 深拷贝
  507. this.goodDetailModalVisible = true;
  508. this.selectedPropertyList = [];
  509. console.log('显示当前商品的详情信息', this.currentGoods);
  510. },
  511. closeGoodDetailModal() {
  512. // 关闭饮品详情模态框
  513. this.goodDetailModalVisible = false;
  514. },
  515. // 改变商品的某个默认属性值 要区分必选和多选的属性
  516. changePropertyDefault(categoryIndex, propertyIndex) {
  517. let propertyCategory = this.currentGoods.goodsPropertyVos[categoryIndex].category;
  518. let propertyList = this.currentGoods.goodsPropertyVos[categoryIndex].propertyList;
  519. if (propertyCategory != '加料') {
  520. // 必须选一个
  521. propertyList.forEach(property => (property.isDefault = false)); // 重置所有默认选择状态重新选择
  522. propertyList[propertyIndex].isDefault = true;
  523. if (propertyCategory == '大小') {
  524. this.currentGoods.realPrice = this.currentGoods.realPrice - this.currentGoods.defaultPrice +
  525. propertyList[propertyIndex].rebasePrice;
  526. this.currentGoods.defaultPrice = propertyList[propertyIndex].rebasePrice;
  527. this.currentGoods.number = 1;
  528. this.currentGoods.propertyStr = this.getGoodSelectedProps(this.currentGoods);
  529. }
  530. } else {
  531. // 可选项 加料或减料
  532. if (propertyList[propertyIndex].isDefault) {
  533. this.currentGoods.realPrice -= propertyList[propertyIndex].extraPrice;
  534. propertyList[propertyIndex].isDefault = false;
  535. } else {
  536. this.currentGoods.realPrice += propertyList[propertyIndex].extraPrice;
  537. propertyList[propertyIndex].isDefault = true;
  538. }
  539. }
  540. },
  541. // 计算当前饮品所选属性,空格隔开
  542. getGoodSelectedProps(goods) {
  543. if (goods.goodsPropertyVos) {
  544. let propertyStr = '';
  545. goods.goodsPropertyVos.forEach(goodsPropertyVo => {
  546. goodsPropertyVo.propertyList.forEach(property => {
  547. if (property.isDefault) {
  548. propertyStr += property.propertyOption + ' ';
  549. }
  550. });
  551. });
  552. return propertyStr;
  553. }
  554. return '';
  555. },
  556. // 改变当前商品数量
  557. changeCurrentGoodsNumber(number) {
  558. this.currentGoods.number += number;
  559. if (this.currentGoods.number < 0) {
  560. this.currentGoods.number = 0;
  561. } else if (this.currentGoods.number >= 100) {
  562. this.currentGoods.number = 100;
  563. }
  564. },
  565. // 将当前商品加入到购物车
  566. addCurrentGoodsToCart() {
  567. if (this.currentGoods && this.currentGoods.number) {
  568. this.handleAddToCart(this.currentGoods);
  569. }
  570. this.closeGoodDetailModal();
  571. },
  572. // 减少购物车里的商品数量, goodsId和propertyStr去比较
  573. handleReduceFromCart(goods) {
  574. let propertyStr = this.getGoodSelectedProps(goods);
  575. let cart = this.cart;
  576. for (let i = cart.length - 1; i >= 0; i--) {
  577. if (cart[i].id == goods.id && cart[i].propertyStr == propertyStr) {
  578. if (cart[i].number <= 1) cart.splice(i, 1);
  579. else cart[i].number -= 1;
  580. return;
  581. }
  582. }
  583. },
  584. // 添加到购物车
  585. handleAddToCart(goods) {
  586. let propertyStr = this.getGoodSelectedProps(goods);
  587. goods.propertyStr = propertyStr;
  588. let cart = this.cart;
  589. for (let i = cart.length - 1; i >= 0; i--) {
  590. if (cart[i].id == goods.id && cart[i].propertyStr == propertyStr) {
  591. cart[i].number++;
  592. return;
  593. }
  594. }
  595. // 购物车里不存在
  596. if (!goods.number) goods.number = 1;
  597. this.cart.push(JSON.parse(JSON.stringify(goods)));
  598. },
  599. // 清空购物车
  600. handleCartClear() {
  601. let that = this;
  602. uni.showModal({
  603. title: '提示',
  604. content: '确定清空购物车么',
  605. success: ({
  606. confirm
  607. }) => {
  608. if (confirm) {
  609. that.cartPopupVisible = false;
  610. this.cart = []
  611. }
  612. }
  613. });
  614. },
  615. // 在购物车里操作商品数量
  616. handleCartItemAdd(index) {
  617. this.cart[index].number += 1;
  618. },
  619. handleCartItemReduce(index) {
  620. if (this.cart[index].number === 1) {
  621. this.cart.splice(index, 1);
  622. } else {
  623. this.cart[index].number -= 1;
  624. }
  625. if (!this.cart.length) {
  626. this.cartPopupVisible = false;
  627. }
  628. },
  629. toPay() {
  630. this.cartPopupVisible = false;
  631. if (this.$isEmpty(this.vuex_userId)) {
  632. this.showLogin()
  633. return
  634. }
  635. let orderInfo={
  636. shopId:this.shopId,
  637. cart:this.cart,
  638. cartKey:this.cartKey,
  639. takeType:this.takeType,
  640. address:this.address,
  641. store:this.appProperties,
  642. address:this.address
  643. }
  644. this.$u.vuex('vuex_orderInfo',orderInfo)
  645. uni.navigateTo({
  646. url: '../pay/pay'
  647. })
  648. },
  649. fetchAddress(){
  650. if (this.$isEmpty(this.vuex_userId)) {
  651. return
  652. }
  653. let params={
  654. userId:this.vuex_userId,
  655. isDefault:true
  656. }
  657. this.$api.address.list(params).then(res=>{
  658. this.address=res.data.records[0]
  659. })
  660. },
  661. // 登录 begin
  662. showLogin(){
  663. this.$refs.login.show()
  664. },
  665. showPhoneModal(){
  666. this.$refs.login.showPhoneModal()
  667. },
  668. signIn(resp){
  669. //获取手机号
  670. if (this.$isEmpty(this.vuex_phone)) {
  671. this.showPhoneModal()
  672. }
  673. this.$u.toast('登录成功')
  674. this.fetchAddress()
  675. },
  676. async login(e){
  677. if (this.$isEmpty(this.vuex_userId)) {
  678. this.showLogin()
  679. return
  680. }else{
  681. this.userInfo=this.$cache.get('userInfo')
  682. }
  683. //获取手机号
  684. if (this.$isEmpty(this.vuex_phone)) {
  685. this.showPhoneModal()
  686. }
  687. },
  688. // 登录 end
  689. /**
  690. * u-view 菜单栏 begin
  691. *
  692. */
  693. async swichMenu(index) {
  694. if (this.arr.length == 0) {
  695. await this.getMenuItemTop();
  696. }
  697. if (index == this.current) return;
  698. this.scrollRightTop = this.oldScrollTop;
  699. this.$nextTick(function() {
  700. this.scrollRightTop = this.arr[index];
  701. this.current = index;
  702. this.leftMenuStatus(index);
  703. })
  704. },
  705. // 获取一个目标元素的高度
  706. getElRect(elClass, dataVal) {
  707. new Promise((resolve, reject) => {
  708. const query = uni.createSelectorQuery().in(this);
  709. query.select('.' + elClass).fields({
  710. size: true
  711. }, res => {
  712. // 如果节点尚未生成,res值为null,循环调用执行
  713. if (!res) {
  714. setTimeout(() => {
  715. this.getElRect(elClass);
  716. }, 10);
  717. return;
  718. }
  719. this[dataVal] = res.height;
  720. resolve();
  721. }).exec();
  722. })
  723. },
  724. // 观测元素相交状态
  725. async observer() {
  726. this.goods.map((val, index) => {
  727. let observer = uni.createIntersectionObserver(this);
  728. // 检测右边scroll-view的id为itemxx的元素与right-box的相交状态
  729. // 如果跟.right-box底部相交,就动态设置左边栏目的活动状态
  730. observer.relativeTo('.right-box', {
  731. top: 0
  732. }).observe('#item' + index, res => {
  733. if (res.intersectionRatio > 0) {
  734. let id = res.id.substring(4);
  735. this.leftMenuStatus(id);
  736. }
  737. })
  738. })
  739. },
  740. // 设置左边菜单的滚动状态
  741. async leftMenuStatus(index) {
  742. this.current = index;
  743. // 如果为0,意味着尚未初始化
  744. if (this.menuHeight == 0 || this.menuItemHeight == 0) {
  745. await this.getElRect('menu-scroll-view', 'menuHeight');
  746. await this.getElRect('u-tab-item', 'menuItemHeight');
  747. }
  748. // 将菜单活动item垂直居中
  749. this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
  750. },
  751. // 获取右边菜单每个item到顶部的距离
  752. getMenuItemTop() {
  753. new Promise(resolve => {
  754. let selectorQuery = uni.createSelectorQuery();
  755. selectorQuery.selectAll('.class-item').boundingClientRect((rects) => {
  756. // 如果节点尚未生成,rects值为[](因为用selectAll,所以返回的是数组),循环调用执行
  757. if (!rects.length) {
  758. setTimeout(() => {
  759. this.getMenuItemTop();
  760. }, 10);
  761. return;
  762. }
  763. rects.forEach((rect) => {
  764. // 这里减去rects[0].top,是因为第一项顶部可能不是贴到导航栏(比如有个搜索框的情况)
  765. this.arr.push(rect.top - rects[0].top);
  766. resolve();
  767. })
  768. }).exec()
  769. })
  770. },
  771. // 右边菜单滚动
  772. async rightScroll(e) {
  773. this.oldScrollTop = e.detail.scrollTop;
  774. if (this.arr.length == 0) {
  775. await this.getMenuItemTop();
  776. }
  777. if (this.timer) return;
  778. if (!this.menuHeight) {
  779. await this.getElRect('menu-scroll-view', 'menuHeight');
  780. }
  781. setTimeout(() => { // 节流
  782. this.timer = null;
  783. // scrollHeight为右边菜单垂直中点位置
  784. let scrollHeight = e.detail.scrollTop + this.menuHeight / 2;
  785. for (let i = 0; i < this.arr.length; i++) {
  786. let height1 = this.arr[i];
  787. let height2 = this.arr[i + 1];
  788. // 如果不存在height2,意味着数据循环已经到了最后一个,设置左边菜单为最后一项即可
  789. if (!height2 || scrollHeight >= height1 && scrollHeight < height2) {
  790. this.leftMenuStatus(i);
  791. return;
  792. }
  793. }
  794. }, 10)
  795. },
  796. /**
  797. * u-view 菜单栏 end
  798. */
  799. }
  800. }
  801. </script>
  802. <style lang="scss" scoped>
  803. .nav {
  804. width: 100%;
  805. flex-shrink: 0;
  806. display: flex;
  807. flex-direction: column;
  808. .header {
  809. width: 100%;
  810. display: flex;
  811. align-items: center;
  812. justify-content: space-between;
  813. padding: 20rpx;
  814. background-color: #ffffff;
  815. height: 100rpx;
  816. .left {
  817. flex: 1;
  818. display: flex;
  819. flex-direction: column;
  820. .store-name {
  821. display: flex;
  822. justify-content: flex-start;
  823. align-items: center;
  824. font-size: $font-size-lg;
  825. margin-bottom: 10rpx;
  826. .iconfont {
  827. margin-left: 10rpx;
  828. line-height: 100%;
  829. }
  830. }
  831. .store-location {
  832. display: flex;
  833. justify-content: flex-start;
  834. align-items: center;
  835. color: $text-color-assist;
  836. font-size: $font-size-sm;
  837. .iconfont {
  838. vertical-align: middle;
  839. display: table-cell;
  840. color: $color-primary;
  841. line-height: 100%;
  842. }
  843. }
  844. }
  845. .right {
  846. background-color: $bg-color-grey;
  847. border-radius: 38rpx;
  848. display: flex;
  849. align-items: center;
  850. font-size: $font-size-sm;
  851. padding: 0 38rpx;
  852. color: $text-color-assist;
  853. .dinein,
  854. .takeout {
  855. position: relative;
  856. display: flex;
  857. align-items: center;
  858. &.active {
  859. padding: 14rpx 38rpx;
  860. color: #ffffff;
  861. background-color: $color-primary;
  862. border-radius: 38rpx;
  863. }
  864. }
  865. .takeout {
  866. margin-left: 20rpx;
  867. height: 100%;
  868. flex: 1;
  869. padding: 14rpx 0;
  870. }
  871. .dinein.active {
  872. margin-left: -38rpx;
  873. }
  874. .takeout.active {
  875. margin-right: -38rpx;
  876. }
  877. }
  878. }
  879. .coupon {
  880. flex: 1;
  881. width: 100%;
  882. font-size: $font-size-base;
  883. color: $color-primary;
  884. padding: 0 20rpx;
  885. display: flex;
  886. align-items: center;
  887. overflow: hidden;
  888. .title {
  889. flex: 1;
  890. margin-left: 10rpx;
  891. overflow: hidden;
  892. white-space: nowrap;
  893. text-overflow: ellipsis;
  894. }
  895. .iconfont {
  896. line-height: 100%;
  897. }
  898. }
  899. }
  900. .item-container {
  901. display: flex;
  902. flex-wrap: wrap;
  903. .thumb-box {
  904. width: 100%;
  905. display: flex;
  906. padding: 20rpx 0;
  907. border-bottom: 1rpx solid #EEEEEE;
  908. .item-menu-image {
  909. width: 160rpx;
  910. height: 160rpx;
  911. margin-right: 20rpx;
  912. border-radius: 8rpx;
  913. }
  914. .item-content{
  915. width: calc(100% - 180rpx);
  916. }
  917. .name {
  918. font-size: $font-size-base;
  919. margin-bottom: 10rpx;
  920. }
  921. .tips {
  922. width: 100%;
  923. height: 40rpx;
  924. line-height: 40rpx;
  925. overflow: hidden;
  926. text-overflow: ellipsis;
  927. white-space: nowrap;
  928. font-size: $font-size-sm;
  929. color: $text-color-assist;
  930. margin-bottom: 10rpx;
  931. }
  932. .price_and_action {
  933. width: 100%;
  934. display: flex;
  935. justify-content: space-between;
  936. align-items: center;
  937. margin-top: 30rpx;
  938. .price {
  939. font-size: $font-size-base;
  940. font-weight: 600;
  941. }
  942. .btn-group {
  943. display: flex;
  944. justify-content: space-between;
  945. align-items: center;
  946. position: relative;
  947. .btn {
  948. background-color: $base-color;
  949. padding: 0 20rpx;
  950. box-sizing: border-box;
  951. font-size: $font-size-sm;
  952. height: 44rpx;
  953. line-height: 44rpx;
  954. &.property_btn {
  955. border-radius: 24rpx;
  956. }
  957. &.add_btn,
  958. &.reduce_btn {
  959. color: #FFFFFF;
  960. border: $base-color;
  961. padding: 0;
  962. width: 44rpx;
  963. border-radius: 44rpx;
  964. }
  965. }
  966. .dot {
  967. position: absolute;
  968. background-color: #ffffff;
  969. border: 1px solid $color-primary;
  970. color: $color-primary;
  971. font-size: $font-size-sm;
  972. width: 36rpx;
  973. height: 36rpx;
  974. line-height: 36rpx;
  975. text-align: center;
  976. border-radius: 100%;
  977. right: -12rpx;
  978. top: -10rpx;
  979. }
  980. .number {
  981. width: 44rpx;
  982. height: 44rpx;
  983. line-height: 44rpx;
  984. text-align: center;
  985. }
  986. }
  987. }
  988. }
  989. .thumb-box:last-child {
  990. border: none;
  991. }
  992. }
  993. .good-detail-modal {
  994. width: 100%;
  995. height: 100%;
  996. display: flex;
  997. flex-direction: column;
  998. .cover {
  999. height: 320rpx;
  1000. padding: 30rpx 0;
  1001. display: flex;
  1002. justify-content: center;
  1003. align-items: center;
  1004. position: relative;
  1005. .image {
  1006. width: 260rpx;
  1007. height: 260rpx;
  1008. }
  1009. .btn-group {
  1010. position: absolute;
  1011. right: 10rpx;
  1012. top: 30rpx;
  1013. display: flex;
  1014. align-items: center;
  1015. justify-content: space-around;
  1016. image {
  1017. width: 80rpx;
  1018. height: 80rpx;
  1019. }
  1020. }
  1021. }
  1022. .detail {
  1023. width: 100%;
  1024. min-height: 1vh;
  1025. max-height: calc(90vh - 320rpx - 80rpx - 330rpx);
  1026. .wrapper {
  1027. width: 100%;
  1028. height: 100%;
  1029. overflow: hidden;
  1030. .basic {
  1031. padding: 0 20rpx 30rpx;
  1032. display: flex;
  1033. flex-direction: column;
  1034. .name {
  1035. font-size: $font-size-base;
  1036. color: $text-color-base;
  1037. margin-bottom: 10rpx;
  1038. }
  1039. .tips {
  1040. font-size: $font-size-sm;
  1041. color: $text-color-grey;
  1042. }
  1043. }
  1044. .properties {
  1045. width: 100%;
  1046. border-top: 2rpx solid $bg-color-grey;
  1047. padding: 10rpx 30rpx 0;
  1048. display: flex;
  1049. flex-direction: column;
  1050. .property {
  1051. width: 100%;
  1052. display: flex;
  1053. flex-direction: column;
  1054. margin-bottom: 20rpx;
  1055. padding-bottom: -16rpx;
  1056. .title {
  1057. width: 100%;
  1058. display: flex;
  1059. justify-content: flex-start;
  1060. align-items: center;
  1061. margin-bottom: 20rpx;
  1062. .name {
  1063. font-size: 26rpx;
  1064. color: $text-color-base;
  1065. margin-right: 20rpx;
  1066. }
  1067. .desc {
  1068. flex: 1;
  1069. font-size: $font-size-sm;
  1070. color: $color-primary;
  1071. overflow: hidden;
  1072. text-overflow: ellipsis;
  1073. white-space: nowrap;
  1074. }
  1075. }
  1076. .values {
  1077. width: 100%;
  1078. display: flex;
  1079. flex-wrap: wrap;
  1080. .value {
  1081. border-radius: 8rpx;
  1082. background-color: $bg-color-grey;
  1083. padding: 16rpx 30rpx;
  1084. font-size: 26rpx;
  1085. color: $text-color-assist;
  1086. margin-right: 16rpx;
  1087. margin-bottom: 16rpx;
  1088. &.default {
  1089. background-color: $color-primary;
  1090. color: $text-color-white;
  1091. }
  1092. }
  1093. }
  1094. }
  1095. }
  1096. }
  1097. }
  1098. .action {
  1099. display: flex;
  1100. align-items: center;
  1101. justify-content: space-between;
  1102. background-color: $bg-color-grey;
  1103. height: 120rpx;
  1104. padding: 0 26rpx;
  1105. .left {
  1106. flex: 1;
  1107. display: flex;
  1108. flex-direction: column;
  1109. justify-content: center;
  1110. margin-right: 20rpx;
  1111. overflow: hidden;
  1112. .price {
  1113. font-size: $font-size-lg;
  1114. color: $text-color-base;
  1115. }
  1116. .props {
  1117. color: $text-color-assist;
  1118. font-size: 24rpx;
  1119. width: 100%;
  1120. overflow: hidden;
  1121. text-overflow: ellipsis;
  1122. white-space: nowrap;
  1123. }
  1124. }
  1125. .btn-group {
  1126. display: flex;
  1127. align-items: center;
  1128. justify-content: space-around;
  1129. .number {
  1130. font-size: $font-size-base;
  1131. width: 44rpx;
  1132. height: 44rpx;
  1133. line-height: 44rpx;
  1134. text-align: center;
  1135. }
  1136. .btn {
  1137. padding: 0;
  1138. font-size: $font-size-base;
  1139. width: 44rpx;
  1140. height: 44rpx;
  1141. line-height: 44rpx;
  1142. border-radius: 100%;
  1143. }
  1144. }
  1145. }
  1146. .add-to-cart-btn {
  1147. display: flex;
  1148. justify-content: center;
  1149. align-items: center;
  1150. background-color: $color-primary;
  1151. color: $text-color-white;
  1152. font-size: $font-size-base;
  1153. height: 80rpx;
  1154. border-radius: 0 0 12rpx 12rpx;
  1155. }
  1156. }
  1157. .cart-popup {
  1158. .top {
  1159. background-color: #f3ede3;
  1160. color: #ff9447;
  1161. padding: 10rpx 30rpx;
  1162. font-size: 24rpx;
  1163. text-align: right;
  1164. }
  1165. .cart-list {
  1166. background-color: #FFFFFF;
  1167. width: 100%;
  1168. overflow: hidden;
  1169. min-height: 30vh;
  1170. max-height: 70vh;
  1171. margin-bottom: 30rpx;
  1172. .wrapper {
  1173. height: 100%;
  1174. display: flex;
  1175. flex-direction: column;
  1176. padding: 0 30rpx;
  1177. margin-bottom: 156rpx;
  1178. .item {
  1179. display: flex;
  1180. justify-content: space-between;
  1181. align-items: center;
  1182. padding: 30rpx 0;
  1183. position: relative;
  1184. &::after {
  1185. content: ' ';
  1186. position: absolute;
  1187. bottom: 0;
  1188. left: 0;
  1189. width: 100%;
  1190. background-color: $border-color;
  1191. height: 2rpx;
  1192. transform: scaleY(.6);
  1193. }
  1194. .left {
  1195. flex: 1;
  1196. display: flex;
  1197. flex-direction: column;
  1198. overflow: hidden;
  1199. margin-right: 30rpx;
  1200. .name {
  1201. font-size: $font-size-sm;
  1202. color: $text-color-base;
  1203. }
  1204. .props {
  1205. color: $text-color-assist;
  1206. font-size: 24rpx;
  1207. overflow: hidden;
  1208. text-overflow: ellipsis;
  1209. white-space: nowrap;
  1210. }
  1211. }
  1212. .center {
  1213. margin-right: 120rpx;
  1214. font-size: $font-size-base;
  1215. }
  1216. .right {
  1217. display: flex;
  1218. align-items: center;
  1219. justify-content: space-between;
  1220. .btn {
  1221. width: 46rpx;
  1222. height: 46rpx;
  1223. border-radius: 100%;
  1224. padding: 0;
  1225. text-align: center;
  1226. line-height: 46rpx;
  1227. }
  1228. .number {
  1229. font-size: $font-size-base;
  1230. width: 46rpx;
  1231. height: 46rpx;
  1232. text-align: center;
  1233. line-height: 46rpx;
  1234. }
  1235. }
  1236. }
  1237. }
  1238. }
  1239. }
  1240. .cart-box {
  1241. position: fixed;
  1242. bottom: 30rpx;
  1243. left: 30rpx;
  1244. right: 30rpx;
  1245. height: 96rpx;
  1246. border-radius: 48rpx;
  1247. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.2);
  1248. background-color: #FFFFFF;
  1249. display: flex;
  1250. align-items: center;
  1251. justify-content: space-between;
  1252. z-index: 999;
  1253. .cart-img {
  1254. width: 96rpx;
  1255. height: 96rpx;
  1256. position: relative;
  1257. margin-top: -48rpx;
  1258. }
  1259. .pay-btn {
  1260. height: 100%;
  1261. padding: 0 30rpx;
  1262. color: #FFFFFF;
  1263. border-radius: 0 50rpx 50rpx 0;
  1264. display: flex;
  1265. align-items: center;
  1266. background-color: rgba(255, 148, 71,.6);
  1267. font-size: $font-size-base;
  1268. }
  1269. .mark {
  1270. padding-left: 46rpx;
  1271. margin-right: 30rpx;
  1272. position: relative;
  1273. .tag {
  1274. background-color: #FFFFFF;
  1275. color: $base-color;
  1276. border: 1rpx solid $base-color;
  1277. display: flex;
  1278. justify-content: center;
  1279. align-items: center;
  1280. font-size: $font-size-sm;
  1281. position: absolute;
  1282. right: -10rpx;
  1283. top: -50rpx;
  1284. border-radius: 100%;
  1285. padding: 4rpx;
  1286. width: 40rpx;
  1287. height: 40rpx;
  1288. opacity: .9;
  1289. }
  1290. }
  1291. .price {
  1292. flex: 1;
  1293. color: $text-color-base;
  1294. }
  1295. }
  1296. .u-wrap {
  1297. height: calc(100vh);
  1298. /* #ifdef H5 */
  1299. height: calc(100vh - var(--window-top));
  1300. /* #endif */
  1301. display: flex;
  1302. flex-direction: column;
  1303. width: 100%;
  1304. }
  1305. .u-search-box {
  1306. background-color: #FFFFFF;
  1307. }
  1308. .u-menu-wrap {
  1309. width: 100%;
  1310. flex: 1;
  1311. display: flex;
  1312. overflow: hidden;
  1313. }
  1314. .u-search-inner {
  1315. background-color: rgb(234, 234, 234);
  1316. border-radius: 100rpx;
  1317. display: flex;
  1318. align-items: center;
  1319. padding: 10rpx 16rpx;
  1320. }
  1321. .u-search-text {
  1322. font-size: 26rpx;
  1323. color: $u-tips-color;
  1324. margin-left: 10rpx;
  1325. }
  1326. .u-tab-view {
  1327. width: 200rpx;
  1328. height: 100%;
  1329. }
  1330. .u-tab-item {
  1331. height: 110rpx;
  1332. background: #f6f6f6;
  1333. box-sizing: border-box;
  1334. display: flex;
  1335. align-items: center;
  1336. justify-content: center;
  1337. font-size: 26rpx;
  1338. color: #444;
  1339. font-weight: 400;
  1340. line-height: 1;
  1341. }
  1342. .u-tab-item-active {
  1343. position: relative;
  1344. color: #000;
  1345. font-size: 30rpx;
  1346. font-weight: 600;
  1347. background: #fff;
  1348. }
  1349. .u-tab-item-active::before {
  1350. content: "";
  1351. position: absolute;
  1352. border-left: 4px solid $base-color;
  1353. height: 32rpx;
  1354. left: 0;
  1355. top: 39rpx;
  1356. }
  1357. .u-tab-view {
  1358. height: 100%;
  1359. }
  1360. .right-box {
  1361. background-color: rgb(250, 250, 250);
  1362. }
  1363. .page-view {
  1364. margin-bottom: 150rpx;
  1365. background-color: #FFFFFF;
  1366. padding: 16rpx;
  1367. }
  1368. .class-item {
  1369. margin-bottom: 30rpx;
  1370. background-color: #fff;
  1371. border-radius: 8rpx;
  1372. }
  1373. .class-item:first-child{
  1374. margin-bottom: 0rpx;
  1375. }
  1376. .class-item:last-child {
  1377. min-height: 100vh;
  1378. }
  1379. .item-title {
  1380. padding: 20rpx;
  1381. font-size: 26rpx;
  1382. color: $u-main-color;
  1383. font-weight: bold;
  1384. }
  1385. </style>