index.vue 55 KB

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