index.vue 54 KB

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