category - 副本 (2).vue 50 KB

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