index.vue 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047
  1. <template>
  2. <view class="hx-store" @touchstart="touchStart">
  3. <hx-navbar
  4. :fixed="true"
  5. :color="['#ffffff','#888888']"
  6. barPlaceholder="hidden"
  7. transparent="auto"
  8. :back="false"
  9. :rightSlot="false"
  10. :background-color="[245,245,245]"
  11. :pageScroll.sync="pageScroll">
  12. <block slot="left">
  13. <view class="" style="margin-left: 6px; font-size: 22px;" @click="navBack">
  14. <i class="hxicon-back"></i>
  15. </view>
  16. </block>
  17. <view class="ctn">
  18. <view class="searchCtn" :style="{'width':navSearchWidth + '%','background-color':'rgba(230,230,230,'+ navSearchBgOpacity +')'}">
  19. <i class="hxicon-search"></i>
  20. <input confirm-type="search" class="input" type="text" placeholder="输入搜索关键词" style="font-size: 14px;" :style="{'opacity':navSearchBgOpacity ,'color':navSearchColor}">
  21. </view>
  22. <view class="leftBox" style="font-size: 22px;">
  23. <i class="hxicon-favor"></i>
  24. <i class="hxicon-more"></i>
  25. </view>
  26. <view class="jrNull"></view>
  27. </view>
  28. </hx-navbar>
  29. <!-- 只需要绑定购物车位置即可 -->
  30. <flyInCart ref="inCart" :cartBasketRect="cartBasketRect"></flyInCart>
  31. <!-- 头部 -->
  32. <view class="header">
  33. <image class="header-bg" :src="storeData.banner" mode=""></image>
  34. <view :class="showStoreBox ? 'header-bg-gray' : 'header-bg-black'"></view>
  35. <view class="header-top-Placeholder" ></view>
  36. <view class="container storeInfo hx-shadow" :style="{height:storeInfoBoxHeight + 'px'}">
  37. <image class="storeAvatar hx-shadow" :src="storeData.avatar" mode=""></image>
  38. <view class="hx-txt-18 hx-color-black hx-txt-weigth hx-mb-10 ">
  39. 十里桃花
  40. </view>
  41. <view class="hx-txt-14 hx-color-black ">
  42. 店家说明,本店放心吃,地方名才
  43. </view>
  44. <!-- <view class="">
  45. 后续再扩展优惠券,满减,折扣,活动等功能
  46. </view> -->
  47. <view class="shrink-box">
  48. <i class="hxicon" :class="showStoreBox ? 'icon-fold' : 'icon-unfold'" @click="showStoreBox = !showStoreBox"></i>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 主体 -->
  53. <view class="main" :style="{height: mainHeight}" >
  54. <!-- <view class="" :style="{display:showZz}" style="position: absolute;top: 0;bottom: 0;left: 0;width: 100%; background: #3F536E;z-index: 999;opacity: 0.5;">
  55. 遮罩
  56. </view> -->
  57. <view class="tabs-box" :style="{'top': 'calc(44px + ' + statusBarHeight + 'px)','background-color':'rgba(245,245,245,'+ navSearchBgOpacity +')'}">
  58. <view class="" style="width: 210px; height: 100%;">
  59. <view class="hx-tabs">
  60. <view class="hx-tabs-item" v-for="(item,i) in tabs" :key="i" :class="{'hx-tabs-active': swiperCurrent == i}" @click="swiperChange(i)" :style="{transition: transtionTime + 'ms'}">
  61. <text>{{item.name}}</text>
  62. </view>
  63. <view class="hx-tabs-slider-box" :style="{transition: transtionTime + 'ms',left:swiperCurrentSliderLeft + 'px'}">
  64. <view class="hx-tabs-slider"></view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <swiper
  70. id="mainSwiper"
  71. style="height: 100%;"
  72. :current="swiperCurrent"
  73. :duration="transtionTime"
  74. @transition="transition"
  75. @animationfinish="animationfinish">
  76. <!-- 购物 -->
  77. <swiper-item class="swiper-item" >
  78. <view class="scroll-items">
  79. <view class="category-list">
  80. <!-- 左侧分类导航 -->
  81. <scroll-view :scroll-top="menuScrollTop" :scroll-y="goodsBoxScroll" class="left" >
  82. <view v-for="item in categoryList" :key="item.id" class="row" :class="{active: item.id == menuCurrentId}" @click="showCategory(item)">
  83. <view class="text">
  84. {{item.name}}
  85. </view>
  86. <view class="row-number" v-if="item.number">
  87. {{item.number}}
  88. </view>
  89. </view>
  90. </scroll-view>
  91. <!-- 右侧子导航 -->
  92. <scroll-view scroll-with-animation :scroll-y="goodsBoxScroll" class="right" @scroll="asideScroll" :scroll-top="tabScrollTop" >
  93. <view class="goodsListBox">
  94. <view class="category" v-for="item in categoryList" :key="item.id" :id="'goodsBox'+item.id" >
  95. <view class="s-item">{{item.name}}</view>
  96. <view class="list" >
  97. <view class="box" v-for="(rowData,i) in goodsList" :key="rowData.id" v-if="item.id == rowData.type_id">
  98. <!-- 商品列表 -->
  99. <!-- <m-store-pro @touchOnGoods="touchOnGoods" :rowData="box"></m-store-pro>
  100. -->
  101. <!-- 商品列表 -->
  102. <view class="m-store-item">
  103. <view class="m-img" @click="hrefGoodsInfo(rowData.id)">
  104. <image style="width: 100%;height: 100%;" :src="rowData.img" mode="aspectFit"></image>
  105. </view>
  106. <view class="m-text">
  107. <view class="m-title" @click="hrefGoodsInfo(rowData.id)">
  108. {{rowData.name}}
  109. </view>
  110. <view class="m-descripe">
  111. {{rowData.descripe}}
  112. </view>
  113. <block v-if="rowData.form">
  114. <view class="m-price-box">
  115. <view class="symbol">¥</view>
  116. <view class="m-price">{{rowData.form_child[0].price}}</view>
  117. <view class="m-old-price" v-if="rowData.form_child[0].oldprice">
  118. <text>¥{{rowData.form_child[0].oldprice}}</text>
  119. </view>
  120. </view>
  121. </block>
  122. <block v-else>
  123. <view class="m-price-box">
  124. <view class="symbol">¥</view>
  125. <view class="m-price">{{rowData.price}}</view>
  126. <view class="m-old-price" v-if="rowData.oldprice">
  127. <text>¥{{rowData.oldprice}}</text>
  128. </view>
  129. </view>
  130. </block>
  131. <view class="m-distance" >
  132. <block v-if="rowData.form">
  133. <view class="miniBtn" @click="showForm(rowData)">
  134. <text>选规格</text>
  135. <!-- #ifdef APP-PLUS || H5 -->
  136. <view class="num" v-if="getCartGoodsNum(rowData)">{{getCartGoodsNum(rowData)}}</view>
  137. <!-- #endif -->
  138. </view>
  139. </block>
  140. <block v-else>
  141. <view :class="'addEle_' + i" class="jumpPosition"></view>
  142. <hx-number-box @change="addGoodsChange" :value="rowData.number" :rowData="rowData" :clickTime="animaTime" @addChange="touchOnAddGoods('.addEle_' + i,rowData)"></hx-number-box>
  143. </block>
  144. <!-- <image @click="touchOnAddGoods('.addEle_' + i,rowData)" style="width:20px;height: 20px;" src="../../static/img/icon/shop_icon_buy.png" mode="aspectFit"></image>
  145. -->
  146. </view>
  147. </view>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </scroll-view>
  154. </view>
  155. </view>
  156. </swiper-item>
  157. <!-- 评价 -->
  158. <swiper-item class="swiper-item" >
  159. <scroll-view scroll-y style="height: 100%;width: 100%;background-color: #ffffff;" @scroll="asideScroll" :scroll-y="goodsBoxScroll" >
  160. <view class="scroll-items evaluate-box" >
  161. <view class="evaluate-box-header">
  162. </view>
  163. <view class="evaluate-box-body">
  164. </view>
  165. <hx-comment :listData="commentList"></hx-comment>
  166. </view>
  167. </scroll-view>
  168. </swiper-item>
  169. <!-- 商家 -->
  170. <swiper-item class="swiper-item" >
  171. <view class="scroll-items business-box">
  172. <view class="info-list hx-mt-15">
  173. <view class="info-list-container">
  174. <i class="hxicon-location"></i>
  175. <text>{{ storeData.address }}</text>
  176. </view>
  177. </view>
  178. <view class="info-list hx-mt-15 ">
  179. <view class="info-list-container hx-bb">
  180. <i class="hxicon-time"></i>
  181. <text>配送时间:{{ storeData.delivery_time }}</text>
  182. </view>
  183. </view>
  184. <view class=" info-list">
  185. <view class="info-list-container" @click="goCall(storeData.telephone)">
  186. <i class="hxicon-phone"></i>
  187. <text style="flex: 1;">商家电话:{{ storeData.telephone }}</text>
  188. <view class="right">
  189. <text>拨打</text><i class="hxicon-right"></i>
  190. </view>
  191. </view>
  192. </view>
  193. <view class="info-list hx-mt-15">
  194. <view class="info-list-container" @click="showStoreBoxFunc">
  195. <i class="hxicon-new" style="color:#ff3333"></i>
  196. <text style="flex: 1;">商家当前热门活动</text>
  197. <view class="right">
  198. <text>查看</text><i class="hxicon-right"></i>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. </swiper-item>
  204. </swiper>
  205. </view>
  206. <!-- 购物车 -->
  207. <view class="foot" @touchmove.stop.prevent="mpClear" :style="{height: footHeight}" v-if="showFoot">
  208. <view class="zz" @click="hideShoppingCar"></view>
  209. <view class="btn-box">
  210. <view class="btn-box-left" @click="contact">
  211. <view class="imgBox">
  212. <image src="../../static/store/contact.png" mode=""></image>
  213. </view>
  214. <text>联系商家</text>
  215. </view>
  216. <view class="btn-box-line"></view>
  217. <view class="btn-box-center" @click="showShoppingCar">
  218. <view class="cart" :animation="cartAnimationData">
  219. <view class="tag cartNum" v-if="goodsTotalNumber>0">{{goodsTotalNumber}}</view>
  220. <image :src="goodsTotalNumber ? '/static/store/cart.png' : '/static/store/cart2.png'" mode=""></image>
  221. </view>
  222. <view class="priceBox">
  223. <view class="hx-txt-18 hx-color-white" v-if="goodsTotalPrice>0">
  224. ¥{{goodsTotalPrice}}
  225. </view>
  226. <view class="hx-txt-10 hx-color-gray">
  227. 另需配送费¥{{shippingDees}}
  228. </view>
  229. </view>
  230. </view>
  231. <view class="btn-box-right">
  232. <view class="jiesuan" v-if="goodsTotalPrice>0 && goodsTotalPrice >= startingPrice" @click="jiesuan">
  233. 去结算
  234. </view>
  235. <view class="pscj hx-txt-10 hx-color-gray" v-else>
  236. <text v-if="startingPrice>0">差¥{{-(goodsTotalPrice-startingPrice)}}起送</text>
  237. </view>
  238. </view>
  239. </view>
  240. <view class="cart-box" :style="{display: showCar ? 'flex' : 'none'}">
  241. <view class="box-container rebate-box" v-if="showDiscount">
  242. <text>已享100减25</text>
  243. </view>
  244. <view class="box-container operating-box">
  245. <view class="operating-box_right">
  246. </view>
  247. <view class="operating-box_left clear" @click="clearShoppingCart">
  248. <i class="hxicon-delete"></i>
  249. <text>清空购物车</text>
  250. </view>
  251. </view>
  252. <view class=" goods-box">
  253. <view class="" style="flex: 1;">
  254. <scroll-view scroll-y="true" class="goods-list-scroll" :scroll-top="carGoodsScrollTop">
  255. <view class="goods-list">
  256. <view class="box" v-for="(rowData,i) in shoppCart" :key="rowData.id" v-if="rowData.number>0">
  257. <view class="m-store-item">
  258. <view class="m-img">
  259. <image style="width: 100%;height: 100%;" :src="rowData.img" mode="aspectFit"></image>
  260. </view>
  261. <view class="m-text">
  262. <view class="m-title">
  263. {{rowData.name}}
  264. </view>
  265. <view class="m-descripe">
  266. {{rowData.current_form ? rowData.form.name + ":" + rowData.current_form.name : rowData.descripe}}
  267. </view>
  268. <view class="m-price-box" >
  269. <view class="symbol">¥</view>
  270. <view class="m-price">{{rowData.price}}</view>
  271. <view class="m-old-price" v-if="rowData.oldprice">
  272. <text>¥{{rowData.oldprice}}</text>
  273. </view>
  274. </view>
  275. <view class="m-distance" >
  276. <view :class="'addEle2_' + rowData.id" class="jumpPosition">
  277. </view>
  278. <hx-number-box @change="addGoodsChange" :value="rowData.number" :rowData="rowData" :clickTime="animaTime" @addChange="touchOnAddGoods('.addEle2_' + rowData.id,rowData)"></hx-number-box>
  279. </view>
  280. </view>
  281. </view>
  282. </view>
  283. </view>
  284. </scroll-view>
  285. </view>
  286. </view>
  287. </view>
  288. </view>
  289. <!-- v-if="showFormBox" -->
  290. <!-- 多规格 -->
  291. <uni-popup ref="popup" type="center" @change="popupChange">
  292. <view class="form-main" v-if="currentGoodsData.name">
  293. <view class="form-main_ctn" @click.stop.prevent="mpClear" >
  294. <view class="godos_tit"><text>{{currentGoodsData.name}}</text></view>
  295. <view class="gg_tit">
  296. <text>{{currentGoodsData.form.name}}</text>
  297. </view>
  298. <view class="gg_box">
  299. <block v-for="form_child in currentGoodsData.form_child" :key="form_child.id" v-if="form_child.pid == currentGoodsData.form.id">
  300. <view class="item" :class="{'active': form_child.select}" @click="selectGoodsForm(currentGoodsData,form_child)">{{form_child.name}}</view>
  301. </block>
  302. </view>
  303. <view class="select_gg">
  304. <text class="lable">已选规格:</text>
  305. <view class="select_gg_box">
  306. <block v-for="form_child in currentGoodsData.form_child" :key="form_child.id" v-if="form_child.select == true">
  307. <view class="gg-item">
  308. <text>{{form_child.name}} </text>
  309. <text class="gg-item-cut">,</text>
  310. </view>
  311. </block>
  312. </view>
  313. </view>
  314. <view class="bottom">
  315. <view class="price_box">
  316. <text>¥</text>
  317. <block v-for="(form_child,i) in currentGoodsData.form_child" :key="i" v-if="form_child.select == true">
  318. <text class="price">{{form_child.price}}</text>
  319. </block>
  320. </view>
  321. <view class="form-btn-box">
  322. <block v-if="!currentGoodsData.number">
  323. <view id="ggAddBtn" class="add-btn" @click="formFirstAddGoods()">
  324. <i class="hxicon-add" id="eleAdd"></i>
  325. <text>加入购物车</text>
  326. </view>
  327. </block>
  328. <block v-else>
  329. <view class="addEle_gg jumpPosition"></view>
  330. <hx-number-box @change="formAddGoodsChange" :value="currentGoodsData.number" :rowData="currentGoodsData" :clickTime="animaTime + 200" @addChange="touchOnAddGoods('.addEle_gg',currentGoodsData)"></hx-number-box>
  331. </block>
  332. </view>
  333. </view>
  334. </view>
  335. <view class="close" @click="hiddenForm()">
  336. <i class="hxicon-close"></i>
  337. </view>
  338. </view>
  339. </uni-popup>
  340. </view>
  341. </template>
  342. <script>
  343. import uniIcons from '@/components/uni-icons/uni-icons.vue';
  344. import hxNavbar from '@/components/hx-navbar/hx-navbar.vue';
  345. import jumpBall from '@/components/hx-jump-ball/hx-jump-ball.vue';
  346. import hxNumberBox from "@/components/uni-number-box/uni-number-box.vue";
  347. import hxComment from "@/components/hx-comment/hx-comment.vue";
  348. // 加入购物车动画组件
  349. import flyInCart from '@/components/flyInCart.vue'
  350. //引入测试数据
  351. import testData from "@/common/testdata.js";
  352. var statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  353. export default {
  354. components: {
  355. jumpBall,
  356. hxNavbar,
  357. uniIcons,
  358. hxNumberBox,
  359. hxComment,
  360. flyInCart
  361. },
  362. data() {
  363. return {
  364. pageScroll:{},
  365. //商家信息
  366. storeData: [],
  367. //商品列表
  368. goodsList: [],
  369. //商品分类信息列表
  370. categoryList: [],
  371. //评论列表
  372. commentList: [],
  373. navSearchWidth: 3,
  374. navSearchBgOpacity: 0,
  375. navSearchColor: '#ffffff',
  376. navHeadHeight: 44,
  377. //默认禁止商品栏滚动
  378. goodsBoxScroll: false,
  379. statusBarHeight,
  380. //动画时间
  381. animaTime: 300,
  382. //商家盒子高度
  383. storeInfoBoxHeight: 100,
  384. //展开门店信息容器
  385. showStoreBox: false,
  386. num:1,
  387. element: [],
  388. cartAnimation: {},
  389. cartAnimationData: {},
  390. //tabs
  391. tabs: [
  392. {name:'购物'},
  393. {name:'评价'},
  394. {name:'商家'},
  395. ],
  396. swiperCurrent: 0,
  397. dx: 0,
  398. swiperCurrentSliderLeft: 0,
  399. transtionTime:100,
  400. //所有购物车
  401. shoppingCartAll:[],
  402. //显示购物车
  403. showFoot:true,
  404. //配送费
  405. shippingDees: 0,
  406. //配送起步价
  407. startingPrice:0,
  408. //购物车商品价格合计
  409. goodsTotalPrice: 0,
  410. //购物车商品数量合计
  411. goodsTotalNumber: 0,
  412. //当前门店购物车
  413. shoppCart: [],
  414. //foot 高度
  415. footHeight: '0',
  416. //显示购物车
  417. showCar: false,
  418. //购物车中商品滚动条位置
  419. carGoodsScrollTop: 0,
  420. //购物车缓存 Storage 名称
  421. shoppingCartStorageName: 'shopping_cart',
  422. sizeCalcState: false,
  423. tabScrollTop: 0,
  424. mainHeight: 0,
  425. menuCurrentId:1,
  426. //购物车显示折扣
  427. showDiscount:true,
  428. //手指触摸滑动
  429. touchData:{},
  430. //页面滚动条距离顶部的距离
  431. pageScrollTop: 0,
  432. menuScrollTop: 0,
  433. //多规格当前产品
  434. currentGoodsData: {},
  435. //显示规格容器
  436. showFormBox: false,
  437. //显示规格动画
  438. formAnimationData:{},
  439. //购物车位置数据
  440. cartBasketRect:{},
  441. navStatus: true,
  442. isBack:true,
  443. }
  444. },
  445. async onLoad(option) {
  446. const that = this
  447. uni.showLoading({
  448. title: '加载中'
  449. });
  450. //模拟请求数据
  451. setTimeout(()=>{
  452. //商家信息
  453. that.storeData = testData.storeData,
  454. //商品列表
  455. that.goodsList = testData.goodsData;
  456. //商品分类信息列表
  457. that.categoryList = testData.categoryData;
  458. //评论列表
  459. that.commentList = testData.commentData,
  460. setTimeout(()=>{
  461. this.init();
  462. uni.hideLoading();
  463. },200)
  464. },500)
  465. },
  466. onReady() {
  467. const that = this
  468. let sysInfo = uni.getSystemInfoSync();
  469. //屏幕高度 - 头部导航高度 - 状态栏高度 - 分页高度
  470. this.mainHeight = sysInfo.screenHeight - 43 - statusBarHeight - 40 + 'px';
  471. let q = uni.createSelectorQuery()
  472. setTimeout(function(){
  473. q.select('.cart').boundingClientRect(data => {
  474. that.cartBasketRect = data
  475. }).exec();
  476. },100)
  477. that.calcSize();
  478. },
  479. onBackPress(event) {
  480. if(this.showFormBox){
  481. this.hiddenForm()
  482. return true
  483. }
  484. if(!this.isBack){
  485. this.$refs.popup.close()
  486. return true
  487. }
  488. },
  489. onShow() {
  490. this.init();
  491. },
  492. mounted() {
  493. let that = this
  494. },
  495. watch:{
  496. showStoreBox(val,oldVal){
  497. if(val == true){
  498. this.showStoreBoxFunc();
  499. }else{
  500. this.hiddenStoreBoxFunc();
  501. }
  502. }
  503. },
  504. onPageScroll(e) {
  505. let that = this
  506. let top = e.scrollTop
  507. that.pageScrollTop = e.scrollTop
  508. that.pageScroll = e
  509. if(top < 120){
  510. if(that.navSearchWidth >= 3){
  511. if(top<3){
  512. that.navSearchWidth = 3
  513. that.navSearchBgOpacity = 0
  514. that.navSearchColor = '#ffffff'
  515. }else{
  516. let n = top * (120/100)
  517. if(n > 100){
  518. n = 100
  519. }
  520. that.navSearchWidth = n
  521. //that.navSearchBgOpacity =1
  522. that.navSearchBgOpacity = top * (1/100)
  523. that.navSearchColor = '#888888'
  524. }
  525. }
  526. }else{
  527. that.navSearchWidth = 100
  528. that.navSearchBgOpacity = 1
  529. that.navSearchColor = '#888888'
  530. }
  531. let view = uni.createSelectorQuery().select(".main");
  532. view.fields({
  533. rect: true
  534. }, data => {
  535. if(data != null){
  536. if(data.top <= statusBarHeight+44){
  537. that.goodsBoxScroll = true
  538. }else{
  539. that.goodsBoxScroll = false
  540. }
  541. }
  542. }).exec();
  543. },
  544. methods: {
  545. init(){
  546. let that = this;
  547. //假设这是从后台获取的商品数据
  548. let goods = this.goodsList;
  549. //商品初始化
  550. // for(let i in goods){
  551. // goods[i].purchases = 3
  552. // }
  553. that.shoppCart = []
  554. let carts = uni.getStorageSync(that.shoppingCartStorageName) || [];
  555. console.log(carts);
  556. //根据缓存数据 获取购物车中属于本商店的商品
  557. for(let i in carts){
  558. if(carts[i].store_id == that.storeData.store_id){
  559. that.shoppCart = carts[i].shopping_cart ? carts[i].shopping_cart : [];
  560. break;
  561. }
  562. }
  563. that.goodsTotalPrice = 0;
  564. that.goodsTotalNumber = 0;
  565. for(let i in that.shoppCart){
  566. for(let j in goods){
  567. if(goods[j].id == that.shoppCart[i].id){
  568. goods[j].number = that.shoppCart[i].number
  569. }
  570. }
  571. //计算商品总价
  572. that.goodsTotalPrice += that.shoppCart[i].total
  573. //商品总数量
  574. that.goodsTotalNumber += that.shoppCart[i].number
  575. }
  576. //初始化商品列表
  577. that.goodsList = goods;
  578. //初始化起步价和配送费
  579. that.starting_price = that.storeData.starting_price;
  580. that.shipping_dees = that.storeData.shipping_dees;
  581. that.setLabelNumber();
  582. },
  583. navBack(){
  584. if(getCurrentPages().length>1){
  585. uni.navigateBack();
  586. }else{
  587. // #ifdef H5
  588. history.back()
  589. // #endif
  590. // #ifndef H5
  591. uni.reLaunch({
  592. url: '/pages/index/index'
  593. });
  594. // #endif
  595. }
  596. },
  597. popupChange(e){
  598. this.isBack = !e.show
  599. },
  600. //-----------------------------------------------------------------------------------
  601. //显示 规格
  602. showForm(goods){
  603. var that = this;
  604. let goodsCart = that.getStoreCart();
  605. if(goodsCart){
  606. let currentGoods = null
  607. for(let i in goodsCart){
  608. if(goodsCart[i].id == goods.id){
  609. currentGoods = goodsCart[i]
  610. break
  611. }
  612. }
  613. if(currentGoods){
  614. let selectStatus = false
  615. for (let i in goods.form_child){
  616. if(goods.form_child[i].id == currentGoods.current_form.id){
  617. if(!selectStatus){
  618. goods.form_child[i].select = true
  619. goods.number = currentGoods.number
  620. selectStatus = true
  621. }else{
  622. goods.form_child[i].select = false
  623. }
  624. }else{
  625. goods.form_child[i].select = false
  626. }
  627. }
  628. }
  629. }
  630. that.currentGoodsData = goods
  631. that.$refs.popup.open()
  632. },
  633. //隐藏规格
  634. hiddenForm(){
  635. this.$refs.popup.close();
  636. },
  637. formFirstAddGoods(){
  638. let that = this
  639. that.formAddGoodsChange(1,that.currentGoodsData)
  640. that.touchOnAddGoods('#ggAddBtn',that.currentGoodsData)
  641. },
  642. //加入购物车
  643. formAddGoodsChange(number,goodsData){
  644. let that = this;
  645. if(number >= 1){
  646. for(let i in goodsData.form_child){
  647. if(goodsData.form_child[i].select == true ){
  648. that.currentGoodsData.current_form = goodsData.form_child[i]
  649. break
  650. }
  651. }
  652. }
  653. that.addGoodsChange(number,that.currentGoodsData)
  654. },
  655. //选择规格
  656. selectGoodsForm(goods,formChild){
  657. let that = this
  658. let data = goods.form_child
  659. let n = 0
  660. for (var i in data){
  661. if(data[i].id == formChild.id){
  662. data[i].select = true
  663. }else{
  664. data[i].select = false
  665. }
  666. }
  667. let goodsCart = that.getStoreCart();
  668. if(goodsCart){
  669. for(let i in goodsCart){
  670. if(goodsCart[i].id == goods.id && goodsCart[i].current_form.id == formChild.id){
  671. n = goodsCart[i].number
  672. break;
  673. }
  674. }
  675. }
  676. goods.number = n
  677. this.currentGoodsData = goods
  678. },
  679. //获取该商品在购物车的数量
  680. getCartGoodsNum(goods){
  681. let cart = this.getStoreCart()
  682. let n = 0
  683. if(cart){
  684. for(let i in cart){
  685. if(cart[i].id == goods.id){
  686. n += cart[i].number
  687. }
  688. }
  689. }
  690. return n
  691. },
  692. //-----------------------------------------------------------------------------------
  693. //获取门店购物车
  694. getStoreCart(){
  695. const that = this
  696. return that.shoppCart
  697. },
  698. //---------------------------------------------------------------------------------
  699. swiperChange(index) {
  700. this.swiperCurrent = index;
  701. this.swiperCurrentSliderLeft= 70 * index;
  702. },
  703. transition({ detail: { dx } }) {
  704. // this.$refs.tabs.setDx(dx);
  705. },
  706. animationfinish({detail: { current }}) {
  707. /* this.$refs.tabs.setFinishCurrent(current); */
  708. this.swiperCurrent = current;
  709. this.current = current;
  710. this.swiperChange(current);
  711. this.showFoot = current == 0 && this.showStoreBox != true ? true : false;
  712. },
  713. //一级分类点击
  714. showCategory(item){
  715. const that = this
  716. that.isBoxScroll = true;
  717. that.menuCurrentId = item.id;
  718. setTimeout(()=>{
  719. let index = that.categoryList.findIndex(sitem=>sitem.id === item.id);
  720. that.tabScrollTop = that.categoryList[index].top;
  721. that.isBoxScroll = false
  722. },100)
  723. },
  724. //右侧栏滚动
  725. asideScroll(e){
  726. const that = this;
  727. const scrollTop = Math.round(e.detail.scrollTop);
  728. that.calcSize()
  729. const tabs = that.categoryList.filter(item=>item.top <= scrollTop).reverse();
  730. if(tabs.length > 0){
  731. that.menuCurrentId = tabs[0].id;
  732. }
  733. const menuNum = that.categoryList.length
  734. const cNum = tabs.length
  735. // 定位在第4个分类,当分类滑动到第4格时将不再变换位置。
  736. const n = 4
  737. if(cNum>n){
  738. that.menuScrollTop = (cNum - n) * 45
  739. }else{
  740. that.menuScrollTop = 0
  741. }
  742. },
  743. //计算右侧栏每个tab的高度等信息
  744. calcSize(event){
  745. let h = 0;
  746. // if(this.sizeCalcState){
  747. // return false
  748. // }
  749. this.categoryList.forEach(item=>{
  750. let view = uni.createSelectorQuery().select("#goodsBox" + item.id);
  751. view.fields({
  752. size: true
  753. }, data => {
  754. if(data != null){
  755. item.top = h;
  756. h += Math.round(data.height);
  757. item.bottom = h;
  758. }
  759. }).exec();
  760. })
  761. this.sizeCalcState = true;
  762. },
  763. //小球跳跃动画
  764. touchOnAddGoods(ele,data){
  765. const that = this;
  766. let q = uni.createSelectorQuery()
  767. q.select(ele).boundingClientRect(res => {
  768. that.$refs.inCart.addToCart(res,data.id);
  769. }).exec();
  770. },
  771. //新增商品计算价格
  772. addGoodsChange(number,rowData){
  773. number = Number(number)
  774. var that = this;
  775. let shoppCart = [];
  776. let totalPrice = 0;
  777. let totalNumber = 0;
  778. let existedGoods = false;
  779. //门店第一次添加商品
  780. let isFirstAddGoods = true;
  781. //是否为有规格的商品
  782. let isFormGoods = false
  783. if(rowData.current_form){
  784. isFormGoods = true
  785. }
  786. let deleteGoods = null
  787. let carts = uni.getStorageSync(that.shoppingCartStorageName) || [];
  788. if(carts.length != 0){
  789. isFirstAddGoods = false
  790. //根据缓存数据 获取购物车中属于本商店的商品
  791. for(let i in carts){
  792. if(carts[i].store_id == that.storeData.store_id){
  793. shoppCart = carts[i].shopping_cart ? carts[i].shopping_cart : [];
  794. break;
  795. }
  796. }
  797. //检查该商品是否为第一次添加,
  798. for(var i in shoppCart){
  799. // if(shoppCart[i].id == rowData.id){
  800. // // 是多规格商品
  801. // if(isFormGoods){
  802. // //规格相同
  803. // if(shoppCart[i].current_form.id == rowData.current_form.id){
  804. // //数量为0,在购物车中移除该商品
  805. // if(number <= 0){
  806. // deleteGoods = shoppCart[i];
  807. // break;
  808. // }else{
  809. // // 直接修改商品数量,并计算出单品合计
  810. // shoppCart[i].price = rowData.current_form.price
  811. // shoppCart[i].oldprice = rowData.current_form.oldprice
  812. // shoppCart[i].total = number * rowData.current_form.price
  813. // }
  814. // }
  815. // }else{
  816. // // 不是多规格商品
  817. // }
  818. // }
  819. if(shoppCart[i].id == rowData.id){
  820. if(isFormGoods){
  821. //相同商品比较规格是否也相同
  822. if(shoppCart[i].current_form.id == rowData.current_form.id){
  823. existedGoods = true;
  824. }
  825. }else{
  826. existedGoods = true;
  827. }
  828. if(existedGoods){
  829. //在购物车中移除该商品
  830. if(number <= 0){
  831. deleteGoods = shoppCart[i];
  832. break;
  833. }
  834. //非第一次添加,直接修改商品数量,并计算出单品合计
  835. if(isFormGoods){
  836. shoppCart[i].price = rowData.current_form.price
  837. shoppCart[i].oldprice = rowData.current_form.oldprice
  838. shoppCart[i].total = number * rowData.current_form.price
  839. }else{
  840. shoppCart[i].price = rowData.price
  841. shoppCart[i].total = number * rowData.price
  842. shoppCart[i].oldprice = rowData.oldprice
  843. }
  844. shoppCart[i].number = rowData.number = number
  845. break;
  846. }
  847. }
  848. }
  849. }
  850. //在购物车中移除该商品
  851. if(deleteGoods != null){
  852. if(carts){
  853. //根据缓存数据 获取购物车中属于本商店的商品
  854. for(let i in carts){
  855. if(carts[i].store_id == that.storeData.store_id){
  856. var index = shoppCart.indexOf(deleteGoods);
  857. if (index > -1) {
  858. shoppCart.splice(index, 1);
  859. }
  860. carts[i].shopping_cart = shoppCart
  861. uni.setStorageSync(that.shoppingCartStorageName,carts);
  862. break;
  863. }
  864. }
  865. setTimeout(()=>{
  866. this.init();
  867. },100)
  868. }else{
  869. that.storeData.shopping_cart = []
  870. uni.setStorageSync(that.shoppingCartStorageName,that.storeData);
  871. }
  872. return
  873. }
  874. //第一次添加
  875. if(!existedGoods){
  876. if(rowData.form){
  877. rowData.price = rowData.current_form.price
  878. rowData.oldprice = rowData.current_form.oldprice
  879. rowData.total = number * rowData.current_form.price
  880. }else{
  881. rowData.total = number * rowData.price
  882. }
  883. rowData.number = number;
  884. shoppCart.push(rowData);
  885. }
  886. //计算总商品数量和总价
  887. for(var i in shoppCart){
  888. //总价
  889. totalPrice += shoppCart[i].total
  890. totalNumber += shoppCart[i].number
  891. }
  892. //更改商品列表中的已购买数量
  893. for(let i in that.goodsList){
  894. if(that.goodsList[i].id == rowData.id){
  895. that.goodsList[i] = rowData
  896. break;
  897. }
  898. }
  899. that.goodsTotalPrice = totalPrice
  900. that.goodsTotalNumber = totalNumber
  901. that.shoppCart = shoppCart;
  902. that.storeData.shopping_cart = shoppCart;
  903. that.setLabelNumber();
  904. if(isFirstAddGoods){
  905. carts.push(that.storeData)
  906. }
  907. if(that.goodsTotalNumber == 0){
  908. that.hideShoppingCar();
  909. }
  910. //购物车商品数据缓存至本地
  911. uni.setStorageSync(that.shoppingCartStorageName,carts);
  912. },
  913. //计算每类商品购买的总数
  914. setLabelNumber(){
  915. let that = this;
  916. //计算每一类购买商品的总数量
  917. for(let j in that.categoryList){
  918. let n = 0;
  919. for(var i in that.shoppCart){
  920. if(that.shoppCart[i].type_id == that.categoryList[j].id){
  921. n += that.shoppCart[i].number;
  922. }
  923. }
  924. that.categoryList[j].number = n;
  925. }
  926. },
  927. //去结算
  928. jiesuan(){
  929. this.navTo("/pages/order/preview?sid=" + this.storeData.store_id)
  930. },
  931. navTo(url){
  932. let that = this;
  933. if(that.navStatus){
  934. that.navStatus = false
  935. uni.navigateTo({
  936. url: url,
  937. complete:function(){
  938. that.navStatus = true
  939. }
  940. })
  941. }
  942. },
  943. //联系商家
  944. contact(){
  945. uni.showModal({
  946. title:"",
  947. content:"联系商家"
  948. })
  949. },
  950. showStoreBoxFunc(){
  951. this.storeInfoBoxHeight = uni.getSystemInfoSync().screenHeight-136;
  952. this.$set(this.$data,'showFoot',false);
  953. this.showStoreBox = true;
  954. uni.pageScrollTo({
  955. duration:0,
  956. scrollTop:0
  957. })
  958. },
  959. hiddenStoreBoxFunc(){
  960. this.storeInfoBoxHeight = 100;
  961. this.showStoreBox = false;
  962. if(this.swiperCurrent == 0){
  963. this.$set(this.$data,'showFoot',true);
  964. }
  965. },
  966. mpClear(e) {
  967. // TODO nvue 取消冒泡
  968. e.stopPropagation()
  969. },
  970. //显示购物车
  971. showShoppingCar(){
  972. if(this.goodsTotalNumber == 0){
  973. return;
  974. }
  975. this.footHeight = '100%';
  976. this.showCar = true;
  977. this.carGoodsScrollTop = 0;
  978. },
  979. //隐藏购物车
  980. hideShoppingCar(){
  981. this.footHeight = '0';
  982. this.showCar = false;
  983. },
  984. //清空该门店的购物车
  985. clearShoppingCart(){
  986. let that = this;
  987. that.shoppCart = [];
  988. that.storeData.shopping_cart = [];
  989. for(let i in that.shoppingCartAll){
  990. if(that.shoppingCartAll[i].store_id == that.storeData.store_id){
  991. that.shoppingCartAll[i] = that.storeData
  992. }
  993. }
  994. uni.setStorageSync(that.shoppingCartStorageName,that.shoppingCartAll);
  995. for(let i in that.goodsList){
  996. that.goodsList[i].number = 0;
  997. }
  998. for(let i in that.categoryList){
  999. that.categoryList[i].number = 0;
  1000. }
  1001. //购物车商品价格合计
  1002. that.goodsTotalPrice = 0;
  1003. //购物车商品数量合计
  1004. that.goodsTotalNumber = 0;
  1005. that.hideShoppingCar();
  1006. },
  1007. hrefGoodsInfo(id){
  1008. this.navTo('/pages/product/product?id=' + id)
  1009. },
  1010. //拨打电话
  1011. goCall(phone){
  1012. if(!phone){
  1013. return;
  1014. }
  1015. uni.makePhoneCall({
  1016. phoneNumber: phone //仅为示例
  1017. });
  1018. },
  1019. touchStart(e){
  1020. this.touchData.clientX=e.changedTouches[0].clientX;
  1021. this.touchData.clientY=e.changedTouches[0].clientY;
  1022. },
  1023. }
  1024. }
  1025. </script>
  1026. <style lang="scss">
  1027. //主题颜色
  1028. $hx-theme-color: #FFC107;
  1029. $hx-theme-color-light: #FFEB3B;
  1030. .add{
  1031. position: fixed;
  1032. right: 60upx;
  1033. top: 300upx;
  1034. z-index: 999;
  1035. }
  1036. .ctn{
  1037. /* border: 1px solid #e3e3e3; */
  1038. width: 100%;
  1039. display: flex;
  1040. justify-content: flex-end;
  1041. overflow: hidden;
  1042. align-items: center;
  1043. .searchCtn{
  1044. display: flex;
  1045. border-radius: 80upx;
  1046. padding: 8upx 12upx;
  1047. line-height: 44upx;
  1048. background: #e0e0e0;
  1049. overflow: hidden;
  1050. align-items: center;
  1051. min-width: 22px;
  1052. }
  1053. .leftBox{
  1054. display: flex;
  1055. width: 53px;
  1056. justify-content: space-between;
  1057. flex: none;
  1058. margin: 0 8px;
  1059. }
  1060. .jrNull{
  1061. /* #ifdef MP */
  1062. width: 95px;
  1063. flex: none;
  1064. /* #endif */
  1065. }
  1066. }
  1067. page{
  1068. background: #ffffff;
  1069. }
  1070. .hx-bb{
  1071. border-bottom: 1px solid $uni-border-color;
  1072. }
  1073. .hx-txt-10{
  1074. font-size: 10px;
  1075. }
  1076. .hx-txt-12{
  1077. font-size: 12px;
  1078. }
  1079. .hx-txt-14{
  1080. font-size: 14px;
  1081. }
  1082. .hx-txt-16{
  1083. font-size: 16px;
  1084. }
  1085. .hx-txt-18{
  1086. font-size: 18px;
  1087. }
  1088. .hx-txt-22{
  1089. font-size: 22px;
  1090. }
  1091. .hx-color-gray{
  1092. color: #bbbbbb;
  1093. }
  1094. .hx-color-white{
  1095. color: #FFFFFF;
  1096. }
  1097. .hx-color-black{
  1098. color: #333333;
  1099. }
  1100. .hx-txt-weigth{
  1101. font-weight: bold;
  1102. }
  1103. .hx-mb-10{
  1104. margin-bottom: 10px;
  1105. }
  1106. .hx-mt-15{
  1107. margin-top: 15px;
  1108. }
  1109. .hx-shadow{
  1110. box-shadow: 0px 6upx 16upx rgba(173, 173, 173, 0.2);
  1111. }
  1112. .miniBtn{
  1113. position: relative;
  1114. padding: 0 12px;
  1115. border-radius: 20px;
  1116. height: 24px;
  1117. line-height: 24px;
  1118. text-align: center;
  1119. background: linear-gradient(100deg, #FFEB3B, #FFC107);
  1120. font-size: 10px;
  1121. color: #333;
  1122. .num{
  1123. position: absolute;
  1124. right: 0;
  1125. top: -10px;
  1126. width: 18px;
  1127. height: 18px;
  1128. line-height: 18px;
  1129. font-size: 10px;
  1130. color: #fff;
  1131. background-color: #ff5722;
  1132. text-align: center;
  1133. border-radius: 50%;
  1134. }
  1135. }
  1136. .hx-store{
  1137. .header{
  1138. position: relative;
  1139. min-height: 230px;
  1140. &-bg{
  1141. position: absolute;
  1142. left: 0;
  1143. top: 0;
  1144. z-index: 2;
  1145. width: 100%;
  1146. height: 142px;
  1147. }
  1148. &-bg-black{
  1149. position: absolute;
  1150. left: 0;
  1151. top: 142px;
  1152. bottom: 0;
  1153. z-index: 1;
  1154. background-color: #ffffff;
  1155. width: 100%;
  1156. transition: background-color 0.2s;
  1157. }
  1158. &-bg-gray{
  1159. position: absolute;
  1160. left: 0;
  1161. top: 142px;
  1162. bottom: -16px;
  1163. z-index: 1;
  1164. background-color: #afafaf;
  1165. width: 100%;
  1166. transition: background-color 0.2s;
  1167. }
  1168. &-top-Placeholder{
  1169. height: 105px;
  1170. }
  1171. .storeInfo{
  1172. position: relative;
  1173. z-index: 2;
  1174. background: #ffffff;
  1175. height: 100px;
  1176. border-radius: 6px;
  1177. padding: 12px;
  1178. margin-bottom: 4px;
  1179. transition: all 0.2s;
  1180. .shrink-box{
  1181. position: absolute;
  1182. bottom: 0;
  1183. left: 0;
  1184. right: 0;
  1185. text-align: center;
  1186. font-size: 20px;
  1187. color: #a2a8ab;
  1188. }
  1189. .storeAvatar{
  1190. position: absolute;
  1191. width: 50px;
  1192. height: 50px;
  1193. right: 16px;
  1194. top: -25px;
  1195. background: #ffffff;
  1196. border-radius: 4px;
  1197. }
  1198. }
  1199. }
  1200. .container{
  1201. margin: 0 32upx;
  1202. }
  1203. .tabs-box{
  1204. width: 100%;
  1205. position: sticky;
  1206. top: calc(44px + var(--status-bar-height));
  1207. z-index: 10;
  1208. background-color: white;
  1209. border-bottom: 1px solid #efefef;
  1210. height: 40px;
  1211. .hx-tabs{
  1212. position: relative;
  1213. display: flex;
  1214. height:100%;
  1215. &-item{
  1216. display: flex;
  1217. flex-direction: row;
  1218. justify-content: center;
  1219. align-items: center;
  1220. width: 70px;
  1221. color:#666666;
  1222. text{
  1223. font-size: 16px;
  1224. }
  1225. }
  1226. &-active{
  1227. color:#333333;
  1228. font-weight: bold;
  1229. }
  1230. &-slider-box{
  1231. position: absolute;
  1232. display: flex;
  1233. justify-content: center;
  1234. bottom: 0;
  1235. width: 70px;
  1236. }
  1237. &-slider{
  1238. display: flex;
  1239. background: #f6d200;
  1240. width: 30px;
  1241. height: 3px;
  1242. }
  1243. }
  1244. }
  1245. .main{
  1246. position: relative;
  1247. background-color: #ffffff;
  1248. #mainSwiper{
  1249. background-color: #eeeeee;
  1250. position: sticky;
  1251. top: calc(40px + 44px + var(--status-bar-height));
  1252. .scroll-items{
  1253. // 商品列表样式
  1254. .category-list{
  1255. width: 100%;
  1256. background-color: #fff;
  1257. display: flex;
  1258. padding-bottom: 50px;
  1259. .left,.right{
  1260. background: #fff;
  1261. position: absolute;
  1262. top:0;
  1263. bottom: 0upx;
  1264. }
  1265. .left{
  1266. width: 24%;
  1267. left: 0upx;
  1268. background-color: #f6f3f3;
  1269. .row{
  1270. width: 100%;
  1271. height: 45px;
  1272. display: flex;
  1273. align-items: center;
  1274. overflow: hidden;
  1275. position: relative;
  1276. .text{
  1277. width: 100%;
  1278. font-size: 14px;
  1279. color:#999999;
  1280. overflow: hidden;
  1281. text-overflow: ellipsis;
  1282. display: -webkit-box;
  1283. -webkit-box-orient: vertical;
  1284. -webkit-line-clamp: 2;
  1285. text-align: center;
  1286. padding: 0 16px;
  1287. }
  1288. &-number{
  1289. position: absolute;
  1290. width: 18px;
  1291. height: 18px;
  1292. right: 4px;
  1293. top: 4px;
  1294. background: #ff5722;
  1295. border-radius: 50%;
  1296. line-height: 18px;
  1297. text-align: center;
  1298. font-size: 10px;
  1299. color: #ffffff;
  1300. }
  1301. &.active{
  1302. height: 45px;
  1303. background-color: #fff;
  1304. .text{
  1305. font-size: 14px;
  1306. }
  1307. }
  1308. }
  1309. .row:last-child{
  1310. margin-bottom: 200upx;
  1311. }
  1312. }
  1313. .right{
  1314. width: 76%;
  1315. left: 24%;
  1316. .goodsListBox{
  1317. padding-bottom: 100px;
  1318. .category{
  1319. // width: 94%;
  1320. padding: 0 15px 10px 15px;
  1321. .s-item{
  1322. height: 45px;
  1323. line-height: 45px;
  1324. font-size: 16px;
  1325. background: #ffffff;
  1326. color: #555555;
  1327. position: sticky;
  1328. top: 0;
  1329. z-index: 18;
  1330. }
  1331. .list:last-child{
  1332. margin-bottom: 0;
  1333. }
  1334. .list{
  1335. margin-bottom: 20px;
  1336. width: 100%;
  1337. display: flex;
  1338. flex-wrap: wrap;
  1339. .box:first-child{
  1340. .m-store-item{
  1341. margin-top: 0;
  1342. }
  1343. }
  1344. .box{
  1345. width: 100%;
  1346. .m-store-item{
  1347. display: flex;
  1348. flex-direction: row;
  1349. width: 100%;
  1350. justify-content: space-between;
  1351. align-items: flex-end;
  1352. margin-top: 15px;
  1353. margin-bottom: 15px;
  1354. .m-img{
  1355. flex: 0 0 85px;
  1356. height: 85px;
  1357. background: #eee;
  1358. border-radius: 4px;
  1359. }
  1360. .m-text{
  1361. flex: 1;
  1362. position: relative;
  1363. height: 85px;
  1364. padding: 0 6px;
  1365. display: flex;
  1366. align-content: space-between;
  1367. flex-direction: column;
  1368. .m-title{
  1369. font-size: 16px;
  1370. color:#555555;
  1371. height: 21px;
  1372. font-weight: bold;
  1373. }
  1374. .m-descripe{
  1375. font-size: 12px;
  1376. color:#999999;
  1377. margin-top: 5px;
  1378. height: 35px;
  1379. }
  1380. .m-price-box{
  1381. height: 24px;
  1382. font-weight: bold;
  1383. display: flex;
  1384. flex-direction: row;
  1385. align-items: flex-end;
  1386. .symbol{
  1387. color:#ff582b;
  1388. font-size: 12px;
  1389. }
  1390. .m-price{
  1391. position: relative;
  1392. top: 2px;
  1393. font-size: 18px;
  1394. color:#ff582b;
  1395. }
  1396. .m-old-price{
  1397. margin-left: 3px;
  1398. display: flex;
  1399. flex-direction: row;
  1400. font-size: 10px;
  1401. color:#999999;
  1402. margin-top: 5upx;
  1403. text-decoration: line-through;
  1404. font-weight: normal;
  1405. }
  1406. }
  1407. .m-distance{
  1408. position: absolute;
  1409. right: 0;
  1410. bottom: -4px;
  1411. z-index: 16;
  1412. color:#b2b2b2;
  1413. font-size: 20upx;
  1414. text-align: right;
  1415. .jumpPosition{
  1416. position: absolute;
  1417. bottom: 23px;
  1418. right: 0;
  1419. z-index: 2;
  1420. width: 28px;
  1421. height: 28px;
  1422. }
  1423. }
  1424. }
  1425. }
  1426. }
  1427. }
  1428. }
  1429. }
  1430. }
  1431. }
  1432. }
  1433. .evaluate-box{
  1434. }
  1435. .business-box{
  1436. .info-list{
  1437. background: #ffffff;
  1438. padding: 0 15px;
  1439. &-container{
  1440. line-height: 46px;
  1441. height: 46px;
  1442. display: flex;
  1443. flex-direction: row;
  1444. [class*="hxicon-"]{
  1445. color: #a2a2a2;
  1446. margin-right: 8px;
  1447. }
  1448. text{
  1449. font-size: 14px;
  1450. }
  1451. .right{
  1452. float: right;
  1453. color: #dddddd;
  1454. display: flex;
  1455. flex-direction: row;
  1456. align-items:center;
  1457. [class*="hxicon-"]{
  1458. color: #dddddd;
  1459. margin-right: 0;
  1460. font-size: 16px;
  1461. }
  1462. }
  1463. }
  1464. }
  1465. }
  1466. }
  1467. }
  1468. .foot{
  1469. position: fixed;
  1470. display: flex;
  1471. z-index: 999;
  1472. justify-content:center;
  1473. align-items : center;
  1474. bottom: 0;
  1475. height: 100%;
  1476. width: 100%;
  1477. /*width: calc(100% - 32px);*/
  1478. .btn-box{
  1479. position:absolute;
  1480. display: flex;
  1481. bottom: 15px;
  1482. justify-content:center;
  1483. align-items : center;
  1484. margin:0;
  1485. height: 50px;
  1486. width: calc(100% - 32px);
  1487. z-index: 9;
  1488. &-left{
  1489. background: #222222;
  1490. border-top-left-radius:50px;
  1491. border-top-right-radius:9px;
  1492. border-bottom-left-radius:50px;
  1493. border-bottom-right-radius:9px;
  1494. padding-left: 6upx;
  1495. display: flex;
  1496. flex-direction:column;
  1497. justify-content:center;
  1498. align-self: center;
  1499. width: 70px;
  1500. height: 100%;
  1501. color: #f6d200;
  1502. text-align: center;
  1503. .imgBox{
  1504. display: flex;
  1505. text-align: center;
  1506. justify-content:center;
  1507. image{
  1508. width: 20px;
  1509. height: 20px;
  1510. }
  1511. }
  1512. text{
  1513. font-size: 20upx;
  1514. }
  1515. }
  1516. &-line{
  1517. background: #ffffff;
  1518. width: 2px;
  1519. height: 100%;
  1520. }
  1521. &-center{
  1522. height: 100%;
  1523. flex: auto;
  1524. display: flex;
  1525. justify-content:flex-start;
  1526. align-self: center;
  1527. align-items: center;
  1528. background: #222222;
  1529. border-top-left-radius:8upx;
  1530. border-bottom-left-radius:8upx;
  1531. padding-left: 10upx;
  1532. .cart{
  1533. position: relative;
  1534. width: 36px;
  1535. height: 36px;
  1536. image{
  1537. width: 100%;
  1538. height: 100%;
  1539. }
  1540. .tag{
  1541. position: absolute;
  1542. right: 12upx;
  1543. top: 16upx;
  1544. height: 18px;
  1545. width: 18px;
  1546. background-color: #ff4000;
  1547. color: #ffffff;
  1548. border-radius: 50%;
  1549. z-index: 1;
  1550. font-size: 10px;
  1551. text-align: center;
  1552. line-height: 18px;
  1553. }
  1554. }
  1555. .priceBox{
  1556. flex: auto;
  1557. }
  1558. }
  1559. &-right{
  1560. width: 70px;
  1561. height: 100%;
  1562. position: relative;
  1563. display: flex;
  1564. justify-content:flex-start;
  1565. align-self: center;
  1566. align-items: center;
  1567. .pscj{
  1568. width: 100%;
  1569. height: 100%;
  1570. border-top-right-radius:100upx;
  1571. border-bottom-right-radius:100upx;
  1572. background: #222222;
  1573. text-align: center;
  1574. display: flex;
  1575. justify-content:center;
  1576. align-self: center;
  1577. align-items: center;
  1578. }
  1579. .jiesuan{
  1580. width: 100%;
  1581. height: 100%;
  1582. font-size: 28upx;
  1583. border-top-right-radius:100upx;
  1584. border-bottom-right-radius:100upx;
  1585. text-align: center;
  1586. display: flex;
  1587. justify-content:center;
  1588. align-self: center;
  1589. align-items: center;
  1590. background: linear-gradient(45deg, $hx-theme-color-light, $hx-theme-color);
  1591. font-weight: bold;
  1592. color: #222222;
  1593. }
  1594. }
  1595. }
  1596. .zz{
  1597. position: absolute;
  1598. top: 0;
  1599. left: 0;
  1600. right: 0;
  1601. bottom: 0;
  1602. background-color: rgba(0,0,0,.7);
  1603. z-index: 1;
  1604. }
  1605. .cart-box{
  1606. display: flex;
  1607. justify-content: flex-start;
  1608. flex-flow: column;
  1609. background: #ffffff;
  1610. position: absolute;
  1611. bottom: 0;
  1612. z-index: 2;
  1613. max-height: 66%;
  1614. padding-bottom: 62px;
  1615. border-top-left-radius: 16px;
  1616. border-top-right-radius: 16px;
  1617. overflow: hidden;
  1618. width: 100%;
  1619. .rebate-box{
  1620. height: 30px;
  1621. background: #FFC107;
  1622. color: #FF9900;
  1623. text-align: center;
  1624. line-height: 30px;
  1625. font-size: 14px;
  1626. }
  1627. .box-container{
  1628. box-sizing: border-box;
  1629. padding:0 16px;
  1630. }
  1631. .operating-box{
  1632. font-size: 12px;
  1633. line-height: 40px;
  1634. height: 40px;
  1635. border-bottom: 1px solid #f6f6f6;
  1636. color: #666666;
  1637. display: flex;
  1638. flex-direction: row;
  1639. &_right{
  1640. flex: 1;
  1641. }
  1642. &_left{
  1643. display: flex;
  1644. flex-direction: row;
  1645. }
  1646. }
  1647. .goods-box{
  1648. height: 100%;
  1649. overflow: hidden;
  1650. flex: 1;
  1651. display: flex;
  1652. .goods-list-scroll{
  1653. height: 100%;
  1654. .goods-list{
  1655. width: 100%;
  1656. display: flex;
  1657. flex-wrap: wrap;
  1658. .box{
  1659. width: 100%;
  1660. border-bottom: 1px solid #f6f6f6;
  1661. box-sizing: border-box;
  1662. padding: 0 16px;
  1663. .m-store-item{
  1664. display: flex;
  1665. flex-direction: row;
  1666. width: 100%;
  1667. justify-content: space-between;
  1668. align-items: flex-end;
  1669. padding-top: 15px;
  1670. padding-bottom: 15px;
  1671. .m-img{
  1672. flex: 0 0 85px;
  1673. height: 85px;
  1674. background: #eee;
  1675. border-radius: 4px;
  1676. }
  1677. .m-text{
  1678. flex: 1;
  1679. position: relative;
  1680. height: 85px;
  1681. padding: 0 6px;
  1682. display: flex;
  1683. align-content: space-between;
  1684. flex-direction: column;
  1685. .m-title{
  1686. font-size: 16px;
  1687. color:#555555;
  1688. height: 21px;
  1689. font-weight: bold;
  1690. }
  1691. .m-descripe{
  1692. font-size: 12px;
  1693. color:#999999;
  1694. margin-top: 5px;
  1695. height: 35px;
  1696. }
  1697. .m-price-box{
  1698. height: 24px;
  1699. font-weight: bold;
  1700. display: flex;
  1701. flex-direction: row;
  1702. align-items: flex-end;
  1703. .symbol{
  1704. color:#ff582b;
  1705. font-size: 12px;
  1706. }
  1707. .m-price{
  1708. position: relative;
  1709. top: 2px;
  1710. font-size: 18px;
  1711. color:#ff582b;
  1712. }
  1713. .m-old-price{
  1714. margin-left: 3px;
  1715. display: flex;
  1716. flex-direction: row;
  1717. font-size: 10px;
  1718. color:#999999;
  1719. margin-top: 5upx;
  1720. text-decoration: line-through;
  1721. font-weight: normal;
  1722. }
  1723. }
  1724. .m-distance{
  1725. position: absolute;
  1726. right: 0;
  1727. bottom: -4px;
  1728. z-index: 16;
  1729. color:#b2b2b2;
  1730. font-size: 20upx;
  1731. text-align: right;
  1732. .jumpPosition{
  1733. position: absolute;
  1734. bottom: 23px;
  1735. right: 0;
  1736. z-index: 2;
  1737. width: 28px;
  1738. height: 28px;
  1739. }
  1740. }
  1741. }
  1742. }
  1743. }
  1744. }
  1745. }
  1746. }
  1747. }
  1748. }
  1749. }
  1750. .form-main{
  1751. display: flex;
  1752. flex-direction: column;
  1753. justify-content: left;
  1754. padding: 15px;
  1755. .form-main_ctn{
  1756. display: flex;
  1757. flex-direction: column;
  1758. justify-content: left;
  1759. padding: 23px 22px 22px 22px;
  1760. background-color: #fff;
  1761. border-radius: 8px;
  1762. .godos_tit{
  1763. margin-top: 4px;
  1764. margin-bottom: 6px;
  1765. font-size: 18px;
  1766. font-weight: bold;
  1767. color: #333;
  1768. }
  1769. .gg_tit{
  1770. margin-top: 8px;
  1771. font-size: 14px;
  1772. font-weight: bold;
  1773. color: #555;
  1774. }
  1775. .gg_box{
  1776. margin-top: 8px;
  1777. display: flex;
  1778. flex-direction: row;
  1779. flex-wrap: wrap;
  1780. font-size: 12;
  1781. color: #333;
  1782. .item{
  1783. margin-right: 14px;
  1784. margin-bottom: 14px;
  1785. border: 1px solid #f1f1f1;
  1786. border-radius: 4px;
  1787. padding: 4px 6px;
  1788. }
  1789. .item.active{
  1790. border-color: #ffe081;
  1791. background-color: #fff0b7;
  1792. }
  1793. }
  1794. .select_gg{
  1795. margin: 26px -12px 0;
  1796. padding: 6px 12px;
  1797. color: #999;
  1798. background-color: #f9f9f9;
  1799. display: flex;
  1800. flex-direction: row;
  1801. .lable{
  1802. }
  1803. .select_gg_box{
  1804. flex: 1;
  1805. display: flex;
  1806. flex-direction: row;
  1807. flex-wrap: wrap;
  1808. .gg-item{
  1809. color: #333;
  1810. .gg-item-cut{
  1811. margin-left: 3px;
  1812. margin-right: 3px;
  1813. }
  1814. }
  1815. .gg-item:last-child{
  1816. .gg-item-cut{
  1817. display: none;
  1818. }
  1819. }
  1820. }
  1821. }
  1822. .bottom{
  1823. position: relative;
  1824. display: flex;
  1825. flex-direction: row;
  1826. margin-top: 12px;
  1827. .price_box{
  1828. flex: 1;
  1829. lign-items: baseline;
  1830. color: #ff582b;
  1831. font-size: 14px;
  1832. position: relative;
  1833. top: 4px;
  1834. .price{
  1835. font-size: 24px;
  1836. }
  1837. }
  1838. .jumpPosition{
  1839. position: absolute;
  1840. right: 16px;
  1841. top: 2px;
  1842. }
  1843. .form-btn-box{
  1844. height: 30px;
  1845. line-height: 30px;
  1846. .add-btn{
  1847. border-radius: 50px;
  1848. background-color: #ffce3c;
  1849. padding: 0 12px;
  1850. display: flex;
  1851. height: 30px;
  1852. line-height: 30px;
  1853. align-items: center;
  1854. i{
  1855. font-weight: bold;
  1856. font-size: 18px;
  1857. margin-right: 3px;
  1858. margin-left: -4px;
  1859. }
  1860. text{
  1861. font-size: 14px;
  1862. font-weight: bold;
  1863. color: #363636;
  1864. }
  1865. }
  1866. }
  1867. }
  1868. }
  1869. .close{
  1870. position: absolute;
  1871. left: 50%;
  1872. margin-left: -20px;
  1873. bottom: -70px;
  1874. border-radius: 50%;
  1875. height: 40px;
  1876. width: 40px;
  1877. background-color: #fff;
  1878. opacity: 0.7;
  1879. text-align: center;
  1880. line-height: 43px;
  1881. i{
  1882. font-weight: bold;
  1883. font-size: 22px;
  1884. }
  1885. }
  1886. }
  1887. </style>