store_cate1.vue 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804
  1. <template>
  2. <!-- 商品分类第三种布局样式 -->
  3. <view class="goodCate">
  4. <!-- #ifdef MP || APP-PLUS -->
  5. <view class="mp-header">
  6. <view class="sys-head" :style="{ height: sysHeight }"></view>
  7. <view class="serch-box" style="height: 43px;">
  8. <view class="serch-wrapper acea-row row-middle">
  9. <button v-if="info.store_splicing_switch" class="group-button" hover-class="none" @tap="onCollage">
  10. <text class="iconfont icon-pindan"></text>拼单
  11. </button>
  12. <navigator url="/pages/goods/goods_search/index" class="input acea-row row-center-wrapper" hover-class="none">
  13. <text class="iconfont icon-xiazai5"></text>
  14. 搜索商品信息
  15. </navigator>
  16. </view>
  17. </view>
  18. <!-- 门店地址详情 -->
  19. <view class="store-address">
  20. <view class="address acea-row row-middle" @click="goMap()">
  21. <view class="name line1">{{info.name || '暂无门店'}}</view>
  22. <text class="iconfont icon-xiangyou" />
  23. </view>
  24. <view class="distance">
  25. 门店距您{{info.range||0}}km
  26. </view>
  27. <view class="time">
  28. 营业时间:{{info.day_time || '-'}}
  29. </view>
  30. <view class="switch acea-row row-between-wrapper">
  31. <view class="title" :class="{'on': switchNum == item.key,'onLeft':switchNum != 1 && switchNum == item.key}"
  32. v-for="(item, index) in deliveryList" :key="item.key" @click="swithFn(item.key)">{{item.name}}</view>
  33. </view>
  34. </view>
  35. <!-- 门店详情 -->
  36. </view>
  37. <!-- #endif -->
  38. <!-- #ifdef H5 -->
  39. <view class="header acea-row row-center-wrapper">
  40. <view class="search-box acea-row row-middle">
  41. <button v-if="isSplicingPlatform && info.store_splicing_switch" class="group-button" hover-class="none" @tap="onCollage">
  42. <text class="iconfont icon-pindan"></text>拼单
  43. </button>
  44. <navigator url="/pages/goods/goods_search/index" class="search acea-row row-middle" hover-class="none">
  45. <text class="iconfont icon-sousuo5"></text>
  46. 搜索商品信息
  47. </navigator>
  48. </view>
  49. <view class="store-address">
  50. <view class="address acea-row row-middle" @click="goMap()">
  51. <view class="name line1">{{info.name || '暂无门店'}}</view>
  52. <text class="iconfont icon-xiangyou" />
  53. </view>
  54. <view class="distance">
  55. 门店距您{{info.range||0}}km
  56. </view>
  57. <view class="time">
  58. 营业时间:{{info.day_time || '-'}}
  59. </view>
  60. <view class="switch acea-row row-between-wrapper">
  61. <view class="title" :class="{'on': switchNum == item.key,'onLeft':switchNum != 1}"
  62. v-for="(item, index) in deliveryList" :key="item.key" @click="swithFn(item.key)">{{item.name}}</view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="conter">
  67. <!-- #endif -->
  68. <!-- #ifndef H5 -->
  69. <view class="conter" :style="'padding-top:'+marTop+'px'">
  70. <!-- #endif -->
  71. <!-- #ifndef H5 -->
  72. <view class='aside' :style="'top:'+marTop+'px'">
  73. <!-- #endif -->
  74. <!-- #ifdef H5 -->
  75. <view class='aside'>
  76. <!-- #endif -->
  77. <view class='item acea-row row-center-wrapper' :class='index==navActive?"on":""'
  78. v-for="(item,index) in categoryList" :key="index" @click="tapNav(index,item)">
  79. <text>{{item.cate_name}}</text>
  80. </view>
  81. </view>
  82. <view class="wrapper">
  83. <view class="bgcolor" v-if="iSlong">
  84. <!-- #ifndef H5 -->
  85. <view class="longTab acea-row row-middle" :style="'top:'+marTop+'px'">
  86. <!-- #endif -->
  87. <!-- #ifdef H5 -->
  88. <view class="longTab acea-row row-middle">
  89. <!-- #endif -->
  90. <scroll-view scroll-x="true" style="white-space: nowrap; display: flex;height:44rpx;"
  91. scroll-with-animation :scroll-left="tabLeft" show-scrollbar="true">
  92. <view class="longItem" :style='"width:"+isWidth+"px"' :class="index===tabClick?'click':''"
  93. v-for="(item,index) in categoryErList" :key="index" @click="longClick(index)">
  94. {{item.cate_name}}
  95. </view>
  96. </scroll-view>
  97. </view>
  98. <!-- #ifndef H5 -->
  99. <view class="openList" :style="'top:'+marTop+'px'" @click="openTap"><text
  100. class="iconfont icon-xiangxia"></text></view>
  101. <!-- #endif -->
  102. <!-- #ifdef H5 -->
  103. <view class="openList" @click="openTap"><text class="iconfont icon-xiangxia"></text></view>
  104. <!-- #endif -->
  105. </view>
  106. <view v-else>
  107. <!-- #ifndef H5 -->
  108. <view class="downTab" :style="'margin-top:'+marTop+'px'">
  109. <!-- #endif -->
  110. <!-- #ifdef H5 -->
  111. <view class="downTab">
  112. <!-- #endif -->
  113. <view class="title acea-row row-between-wrapper">
  114. <view>{{categoryTitle}}</view>
  115. <view class="closeList" @click="closeTap"><text class="iconfont icon-xiangxia"></text>
  116. </view>
  117. </view>
  118. <view class="children">
  119. <view class="acea-row row-middle">
  120. <view class="item line1" :class="index===tabClick?'click':''"
  121. v-for="(item,index) in categoryErList" :key="index" @click="longClick(index)">
  122. {{item.cate_name}}
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="mask" @click="closeTap"></view>
  128. </view>
  129. <!--商品列表 -->
  130. <goodClass :tempArr="tempArr" :isLogin="isLogin" @gocartduo="goCartDuo" @gocartdan="goCartDan"
  131. @ChangeCartNumDan="ChangeCartNumDan" @detail="goDetail"></goodClass>
  132. <view class='loadingicon acea-row row-center-wrapper'>
  133. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  134. </view>
  135. </view>
  136. </view>
  137. <view class="footer acea-row row-between-wrapper" :class="isFooter?'':'on'">
  138. <view class="cartIcon acea-row row-center-wrapper" @click="getCartList(0)" v-if="cartNum>0">
  139. <!-- <view class="iconfont icon-gouwuche-yangshi2"></view> -->
  140. <!-- <text class="num">{{cartNum}}</text> -->
  141. <uni-badge class="uni-badge-left-margin" :text="cartNum" absolute="rightTop">
  142. <view class="iconfont icon-gouwuche-yangshi2"></view>
  143. </uni-badge>
  144. </view>
  145. <view class="cartIcon acea-row row-center-wrapper noCart" v-else>
  146. <view class="iconfont icon-gouwuche-yangshi2"></view>
  147. </view>
  148. <view class="acea-row row-middle" :class="cartNum>0?'':'noCart'">
  149. <view class="money">¥<text class="num">{{totalPrice}}</text></view>
  150. <view class="bnt" @click="subOrder">去结算</view>
  151. </view>
  152. </view>
  153. <!-- #ifdef H5 || MP -->
  154. <view v-if="isSplicingPlatform" :class="{ mask: collageVisible }" @tap="onCollageClose"></view>
  155. <view v-if="isSplicingPlatform" :class="{ 'dialog-footer': isFooter, active: collageVisible }" class="dialog">
  156. <view class="dialog-head">
  157. <view v-for="item in deliveryList" :key="item.key" :class="{ active: collageDelivery == item.key }" class="button" @tap="collageDeliveryChange(item.key)">
  158. <text :class="['iconfont', item.icon]"></text>{{ item.name }}
  159. </view>
  160. </view>
  161. <view class="dialog-body">
  162. <view class="">{{ collageDelivery == 1 ? '配送地址' : '自提门店' }}</view>
  163. <view class="dialog-body-main">
  164. <view class="dialog-body-main-inner">
  165. <view v-if="collageDelivery == 2 || collageAddress.id" class="dialog-body-left">
  166. <view class="dialog-body-name">
  167. {{ collageDelivery == 1 ? `${collageAddress.province}${collageAddress.city}${collageAddress.district}${collageAddress.detail}` : collageStore.name }}
  168. <text v-if="collageDelivery == 2" class="tag">距离{{ collageStore.range || 0 }}km</text>
  169. </view>
  170. <view class="dialog-body-info">
  171. <view v-if="collageDelivery == 2" class="item">
  172. <text class="iconfont icon-weizhi"></text>{{ collageStore.detailed_address }}
  173. </view>
  174. <view v-if="collageDelivery == 1" class="item">
  175. {{ collageAddress.real_name }} {{ collageAddress.phone }}
  176. </view>
  177. <view v-else class="item">
  178. <text class="iconfont icon-shijian"></text>营业时间:{{ collageStore.day_time || '-' }}
  179. </view>
  180. </view>
  181. </view>
  182. <view v-if="collageDelivery == 1 && !collageAddress.id" class="dialog-body-left">您还未选择配送地址,先去选择您的收货地址再下单吧~</view>
  183. <view v-if="collageDelivery == 2" class="dialog-body-right" @tap="showMaoLocation"><text class="iconfont icon-dingwei2"></text></view>
  184. </view>
  185. <view class="dialog-body-main-btn">
  186. <view v-if="collageDelivery == 1" class="" @tap="onAddress">{{ collageAddress.id ? '切换地址' : '选择地址' }}<text class="iconfont icon-xiangyou" /></view>
  187. <view v-if="collageDelivery == 2" class="" @tap="goMap(1)">切换门店<text class="iconfont icon-xiangyou" /></view>
  188. </view>
  189. </view>
  190. </view>
  191. <view class="dialog-foot">
  192. <button class="button" hover-class="none" @tap="onCollageClose">我再想想</button>
  193. <button class="button primary" hover-class="none" @tap="initCollage">发起拼单</button>
  194. </view>
  195. </view>
  196. <addressWindow v-if="isSplicingPlatform" ref="addressWindow" :isFooter='isFooter' :address="address" :pagesUrl="pagesUrl" @changeClose="onAddress" @OnChangeAddress="onAddressChange"></addressWindow>
  197. <!-- #endif -->
  198. <!-- 分类购物车下拉列表 -->
  199. <cartList :cartData="cartData" :isFooter='isFooter' @closeList="closeList" @ChangeCartNumDan="ChangeCartList"
  200. @ChangeSubDel="ChangeSubDel" @ChangeOneDel="ChangeOneDel"></cartList>
  201. <!-- 产品属性组件 -->
  202. <productWindow :isFooter="isFooter" :attr="attr" :isShow='1' :iSplus='1' :iScart='1' @myevent="onMyEvent"
  203. @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNumDuo" @attrVal="attrVal" @iptCartNum="iptCartNum"
  204. @goCat="goCatNum" :is_vip="is_vip" id='product-window'></productWindow>
  205. <!-- #ifdef MP -->
  206. <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize>
  207. <!-- #endif -->
  208. </view>
  209. </template>
  210. <script>
  211. let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  212. import {
  213. vcartList,
  214. getCartCounts,
  215. cartDel
  216. } from '@/api/order.js';
  217. import {
  218. getCategoryList,
  219. getAttr,
  220. postCartNum,
  221. initCollage,
  222. hasCollage,
  223. isWithin,
  224. } from '@/api/store.js';
  225. import {
  226. getProducts,
  227. getCustomerList,
  228. getStoreCategory,
  229. getStoreBrand
  230. } from '@/api/new_store.js';
  231. import productWindow from '@/components/productWindow/index';
  232. import goodClass from '@/components/goodClass';
  233. import cartList from '@/components/cartList';
  234. // #ifdef H5 || MP
  235. import { getAddressDefault } from '@/api/user.js';
  236. import addressWindow from '@/components/addressWindow';
  237. // #endif
  238. import {
  239. mapState,
  240. mapGetters
  241. } from 'vuex';
  242. import {
  243. goShopDetail
  244. } from '@/libs/order.js';
  245. import {
  246. toLogin
  247. } from '@/libs/login.js';
  248. export default {
  249. computed: {
  250. ...mapState({
  251. cartNum: state => state.indexData.cartNum
  252. }),
  253. ...mapGetters(['isLogin', 'uid', 'cartNum'])
  254. },
  255. components: {
  256. productWindow,
  257. goodClass,
  258. cartList,
  259. // #ifdef H5 || MP
  260. addressWindow
  261. // #endif
  262. },
  263. props: {
  264. isFooter: {
  265. type: Boolean,
  266. default: false
  267. },
  268. info: {
  269. type: Object,
  270. default: {}
  271. },
  272. },
  273. data() {
  274. return {
  275. // deliveryList:[
  276. // {name:'配送',key:1},
  277. // {name:'自提',key:2}
  278. // ],
  279. deliveryList:[
  280. {name:'自提',key:2,icon:'icon-ziti'},
  281. {name:'配送',key:1,icon:'icon-peisong1'},
  282. ],
  283. marTop: 0,
  284. switchNum: 1,
  285. sysHeight: sysHeight,
  286. categoryList: [],
  287. navActive: 0,
  288. categoryTitle: '',
  289. categoryErList: [],
  290. tabLeft: 0,
  291. isWidth: 0, //每个导航栏占位
  292. tabClick: 0, //导航栏被点击
  293. iSlong: true,
  294. tempArr: [],
  295. loading: false,
  296. loadend: false,
  297. loadTitle: '加载更多',
  298. page: 1,
  299. limit: 10,
  300. cid: 0, //一级分类
  301. sid: 0, //二级分类
  302. delivery_type:3, // 配送方式
  303. isAuto: false, //没有授权的不会自动授权
  304. isShowAuth: false, //是否隐藏授权
  305. attr: {
  306. cartAttr: false,
  307. productAttr: [],
  308. productSelect: {}
  309. },
  310. productValue: [],
  311. attrValue: '', //已选属性
  312. storeName: '', //多属性产品名称
  313. id: 0,
  314. cartData: {
  315. cartList: [],
  316. iScart: false
  317. },
  318. totalPrice: 0.00,
  319. lengthCart: 0,
  320. is_vip: 0, //是否是会员
  321. cart_num: 0,
  322. storeInfo: {},
  323. // #ifdef H5 || MP
  324. collageVisible: false,
  325. collageDelivery: 2,
  326. address: {
  327. address: false,
  328. }, //地址组件
  329. pagesUrl: '',
  330. collageStore: this.info,
  331. collageAddress: {},
  332. isSplicingPlatform: true,
  333. // #endif
  334. }
  335. },
  336. watch: {
  337. // #ifdef H5 || MP
  338. collageDelivery() {
  339. this.collageStore = this.info;
  340. }
  341. // #endif
  342. },
  343. mounted() {
  344. let that = this;
  345. // that.swithFn(that.info.default_delivery);
  346. // 获取设备宽度
  347. uni.getSystemInfo({
  348. success(e) {
  349. that.isWidth = e.windowWidth / 5
  350. }
  351. });
  352. uni.$on('newAttrNum',(data)=>{
  353. if(data.length){
  354. this.tempArr.forEach((item)=>{
  355. data.forEach(j=>{
  356. if(item.id == j.id){
  357. item.cart_num = j.num
  358. }
  359. })
  360. })
  361. this.getCartList(1);
  362. }
  363. })
  364. uni.$on('newCartNum',(data)=>{
  365. if(data.length){
  366. this.tempArr.forEach((item)=>{
  367. data.forEach(j=>{
  368. if(item.id == j.product_id){
  369. item.cart_num = 0
  370. }
  371. })
  372. })
  373. this.getCartList(1);
  374. }
  375. })
  376. // #ifdef H5
  377. this.isSplicingPlatform = this.$wechat.isWeixin();
  378. // #endif
  379. // #ifdef H5 || MP
  380. if (this.isSplicingPlatform && this.info.store_splicing_switch) {
  381. this.collageDelivery = this.info.is_store ? 2 : 1;
  382. uni.$on('activeFn', data => {
  383. this.collageStore = data;
  384. });
  385. uni.$on('addressChange', data => {
  386. this.collageAddress = data;
  387. this.address.addressId = data.id;
  388. });
  389. }
  390. // #endif
  391. },
  392. methods: {
  393. // #ifdef H5 || MP
  394. showMaoLocation() {
  395. let data = {
  396. latitude: Number(this.collageStore.latitude),
  397. longitude: Number(this.collageStore.longitude),
  398. name: this.collageStore.name,
  399. address: `${this.collageStore.address}-${this.collageStore.detailed_address}`,
  400. };
  401. // #ifdef H5
  402. if (this.$wechat.isWeixin()) {
  403. data.scale = 13;
  404. return this.$wechat.seeLocation(data);
  405. }
  406. // #endif
  407. uni.openLocation(data);
  408. },
  409. // 用户默认地址
  410. getAddressDefault() {
  411. getAddressDefault().then(res => {
  412. const data = res.data;
  413. if (Array.isArray(data)) {
  414. return;
  415. }
  416. this.onAddressChange(data.id, data, true);
  417. });
  418. },
  419. // 点击拼单
  420. onCollage() {
  421. if (!this.isLogin) {
  422. // #ifdef H5
  423. return toLogin();
  424. // #endif
  425. // #ifdef MP
  426. return this.isShowAuth = true;
  427. // #endif
  428. }
  429. hasCollage().then(res => {
  430. const collageId = res.data.collageId;
  431. if (collageId) {
  432. uni.navigateTo({
  433. url: `/pages/store/group_buy/index?collage_id=${collageId}`
  434. });
  435. } else{
  436. this.getAddressDefault();
  437. this.$refs.addressWindow.getAddressList();
  438. this.collageVisible = true;
  439. }
  440. });
  441. },
  442. // 发起拼单
  443. initCollage() {
  444. let data = {
  445. store_id: this.collageStore.id,
  446. address_id: this.collageAddress.id || 0,
  447. shipping_type: this.collageDelivery == 1 ? 3 : 2
  448. };
  449. initCollage(data).then(res => {
  450. this.collageVisible = false;
  451. uni.navigateTo({
  452. url: `/pages/store/group_buy/index?collage_id=${res.data.collageId}`
  453. });
  454. }).catch(err => {
  455. this.$util.Tips({
  456. title: err
  457. });
  458. });
  459. },
  460. // 选择配送地址
  461. onAddressChange(id, data, isInit) {
  462. isWithin({
  463. store_id: this.collageStore.id,
  464. address_id: id
  465. }).then(() => {
  466. if (!isInit) {
  467. this.onAddress();
  468. }
  469. this.collageAddress = data;
  470. this.address.addressId = data;
  471. }).catch(() => {
  472. if (!isInit) {
  473. this.$util.Tips({
  474. title: '您选择的地址超出门店配送范围,请重新选择'
  475. });
  476. }
  477. });
  478. },
  479. onCollageClose() {
  480. this.collageVisible = false;
  481. },
  482. // 选择自提、配送
  483. collageDeliveryChange(key) {
  484. if (key != 2 || this.info.is_store) {
  485. this.collageDelivery = key;
  486. }
  487. },
  488. // 切换地址
  489. onAddress() {
  490. this.address.address = !this.address.address;
  491. this.pagesUrl = '/pages/users/user_address_list/index?isCollage=1&store_id='+this.info.id
  492. this.$refs.addressWindow.getAddressList();
  493. },
  494. // #endif
  495. getNoCart(){
  496. if(this.cartNum<=0){
  497. this.tempArr.forEach((item)=>{
  498. item.cart_num = 0
  499. })
  500. this.totalPrice = 0;
  501. }
  502. },
  503. // 授权回调
  504. onLoadFun() {
  505. setTimeout(function(){
  506. this.isShowAuth = false;
  507. },10)
  508. },
  509. // 授权关闭
  510. authColse: function(e) {
  511. this.isShowAuth = e
  512. },
  513. updateFun(e) {
  514. if (e.cartNum) {
  515. this.tempArr.forEach((item) => {
  516. if (item.id == e.id) {
  517. item.cart_num = e.cartNum
  518. }
  519. })
  520. }
  521. },
  522. // 商品列表
  523. getProducts() {
  524. let that = this;
  525. if (that.loadend) return;
  526. if (that.loading) return;
  527. that.loading = true;
  528. getProducts({
  529. page: that.page,
  530. limit: that.limit,
  531. type: 1,
  532. cid: that.cid,
  533. sid: that.sid,
  534. store_id: that.info.id,
  535. delivery_type:that.delivery_type,
  536. }).then(res => {
  537. let list = res.data,
  538. loadend = list.length < that.limit;
  539. that.tempArr = that.$util.SplitArray(list, that.tempArr);
  540. that.$set(that, 'tempArr', that.tempArr);
  541. that.loading = false;
  542. that.loadend = loadend;
  543. that.loadTitle = loadend ? "没有更多内容啦~" : "加载更多";
  544. that.page = that.page + 1;
  545. }).catch(err => {
  546. that.loading = false;
  547. that.loadTitle = '加载更多'
  548. });
  549. },
  550. // 切换自提方式
  551. swithFn(num) {
  552. this.switchNumFun(num);
  553. this.page = 1;
  554. this.loadend = false;
  555. this.tempArr = []
  556. this.getProducts()
  557. },
  558. switchNumFun(num){
  559. switch (num) {
  560. case 1:
  561. this.switchNum = 1
  562. this.delivery_type = '3'
  563. break;
  564. case 2:
  565. this.switchNum = 2
  566. this.delivery_type='2'
  567. break;
  568. }
  569. },
  570. // 跳转到门店列表
  571. goMap(val = 0) {
  572. uni.navigateTo({
  573. // url: "/pages/store/map/index?storeFrom=1&type=1&storeId="+(val ? this.collageStore.id : this.info.id)+'&isCollage='+val,
  574. url: `/pages/store/store_list/index?storeFrom=1&type=1&storeId=${val ? this.collageStore.id : this.info.id}&isCollage=${val}`,
  575. success(res) {
  576. console.log('成功啦', res);
  577. },
  578. fail(err) {
  579. console.log('失败啦', err);
  580. }
  581. })
  582. },
  583. getMarTop() {
  584. // #ifdef MP || APP-PLUS
  585. let that = this;
  586. setTimeout(() => {
  587. // 获取小程序头部高度
  588. let info = uni.createSelectorQuery().in(this).select(".mp-header");
  589. info.boundingClientRect(function(data) {
  590. that.marTop = data.height
  591. }).exec()
  592. }, 100)
  593. // #endif
  594. },
  595. // 生成订单;
  596. subOrder: function() {
  597. let that = this,
  598. list = that.cartData.cartList,
  599. ids = [];
  600. if (list.length) {
  601. list.forEach(item => {
  602. if(item.attrStatus && item.status){
  603. ids.push(item.id)
  604. }
  605. });
  606. uni.navigateTo({
  607. url: '/pages/goods/order_confirm/index?cartId=' + ids.join(',')+'&delivery_type='+that.delivery_type + '&store_id=' + that.info.id
  608. });
  609. that.cartData.iScart = false;
  610. } else {
  611. return that.$util.Tips({
  612. title: '请选择产品'
  613. });
  614. }
  615. },
  616. // 计算总价;
  617. getTotalPrice: function() {
  618. let that = this,
  619. list = that.cartData.cartList,
  620. totalPrice = 0.00;
  621. list.forEach(item => {
  622. if (item.attrStatus && item.status) {
  623. totalPrice = that.$util.$h.Add(totalPrice, that.$util.$h.Mul(item.cart_num, item
  624. .truePrice));
  625. }
  626. })
  627. // if(num){
  628. // data.forEach(item => {
  629. // totalPrice = that.$util.$h.Sub(totalPrice, that.$util.$h.Mul(item.cart_num, item.sum_price));
  630. // })
  631. // }
  632. that.$set(that, 'totalPrice', totalPrice);
  633. },
  634. ChangeSubDel: function(event) {
  635. let that = this,
  636. list = that.cartData.cartList,
  637. ids = [],
  638. storeId = uni.getStorageSync('user_store_id');
  639. list.forEach(item => {
  640. ids.push(item.id)
  641. });
  642. cartDel(ids.join(","),storeId).then(res => {
  643. that.$set(that.cartData, 'cartList', []);
  644. that.cartData.iScart = false;
  645. that.totalPrice = 0.00;
  646. that.page = 1;
  647. that.loadend = false;
  648. that.tempArr = [];
  649. that.getProducts();
  650. that.getCartNum();
  651. })
  652. },
  653. ChangeOneDel: function(id, index) {
  654. let that = this,
  655. list = that.cartData.cartList,
  656. storeId = uni.getStorageSync('user_store_id');
  657. cartDel(id.toString(),storeId).then(res => {
  658. list.splice(index, 1);
  659. if (!list.length) {
  660. that.cartData.iScart = false;
  661. that.page = 1;
  662. that.loadend = false;
  663. that.tempArr = [];
  664. that.getProducts();
  665. };
  666. that.getCartNum();
  667. })
  668. },
  669. getCartList(iSshow) {
  670. let that = this;
  671. let data = {
  672. store_id:that.info.id
  673. };
  674. vcartList(data).then(res => {
  675. that.$set(that.cartData, 'cartList', res.data);
  676. if (res.data.length) {
  677. that.$set(that.cartData, 'iScart', iSshow ? false : !that.cartData.iScart);
  678. } else {
  679. that.$set(that.cartData, 'iScart', false);
  680. }
  681. that.getTotalPrice();
  682. })
  683. },
  684. closeList(e) {
  685. this.$set(this.cartData, 'iScart', e);
  686. },
  687. getCartNum: function() {
  688. let that = this;
  689. getCartCounts(0,that.info.id).then(res => {
  690. this.$store.commit('indexData/setCartNum', res.data.count)
  691. });
  692. },
  693. onMyEvent: function() {
  694. this.$set(this.attr, 'cartAttr', false);
  695. },
  696. /**
  697. * 默认选中属性
  698. *
  699. */
  700. DefaultSelect: function() {
  701. let productAttr = this.attr.productAttr;
  702. let value = [];
  703. for (let key in this.productValue) {
  704. if (this.productValue[key].stock > 0) {
  705. value = this.attr.productAttr.length ? key.split(",") : [];
  706. break;
  707. }
  708. }
  709. for (let i = 0; i < productAttr.length; i++) {
  710. this.$set(productAttr[i], "index", value[i]);
  711. }
  712. //sort();排序函数:数字-英文-汉字;
  713. let productSelect = this.productValue[value.join(",")];
  714. if (productSelect && productAttr.length) {
  715. this.$set(
  716. this.attr.productSelect,
  717. "store_name",
  718. this.storeName
  719. );
  720. this.$set(this.attr.productSelect, "image", productSelect.image);
  721. this.$set(this.attr.productSelect, "price", productSelect.price);
  722. this.$set(this.attr.productSelect, "stock", productSelect.stock);
  723. this.$set(this.attr.productSelect, "unique", productSelect.unique);
  724. this.$set(this.attr.productSelect, "cart_num", 1);
  725. this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
  726. this.$set(this, "attrValue", value.join(","));
  727. } else if (!productSelect && productAttr.length) {
  728. this.$set(
  729. this.attr.productSelect,
  730. "store_name",
  731. this.storeName
  732. );
  733. this.$set(this.attr.productSelect, "image", this.storeInfo.image);
  734. this.$set(this.attr.productSelect, "price", this.storeInfo.price);
  735. this.$set(this.attr.productSelect, "stock", 0);
  736. this.$set(this.attr.productSelect, "unique", "");
  737. this.$set(this.attr.productSelect, "cart_num", 0);
  738. this.$set(this, "attrValue", "");
  739. this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
  740. } else if (!productSelect && !productAttr.length) {
  741. this.$set(
  742. this.attr.productSelect,
  743. "store_name",
  744. this.storeName
  745. );
  746. this.$set(this.attr.productSelect, "image", this.storeInfo.image);
  747. this.$set(this.attr.productSelect, "price", this.storeInfo.price);
  748. this.$set(this.attr.productSelect, "stock", this.storeInfo.stock);
  749. this.$set(
  750. this.attr.productSelect,
  751. "unique",
  752. this.storeInfo.unique || ""
  753. );
  754. this.$set(this.attr.productSelect, "cart_num", 1);
  755. this.$set(this, "attrValue", "");
  756. this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
  757. }
  758. },
  759. /**
  760. * 属性变动赋值
  761. *
  762. */
  763. ChangeAttr: function(res) {
  764. let productSelect = this.productValue[res];
  765. if (productSelect && productSelect.stock > 0) {
  766. this.$set(this.attr.productSelect, "image", productSelect.image);
  767. this.$set(this.attr.productSelect, "price", productSelect.price);
  768. this.$set(this.attr.productSelect, "stock", productSelect.stock);
  769. this.$set(this.attr.productSelect, "unique", productSelect.unique);
  770. this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
  771. this.$set(this.attr.productSelect, "cart_num", 1);
  772. this.$set(this, "attrValue", res);
  773. } else if (productSelect && productSelect.stock == 0) {
  774. this.$set(this.attr.productSelect, "image", productSelect.image);
  775. this.$set(this.attr.productSelect, "price", productSelect.price);
  776. this.$set(this.attr.productSelect, "stock", 0);
  777. this.$set(this.attr.productSelect, "unique", "");
  778. this.$set(this.attr.productSelect, 'vip_price', productSelect.vip_price);
  779. this.$set(this.attr.productSelect, "cart_num", 0);
  780. this.$set(this, "attrValue", "");
  781. } else {
  782. this.$set(this.attr.productSelect, "image", this.storeInfo.image);
  783. this.$set(this.attr.productSelect, "price", this.storeInfo.price);
  784. this.$set(this.attr.productSelect, "stock", 0);
  785. this.$set(this.attr.productSelect, "unique", "");
  786. this.$set(this.attr.productSelect, 'vip_price', this.storeInfo.vip_price);
  787. this.$set(this.attr.productSelect, "cart_num", 0);
  788. this.$set(this, "attrValue", "");
  789. }
  790. },
  791. attrVal(val) {
  792. this.$set(this.attr.productAttr[val.indexw], 'index', this.attr.productAttr[val.indexw].attr_values[val
  793. .indexn]);
  794. },
  795. /**
  796. * 购物车手动填写
  797. *
  798. */
  799. iptCartNum: function(e) {
  800. this.$set(this.attr.productSelect, 'cart_num', e);
  801. },
  802. // 点击默认单属性购物车
  803. goCartDan(item, index) {
  804. if (!this.isLogin) {
  805. this.getIsLogin();
  806. } else {
  807. this.tempArr[index].cart_num = 1;
  808. this.$set(this, 'tempArr', this.tempArr);
  809. this.goCat(0, item.id, 1);
  810. }
  811. },
  812. // 改变单属性购物车
  813. ChangeCartNumDan(changeValue, index, item) {
  814. let num = this.tempArr[index];
  815. let stock = this.tempArr[index].stock;
  816. this.ChangeCartNum(changeValue, num, stock, 0, item.id);
  817. },
  818. // 改变多属性购物车
  819. ChangeCartNumDuo(changeValue) {
  820. //获取当前变动属性
  821. let productSelect = this.productValue[this.attrValue];
  822. //如果没有属性,赋值给商品默认库存
  823. if (productSelect === undefined && !this.attr.productAttr.length)
  824. productSelect = this.attr.productSelect;
  825. //无属性值即库存为0;不存在加减;
  826. if (productSelect === undefined) return;
  827. let stock = productSelect.stock || 0;
  828. let num = this.attr.productSelect;
  829. this.ChangeCartNum(changeValue, num, stock, 1);
  830. },
  831. // 已经加入购物车时的购物加减;
  832. ChangeCartList(changeValue, index) {
  833. let list = this.cartData.cartList;
  834. let num = list[index];
  835. let stock = list[index].trueStock;
  836. this.ChangeCartNum(changeValue, num, stock, 0, num.product_id, index, 1);
  837. if (!list.length) {
  838. this.cartData.iScart = false;
  839. this.page = 1;
  840. this.loadend = false;
  841. this.tempArr = [];
  842. this.getProducts();
  843. }
  844. },
  845. // 购物车加减计算函数
  846. ChangeCartNum(changeValue, num, stock, isDuo, id, index, cart) {
  847. if (changeValue) {
  848. num.cart_num++;
  849. if (num.cart_num > stock) {
  850. if (isDuo) {
  851. this.$set(this.attr.productSelect, "cart_num", stock ? stock : 1);
  852. this.$set(this, "cart_num", stock ? stock : 1);
  853. } else {
  854. num.cart_num = stock ? stock : 0;
  855. this.$set(this, 'tempArr', this.tempArr);
  856. this.$set(this.cartData, 'cartList', this.cartData.cartList);
  857. }
  858. return this.$util.Tips({
  859. title: "该产品没有更多库存了"
  860. });
  861. } else {
  862. if (!isDuo) {
  863. if (cart) {
  864. this.goCat(0, id, 1, 1, num.product_attr_unique);
  865. this.getTotalPrice();
  866. this.tempArr.forEach((item) => {
  867. if (item.id == id) {
  868. item.cart_num++;
  869. }
  870. })
  871. } else {
  872. this.goCat(0, id, 1);
  873. }
  874. } else {
  875. this.tempArr.forEach((item) => {
  876. if (item.id == id) {
  877. item.cart_num++;
  878. }
  879. })
  880. }
  881. }
  882. } else {
  883. num.cart_num--;
  884. if (num.cart_num == 0) {
  885. this.cartData.cartList.splice(index, 1);
  886. if (isDuo) {
  887. this.$set(this.attr.productSelect, "cart_num", 1);
  888. this.$set(this, "cart_num", 1);
  889. }
  890. }
  891. if (num.cart_num < 0) {
  892. if (isDuo) {
  893. this.$set(this.attr.productSelect, "cart_num", 1);
  894. this.$set(this, "cart_num", 1);
  895. } else {
  896. num.cart_num = 0;
  897. this.$set(this, 'tempArr', this.tempArr);
  898. this.$set(this.cartData, 'cartList', this.cartData.cartList);
  899. }
  900. } else {
  901. if (!isDuo) {
  902. if (cart) {
  903. this.goCat(0, id, 0, 1, num.product_attr_unique);
  904. this.getTotalPrice();
  905. this.tempArr.forEach((item) => {
  906. if (item.id == id) {
  907. item.cart_num--;
  908. }
  909. })
  910. } else {
  911. this.goCat(0, id, 0);
  912. }
  913. } else {
  914. this.tempArr.forEach((item) => {
  915. if (item.id == id) {
  916. item.cart_num--;
  917. }
  918. })
  919. }
  920. }
  921. }
  922. },
  923. // 多规格加入购物车;
  924. goCatNum() {
  925. this.goCat(1, this.id, 1);
  926. },
  927. /*
  928. * 加入购物车
  929. */
  930. goCat: function(duo, id, type, cart, unique) {
  931. let that = this;
  932. if (duo) {
  933. let productSelect = that.productValue[this.attrValue];
  934. //如果有属性,没有选择,提示用户选择
  935. if (
  936. that.attr.productAttr.length &&
  937. productSelect === undefined
  938. )
  939. return that.$util.Tips({
  940. title: "产品库存不足,请选择其它属性"
  941. });
  942. }
  943. let q = {
  944. product_id: id,
  945. num: duo ? that.attr.productSelect.cart_num : 1,
  946. type: type,
  947. unique: duo ? that.attr.productSelect.unique : cart ? unique : ""
  948. };
  949. postCartNum(q)
  950. .then(function(res) {
  951. if (duo) {
  952. that.attr.cartAttr = false;
  953. that.$util.Tips({
  954. title: "添加购物车成功"
  955. });
  956. // that.page = 1;
  957. // that.loadend = false;
  958. that.tempArr.forEach((item, index) => {
  959. if (item.id == that.id) {
  960. let arrtStock = that.attr.productSelect.stock
  961. let objNum = parseInt(item.cart_num) + parseInt(that.attr.productSelect.cart_num);
  962. item.cart_num = objNum > arrtStock ? arrtStock : objNum
  963. }
  964. })
  965. // that.productslist();
  966. }
  967. that.getCartNum();
  968. if (!cart) {
  969. that.getCartList(1);
  970. }
  971. })
  972. .catch(err => {
  973. return that.$util.Tips({
  974. title: err
  975. });
  976. });
  977. },
  978. goCartDuo(item) {
  979. if (!this.isLogin) {
  980. this.getIsLogin();
  981. } else {
  982. // uni.showLoading({
  983. // title: '加载中'
  984. // });
  985. this.storeName = item.store_name;
  986. this.getAttrs(item.id);
  987. this.$set(this, 'id', item.id);
  988. this.$set(this.attr, 'cartAttr', true);
  989. }
  990. },
  991. getIsLogin() {
  992. //#ifndef MP
  993. toLogin();
  994. //#endif
  995. //#ifdef MP
  996. this.isShowAuth = true;
  997. //#endif
  998. },
  999. // 商品详情接口;
  1000. getAttrs(id) {
  1001. let that = this;
  1002. getAttr(id, 0).then(res => {
  1003. // uni.hideLoading();
  1004. that.$set(that.attr, 'productAttr', res.data.productAttr);
  1005. that.$set(that, 'productValue', res.data.productValue);
  1006. that.$set(that, 'is_vip', res.data.storeInfo.is_vip);
  1007. that.$set(that, 'storeInfo', res.data.storeInfo);
  1008. that.DefaultSelect();
  1009. })
  1010. },
  1011. // 去详情页
  1012. goDetail(item) {
  1013. goShopDetail(item, this.uid).then(res => {
  1014. uni.navigateTo({
  1015. url: `/pages/goods_details/index?id=${item.id}&fromType=1`
  1016. });
  1017. });
  1018. },
  1019. openTap() {
  1020. this.iSlong = false
  1021. },
  1022. closeTap() {
  1023. this.iSlong = true
  1024. },
  1025. // 分类数据
  1026. getAllCategory: function() {
  1027. let that = this;
  1028. getStoreCategory().then(res => {
  1029. let data = res.data;
  1030. data.forEach(item => {
  1031. item.children.unshift({
  1032. 'id': 0,
  1033. 'cate_name': '全部'
  1034. })
  1035. })
  1036. that.categoryTitle = data[0].cate_name;
  1037. that.cid = data[0].id;
  1038. that.sid = 0;
  1039. that.navActive = 0;
  1040. that.tabClick = 0;
  1041. that.categoryList = data;
  1042. that.categoryErList = res.data[0].children ? res.data[0].children : [];
  1043. that.page = 1;
  1044. that.loadend = false;
  1045. that.loading = false;
  1046. that.tempArr = [];
  1047. that.info.default_delivery
  1048. that.switchNumFun(that.info.default_delivery);
  1049. that.getProducts();
  1050. })
  1051. },
  1052. tapNav(index, item) {
  1053. uni.pageScrollTo({
  1054. duration: 0,
  1055. scrollTop: 0
  1056. })
  1057. let list = this.categoryList[index];
  1058. this.navActive = index;
  1059. this.categoryTitle = list.cate_name;
  1060. this.categoryErList = item.children ? item.children : [];
  1061. this.tabClick = 0;
  1062. this.tabLeft = 0;
  1063. this.cid = list.id;
  1064. this.sid = 0;
  1065. this.page = 1;
  1066. this.loadend = false;
  1067. this.tempArr = [];
  1068. this.getProducts();
  1069. },
  1070. // 导航栏点击
  1071. longClick(index) {
  1072. if (this.categoryErList.length > 3) {
  1073. this.tabLeft = (index - 1) * (this.isWidth + 6) //设置下划线位置
  1074. };
  1075. this.tabClick = index; //设置导航点击了哪一个
  1076. this.iSlong = true;
  1077. this.sid = this.categoryErList[index].id;
  1078. this.page = 1;
  1079. this.loadend = false;
  1080. this.tempArr = [];
  1081. this.getProducts();
  1082. },
  1083. },
  1084. onReachBottom: function() {
  1085. this.getProducts();
  1086. }
  1087. }
  1088. </script>
  1089. <style lang="scss">
  1090. /* #ifdef MP || APP-PLUS */
  1091. .mp-header {
  1092. z-index: 30;
  1093. position: fixed;
  1094. left: 0;
  1095. top: 0;
  1096. width: 100%;
  1097. background: #fff;
  1098. border-bottom: 1px solid #F0F0F0;
  1099. .serch-wrapper {
  1100. height: 100%;
  1101. /* #ifdef MP */
  1102. padding: 0 220rpx 0 30rpx;
  1103. /* #endif */
  1104. /* #ifdef APP-PLUS */
  1105. padding: 0 50rpx 0 40rpx;
  1106. /* #endif */
  1107. .input {
  1108. flex: 1;
  1109. height: 55rpx;
  1110. // padding: 0 0 0 30rpx;
  1111. background: #F8F8F8;
  1112. color: #ADADAD;
  1113. font-size: 26rpx;
  1114. /* #ifdef MP */
  1115. width: 70%;
  1116. /* #endif */
  1117. /* #ifdef APP-PLUS */
  1118. width: 100%;
  1119. /* #endif */
  1120. border-radius: 50rpx;
  1121. .iconfont {
  1122. margin-right: 20rpx;
  1123. }
  1124. }
  1125. }
  1126. }
  1127. /* #endif */
  1128. page {
  1129. background-color: #fff;
  1130. }
  1131. /deep/.product-window.joinCart {
  1132. z-index: 999;
  1133. }
  1134. ::-webkit-scrollbar {
  1135. width: 0;
  1136. height: 0;
  1137. color: transparent;
  1138. display: none
  1139. }
  1140. .goodCate {
  1141. /deep/.mask {
  1142. z-index: 99;
  1143. }
  1144. /deep/.attrProduct {
  1145. .mask {
  1146. z-index: 100;
  1147. }
  1148. }
  1149. .header {
  1150. position: fixed;
  1151. background-color: #fff;
  1152. top: 0;
  1153. left: 0;
  1154. width: 100%;
  1155. z-index: 99;
  1156. border-bottom: 1px solid #F0F0F0;
  1157. /* #ifdef H5 */
  1158. padding-top: 20rpx;
  1159. /* #endif */
  1160. .pageIndex {
  1161. width: 68rpx;
  1162. height: 68rpx;
  1163. border-radius: 50%;
  1164. background-color: #F7F7F7;
  1165. .iconfont {
  1166. color: #666666;
  1167. font-size: 30rpx;
  1168. }
  1169. // image{
  1170. // width: 29rpx;
  1171. // height: 30rpx;
  1172. // }
  1173. }
  1174. .search {
  1175. flex: 1;
  1176. // width: 690rpx;
  1177. height: 68rpx;
  1178. border-radius: 36rpx;
  1179. background-color: #F7F7F7;
  1180. font-size: 26rpx;
  1181. color: #cccccc;
  1182. padding: 0 30rpx;
  1183. box-sizing: border-box;
  1184. .iconfont {
  1185. font-size: 30rpx;
  1186. margin-right: 18rpx;
  1187. color: #666666;
  1188. }
  1189. }
  1190. }
  1191. .conter {
  1192. /* #ifdef H5 */
  1193. padding-top: 288rpx;
  1194. /* #endif */
  1195. height: 100vh;
  1196. background-color: #fff;
  1197. .aside {
  1198. position: fixed;
  1199. width: 23%;
  1200. left: 0;
  1201. bottom: 0;
  1202. /* #ifdef H5 */
  1203. top: 288rpx;
  1204. /* #endif */
  1205. background-color: #F7F7F7;
  1206. overflow-y: auto;
  1207. overflow-x: hidden;
  1208. /* #ifdef H5 */
  1209. // margin-top: 128rpx;
  1210. /* #endif */
  1211. z-index: 99;
  1212. padding-bottom: 194rpx;
  1213. .item {
  1214. height: 100rpx;
  1215. width: 100%;
  1216. font-size: 26rpx;
  1217. color: #333333;
  1218. &.on {
  1219. background-color: #FFFFFF;
  1220. width: 100%;
  1221. text-align: center;
  1222. color: var(--view-theme);
  1223. font-weight: 500;
  1224. position: relative;
  1225. &::after {
  1226. content: "";
  1227. position: absolute;
  1228. width: 6rpx;
  1229. height: 46rpx;
  1230. background: var(--view-theme);
  1231. border-radius: 0 4rpx 4rpx 0;
  1232. left: 0
  1233. }
  1234. }
  1235. }
  1236. }
  1237. .wrapper {
  1238. margin-top: 104rpx;
  1239. padding-bottom: 250rpx;
  1240. /* #ifdef H5 */
  1241. padding-bottom: 200rpx;
  1242. /* #endif */
  1243. width: 77%;
  1244. float: right;
  1245. background-color: #FFFFFF;
  1246. // padding-bottom: 240rpx;
  1247. .bgcolor {
  1248. width: 100%;
  1249. background-color: #FFFFFF;
  1250. }
  1251. // .goodsList {
  1252. // margin-top: 0 !important;
  1253. // }
  1254. .mask {
  1255. z-index: 9;
  1256. }
  1257. .longTab {
  1258. width: 65%;
  1259. position: fixed;
  1260. /* #ifdef H5 */
  1261. top: 288rpx;
  1262. /* #endif */
  1263. height: 100rpx;
  1264. z-index: 99;
  1265. background-color: #FFFFFF;
  1266. .longItem {
  1267. height: 44rpx;
  1268. display: inline-block;
  1269. line-height: 44rpx;
  1270. text-align: center;
  1271. font-size: 26rpx;
  1272. overflow: hidden;
  1273. text-overflow: ellipsis;
  1274. white-space: nowrap;
  1275. color: #333333;
  1276. background-color: #F7F7F7;
  1277. border-radius: 22rpx;
  1278. margin-left: 12rpx;
  1279. &.click {
  1280. font-weight: bold;
  1281. background-color: var(--view-theme);
  1282. color: #ffffff;
  1283. }
  1284. }
  1285. .underlineBox {
  1286. height: 3px;
  1287. width: 20%;
  1288. display: flex;
  1289. align-content: center;
  1290. justify-content: center;
  1291. transition: .5s;
  1292. .underline {
  1293. width: 33rpx;
  1294. height: 4rpx;
  1295. background-color: #FFFFFF;
  1296. }
  1297. }
  1298. }
  1299. .openList {
  1300. width: 12%;
  1301. height: 100rpx;
  1302. background-color: #FFFFFF;
  1303. line-height: 100rpx;
  1304. padding-left: 30rpx;
  1305. position: fixed;
  1306. right: 0;
  1307. /* #ifdef H5 */
  1308. top: 288rpx;
  1309. /* #endif */
  1310. z-index: 99;
  1311. .iconfont {
  1312. font-size: 22rpx;
  1313. color: #666666;
  1314. }
  1315. }
  1316. .downTab {
  1317. width: 78%;
  1318. position: fixed;
  1319. top: 0rpx;
  1320. /* #ifdef H5 */
  1321. top: 288rpx;
  1322. /* #endif */
  1323. z-index: 102;
  1324. background-color: #FFFFFF;
  1325. .title {
  1326. height: 100rpx;
  1327. font-size: 26rpx;
  1328. color: #999999;
  1329. padding-left: 20rpx;
  1330. .closeList {
  1331. width: 90rpx;
  1332. height: 100%;
  1333. line-height: 100rpx;
  1334. padding-left: 30rpx;
  1335. transform: rotate(180deg);
  1336. .iconfont {
  1337. font-size: 22rpx;
  1338. color: #666666;
  1339. }
  1340. }
  1341. }
  1342. .children {
  1343. max-height: 500rpx;
  1344. overflow-x: hidden;
  1345. overflow-y: auto;
  1346. padding-bottom: 20rpx;
  1347. .item {
  1348. height: 60rpx;
  1349. background-color: #F7F7F7;
  1350. border-radius: 30rpx;
  1351. line-height: 60rpx;
  1352. padding: 0 15rpx;
  1353. margin: 0 0 20rpx 20rpx;
  1354. width: 165rpx;
  1355. text-align: center;
  1356. &.click {
  1357. font-weight: bold;
  1358. background-color: var(--view-theme);
  1359. color: #ffffff;
  1360. }
  1361. }
  1362. }
  1363. }
  1364. .goodsList {
  1365. margin-top: 0rpx;
  1366. padding: 0 30rpx 0 20rpx;
  1367. /deep/.item {
  1368. margin-bottom: 33rpx !important;
  1369. .text {
  1370. font-size: 26rpx;
  1371. }
  1372. .bottom {
  1373. .sales {
  1374. .money {
  1375. font-size: 34rpx;
  1376. text {
  1377. font-size: 26rpx;
  1378. }
  1379. }
  1380. }
  1381. .cart {
  1382. .pictrue {
  1383. width: 50rpx;
  1384. height: 50rpx;
  1385. }
  1386. }
  1387. }
  1388. }
  1389. }
  1390. }
  1391. }
  1392. .store-address {
  1393. width: 100%;
  1394. margin-top: 15rpx;
  1395. position: relative;
  1396. padding: 12rpx 30rpx 0 30rpx;
  1397. height: 185rpx;
  1398. background-color: #fff;
  1399. .address {
  1400. font-size: 32rpx;
  1401. font-weight: 500;
  1402. color: #333333;
  1403. .name{
  1404. max-width: 400rpx;
  1405. }
  1406. .icon-xiangyou {
  1407. font-size: 24rpx;
  1408. margin-left: 10rpx;
  1409. }
  1410. }
  1411. .distance {
  1412. margin-top: 16rpx;
  1413. font-size: 24rpx;
  1414. font-weight: 400;
  1415. color: #999999;
  1416. }
  1417. .time {
  1418. margin-top: 16rpx;
  1419. font-size: 24rpx;
  1420. font-weight: 400;
  1421. color: #333333;
  1422. }
  1423. .switch {
  1424. position: absolute;
  1425. top: 15rpx;
  1426. /* #ifdef H5 */
  1427. top: 20rpx;
  1428. /* #endif */
  1429. right: 30rpx;
  1430. width: 194rpx;
  1431. height: 58rpx;
  1432. background: #F5F5F5;
  1433. border-radius: 33rpx;
  1434. .title {
  1435. width: 94rpx;
  1436. height: 100%;
  1437. line-height: 58rpx;
  1438. border-radius: 33rpx;
  1439. text-align: center;
  1440. // padding-right: 20rpx;
  1441. &.onLeft {
  1442. // padding-left: 20rpx;
  1443. // padding-right: 0;
  1444. }
  1445. &.on {
  1446. width: 100rpx;
  1447. background-color: var(--view-theme) !important;
  1448. color: #fff;
  1449. padding: 0 !important;
  1450. }
  1451. }
  1452. }
  1453. }
  1454. .footer {
  1455. width: 100%;
  1456. position: fixed;
  1457. left: 0;
  1458. background-color: #fff;
  1459. box-shadow: 0px -3px 16px rgba(36, 12, 12, 0.05);
  1460. z-index: 100;
  1461. padding-left: 30rpx;
  1462. box-sizing: border-box;
  1463. height: 100rpx;
  1464. // #ifdef H5
  1465. bottom: 94rpx;
  1466. bottom: calc(94rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1467. bottom: calc(94rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1468. // #endif
  1469. // #ifndef H5
  1470. bottom: 98rpx;
  1471. bottom: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1472. bottom: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1473. // #endif
  1474. &.on {
  1475. // #ifndef H5
  1476. bottom: 0rpx;
  1477. // #endif
  1478. }
  1479. /deep/.cartIcon {
  1480. width: 80rpx;
  1481. height: 80rpx;
  1482. border-radius: 50%;
  1483. position: relative;
  1484. margin-top: -36rpx;
  1485. .iconfont {
  1486. font-size: 94rpx;
  1487. margin-top: 12rpx;
  1488. color: var(--view-theme);
  1489. }
  1490. &.noCart {
  1491. .iconfont {
  1492. color: #CBCBCB;
  1493. }
  1494. }
  1495. .num {
  1496. min-width: 14rpx;
  1497. background-color: #fff;
  1498. color: var(--view-theme);
  1499. border-radius: 15px;
  1500. position: absolute;
  1501. right: -10rpx;
  1502. top: 20rpx;
  1503. font-size: 20rpx;
  1504. padding: 0 10rpx;
  1505. border: 1px solid var(--view-theme);
  1506. }
  1507. }
  1508. .money {
  1509. font-size: 26rpx;
  1510. font-weight: bold;
  1511. color: var(--view-priceColor);
  1512. margin-right: 34rpx;
  1513. .num {
  1514. font-size: 34rpx;
  1515. }
  1516. }
  1517. .bnt {
  1518. width: 192rpx;
  1519. height: 76rpx;
  1520. background-color: var(--view-theme);
  1521. border-radius: 46px;
  1522. line-height: 76rpx;
  1523. text-align: center;
  1524. color: #fff;
  1525. font-size: 28rpx;
  1526. margin-right: 30rpx;
  1527. }
  1528. .noCart {
  1529. .money {
  1530. color: #CBCBCB;
  1531. }
  1532. .bnt {
  1533. background-color: #CBCBCB;
  1534. }
  1535. }
  1536. }
  1537. }
  1538. .group-button {
  1539. transform: rotateZ(360deg);
  1540. padding: 19rpx 24rpx;
  1541. border: 1rpx solid #DDDDDD;
  1542. border-radius: 32rpx;
  1543. margin-right: 40rpx;
  1544. font-weight: 500;
  1545. font-size: 26rpx;
  1546. line-height: 26rpx;
  1547. color: #333333;
  1548. .iconfont {
  1549. margin-right: 10rpx;
  1550. font-size: 26rpx;
  1551. color: var(--view-theme);
  1552. }
  1553. }
  1554. /* #ifdef H5 || MP */
  1555. .dialog {
  1556. position: fixed;
  1557. right: 0;
  1558. left: 0;
  1559. z-index: 101;
  1560. padding: 36rpx 40rpx 40rpx;
  1561. border-radius: 12rpx 12rpx 0 0;
  1562. background-color: #FFFFFF;
  1563. transform: translateY(100%);
  1564. transition: 0.3s;
  1565. /* #ifdef H5 */
  1566. bottom: 94rpx;
  1567. bottom: calc(94rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1568. bottom: calc(94rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1569. /* #endif */
  1570. /* #ifdef MP */
  1571. bottom: 0rpx;
  1572. bottom: calc(0rpx + constant(safe-area-inset-bottom));
  1573. bottom: calc(0rpx + env(safe-area-inset-bottom));
  1574. /* #endif */
  1575. &.dialog-footer {
  1576. /* #ifdef MP */
  1577. bottom: 98rpx;
  1578. bottom: calc(98rpx + constant(safe-area-inset-bottom));
  1579. bottom: calc(98rpx + env(safe-area-inset-bottom));
  1580. /* #endif */
  1581. }
  1582. &.active {
  1583. transform: translateY(0);
  1584. }
  1585. }
  1586. .dialog-head {
  1587. display: flex;
  1588. .button {
  1589. flex: 1;
  1590. display: flex;
  1591. justify-content: center;
  1592. align-items: center;
  1593. height: 138rpx;
  1594. border: 4rpx solid #DDDDDD;
  1595. border-radius: 12rpx;
  1596. font-weight: 500;
  1597. font-size: 32rpx;
  1598. color: #333333;
  1599. cursor: pointer;
  1600. +.button {
  1601. margin-left: 46rpx;
  1602. }
  1603. .iconfont {
  1604. margin-right: 40rpx;
  1605. font-size: 80rpx;
  1606. color: #999999;
  1607. }
  1608. &.active {
  1609. border: 4rpx solid var(--view-theme);
  1610. .iconfont {
  1611. color: var(--view-theme);
  1612. }
  1613. }
  1614. }
  1615. }
  1616. .dialog-body {
  1617. margin-top: 60rpx;
  1618. font-size: 24rpx;
  1619. color: #999999;
  1620. .dialog-body-main {
  1621. .dialog-body-main-inner {
  1622. display: flex;
  1623. margin-top: 32rpx;
  1624. }
  1625. .dialog-body-main-btn {
  1626. display: flex;
  1627. justify-content: center;
  1628. align-items: center;
  1629. margin-top: 56rpx;
  1630. .iconfont {
  1631. margin-left: 12rpx;
  1632. font-size: 22rpx;
  1633. color: #666666;
  1634. }
  1635. }
  1636. }
  1637. .dialog-body-left {
  1638. flex: 1;
  1639. min-width: 0;
  1640. margin-right: 20rpx;
  1641. }
  1642. .dialog-body-right {
  1643. display: flex;
  1644. justify-content: center;
  1645. align-items: center;
  1646. width: 40rpx;
  1647. height: 40rpx;
  1648. border-radius: 50%;
  1649. background-color: var(--view-minorColorT);
  1650. font-size: 22rpx;
  1651. color: var(--view-theme);
  1652. cursor: pointer;
  1653. }
  1654. .dialog-body-name {
  1655. font-weight: 500;
  1656. font-size: 24rpx;
  1657. line-height: 1.2;
  1658. color: #333333;
  1659. .tag {
  1660. margin-left: 14rpx;
  1661. font-size: 24rpx;
  1662. color: #888888;
  1663. }
  1664. }
  1665. .dialog-body-info {
  1666. margin-top: 28rpx;
  1667. .item {
  1668. display: flex;
  1669. font-size: 22rpx;
  1670. line-height: 1.5;
  1671. color: #888888;
  1672. +.item {
  1673. margin-top: 20rpx;
  1674. }
  1675. .iconfont {
  1676. margin-right: 5rpx;
  1677. font-size: 22rpx;
  1678. line-height: 1.5;
  1679. color: #CCCCCC;
  1680. }
  1681. }
  1682. }
  1683. }
  1684. .dialog-foot {
  1685. display: flex;
  1686. margin-top: 78rpx;
  1687. .button {
  1688. display: flex;
  1689. justify-content: center;
  1690. align-items: center;
  1691. flex: 1;
  1692. min-width: 0;
  1693. height: 92rpx;
  1694. border-radius: 46rpx;
  1695. background-color: #EEEEEE;
  1696. font-size: 30rpx;
  1697. color: #666666;
  1698. cursor: pointer;
  1699. +.button {
  1700. margin-left: 46rpx;
  1701. }
  1702. &.primary {
  1703. background-color: var(--view-theme);
  1704. color: #FFFFFF;
  1705. }
  1706. }
  1707. }
  1708. /* #endif */
  1709. .search-box {
  1710. flex: 1;
  1711. padding: 0 30rpx;
  1712. }
  1713. </style>