index.vue 50 KB

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