index.vue 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906
  1. <template>
  2. <view>
  3. <!-- index.wxml -->
  4. <view class="wrap">
  5. <!-- 门店 -->
  6. <view class="store_wrap">
  7. <view class="store_l" v-if="store">
  8. <view class="logo_wrap">
  9. <image class="logo" mode="heightFix" :src="imgUrl + store.thumb"></image>
  10. </view>
  11. <view class="store_t_info">
  12. <view class="">
  13. <view class="store_t_info_t">
  14. <view class="name slh">{{ store.title }}</view>
  15. <!-- <image class="icon_phone" src="/statics/img/icon_phone.png" bind:tap="onMakePhone"></image> -->
  16. </view>
  17. <view class="desc">距离您{{ store.distance }}km</view>
  18. <!-- <view class="desc">营业时间:{{ store.begin_at+'~'+ store.end_at }}</view> -->
  19. </view>
  20. <!-- <image class="icon_phone" src="/statics/img/icon_phone.png" bind:tap="onMakePhone"></image> -->
  21. </view>
  22. </view>
  23. <view class="store_r" v-if="store">
  24. <view :class="fare_type != 1 ? 'wenzi active' : 'wenzi'" @tap="changeFareType" data-type="0">外卖</view>
  25. <view :class="fare_type == 1 ? 'wenzi active' : 'wenzi'" @tap="changeFareType" data-type="1">自取</view>
  26. </view>
  27. </view>
  28. <!-- 商品 -->
  29. <view class="goods_wrap">
  30. <scroll-view :scroll-y="true" :style="'height:' + scrollH + 'px'" :scroll-into-view="toViewYiji">
  31. <view class="goods_wrap_l">
  32. <view
  33. :class="item.id == activeCateId ? 'cate_item active' : 'cate_item'"
  34. :id="'yijicate' + item.id"
  35. :data-item="item"
  36. @tap="selectClassesClick"
  37. v-for="(item, index) in good_cate"
  38. :key="item.idx"
  39. >
  40. {{ item.name }}
  41. </view>
  42. </view>
  43. </scroll-view>
  44. <view class="">
  45. <!-- wx:if="{{ showErjiCate }}" -->
  46. <view class="erji_cate">
  47. <view v-if="currentCate.children && currentCate.children.length != 0">
  48. <scroll-view :scroll-x="true" :scroll-into-view="toViewErji" style="white-space: nowrap; width: 570rpx">
  49. <text
  50. :class="activeErjiId == item.id ? 'cate_item active' : 'cate_item'"
  51. :id="'erjiCate' + item.id"
  52. @tap="onErjiCate"
  53. :data-item="item"
  54. v-for="(item, index) in currentCate.children"
  55. :key="item.idx"
  56. >
  57. {{ item.name }}
  58. </text>
  59. </scroll-view>
  60. </view>
  61. <view style="padding-left: 15rpx" v-else>{{ currentCate.name }}</view>
  62. </view>
  63. <!-- toViewErji toView -->
  64. <scroll-view :scroll-y="true" :style="'height:' + scrollH + 'px'" :scroll-into-view="toView" scroll-with-animation @scroll="scrollProductList">
  65. <view class="goods_wrap_r">
  66. <view class="goods_list_w" :id="'yiji' + goods.good_cate_id" v-for="(goods, index) in good_list" :key="goods.idx">
  67. <view class="cate_name">{{ goods.name }}</view>
  68. <view>
  69. <!-- 有二级 -->
  70. <view v-if="goods.children">
  71. <view class="goods_list" :id="'erji' + goods.good_cate_id" v-for="(goods, index1) in goods.children" :key="goods.idx">
  72. <view class="goods_item_w" :id="item.id" v-for="(item, index2) in goods.goodList" :key="item.idx">
  73. <view class="goods_item">
  74. <image class="goods_tu" :src="imgUrl + item.thumb" @tap="onGoodsSpec" :data-item="item"></image>
  75. <view class="goods_info">
  76. <view class="goods_title slh_s" @tap="onGoodsSpec" :data-item="item">{{ item.title }}</view>
  77. <view class="goods_desc slh" @tap="onGoodsSpec" :data-item="item">{{ item.describe ? item.describe : '' }}</view>
  78. <view class="goods_specs">
  79. <view class="price">
  80. <view>
  81. <text class="unit">¥</text>
  82. {{ item.price }}
  83. </view>
  84. <view class="vip">会员价{{ '¥' + item.low_member_price }}</view>
  85. </view>
  86. <view class="topNum_w" v-if="item.status == 1">
  87. <view class="btn_specs" v-if="item.good_specs && item.good_specs.length != 0" @tap="onGoodsSpec" :data-item="item">
  88. <text class="">选规格</text>
  89. <view class="topNum" v-if="item.good_specs && item.good_specs.length != 0 && item.cartNums">
  90. {{ item.cartNums }}
  91. </view>
  92. </view>
  93. <van-stepper
  94. v-else
  95. :value="item.nums"
  96. input-width="40rpx"
  97. min="0"
  98. disable-input
  99. custom-class="stepper"
  100. plus-class="plus"
  101. minus-class="minus"
  102. input-class="step_input"
  103. @change="onChangeSpecNum($event, { item })"
  104. :data-item="item"
  105. />
  106. </view>
  107. <view class="topNum_w" v-if="item.status != 1">已售罄</view>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="use_coupon" v-if="item.is_use_coupon != 1">特殊商品不参与任何活动</view>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 无二级 -->
  116. <view v-else :id="'erji' + goods.good_cate_id">
  117. <view class="goods_list">
  118. <view class="goods_item_w" :id="item.id" v-for="(item, index1) in goods.goodList" :key="item.idx">
  119. <view class="goods_item">
  120. <image class="goods_tu" :src="imgUrl + item.thumb" @tap="onGoodsSpec" :data-item="item"></image>
  121. <view class="goods_info">
  122. <view class="goods_title slh_s" @tap="onGoodsSpec" :data-item="item">{{ item.title }}</view>
  123. <view class="goods_desc slh" @tap="onGoodsSpec" :data-item="item">{{ item.describe ? item.describe : '' }}</view>
  124. <view class="goods_specs">
  125. <view class="price">
  126. <view>
  127. <text class="unit">¥</text>
  128. {{ item.price }}
  129. </view>
  130. <view class="vip">会员价{{ '¥' + item.low_member_price }}</view>
  131. </view>
  132. <view class="topNum_w" v-if="item.status == 1">
  133. <view class="btn_specs" v-if="item.good_specs && item.good_specs.length != 0" @tap="onGoodsSpec" :data-item="item">
  134. <text class="">选规格</text>
  135. <view class="topNum" v-if="item.good_specs && item.good_specs.length != 0 && item.cartNums">
  136. {{ item.cartNums }}
  137. </view>
  138. </view>
  139. <van-stepper
  140. v-else
  141. :value="item.nums"
  142. input-width="40rpx"
  143. min="0"
  144. disable-input
  145. custom-class="stepper"
  146. plus-class="plus"
  147. minus-class="minus"
  148. input-class="step_input"
  149. @change="onChangeSpecNum($event, { item })"
  150. :data-item="item"
  151. />
  152. </view>
  153. <view class="topNum_w" v-if="item.status != 1">已售罄</view>
  154. </view>
  155. </view>
  156. </view>
  157. <view class="use_coupon" v-if="item.is_use_coupon != 1">特殊商品不参与任何活动</view>
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </scroll-view>
  165. </view>
  166. </view>
  167. <!-- 合计 -->
  168. <!-- style="background-image:url({{ hejiBg }})" -->
  169. <view class="heji_wrap">
  170. <view class="heji_l">
  171. <view class="cart_w" @tap="goShopCart">
  172. <image class="cart_tu" src="/static/statics/img/shopcar_tu.png"></image>
  173. <view class="goods_num" v-if="totalNums">{{ totalNums }}</view>
  174. </view>
  175. <view class="total_price">
  176. <text>
  177. <text class="unit">¥</text>
  178. {{ totalPrice }}
  179. </text>
  180. <!-- <text class="vip" wx:if="{{ totalMemberPrice }}"><text class="unit">{{ '会员¥'+totalMemberPrice }}</text></text> -->
  181. </view>
  182. </view>
  183. <view class="heji_btn" @tap="toPay">选好了</view>
  184. </view>
  185. </view>
  186. <!-- 规格 -->
  187. <uni-popup ref="goodsSpec" >
  188. <view class="guige_wrap" v-if="showGoodsSpec">
  189. <view class="guige">
  190. <view class="goods_thumb_wrap" style="">
  191. <!-- aspectFit center widthFix -->
  192. <image class="goods_thumb" mode="widthFix" :src="imgUrl + currentGoods.thumb"></image>
  193. </view>
  194. <view class="goods_name">
  195. <view class="goods_name_l">{{ currentGoods.title }}</view>
  196. </view>
  197. <view class="goods_desc" v-if="currentGoods.describe">
  198. <view class="goods_desc_nr">{{ currentGoods.describe }}</view>
  199. </view>
  200. <view class="goods_guige" v-if="currentGoods.good_specs.length != 0">
  201. <view class="goods_guige_name">规格</view>
  202. <view class="goods_guige_nr">
  203. <view
  204. :class="good_specs.is_checked ? 'guige_item selected' : 'guige_item'"
  205. @tap="onChangeSpecGoods"
  206. :data-specs="good_specs"
  207. :data-id="good_specs.id"
  208. v-for="(good_specs, index) in currentGoods.good_specs"
  209. :key="index"
  210. >
  211. <view class="item_wenzi">
  212. <text>{{ good_specs.title }}</text>
  213. </view>
  214. <!-- <view class="price">
  215. <text>
  216. <text class="unit"></text>
  217. <text>{{ good_specs.price }}</text>
  218. </text>
  219. <text class="vip">会员价{{ '¥'+ good_specs.member_price}}</text>
  220. </view> -->
  221. </view>
  222. </view>
  223. </view>
  224. <view class="guige_b">
  225. <view class="guige_b_l">
  226. <text class="price">
  227. <text class="unit">¥</text>
  228. {{ checkedSpec.price }}
  229. </text>
  230. <text class="vip">会员价{{ '¥' + checkedSpec.member_price }}</text>
  231. </view>
  232. <!-- <view class="">
  233. <van-stepper value="{{ checkedSpec.nums }}" async-change input-width="40rpx" min="0" disable-input custom-class="stepper" plus-class="plus" minus-class="minus" input-class="step_input" data-item="{{ checkedSpec }}" bind:change="onChangeSpecNum" />
  234. </view> -->
  235. <view class="" v-if="checkedSpec.status == 1">
  236. <van-stepper
  237. :value="checkedSpecNums"
  238. async-change
  239. input-width="40rpx"
  240. min="0"
  241. disable-input
  242. custom-class="stepper"
  243. plus-class="plus"
  244. minus-class="minus"
  245. input-class="step_input"
  246. :data-item="checkedSpec"
  247. @change="onChangeSpecNum($event, { item: checkedSpec })"
  248. />
  249. </view>
  250. <view class="" v-if="checkedSpec.status != 1">已售罄</view>
  251. </view>
  252. </view>
  253. <van-icon name="close" class="btn_close" color="#ffffff" size="30px" @tap.native="closeGoodsSpec" />
  254. </view>
  255. </uni-popup>
  256. <!-- <van-overlay :z-index="5" class-style="background: rgba(0,0,0,.3);" :show="showGoodsSpec" @tap.native.stop.prevent="closeGoodsSpec"></van-overlay> -->
  257. <!-- style="top: {{ setBgHeight + 40 }}px" -->
  258. <!-- loading -->
  259. <!-- <van-overlay show="{{ loading }}" z-index="100">
  260. <van-loading custom-class="custom_loading" />
  261. </van-overlay> -->
  262. <!-- 开启定位提示 -->
  263. <van-dialog
  264. class="custom_dialog"
  265. title="地理位置未授权"
  266. message="开启羊汤馆小程序定位授权后,可为您推荐就近门店"
  267. :show="showOpenLocation"
  268. confirm-button-text="授权定位"
  269. confirm-button-color="#D54C43"
  270. show-cancel-button
  271. @close="onCloseLocation"
  272. @confirm="onConfirmLocation"
  273. ></van-dialog>
  274. <!-- 所选门店不支持的提醒 -->
  275. <van-dialog :title="tipsTitle" :show="showTips" class="single_btn" confirm-button-color="#000000" confirmButtonText="我知道了" @confirm="closeShowTips"></van-dialog>
  276. <!-- 配送方式弹层 -->
  277. <!-- <van-overlay z-index="5" class-style="background: rgba(0,0,0,.3);" show="{{ showSelectFare }}">
  278. <view class="fare_w">
  279. <view class="title">请选择您的取货方式</view>
  280. <view class="type">
  281. <image class="type_bg" src="/statics/img/type_bg.png"></image>
  282. <view class="type_item waimai" bind:tap="changeFareType" data-type="0">外卖</view>
  283. <view class="type_item ziqu" bind:tap="changeFareType" data-type="1">自提</view>
  284. </view>
  285. <van-icon name="close" class="btn_close" color="#ffffff" size="30px" bind:tap="closeSelectFare" />
  286. </view>
  287. </van-overlay> -->
  288. <!-- js -->
  289. </view>
  290. </template>
  291. <script module="we" lang="wxs">
  292. /* 字符串长度截取 */
  293. var strSlice = function(value) {
  294. if(value.length > 10){
  295. value = value.slice(0,6)+'...'
  296. };
  297. return value;
  298. };
  299. module.exports = {
  300. strSlice: strSlice
  301. }
  302. </script>
  303. <script>
  304. // index.js
  305. import * as api from '@/service/api'
  306. import * as util from '@/util/util.js'
  307. import func from '@/util/wxUtil.js';
  308. let clickScrollTimer;
  309. export default {
  310. data() {
  311. return {
  312. customTop: getApp().globalData.customTop,
  313. setBgHeight: getApp().globalData.setBgHeight,
  314. // 导航条高度
  315. imgUrl: api.API_BASE_IMAGE,
  316. keywords: '',
  317. showGoodsSpec: false,
  318. // 规格弹层
  319. showShopCar: false,
  320. // 购物车弹层
  321. store: null,
  322. // 所在门店
  323. loading: false,
  324. // 全局loading
  325. fare_type: 1,
  326. // 0外卖 1自提 默认自提
  327. showOpenLocation: false,
  328. // 开启定位提醒
  329. good_list: null,
  330. cartList: null,
  331. // showSelectFare: false, // 配送方式弹层
  332. showTopCate: false,
  333. toViewErji: null,
  334. totalNums: 0,
  335. totalPrice: 0,
  336. totalMemberPrice: 0,
  337. activeErjiId: 0,
  338. checkedSpecNums: 0,
  339. isClickToScroll: false,
  340. // 通过点击滚动产品列表 true 滚动事件中不赋值,false 时赋值
  341. activeCateId: '',
  342. toViewErji: '',
  343. activeErjiId: '',
  344. toView: '',
  345. currentCate: {
  346. children: '',
  347. name: ''
  348. },
  349. showErjiCate: false,
  350. tableId: null,
  351. storeWrapH: '',
  352. scrollH: '',
  353. guigeH: '',
  354. toViewYiji: '',
  355. cartGoods: '',
  356. good_cate: '',
  357. currentGoods: {
  358. thumb: '',
  359. title: '',
  360. describe: '',
  361. good_specs: []
  362. },
  363. checkedSpec: {
  364. member_price: '',
  365. status: 0
  366. },
  367. checkedAddress: '',
  368. showTips: false,
  369. showSelectFare: false,
  370. goods: {
  371. good_cate_id: '',
  372. idx: '',
  373. name: '',
  374. children: '',
  375. goodList: []
  376. },
  377. good_specs: {
  378. is_checked: false,
  379. id: '',
  380. title: ''
  381. },
  382. tipsTitle: ''
  383. };
  384. },
  385. onLoad: function (options) {
  386. // Do some initialize when page load.
  387. let that = this;
  388. if (options.tableId) {
  389. that.setData({
  390. tableId: options.tableId
  391. });
  392. }
  393. },
  394. onShow: function () {
  395. // Do something when page show.
  396. let that = this;
  397. that.setData({
  398. showGoodsSpec: false,
  399. // 规格弹层
  400. showShopCar: false // 购物车弹层
  401. }); // 获取配送方式
  402. if (uni.getStorageSync('fare_type')) {
  403. that.setData({
  404. fare_type: uni.getStorageSync('fare_type')
  405. });
  406. } else {
  407. // 未获取到,需主动存一下,默认自提
  408. uni.setStorage({
  409. key: 'fare_type',
  410. data: '1'
  411. });
  412. } // 单店开是否开定位,都需要把商品调出来
  413. getApp().globalData.getLocal(function () {
  414. that.afterAuthLocation(); // 拒绝定位时,提醒去开启
  415. if (getApp().globalData.location_auth == -1) {
  416. console.log('拒绝定位');
  417. that.setData({
  418. showOpenLocation: true
  419. });
  420. }
  421. });
  422. },
  423. onReady: function () {
  424. // Do something when page ready.
  425. let that = this; // 滚动区域高度计算
  426. uni.getSystemInfo({
  427. success: function (res) {
  428. let height = res.windowHeight; // console.log('总height',height)
  429. const query = uni.createSelectorQuery();
  430. query.select('.store_wrap').boundingClientRect();
  431. query.select('.heji_wrap').boundingClientRect(); // query.select('.erji_cate').boundingClientRect();
  432. query.exec((res) => {
  433. // 分别取出节点的高度
  434. let storeWrapH = res[0].height; // 门店选择的高度 px
  435. let hejiWrapH = res[1].height; // 底部合计的高度 px
  436. // let erjiCateH = res[2].height; // 顶部分类固定宽
  437. // let scrollH = height - storeWrapH - hejiWrapH - erjiCateH;
  438. let scrollH = height - storeWrapH - hejiWrapH;
  439. that.setData({
  440. storeWrapH: storeWrapH,
  441. scrollH: scrollH,
  442. guigeH: height * 0.5
  443. }); // console.log('scrollH',scrollH)
  444. // console.log('门店高度',that.data.storeWrapH);
  445. });
  446. }
  447. });
  448. },
  449. onHide: function () {
  450. // Do something when page hide.
  451. // console.log('hide')
  452. let that = this; // return;
  453. // 主动模拟selectClassesClick
  454. clearTimeout(clickScrollTimer);
  455. let item = that.good_cate[0];
  456. that.setData({
  457. isClickToScroll: true,
  458. activeCateId: item.id,
  459. toView: 'erji' + (item.children && item.children.length != 0 ? item.children[0].id : item.id),
  460. //不能数字开头,所以开头加了productItem
  461. activeErjiId: item.children && item.children.length != 0 ? item.children[0].id : item.id,
  462. toViewYiji: 'yijicate' + item.id
  463. }); // console.log('toView',that.data.toView);
  464. // console.log('activeErjiId',that.data.activeErjiId);
  465. let good_cate = that.good_cate; // 循环当前分类
  466. for (let i in good_cate) {
  467. if (good_cate[i].id == item.id) {
  468. that.setData({
  469. currentCate: good_cate[i]
  470. });
  471. }
  472. }
  473. },
  474. onUnload: function () {
  475. // Do something when page close.
  476. },
  477. onPullDownRefresh: function () {
  478. // Do something when pull down.
  479. },
  480. onReachBottom: function () {
  481. // Do something when page reach bottom.
  482. },
  483. onPageScroll: function () {
  484. // Do something when page scroll
  485. },
  486. onResize: function () {
  487. // Do something when page resize
  488. },
  489. methods: {
  490. // 获取购物车商品
  491. getCartsList() {
  492. let that = this;
  493. api.getCartsList({}).then(res => {
  494. // 在首页只体现普通商品
  495. let list = res.result.list;
  496. that.setData({
  497. cartGoods: list,
  498. totalNums: res.result.total_num,
  499. totalPrice: res.result.money
  500. }); // 同步商品列表
  501. that.updateTotalGoods();
  502. })
  503. },
  504. // 店铺列表(只拿最近的)
  505. getStoreList(lat, lng) {
  506. let that = this;
  507. let data = {
  508. lat: lat ? lat : getApp().globalData.lat,
  509. lng: lng ? lng : getApp().globalData.lng,
  510. page: 1,
  511. size: 10
  512. };
  513. api.getStoreList(data).then(res => {
  514. let storeList = res.result; // 有门店
  515. if (storeList && storeList.length != 0) {
  516. let currentStore = storeList[0];
  517. that.setData({
  518. store: currentStore
  519. }); // 营业时间的判断
  520. // that.checkBusinessTime();
  521. // 存下门店
  522. uni.setStorage({
  523. key: 'store',
  524. data: JSON.stringify(that.store)
  525. }); // 获取店内商品
  526. that.getGoodsList(function () {
  527. // 登录状态
  528. if (getApp().globalData.token) {
  529. getApp().globalData.loadingCount = 0; // 主动关
  530. that.getCartsList();
  531. }
  532. });
  533. } else {
  534. uni.showToast({
  535. title: '门店暂未营业',
  536. icon: 'none'
  537. });
  538. }
  539. })
  540. },
  541. // 拨打店铺电话
  542. onMakePhone() {
  543. let that = this;
  544. uni.makePhoneCall({
  545. phoneNumber: that.store.phone
  546. });
  547. },
  548. // 获取商品分类及商品
  549. getGoodsList(callback) {
  550. let that = this;
  551. let params = {
  552. store_id: that.store.id
  553. };
  554. api.getGoodsList(params).then(res => {
  555. console.log(res)
  556. let list = res.result.good; // 回调
  557. if (callback) {
  558. callback();
  559. }
  560. that.setData({
  561. good_cate: res.result.good_cate,
  562. good_list: list,
  563. activeCateId: res.result.good_cate[0].id,
  564. //默认左侧第一个选中
  565. currentCate: res.result.good_cate[0],
  566. // 当前分类(结构为一级分类+二级分类)
  567. toView: 'erji' + res.result.good_cate[0].id
  568. }); // console.log('左侧第一个分类',that.data.activeCateId);
  569. // console.log('右侧第一个内容',that.data.toView);
  570. // 一级节点
  571. // 不知道干什么用的
  572. // that.good_list.forEach((item) => {
  573. // // 添加节点的布局位置的查询请求
  574. // uni.createSelectorQuery()
  575. // .select('#yiji' + item.good_cate_id)
  576. // .boundingClientRect((rect) => {
  577. // console.log('rect:',rect)
  578. // item.offsetTop = rect.top;
  579. // item.height = rect.height; // console.log('rect',rect)
  580. // // console.log('item',item);
  581. // })
  582. // .exec(); // 二级节点
  583. // if (item.children) {
  584. // item.children.forEach((erjiItem) => {
  585. // uni.createSelectorQuery()
  586. // .select('#erji' + erjiItem.good_cate_id)
  587. // .boundingClientRect((rect) => {
  588. // erjiItem.offsetTop = rect.top;
  589. // erjiItem.height = rect.height; // console.log('rect',rect)
  590. // // console.log('item',item);
  591. // })
  592. // .exec();
  593. // });
  594. // }
  595. // }); // console.log('商品列表带节点',that.data.good_list);
  596. })
  597. },
  598. // 左侧菜单栏切换事件
  599. selectClassesClick: function (e) {
  600. let that = this; // return;
  601. console.log('e===', e);
  602. clearTimeout(clickScrollTimer);
  603. let item = e.currentTarget.dataset.item;
  604. that.setData({
  605. isClickToScroll: true,
  606. activeCateId: item.id,
  607. toView: 'erji' + (item.children && item.children.length != 0 ? item.children[0].id : item.id),
  608. //不能数字开头,所以开头加了productItem
  609. activeErjiId: item.children && item.children.length != 0 ? item.children[0].id : item.id,
  610. toViewYiji: 'yijicate' + item.id
  611. }); // console.log('toView',that.data.toView);
  612. // console.log('activeErjiId',that.data.activeErjiId);
  613. let good_cate = that.good_cate; // 循环当前分类
  614. for (let i in good_cate) {
  615. if (good_cate[i].id == item.id) {
  616. that.setData({
  617. currentCate: good_cate[i]
  618. });
  619. }
  620. } // console.log('当前fenlei',that.data.currentCate);
  621. },
  622. // 监听右边商品列表滑动
  623. scrollProductList(e) {
  624. let that = this;
  625. let good_cate = that.good_cate;
  626. let scrollTop = e.detail.scrollTop;
  627. if (scrollTop != 0) {
  628. that.setData({
  629. showErjiCate: true
  630. });
  631. } // return;
  632. // console.log('isClickToScroll',that.data.isClickToScroll);
  633. // console.log('e.detail.scrollTop',scrollTop);
  634. if (!that.isClickToScroll) {
  635. that.good_list.forEach((item) => {
  636. // console.log('item',item);
  637. // console.log('item.offsetTop',item.offsetTop );
  638. // console.log('item.height',item.height);
  639. if (scrollTop >= item.offsetTop - that.storeWrapH && e.detail.scrollTop <= item.offsetTop - that.storeWrapH + item.height) {
  640. that.setData({
  641. activeCateId: item.good_cate_id,
  642. toViewYiji: 'yijicate' + item.good_cate_id
  643. }); // console.log('左侧分类1111',item.good_cate_id)
  644. good_cate.forEach((cateItem) => {
  645. if (cateItem.id == item.good_cate_id) {
  646. that.setData({
  647. currentCate: cateItem
  648. });
  649. }
  650. }); // console.log('当前分类',that.data.currentCate);
  651. if (item.children) {
  652. item.children.forEach((erjiItem) => {
  653. if (scrollTop >= erjiItem.offsetTop - 180 && scrollTop <= erjiItem.offsetTop + erjiItem.height - 180) {
  654. that.setData({
  655. activeErjiId: erjiItem.good_cate_id,
  656. toViewErji: 'erjiCate' + erjiItem.good_cate_id
  657. });
  658. }
  659. });
  660. }
  661. return;
  662. }
  663. });
  664. } else {
  665. clickScrollTimer = setTimeout(function () {
  666. that.setData({
  667. isClickToScroll: false
  668. });
  669. }, 300);
  670. } // console.log('当前分类',that.data.currentCate)
  671. // console.log('左侧分类',that.data.activeCateId);
  672. // console.log('二级分类',that.data.activeErjiId);
  673. // console.log('右侧分类',that.data.toView);
  674. },
  675. // 点击某个二级菜单
  676. onErjiCate(event) {
  677. // console.log('二级event',event)
  678. let that = this;
  679. let good_cate = that.good_cate;
  680. let item = event.currentTarget.dataset.item; // console.log('item',item);
  681. // return;
  682. that.setData({
  683. toView: 'erji' + item.id,
  684. activeErjiId: item.id,
  685. activeCateId: item.parentid,
  686. toViewErji: 'erjiCate' + item.id
  687. }); // 循环当前分类
  688. // for(let i in good_cate){
  689. // if(good_cate[i].id == item.parentid){
  690. // that.setData({
  691. // currentCate: good_cate[i]
  692. // })
  693. // }
  694. // }
  695. // console.log('toView',that.data.toView);
  696. // console.log('当前的一级分类',that.data.currentCate)
  697. },
  698. // 查看规格
  699. onGoodsSpec(event) {
  700. let that = this;
  701. let item = event.currentTarget.dataset.item;
  702. if (item.status != 1) {
  703. // 如果商品售罄
  704. uni.showToast({
  705. title: '此商品已售罄',
  706. icon: 'none'
  707. });
  708. return;
  709. }
  710. let checkedSpec = null; // 有规格
  711. if (item.good_specs && item.good_specs.length != 0) {
  712. let specsArr = item.good_specs;
  713. for (let i in specsArr) {
  714. if (i == 0) {
  715. specsArr[i].is_checked = true; // 规格默认选中第一项
  716. checkedSpec = specsArr[i];
  717. } else {
  718. specsArr[i].is_checked = false;
  719. }
  720. }
  721. } else {
  722. // 无规格
  723. item['member_price'] = item.base_member_price;
  724. checkedSpec = item;
  725. } // console.log('当前商品',item);
  726. // console.log('当前选中规格',checkedSpec);
  727. that.setData({
  728. showGoodsSpec: true,
  729. currentGoods: item,
  730. // 当前商品
  731. checkedSpec: checkedSpec,
  732. // 当前选中规格
  733. checkedSpecNums: checkedSpec.nums ? checkedSpec.nums : 0
  734. });
  735. this.$refs.goodsSpec.open()
  736. },
  737. // 更改商品规格弹层的商品数量
  738. onChangeSpecNum(event, _dataset) {
  739. /* ---处理dataset begin--- */
  740. this.datasetHandle(event, _dataset);
  741. /* ---处理dataset end--- */
  742. let that = this;
  743. let nums = event.detail;
  744. that.setData({
  745. checkedSpecNums: nums
  746. }); // 更新购物车
  747. let oldCartGoods = that.cartGoods;
  748. let item = event.currentTarget.dataset.item; // console.log('item',item);
  749. // console.log('购物车',oldCartGoods);
  750. if (that.isAddCart(item)) {
  751. console.log('在'); // 在购物车
  752. // return;
  753. let params = {}; // 有规格id
  754. if (item.good_id) {
  755. for (let i in oldCartGoods) {
  756. if (oldCartGoods[i].good_id == item.good_id && oldCartGoods[i].good_specs_id == item.id) {
  757. params.id = oldCartGoods[i].id; // 购物车ID
  758. break;
  759. }
  760. }
  761. } else {
  762. // 无规格id
  763. for (let i in oldCartGoods) {
  764. if (oldCartGoods[i].good_id == item.id && !oldCartGoods[i].good_specs_id) {
  765. params.id = oldCartGoods[i].id; // 购物车ID
  766. break;
  767. }
  768. }
  769. }
  770. if (nums != 0) {
  771. params.nums = nums; // 修改数量
  772. api.editnum(params).then(res => {
  773. console.log(res)
  774. that.getCartsList();
  775. })
  776. } else {
  777. // 删除
  778. api.removeCarts(params).then(res => {
  779. console.log(res)
  780. that.getCartsList();
  781. })
  782. }
  783. } else {
  784. console.log('不在'); // return;
  785. let params = {
  786. good_id: item.good_id ? item.good_id : item.id,
  787. nums: nums,
  788. is_add: 0 // 是否为活动加购商品(1是 0否)
  789. }; // 有规格id(加一个无规格的看看)
  790. if (item.good_id) {
  791. params.good_specs_id = item.id;
  792. } // 添加购物车
  793. api.createCarts(params).then(res => {
  794. that.getCartsList();
  795. })
  796. }
  797. },
  798. // 切换规格
  799. onChangeSpecGoods(event) {
  800. let that = this; // console.log('event====',event);
  801. let currentSpecs = event.currentTarget.dataset.specs;
  802. let oldCartGoods = that.cartGoods;
  803. let checkedSpec = null;
  804. let checkedSpecNums = 0; // 同步选中状态
  805. let currentGoods = that.currentGoods;
  806. let specsArr = currentGoods.good_specs;
  807. for (let j in specsArr) {
  808. if (specsArr[j].id == currentSpecs.id) {
  809. specsArr[j].is_checked = true;
  810. if (that.isAddCart(specsArr[j])) {
  811. // 同步购物车
  812. for (let i in oldCartGoods) {
  813. if (oldCartGoods[i].good_id == currentSpecs.good_id && oldCartGoods[i].good_specs_id == currentSpecs.id) {
  814. specsArr[j].nums = oldCartGoods[i].nums;
  815. checkedSpecNums = oldCartGoods[i].nums; // console.log('进来了==')
  816. break;
  817. }
  818. }
  819. } else {
  820. specsArr[j].nums = 0;
  821. checkedSpecNums = 0;
  822. }
  823. checkedSpec = specsArr[j]; // break;
  824. } else {
  825. specsArr[j].is_checked = false;
  826. }
  827. }
  828. that.setData({
  829. currentGoods: currentGoods,
  830. checkedSpec: checkedSpec,
  831. checkedSpecNums: checkedSpecNums
  832. }); // console.log('全规格',specsArr);
  833. // console.log('当前规格',checkedSpec);
  834. },
  835. // 关闭规格
  836. closeGoodsSpec() {
  837. let that = this;
  838. that.setData({
  839. showGoodsSpec: false
  840. });
  841. },
  842. // 计算价格和数量
  843. computedGoods() {
  844. let that = this;
  845. let list = that.cartGoods;
  846. let totalNums = 0;
  847. let totalPrice = 0;
  848. let totalMemberPrice = 0;
  849. for (let i in list) {
  850. if (list[i].nums != 0) {
  851. totalNums += parseInt(list[i].nums);
  852. totalPrice += parseFloat(list[i].total_prices);
  853. totalMemberPrice += parseFloat(list[i].total_member_prices);
  854. }
  855. }
  856. that.setData({
  857. totalNums: totalNums,
  858. totalPrice: totalPrice,
  859. totalMemberPrice: totalMemberPrice
  860. }); // 同步商品列表
  861. // that.updateTotalGoods();
  862. },
  863. // 去结算
  864. toPay() {
  865. let that = this; // 未开启 不允许进入下一步
  866. if (getApp().globalData.location_auth == -1) {
  867. uni.showToast({
  868. title: '地理位置未授权,请您授权定位后重试',
  869. icon: 'none'
  870. });
  871. return;
  872. } // 验证登录
  873. getApp().globalData.verifyLogin(function (loginStatus) {
  874. // console.log('登录状态',loginStatus)
  875. if (loginStatus) {
  876. if (!that.totalNums) {
  877. uni.showToast({
  878. title: '请先选择商品',
  879. icon: 'none'
  880. });
  881. return;
  882. } // 验证是否能下单,如果不能给提示并进购物车(因为可能是购物车有商品,但未勾选)
  883. let params = {
  884. token: getApp().globalData.token
  885. };
  886. api.createList(params).then(res => {
  887. if (res.data.code != 200) {
  888. uni.showToast({
  889. title: res.data.msg,
  890. icon: 'none',
  891. duration: 3000
  892. });
  893. setTimeout(function () {
  894. uni.navigateTo({
  895. url: '/pages/shopcart/index'
  896. });
  897. }, 1000);
  898. } else {
  899. uni.navigateTo({
  900. url: '/pages/create-order/index'
  901. });
  902. }
  903. })
  904. }
  905. });
  906. },
  907. // 取消授权提醒
  908. onCloseLocation() {
  909. let that = this;
  910. that.setData({
  911. showOpenLocation: false
  912. });
  913. },
  914. // 同意去打开地理位置
  915. onConfirmLocation() {
  916. // console.log('触发====');
  917. let that = this;
  918. uni.openSetting({
  919. success: function (res) {
  920. console.log(res);
  921. let authSetting = res.authSetting;
  922. if (authSetting['scope.userLocation']) {
  923. // 开启
  924. getApp().globalData.getLocal(function () {
  925. that.afterAuthLocation();
  926. });
  927. }
  928. }
  929. });
  930. },
  931. // 允许定位后的操作(或 拒绝定位,但选了默认店铺)
  932. afterAuthLocation(lat, lng) {
  933. let that = this; // 外卖流程,需要验证是否登录
  934. if (that.fare_type == 0) {
  935. getApp().globalData.verifyLogin(function (loginstatus) {
  936. if (loginstatus) {
  937. console.log('登录状态', loginstatus);
  938. try {
  939. uni.getStorage({
  940. key: 'checkedAddress',
  941. success: function (res) {
  942. // console.log('res.data',res.data);
  943. let checkedAddress = JSON.parse(res.data);
  944. that.setData({
  945. checkedAddress: checkedAddress
  946. }); // 按地址算
  947. that.getStoreList(that.checkedAddress.lat, that.checkedAddress.lnt);
  948. },
  949. fail: function () {
  950. uni.showToast({
  951. title: '请先选择收货地址',
  952. icon: 'none'
  953. });
  954. setTimeout(function () {
  955. uni.navigateTo({
  956. url: '/pages/user/address/list/index'
  957. });
  958. }, 1000);
  959. }
  960. });
  961. } catch (err) {
  962. console.log('报错信息', err);
  963. }
  964. }
  965. });
  966. } else {
  967. that.getStoreList();
  968. }
  969. console.log('定位成功');
  970. },
  971. // 切换配送方式
  972. changeFareType(event) {
  973. // console.log(event);
  974. let that = this;
  975. let fare_type = event.currentTarget.dataset.type; // 0外卖 1自提
  976. let store = that.store; // 判断门店是否支持此配送方式
  977. if (fare_type == 0 && store.is_delivery != 1) {
  978. uni.showToast({
  979. title: '门店暂不支持外卖',
  980. icon: 'none'
  981. });
  982. return;
  983. }
  984. if (fare_type == 1 && store.is_ziti != 1) {
  985. uni.showToast({
  986. title: '门店暂不支持自提',
  987. icon: 'none'
  988. });
  989. return;
  990. } // 支持
  991. // if(that.data.showSelectFare){
  992. // that.setData({
  993. // showSelectFare: false
  994. // })
  995. // };
  996. // 切换时实现: 自取选门店,外卖选地址
  997. // 为每次选外卖时重选地址,清掉checkedAddress
  998. uni.removeStorageSync('checkedAddress'); // 更新
  999. that.setData({
  1000. fare_type: fare_type
  1001. });
  1002. uni.setStorage({
  1003. key: 'fare_type',
  1004. data: that.fare_type
  1005. }); // 切到外卖
  1006. if (fare_type == 0) {
  1007. // 选地址
  1008. uni.navigateTo({
  1009. url: '/pages/user/address/list/index'
  1010. });
  1011. }
  1012. },
  1013. // 关闭提醒
  1014. closeShowTips() {
  1015. let that = this;
  1016. that.setData({
  1017. showTips: false
  1018. });
  1019. },
  1020. // 关闭选配送方式(用不到了)
  1021. closeSelectFare() {
  1022. let that = this;
  1023. that.setData({
  1024. showSelectFare: false
  1025. });
  1026. },
  1027. // 计算每个商品的总数量
  1028. updateTotalGoods() {
  1029. let that = this;
  1030. let oldCartGoods = that.cartGoods; // console.log('购物车',oldCartGoods);
  1031. let list = that.good_list;
  1032. list.forEach((item) => {
  1033. if (item.children) {
  1034. // 有二级
  1035. let erjiGoods = item.children;
  1036. erjiGoods.forEach((erjiItem) => {
  1037. let goodsList = erjiItem.goodList;
  1038. goodsList.forEach((goods) => {
  1039. goods.cartNums = 0;
  1040. oldCartGoods.forEach((oldGoods) => {
  1041. if (!oldGoods.is_add) {
  1042. // 有规格
  1043. if (goods.good_specs && goods.good_specs.length != 0) {
  1044. let specsArr = goods.good_specs;
  1045. specsArr.forEach((goodsSpec) => {
  1046. if (oldGoods.good_id == goodsSpec.good_id && oldGoods.good_specs_id == goodsSpec.id) {
  1047. goodsSpec.nums = oldGoods.nums;
  1048. goods.cartNums += oldGoods.nums;
  1049. }
  1050. });
  1051. } else {
  1052. // 无规格
  1053. if (oldGoods.good_id == goods.id) {
  1054. goods.nums = oldGoods.nums;
  1055. }
  1056. }
  1057. }
  1058. });
  1059. });
  1060. });
  1061. } else {
  1062. // 无二级
  1063. let goodsList = item.goodList;
  1064. goodsList.forEach((goods) => {
  1065. goods.cartNums = 0;
  1066. oldCartGoods.forEach((oldGoods) => {
  1067. if (!oldGoods.is_add) {
  1068. // 有规格
  1069. if (goods.good_specs && goods.good_specs.length != 0) {
  1070. let specsArr = goods.good_specs;
  1071. specsArr.forEach((goodsSpec) => {
  1072. if (oldGoods.good_id == goodsSpec.good_id && oldGoods.good_specs_id == goodsSpec.id) {
  1073. goodsSpec.nums = oldGoods.nums;
  1074. goods.cartNums += oldGoods.nums;
  1075. }
  1076. });
  1077. } else {
  1078. // 无规格
  1079. if (oldGoods.good_id == goods.id) {
  1080. goods.nums = oldGoods.nums;
  1081. }
  1082. }
  1083. }
  1084. });
  1085. });
  1086. }
  1087. });
  1088. that.setData({
  1089. good_list: list
  1090. }); // console.log('重组商品',list);
  1091. },
  1092. // 核实商品是否存在于购物车
  1093. isAddCart(item) {
  1094. let that = this;
  1095. let oldCartGoods = that.cartGoods;
  1096. let is_have = false; // console.log('购物车',oldCartGoods);
  1097. // console.log('操作商品',item);
  1098. // 检测购物车是否有此商品
  1099. for (let i in oldCartGoods) {
  1100. if (item.good_id) {
  1101. // 有规格
  1102. console.log(item.id, oldCartGoods[i].good_specs_id);
  1103. if (item.id == oldCartGoods[i].good_specs_id && !oldCartGoods[i].is_add) {
  1104. is_have = true;
  1105. break;
  1106. }
  1107. } else {
  1108. if (item.id == oldCartGoods[i].good_id && !oldCartGoods[i].is_add) {
  1109. is_have = true;
  1110. break;
  1111. }
  1112. }
  1113. }
  1114. return is_have;
  1115. },
  1116. // 进入购物车页面
  1117. goShopCart() {
  1118. let that = this;
  1119. uni.navigateTo({
  1120. url: '/pages/shopcart/index'
  1121. });
  1122. },
  1123. // 营业时间判断(弃用 改成多段时间了, 前端判断没意义了)
  1124. checkBusinessTime() {
  1125. let that = this;
  1126. let store = that.store; // console.log('store',that.data.store,store.status);
  1127. if (store.status != 1) {
  1128. uni.showToast({
  1129. title: '门店暂未营业',
  1130. icon: 'none',
  1131. duration: 3000
  1132. });
  1133. return;
  1134. }
  1135. let currentTime = new Date();
  1136. let year = currentTime.getFullYear();
  1137. let month = currentTime.getMonth() + 1;
  1138. let day = currentTime.getDate();
  1139. let endDay = currentTime.getDate();
  1140. if (store.end_at.split(':')[0] < store.begin_at.split(':')[0]) {
  1141. endDay = endDay + 1;
  1142. }
  1143. let storeBeginAt = new Date(year + '/' + month + '/' + day + ' ' + store.begin_at);
  1144. let storeEndAt = new Date(year + '/' + month + '/' + endDay + ' ' + store.end_at);
  1145. if (storeBeginAt.getTime() > currentTime.getTime() || storeEndAt.getTime() < currentTime.getTime()) {
  1146. uni.showToast({
  1147. title: '门店暂未营业',
  1148. icon: 'none',
  1149. duration: 3000
  1150. });
  1151. }
  1152. }
  1153. }
  1154. };
  1155. </script>
  1156. <style>
  1157. /**index.wxss**/
  1158. .wrap {
  1159. height: 100vh;
  1160. }
  1161. .store_wrap {
  1162. width: 750rpx;
  1163. height: 150rpx;
  1164. padding: 0 30rpx;
  1165. border-bottom: 1rpx solid rgba(0, 0, 0, 0.15);
  1166. display: flex;
  1167. align-items: center;
  1168. justify-content: space-between;
  1169. }
  1170. .store_wrap .store_l {
  1171. display: flex;
  1172. align-items: center;
  1173. }
  1174. .store_wrap .store_l .logo_wrap {
  1175. width: 98rpx;
  1176. height: 98rpx;
  1177. background: #f6f6f6;
  1178. border-radius: 50%;
  1179. display: flex;
  1180. align-items: center;
  1181. justify-content: center;
  1182. }
  1183. .store_wrap .store_l .logo {
  1184. /* width: 98rpx; */
  1185. height: 70rpx;
  1186. }
  1187. .store_wrap .store_t_info {
  1188. padding-left: 30rpx;
  1189. display: flex;
  1190. align-items: center;
  1191. }
  1192. .store_wrap .store_t_info_t {
  1193. display: flex;
  1194. align-items: center;
  1195. /* justify-content: space-around; */
  1196. width: 320rpx;
  1197. }
  1198. .store_wrap .store_t_info .name {
  1199. /* width: 100%; */
  1200. font-size: 30rpx;
  1201. color: #080808;
  1202. padding-right: 40rpx;
  1203. flex: 1;
  1204. }
  1205. .store_wrap .icon_phone {
  1206. width: 32rpx;
  1207. height: 32rpx;
  1208. }
  1209. .store_wrap .store_t_info .desc {
  1210. font-size: 26rpx;
  1211. color: rgba(51, 51, 51, 0.54);
  1212. }
  1213. .store_wrap .store_r {
  1214. width: 180rpx;
  1215. height: 60rpx;
  1216. background: #f6f6f6;
  1217. border-radius: 30rpx;
  1218. display: flex;
  1219. align-items: center;
  1220. justify-content: center;
  1221. position: relative;
  1222. }
  1223. .store_wrap .store_r .wenzi {
  1224. width: 90rpx;
  1225. height: 50rpx;
  1226. flex: 1;
  1227. display: flex;
  1228. align-items: center;
  1229. justify-content: center;
  1230. font-size: 26rpx;
  1231. color: rgba(51, 51, 51, 0.54);
  1232. background: #f6f6f6;
  1233. border-radius: 30rpx;
  1234. }
  1235. .store_wrap .store_r .wenzi.active {
  1236. background: #295c56;
  1237. color: #ffffff;
  1238. }
  1239. .heji_wrap {
  1240. width: 750rpx;
  1241. height: 100rpx;
  1242. background-repeat: no-repeat;
  1243. background-size: 100% 100%;
  1244. position: fixed;
  1245. bottom: 0;
  1246. left: 0rpx;
  1247. display: flex;
  1248. align-items: center;
  1249. justify-content: space-between;
  1250. z-index: 3;
  1251. background: #f8f8f8;
  1252. box-shadow: 0rpx -5rpx 10rpx 0rpx rgba(161, 161, 161, 0.09);
  1253. }
  1254. .heji_wrap .heji_l {
  1255. /* width: 470rpx; */
  1256. display: flex;
  1257. align-items: center;
  1258. padding-left: 30rpx;
  1259. }
  1260. .heji_wrap .total_price {
  1261. padding-left: 40rpx;
  1262. font-size: 38rpx;
  1263. color: #000000;
  1264. }
  1265. .heji_wrap .total_price .unit {
  1266. font-size: 26rpx;
  1267. }
  1268. .heji_wrap .heji_r {
  1269. /* flex: 1; */
  1270. margin-left: 58rpx;
  1271. }
  1272. .heji_wrap .heji_btn {
  1273. width: 198rpx;
  1274. height: 100rpx;
  1275. color: #ffffff;
  1276. background: #295c56;
  1277. display: flex;
  1278. align-items: center;
  1279. justify-content: center;
  1280. }
  1281. /* 商品 */
  1282. .goods_wrap {
  1283. width: 100%;
  1284. display: flex;
  1285. }
  1286. .goods_wrap_l {
  1287. width: 176rpx;
  1288. background: #f6f6f6;
  1289. }
  1290. .goods_wrap_l .cate_item {
  1291. padding-left: 30rpx;
  1292. height: 98rpx;
  1293. /* line-height: 98rpx; */
  1294. font-size: 28rpx;
  1295. color: rgba(8, 8, 8, 0.54);
  1296. display: flex;
  1297. align-items: center;
  1298. }
  1299. .goods_wrap_l .cate_item.active {
  1300. background: #295c56;
  1301. color: #ffffff;
  1302. border-radius: 0 10rpx 10rpx 0;
  1303. }
  1304. .goods_wrap_r {
  1305. width: 574rpx;
  1306. flex: 1;
  1307. padding: 30rpx 30rpx 30rpx 15rpx;
  1308. padding-top: 0;
  1309. }
  1310. .goods_wrap_r .goods_ad {
  1311. width: 544rpx;
  1312. height: 265rpx;
  1313. border-radius: 5rpx;
  1314. }
  1315. .goods_list_w .cate_name {
  1316. font-size: 28rpx;
  1317. color: rgba(8, 8, 8, 0.54);
  1318. padding-top: 26rpx;
  1319. }
  1320. /* 步进器 */
  1321. .stepper .step_input {
  1322. /* height: 24rpx; */
  1323. height: 42rpx;
  1324. line-height: 24rpx;
  1325. padding-top: 0;
  1326. font-size: 26rpx;
  1327. color: rgba(0, 0, 0, 1);
  1328. background: none;
  1329. }
  1330. .stepper .plus,
  1331. .stepper .minus {
  1332. border-radius: 50%;
  1333. overflow: hidden;
  1334. vertical-align: bottom;
  1335. width: 42rpx;
  1336. height: 42rpx;
  1337. }
  1338. /* .stepper .plus{
  1339. color: #333333;
  1340. border: 1px solid #FFD102;
  1341. background: #FFD102;
  1342. }
  1343. .stepper .minus{
  1344. border: 1px solid #FFD102;
  1345. color: rgba(0, 0, 0, 1);
  1346. background: #fff;
  1347. } */
  1348. /* 规格 */
  1349. .guige_wrap {
  1350. width: 670rpx;
  1351. border-radius: 10rpx;
  1352. margin: 0 auto;
  1353. position: fixed;
  1354. top: 50%;
  1355. left: 50%;
  1356. transform: translate(-50%, -50%);
  1357. z-index: 5;
  1358. }
  1359. .guige {
  1360. width: 670rpx;
  1361. padding-bottom: 38rpx;
  1362. background: #ffffff;
  1363. }
  1364. .guige .goods_thumb_wrap {
  1365. width: 670rpx;
  1366. height: auto;
  1367. position: relative;
  1368. }
  1369. .guige .goods_thumb_wrap .line {
  1370. width: 670rpx;
  1371. height: 30rpx;
  1372. position: absolute;
  1373. bottom: 0;
  1374. left: 0;
  1375. background-repeat: repeat-x;
  1376. background-size: 18rpx 30rpx;
  1377. }
  1378. .guige .goods_thumb {
  1379. width: 670rpx;
  1380. /* width: 500rpx; */
  1381. height: auto;
  1382. display: block;
  1383. margin: 0 auto;
  1384. }
  1385. .guige .goods_name {
  1386. padding: 20rpx 30rpx 0;
  1387. font-size: 30rpx;
  1388. color: #080808;
  1389. display: flex;
  1390. align-items: center;
  1391. justify-content: space-between;
  1392. }
  1393. .guige .goods_labels {
  1394. padding: 0 30rpx;
  1395. font-size: 24rpx;
  1396. color: rgba(8, 8, 8, 0.54);
  1397. display: flex;
  1398. flex-wrap: wrap;
  1399. }
  1400. .guige .goods_labels .label {
  1401. padding: 6rpx;
  1402. background: #f6f6f6;
  1403. margin: 10rpx 14rpx 0 0;
  1404. }
  1405. .guige .goods_desc {
  1406. padding: 10rpx 30rpx 0;
  1407. }
  1408. .guige .goods_desc .goods_desc_name {
  1409. font-size: 26rpx;
  1410. color: rgba(51, 51, 51, 0.54);
  1411. }
  1412. .guige .goods_desc .goods_desc_nr {
  1413. /* padding-top: 20rpx; */
  1414. font-size: 24rpx;
  1415. color: rgba(8, 8, 8, 0.54);
  1416. }
  1417. .guige .goods_guige {
  1418. padding: 20rpx 30rpx 0;
  1419. }
  1420. .guige .goods_guige .goods_guige_name {
  1421. font-size: 26rpx;
  1422. color: rgba(51, 51, 51, 0.54);
  1423. }
  1424. .guige .goods_guige .goods_guige_nr {
  1425. display: flex;
  1426. flex-wrap: wrap;
  1427. }
  1428. .guige .guige_item {
  1429. height: 59rpx;
  1430. font-size: 24rpx;
  1431. color: #333333;
  1432. background: #ffffff;
  1433. border: 1rpx solid rgba(0, 0, 0, 0.12);
  1434. border-radius: 5rpx;
  1435. display: flex;
  1436. align-items: center;
  1437. margin: 20rpx 20rpx 0 0;
  1438. }
  1439. .guige .guige_item:last-child {
  1440. margin-right: 0;
  1441. }
  1442. .guige .guige_item .item_wenzi {
  1443. display: flex;
  1444. }
  1445. .guige .guige_item .item_wenzi text {
  1446. padding: 0 16rpx 0 12rpx;
  1447. display: flex;
  1448. align-items: center;
  1449. }
  1450. .guige .guige_item .item_wenzi text:not(:last-child)::after {
  1451. content: '';
  1452. display: block;
  1453. width: 2rpx;
  1454. height: 16rpx;
  1455. background: rgba(0, 0, 0, 0.12);
  1456. margin-left: 16rpx;
  1457. }
  1458. .guige .guige_item .price {
  1459. padding: 0 18rpx;
  1460. font-size: 28rpx;
  1461. border-left: 1rpx solid rgba(0, 0, 0, 0.12);
  1462. }
  1463. .guige .guige_item .price .unit {
  1464. font-size: 20rpx;
  1465. }
  1466. .guige .guige_item.selected {
  1467. background: #fffbf0;
  1468. border-color: #ed8c17;
  1469. color: #ed8c17;
  1470. }
  1471. /* .guige .guige_item.selected .item_wenzi text:not(:last-child)::after{
  1472. background: #D54C43;
  1473. } */
  1474. .guige .guige_item.selected .price {
  1475. color: #ea4335;
  1476. border-left-color: #ed8c17;
  1477. }
  1478. .guige .guige_selected {
  1479. margin-top: 20rpx;
  1480. height: 60rpx;
  1481. background: #fafafa;
  1482. border: 1rpx solid rgba(0, 0, 0, 0.05);
  1483. border-left: 0 none;
  1484. border-right: 0 none;
  1485. padding: 0rpx 30rpx;
  1486. display: flex;
  1487. align-items: center;
  1488. font-size: 26rpx;
  1489. color: #000000;
  1490. }
  1491. .guige .guige_selected .label {
  1492. color: rgba(0, 0, 0, 0.54);
  1493. }
  1494. .guige .guige_b {
  1495. margin-top: 30rpx;
  1496. padding: 0 30rpx;
  1497. display: flex;
  1498. align-items: center;
  1499. justify-content: space-between;
  1500. }
  1501. .guige .guige_b .guige_b_l {
  1502. font-size: 26rpx;
  1503. color: #000000;
  1504. }
  1505. .guige .guige_b .price {
  1506. font-size: 38rpx;
  1507. color: #ea4335;
  1508. padding-left: 10rpx;
  1509. }
  1510. .guige .guige_b .price .unit {
  1511. font-size: 22rpx;
  1512. }
  1513. .guige .guige_b .item {
  1514. font-size: 24rpx;
  1515. color: rgba(0, 0, 0, 0.54);
  1516. }
  1517. .guige .guige_b .guige_b_r {
  1518. width: 350rpx;
  1519. height: 90rpx;
  1520. background: #d54c43;
  1521. border-radius: 45rpx;
  1522. font-size: 34rpx;
  1523. color: #ffffff;
  1524. display: flex;
  1525. align-items: center;
  1526. justify-content: center;
  1527. }
  1528. .guige_wrap .btn_close {
  1529. width: 100%;
  1530. }
  1531. .guige_wrap .btn_close .van-icon {
  1532. /* width: 56rpx;
  1533. height: 56rpx; */
  1534. display: block;
  1535. margin: 36rpx auto;
  1536. }
  1537. /* 购物车 */
  1538. .shopcar_wrap {
  1539. width: 750rpx;
  1540. padding: 0 0 130rpx;
  1541. border-radius: 20rpx 20rpx 0rpx 0rpx;
  1542. background: #ffffff;
  1543. position: fixed;
  1544. bottom: 0;
  1545. left: 0;
  1546. z-index: 2;
  1547. }
  1548. /* .shopcar_wrap::after{
  1549. content: "";
  1550. display: block;
  1551. width: 0;
  1552. height: 0;
  1553. border: 16rpx solid transparent;
  1554. border-bottom-color: #FFFFFF;
  1555. position: absolute;
  1556. top: -30rpx;
  1557. left: 60rpx;
  1558. } */
  1559. .shopcar .shopcar_t {
  1560. padding: 0 30rpx;
  1561. display: flex;
  1562. align-items: center;
  1563. justify-content: space-between;
  1564. padding-top: 25rpx;
  1565. font-size: 26rpx;
  1566. color: #080808;
  1567. }
  1568. .shopcar .shopcar_t .shopcar_t_r {
  1569. display: flex;
  1570. align-items: center;
  1571. font-size: 24rpx;
  1572. color: rgba(8, 8, 8, 0.54);
  1573. }
  1574. .shopcar .shopcar_t .icon_empty {
  1575. width: 21rpx;
  1576. height: 23rpx;
  1577. margin-right: 6rpx;
  1578. }
  1579. .shopcar .goods_scroll {
  1580. height: 560rpx;
  1581. }
  1582. .shopcar .goods_list {
  1583. padding: 0 30rpx;
  1584. }
  1585. .shopcar .goods_list .goods_item .goods_tu {
  1586. width: 138rpx;
  1587. height: 138rpx;
  1588. }
  1589. .shopcar .goods_list .goods_item .goods_info {
  1590. min-height: 160rpx;
  1591. display: flex;
  1592. flex-direction: column;
  1593. justify-content: space-between;
  1594. }
  1595. /* 购物车按钮 */
  1596. .cart_w {
  1597. /* position: fixed;
  1598. left: 40rpx;
  1599. z-index: 4; */
  1600. position: relative;
  1601. }
  1602. .cart_w .cart_tu {
  1603. width: 120rpx;
  1604. height: 122rpx;
  1605. margin-top: -30rpx;
  1606. }
  1607. .cart_w .goods_num {
  1608. min-width: 34rpx;
  1609. height: 34rpx;
  1610. border-radius: 50%;
  1611. background: #ffd102;
  1612. display: flex;
  1613. align-items: center;
  1614. justify-content: center;
  1615. position: absolute;
  1616. top: -28rpx;
  1617. right: 16rpx;
  1618. font-size: 24rpx;
  1619. font-weight: bold;
  1620. color: #000000;
  1621. }
  1622. /* 外卖 */
  1623. .store_wrap .store_l.takeout {
  1624. display: block;
  1625. width: 450rpx;
  1626. }
  1627. .store_wrap .takeout .user_address {
  1628. display: flex;
  1629. align-items: center;
  1630. font-size: 30rpx;
  1631. }
  1632. .store_wrap .takeout .store_t_info {
  1633. padding-left: 0;
  1634. display: flex;
  1635. align-items: center;
  1636. font-size: 28rpx;
  1637. color: rgba(51, 51, 51, 0.87);
  1638. }
  1639. .store_wrap .takeout .store_t_info .wenzi {
  1640. color: rgba(51, 51, 51, 0.54);
  1641. padding-right: 10rpx;
  1642. }
  1643. .store_wrap .takeout .store_t_info .name {
  1644. padding-right: 4rpx;
  1645. }
  1646. .store_t_info .icon_change {
  1647. width: 25rpx;
  1648. height: 19rpx;
  1649. margin-left: 10rpx;
  1650. }
  1651. /* 配送方式 */
  1652. .fare_w {
  1653. position: absolute;
  1654. left: 50%;
  1655. top: 50%;
  1656. transform: translate(-50%, -50%);
  1657. color: #ffffff;
  1658. font-size: 36rpx;
  1659. text-align: center;
  1660. }
  1661. .fare_w .type {
  1662. display: flex;
  1663. position: relative;
  1664. margin: 40rpx 0;
  1665. }
  1666. .fare_w .type .type_item {
  1667. width: 257rpx;
  1668. height: 210rpx;
  1669. color: #333333;
  1670. padding: 30rpx 0 0 30rpx;
  1671. text-align: left;
  1672. }
  1673. .fare_w .type .type_item.waimai {
  1674. position: absolute;
  1675. top: 0;
  1676. left: 0;
  1677. }
  1678. .fare_w .type .type_item.ziqu {
  1679. position: absolute;
  1680. top: 0;
  1681. right: 0;
  1682. }
  1683. .fare_w .type_bg {
  1684. width: 602rpx;
  1685. height: 212rpx;
  1686. }
  1687. /* 二级分类 */
  1688. .erji_cate {
  1689. display: flex;
  1690. align-items: center;
  1691. font-size: 28rpx;
  1692. color: rgba(8, 8, 8, 0.54);
  1693. /* position: fixed;
  1694. top: 0; */
  1695. background: #ffffff;
  1696. z-index: 16;
  1697. width: 100%;
  1698. height: 80rpx;
  1699. }
  1700. .erji_cate .cate_item {
  1701. padding: 4rpx;
  1702. background: #f6f6f6;
  1703. margin-left: 20rpx;
  1704. }
  1705. .erji_cate .cate_item.active {
  1706. background: #295c56;
  1707. color: #ffffff;
  1708. }
  1709. /* 会员价 */
  1710. .goods_list .goods_item .goods_specs .price .vip {
  1711. /* position: relative;
  1712. width: 57rpx; */
  1713. /* height: 20rpx; */
  1714. /* padding: 2rpx; */
  1715. /* line-height: 20rpx; */
  1716. /* background: #FFD102;
  1717. color: #333333;
  1718. font-size: 18rpx;
  1719. text-align: center;
  1720. display: inline-block;
  1721. margin-left: 4rpx; */
  1722. padding: 4rpx 10rpx;
  1723. font-size: 20rpx;
  1724. /* font-weight: bold; */
  1725. background: #ffffff;
  1726. border: 1px solid #f1a223;
  1727. border-radius: 14px;
  1728. display: flex;
  1729. align-items: center;
  1730. justify-content: center;
  1731. color: #f1a223;
  1732. }
  1733. .guige .guige_b .guige_b_l .vip {
  1734. padding-left: 8rpx;
  1735. }
  1736. /* .guige .guige_item .price .vip{
  1737. font-size: 18rpx;
  1738. padding-left: 4rpx;
  1739. }
  1740. .guige .guige_b .price .vip{
  1741. font-size: 18rpx;
  1742. padding-left: 4rpx;
  1743. }*/
  1744. .heji_wrap .total_price .vip {
  1745. padding-left: 8rpx;
  1746. }
  1747. /* 规格加总数 */
  1748. .topNum_w {
  1749. position: relative;
  1750. }
  1751. .topNum_w .topNum {
  1752. position: absolute;
  1753. top: -20rpx;
  1754. right: -8rpx;
  1755. min-width: 34rpx;
  1756. height: 34rpx;
  1757. background: #f1a223;
  1758. font-size: 24rpx;
  1759. color: #ffffff;
  1760. border-radius: 50%;
  1761. display: flex;
  1762. align-items: center;
  1763. justify-content: center;
  1764. }
  1765. /* 未营业 */
  1766. .heji_wrap .heji_btn.un_open {
  1767. background: rgba(0, 0, 0, 0.2);
  1768. }
  1769. /* 不参与活动的提示 */
  1770. .use_coupon {
  1771. width: 100%;
  1772. padding: 12rpx 14rpx;
  1773. background: #f6f6f6;
  1774. border-radius: 5rpx;
  1775. font-size: 24rpx;
  1776. color: rgba(8, 8, 8, 0.54);
  1777. }
  1778. </style>