index.vue 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934
  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 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. if (res.code == 0) {
  573. if (res.data && res.data.value) {
  574. that.arr.push(res.data.value)
  575. }
  576. }
  577. })
  578. that.$Request.getT('/app/common/type/269').then(res => { //订单状态通知
  579. if (res.code == 0) {
  580. if (res.data && res.data.value) {
  581. that.arr.push(res.data.value)
  582. }
  583. }
  584. })
  585. // #ifdef MP-WEIXIN
  586. if (that.showModal) {
  587. that.openMsg()
  588. }
  589. // #endif
  590. }
  591. // this.getShopList()
  592. },
  593. onShareAppMessage(res) { //发送给朋友
  594. return {
  595. title: this.tuiguang,
  596. path: '/pages/index/index',
  597. imageUrl: this.tuiguangImg,
  598. }
  599. },
  600. onShareTimeline(res) { //分享到朋友圈
  601. return {
  602. title: this.tuiguang,
  603. path: '/pages/index/index',
  604. imageUrl: this.tuiguangImg,
  605. }
  606. },
  607. methods: {
  608. goChat() {
  609. if (this.token) {
  610. uni.navigateTo({
  611. url: '/my/setting/chat'
  612. })
  613. } else {
  614. this.bindlogin()
  615. }
  616. },
  617. bindlogin() {
  618. uni.navigateTo({
  619. url: '/pages/public/login'
  620. })
  621. },
  622. // 打开隐私协议页面
  623. openPrivacyContract() {
  624. let that = this;
  625. wx.openPrivacyContract({
  626. fail: () => {
  627. that.$queue.showToast('遇到错误无法打开!');
  628. }
  629. })
  630. },
  631. // 拒绝隐私协议
  632. exitMiniProgram() {
  633. // 直接退出小程序
  634. wx.exitMiniProgram()
  635. },
  636. // 同意隐私协议
  637. handleAgreePrivacyAuthorization() {
  638. // this.$refs.popusAuthorization.close();
  639. this.Authorization = false;
  640. let that = this;
  641. uni.getLocation({
  642. type: 'gcj02', //返回可以用于uni.openLocation的经纬度
  643. highAccuracyExpireTime: 100,
  644. success: function(res) {
  645. console.log(res)
  646. that.lat = res.latitude;
  647. that.lng = res.longitude;
  648. that.defaultAddress()
  649. // that.getShopList()
  650. },
  651. fail(e) {
  652. uni.showModal({
  653. title: '温馨提示',
  654. content: '您的定位权限未开启,请开启后再来刷新操作吧!',
  655. showCancel: true,
  656. cancelText: '取消',
  657. confirmText: '确认',
  658. success: res => {
  659. if (res.confirm) {
  660. // #ifdef MP-WEIXIN
  661. uni.openSetting({ // 打开设置页
  662. success(rea) {
  663. console.log(rea.authSetting)
  664. }
  665. });
  666. // #endif
  667. // #ifdef APP-PLUS
  668. gotoAppPermissionSetting()
  669. // #endif
  670. }
  671. }
  672. });
  673. }
  674. });
  675. },
  676. selectShow() {
  677. this.lookShow = !this.lookShow
  678. },
  679. //筛选活动
  680. searchhd(index, activityId) {
  681. if (index == this.currenthd) {
  682. this.page=1
  683. this.currenthd = -1
  684. this.activityId = '';
  685. this.shopList =[]
  686. this.getShopList()
  687. } else {
  688. console.log('eww','ll')
  689. this.page=1
  690. this.currenthd = index;
  691. this.activityId = activityId;
  692. this.shopList =[]
  693. // this.getShopList()
  694. this.huoDListSh()
  695. }
  696. },
  697. //获取所有活动
  698. gethdlist() {
  699. // this.$Request.get("/app/activityManage/getActivityList").then(res => {
  700. let data={
  701. page:1,
  702. limit:10,
  703. }
  704. this.$Request.get('/app/activity/page').then(res => {
  705. if (res.code == 0) {
  706. var total=res.totalCount
  707. let data={
  708. page:1,
  709. limit:total,
  710. }
  711. this.$Request.get('/app/activity/page').then(res => {
  712. if (res.code == 0) {
  713. res.data.list.map((item, index) => {
  714. if (item.id == 14) {
  715. res.data.list.splice(index, 1)
  716. }
  717. })
  718. this.hdlist = res.data.list
  719. }
  720. });
  721. }
  722. });
  723. },
  724. // 获取精选商家
  725. getjxShop() {
  726. let data = {
  727. activityId: 14,
  728. page: 1,
  729. limit: 4,
  730. lat: this.lat,
  731. lng: this.lng,
  732. }
  733. this.$Request.get("/app/activityManage/getShoActivityShopList", data).then(res => {
  734. if (res.code == 0) {
  735. this.jxlist = res.data.records
  736. }
  737. });
  738. },
  739. gotoList() {
  740. uni.navigateTo({
  741. url: '/running/huodong/list?activityId=14'
  742. })
  743. },
  744. gotohuodong(name,id,imageUrl, url) {
  745. uni.navigateTo({
  746. url: url + '?activityTitle=' + name+'&activityId='+id+'&imageUrl='+imageUrl
  747. })
  748. },
  749. // 获取活动轮播图
  750. getHuoDList() {
  751. let data = {
  752. classify: 12
  753. }
  754. this.$Request.get("/app/banner/selectBannerList", data).then(res => {
  755. if (res.code == 0) {
  756. let arr = []
  757. arr = res.data
  758. arr.map((item, index) => {
  759. if (item.name == '推荐商家') {
  760. arr.splice(index, 1)
  761. }
  762. })
  763. this.huodongList = arr
  764. }
  765. });
  766. },
  767. swiperChange(e) {
  768. if (this.huodongList.length - 1 == e.detail.current) {
  769. this.currents = 0
  770. } else {
  771. this.currents = e.detail.current + 1
  772. }
  773. // this.moneys = this.swiper[this.currents].mysteryBoxTypePrice
  774. // this.boxType = this.swiper[this.currents].mysteryBoxTypeId
  775. // this.getgoodsList(this.swiper[this.currents].mysteryBoxTypeId)
  776. },
  777. //活动列表
  778. getHuoDongList() {
  779. // huodongList
  780. //
  781. // this.$Request.getT('/app/activityManage/getActivityList').then(res => {
  782. let data={
  783. page:1,
  784. limit:10,
  785. }
  786. this.$Request.getT('/app/activity/page',data).then(res => {
  787. if (res.code === 0) {
  788. var total=res.totalCount
  789. let data={
  790. page:1,
  791. limit:total,
  792. }
  793. this.$Request.getT('/app/activity/page',data).then(res => {
  794. if (res.code === 0) {
  795. this.huodongList = res.data.list
  796. }
  797. });
  798. }
  799. });
  800. },
  801. // 分享文案和图片
  802. getZiZhi() {
  803. this.$Request.getT('/app/common/type/239').then(res => {
  804. if (res.code === 0) {
  805. this.tuiguang = res.data.value;
  806. }
  807. });
  808. this.$Request.getT('/app/common/type/238').then(res => {
  809. if (res.code === 0) {
  810. this.tuiguangImg = res.data.value;
  811. }
  812. });
  813. },
  814. // 红包
  815. takemoney() {
  816. this.$Request.getT('/app/userinfo/getNewUserRedPacketWm').then(res => {
  817. console.log(res.code)
  818. if (res.code == 0) {
  819. this.HBShow = false
  820. this.getUserInfo()
  821. setTimeout(function() {
  822. uni.navigateTo({
  823. url: '/my/coupon/index'
  824. })
  825. }, 100)
  826. }
  827. });
  828. },
  829. getSelect(e) {
  830. this.options4.forEach(res => {
  831. if (res.id == e.id) {
  832. res.select = true
  833. this.page = 1
  834. this.shopTypeId = e.id
  835. this.getShopList();
  836. this.isShow = false
  837. } else {
  838. res.select = false
  839. }
  840. })
  841. },
  842. // 获取用户信息
  843. getUserInfo() {
  844. this.$Request.getT('/app/user/selectUserMessage').then(res => {
  845. console.log(res)
  846. if (res.code == 0) {
  847. this.shopStatus = res.data.shopStatus
  848. this.newUserFlagWm = res.data.newUserFlagWm
  849. if (this.newUserFlagWm == 1) {
  850. this.waimaiHB = this.$queue.getData('waimaiHB');
  851. if (this.waimaiHB === '是') {
  852. this.HBShow = true
  853. }
  854. } else {
  855. this.HBShow = false
  856. }
  857. }
  858. });
  859. },
  860. // 获取公告
  861. getNoticeList() {
  862. let data = {
  863. page: 1,
  864. limit: 100
  865. }
  866. this.$Request.get("/app/common/type/432", data).then(res => {
  867. if (res.code == 0) {
  868. this.noticeList = res.data
  869. // console.log(this.noticeList,999);
  870. }
  871. });
  872. },
  873. confirm(e) {
  874. this.isShow = false
  875. this.page = 1
  876. this.current = e;
  877. this.getShopList();
  878. },
  879. // 获取轮播图
  880. getBannerList() {
  881. let data = {
  882. classify: 1
  883. }
  884. this.$Request.get("/app/banner/selectBannerList", data).then(res => {
  885. if (res.code == 0) {
  886. this.bannerList = res.data
  887. }
  888. });
  889. },
  890. // 获取轮播图
  891. getGridList() {
  892. let data = {
  893. classify: 4
  894. }
  895. this.$Request.get("/app/banner/selectBannerList", data).then(res => {
  896. if (res.code == 0) {
  897. this.gridData = res.data
  898. }
  899. });
  900. },
  901. // 商户类型
  902. getShopType() {
  903. this.$Request.getT('/app/shoptype/selectShopTypeList').then(res => {
  904. if (res.code == 0) {
  905. // this.shopTypeList = [...this.shopTypeList ,...res.data]
  906. res.data.forEach(res => {
  907. res.select = false
  908. })
  909. this.options4 = [...this.options4, ...res.data]
  910. console.log(this.options4, '+++++++++++++++++++')
  911. }
  912. })
  913. },
  914. //活动下的商户
  915. huoDListSh(){
  916. let data = {
  917. page: this.page,
  918. limit: this.limit,
  919. screen: this.current,
  920. shopTypeId: this.shopTypeId,
  921. lng: this.lng,
  922. lat: this.lat,
  923. // activityId: this.activityId,
  924. city:this.city,
  925. }
  926. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  927. if (res.code == 0) {
  928. var totalCount=res.data.totalCount
  929. let data = {
  930. page: this.page,
  931. limit: totalCount,
  932. }
  933. console.log(data,this.activityId)
  934. this.$Request.getT(`/app/activity-shop/activity-shop-page/${this.activityId}`, data).then(res => {
  935. console.log(res,'hhhhhh2h')
  936. if (res.code == 0) {
  937. var huodongList=[]
  938. huodongList=res.data.list
  939. let data = {
  940. page: this.page,
  941. limit: totalCount,
  942. screen: this.current,
  943. shopTypeId: this.shopTypeId,
  944. lng: this.lng,
  945. lat: this.lat,
  946. // activityId: this.activityId,
  947. city:this.city,
  948. }
  949. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  950. if (res.code == 0) {
  951. this.totalCount = res.data.totalCount
  952. res.data.list.forEach(ret => {
  953. if (ret.distance > 1000) {
  954. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  955. } else {
  956. if (ret.distance == 0) {
  957. ret.distance = "0m";
  958. } else {
  959. ret.distance = Number(ret.distance).toFixed(1) + "m";
  960. }
  961. }
  962. ret.shopScore = ret.shopScore.toFixed(1)
  963. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  964. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  965. '../../static/logo.png'
  966. ret.errandTime = Math.round(ret.errandTime)
  967. })
  968. var shopList=[]
  969. shopList=res.data.list
  970. for (let i = 0; i < shopList.length; i++) {
  971. let item1 = shopList[i];
  972. // 内层循环遍历array2
  973. for (let j = 0; j < huodongList.length; j++) {
  974. let item2 = huodongList[j];
  975. // 检查id是否相等
  976. if (item1.shopId === item2.shopId) {
  977. // 如果相等,将对象添加到matchedArray
  978. this.shopList.push(item1);
  979. // 如果只需要添加一次,则可以在这里退出内层循环
  980. // break;
  981. }
  982. }
  983. }
  984. // for(var i=0;i<shopList.length;i++){
  985. // let item1 = shopList[i];
  986. // for(var j=0;j<huodongList.length;j++){
  987. // let item2 = huodongList[j];
  988. // console.log(shopList[i].shopId==huodongList[j].shopId,'oppoo')
  989. // if(item1.shopId==item2.shopId){
  990. // this.shopList.push(item1)
  991. // console.log(this.shopList,'pp')
  992. // // return一次就退出
  993. // }else{
  994. // this.shopList =[]
  995. // }
  996. // }
  997. // }
  998. }
  999. })
  1000. }
  1001. })
  1002. }
  1003. uni.stopPullDownRefresh();
  1004. uni.hideLoading()
  1005. })
  1006. },
  1007. // 商户列表
  1008. getShopList() {
  1009. console.log(this.city,'city')
  1010. uni.setStorageSync('lng', this.lng);
  1011. uni.setStorageSync('lat', this.lat);
  1012. let data = {
  1013. page: this.page,
  1014. limit: this.limit,
  1015. screen: this.current,
  1016. shopTypeId: this.shopTypeId,
  1017. lng: this.lng,
  1018. lat: this.lat,
  1019. // activityId: this.activityId,
  1020. city:this.city,
  1021. }
  1022. console.log(data,'jjj')
  1023. this.$Request.getT('/app/goods/selectShop', data).then(res => {
  1024. console.log(res,'hhhhhh')
  1025. if (res.code == 0) {
  1026. this.totalCount = res.data.totalCount
  1027. res.data.list.forEach(ret => {
  1028. if (ret.distance > 1000) {
  1029. ret.distance = Number((ret.distance / 1000)).toFixed(2) + "km"
  1030. } else {
  1031. if (ret.distance == 0) {
  1032. ret.distance = "0m";
  1033. } else {
  1034. ret.distance = Number(ret.distance).toFixed(1) + "m";
  1035. }
  1036. }
  1037. ret.shopScore = ret.shopScore.toFixed(1)
  1038. ret.shopLable = ret.shopLable ? ret.shopLable.split(',') : ''
  1039. ret.shopCover = ret.shopCover ? ret.shopCover.split(',') :
  1040. '../../static/logo.png'
  1041. ret.errandTime = Math.round(ret.errandTime)
  1042. })
  1043. if (this.page == 1) {
  1044. this.shopList = res.data.list
  1045. } else {
  1046. this.shopList = [...this.shopList, ...res.data.list]
  1047. }
  1048. console.log(this.shopList)
  1049. }
  1050. uni.stopPullDownRefresh();
  1051. uni.hideLoading()
  1052. })
  1053. },
  1054. goNav(url) {
  1055. console.log(url)
  1056. if (this.userId) {
  1057. if (uni.getStorageSync('sendMsg')) {
  1058. console.log('授权+1')
  1059. wx.requestSubscribeMessage({
  1060. tmplIds: this.arr,
  1061. success(re) {
  1062. console.log(JSON.stringify(re), 111111111111)
  1063. var datas = JSON.stringify(re);
  1064. if (datas.indexOf("accept") != -1) {
  1065. // console.log(re)
  1066. }
  1067. },
  1068. fail: (res) => {
  1069. // console.log(res)
  1070. }
  1071. })
  1072. }
  1073. uni.navigateTo({
  1074. url
  1075. })
  1076. } else {
  1077. uni.navigateTo({
  1078. url: '/pages/public/login'
  1079. })
  1080. }
  1081. },
  1082. goShopDet(url, e,shuzu) {
  1083. if (uni.getStorageSync('sendMsg')) {
  1084. console.log('授权+1')
  1085. wx.requestSubscribeMessage({
  1086. tmplIds: this.arr,
  1087. success(re) {
  1088. console.log(JSON.stringify(re), 111111111111)
  1089. var datas = JSON.stringify(re);
  1090. if (datas.indexOf("accept") != -1) {
  1091. // console.log(re)
  1092. }
  1093. },
  1094. fail: (res) => {
  1095. // console.log(res)
  1096. }
  1097. })
  1098. }
  1099. this.shop = e
  1100. // console.log(e, '当前店铺')
  1101. let myDate = new Date();
  1102. let hours = myDate.getHours();
  1103. let minute = myDate.getMinutes();
  1104. let openTime = this.shop.businessHours.split(':')[0] //开始小时
  1105. let openTime1 = this.shop.businessHours.split(':')[1] //开始分钟
  1106. let closeTime = this.shop.lockHours.split(':')[0] //结束小时
  1107. let closeTime1 = this.shop.lockHours.split(':')[1] //结束分钟.
  1108. console.log(hours)
  1109. console.log(minute)
  1110. console.log(openTime)
  1111. console.log(openTime1)
  1112. console.log(closeTime)
  1113. console.log(closeTime1)
  1114. console.log(minute >= closeTime1)
  1115. if (hours < openTime) {
  1116. this.hintShow = true
  1117. return
  1118. } else if (hours == openTime && minute < openTime1) {
  1119. this.hintShow = true
  1120. return
  1121. } else if (hours > closeTime) {
  1122. this.hintShow = true
  1123. return
  1124. } else if (hours == closeTime && minute >= closeTime1) {
  1125. this.hintShow = true
  1126. return
  1127. }
  1128. console.log(url)
  1129. let items = encodeURIComponent(JSON.stringify(shuzu));
  1130. if (this.userId) {
  1131. uni.navigateTo({
  1132. url:'/pages/index/shop/index?shopId='+url+'&huoListss='+items
  1133. })
  1134. } else {
  1135. uni.navigateTo({
  1136. url: '/pages/public/login'
  1137. })
  1138. }
  1139. },
  1140. defaultAddress() {
  1141. if (uni.getStorageSync('city')) {
  1142. this.address = uni.getStorageSync('city')
  1143. this.lng = uni.getStorageSync('lng')
  1144. this.lat = uni.getStorageSync('lat')
  1145. this.page = 1
  1146. this.getShopList()
  1147. return
  1148. }
  1149. let data = {
  1150. page: 1,
  1151. limit: 1000
  1152. }
  1153. this.$Request.get('/app/address/selectAddressList', data).then(res => {
  1154. if (res.code == 0 && res.data.list.length) {
  1155. this.address = res.data.list[0].addressDetail
  1156. this.city=res.data.list[0].city
  1157. this.lng = res.data.list[0].lng
  1158. this.lat = res.data.list[0].lat
  1159. res.data.list.forEach(res => {
  1160. if (res.addressDefault) {
  1161. this.address = res.addressDetail
  1162. this.city=res.city
  1163. this.lng = res.lng
  1164. this.lat = res.lat
  1165. }
  1166. })
  1167. console.log('选择的经纬度', this.lng, this.lat)
  1168. } else {
  1169. let data = {
  1170. lat: this.lat,
  1171. lng: this.lng
  1172. }
  1173. this.$Request.get("/app/address/selectCity", data).then(res => {
  1174. if (res.code == 0) {
  1175. this.address = res.data.city
  1176. // console.log(3333333333)
  1177. // this.getShopList()
  1178. }
  1179. });
  1180. }
  1181. this.page = 1
  1182. this.getShopList()
  1183. })
  1184. },
  1185. goAddress() {
  1186. let userId = this.$queue.getData('userId');
  1187. if (!userId) {
  1188. uni.navigateTo({
  1189. url: '/pages/public/login'
  1190. })
  1191. return
  1192. }
  1193. uni.navigateTo({
  1194. url: '/pages/index/selectCampus'
  1195. })
  1196. },
  1197. // 查看金刚区详情
  1198. goDetail(item) {
  1199. if (uni.getStorageSync('sendMsg')) {
  1200. console.log('授权+1',this.arr)
  1201. wx.requestSubscribeMessage({
  1202. tmplIds: this.arr,
  1203. success(re) {
  1204. console.log(JSON.stringify(re), 111111111111)
  1205. var datas = JSON.stringify(re);
  1206. if (datas.indexOf("accept") != -1) {
  1207. // console.log(re)
  1208. }
  1209. },
  1210. fail: (res) => {
  1211. // console.log(res)
  1212. }
  1213. })
  1214. }
  1215. let userId = this.$queue.getData('userId');
  1216. if (!userId) {
  1217. uni.navigateTo({
  1218. url: '/pages/public/login'
  1219. })
  1220. return
  1221. }
  1222. //如果是小程序跳转就是设置这个
  1223. if (item.describes) {
  1224. uni.navigateToMiniProgram({
  1225. appId: item.describes,
  1226. path: item.classifyUrl,
  1227. success: res => {
  1228. // 打开成功
  1229. console.log("打开成功", res);
  1230. },
  1231. fail: err => {
  1232. console.log(err);
  1233. }
  1234. })
  1235. return
  1236. }
  1237. uni.navigateTo({
  1238. url: item.url
  1239. });
  1240. },
  1241. // 开启订阅消息
  1242. openMsg() {
  1243. console.log('订阅消息')
  1244. var that = this
  1245. uni.getSetting({
  1246. withSubscriptions: true, //是否获取用户订阅消息的订阅状态,默认false不返回
  1247. success(ret) {
  1248. console.log(ret.subscriptionsSetting, '------------------')
  1249. // if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
  1250. if (ret.subscriptionsSetting.itemSettings) {
  1251. uni.setStorageSync('sendMsg', true)
  1252. uni.openSetting({ // 打开设置页
  1253. success(rea) {
  1254. console.log(rea.authSetting)
  1255. }
  1256. });
  1257. } else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  1258. console.log(99999)
  1259. uni.setStorageSync('sendMsg', false)
  1260. uni.showModal({
  1261. title: '提示',
  1262. content: '为了更好的体验,请绑定消息推送',
  1263. confirmText: '确定',
  1264. cancelText: '取消',
  1265. success: function(res) {
  1266. if (res.confirm) {
  1267. console.log(that.arr)
  1268. wx.requestSubscribeMessage({
  1269. tmplIds: that.arr,
  1270. success(re) {
  1271. console.log(JSON.stringify(re),
  1272. '++++++++++++++')
  1273. var datas = JSON.stringify(re);
  1274. if (datas.indexOf("accept") != -1) {
  1275. console.log(re)
  1276. uni.setStorageSync('sendMsg', true)
  1277. }
  1278. },
  1279. fail: (res) => {
  1280. console.log(res)
  1281. }
  1282. })
  1283. uni.setStorageSync('sendMsg', true)
  1284. console.log('确认')
  1285. that.showModal = false
  1286. } else if (res.cancel) {
  1287. console.log('取消')
  1288. uni.setStorageSync('sendMsg', false)
  1289. that.showModal = true
  1290. }
  1291. }
  1292. })
  1293. }
  1294. }
  1295. })
  1296. },
  1297. // 跳转商品详情
  1298. goDet(goodsId, shopId) {
  1299. let userId = this.$queue.getData('userId');
  1300. if (!userId) {
  1301. uni.navigateTo({
  1302. url: '/pages/public/login'
  1303. })
  1304. return
  1305. }
  1306. uni.navigateTo({
  1307. url: '/pages/index/shop/goodsDet?goodsId=' + goodsId + '&shopId=' + shopId + '&orderType=2'
  1308. })
  1309. },
  1310. },
  1311. onReachBottom: function() {
  1312. console.log('当前长度',this.shopList.length,this.totalCount)
  1313. if (this.shopList.length < this.totalCount) {
  1314. if(this.activityId==''){
  1315. wx.showLoading({
  1316. title: '加载中...',
  1317. mask: true, // 是否显示透明蒙层,防止触摸穿透
  1318. })
  1319. this.page = this.page + 1;
  1320. this.getShopList()
  1321. }
  1322. } else {
  1323. uni.showToast({
  1324. title: '已经到底了',
  1325. icon: 'none'
  1326. })
  1327. }
  1328. },
  1329. onPullDownRefresh: function() {
  1330. if(this.activityId==''){
  1331. this.page = 1;
  1332. this.getShopList()
  1333. }
  1334. },
  1335. }
  1336. </script>
  1337. <style lang="scss" scoped>
  1338. .privacy {
  1339. position: fixed;
  1340. top: 0;
  1341. right: 0;
  1342. bottom: 0;
  1343. left: 0;
  1344. background: rgba(0, 0, 0, .5);
  1345. z-index: 9999999;
  1346. display: flex;
  1347. align-items: center;
  1348. justify-content: center;
  1349. }
  1350. .contentview {
  1351. width: 632rpx;
  1352. padding: 48rpx;
  1353. box-sizing: border-box;
  1354. background: #fff;
  1355. border-radius: 16rpx;
  1356. }
  1357. .contentview .title {
  1358. text-align: center;
  1359. color: #333;
  1360. font-weight: bold;
  1361. font-size: 32rpx;
  1362. }
  1363. .contentview .des {
  1364. font-size: 26rpx;
  1365. color: #666;
  1366. margin-top: 40rpx;
  1367. text-align: justify;
  1368. line-height: 1.6;
  1369. }
  1370. .contentview .des .link {
  1371. color: #07c160;
  1372. text-decoration: underline;
  1373. }
  1374. button::after {
  1375. border: none;
  1376. }
  1377. .btns {
  1378. margin-top: 48rpx;
  1379. display: flex;
  1380. }
  1381. .btns .item {
  1382. justify-content: space-between;
  1383. width: 244rpx;
  1384. height: 80rpx;
  1385. display: flex;
  1386. align-items: center;
  1387. justify-content: center;
  1388. border-radius: 16rpx;
  1389. box-sizing: border-box;
  1390. border: none;
  1391. }
  1392. .btns .reject {
  1393. background: #f4f4f5;
  1394. color: #909399;
  1395. }
  1396. .btns .agree {
  1397. background: #07c160;
  1398. color: #fff;
  1399. }
  1400. .hd {
  1401. width: 100%;
  1402. height: auto;
  1403. // margin-top: 20rpx;
  1404. background-color: #ffffff;
  1405. .hd-box {
  1406. width: 686rpx;
  1407. height: 100%;
  1408. // padding-top: 20rpx;
  1409. padding-bottom: 20rpx;
  1410. .scroll-view_H {
  1411. width: 100%;
  1412. white-space: nowrap;
  1413. }
  1414. .hd-box-item {
  1415. display: inline-block;
  1416. padding: 10rpx 20rpx 10rpx 20rpx;
  1417. background-color: #F7F5F6;
  1418. font-size: 24rpx;
  1419. border-radius: 8rpx;
  1420. margin-right: 10rpx;
  1421. }
  1422. }
  1423. }
  1424. .select {
  1425. color: #FCD202;
  1426. }
  1427. .jxShop {
  1428. width: 100%;
  1429. height: 320rpx;
  1430. background-color: #ffffff;
  1431. .jxShop-box {
  1432. margin-top: 20rpx;
  1433. width: 686rpx;
  1434. height: 300rpx;
  1435. // background-color: #F7F5F6;
  1436. // background: linear-gradient(rgba(252,210,2,0.4) 1%,#fffdf2 100%);
  1437. // background: linear-gradient(#ffee99 1%,#fffbe5 100%);
  1438. background: #fff8d3;
  1439. border-radius: 16rpx;
  1440. .jxShop-box-c {
  1441. width: 626rpx;
  1442. height: 100%;
  1443. }
  1444. .jxShop-box-c-title {
  1445. width: 100%;
  1446. margin-top: 20rpx;
  1447. }
  1448. .jxShop-box-c-title-l {
  1449. color: #1A1A1A;
  1450. font-size: 34rpx;
  1451. font-weight: 800;
  1452. }
  1453. .jxShop-box-c-title-r {
  1454. color: #1E1F31;
  1455. font-size: 26rpx;
  1456. font-weight: 500;
  1457. }
  1458. .jxShop-box-c-list {
  1459. width: 100%;
  1460. height: 190rpx;
  1461. margin-top: 20rpx;
  1462. }
  1463. .jxShop-box-c-list-item {
  1464. width: 149rpx;
  1465. height: 100%;
  1466. background: #ffffff;
  1467. border-radius: 8px;
  1468. image {
  1469. width: 100%;
  1470. height: 114rpx;
  1471. border-radius: 8rpx 8rpx 0 0;
  1472. }
  1473. .jxShop-box-c-list-item-name {
  1474. width: 149rpx;
  1475. text-align: center;
  1476. font-size: 28rpx;
  1477. color: #1A1A1A;
  1478. font-weight: bold;
  1479. margin-top: 10rpx;
  1480. overflow: hidden;
  1481. white-space: nowrap;
  1482. text-overflow: ellipsis;
  1483. padding-left: 10rpx;
  1484. padding-right: 10rpx;
  1485. }
  1486. }
  1487. }
  1488. }
  1489. .huodong {
  1490. width: 100%;
  1491. height: 380rpx;
  1492. // margin-top: 20rpx;
  1493. background-color: #ffffff;
  1494. .huodong-box {
  1495. margin-top: 20rpx;
  1496. width: 686rpx;
  1497. height: 360rpx;
  1498. // background-color: #D4FCE2;
  1499. background-color: #fff8d3;
  1500. border-radius: 24rpx;
  1501. .huodong-box-c {
  1502. width: 646rpx;
  1503. height: 100%;
  1504. }
  1505. .huodong-box-c-title {
  1506. margin-top: 20rpx;
  1507. }
  1508. .huodong-box-c-title-l {
  1509. // color: #34CD40;
  1510. color: rgba(252, 210, 2, 1);
  1511. font-size: 44rpx;
  1512. font-weight: 600;
  1513. image {
  1514. width: 276rpx;
  1515. height: 65rpx;
  1516. }
  1517. // font-style: italic;
  1518. }
  1519. .huodong-box-c-title-r {
  1520. // background: linear-gradient(114deg, rgba(252, 210, 2, 0.2) 0%, rgba(252, 210, 2, 0.5) 50%, rgba(252, 210, 2, 1) 100%);
  1521. background-color: #FFE3C7;
  1522. border-radius: 40rpx;
  1523. color: #FF8D1A;
  1524. font-size: 26rpx;
  1525. font-weight: 600;
  1526. padding: 10rpx 20rpx;
  1527. }
  1528. .huodong-box-c-list {
  1529. width: 100%;
  1530. height: 320rpx;
  1531. margin-top: 10rpx;
  1532. }
  1533. .huodong-box-c-list-l {
  1534. width: 190rpx;
  1535. height: 250rpx;
  1536. background: linear-gradient(0deg, #34CD41 0%, #48DB19 100%);
  1537. border-radius: 24rpx;
  1538. }
  1539. .huodong-box-c-list-l-t {
  1540. width: 180rpx;
  1541. height: 240rpx;
  1542. border-radius: 24rpx;
  1543. background-color: #ffffff;
  1544. margin-top: 5rpx;
  1545. }
  1546. .huodong-box-c-list-l-t>image {
  1547. width: 160rpx;
  1548. height: 170rpx;
  1549. margin-top: 10rpx;
  1550. border-radius: 24rpx;
  1551. }
  1552. .huodong-box-c-list-l-t-b {
  1553. width: 100%;
  1554. height: 56rpx;
  1555. background-color: #E0F7F1;
  1556. color: #36CF3D;
  1557. font-size: 30rpx;
  1558. border-radius: 24rpx;
  1559. }
  1560. .huodong-box-c-list-l-t-t {
  1561. width: 100%;
  1562. text-align: center;
  1563. font-size: 36rpx;
  1564. // font-weight: bold;
  1565. font-weight: 600;
  1566. color: #ffffff;
  1567. }
  1568. .huodong-box-c-list-c {
  1569. width: 220rpx;
  1570. height: 280rpx;
  1571. background: linear-gradient(0deg, #34CD41 0%, #48DB19 100%);
  1572. border-radius: 24rpx;
  1573. }
  1574. .huodong-box-c-list-c-t {
  1575. width: 211rpx;
  1576. height: 270rpx;
  1577. border-radius: 24rpx;
  1578. background-color: #ffffff;
  1579. margin-top: 5rpx;
  1580. }
  1581. .huodong-box-c-list-c-t>image {
  1582. width: 186rpx;
  1583. height: 190rpx;
  1584. margin-top: 10rpx;
  1585. border-radius: 24rpx;
  1586. }
  1587. .huodong-box-c-list-c-b {
  1588. width: 100%;
  1589. height: 70rpx;
  1590. background-color: #E0F7F1;
  1591. color: #36CF3D;
  1592. font-size: 30rpx;
  1593. border-radius: 24rpx;
  1594. }
  1595. .huodong-box-c-list-c-t-t {
  1596. width: 100%;
  1597. text-align: center;
  1598. font-size: 36rpx;
  1599. // font-weight: bold;
  1600. font-weight: 600;
  1601. color: #ffffff;
  1602. }
  1603. }
  1604. }
  1605. .search-btn {
  1606. width: 132rpx;
  1607. height: 80rpx;
  1608. font-size: 28rpx;
  1609. text-align: center;
  1610. line-height: 80rpx;
  1611. background: #FFAF5E;
  1612. border-radius: 36px;
  1613. }
  1614. .address {
  1615. width: 100%;
  1616. background-color: #FFAF5E;
  1617. display: flex;
  1618. align-items: center;
  1619. // #ifndef H5
  1620. position: fixed;
  1621. top: 0;
  1622. height: 180rpx;
  1623. // line-height: 260rpx;
  1624. padding: 80rpx 34rpx 0rpx;
  1625. // #endif
  1626. // #ifdef H5
  1627. height: 80rpx;
  1628. line-height: 80rpx;
  1629. padding: 0 34rpx;
  1630. // #endif
  1631. font-size: 32rpx;
  1632. z-index: 999;
  1633. .address_name {
  1634. max-width: 90%;
  1635. overflow: hidden;
  1636. text-overflow: ellipsis;
  1637. white-space: nowrap;
  1638. }
  1639. }
  1640. .lable {
  1641. border: 1rpx solid #FFE6D9;
  1642. height: 40rpx;
  1643. padding: 0 14rpx;
  1644. background: #FFE6D9;
  1645. border-radius: 4rpx;
  1646. font-weight: 500;
  1647. color: #FD6416;
  1648. font-size: 20rpx;
  1649. margin-right: 10rpx;
  1650. margin-bottom: 10rpx;
  1651. }
  1652. .tabs {
  1653. margin-bottom: 20rpx;
  1654. display: flex;
  1655. justify-content: space-between;
  1656. align-items: center;
  1657. }
  1658. .tabs_name {
  1659. flex: 1;
  1660. /* display: inline-block; */
  1661. text-align: center;
  1662. margin-bottom: 30rpx 0;
  1663. position: relative;
  1664. display: flex;
  1665. /* justify-content: space-between; */
  1666. align-items: center;
  1667. }
  1668. .tabs_name view {
  1669. margin: 0 auto;
  1670. display: flex;
  1671. align-items: center;
  1672. }
  1673. .tabs_2 {
  1674. /* width: 30%; */
  1675. }
  1676. .actives {
  1677. color: #007AFF;
  1678. }
  1679. .tabsicon {
  1680. position: absolute;
  1681. top: 0;
  1682. right: 22rpx;
  1683. width: 20rpx;
  1684. height: 40rpx;
  1685. z-index: 1;
  1686. }
  1687. .tabs_icon {
  1688. width: 12rpx;
  1689. height: 8rpx;
  1690. z-index: 1;
  1691. margin-left: 10rpx;
  1692. }
  1693. .icon1 {
  1694. /* position: absolute; */
  1695. /* top: 6rpx; */
  1696. }
  1697. .icon2 {
  1698. position: absolute;
  1699. bottom: 6rpx;
  1700. }
  1701. .page-box {
  1702. // position: relative;
  1703. // z-index: 0;
  1704. // top: 70px;
  1705. }
  1706. .centre {
  1707. margin: auto;
  1708. height: 400rpx;
  1709. text-align: center;
  1710. font-size: 32rpx;
  1711. }
  1712. .centre image {
  1713. width: 387rpx;
  1714. height: 341rpx;
  1715. margin: 40rpx auto 20rpx;
  1716. }
  1717. .centre .tips {
  1718. font-size: 32rpx;
  1719. color: #2F3044;
  1720. margin: 20rpx 0 40rpx;
  1721. font-weight: 700;
  1722. }
  1723. .hintPopul {
  1724. width: 100%;
  1725. height: 100%;
  1726. position: fixed;
  1727. top: 0;
  1728. background: rgba(0, 0, 0, .4);
  1729. z-index: 999;
  1730. }
  1731. .content_ {
  1732. position: absolute;
  1733. left: 0;
  1734. right: 0;
  1735. top: 0;
  1736. bottom: 0;
  1737. margin: auto;
  1738. text-align: center;
  1739. width: 500rpx;
  1740. height: 400rpx;
  1741. border-radius: 20rpx;
  1742. background-color: #fff;
  1743. padding-top: 120rpx;
  1744. }
  1745. .content_ image {
  1746. position: absolute;
  1747. top: -50rpx;
  1748. left: 0;
  1749. right: 0;
  1750. margin: auto;
  1751. }
  1752. .hintText {
  1753. font-size: 30rpx;
  1754. }
  1755. .skuBtn {
  1756. width: 460rpx;
  1757. height: 60rpx;
  1758. line-height: 60rpx;
  1759. text-align: center;
  1760. background: #FCD202;
  1761. font-size: 28rpx;
  1762. border: 2rpx solid #FCD202;
  1763. color: #333333;
  1764. border-radius: 50rpx;
  1765. font-weight: 700;
  1766. margin: auto;
  1767. }
  1768. .hongbao {
  1769. width: 100%;
  1770. /* height: 100px; */
  1771. /* background: #007AFF; */
  1772. position: fixed;
  1773. top: 34%;
  1774. /* bottom: 50%; */
  1775. left: 0rpx;
  1776. right: 0rpx;
  1777. /* display: none; */
  1778. }
  1779. .hb_img {
  1780. width: 100%;
  1781. height: 535rpx;
  1782. }
  1783. .hb_btn {
  1784. width: 70%;
  1785. height: 72rpx;
  1786. position: absolute;
  1787. top: 315rpx;
  1788. left: 80rpx;
  1789. }
  1790. .serviceBtn{
  1791. position: fixed;
  1792. right: 52rpx;
  1793. bottom: 50rpx;
  1794. display: flex;
  1795. flex-direction: column;
  1796. align-items: center;
  1797. justify-content: center;
  1798. width: 140rpx;
  1799. height: 140rpx;
  1800. border-radius: 50%;
  1801. color: #fff;
  1802. font-size: 20rpx;
  1803. background-color: #3E8EF7;
  1804. box-shadow: 0 0 7rpx #000;
  1805. .serviceBtn_text{
  1806. margin-top: 5rpx;
  1807. }
  1808. }
  1809. </style>