index.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974
  1. <template>
  2. <view class="content">
  3. <view @click="goAddress()" class="address text-bold">
  4. <view class="address_name">{{address?address:'选择地址'}}</view>
  5. <u-icon name="arrow-down" color="#333333" size="28"></u-icon>
  6. </view>
  7. <!-- #ifdef H5 -->
  8. <view class="bg-white">
  9. <!-- #endif -->
  10. <!-- #ifndef H5 -->
  11. <view class="bg-white" style="margin-top: 180rpx;">
  12. <!-- #endif -->
  13. <view class="padding-lr padding-top">
  14. <view class="flex align-center padding-left" @click="goNav('/pages/index/search/index')"
  15. style="border: 2rpx solid #FFAF5E;height: 80rpx;border-radius: 60rpx;">
  16. <u-icon name="search" size="46"></u-icon>
  17. <view class="flex-sub text-gray margin-left-sm">输入商家或商品名称</view>
  18. <view class="search-btn">搜索</view>
  19. </view>
  20. </view>
  21. <view class="padding-top padding-lr">
  22. <swiper class="swiper radius" :autoplay="true" interval="2000" duration="500" :circular="true"
  23. style="width: 100%;height: 280rpx;">
  24. <swiper-item v-for="(item,index) in bannerList" :key='index' @click="goNav(item.url)">
  25. <image :src="item.imageUrl" class="radius" style="width: 100%;height: 280rpx;"></image>
  26. </swiper-item>
  27. </swiper>
  28. </view>
  29. <view class="padding-lr radius" v-if="XCXIsSelect == '是'">
  30. <u-grid :col="5" :border="false">
  31. <u-grid-item v-for="(item,index) in gridData" :key='index' @tap="goDetail(item)">
  32. <image :src="item.imageUrl" style="width: 92rpx;height: 92rpx;border-radius: 92rpx;">
  33. </image>
  34. <view class="grid-text margin-top-sm">{{item.name}}</view>
  35. </u-grid-item>
  36. </u-grid>
  37. </view>
  38. </view>
  39. <!-- 公告 -->
  40. <view class="flex justify-between align-center bg-white padding-bottom padding-lr radius bg-white"
  41. style="width: 100%;height: 100rpx;">
  42. <image @click="ceshi" src="../../static/images/index/gonggao.png" style="width: 140rpx;height: 50rpx;" mode=""></image>
  43. <view class="flex-sub margin-left-sm" style="height:82rpx;overflow: hidden;">
  44. <uni-notice-bar single speed="25" scrollable background-color="#fff" color="#000" :text="noticeList.value" />
  45. </view>
  46. </view>
  47. <view class="flex justify-between padding-lr bg-white" v-if="XCXIsSelect == '是'">
  48. <image src="../../static/images/index/jifen.png" @click="goNav('/my/integral/index')"
  49. style="width: 338rpx;height: 180rpx;" mode=""></image>
  50. <image src="../../static/images/index/renwu.png" @click="goNav('/my/task/index')"
  51. style="width: 338rpx;height: 180rpx;" mode=""></image>
  52. </view>
  53. <!-- <view class="padding-top padding-lr bg-white" v-if="!shopStatus == 1&&XCXIsSelect=='是'">
  54. <image src="../../static/images/index/banner.png" @click="goNav('/my/apply/index')"
  55. style="width: 100%;height: 170rpx;" mode=""></image>
  56. </view> -->
  57. <!-- 活动推荐 -->
  58. <view class="huodong flex justify-center" v-if="huodongList.length>0&&XCXIsSelect!='否'">
  59. <view class="huodong-box flex justify-center">
  60. <view class="huodong-box-c">
  61. <view class="huodong-box-c-title flex justify-between align-center">
  62. <view class="huodong-box-c-title-l flex align-center">
  63. <image src="../../static/images/index/hd.png" mode=""></image>
  64. </view>
  65. <view class="huodong-box-c-title-r">
  66. 美食速达
  67. </view>
  68. </view>
  69. <view class="huodong-box-c-list">
  70. <swiper @change="swiperChange" :indicator-dots="false" display-multiple-items="3"
  71. :circular="true" style="height: 300rpx;" :autoplay="false" previous-margin="5"
  72. :interval="300" :duration="300">
  73. <swiper-item v-for="(item,index) in huodongList"
  74. style="border-radius: 28rpx;height: 320rpx;"
  75. @click="gotohuodong(item.name,item.id,item.imageUrl,item.url)">
  76. <view class="swiper-item flex justify-center flex-wrap align-center"
  77. style="width: 200rpx;height: 240rpx;background: linear-gradient(0deg, rgba(252, 210, 2, 0.8) 0%, rgba(252, 210, 2, 1) 100%);border-radius: 28rpx;"
  78. :style="currents==index?'height:260rpx;border-radius: 28rpx;':'margin-top:14rpx;'">
  79. <view class="flex justify-center align-center"
  80. :style="currents==index?'height:200rpx':''"
  81. style="width: 190rpx;height: 180rpx;border-radius: 28rpx;margin-top: 5rpx;">
  82. <image :src="item.imageUrl"
  83. style="width: 95%;height: 95%;border-radius: 20rpx;" mode="aspectFill">
  84. </image>
  85. </view>
  86. <view class=""
  87. style="width: 100%;text-align: center;font-size: 32rpx;color: white;font-weight: bold;padding-bottom: 10rpx;">
  88. {{item.name}}
  89. </view>
  90. </view>
  91. </swiper-item>
  92. </swiper>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 推荐商家 -->
  98. <view class="jxShop flex justify-center" v-if="jxlist.length>0&&XCXIsSelect!='否'">
  99. <view class="jxShop-box flex justify-center">
  100. <view class="jxShop-box-c">
  101. <view class="jxShop-box-c-title flex justify-between align-center">
  102. <view class="jxShop-box-c-title-l">
  103. 推荐商家
  104. </view>
  105. <view class="jxShop-box-c-title-r flex align-center" @click="gotoList()">
  106. 更多
  107. <u-icon name="arrow-right" color="#1E1F31" size="28"></u-icon>
  108. </view>
  109. </view>
  110. <view class="jxShop-box-c-list flex justify-between">
  111. <view class="jxShop-box-c-list-item"
  112. @click="goShopDet(item.shopId,item,item.shopActivityList)"
  113. v-for="(item,index) in jxlist" :key="index">
  114. <image :src="item.shopCover" mode="aspectFill"></image>
  115. <view class="jxShop-box-c-list-item-name">
  116. {{item.shopName}}
  117. </view>
  118. </view>
  119. <view class="jxShop-box-c-list-item" style="height: 0;">
  120. </view>
  121. <view class="jxShop-box-c-list-item" style="height: 0;">
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="flex justify-center"
  128. style="position: relative;background-color: #ffffff;padding-top: 20rpx;padding-bottom: 20rpx;">
  129. <view style="width: 686rpx;" class="flex justify-between align-center bg-white">
  130. <view :class="current==1?'select':''" @click="confirm(1)">综合排序</view>
  131. <view :class="current==3?'select':''" @click="confirm(3)">距离优先</view>
  132. <view :class="current==4?'select':''" @click="confirm(4)">销量优先</view>
  133. <view class="flex" @click="isShow = !isShow">
  134. <view class="flex align-center" style="margin: 0 auto;">
  135. <view :class="isShow?'select':''">筛选</view>
  136. <u-icon v-if="!isShow" name="arrow-down" size="28"></u-icon>
  137. <u-icon v-if="isShow" name="arrow-up" color="#FCD202" size="28"></u-icon>
  138. </view>
  139. </view>
  140. </view>
  141. <view v-if="isShow"
  142. style="position: absolute;top: 50rpx;width: 100%;z-index: 10;background: rgba(0,0,0,.5);height: 100vh;"
  143. @click="isShow =false">
  144. <view class="padding-lr bg-white">
  145. <view class="flex justify-between align-center padding-tb-sm u-border-bottom"
  146. v-for="(item,index) in options4" :key='index' @click.stop="getSelect(item)">
  147. <view class="text-df" :class="item.select?'select':''">{{item.shopTypeName}}</view>
  148. <u-icon v-if="item.select" name="checkmark" color="#FCD202" size="28"></u-icon>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <!-- 活动筛选 -->
  154. <view class="hd flex justify-center" v-if="hdlist.length>0">
  155. <view class="hd-box">
  156. <scroll-view scroll-x="true" class="scroll-view_H">
  157. <view class="hd-box-item" :style="currenthd==index?'background-color:#fcd202;':''"
  158. @click="searchhd(index,item.id)" v-for="(item,index) in hdlist" :key="index">
  159. {{item.title}}
  160. </view>
  161. </scroll-view>
  162. </view>
  163. </view>
  164. <view class="padding-lr">
  165. <view class="margin-tb-sm flex justify-between bg-white padding-sm radius"
  166. v-for="(item,index) in shopList" :key='index'
  167. @click="goShopDet(item.shopId,item,item.shopActivityList)">
  168. <image :src="item.shopCover[0]" class="radius" style="width: 160rpx;height: 160rpx;"></image>
  169. <view class=" margin-left-sm" style="width: 450rpx;">
  170. <view class=" flex flex-direction justify-between">
  171. <view class="text-lg text-bold text-black">{{item.shopName}}</view>
  172. <view class="flex align-center margin-top-xs" style="width: 100%;">
  173. <u-icon name="star-fill" color="#FD6416" size="28"></u-icon>
  174. <text class="text-lg" style=""> {{item.shopScore?item.shopScore:0}}</text>
  175. <text
  176. class="text-gray flex-sub margin-left-xs">销量{{item.shopSales?item.shopSales:0}}</text>
  177. <text class="text-gray margin-left-xs">{{item.errandTime}}分钟</text>
  178. <text class="text-gray margin-left-xs">{{item.distance}}</text>
  179. </view>
  180. <view class="text-gray margin-top-xs flex justify-between">
  181. <view>起送 ¥{{item.minimumDelivery}} 配送 ¥{{item.errandMoney?item.errandMoney:0}}</view>
  182. <view style="color: #FCD202;">{{item.autoSendOrder==1?'商家配送':'平台配送'}}</view>
  183. </view>
  184. <view class="text-gray margin-top-xs" v-if="item.businessHours&&item.lockHours">
  185. 营业时间:{{item.businessHours}}-{{item.lockHours}}</view>
  186. <view class="flex margin-top-xs justify-between align-start" style="width: 100%;">
  187. <view class="flex flex-wrap align-center"
  188. style="width: 100%;height: 100%;overflow: hidden;">
  189. <!-- <view class="lable flex justify-center align-center" v-if="item.enableFullReductionFlag==1">
  190. 不参与配送费满减</view> -->
  191. <view class="lable flex justify-center align-center" v-if="item.enableFullReductionFlag==0&&item.exemptMinMoney">
  192. 满{{item.exemptMinMoney}}免配送费</view>
  193. <view v-for="(ite,ind) in item.shopActivityList" :key='ind' v-if="item.shopActivityList && ite.activityType!='1'">
  194. <view class="lable flex justify-center align-center" style="border-radius: 4rpx;background-color: #ffffff;color: red;box-sizing: border-box;">
  195. <text v-if="ite.activityType=='2'">时段</text>
  196. <text v-if="ite.activityType=='3'">满额</text>
  197. <text v-if="ite.activityType=='4'">全场</text>
  198. <text style="margin-left: 3px;">|</text>
  199. <text style="margin-left: 3px;">{{ite.activityName}}</text>
  200. </view>
  201. <!-- <view class="lable flex justify-center align-center"
  202. style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;"
  203. >{{ite.activityName}}
  204. </view> -->
  205. </view>
  206. <view class="lable flex justify-center align-center" v-for="(ite,ind) in item.shopLable" :key='ind'
  207. v-if="item.shopLable">
  208. {{ite}}
  209. </view>
  210. <view class="lable flex justify-center align-center" v-if="item.couponList" style="border-radius: 4rpx;border: 1rpx solid red;background-color: #ffffff;color: red;box-sizing: border-box;" v-for="(it,ide) in item.couponList" :key="ide">
  211. <text>优惠券</text>
  212. <text style="margin-left: 3px;">|</text>
  213. <text style="margin-left: 3px;">满{{it.minMoney}}减{{it.money}}</text>
  214. </view>
  215. </view>
  216. </view>
  217. </view>
  218. <view class="flex margin-top-xs">
  219. <view v-for="(ite,ind) in item.goodsList" :key='ind'
  220. @click.stop="goDet(ite.goodsId,item.shopId)" style="width: 33%;">
  221. <image :src="ite.goodsCover" style="width: 120rpx;height: 120rpx;" class="radius"
  222. mode="">
  223. </image>
  224. <view class="u-line-1 text-df text-bold margin-top-xs">{{ite.goodsName}}</view>
  225. <view class="text-bold margin-top-xs" style="color: #FD6416;"> <text
  226. class="text-sm">¥</text> {{ite.goodsMoney}}</view>
  227. </view>
  228. </view>
  229. </view>
  230. </view>
  231. </view>
  232. <!-- <empty v-if="!shopList.length" ></empty> -->
  233. <view class="page-box" v-if="!shopList.length">
  234. <view class="centre" v-if="XCXIsSelect == '是'">
  235. <image src="../../static/images/empty.png" mode=""></image>
  236. <view class="tips">暂无内容</view>
  237. </view>
  238. <view class="centre" v-else-if="XCXIsSelect == '否'">
  239. <image style="width: 345px;height: 140px;" src="https://mxys.chuanghai-tech.com/img/20240315/12fa3c96351f4f10abae1ba251d4c284.jpg" mode=""></image>
  240. </view>
  241. </view>
  242. <!-- 打样提示 -->
  243. <view v-if="hintShow" class="hintPopul" @click.stop="hintShow=false">
  244. <view class="content_">
  245. <image src="../../static/images/index/shop.png" mode="" style="width: 200rpx;height: 180rpx;">
  246. </image>
  247. <view class="text-xl text-bold">店铺打烊啦</view>
  248. <view class="hintText margin-top-sm text-gray">现在店铺已经打烊了,营业时间</view>
  249. <view class="margin-top-xs text-gray margin-bottom">{{shop.businessHours}}-{{shop.lockHours}}</view>
  250. <view class="skuBtn" @click="hintShow=false">知道了</view>
  251. </view>
  252. </view>
  253. <u-popup v-model="Authorization" mode="center" close-icon="close-circle" close-icon-pos="top-right"
  254. close-icon-color="#8f9298" close-icon-size="50">
  255. <view class="contentview">
  256. <view class="title">隐私保护指引</view>
  257. <view class="des" @click="openPrivacyContract">
  258. 在使用当前小程序服务之前,请仔细阅读<text
  259. style="color: #FF7F00;">{{privacyContractName}}</text>。如你同意{{privacyContractName}},请点击“同意”开始使用。
  260. </view>
  261. <view class="btns">
  262. <button class="item reject" @click="exitMiniProgram">拒绝</button>
  263. <button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization"
  264. @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  265. </view>
  266. </view>
  267. </u-popup>
  268. <!-- 新人红包 -->
  269. <view class="hongbao" v-if="waimaiHB == '是' &&HBShow">
  270. <view style="width: 62%;margin: 0 auto;position: relative;">
  271. <view @click="HBShow=false"
  272. style="position: absolute;right: -10rpx;top: -10rpx;z-index: 999;;font-size: 60rpx;font-weight: bold;">
  273. X
  274. </view>
  275. <!-- @click="takemoney()" ../../static/images/index/hb_bg.png-->
  276. <image :src="Tupian('/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240520171928.jpg')" class="hb_img"></image>
  277. <!-- <image src="../../static/images/index/hb_btn.png" class="hb_btn" @click="takemoney()"></image> -->
  278. </view>
  279. </view>
  280. <!-- 联系客服悬浮按钮区域 -->
  281. <view class="serviceBtn" @click="goChat">
  282. <img src="../../static/images/my/13.png" style="width: 60rpx;height: 60rpx;" mode="scaleToFill" />
  283. <view class="serviceBtn_text">
  284. 联系客服
  285. </view>
  286. </view>
  287. </view>
  288. </template>
  289. <script>
  290. import empty from '@/components/empty.vue'
  291. import {
  292. requestAndroidPermission,
  293. gotoAppPermissionSetting
  294. } from '@/components/permission.js'
  295. export default {
  296. components: {
  297. empty
  298. },
  299. data() {
  300. return {
  301. Authorization: false,
  302. privacyContractName: '',
  303. lookShow: false,
  304. currenthd: -1,
  305. hdlist: [],
  306. activityId: '',
  307. currents: 1,
  308. HBShow: false,
  309. isShow: false,
  310. hintShow: false,
  311. address: '暂无地址',
  312. city:'',
  313. bannerList: [{
  314. "id": 3,
  315. "createTime": "2021-12-24 17:52:27",
  316. "name": "banner3",
  317. "imageUrl": "https://diancan.xianmxkj.com/file/uploadPath/2021/12/24/0bfdbabcde9c62b42e77aecdb583033b.png",
  318. "state": 1,
  319. "classify": 1,
  320. "url": "",
  321. "sort": 3,
  322. "describess": "banner3"
  323. },
  324. {
  325. "id": 45,
  326. "createTime": "2021-12-24 17:52:27",
  327. "name": "banner",
  328. "imageUrl": "https://diancan.xianmxkj.com/file/uploadPath/2021/12/24/589d72b40a690147a48854a3b7f88953.png",
  329. "state": 1,
  330. "classify": 1,
  331. "url": "",
  332. "sort": 1,
  333. "describess": ""
  334. },
  335. ],
  336. gridData: [],
  337. page: 1,
  338. limit: 10,
  339. shopList: [],
  340. screen: '1',
  341. lng: '',
  342. lat: '',
  343. shopType: '1',
  344. shopTypeList: [{
  345. id: '0',
  346. shopTypeName: "全部"
  347. }],
  348. userId: '',
  349. src1: '../../static/images/index/xia.png',
  350. noticeList: {},
  351. show: false,
  352. typeShow: false,
  353. current: 1,
  354. sort: 1,
  355. fabuclassifyId: '',
  356. typeName: '全部',
  357. fabuclassifyName: '筛选',
  358. shopTypeId: '',
  359. value1: 0,
  360. value2: 0,
  361. value3: 0,
  362. value4: 0,
  363. options1: [{
  364. label: '综合排序',
  365. value: 1,
  366. }],
  367. options2: [{
  368. value: '3',
  369. label: "距离优先"
  370. }],
  371. options3: [{
  372. value: '4',
  373. label: "销量优先"
  374. }],
  375. options4: [{
  376. id: '',
  377. select: true,
  378. shopTypeName: "全部"
  379. }],
  380. defaultIndex: [0, 0, 0, 0],
  381. filterData: [
  382. [{
  383. label: '综合排序',
  384. value: '1',
  385. }],
  386. [{
  387. label: '距离优先',
  388. value: '3',
  389. }],
  390. [{
  391. label: '销量优先',
  392. value: '4',
  393. }],
  394. [{
  395. label: '不限性别',
  396. value: '0',
  397. },
  398. {
  399. label: '限男生',
  400. value: 1,
  401. },
  402. {
  403. label: '限女生',
  404. value: 2,
  405. }
  406. ],
  407. ],
  408. shopStatus: '',
  409. shop: {},
  410. title: '综合排序',
  411. title1: '距离优先',
  412. title2: '销量优先',
  413. title3: '筛选',
  414. XCXIsSelect: '否',
  415. arr: [],
  416. showModal: true,
  417. shopId: '',
  418. totalCount: 0,
  419. newUserFlagWm: 2,
  420. waimaiHB: '否',
  421. tuiguang: '',
  422. tuiguangImg: '',
  423. huodongList: [],
  424. jxlist: [],
  425. huoList:[],//商户参与的活动
  426. token:""
  427. }
  428. },
  429. onLoad(e) {
  430. let that = this
  431. that.token = that.$queue.getData("token")
  432. that.userId = uni.getStorageSync('userId') ? uni.getStorageSync('userId') : ''
  433. that.getZiZhi();
  434. that.getBannerList()
  435. that.getGridList()
  436. that.getShopType()
  437. that.getNoticeList()
  438. // that.getHuoDongList() //活动列表
  439. that.getHuoDList() //活动轮播
  440. that.gethdlist();
  441. uni.getLocation({
  442. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  443. highAccuracyExpireTime: 100,
  444. success: function(res) {
  445. that.lat = res.latitude;
  446. that.lng = res.longitude;
  447. that.defaultAddress()
  448. // that.getShopList()
  449. },
  450. fail(e) {
  451. uni.showModal({
  452. title: '温馨提示',
  453. content: '您的定位权限未开启,请开启后再来刷新操作吧!',
  454. showCancel: true,
  455. cancelText: '取消',
  456. confirmText: '确认',
  457. success: res => {
  458. if (res.confirm) {
  459. // #ifdef MP-WEIXIN
  460. uni.openSetting({ // 打开设置页
  461. success(rea) {
  462. console.log(rea.authSetting)
  463. }
  464. });
  465. // #endif
  466. // #ifdef APP-PLUS
  467. gotoAppPermissionSetting()
  468. // #endif
  469. }
  470. }
  471. });
  472. }
  473. });
  474. console.log(that.lat, that.lng, '经纬度')
  475. // #ifdef MP-WEIXIN
  476. if (e.scene) {
  477. const scene = decodeURIComponent(e.scene);
  478. let list = scene.split(',');
  479. let shopId;
  480. if (list.length > 0) {
  481. shopId = list[0]; //获取shopid
  482. }
  483. // uni.setStorageSync('shopId',e.shopId)
  484. console.log(e, '首页')
  485. console.log(scene, '商铺id')
  486. console.log(shopId, 'shopId')
  487. if (shopId) {
  488. that.shopId = shopId
  489. }
  490. if (!that.userId) {
  491. uni.navigateTo({
  492. url: '/pages/public/login'
  493. })
  494. return;
  495. }
  496. setTimeout(function() {
  497. uni.navigateTo({
  498. url: '/pages/index/shop/index?shopId=' + that.shopId
  499. })
  500. }, 100)
  501. } else if (e.orderId) {
  502. uni.setStorageSync('orderId', e.orderId)
  503. if (!that.userId) {
  504. uni.navigateTo({
  505. url: '/pages/public/login'
  506. })
  507. return;
  508. }
  509. setTimeout(function() {
  510. uni.navigateTo({
  511. url: '/pages/index/shop/goodsList?shopId=' + e.shopId
  512. })
  513. }, 100)
  514. }
  515. try {
  516. wx.getPrivacySetting({
  517. success: res => {
  518. console.log("是否需要授权:", res.needAuthorization, "隐私协议的名称为:", res.privacyContractName)
  519. if (res.needAuthorization) {
  520. that.privacyContractName = res.privacyContractName;
  521. // this.$refs.popusAuthorization.open();
  522. that.Authorization = true;
  523. }
  524. },
  525. fail: () => {},
  526. complete: () => {},
  527. })
  528. } catch (e) {
  529. //TODO handle the exception
  530. }
  531. // #endif
  532. },
  533. onShow() {
  534. let that = this
  535. that.token = that.$queue.getData('token')
  536. that.$Request.get('/app/common/type/264').then(res => {
  537. if (res.code == 0) {
  538. // #ifdef MP-WEIXIN
  539. that.XCXIsSelect = res.data.value;
  540. that.$queue.setData('XCXIsSelect', res.data.value);
  541. that.$queue.setData('shangxianSelect', res.data.value);
  542. // #endif
  543. // #ifndef MP-WEIXIN
  544. that.$queue.setData('XCXIsSelect', '是');
  545. that.$queue.setData('shangxianSelect', '是');
  546. that.XCXIsSelect = '是'
  547. // #endif
  548. }
  549. });
  550. that.getHuoDList() //活动轮播
  551. that.gethdlist();
  552. uni.getLocation({
  553. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  554. success: function(res) {
  555. console.log(res)
  556. that.lat = res.latitude;
  557. that.lng = res.longitude;
  558. that.defaultAddress()
  559. }
  560. });
  561. that.userId = uni.getStorageSync('userId') ? uni.getStorageSync('userId') : ''
  562. that.lng = uni.getStorageSync('lng') ? uni.getStorageSync('lng') : that.lng
  563. that.lat = uni.getStorageSync('lat') ? uni.getStorageSync('lat') : that.lat
  564. console.log(that.userId, '我的id')
  565. // if (this.lng && this.lat) {
  566. // that.defaultAddress()
  567. // that.getjxShop(); //精选商家
  568. // }
  569. if (that.userId) {
  570. that.getUserInfo()
  571. that.$Request.getT('/app/common/type/266').then(res => { //订单取消通知
  572. // console.log(res, 963)
  573. if (res.code == 0) {
  574. if (res.data && res.data.value) {
  575. that.arr.push(res.data.value)
  576. }
  577. }
  578. })
  579. that.$Request.getT('/app/common/type/269').then(res => { //订单状态通知
  580. // console.log(res, 966)
  581. if (res.code == 0) {
  582. if (res.data && res.data.value) {
  583. that.arr.push(res.data.value)
  584. }
  585. }
  586. })
  587. // that.$Request.getT('/app/common/type/440').then(res => { //订单状态通知
  588. // // console.log(res, 999)
  589. // if (res.code == 0) {
  590. // if (res.data && res.data.value) {
  591. // that.arr.push(res.data.value)
  592. // }
  593. // }
  594. // })
  595. // that.$Request.getT('/app/common/type/441').then(res => { //订单状态通知
  596. // // console.log(res, 999)
  597. // if (res.code == 0) {
  598. // if (res.data && res.data.value) {
  599. // that.arr.push(res.data.value)
  600. // }
  601. // }
  602. // })
  603. // #ifdef MP-WEIXIN
  604. if (that.showModal) {
  605. that.openMsg()
  606. }
  607. // #endif
  608. }
  609. // this.getShopList()
  610. },
  611. onShareAppMessage(res) { //发送给朋友
  612. return {
  613. title: this.tuiguang,
  614. path: '/pages/index/index',
  615. imageUrl: this.tuiguangImg,
  616. }
  617. },
  618. onShareTimeline(res) { //分享到朋友圈
  619. return {
  620. title: this.tuiguang,
  621. path: '/pages/index/index',
  622. imageUrl: this.tuiguangImg,
  623. }
  624. },
  625. methods: {
  626. //测试付钱
  627. ceshi(){
  628. console.log('付钱')
  629. wx.requestPayment( {
  630. "appId": 'wx45ab46867002aa0b', //公众号ID,由商户传入
  631. "timeStamp": '1730281084', //时间戳,自1970年以来的秒数
  632. "nonceStr": '14cdaf9f6ab64c0ab4d2df3a63f2b484', //随机串
  633. "package": 'prepay_id=wx30173804948968a92217fddbd7942d0000',
  634. "signType": 'RSA', //微信签名方式:
  635. "paySign": 'QFMu/l1/WIM9QTXaalpiHSwKr6MpeNt6ixpWb/qaT2u0Dw344kknTQRWSs86T+aqSSnBuVyL+mjEchC/GkNwG489omH03fWtVWM3jEtgpzS4oEQF7F+QehyxKR/Lw11OBvQont+xmuhI7DwSVn5OKB5yEfxG57LdcFBb2x6+FGlLFvSEB0p/XqJh8aW+80tvaz1lhX677AyxU5VwP1aBIB5MivqvBWypbyfKR30qA7oM8wOq6O4baYQtXrq0z0kokhNk0aZxHTYuqqNXftcyyBGyyM6hl0LHXvlxhrbS8N/GitwgSX3KJ3Jate+V5UVNv0+vY1NNxVOzDMhNirWNMg==' //微信签名
  636. },
  637. function(res) {
  638. console.log(res,'res')
  639. if (res.err_msg == "get_brand_wcpay_request:ok") {
  640. // 使用以上方式判断前端返回,微信团队郑重提示:
  641. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  642. }else{
  643. this.chapayIf()
  644. }
  645. });
  646. },
  647. goChat() {
  648. if (this.token) {
  649. uni.navigateTo({
  650. url: '/my/setting/chat'
  651. })
  652. } else {
  653. this.bindlogin()
  654. }
  655. },
  656. bindlogin() {
  657. uni.navigateTo({
  658. url: '/pages/public/login'
  659. })
  660. },
  661. // 打开隐私协议页面
  662. openPrivacyContract() {
  663. let that = this;
  664. wx.openPrivacyContract({
  665. fail: () => {
  666. that.$queue.showToast('遇到错误无法打开!');
  667. }
  668. })
  669. },
  670. // 拒绝隐私协议
  671. exitMiniProgram() {
  672. // 直接退出小程序
  673. wx.exitMiniProgram()
  674. },
  675. // 同意隐私协议
  676. handleAgreePrivacyAuthorization() {
  677. // this.$refs.popusAuthorization.close();
  678. this.Authorization = false;
  679. let that = this;
  680. uni.getLocation({
  681. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  682. highAccuracyExpireTime: 100,
  683. success: function(res) {
  684. console.log(res)
  685. that.lat = res.latitude;
  686. that.lng = res.longitude;
  687. that.defaultAddress()
  688. // that.getShopList()
  689. },
  690. fail(e) {
  691. uni.showModal({
  692. title: '温馨提示',
  693. content: '您的定位权限未开启,请开启后再来刷新操作吧!',
  694. showCancel: true,
  695. cancelText: '取消',
  696. confirmText: '确认',
  697. success: res => {
  698. if (res.confirm) {
  699. // #ifdef MP-WEIXIN
  700. uni.openSetting({ // 打开设置页
  701. success(rea) {
  702. console.log(rea.authSetting)
  703. }
  704. });
  705. // #endif
  706. // #ifdef APP-PLUS
  707. gotoAppPermissionSetting()
  708. // #endif
  709. }
  710. }
  711. });
  712. }
  713. });
  714. },
  715. selectShow() {
  716. this.lookShow = !this.lookShow
  717. },
  718. //筛选活动
  719. searchhd(index, activityId) {
  720. if (index == this.currenthd) {
  721. this.page=1
  722. this.currenthd = -1
  723. this.activityId = '';
  724. this.shopList =[]
  725. this.getShopList()
  726. } else {
  727. console.log('eww','ll')
  728. this.page=1
  729. this.currenthd = index;
  730. this.activityId = activityId;
  731. this.shopList =[]
  732. // this.getShopList()
  733. this.huoDListSh()
  734. }
  735. },
  736. //获取所有活动
  737. gethdlist() {
  738. // this.$Request.get("/app/activityManage/getActivityList").then(res => {
  739. let data={
  740. page:1,
  741. limit:10,
  742. }
  743. this.$Request.get('/app/activity/page').then(res => {
  744. if (res.code == 0) {
  745. var total=res.totalCount
  746. let data={
  747. page:1,
  748. limit:total,
  749. }
  750. this.$Request.get('/app/activity/page').then(res => {
  751. if (res.code == 0) {
  752. res.data.list.map((item, index) => {
  753. if (item.id == 14) {
  754. res.data.list.splice(index, 1)
  755. }
  756. })
  757. this.hdlist = res.data.list
  758. }
  759. });
  760. }
  761. });
  762. },
  763. // 获取精选商家
  764. getjxShop() {
  765. let data = {
  766. activityId: 14,
  767. page: 1,
  768. limit: 4,
  769. lat: this.lat,
  770. lng: this.lng,
  771. }
  772. this.$Request.get("/app/activityManage/getShoActivityShopList", data).then(res => {
  773. if (res.code == 0) {
  774. this.jxlist = res.data.records
  775. }
  776. });
  777. },
  778. gotoList() {
  779. uni.navigateTo({
  780. url: '/running/huodong/list?activityId=14'
  781. })
  782. },
  783. gotohuodong(name,id,imageUrl, url) {
  784. uni.navigateTo({
  785. url: url + '?activityTitle=' + name+'&activityId='+id+'&imageUrl='+imageUrl
  786. })
  787. },
  788. // 获取活动轮播图
  789. getHuoDList() {
  790. let data = {
  791. classify: 12
  792. }
  793. this.$Request.get("/app/banner/selectBannerList", data).then(res => {
  794. if (res.code == 0) {
  795. let arr = []
  796. arr = res.data
  797. arr.map((item, index) => {
  798. if (item.name == '推荐商家') {
  799. arr.splice(index, 1)
  800. }
  801. })
  802. this.huodongList = arr
  803. }
  804. });
  805. },
  806. swiperChange(e) {
  807. if (this.huodongList.length - 1 == e.detail.current) {
  808. this.currents = 0
  809. } else {
  810. this.currents = e.detail.current + 1
  811. }
  812. // this.moneys = this.swiper[this.currents].mysteryBoxTypePrice
  813. // this.boxType = this.swiper[this.currents].mysteryBoxTypeId
  814. // this.getgoodsList(this.swiper[this.currents].mysteryBoxTypeId)
  815. },
  816. //活动列表
  817. getHuoDongList() {
  818. // huodongList
  819. //
  820. // this.$Request.getT('/app/activityManage/getActivityList').then(res => {
  821. let data={
  822. page:1,
  823. limit:10,
  824. }
  825. this.$Request.getT('/app/activity/page',data).then(res => {
  826. if (res.code === 0) {
  827. var total=res.totalCount
  828. let data={
  829. page:1,
  830. limit:total,
  831. }
  832. this.$Request.getT('/app/activity/page',data).then(res => {
  833. if (res.code === 0) {
  834. this.huodongList = res.data.list
  835. }
  836. });
  837. }
  838. });
  839. },
  840. // 分享文案和图片
  841. getZiZhi() {
  842. this.$Request.getT('/app/common/type/239').then(res => {
  843. if (res.code === 0) {
  844. this.tuiguang = res.data.value;
  845. }
  846. });
  847. this.$Request.getT('/app/common/type/238').then(res => {
  848. if (res.code === 0) {
  849. this.tuiguangImg = res.data.value;
  850. }
  851. });
  852. },
  853. // 红包
  854. takemoney() {
  855. this.$Request.getT('/app/userinfo/getNewUserRedPacketWm').then(res => {
  856. console.log(res.code)
  857. if (res.code == 0) {
  858. this.HBShow = false
  859. this.getUserInfo()
  860. setTimeout(function() {
  861. uni.navigateTo({
  862. url: '/my/coupon/index'
  863. })
  864. }, 100)
  865. }
  866. });
  867. },
  868. getSelect(e) {
  869. this.options4.forEach(res => {
  870. if (res.id == e.id) {
  871. res.select = true
  872. this.page = 1
  873. this.shopTypeId = e.id
  874. this.getShopList();
  875. this.isShow = false
  876. } else {
  877. res.select = false
  878. }
  879. })
  880. },
  881. // 获取用户信息
  882. getUserInfo() {
  883. this.$Request.getT('/app/user/selectUserMessage').then(res => {
  884. console.log(res)
  885. if (res.code == 0) {
  886. this.shopStatus = res.data.shopStatus
  887. this.newUserFlagWm = res.data.newUserFlagWm
  888. if (this.newUserFlagWm == 1) {
  889. this.waimaiHB = this.$queue.getData('waimaiHB');
  890. if (this.waimaiHB === '是') {
  891. this.HBShow = true
  892. }
  893. } else {
  894. this.HBShow = false
  895. }
  896. }
  897. });
  898. },
  899. // 获取公告
  900. getNoticeList() {
  901. let data = {
  902. page: 1,
  903. limit: 100
  904. }
  905. this.$Request.get("/app/common/type/432", data).then(res => {
  906. if (res.code == 0) {
  907. this.noticeList = res.data
  908. // console.log(this.noticeList,999);
  909. }
  910. });
  911. },
  912. confirm(e) {
  913. this.isShow = false
  914. this.page = 1
  915. this.current = e;
  916. this.getShopList();
  917. },
  918. // 获取轮播图
  919. getBannerList() {
  920. let data = {
  921. classify: 1
  922. }
  923. this.$Request.get("/app/banner/selectBannerList", data).then(res => {
  924. if (res.code == 0) {
  925. this.bannerList = res.data
  926. }
  927. });
  928. },
  929. // 获取轮播图
  930. getGridList() {
  931. let data = {
  932. classify: 4
  933. }
  934. this.$Request.get("/app/banner/selectBannerList", data).then(res => {
  935. if (res.code == 0) {
  936. this.gridData = res.data
  937. }
  938. });
  939. },
  940. // 商户类型
  941. getShopType() {
  942. this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
  943. if (res.code == 0) {
  944. // this.shopTypeList = [...this.shopTypeList ,...res.data]
  945. res.data.forEach(res => {
  946. res.select = false
  947. })
  948. this.options4 = [...this.options4, ...res.data]
  949. console.log(this.options4, '+++++++++++++++++++')
  950. }
  951. })
  952. },
  953. //活动下的商户
  954. huoDListSh(){
  955. let data = {
  956. page: this.page,
  957. limit: this.limit,
  958. screen: this.current,
  959. shopTypeId: this.shopTypeId,
  960. lng: this.lng,
  961. lat: this.lat,
  962. // activityId: this.activityId,
  963. city:this.city,
  964. }
  965. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  966. if (res.code == 0) {
  967. var totalCount=res.data.totalCount
  968. let data = {
  969. page: this.page,
  970. limit: totalCount,
  971. }
  972. console.log(data,this.activityId)
  973. this.$Request.getT(`/app/activity-shop/activity-shop-page/${this.activityId}`, data).then(res => {
  974. console.log(res,'hhhhhh2h')
  975. if (res.code == 0) {
  976. var huodongList=[]
  977. huodongList=res.data.list
  978. let data = {
  979. page: this.page,
  980. limit: totalCount,
  981. screen: this.current,
  982. shopTypeId: this.shopTypeId,
  983. lng: this.lng,
  984. lat: this.lat,
  985. // activityId: this.activityId,
  986. city:this.city,
  987. }
  988. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  989. if (res.code == 0) {
  990. this.totalCount = res.data.totalCount
  991. res.data.list.forEach(ret => {
  992. if (ret.distance > 1000) {
  993. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  994. } else {
  995. if (ret.distance == 0) {
  996. ret.distance = "0m";
  997. } else {
  998. ret.distance = Number(ret.distance).toFixed(1) + "m";
  999. }
  1000. }
  1001. ret.shopScore = ret.shopScore.toFixed(1)
  1002. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  1003. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  1004. '../../static/logo.png'
  1005. ret.errandTime = Math.round(ret.errandTime)
  1006. })
  1007. var shopList=[]
  1008. shopList=res.data.list
  1009. for (let i = 0; i < shopList.length; i++) {
  1010. let item1 = shopList[i];
  1011. // 内层循环遍历array2
  1012. for (let j = 0; j < huodongList.length; j++) {
  1013. let item2 = huodongList[j];
  1014. // 检查id是否相等
  1015. if (item1.shopId === item2.shopId) {
  1016. // 如果相等,将对象添加到matchedArray
  1017. this.shopList.push(item1);
  1018. // 如果只需要添加一次,则可以在这里退出内层循环
  1019. // break;
  1020. }
  1021. }
  1022. }
  1023. // for(var i=0;i<shopList.length;i++){
  1024. // let item1 = shopList[i];
  1025. // for(var j=0;j<huodongList.length;j++){
  1026. // let item2 = huodongList[j];
  1027. // console.log(shopList[i].shopId==huodongList[j].shopId,'oppoo')
  1028. // if(item1.shopId==item2.shopId){
  1029. // this.shopList.push(item1)
  1030. // console.log(this.shopList,'pp')
  1031. // // return一次就退出
  1032. // }else{
  1033. // this.shopList =[]
  1034. // }
  1035. // }
  1036. // }
  1037. }
  1038. })
  1039. }
  1040. })
  1041. }
  1042. uni.stopPullDownRefresh();
  1043. uni.hideLoading()
  1044. })
  1045. },
  1046. // 商户列表
  1047. getShopList() {
  1048. console.log(this.city,'city')
  1049. uni.setStorageSync('lng', this.lng);
  1050. uni.setStorageSync('lat', this.lat);
  1051. let data = {
  1052. page: this.page,
  1053. limit: this.limit,
  1054. screen: this.current,
  1055. shopTypeId: this.shopTypeId,
  1056. lng: this.lng,
  1057. lat: this.lat,
  1058. // activityId: this.activityId,
  1059. city:this.city,
  1060. }
  1061. console.log(data,'jjj')
  1062. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  1063. console.log(res,'hhhhhh6')
  1064. if (res.code == 0) {
  1065. this.totalCount = res.data.totalCount
  1066. res.data.list.forEach(ret => {
  1067. if (ret.distance > 1000) {
  1068. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  1069. } else {
  1070. if (ret.distance == 0) {
  1071. ret.distance = "0m";
  1072. } else {
  1073. ret.distance = Number(ret.distance).toFixed(1) + "m";
  1074. }
  1075. }
  1076. ret.shopScore = ret.shopScore.toFixed(2)
  1077. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  1078. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  1079. '../../static/logo.png'
  1080. ret.errandTime = Math.round(ret.errandTime)
  1081. })
  1082. if (this.page == 1) {
  1083. this.shopList = res.data.list
  1084. } else {
  1085. this.shopList = [...this.shopList, ...res.data.list]
  1086. }
  1087. console.log(this.shopList)
  1088. }
  1089. uni.stopPullDownRefresh();
  1090. uni.hideLoading()
  1091. })
  1092. },
  1093. goNav(url) {
  1094. console.log(url)
  1095. if (this.userId) {
  1096. if (uni.getStorageSync('sendMsg')) {
  1097. console.log('授权+1')
  1098. wx.requestSubscribeMessage({
  1099. tmplIds: this.arr,
  1100. success(re) {
  1101. console.log(JSON.stringify(re), 111111111111)
  1102. var datas = JSON.stringify(re);
  1103. if (datas.indexOf("accept") != -1) {
  1104. // console.log(re)
  1105. }
  1106. },
  1107. fail: (res) => {
  1108. // console.log(res)
  1109. }
  1110. })
  1111. }
  1112. uni.navigateTo({
  1113. url
  1114. })
  1115. } else {
  1116. uni.navigateTo({
  1117. url: '/pages/public/login'
  1118. })
  1119. }
  1120. },
  1121. goShopDet(url, e,shuzu) {
  1122. if (uni.getStorageSync('sendMsg')) {
  1123. console.log('授权+1')
  1124. wx.requestSubscribeMessage({
  1125. tmplIds: this.arr,
  1126. success(re) {
  1127. console.log(JSON.stringify(re), 111111111111)
  1128. var datas = JSON.stringify(re);
  1129. if (datas.indexOf("accept") != -1) {
  1130. // console.log(re)
  1131. }
  1132. },
  1133. fail: (res) => {
  1134. // console.log(res)
  1135. }
  1136. })
  1137. }
  1138. this.shop = e
  1139. // console.log(e, '当前店铺')
  1140. let myDate = new Date();
  1141. let hours = myDate.getHours();
  1142. let minute = myDate.getMinutes();
  1143. let openTime = this.shop.businessHours.split(':')[0] //开始小时
  1144. let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
  1145. let closeTime = this.shop.lockHours.split(':')[0] //结束小时
  1146. let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
  1147. console.log(hours)
  1148. console.log(minute)
  1149. console.log(openTime)
  1150. console.log(openTime1)
  1151. console.log(closeTime)
  1152. console.log(closeTime1)
  1153. console.log(minute >= closeTime1)
  1154. if (hours < openTime) {
  1155. this.hintShow = true
  1156. return
  1157. } else if (hours == openTime && minute < openTime1) {
  1158. this.hintShow = true
  1159. return
  1160. } else if (hours > closeTime) {
  1161. this.hintShow = true
  1162. return
  1163. } else if (hours == closeTime && minute >= closeTime1) {
  1164. this.hintShow = true
  1165. return
  1166. }
  1167. console.log(url)
  1168. let items = encodeURIComponent(JSON.stringify(shuzu));
  1169. if (this.userId) {
  1170. uni.navigateTo({
  1171. url:'/pages/index/shop/index?shopId='+url+'&huoListss='+items
  1172. })
  1173. } else {
  1174. uni.navigateTo({
  1175. url: '/pages/public/login'
  1176. })
  1177. }
  1178. },
  1179. defaultAddress() {
  1180. if (uni.getStorageSync('city')) {
  1181. this.address = uni.getStorageSync('city')
  1182. this.lng = uni.getStorageSync('lng')
  1183. this.lat = uni.getStorageSync('lat')
  1184. this.page = 1
  1185. this.getShopList()
  1186. return
  1187. }
  1188. let data = {
  1189. page: 1,
  1190. limit: 1000
  1191. }
  1192. this.$Request.get('/app/address/selectAddressList', data).then(res => {
  1193. if (res.code == 0 && res.data.list.length) {
  1194. this.address = res.data.list[0].addressDetail
  1195. this.city=res.data.list[0].city
  1196. this.lng = res.data.list[0].lng
  1197. this.lat = res.data.list[0].lat
  1198. res.data.list.forEach(res => {
  1199. if (res.addressDefault) {
  1200. this.address = res.addressDetail
  1201. this.city=res.city
  1202. this.lng = res.lng
  1203. this.lat = res.lat
  1204. }
  1205. })
  1206. console.log('选择的经纬度', this.lng, this.lat)
  1207. } else {
  1208. let data = {
  1209. lat: this.lat,
  1210. lng: this.lng
  1211. }
  1212. this.$Request.get("/app/address/selectCity", data).then(res => {
  1213. if (res.code == 0) {
  1214. this.address = res.data.city
  1215. // console.log(3333333333)
  1216. // this.getShopList()
  1217. }
  1218. });
  1219. }
  1220. this.page = 1
  1221. this.getShopList()
  1222. })
  1223. },
  1224. goAddress() {
  1225. let userId = this.$queue.getData('userId');
  1226. if (!userId) {
  1227. uni.navigateTo({
  1228. url: '/pages/public/login'
  1229. })
  1230. return
  1231. }
  1232. uni.navigateTo({
  1233. url: '/pages/index/selectCampus'
  1234. })
  1235. },
  1236. // 查看金刚区详情
  1237. goDetail(item) {
  1238. if (uni.getStorageSync('sendMsg')) {
  1239. console.log('授权+1',this.arr)
  1240. wx.requestSubscribeMessage({
  1241. tmplIds: this.arr,
  1242. success(re) {
  1243. console.log(JSON.stringify(re), 111111111111)
  1244. var datas = JSON.stringify(re);
  1245. if (datas.indexOf("accept") != -1) {
  1246. // console.log(re)
  1247. }
  1248. },
  1249. fail: (res) => {
  1250. // console.log(res)
  1251. }
  1252. })
  1253. }
  1254. let userId = this.$queue.getData('userId');
  1255. if (!userId) {
  1256. uni.navigateTo({
  1257. url: '/pages/public/login'
  1258. })
  1259. return
  1260. }
  1261. //如果是小程序跳转就是设置这个
  1262. if (item.describes) {
  1263. uni.navigateToMiniProgram({
  1264. appId: item.describes,
  1265. path: item.classifyUrl,
  1266. success: res => {
  1267. // 打开成功
  1268. console.log("打开成功", res);
  1269. },
  1270. fail: err => {
  1271. console.log(err);
  1272. }
  1273. })
  1274. return
  1275. }
  1276. uni.navigateTo({
  1277. url: item.url
  1278. });
  1279. },
  1280. // 开启订阅消息
  1281. openMsg() {
  1282. console.log('订阅消息')
  1283. var that = this
  1284. uni.getSetting({
  1285. withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
  1286. success(ret) {
  1287. console.log(ret.subscriptionsSetting, '------------------')
  1288. // if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
  1289. if (ret.subscriptionsSetting.itemSettings) {
  1290. uni.setStorageSync('sendMsg', true)
  1291. uni.openSetting({ // 打开设置页
  1292. success(rea) {
  1293. console.log(rea.authSetting)
  1294. }
  1295. });
  1296. } else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  1297. console.log(99999)
  1298. uni.setStorageSync('sendMsg', false)
  1299. uni.showModal({
  1300. title: '提示',
  1301. content: '为了更好的体验,请绑定消息推送',
  1302. confirmText: '确定',
  1303. cancelText: '取消',
  1304. success: function(res) {
  1305. if (res.confirm) {
  1306. console.log(that.arr)
  1307. wx.requestSubscribeMessage({
  1308. tmplIds: that.arr,
  1309. success(re) {
  1310. console.log(JSON.stringify(re),
  1311. '++++++++++++++')
  1312. var datas = JSON.stringify(re);
  1313. if (datas.indexOf("accept") != -1) {
  1314. console.log(re)
  1315. uni.setStorageSync('sendMsg', true)
  1316. }
  1317. },
  1318. fail: (res) => {
  1319. console.log(res)
  1320. }
  1321. })
  1322. uni.setStorageSync('sendMsg', true)
  1323. console.log('确认')
  1324. that.showModal = false
  1325. } else if (res.cancel) {
  1326. console.log('取消')
  1327. uni.setStorageSync('sendMsg', false)
  1328. that.showModal = true
  1329. }
  1330. }
  1331. })
  1332. }
  1333. }
  1334. })
  1335. },
  1336. // 跳转商品详情
  1337. goDet(goodsId, shopId) {
  1338. let userId = this.$queue.getData('userId');
  1339. if (!userId) {
  1340. uni.navigateTo({
  1341. url: '/pages/public/login'
  1342. })
  1343. return
  1344. }
  1345. uni.navigateTo({
  1346. url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
  1347. })
  1348. },
  1349. },
  1350. onReachBottom: function() {
  1351. console.log('当前长度',this.shopList.length,this.totalCount)
  1352. if (this.shopList.length < this.totalCount) {
  1353. if(this.activityId==''){
  1354. wx.showLoading({
  1355. title: '加载中...',
  1356. mask: true, // 是否显示透明蒙层,防止触摸穿透
  1357. })
  1358. this.page = this.page + 1;
  1359. this.getShopList()
  1360. }
  1361. } else {
  1362. uni.showToast({
  1363. title: '已经到底了',
  1364. icon: 'none'
  1365. })
  1366. }
  1367. },
  1368. onPullDownRefresh: function() {
  1369. if(this.activityId==''){
  1370. this.page = 1;
  1371. this.getShopList()
  1372. }
  1373. },
  1374. }
  1375. </script>
  1376. <style lang="scss" scoped>
  1377. .privacy {
  1378. position: fixed;
  1379. top: 0;
  1380. right: 0;
  1381. bottom: 0;
  1382. left: 0;
  1383. background: rgba(0, 0, 0, .5);
  1384. z-index: 9999999;
  1385. display: flex;
  1386. align-items: center;
  1387. justify-content: center;
  1388. }
  1389. .contentview {
  1390. width: 632rpx;
  1391. padding: 48rpx;
  1392. box-sizing: border-box;
  1393. background: #fff;
  1394. border-radius: 16rpx;
  1395. }
  1396. .contentview .title {
  1397. text-align: center;
  1398. color: #333;
  1399. font-weight: bold;
  1400. font-size: 32rpx;
  1401. }
  1402. .contentview .des {
  1403. font-size: 26rpx;
  1404. color: #666;
  1405. margin-top: 40rpx;
  1406. text-align: justify;
  1407. line-height: 1.6;
  1408. }
  1409. .contentview .des .link {
  1410. color: #07c160;
  1411. text-decoration: underline;
  1412. }
  1413. button::after {
  1414. border: none;
  1415. }
  1416. .btns {
  1417. margin-top: 48rpx;
  1418. display: flex;
  1419. }
  1420. .btns .item {
  1421. justify-content: space-between;
  1422. width: 244rpx;
  1423. height: 80rpx;
  1424. display: flex;
  1425. align-items: center;
  1426. justify-content: center;
  1427. border-radius: 16rpx;
  1428. box-sizing: border-box;
  1429. border: none;
  1430. }
  1431. .btns .reject {
  1432. background: #f4f4f5;
  1433. color: #909399;
  1434. }
  1435. .btns .agree {
  1436. background: #07c160;
  1437. color: #fff;
  1438. }
  1439. .hd {
  1440. width: 100%;
  1441. height: auto;
  1442. // margin-top: 20rpx;
  1443. background-color: #ffffff;
  1444. .hd-box {
  1445. width: 686rpx;
  1446. height: 100%;
  1447. // padding-top: 20rpx;
  1448. padding-bottom: 20rpx;
  1449. .scroll-view_H {
  1450. width: 100%;
  1451. white-space: nowrap;
  1452. }
  1453. .hd-box-item {
  1454. display: inline-block;
  1455. padding: 10rpx 20rpx 10rpx 20rpx;
  1456. background-color: #F7F5F6;
  1457. font-size: 24rpx;
  1458. border-radius: 8rpx;
  1459. margin-right: 10rpx;
  1460. }
  1461. }
  1462. }
  1463. .select {
  1464. color: #FCD202;
  1465. }
  1466. .jxShop {
  1467. width: 100%;
  1468. height: 320rpx;
  1469. background-color: #ffffff;
  1470. .jxShop-box {
  1471. margin-top: 20rpx;
  1472. width: 686rpx;
  1473. height: 300rpx;
  1474. // background-color: #F7F5F6;
  1475. // background: linear-gradient(rgba(252,210,2,0.4) 1%,#fffdf2 100%);
  1476. // background: linear-gradient(#ffee99 1%,#fffbe5 100%);
  1477. background: #fff8d3;
  1478. border-radius: 16rpx;
  1479. .jxShop-box-c {
  1480. width: 626rpx;
  1481. height: 100%;
  1482. }
  1483. .jxShop-box-c-title {
  1484. width: 100%;
  1485. margin-top: 20rpx;
  1486. }
  1487. .jxShop-box-c-title-l {
  1488. color: #1A1A1A;
  1489. font-size: 34rpx;
  1490. font-weight: 800;
  1491. }
  1492. .jxShop-box-c-title-r {
  1493. color: #1E1F31;
  1494. font-size: 26rpx;
  1495. font-weight: 500;
  1496. }
  1497. .jxShop-box-c-list {
  1498. width: 100%;
  1499. height: 190rpx;
  1500. margin-top: 20rpx;
  1501. }
  1502. .jxShop-box-c-list-item {
  1503. width: 149rpx;
  1504. height: 100%;
  1505. background: #ffffff;
  1506. border-radius: 8px;
  1507. image {
  1508. width: 100%;
  1509. height: 114rpx;
  1510. border-radius: 8rpx 8rpx 0 0;
  1511. }
  1512. .jxShop-box-c-list-item-name {
  1513. width: 149rpx;
  1514. text-align: center;
  1515. font-size: 28rpx;
  1516. color: #1A1A1A;
  1517. font-weight: bold;
  1518. margin-top: 10rpx;
  1519. overflow: hidden;
  1520. white-space: nowrap;
  1521. text-overflow: ellipsis;
  1522. padding-left: 10rpx;
  1523. padding-right: 10rpx;
  1524. }
  1525. }
  1526. }
  1527. }
  1528. .huodong {
  1529. width: 100%;
  1530. height: 380rpx;
  1531. // margin-top: 20rpx;
  1532. background-color: #ffffff;
  1533. .huodong-box {
  1534. margin-top: 20rpx;
  1535. width: 686rpx;
  1536. height: 360rpx;
  1537. // background-color: #D4FCE2;
  1538. background-color: #fff8d3;
  1539. border-radius: 24rpx;
  1540. .huodong-box-c {
  1541. width: 646rpx;
  1542. height: 100%;
  1543. }
  1544. .huodong-box-c-title {
  1545. margin-top: 20rpx;
  1546. }
  1547. .huodong-box-c-title-l {
  1548. // color: #34CD40;
  1549. color: rgba(252, 210, 2, 1);
  1550. font-size: 44rpx;
  1551. font-weight: 600;
  1552. image {
  1553. width: 276rpx;
  1554. height: 65rpx;
  1555. }
  1556. // font-style: italic;
  1557. }
  1558. .huodong-box-c-title-r {
  1559. // background: linear-gradient(114deg, rgba(252, 210, 2, 0.2) 0%, rgba(252, 210, 2, 0.5) 50%, rgba(252, 210, 2, 1) 100%);
  1560. background-color: #FFE3C7;
  1561. border-radius: 40rpx;
  1562. color: #FF8D1A;
  1563. font-size: 26rpx;
  1564. font-weight: 600;
  1565. padding: 10rpx 20rpx;
  1566. }
  1567. .huodong-box-c-list {
  1568. width: 100%;
  1569. height: 320rpx;
  1570. margin-top: 10rpx;
  1571. }
  1572. .huodong-box-c-list-l {
  1573. width: 190rpx;
  1574. height: 250rpx;
  1575. background: linear-gradient(0deg, #34CD41 0%, #48DB19 100%);
  1576. border-radius: 24rpx;
  1577. }
  1578. .huodong-box-c-list-l-t {
  1579. width: 180rpx;
  1580. height: 240rpx;
  1581. border-radius: 24rpx;
  1582. background-color: #ffffff;
  1583. margin-top: 5rpx;
  1584. }
  1585. .huodong-box-c-list-l-t>image {
  1586. width: 160rpx;
  1587. height: 170rpx;
  1588. margin-top: 10rpx;
  1589. border-radius: 24rpx;
  1590. }
  1591. .huodong-box-c-list-l-t-b {
  1592. width: 100%;
  1593. height: 56rpx;
  1594. background-color: #E0F7F1;
  1595. color: #36CF3D;
  1596. font-size: 30rpx;
  1597. border-radius: 24rpx;
  1598. }
  1599. .huodong-box-c-list-l-t-t {
  1600. width: 100%;
  1601. text-align: center;
  1602. font-size: 36rpx;
  1603. // font-weight: bold;
  1604. font-weight: 600;
  1605. color: #ffffff;
  1606. }
  1607. .huodong-box-c-list-c {
  1608. width: 220rpx;
  1609. height: 280rpx;
  1610. background: linear-gradient(0deg, #34CD41 0%, #48DB19 100%);
  1611. border-radius: 24rpx;
  1612. }
  1613. .huodong-box-c-list-c-t {
  1614. width: 211rpx;
  1615. height: 270rpx;
  1616. border-radius: 24rpx;
  1617. background-color: #ffffff;
  1618. margin-top: 5rpx;
  1619. }
  1620. .huodong-box-c-list-c-t>image {
  1621. width: 186rpx;
  1622. height: 190rpx;
  1623. margin-top: 10rpx;
  1624. border-radius: 24rpx;
  1625. }
  1626. .huodong-box-c-list-c-b {
  1627. width: 100%;
  1628. height: 70rpx;
  1629. background-color: #E0F7F1;
  1630. color: #36CF3D;
  1631. font-size: 30rpx;
  1632. border-radius: 24rpx;
  1633. }
  1634. .huodong-box-c-list-c-t-t {
  1635. width: 100%;
  1636. text-align: center;
  1637. font-size: 36rpx;
  1638. // font-weight: bold;
  1639. font-weight: 600;
  1640. color: #ffffff;
  1641. }
  1642. }
  1643. }
  1644. .search-btn {
  1645. width: 132rpx;
  1646. height: 80rpx;
  1647. font-size: 28rpx;
  1648. text-align: center;
  1649. line-height: 80rpx;
  1650. background: #FFAF5E;
  1651. border-radius: 36px;
  1652. }
  1653. .address {
  1654. width: 100%;
  1655. background-color: #FFAF5E;
  1656. display: flex;
  1657. align-items: center;
  1658. // #ifndef H5
  1659. position: fixed;
  1660. top: 0;
  1661. height: 180rpx;
  1662. // line-height: 260rpx;
  1663. padding: 80rpx 34rpx 0rpx;
  1664. // #endif
  1665. // #ifdef H5
  1666. height: 80rpx;
  1667. line-height: 80rpx;
  1668. padding: 0 34rpx;
  1669. // #endif
  1670. font-size: 32rpx;
  1671. z-index: 999;
  1672. .address_name {
  1673. max-width: 90%;
  1674. overflow: hidden;
  1675. text-overflow: ellipsis;
  1676. white-space: nowrap;
  1677. }
  1678. }
  1679. .lable {
  1680. border: 1rpx solid #FFE6D9;
  1681. height: 40rpx;
  1682. padding: 0 14rpx;
  1683. background: #FFE6D9;
  1684. border-radius: 4rpx;
  1685. font-weight: 500;
  1686. color: #FD6416;
  1687. font-size: 20rpx;
  1688. margin-right: 10rpx;
  1689. margin-bottom: 10rpx;
  1690. }
  1691. .tabs {
  1692. margin-bottom: 20rpx;
  1693. display: flex;
  1694. justify-content: space-between;
  1695. align-items: center;
  1696. }
  1697. .tabs_name {
  1698. flex: 1;
  1699. /* display: inline-block; */
  1700. text-align: center;
  1701. margin-bottom: 30rpx 0;
  1702. position: relative;
  1703. display: flex;
  1704. /* justify-content: space-between; */
  1705. align-items: center;
  1706. }
  1707. .tabs_name view {
  1708. margin: 0 auto;
  1709. display: flex;
  1710. align-items: center;
  1711. }
  1712. .tabs_2 {
  1713. /* width: 30%; */
  1714. }
  1715. .actives {
  1716. color: #007AFF;
  1717. }
  1718. .tabsicon {
  1719. position: absolute;
  1720. top: 0;
  1721. right: 22rpx;
  1722. width: 20rpx;
  1723. height: 40rpx;
  1724. z-index: 1;
  1725. }
  1726. .tabs_icon {
  1727. width: 12rpx;
  1728. height: 8rpx;
  1729. z-index: 1;
  1730. margin-left: 10rpx;
  1731. }
  1732. .icon1 {
  1733. /* position: absolute; */
  1734. /* top: 6rpx; */
  1735. }
  1736. .icon2 {
  1737. position: absolute;
  1738. bottom: 6rpx;
  1739. }
  1740. .page-box {
  1741. // position: relative;
  1742. // z-index: 0;
  1743. // top: 70px;
  1744. }
  1745. .centre {
  1746. margin: auto;
  1747. height: 400rpx;
  1748. text-align: center;
  1749. font-size: 32rpx;
  1750. }
  1751. .centre image {
  1752. width: 387rpx;
  1753. height: 341rpx;
  1754. margin: 40rpx auto 20rpx;
  1755. }
  1756. .centre .tips {
  1757. font-size: 32rpx;
  1758. color: #2F3044;
  1759. margin: 20rpx 0 40rpx;
  1760. font-weight: 700;
  1761. }
  1762. .hintPopul {
  1763. width: 100%;
  1764. height: 100%;
  1765. position: fixed;
  1766. top: 0;
  1767. background: rgba(0, 0, 0, .4);
  1768. z-index: 999;
  1769. }
  1770. .content_ {
  1771. position: absolute;
  1772. left: 0;
  1773. right: 0;
  1774. top: 0;
  1775. bottom: 0;
  1776. margin: auto;
  1777. text-align: center;
  1778. width: 500rpx;
  1779. height: 400rpx;
  1780. border-radius: 20rpx;
  1781. background-color: #fff;
  1782. padding-top: 120rpx;
  1783. }
  1784. .content_ image {
  1785. position: absolute;
  1786. top: -50rpx;
  1787. left: 0;
  1788. right: 0;
  1789. margin: auto;
  1790. }
  1791. .hintText {
  1792. font-size: 30rpx;
  1793. }
  1794. .skuBtn {
  1795. width: 460rpx;
  1796. height: 60rpx;
  1797. line-height: 60rpx;
  1798. text-align: center;
  1799. background: #FCD202;
  1800. font-size: 28rpx;
  1801. border: 2rpx solid #FCD202;
  1802. color: #333333;
  1803. border-radius: 50rpx;
  1804. font-weight: 700;
  1805. margin: auto;
  1806. }
  1807. .hongbao {
  1808. width: 100%;
  1809. /* height: 100px; */
  1810. /* background: #007AFF; */
  1811. position: fixed;
  1812. top: 34%;
  1813. /* bottom: 50%; */
  1814. left: 0rpx;
  1815. right: 0rpx;
  1816. /* display: none; */
  1817. }
  1818. .hb_img {
  1819. width: 100%;
  1820. height: 535rpx;
  1821. }
  1822. .hb_btn {
  1823. width: 70%;
  1824. height: 72rpx;
  1825. position: absolute;
  1826. top: 315rpx;
  1827. left: 80rpx;
  1828. }
  1829. .serviceBtn{
  1830. position: fixed;
  1831. right: 52rpx;
  1832. bottom: 50rpx;
  1833. display: flex;
  1834. flex-direction: column;
  1835. align-items: center;
  1836. justify-content: center;
  1837. width: 140rpx;
  1838. height: 140rpx;
  1839. border-radius: 50%;
  1840. color: #fff;
  1841. font-size: 20rpx;
  1842. background-color: #3E8EF7;
  1843. box-shadow: 0 0 7rpx #000;
  1844. .serviceBtn_text{
  1845. margin-top: 5rpx;
  1846. }
  1847. }
  1848. </style>