index.vue 52 KB

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