index.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995
  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,1)">
  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="https://mxys.chuanghai-tech.com/wmfile/20250618/9eeeec20031849fe8379536ffa0f28b3.png" @click="goNav('/my/integral/index')"
  49. style="width: 338rpx;height: 180rpx;" mode=""></image>
  50. <image src="https://mxys.chuanghai-tech.com/wmfile/20250618/ddbb2b42ec9749afab93863bc078614f.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;" mode="aspectFill"></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. 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.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. 'https://mxys.chuanghai-tech.com/wmfile/20250814/fff4dc5d02ea4af881db9685f2e1e61d.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,type) {
  1094. console.log(url)
  1095. if(url=='/my/integral/index' || url=='/my/task/index'){
  1096. uni.navigateTo({
  1097. url: '/pages/public/login'
  1098. })
  1099. return
  1100. }
  1101. // if (this.userId) {
  1102. if (uni.getStorageSync('sendMsg')) {
  1103. console.log('授权+1')
  1104. wx.requestSubscribeMessage({
  1105. tmplIds: this.arr,
  1106. success(re) {
  1107. console.log(JSON.stringify(re), 111111111111)
  1108. var datas = JSON.stringify(re);
  1109. if (datas.indexOf("accept") != -1) {
  1110. // console.log(re)
  1111. }
  1112. },
  1113. fail: (res) => {
  1114. // console.log(res)
  1115. }
  1116. })
  1117. }
  1118. if(type ==1&&url){
  1119. uni.navigateTo({
  1120. url:`/my/web/web?url=${url}`
  1121. })
  1122. }else{
  1123. uni.navigateTo({
  1124. url
  1125. })
  1126. }
  1127. // } else {
  1128. // uni.navigateTo({
  1129. // url: '/pages/public/login'
  1130. // })
  1131. // }
  1132. },
  1133. goShopDet(url, e,shuzu) {
  1134. if (uni.getStorageSync('sendMsg')) {
  1135. console.log('授权+1')
  1136. wx.requestSubscribeMessage({
  1137. tmplIds: this.arr,
  1138. success(re) {
  1139. console.log(JSON.stringify(re), 111111111111)
  1140. var datas = JSON.stringify(re);
  1141. if (datas.indexOf("accept") != -1) {
  1142. // console.log(re)
  1143. }
  1144. },
  1145. fail: (res) => {
  1146. // console.log(res)
  1147. }
  1148. })
  1149. }
  1150. this.shop = e
  1151. // console.log(e, '当前店铺')
  1152. let myDate = new Date();
  1153. let hours = myDate.getHours();
  1154. let minute = myDate.getMinutes();
  1155. let openTime = this.shop.businessHours.split(':')[0] //开始小时
  1156. let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
  1157. let closeTime = this.shop.lockHours.split(':')[0] //结束小时
  1158. let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
  1159. console.log(hours)
  1160. console.log(minute)
  1161. console.log(openTime)
  1162. console.log(openTime1)
  1163. console.log(closeTime)
  1164. console.log(closeTime1)
  1165. console.log(minute >= closeTime1)
  1166. if (hours < openTime) {
  1167. this.hintShow = true
  1168. return
  1169. } else if (hours == openTime && minute < openTime1) {
  1170. this.hintShow = true
  1171. return
  1172. } else if (hours > closeTime) {
  1173. this.hintShow = true
  1174. return
  1175. } else if (hours == closeTime && minute >= closeTime1) {
  1176. this.hintShow = true
  1177. return
  1178. }
  1179. console.log(url)
  1180. let items = encodeURIComponent(JSON.stringify(shuzu));
  1181. // if (this.userId) {
  1182. uni.navigateTo({
  1183. url:'/pages/index/shop/index?shopId='+url+'&huoListss='+items
  1184. })
  1185. // } else {
  1186. // uni.navigateTo({
  1187. // url: '/pages/public/login'
  1188. // })
  1189. // }
  1190. },
  1191. defaultAddress() {
  1192. if (uni.getStorageSync('city')) {
  1193. this.address = uni.getStorageSync('city')
  1194. this.lng = uni.getStorageSync('lng')
  1195. this.lat = uni.getStorageSync('lat')
  1196. this.page = 1
  1197. this.getShopList()
  1198. return
  1199. }
  1200. let data = {
  1201. page: 1,
  1202. limit: 1000
  1203. }
  1204. this.$Request.get('/app/address/selectAddressList', data).then(res => {
  1205. if (res.code == 0 && res.data.list.length) {
  1206. this.address = res.data.list[0].addressDetail
  1207. this.city=res.data.list[0].city
  1208. this.lng = res.data.list[0].lng
  1209. this.lat = res.data.list[0].lat
  1210. res.data.list.forEach(res => {
  1211. if (res.addressDefault) {
  1212. this.address = res.addressDetail
  1213. this.city=res.city
  1214. this.lng = res.lng
  1215. this.lat = res.lat
  1216. }
  1217. })
  1218. console.log('选择的经纬度', this.lng, this.lat)
  1219. } else {
  1220. let data = {
  1221. lat: this.lat,
  1222. lng: this.lng
  1223. }
  1224. this.$Request.get("/app/address/selectCity", data).then(res => {
  1225. if (res.code == 0) {
  1226. this.address = res.data.city
  1227. // console.log(3333333333)
  1228. // this.getShopList()
  1229. }
  1230. });
  1231. }
  1232. this.page = 1
  1233. this.getShopList()
  1234. })
  1235. },
  1236. goAddress() {
  1237. let userId = this.$queue.getData('userId');
  1238. // if (!userId) {
  1239. // uni.navigateTo({
  1240. // url: '/pages/public/login'
  1241. // })
  1242. // return
  1243. // }
  1244. uni.navigateTo({
  1245. url: '/pages/index/selectCampus'
  1246. })
  1247. },
  1248. // 查看金刚区详情
  1249. goDetail(item) {
  1250. console.log(item);
  1251. if (uni.getStorageSync('sendMsg')) {
  1252. console.log('授权+1',this.arr)
  1253. wx.requestSubscribeMessage({
  1254. tmplIds: this.arr,
  1255. success(re) {
  1256. console.log(JSON.stringify(re), 111111111111)
  1257. var datas = JSON.stringify(re);
  1258. if (datas.indexOf("accept") != -1) {
  1259. // console.log(re)
  1260. }
  1261. },
  1262. fail: (res) => {
  1263. // console.log(res)
  1264. }
  1265. })
  1266. }
  1267. let userId = this.$queue.getData('userId');
  1268. // if (!userId) {
  1269. // uni.navigateTo({
  1270. // url: '/pages/public/login'
  1271. // })
  1272. // return
  1273. // }
  1274. //如果是小程序跳转就是设置这个
  1275. if (item.describes) {
  1276. uni.navigateToMiniProgram({
  1277. appId: item.describes,
  1278. path: item.classifyUrl,
  1279. success: res => {
  1280. // 打开成功
  1281. console.log("打开成功", res);
  1282. },
  1283. fail: err => {
  1284. console.log(err);
  1285. }
  1286. })
  1287. return
  1288. }
  1289. if(item.url.indexOf('https:')){
  1290. uni.navigateTo({
  1291. url: item.url
  1292. });
  1293. }else{
  1294. uni.navigateTo({
  1295. url:`/my/web/web?url=${item.url}`
  1296. })
  1297. }
  1298. },
  1299. // 开启订阅消息
  1300. openMsg() {
  1301. console.log('订阅消息')
  1302. var that = this
  1303. uni.getSetting({
  1304. withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
  1305. success(ret) {
  1306. console.log(ret.subscriptionsSetting, '------------------')
  1307. // if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
  1308. if (ret.subscriptionsSetting.itemSettings) {
  1309. uni.setStorageSync('sendMsg', true)
  1310. uni.openSetting({ // 打开设置页
  1311. success(rea) {
  1312. console.log(rea.authSetting)
  1313. }
  1314. });
  1315. } else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  1316. console.log(99999)
  1317. uni.setStorageSync('sendMsg', false)
  1318. uni.showModal({
  1319. title: '提示',
  1320. content: '为了更好的体验,请绑定消息推送',
  1321. confirmText: '确定',
  1322. cancelText: '取消',
  1323. success: function(res) {
  1324. if (res.confirm) {
  1325. console.log(that.arr)
  1326. wx.requestSubscribeMessage({
  1327. tmplIds: that.arr,
  1328. success(re) {
  1329. console.log(JSON.stringify(re),
  1330. '++++++++++++++')
  1331. var datas = JSON.stringify(re);
  1332. if (datas.indexOf("accept") != -1) {
  1333. console.log(re)
  1334. uni.setStorageSync('sendMsg', true)
  1335. }
  1336. },
  1337. fail: (res) => {
  1338. console.log(res)
  1339. }
  1340. })
  1341. uni.setStorageSync('sendMsg', true)
  1342. console.log('确认')
  1343. that.showModal = false
  1344. } else if (res.cancel) {
  1345. console.log('取消')
  1346. uni.setStorageSync('sendMsg', false)
  1347. that.showModal = true
  1348. }
  1349. }
  1350. })
  1351. }
  1352. }
  1353. })
  1354. },
  1355. // 跳转商品详情
  1356. goDet(goodsId, shopId) {
  1357. let userId = this.$queue.getData('userId');
  1358. // if (!userId) {
  1359. // uni.navigateTo({
  1360. // url: '/pages/public/login'
  1361. // })
  1362. // return
  1363. // }
  1364. uni.navigateTo({
  1365. url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
  1366. })
  1367. },
  1368. },
  1369. onReachBottom: function() {
  1370. console.log('当前长度',this.shopList.length,this.totalCount)
  1371. if (this.shopList.length < this.totalCount) {
  1372. if(this.activityId==''){
  1373. wx.showLoading({
  1374. title: '加载中...',
  1375. mask: true, // 是否显示透明蒙层,防止触摸穿透
  1376. })
  1377. this.page = this.page + 1;
  1378. this.getShopList()
  1379. }
  1380. } else {
  1381. uni.showToast({
  1382. title: '已经到底了',
  1383. icon: 'none'
  1384. })
  1385. }
  1386. },
  1387. onPullDownRefresh: function() {
  1388. if(this.activityId==''){
  1389. this.page = 1;
  1390. this.getShopList()
  1391. }
  1392. },
  1393. }
  1394. </script>
  1395. <style lang="scss" scoped>
  1396. .privacy {
  1397. position: fixed;
  1398. top: 0;
  1399. right: 0;
  1400. bottom: 0;
  1401. left: 0;
  1402. background: rgba(0, 0, 0, .5);
  1403. z-index: 9999999;
  1404. display: flex;
  1405. align-items: center;
  1406. justify-content: center;
  1407. }
  1408. .contentview {
  1409. width: 632rpx;
  1410. padding: 48rpx;
  1411. box-sizing: border-box;
  1412. background: #fff;
  1413. border-radius: 16rpx;
  1414. }
  1415. .contentview .title {
  1416. text-align: center;
  1417. color: #333;
  1418. font-weight: bold;
  1419. font-size: 32rpx;
  1420. }
  1421. .contentview .des {
  1422. font-size: 26rpx;
  1423. color: #666;
  1424. margin-top: 40rpx;
  1425. text-align: justify;
  1426. line-height: 1.6;
  1427. }
  1428. .contentview .des .link {
  1429. color: #07c160;
  1430. text-decoration: underline;
  1431. }
  1432. button::after {
  1433. border: none;
  1434. }
  1435. .btns {
  1436. margin-top: 48rpx;
  1437. display: flex;
  1438. }
  1439. .btns .item {
  1440. justify-content: space-between;
  1441. width: 244rpx;
  1442. height: 80rpx;
  1443. display: flex;
  1444. align-items: center;
  1445. justify-content: center;
  1446. border-radius: 16rpx;
  1447. box-sizing: border-box;
  1448. border: none;
  1449. }
  1450. .btns .reject {
  1451. background: #f4f4f5;
  1452. color: #909399;
  1453. }
  1454. .btns .agree {
  1455. background: #07c160;
  1456. color: #fff;
  1457. }
  1458. .hd {
  1459. width: 100%;
  1460. height: auto;
  1461. // margin-top: 20rpx;
  1462. background-color: #ffffff;
  1463. .hd-box {
  1464. width: 686rpx;
  1465. height: 100%;
  1466. // padding-top: 20rpx;
  1467. padding-bottom: 20rpx;
  1468. .scroll-view_H {
  1469. width: 100%;
  1470. white-space: nowrap;
  1471. }
  1472. .hd-box-item {
  1473. display: inline-block;
  1474. padding: 10rpx 20rpx 10rpx 20rpx;
  1475. background-color: #F7F5F6;
  1476. font-size: 24rpx;
  1477. border-radius: 8rpx;
  1478. margin-right: 10rpx;
  1479. }
  1480. }
  1481. }
  1482. .select {
  1483. color: #FCD202;
  1484. }
  1485. .jxShop {
  1486. width: 100%;
  1487. height: 320rpx;
  1488. background-color: #ffffff;
  1489. .jxShop-box {
  1490. margin-top: 20rpx;
  1491. width: 686rpx;
  1492. height: 300rpx;
  1493. // background-color: #F7F5F6;
  1494. // background: linear-gradient(rgba(252,210,2,0.4) 1%,#fffdf2 100%);
  1495. // background: linear-gradient(#ffee99 1%,#fffbe5 100%);
  1496. background: #fff8d3;
  1497. border-radius: 16rpx;
  1498. .jxShop-box-c {
  1499. width: 626rpx;
  1500. height: 100%;
  1501. }
  1502. .jxShop-box-c-title {
  1503. width: 100%;
  1504. margin-top: 20rpx;
  1505. }
  1506. .jxShop-box-c-title-l {
  1507. color: #1A1A1A;
  1508. font-size: 34rpx;
  1509. font-weight: 800;
  1510. }
  1511. .jxShop-box-c-title-r {
  1512. color: #1E1F31;
  1513. font-size: 26rpx;
  1514. font-weight: 500;
  1515. }
  1516. .jxShop-box-c-list {
  1517. width: 100%;
  1518. height: 190rpx;
  1519. margin-top: 20rpx;
  1520. }
  1521. .jxShop-box-c-list-item {
  1522. width: 149rpx;
  1523. height: 100%;
  1524. background: #ffffff;
  1525. border-radius: 8px;
  1526. image {
  1527. width: 100%;
  1528. height: 114rpx;
  1529. border-radius: 8rpx 8rpx 0 0;
  1530. }
  1531. .jxShop-box-c-list-item-name {
  1532. width: 149rpx;
  1533. text-align: center;
  1534. font-size: 28rpx;
  1535. color: #1A1A1A;
  1536. font-weight: bold;
  1537. margin-top: 10rpx;
  1538. overflow: hidden;
  1539. white-space: nowrap;
  1540. text-overflow: ellipsis;
  1541. padding-left: 10rpx;
  1542. padding-right: 10rpx;
  1543. }
  1544. }
  1545. }
  1546. }
  1547. .huodong {
  1548. width: 100%;
  1549. height: 380rpx;
  1550. // margin-top: 20rpx;
  1551. background-color: #ffffff;
  1552. .huodong-box {
  1553. margin-top: 20rpx;
  1554. width: 686rpx;
  1555. height: 360rpx;
  1556. // background-color: #D4FCE2;
  1557. background-color: #fff8d3;
  1558. border-radius: 24rpx;
  1559. .huodong-box-c {
  1560. width: 646rpx;
  1561. height: 100%;
  1562. }
  1563. .huodong-box-c-title {
  1564. margin-top: 20rpx;
  1565. }
  1566. .huodong-box-c-title-l {
  1567. // color: #34CD40;
  1568. color: rgba(252, 210, 2, 1);
  1569. font-size: 44rpx;
  1570. font-weight: 600;
  1571. image {
  1572. width: 276rpx;
  1573. height: 65rpx;
  1574. }
  1575. // font-style: italic;
  1576. }
  1577. .huodong-box-c-title-r {
  1578. // background: linear-gradient(114deg, rgba(252, 210, 2, 0.2) 0%, rgba(252, 210, 2, 0.5) 50%, rgba(252, 210, 2, 1) 100%);
  1579. background-color: #FFE3C7;
  1580. border-radius: 40rpx;
  1581. color: #FF8D1A;
  1582. font-size: 26rpx;
  1583. font-weight: 600;
  1584. padding: 10rpx 20rpx;
  1585. }
  1586. .huodong-box-c-list {
  1587. width: 100%;
  1588. height: 320rpx;
  1589. margin-top: 10rpx;
  1590. }
  1591. .huodong-box-c-list-l {
  1592. width: 190rpx;
  1593. height: 250rpx;
  1594. background: linear-gradient(0deg, #34CD41 0%, #48DB19 100%);
  1595. border-radius: 24rpx;
  1596. }
  1597. .huodong-box-c-list-l-t {
  1598. width: 180rpx;
  1599. height: 240rpx;
  1600. border-radius: 24rpx;
  1601. background-color: #ffffff;
  1602. margin-top: 5rpx;
  1603. }
  1604. .huodong-box-c-list-l-t>image {
  1605. width: 160rpx;
  1606. height: 170rpx;
  1607. margin-top: 10rpx;
  1608. border-radius: 24rpx;
  1609. }
  1610. .huodong-box-c-list-l-t-b {
  1611. width: 100%;
  1612. height: 56rpx;
  1613. background-color: #E0F7F1;
  1614. color: #36CF3D;
  1615. font-size: 30rpx;
  1616. border-radius: 24rpx;
  1617. }
  1618. .huodong-box-c-list-l-t-t {
  1619. width: 100%;
  1620. text-align: center;
  1621. font-size: 36rpx;
  1622. // font-weight: bold;
  1623. font-weight: 600;
  1624. color: #ffffff;
  1625. }
  1626. .huodong-box-c-list-c {
  1627. width: 220rpx;
  1628. height: 280rpx;
  1629. background: linear-gradient(0deg, #34CD41 0%, #48DB19 100%);
  1630. border-radius: 24rpx;
  1631. }
  1632. .huodong-box-c-list-c-t {
  1633. width: 211rpx;
  1634. height: 270rpx;
  1635. border-radius: 24rpx;
  1636. background-color: #ffffff;
  1637. margin-top: 5rpx;
  1638. }
  1639. .huodong-box-c-list-c-t>image {
  1640. width: 186rpx;
  1641. height: 190rpx;
  1642. margin-top: 10rpx;
  1643. border-radius: 24rpx;
  1644. }
  1645. .huodong-box-c-list-c-b {
  1646. width: 100%;
  1647. height: 70rpx;
  1648. background-color: #E0F7F1;
  1649. color: #36CF3D;
  1650. font-size: 30rpx;
  1651. border-radius: 24rpx;
  1652. }
  1653. .huodong-box-c-list-c-t-t {
  1654. width: 100%;
  1655. text-align: center;
  1656. font-size: 36rpx;
  1657. // font-weight: bold;
  1658. font-weight: 600;
  1659. color: #ffffff;
  1660. }
  1661. }
  1662. }
  1663. .search-btn {
  1664. width: 132rpx;
  1665. height: 80rpx;
  1666. font-size: 28rpx;
  1667. text-align: center;
  1668. line-height: 80rpx;
  1669. background: #FFAF5E;
  1670. border-radius: 36px;
  1671. }
  1672. .address {
  1673. width: 100%;
  1674. background-color: #FFAF5E;
  1675. display: flex;
  1676. align-items: center;
  1677. // #ifndef H5
  1678. position: fixed;
  1679. top: 0;
  1680. height: 180rpx;
  1681. // line-height: 260rpx;
  1682. padding: 80rpx 34rpx 0rpx;
  1683. // #endif
  1684. // #ifdef H5
  1685. height: 80rpx;
  1686. line-height: 80rpx;
  1687. padding: 0 34rpx;
  1688. // #endif
  1689. font-size: 32rpx;
  1690. z-index: 999;
  1691. .address_name {
  1692. max-width: 90%;
  1693. overflow: hidden;
  1694. text-overflow: ellipsis;
  1695. white-space: nowrap;
  1696. }
  1697. }
  1698. .lable {
  1699. border: 1rpx solid #FFE6D9;
  1700. height: 40rpx;
  1701. padding: 0 14rpx;
  1702. background: #FFE6D9;
  1703. border-radius: 4rpx;
  1704. font-weight: 500;
  1705. color: #FD6416;
  1706. font-size: 20rpx;
  1707. margin-right: 10rpx;
  1708. margin-bottom: 10rpx;
  1709. }
  1710. .tabs {
  1711. margin-bottom: 20rpx;
  1712. display: flex;
  1713. justify-content: space-between;
  1714. align-items: center;
  1715. }
  1716. .tabs_name {
  1717. flex: 1;
  1718. /* display: inline-block; */
  1719. text-align: center;
  1720. margin-bottom: 30rpx 0;
  1721. position: relative;
  1722. display: flex;
  1723. /* justify-content: space-between; */
  1724. align-items: center;
  1725. }
  1726. .tabs_name view {
  1727. margin: 0 auto;
  1728. display: flex;
  1729. align-items: center;
  1730. }
  1731. .tabs_2 {
  1732. /* width: 30%; */
  1733. }
  1734. .actives {
  1735. color: #007AFF;
  1736. }
  1737. .tabsicon {
  1738. position: absolute;
  1739. top: 0;
  1740. right: 22rpx;
  1741. width: 20rpx;
  1742. height: 40rpx;
  1743. z-index: 1;
  1744. }
  1745. .tabs_icon {
  1746. width: 12rpx;
  1747. height: 8rpx;
  1748. z-index: 1;
  1749. margin-left: 10rpx;
  1750. }
  1751. .icon1 {
  1752. /* position: absolute; */
  1753. /* top: 6rpx; */
  1754. }
  1755. .icon2 {
  1756. position: absolute;
  1757. bottom: 6rpx;
  1758. }
  1759. .page-box {
  1760. // position: relative;
  1761. // z-index: 0;
  1762. // top: 70px;
  1763. }
  1764. .centre {
  1765. margin: auto;
  1766. height: 400rpx;
  1767. text-align: center;
  1768. font-size: 32rpx;
  1769. }
  1770. .centre image {
  1771. width: 387rpx;
  1772. height: 341rpx;
  1773. margin: 40rpx auto 20rpx;
  1774. }
  1775. .centre .tips {
  1776. font-size: 32rpx;
  1777. color: #2F3044;
  1778. margin: 20rpx 0 40rpx;
  1779. font-weight: 700;
  1780. }
  1781. .hintPopul {
  1782. width: 100%;
  1783. height: 100%;
  1784. position: fixed;
  1785. top: 0;
  1786. background: rgba(0, 0, 0, .4);
  1787. z-index: 999;
  1788. }
  1789. .content_ {
  1790. position: absolute;
  1791. left: 0;
  1792. right: 0;
  1793. top: 0;
  1794. bottom: 0;
  1795. margin: auto;
  1796. text-align: center;
  1797. width: 500rpx;
  1798. height: 400rpx;
  1799. border-radius: 20rpx;
  1800. background-color: #fff;
  1801. padding-top: 120rpx;
  1802. }
  1803. .content_ image {
  1804. position: absolute;
  1805. top: -50rpx;
  1806. left: 0;
  1807. right: 0;
  1808. margin: auto;
  1809. }
  1810. .hintText {
  1811. font-size: 30rpx;
  1812. }
  1813. .skuBtn {
  1814. width: 460rpx;
  1815. height: 60rpx;
  1816. line-height: 60rpx;
  1817. text-align: center;
  1818. background: #FCD202;
  1819. font-size: 28rpx;
  1820. border: 2rpx solid #FCD202;
  1821. color: #333333;
  1822. border-radius: 50rpx;
  1823. font-weight: 700;
  1824. margin: auto;
  1825. }
  1826. .hongbao {
  1827. width: 100%;
  1828. /* height: 100px; */
  1829. /* background: #007AFF; */
  1830. position: fixed;
  1831. top: 34%;
  1832. /* bottom: 50%; */
  1833. left: 0rpx;
  1834. right: 0rpx;
  1835. /* display: none; */
  1836. }
  1837. .hb_img {
  1838. width: 100%;
  1839. height: 535rpx;
  1840. }
  1841. .hb_btn {
  1842. width: 70%;
  1843. height: 72rpx;
  1844. position: absolute;
  1845. top: 315rpx;
  1846. left: 80rpx;
  1847. }
  1848. .serviceBtn{
  1849. position: fixed;
  1850. right: 52rpx;
  1851. bottom: 50rpx;
  1852. display: flex;
  1853. flex-direction: column;
  1854. align-items: center;
  1855. justify-content: center;
  1856. width: 140rpx;
  1857. height: 140rpx;
  1858. border-radius: 50%;
  1859. color: #fff;
  1860. font-size: 20rpx;
  1861. background-color: #3E8EF7;
  1862. box-shadow: 0 0 7rpx #000;
  1863. .serviceBtn_text{
  1864. margin-top: 5rpx;
  1865. }
  1866. }
  1867. </style>