index_yaofang.vue 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504
  1. <template>
  2. <view :style="[mainStyle]" v-if="showPage">
  3. <view :class="'top-f' + (isScroll ? ' top-background' : '')" :style="'height:' + systems.barHeight + 'rpx;'">
  4. <view class="top-nav ddflex" :style="'height:' + systems.navigationHeight + 'rpx;top:' + systems.ktxStatusHeight + 'rpx;'">
  5. <view class="search ddflex" @click="jumpUrl('/pages/search/search')">
  6. <image src="../../static/pages/images/ssico_white.png"></image>
  7. <view>找药品/搜品牌</view>
  8. </view>
  9. </view>
  10. </view>
  11. <view @touchstart="touchStart" @touchmove="move" @touchend="end">
  12. <view class="cons">
  13. <view class="banner">
  14. <image :src="merchant.mainGraph" mode="aspectFill" :style="'height:'+(500+conTop) + 'rpx;'" :class="isPlay==1?'isPlay':isPlay==2?'isPlaasf':''"></image>
  15. </view>
  16. <!-- <view @click="saoma()" style="z-index: 999;position: relative;">扫码</view> -->
  17. <view class="con-ss" :style="'top:'+conTop+'rpx'">
  18. <view class="top">
  19. <view class="merchant ddflex" v-if="merchant">
  20. <image :src="merchant.logo" mode="aspectFill" class="m-logo"></image>
  21. <view class="fflex" v-if="merchant && merchant.title">
  22. <view class="m-name ddflex">
  23. <view @click="jumpUrl('/topic/about/about?id='+merchant.id)">{{ getMerchantTitle() }}</view>
  24. <view class="change ddflex" @click="merchantFun()" v-if="config.Many_Store == 1">切换门店<image src="../../static/pages/images/change.png"></image></view>
  25. </view>
  26. <view class="poi"><block v-if="poi&&poi.title">{{poi.title}}<text>·</text></block>距离{{merchant.range ? merchant.mDistance < 1000 ? merchant.mDistance+'m' : merchant.range+'km' : ''}}</view>
  27. <view class="m-bot ddflex" v-if="merchant.label">
  28. <view class="m-tag ddflex fflex">
  29. <text v-for="(it,idx) in merchant.label.split(',')" :key="index">{{it}}</text>
  30. </view>
  31. <!-- <image :src="picUrlss+'lvluo/gsjs_ico.png'" class="gsjs-ico" @click.stop="jumpUrl('/topic/about/about')"></image> -->
  32. </view>
  33. </view>
  34. <view class="fflex" v-else>
  35. <view class="m-name ddflex">
  36. 绿萝云·私域诊所系统
  37. <image src="../../static/pages/images/change.png"></image>
  38. </view>
  39. <view class="m-bot ddflex">
  40. <view class="m-tag ddflex fflex">
  41. <text>医疗营业许可</text>
  42. <text>到店分期</text>
  43. </view>
  44. <image :src="picUrlss+'lvluo/gsjs_ico.png'" class="gsjs-ico" @click.stop="jumpUrl('/topic/about/about')"></image>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="card" :style="'height:'+cardHeight+'rpx;'">
  49. <image :src="picUrlss+'lvluo/logo_lv.png'" class="logo"></image>
  50. <image :src="picUrlss+'lvluo/card_logo.png'" mode="heightFix" class="card-logo"></image>
  51. <view class="card-top">
  52. <view class="card-no">NO.{{userinfoVip.userCode?userinfoVip.userCode:'000000'}}</view>
  53. <view class="card-info ddflex">
  54. <view class="fflex">
  55. <view class="card-name">{{userinfoVip.levelName?userinfoVip.levelName:'会员卡'}}</view>
  56. <view class="card-user">{{userinfoVip.realName?userinfoVip.realName:userinfoVip.nickName?userinfoVip.nickName:'代名'}}<text>{{userinfoVip.cardNo ? userinfoVip.cardNo:'8888**********8888'}}</text></view>
  57. </view>
  58. <image :src="picUrlss +config.mainIconPath+ 'card_ma.png'" class="card-ma" @click="jumpUrl('/mine/payCode/payCode')"></image>
  59. </view>
  60. <image :src="userinfoVip.icon" mode="heightFix" class="vip-img" v-if="userinfoVip.icon"></image>
  61. </view>
  62. <view class="card-bot">
  63. <view class="datas ddflex">
  64. <view class="li" @click="jumpUrl('/wallet/index/index')">
  65. <view class="numbers" v-if="isShowBalance">{{userInfo.balance ? userInfo.balance : 0}}</view>
  66. <view class="numbers" v-else>****</view>
  67. <view class="ddflex">余额<image :src="picUrlss +config.mainIconPath+(isShowBalance?'eye_shows.png':'eye_hides.png')" class="card-eye" @click.stop="optBalance"></image></view>
  68. </view>
  69. <view class="li" @click="jumpUrl('/service/secondCard/secondCard')">
  70. <view class="numbers">{{cardCount?cardCount:0}}</view>
  71. <view>权益卡</view>
  72. </view>
  73. <view class="li" @click="jumpUrl('/mine/coupons/coupons')">
  74. <view class="numbers">{{userInfo.coupon?userInfo.coupon:0}}</view>
  75. <view>优惠券</view>
  76. </view>
  77. </view>
  78. <block v-if="config.is_not_fixed_contact == 1">
  79. <view class="zhuanshu-box" v-if="advisor&&advisor.id">
  80. <view class="zhuanshu-t ddflex">
  81. <image :src="picUrlss+config.mainIconPath+'card_zhuanshu.png'"></image>
  82. </view>
  83. <view class="zhuanshu-info ddflex" @click="jumpUrl('/other/contact/index?id='+advisor.id)">
  84. <image :src="advisor.headUrl ? advisor.headUrl : picUrlss+'lvluo/zhuanshu_img.png'" mode="aspectFill" class="zhuanshu-img"></image>
  85. <view class="fflex">
  86. <view class="zhuanshu-name ddflex">{{advisor.realName}}<text v-if="advisor.label"><block v-for="(it,idx) in advisor.label.split(',')" :key="idx" v-if="idx == 0">{{it}}</block></text></view>
  87. <view class="zhuanshu-mobile">{{advisor.mobile}}</view>
  88. </view>
  89. <image :src="picUrlss+config.mainIconPath+'zhuanshu_weixin.png'" class="zhuanshu-weixin"></image>
  90. </view>
  91. </view>
  92. <button open-type="contact" hover-class="none" class="zhuanshu-box" v-else>
  93. <view class="zhuanshu-t ddflex">
  94. <image :src="picUrlss+config.mainIconPath+'card_zhuanshu.png'"></image>
  95. </view>
  96. <view class="zhuanshu-info ddflex">
  97. <image :src="picUrlss+'lvluo/zhuanshu_img.png'" mode="aspectFill" class="zhuanshu-img"></image>
  98. <view class="fflex">
  99. <view class="zhuanshu-name ddflex">官方客服</view>
  100. </view>
  101. <image :src="picUrlss+config.mainIconPath+'zhuanshu_weixin.png'" class="zhuanshu-weixin"></image>
  102. </view>
  103. </button>
  104. </block>
  105. <block v-else>
  106. <view class="zhuanshu-box" v-if="doctor&&doctor.id">
  107. <view class="zhuanshu-t1 ddflex">
  108. <image :src="picUrlss+config.mainIconPath+'card_zhuanshu.png'"></image>
  109. </view>
  110. <view class="zhuanshu-info ddflex" @click="jumpUrl('/topic/teacherDet/teacherDet?id='+doctor.id)">
  111. <image :src="doctor.headUrl ? doctor.headUrl : picUrlss+'lvluo/zhuanshu_img.png'" mode="aspectFill" class="zhuanshu-img"></image>
  112. <view class="fflex">
  113. <view class="zhuanshu-name ddflex">{{doctor.username}}<text v-if="doctor.label"><block v-for="(it,idx) in doctor.label.split(',')" :key="idx" v-if="idx == 0">{{it}}</block></text></view>
  114. <view class="zhuanshu-mobile">{{doctor.mobile}}</view>
  115. </view>
  116. <image :src="picUrlss+config.mainIconPath+'zhuanshu_weixin.png'" class="zhuanshu-weixin"></image>
  117. </view>
  118. </view>
  119. </block>
  120. </view>
  121. <button class="open-card ddflex" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" hover-class="none" v-if="!userinfoVip.levelGrade || (userinfoVip.levelGrade > 0 && userinfoVip.end)">
  122. <image :src="picUrlss+'lvluo/open_ico.png'"></image>
  123. <view>一键领取会员卡</view>
  124. </button>
  125. </view>
  126. </view>
  127. <view v-for="(item, index) in contact" :key="index">
  128. <storeOptions
  129. v-if="item == 'store_options' || (item == 'sou' && top) || (item == 'type_district' && top_type)"
  130. :storeTemplate="storeTemplate"
  131. :merchant="merchant"
  132. :about="about"
  133. :guarantee="guarantee"
  134. :sousuoTemplate="sousuoTemplate"
  135. :typeDistrictTemplate="typeDistrictTemplate"
  136. :url="site"
  137. :web="url"
  138. :cloud="header.appId == 'ZQ1VK5oc17I387E' ? 'default' : ''"
  139. ></storeOptions>
  140. <!-- 多门店选择模板和搜索模板 -->
  141. <popAd
  142. v-if="item == 'home_pop_up_ads'"
  143. :first="first"
  144. :popAdTemplate="popAdTemplate"
  145. :isLayerAd="isLayerAd"
  146. :popAdList="popAdList"
  147. :iscouponAd="iscouponAd"
  148. :storeShow="storeShow"
  149. ></popAd>
  150. <!-- 弹窗广告 -->
  151. <banner v-if="item == 'ad' && bannerShow" :bannerList="bannerList" :url="site" :web="url" :config="about" :couponList="couponList" :officeList="officeList" :districtTemplate="districtTemplate"></banner>
  152. <!-- 走马灯 -->
  153. <bargain v-if="item == 'bargain' && bargainShow" :bargainList="bargainList" :url="site" :web="url" :bargainTemplate="bargainTemplate"></bargain>
  154. <!-- 砍价 -->
  155. <customers v-if="item == 'New_customers' && customersShow" :customersList="customersList" :url="site" :web="url" :customersTemplate="customersTemplate"></customers>
  156. <!-- 新客 -->
  157. <homecolumn v-if="item == 'homecolumn'" :homecolumnimg="homecolumnimg"></homecolumn>
  158. <!-- 首页专区 -->
  159. <joingroup v-if="item == 'joingroup' && joingroupShow" :joingroupList="joingroupList" :url="site" :web="url" :joingroupTemplate="joingroupTemplate"></joingroup>
  160. <!-- 拼团 -->
  161. <group
  162. v-if="item == 'group' && activityGroupShow"
  163. :activityGroup="activityGroup"
  164. :url="site"
  165. :web="url"
  166. :groupTemplate="groupTemplate"
  167. :merchant="merchant"
  168. :freshen="freshen"
  169. ></group>
  170. <!-- 社区团购 -->
  171. <!-- <pCategoryList
  172. v-if="item == 'p_list'"
  173. :homeTemplate="homeTemplate"
  174. :url="site"
  175. :web="url"
  176. :about="about"
  177. :templateType="templateType"
  178. :merchant="merchant"
  179. :freshen="freshen"
  180. :pCategoryList="pCategoryList"
  181. :pCategorShow="pCategorShow"
  182. ></pCategoryList> -->
  183. <block v-if="item == 'p_list'">
  184. <block v-for="(categoryItem, idx) in pCategoryList" :key="idx">
  185. <pCategoryList
  186. :homeTemplate="homeTemplate"
  187. :url="site"
  188. :web="url"
  189. :about="about"
  190. :templateType="templateType"
  191. :merchant="merchant"
  192. :freshen="freshen"
  193. :pCategorShow="categoryItem.pCategorShow"
  194. :categoryItem="categoryItem"
  195. ></pCategoryList>
  196. </block>
  197. </block>
  198. <!-- 分类 -->
  199. <recommend
  200. v-if="item == 'recommend' && recommendShow"
  201. :pageList="pageList"
  202. :recommendTemplate="recommendTemplate"
  203. :url="site"
  204. :web="url"
  205. :about="about"
  206. :categoryList="categoryList"
  207. ></recommend>
  208. <!-- 推荐 -->
  209. <seckill v-if="item == 'seckill' && seckillShow" :seckillList="seckillList" :url="site" :web="url" :seckillTemplate="seckillTemplate"></seckill>
  210. <!-- 秒杀 -->
  211. <selected v-if="item == 'chosen' && boutiqueShow" :boutiqueList="boutiqueList" :chosenTemplate="chosenTemplate" :url="site" :web="url" :about="about"></selected>
  212. <!-- 精选 -->
  213. <arrivals
  214. v-if="item == 'new_arrivals' && arrivalsShow"
  215. :arrivalsList="arrivalsList"
  216. :arrivalsTemplate="arrivalsTemplate"
  217. :url="site"
  218. :web="url"
  219. :about="about"
  220. ></arrivals>
  221. <!-- 新品上架 -->
  222. <hot v-if="item == 'hot_money' && hotShow" :hotList="hotList" :hotTemplate="hotTemplate" :url="site" :web="url" :about="about"></hot>
  223. <!-- 热门爆款 -->
  224. <specialTopic v-if="item == 'special'" :specialList="specialList"></specialTopic>
  225. <!-- 专题 -->
  226. <redEnvelopes
  227. v-if="item == 'red_envelopes'"
  228. :storeShow="storeShow"
  229. :iscouponAd="iscouponAd"
  230. :first="first"
  231. :couponAd="couponAd"
  232. @iscouponAd="hidecouponAd"
  233. ></redEnvelopes>
  234. <!-- 红包 -->
  235. <supplier
  236. v-if="item == 'supplier_premium' && supplierShow"
  237. :supplierTemplate="supplierTemplate"
  238. :web="merchant.type == 5 ? web : url"
  239. :supplierList="supplierList"
  240. :about="about"
  241. ></supplier>
  242. <!-- 供应商优品 -->
  243. <district v-if="item == 'king_kong_district' && districtShow" :url="site" :web="url" :districtTemplate="districtTemplate"></district>
  244. <!-- 九宫格 金刚区 -->
  245. <suppliers
  246. v-if="item == 'sup_recommend' && supRecommendShow"
  247. :supRecommendList="supRecommendList"
  248. :url="site"
  249. :web="url"
  250. :supRecommendTemplate="supRecommendTemplate"
  251. ></suppliers>
  252. <!-- 供应商推荐 -->
  253. <single
  254. v-if="item == 'single_product' && singleShow"
  255. :pageList="singleList"
  256. :singleTemplate="singleTemplate"
  257. :merchant="merchant"
  258. :url="site"
  259. :web="url"
  260. :about="about"
  261. :categoryList="categoryList"
  262. ></single>
  263. <!-- 单产品推荐 -->
  264. </view>
  265. <view class="bottom" v-if="config.company_permit">
  266. <view class="bot-name">{{config.company_permit.split(',')[0]}} </view>
  267. <view class="bot-xuke ddflex" v-if="config.company_permit.split(',').length>0">{{config.company_permit.split(',')[1]}}<image :src="picUrlss+'lvluo/bot_xuke.png'" @click="scanCode()"></image></view>
  268. </view>
  269. </view>
  270. </view>
  271. </view>
  272. <block v-if="config.is_not_fixed_contact != 1">
  273. <navigator :url="'/other/contact/index?id='+advisor.id" hover-class="none" class="contact ddflex" v-if="advisor&&advisor.id">
  274. <image :src="advisor.headUrl ? advisor.headUrl : picUrlss+'lvluo/fixed_img.png'" mode="aspectFill"></image>
  275. <view class="contact-text">服务<text>顾问</text></view>
  276. </navigator>
  277. <button open-type="contact" hover-class="none" class="contact ddflex" v-else>
  278. <image :src="picUrlss+'lvluo/fixed_img.png'"></image>
  279. <view class="contact-text">服务<text>顾问</text></view>
  280. </button>
  281. </block>
  282. <footer-copyright></footer-copyright>
  283. <!-- #ifdef MP-WEIXIN -->
  284. <foot channel="home" :isUpdate="isUpdate"></foot>
  285. <!-- #endif -->
  286. <update-userinfo
  287. :update-info="isUpdateInfo"
  288. :update-mobile="isUpdateMobile"
  289. v-if="isShowUpdate"
  290. @closeUpdate="closeUpdate"
  291. @updateInfo="updateInfo"
  292. @updateMobile="updateMobile"
  293. ></update-userinfo>
  294. </view>
  295. </template>
  296. <script>
  297. //index.js
  298. //获取应用实例
  299. const app = getApp();
  300. const req = require('../../utils/request.js');
  301. const api = require('../../utils/api.js');
  302. const utils = require('../../utils/util.js');
  303. const mes = require('../../utils/requestmessage.js');
  304. const route = require('../../utils/route');
  305. const QQMapWX = require('../../utils/qqmap.js');
  306. import foot from '../../components/nav-bar/index';
  307. import footerCopyright from '../../components/footer-copyright/footer-copyright';
  308. import popAd from '../../template/popAd/popAd';
  309. import group from '../../template/activityGroup/activityGroup';
  310. import banner from '../../template/banner/banner';
  311. import bargain from '../../template/bargain/bargain';
  312. import customers from '../../template/customers/customers';
  313. import homecolumn from '../../template/homecolumn/homecolumn';
  314. import joingroup from '../../template/joingroup/joingroup';
  315. import pCategoryList from '../../template/pCategoryList/pCategoryList';
  316. import recommend from '../../template/recommend/recommend';
  317. import seckill from '../../template/seckill/seckill';
  318. import selected from '../../template/selected/selected';
  319. import arrivals from '../../template/arrivals/arrivals';
  320. import hot from '../../template/hot/hot';
  321. import specialTopic from '../../template/specialTopic/specialTopic';
  322. import storeOptions from '../../template/store_options/store_options';
  323. import redEnvelopes from '../../template/red_envelopes/index';
  324. import supplier from '../../template/supplier/supplier';
  325. import district from '../../template/king_kong_district/king_kong_district';
  326. import switchStore from '../../template/switchStore/switchStore';
  327. import suppliers from '../../template/suppliers/suppliers';
  328. import single from '../../template/single/single';
  329. export default {
  330. components: {
  331. foot,
  332. footerCopyright,
  333. banner,
  334. group,
  335. bargain,
  336. popAd,
  337. customers,
  338. homecolumn,
  339. joingroup,
  340. pCategoryList,
  341. recommend,
  342. seckill,
  343. selected,
  344. arrivals,
  345. hot,
  346. specialTopic,
  347. storeOptions,
  348. redEnvelopes,
  349. supplier,
  350. district,
  351. switchStore,
  352. suppliers,
  353. single
  354. },
  355. data() {
  356. return {
  357. mainStyle: app.globalData.mainStyle,
  358. showPage: false,
  359. picUrlss: req.public.picUrls,
  360. isUpdate: false, // 是否更新消息
  361. config: {},
  362. systems: {},
  363. isScroll: false,
  364. merchant: '',
  365. cardHeight: 528,
  366. userinfoVip: {},
  367. userInfo: {},
  368. clientData: {
  369. // 用户手指Y轴
  370. clientStartY: '', //开始按下的位置
  371. clientMoveY: '', //按下
  372. clientEndY: '', //抬起
  373. // 页面Y轴
  374. pageY: ''
  375. },
  376. sheight: 100,
  377. isPlay: 0, //是否播放动画
  378. isRefresh: true,
  379. cardCount: '',//次卡数量
  380. isShowBalance: true,
  381. chatPrams: '',//客服类型
  382. conTop: '',
  383. pxToRpxScale: '',//比例
  384. doctor: '',//专属医生
  385. advisor: '',//服务顾问
  386. sessionKey: '',
  387. scene: '',
  388. isShowUpdate: false, //是否显示更新信息弹窗
  389. isUpdateInfo: false, //更新用户信息
  390. isUpdateMobile: false, //绑定手机号
  391. poi: '',
  392. contact: [],
  393. bannerList: [],
  394. categoryList: [],//产品分类列表
  395. page: 1,
  396. boutiqueList: {},//精品榜单
  397. arrivalsList: {},
  398. hotList: {},
  399. pageList: {},//产品列表
  400. isLoad: true,
  401. hasmore: true,
  402. activityGroup: {
  403. products: []
  404. },
  405. couponList: {},//优惠券,
  406. isRemind: false,
  407. isUpdate: false,// 是否更新消息
  408. first: true,//是否显示提示加入我的小程序
  409. isLayerAd: true,//广告
  410. homeTemplate: [],//首页栏目配置
  411. pCategoryList: [],
  412. storeShow: true,
  413. joingroupList: {
  414. products: []
  415. },
  416. //拼团
  417. bargainList: {
  418. products: []
  419. },
  420. //砍价
  421. customersList: {
  422. products: []
  423. },
  424. //新客
  425. freshen: true,
  426. swiperHeight: 0,
  427. url: '',
  428. web: '',
  429. site: '',
  430. internet: '',
  431. storeTemplate: {},
  432. typeDistrictTemplate: {},
  433. sousuoTemplate: {},
  434. popAdTemplate: {},
  435. districtTemplate: {},
  436. Timelyimg: '',
  437. timelyTemplate: {},
  438. homecolumnimg: [],
  439. customersTemplate: {},
  440. joingroupTemplate: {},
  441. supplierTemplate: {},
  442. seckillTemplate: {},
  443. bargainTemplate: {},
  444. specialTemplate: {},
  445. chosenTemplate: {},
  446. arrivalsTemplate: {},
  447. hotTemplate: {},
  448. groupTemplate: {},
  449. recommendTemplate: {},
  450. supRecommendTemplate: {},
  451. singleTemplate: {},
  452. specialList: [],
  453. contact: [],
  454. seckillList: {
  455. products: []
  456. },
  457. about: {},
  458. Is_Store_Price_Stock: '',
  459. guarantee: [],
  460. current: '',
  461. animationData: '',
  462. content: '',
  463. popAdList: {},
  464. supplierList: {},
  465. supRecommendList: {},
  466. singlePage: 1,
  467. isLoadSingle: true,
  468. hasmoreSingle: true,
  469. singleList: {},
  470. iscouponAd: false,
  471. couponAd: {},
  472. logo: false,
  473. top: Boolean,
  474. top_type: Boolean,
  475. switchStoreShow: Boolean,
  476. bargainShow: Boolean,
  477. contactShow: true,
  478. seckillShow: false,
  479. joingroupShow: false,
  480. activityGroupShow: false,
  481. customersShow: false,
  482. districtShow: false,
  483. recommendShow: false,
  484. boutiqueShow: false,
  485. arrivalsShow: false,
  486. hotShow: false,
  487. supplierShow: false,
  488. supRecommendShow: false,
  489. singleShow: false,
  490. pCategorShow: false,
  491. bannerShow: false,
  492. List: [],
  493. marqueeOrderItemIndex: 0,
  494. marqueeOrderItem: '',
  495. officeList: [],//互动
  496. templateType: {
  497. module_ad: 'ad',//广告
  498. module_type_district: 'type_district',//分类导航
  499. module_p_list: 'p_list',//品类专区
  500. module_group: 'group',//团购
  501. module_live: 'live',//直播
  502. module_sou: 'sou',//搜索
  503. module_special: 'special',//专题
  504. module_chosen: 'chosen',//精选
  505. module_new_arrivals: 'new_arrivals',//新品上架
  506. module_hot_money: 'hot_money',//热门爆款
  507. module_recommend: 'recommend',//推荐产品
  508. module_store_options: 'store_options',//多门店选择
  509. module_home_pop_up_ads: 'home_pop_up_ads',//首页弹窗广告
  510. module_joingroup: 'joingroup',//拼团
  511. module_seckill: 'seckill',//秒杀
  512. module_bargain: 'bargain',//砍价
  513. module_customers: 'New_customers',//新客
  514. module_homecolumn: 'homecolumn',//首页专区
  515. module_Timely_delivery_open: 'Timely_delivery_open',//及时达页面
  516. module_supplier_premium: 'supplier_premium', //供应商模块
  517. module_red_envelopes: 'red_envelopes', //优惠券
  518. module_king_kong_district: 'king_kong_district', //金刚区
  519. module_sup_recommend: 'sup_recommend', //供应商推荐
  520. module_single_product: 'single_product' //供应商推荐
  521. },
  522. };
  523. },
  524. onLoad: async function(options) {
  525. this.query = options;
  526. // 获取配色后渲染页面
  527. if(app.globalData.mainStyle&&Object.keys(app.globalData.mainStyle).length === 0)
  528. await app.globalData.upColor()
  529. this.mainStyle = app.globalData.mainStyle
  530. this.showPage = true
  531. if(options.appId) req.setStorage('appId',options.appId);
  532. if(options.scene){
  533. this.scene = options.scene;
  534. await this.loadCode();
  535. }else{
  536. req.silenceLogin(options.userId, '');
  537. }
  538. QQMapWX.initMap(req.public.mapLBSKEY);
  539. req.getLocation(res => {
  540. const to = {
  541. latitude: res.latitude,
  542. longitude: res.longitude
  543. };
  544. QQMapWX.reverseGeocoder(to, async resp => {
  545. if(resp){
  546. this.poi = resp.pois[0];
  547. }
  548. if(req.isAuth()){
  549. await this.getUserInfo();
  550. await this.getuserVip();
  551. await this.getCardCount();
  552. await this.getShowUpdata();
  553. }
  554. });
  555. });
  556. app.globalData.getCheckSessoin(json => {
  557. this.sessionKey = json.session_key;
  558. });
  559. },
  560. onHide(){
  561. if(this.isPlay == 1){
  562. this.isPlay = 2;
  563. }
  564. },
  565. async onShow() {
  566. let _ts = this;
  567. _ts.getChatPrams();
  568. if(isLogin){
  569. _ts.getUserInfo();
  570. _ts.getuserVip();
  571. _ts.getCardCount();
  572. }
  573. await this.getConfig().then(async res => {
  574. await _ts.getMerchant();
  575. await _ts.getHomeTemplateConfig();
  576. // if(this.isRefresh){
  577. // await _ts.getViewInfo();
  578. // }
  579. await _ts.getDoctor();
  580. await _ts.getAdvisor();
  581. });
  582. let isLogin = req.isAuth();
  583. },
  584. onShareAppMessage: function() {
  585. return {
  586. title: this.getShareTitle(),
  587. path: this.getSharePath()
  588. };
  589. },
  590. onShareTimeline() {
  591. return {
  592. title: this.getShareTitle(),
  593. query: this.getSharePath()
  594. };
  595. },
  596. onUnload() {
  597. this.isPlay = 2;
  598. },
  599. methods: {
  600. getShowUpdata(){
  601. // #ifdef MP-WEIXIN||MP-TOUTIAO
  602. return new Promise((resolve,reject)=>{
  603. let userInfo = req.getStorage('userInfo');
  604. if (req.isAuth()) {
  605. setTimeout(res => {
  606. console.log('setTimeoutuserInfo》》》》', userInfo);
  607. if (!userInfo.avatar || userInfo.nickName == '微信用户') {
  608. this.isShowUpdate = true;
  609. this.isUpdateInfo = true;
  610. }
  611. if (userInfo.avatar && !userInfo.mobile && (this.userInfo && !this.userInfo.mobile)) {
  612. this.isShowUpdate = true;
  613. this.isUpdateMobile = true;
  614. }
  615. }, 2000);
  616. }
  617. resolve();
  618. })
  619. // #endif
  620. },
  621. loadCode() {
  622. let _ts = this;
  623. console.log('解码参数scene==',_ts.scene)
  624. return new Promise((resolve, reject) => {
  625. let form = {
  626. scene: _ts.scene
  627. };
  628. req.getRequest('/api/code/params', form, data => {
  629. console.log('解码参数==',data)
  630. req.silenceLogin(data.userId, '');
  631. req.setStorage('pidCode', data.userId);
  632. resolve();
  633. });
  634. });
  635. },
  636. getPhoneNumber(event) {
  637. // console.log('绑定手机号==',event)
  638. const detail = event.detail;
  639. const _ts = this;
  640. if (!detail || !detail.encryptedData || !detail.iv) return false;
  641. req.postRequest('/api/weixin/mobile', {
  642. encryptedData: detail.encryptedData,
  643. iv: detail.iv,
  644. sessionKey: _ts.sessionKey
  645. }, res => {
  646. console.log('res==',res)
  647. if(res.mobile){
  648. var userInfo = req.getStorage('userInfo');
  649. userInfo.mobile = res.mobile;
  650. req.setStorage('userInfo', userInfo);
  651. _ts.jumpUrl('/open/info/index');
  652. }
  653. });
  654. },
  655. getDoctor(){
  656. return new Promise((resolve,reject)=>{
  657. req.getRequest('/api/v3/user/doctor',{},data=>{
  658. console.log('医生==',data)
  659. this.doctor = data;
  660. resolve();
  661. })
  662. })
  663. },
  664. getAdvisor(){
  665. return new Promise((resolve,reject)=>{
  666. req.getRequest('/api/distribution/advisorInfo',{},data=>{
  667. console.log('服务顾问==',data)
  668. this.advisor = data;
  669. resolve();
  670. })
  671. })
  672. },
  673. customerServiceChat() {
  674. let chatPrams = this.chatPrams;
  675. wx.openCustomerServiceChat({
  676. extInfo: {
  677. url: chatPrams.url
  678. },
  679. corpId: chatPrams.enterpriseId,
  680. success(res) {
  681. console.log('调用微信客服')
  682. }
  683. })
  684. },
  685. getChatPrams() {
  686. let that = this;
  687. let chatPrams = req.getStorage('chatService');
  688. if(chatPrams){
  689. that.chatPrams = chatPrams;
  690. that.type = chatPrams.type;
  691. console.log('type==', that.type)
  692. that.$forceUpdate();
  693. }
  694. },
  695. optBalance(){
  696. this.isShowBalance = !this.isShowBalance;
  697. req.setStorage('isShowBalance',this.isShowBalance);
  698. },
  699. touchStart(e){
  700. // console.log('开始移动==',e)
  701. this.clientData.clientStartY = e.changedTouches[0].clientY;
  702. },
  703. move(e) {
  704. // console.log('触摸移动==',e);
  705. if (this.clientData.pageY < 1) {
  706. let distance = e.changedTouches[0].clientY - this.clientData.clientStartY;
  707. if(this.isPlay != 1){
  708. if(distance > 0){
  709. if(distance > this.sheight){
  710. this.conTop = this.sheight*this.pxToRpxScale;
  711. }else{
  712. this.conTop = distance*this.pxToRpxScale;
  713. }
  714. }
  715. }
  716. if (distance > this.sheight) {
  717. this.isPlay = 1;
  718. this.conTop = 0;
  719. } else {
  720. return;
  721. }
  722. }
  723. },
  724. // 手指抬起
  725. end(e) {
  726. let endY = e.changedTouches[0].clientY;
  727. let subY = endY - this.clientData.clientStartY;
  728. this.conTop = 0;
  729. if (subY < -50) {
  730. console.log('上滑')
  731. if(subY*-1 > this.sheight){
  732. if(this.isPlay == 1){
  733. uni.pageScrollTo({
  734. duration: 300,
  735. scrollTop: 0
  736. })
  737. this.isPlay = 2;
  738. }
  739. }
  740. } else if (subY > 50 && this.clientData.pageY < 1) {
  741. console.log('下滑')
  742. if(subY > this.sheight){
  743. this.isPlay = 1;
  744. }else{
  745. uni.pageScrollTo({
  746. duration: 300,
  747. scrollTop: 0
  748. })
  749. }
  750. }else{
  751. if(this.isPlay == 1){
  752. uni.pageScrollTo({
  753. duration: 300,
  754. scrollTop: 0
  755. })
  756. }
  757. }
  758. },
  759. getUserInfo(){
  760. return new Promise((resolve,reject)=>{
  761. req.getRequest('/api/user/my',{},data=>{
  762. if(data.avatar || data.mobile || data.nickName){
  763. let userInfo = req.getStorage('userInfo');
  764. userInfo.avatar = data.avatar;
  765. userInfo.mobile = data.mobile;
  766. userInfo.nickName = data.nickName;
  767. req.setStorage('userInfo',userInfo)
  768. }
  769. this.userInfo = data;
  770. if(req.getStorage('isShowBalance') != ''){
  771. this.isShowBalance = req.getStorage('isShowBalance');
  772. }else{
  773. this.isShowBalance = true;
  774. }
  775. resolve();
  776. })
  777. })
  778. },
  779. getCardCount(){
  780. req.getRequest('/api/v3/secondary/card/count',{},data=>{
  781. this.cardCount = data;
  782. })
  783. },
  784. getuserVip() {
  785. return new Promise((resolve,reject)=>{
  786. req.getRequest('/api/user/levelDetails', {}, data => {
  787. let expireTime = Array;
  788. if (data.expireTime) {
  789. expireTime = data.expireTime.split(' ');
  790. data.expireTime = data.expireTime.replace(/-/g, '/');
  791. }
  792. let nowTime = new Date().getTime();
  793. let endTime = new Date(data.expireTime).getTime();
  794. let times = parseInt((endTime - nowTime) / 1000);
  795. if(data.cardNo) data.cardNo = data.cardNo.replace(/(.{4}).*(.{4})/, '$1********$2');
  796. this.userinfoVip = data;
  797. this.userinfoVip.expireTime = expireTime[0];
  798. if (times <= 0) {
  799. this.userinfoVip.end = true;
  800. } else {
  801. this.userinfoVip.end = false;
  802. }
  803. resolve();
  804. });
  805. })
  806. },
  807. getSharePath() {
  808. let path = '/home/index/index_yaofang?isShare=' + true+'&appId='+req.getStorage('appId');
  809. if (req.getStorage('userInfo')) {
  810. path += '&userId=' + req.getStorage('userInfo').id;
  811. }
  812. if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
  813. path += '&merchantId=' + req.getStorage('MERCHANT').id;
  814. if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
  815. path += '&shopId=' + req.getStorage('smallShop').id;
  816. }
  817. }
  818. return path;
  819. },
  820. getShareTitle() {
  821. let title = '';
  822. if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
  823. title = this.merchant.title;
  824. } else {
  825. title = this.config.CONFIG_PROJECT_TITLE;
  826. }
  827. return (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage('userInfo').nickName) : '') + '为你推荐' + title;
  828. },
  829. /**
  830. * 显示门店标题
  831. */
  832. getMerchantTitle() {
  833. let title = '';
  834. if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
  835. if (this.merchant.title.length > 12) {
  836. title = this.merchant.title.substring(0, 12) + '...';
  837. } else {
  838. title = this.merchant.title;
  839. }
  840. } else {
  841. title = this.config.CONFIG_PROJECT_TITLE;
  842. }
  843. return title;
  844. },
  845. callPhone() {
  846. uni.makePhoneCall({
  847. phoneNumber: this.merchant.phone
  848. });
  849. },
  850. merchantFun() {
  851. app.globalData.openPage('merchant/nearby/nearby');
  852. },
  853. getConfig() {
  854. return new Promise((resolve, reject) => {
  855. req.getRequest('/api/config', {}, data => {
  856. req.setStorage('configRes', JSON.stringify(data));
  857. this.config = data;
  858. this.about = data;
  859. resolve();
  860. });
  861. });
  862. },
  863. getMerchant() {
  864. let _ts = this;
  865. return new Promise((resolve, reject) => {
  866. api.getMerchant(_ts.query, req, data => {
  867. console.log('===', data);
  868. if (data == 1) {
  869. uni.showModal({
  870. title: '温馨提示',
  871. content: '获取定位失败,请前往设置打开定位权限',
  872. showCancel: false,
  873. success(res) {
  874. if (res.confirm) {
  875. // console.log('用户点击确定');
  876. uni.openSetting({
  877. success(res) {
  878. console.log(res.authSetting); // res.authSetting = {
  879. }
  880. });
  881. }
  882. }
  883. });
  884. } else {
  885. _ts.merchant = data;
  886. }
  887. resolve();
  888. });
  889. });
  890. },
  891. getViewInfo(){
  892. let that = this;
  893. const systemInfo = uni.getSystemInfoSync();
  894. let pxToRpxScale = 750 / systemInfo.windowWidth;
  895. return new Promise((resolve, reject) => {
  896. const query = uni.createSelectorQuery();
  897. query.select('.merchant').boundingClientRect(res => {
  898. let height = res.height*pxToRpxScale + res.top*pxToRpxScale+40
  899. that.cardHeight = that.systems.windowHeight - height;
  900. }).exec();
  901. setTimeout(res=>{
  902. query.select('.bottom').boundingClientRect(data => {
  903. let height = data.height*pxToRpxScale;
  904. that.cardHeight = that.cardHeight - height - 115 - that.systems.safeBottomHeight;
  905. that.isRefresh = false;
  906. }).exec();
  907. },200)
  908. resolve();
  909. })
  910. },
  911. jumpVip(url) {
  912. if (req.isLogins(true)) {
  913. let userInfo = req.getStorage('userInfo');
  914. if (userInfo.levelId && userInfo.levelId > 0) {
  915. uni.navigateTo({
  916. url: '/mine/vip/vip'
  917. });
  918. } else {
  919. uni.navigateTo({
  920. url: url
  921. });
  922. }
  923. }
  924. },
  925. jumpUrl(url) {
  926. if (req.isLogins(true)) {
  927. uni.navigateTo({
  928. url: url
  929. });
  930. }
  931. },
  932. scanCode() {
  933. var _this = this; // 允许从相机和相册扫码
  934. uni.scanCode({
  935. success: res => {
  936. console.log('扫码结果1111==',res)
  937. let path = res.path.split('?scene=')[0];
  938. let scene = res.path.split('?scene=')[1];
  939. let paths = '/'+path + '?scene=' +encodeURIComponent(scene);
  940. console.log('paths===',paths)
  941. uni.navigateTo({
  942. url: paths
  943. }); // this.scene = '1290926887903780865';
  944. }
  945. });
  946. },
  947. closeUpdate() {
  948. this.isShowUpdate = false;
  949. },
  950. updateInfo(e) {
  951. this.isUpdateInfo = e;
  952. this.getuserVip();
  953. this.getUserInfo();
  954. },
  955. updateMobile(e) {
  956. this.isUpdateMobile = e;
  957. this.jumpUrl('/open/info/index');
  958. },
  959. jumpUrlColumn(item){
  960. app.globalData.clickBanner(item);
  961. },
  962. //获取首页模板配置
  963. getHomeTemplateConfig() {
  964. let _ts = this;
  965. let page = 'shopIndex';
  966. //荣康模板配置、小店产品==门店产品
  967. // if (this.merchant && this.merchant.type == 5 || this.shopId && this.merchantId) page = 'shopIndex'
  968. req.getRequest(
  969. '/api/template/getTemplate',
  970. {
  971. page: page
  972. },
  973. data => {
  974. let arr = [];
  975. data.forEach(it => {
  976. arr.push(it.module);
  977. });
  978. this.setData({
  979. contact: [...new Set(arr)],
  980. contactShow: false
  981. });
  982. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('store_options') != -1) {
  983. this.top = false;
  984. } else {
  985. this.top = true;
  986. }
  987. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('type_district') != -1) {
  988. this.top_type = false;
  989. } else {
  990. this.top_type = true;
  991. }
  992. console.log(this.contact.indexOf('sou') != -1, this.contact.indexOf('store_options') != -1, this.contact.indexOf('type_district') != -1, this.top);
  993. console.log(this.contact);
  994. this.setData({
  995. homeTemplate: data
  996. });
  997. this.getRqeDatas();
  998. }
  999. );
  1000. },
  1001. async getRqeDatas() {
  1002. console.log('getRqeDatas');
  1003. let that = this; //多门店
  1004. await that.getCategory();
  1005. let store = that.homeTemplate.filter(it => it.module == that.templateType.module_store_options);
  1006. that.setData({
  1007. storeTemplate: store[0]
  1008. }); //搜索
  1009. let sousuo = that.homeTemplate.filter(it => it.module == that.templateType.module_sou);
  1010. that.setData({
  1011. sousuoTemplate: sousuo[0]
  1012. });
  1013. //分类导航
  1014. let typeDistrict = that.homeTemplate.filter(it => it.module == that.templateType.module_type_district);
  1015. that.setData({
  1016. typeDistrictTemplate: typeDistrict[0]
  1017. });
  1018. //弹窗广告
  1019. let popAd = that.homeTemplate.filter(it => it.module == that.templateType.module_home_pop_up_ads);
  1020. if (popAd && popAd.length > 0 && popAd[0].state == 0) {
  1021. that.setData({
  1022. popAdTemplate: popAd[0]
  1023. });
  1024. if (that.freshen) {
  1025. await that.getBannerList(popAd[0].module, popAd[0].contentId);
  1026. }
  1027. } // 及时达
  1028. // let Timely = that.data.homeTemplate.filter(it => it.module == that.data.templateType.module_Timely_delivery_open);
  1029. // if (Timely && Timely.length > 0 && Timely[0].state == 0) {
  1030. // that.setData({ TimelyTemplate: Timely[0] });
  1031. // await this.getTimelyList(Timely[0].module, Timely[0].contentId);
  1032. // }
  1033. let Timely = that.homeTemplate.filter(it => it.module == that.templateType.module_Timely_delivery_open);
  1034. if (Timely.length > 0 && Timely[0].state == 0) {
  1035. // console.log(Timely);
  1036. let Timelyimg = Timely[0].contentId.split(','); // if (Timely[0] != '' && Timely[1] != '' && Timely[2] != '') {
  1037. // if (Timely.length == 3) {
  1038. that.setData({
  1039. Timelyimg: Timelyimg[0],
  1040. timelyTemplate: Timely[0]
  1041. });
  1042. // console.log(Timelyimg); // }
  1043. // }
  1044. }
  1045. // 金刚区
  1046. let district = that.homeTemplate.filter(it => it.module == that.templateType.module_king_kong_district);
  1047. if (district && district.length > 0 && district[0].state == 0) {
  1048. let data = district[0];
  1049. data.content = JSON.parse(district[0].content);
  1050. that.districtTemplate = data;
  1051. if (data.contentId == 2) {
  1052. that.districtShow = true;
  1053. }
  1054. console.log(that.districtTemplate, '=============');
  1055. }
  1056. //顶部banner
  1057. let ad = that.homeTemplate.filter(it => it.module == that.templateType.module_ad);
  1058. if (ad && ad.length > 0 && ad[0].state == 0) {
  1059. if (that.freshen) {
  1060. await that.getBannerList(ad[0].module, ad[0].contentId);
  1061. }
  1062. } //首页专区
  1063. let homecolumn = that.homeTemplate.filter(it => it.module == that.templateType.module_homecolumn);
  1064. if (homecolumn.length > 0 && homecolumn[0].state == 0) {
  1065. let homecolumnimg = homecolumn[0].contentId.split(',');
  1066. if (homecolumnimg[0] != '' && homecolumnimg[1] != '' && homecolumnimg[2] != '') {
  1067. if (homecolumnimg.length == 3) {
  1068. // console.log(homecolumnimg);
  1069. that.setData({
  1070. homecolumnimg: homecolumnimg
  1071. });
  1072. }
  1073. }
  1074. } // 新客
  1075. let customers = that.homeTemplate.filter(it => it.module == that.templateType.module_customers);
  1076. if (customers && customers.length > 0 && customers[0].state == 0) {
  1077. that.setData({
  1078. customersTemplate: customers[0]
  1079. });
  1080. await that.customersListFun(customers[0]);
  1081. } //拼团
  1082. let joingroup = that.homeTemplate.filter(it => it.module == that.templateType.module_joingroup);
  1083. if (joingroup && joingroup.length > 0 && joingroup[0].state == 0) {
  1084. that.setData({
  1085. joingroupTemplate: joingroup[0]
  1086. });
  1087. await that.joingroupListFun(joingroup[0]);
  1088. } // 供应商
  1089. let supplier = that.homeTemplate.filter(it => it.module == that.templateType.module_supplier_premium);
  1090. if (supplier && supplier.length > 0 && supplier[0].state == 0) {
  1091. that.setData({
  1092. supplierTemplate: supplier[0]
  1093. });
  1094. if (that.freshen) {
  1095. await that.getsupplierList(supplier[0]);
  1096. }
  1097. } //秒杀
  1098. let seckill = that.homeTemplate.filter(it => it.module == that.templateType.module_seckill);
  1099. if (seckill && seckill.length > 0 && seckill[0].state == 0) {
  1100. that.setData({
  1101. seckillTemplate: seckill[0]
  1102. });
  1103. await that.seckillListFun(seckill[0]);
  1104. } //砍价
  1105. let bargain = that.homeTemplate.filter(it => it.module == that.templateType.module_bargain);
  1106. if (bargain && bargain.length > 0 && bargain[0].state == 0) {
  1107. that.setData({
  1108. bargainTemplate: bargain[0]
  1109. });
  1110. await that.bargainListFun(bargain[0]);
  1111. } //专题
  1112. let special = that.homeTemplate.filter(it => it.module == that.templateType.module_special);
  1113. if (special && special.length > 0 && special[0].state == 0) {
  1114. that.setData({
  1115. specialTemplate: special[0]
  1116. });
  1117. if (that.freshen) {
  1118. await that.getSpecialList(special[0]);
  1119. }
  1120. } //精选
  1121. let chosen = that.homeTemplate.filter(it => it.module == that.templateType.module_chosen);
  1122. if (chosen && chosen.length > 0 && chosen[0].state == 0) {
  1123. that.setData({
  1124. chosenTemplate: chosen[0]
  1125. });
  1126. if (that.freshen) {
  1127. await that.getBoutiqueList(chosen[0]);
  1128. } // }
  1129. } //团购
  1130. //新品上架
  1131. let arrivals = that.homeTemplate.filter(it => it.module == that.templateType.module_new_arrivals);
  1132. if (arrivals && arrivals.length > 0 && arrivals[0].state == 0) {
  1133. that.setData({
  1134. arrivalsTemplate: arrivals[0]
  1135. });
  1136. if (that.freshen) {
  1137. await that.getArrivalsList(arrivals[0]);
  1138. } // }
  1139. }
  1140. //热门爆款
  1141. let hot = that.homeTemplate.filter(it => it.module == that.templateType.module_hot_money);
  1142. if (hot && hot.length > 0 && hot[0].state == 0) {
  1143. that.setData({
  1144. hotTemplate: hot[0]
  1145. });
  1146. if (that.freshen) {
  1147. await that.getHotList(hot[0]);
  1148. } // }
  1149. }
  1150. let group = that.homeTemplate.filter(it => it.module == that.templateType.module_group);
  1151. if (group && group.length > 0 && group[0].state == 0) {
  1152. that.setData({
  1153. groupTemplate: group[0]
  1154. });
  1155. await that.loadGroup(group[0]);
  1156. }
  1157. //推荐产品
  1158. let recommend = that.homeTemplate.filter(it => it.module == that.templateType.module_recommend);
  1159. if (recommend && recommend.length > 0 && recommend[0].state == 0) {
  1160. that.setData({
  1161. recommendTemplate: recommend[0]
  1162. });
  1163. if (that.freshen) {
  1164. await that.getPageList();
  1165. }
  1166. }
  1167. //单产品推荐
  1168. let single = that.homeTemplate.filter(it => it.module == that.templateType.module_single_product);
  1169. if (single && single.length > 0 && single[0].state == 0) {
  1170. that.setData({
  1171. singleTemplate: single[0]
  1172. });
  1173. if (that.freshen) {
  1174. await that.getSinglePageList();
  1175. }
  1176. }
  1177. //品类专区
  1178. let p_list = that.homeTemplate.filter(it => it.module == that.templateType.module_p_list && it.state == 0);
  1179. // that.pCategoryList = p_list;
  1180. that.List = p_list;
  1181. console.log('p_list==',p_list)
  1182. if (that.freshen) {
  1183. // if (!that.pCategorShow) {
  1184. for (var i = 0; i < that.List.length; i++) {
  1185. await that.getPListProduct(that.List[i], i).then(data => {
  1186. data = data.map(it => {
  1187. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1188. return it;
  1189. });
  1190. var res = {
  1191. displayStyle: that.List[i].theme,
  1192. lineNumber: that.List[i].lineNumber,
  1193. products: data
  1194. };
  1195. that.List[i].productList = res;
  1196. let arr = [];
  1197. that.List.forEach(it => {
  1198. if (it.productList) {
  1199. it.pCategorShow = true;
  1200. arr.push(it);
  1201. }
  1202. });
  1203. that.pCategoryList = that.List;
  1204. if (arr.length == that.List.length) {
  1205. that.pCategorShow = true;
  1206. }
  1207. });
  1208. await that.getCateCoupon(that.List[i],i).then(suc=>{
  1209. that.List[i].couponList = suc;
  1210. })
  1211. }
  1212. // }
  1213. }
  1214. // 红包优惠券
  1215. let coupon = that.homeTemplate.filter(it => it.module == that.templateType.module_red_envelopes && app.globalData.isredenvelopes);
  1216. if (coupon && coupon.length > 0 && coupon[0].state == 0) {
  1217. if (!req.getStorage('userInfo')) {
  1218. that.setData({
  1219. iscouponAd: true,
  1220. couponAd: coupon[0]
  1221. });
  1222. } else {
  1223. req.getRequest(
  1224. '/api/coupon/checkCoupon',
  1225. {
  1226. id: coupon[0].contentId
  1227. },
  1228. res => {
  1229. if (res == 1) {
  1230. that.setData({
  1231. iscouponAd: true,
  1232. couponAd: coupon[0]
  1233. });
  1234. } else if (res == 0) {
  1235. that.setData({
  1236. iscouponAd: false
  1237. });
  1238. }
  1239. }
  1240. );
  1241. }
  1242. // console.log(coupon[0])
  1243. } else {
  1244. that.setData({
  1245. iscouponAd: false
  1246. });
  1247. }
  1248. // 供应商推荐
  1249. let supRecommend = that.homeTemplate.filter(it => it.module == that.templateType.module_sup_recommend);
  1250. if (supRecommend && supRecommend.length > 0 && supRecommend[0].state == 0) {
  1251. that.setData({
  1252. supRecommendTemplate: supRecommend[0]
  1253. });
  1254. if (that.freshen) {
  1255. await that.getSupRecommendList();
  1256. }
  1257. }
  1258. that.setData({
  1259. freshen: false
  1260. });
  1261. that.logo = true;
  1262. },
  1263. getBannerList(module, contentId) {
  1264. //banner图
  1265. let that = this;
  1266. return new Promise((resolve,reject)=>{
  1267. req.getRequest(
  1268. '/api/banner',
  1269. {
  1270. groupId: contentId
  1271. },
  1272. data => {
  1273. if (module == that.templateType.module_ad) {
  1274. that.setData({
  1275. bannerList: data,
  1276. bannerShow: true
  1277. });
  1278. } else {
  1279. that.setData({
  1280. popAdList: data[0]
  1281. });
  1282. }
  1283. resolve();
  1284. }
  1285. );
  1286. })
  1287. },
  1288. getCategory() {
  1289. //产品分类
  1290. let that = this;
  1291. // if (this.districtTemplate) {
  1292. // } else {
  1293. return new Promise((resolve,reject)=>{
  1294. req.getRequest(
  1295. '/api/category/list',
  1296. {
  1297. pid: 0
  1298. },
  1299. res => {
  1300. res = res.map((it, index) => {
  1301. it.index = index;
  1302. return it;
  1303. });
  1304. let newList = this.group(res, 8);
  1305. let data = newList; // .filter(it => it.length >= 8)
  1306. // console.log(newList, data, data.length);
  1307. if (data && data.length > 0 && data[0].length <= 4) {
  1308. this.setData({
  1309. swiperHeight: '100px'
  1310. });
  1311. } else {
  1312. this.setData({
  1313. swiperHeight: '200px'
  1314. });
  1315. }
  1316. that.setData({
  1317. categoryList: data
  1318. });
  1319. resolve();
  1320. }
  1321. );
  1322. })
  1323. // }
  1324. },
  1325. //产品分类优惠券
  1326. getCateCoupon(pCategory,idx){
  1327. let form = {
  1328. page: 1,
  1329. limit: 2,
  1330. categoryId: pCategory.contentId,
  1331. bindType: 'use'
  1332. }
  1333. return new Promise((resolve, reject) => {
  1334. req.getRequest('/api/coupon/list',form,data=>{
  1335. resolve(data);
  1336. })
  1337. })
  1338. },
  1339. // 动态产品分类
  1340. getPListProduct(pCategory, idx) {
  1341. // return new Promise((resolve, reject) => {
  1342. // console.log(idx)
  1343. let that = this;
  1344. let pList = [];
  1345. let form = {
  1346. limit: pCategory.number,
  1347. categoryId: pCategory.contentId // isRecommend:1
  1348. };
  1349. // //小店
  1350. if ((that.merchant && that.merchant.type == 5) || (that.shopId && that.merchantId)) {
  1351. form.merchantId = that.merchant.merchantDTO.id;
  1352. var sid = that.merchant.id;
  1353. if (that.shopId && that.merchantId) (form.merchantId = that.merchantId), (form.sid = that.shopId);
  1354. return new Promise((resolve, reject) => {
  1355. req.getRequest('/api/shopProduct/list', form, data => {
  1356. resolve(data);
  1357. });
  1358. });
  1359. }
  1360. //非小店
  1361. if (that.merchant && that.merchant.type != 5) {
  1362. form.merchantId = that.merchant.id;
  1363. return new Promise((resolve, reject) => {
  1364. req.getRequest('/api/product/list', form, data => {
  1365. resolve(data);
  1366. });
  1367. });
  1368. }
  1369. // })
  1370. },
  1371. //新客
  1372. customersListFun(customersTemplate) {
  1373. let _ts = this;
  1374. _ts.clearAllTimer(4);
  1375. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1376. let from = {
  1377. page: this.page,
  1378. limit: customersTemplate.number,
  1379. type: 6,
  1380. merchantId: this.merchant.merchantDTO.id,
  1381. sid: this.merchant.id
  1382. };
  1383. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1384. return new Promise((resolve,reject)=>{
  1385. req.getRequest('/api/shopProduct/list', from, res => {
  1386. res = res.list.map(it => {
  1387. it.isRemind = it.remindId;
  1388. return it;
  1389. });
  1390. let arrObjFilter;
  1391. arrObjFilter = {
  1392. displayStyle: customersTemplate.theme,
  1393. lineNumber: customersTemplate.lineNumber,
  1394. products: res.filter(ele => ele.end == false)
  1395. };
  1396. this.setData({
  1397. customersList: arrObjFilter,
  1398. customersShow: true
  1399. });
  1400. _ts.initGroupTimer(4);
  1401. resolve();
  1402. });
  1403. })
  1404. }
  1405. if (this.merchant && this.merchant.type != 5) {
  1406. let from = {
  1407. page: 1,
  1408. limit: customersTemplate.number,
  1409. type: 4,
  1410. tag: 'home'
  1411. };
  1412. from.merchantId = this.merchant.id;
  1413. return new Promise((resolve,reject)=>{
  1414. req.getRequest('/api/activity/list', from, data => {
  1415. data = data.map(it => {
  1416. it.isRemind = it.remindId;
  1417. return it;
  1418. });
  1419. let arrObjFilter;
  1420. arrObjFilter = {
  1421. displayStyle: customersTemplate.theme,
  1422. lineNumber: customersTemplate.lineNumber,
  1423. products: data.filter(ele => ele.end == false)
  1424. };
  1425. _ts.setData({
  1426. customersList: arrObjFilter,
  1427. customersShow: true
  1428. });
  1429. _ts.initGroupTimer(4);
  1430. resolve();
  1431. });
  1432. })
  1433. }
  1434. },
  1435. getSupRecommendList() {
  1436. return new Promise((resolve, reject) => {
  1437. req.getRequest('/api/supplier/recommend', {}, res => {
  1438. if (res && res.length > 0) {
  1439. this.supRecommendList = res;
  1440. this.supRecommendShow = true;
  1441. }
  1442. });
  1443. });
  1444. },
  1445. // 获取专题
  1446. getSpecialList(special) {
  1447. let that = this;
  1448. let form = {
  1449. page: 1,
  1450. limit: special.number
  1451. };
  1452. return new Promise((resolve, reject) => {
  1453. req.getRequest('/api/special/list', form, async data => {
  1454. if (data) {
  1455. for (var i = 0; i < data.length; i++) {
  1456. await that.getSpecialProduct(data[i].id).then(datas => {
  1457. var res = {
  1458. displayStyle: datas.displayStyle,
  1459. lineNumber: datas.lineNumber,
  1460. products: datas.products
  1461. };
  1462. data[i].productList = res;
  1463. that.specialList = data
  1464. });
  1465. }
  1466. }
  1467. resolve();
  1468. });
  1469. })
  1470. },
  1471. getSpecialProduct(id){
  1472. let form = {
  1473. id: id,
  1474. page: 1,
  1475. limit: 6
  1476. }
  1477. return new Promise((resolve, reject) => {
  1478. req.getRequest('/api/special/detail',form,data=>{
  1479. resolve(data);
  1480. })
  1481. })
  1482. },
  1483. //社区团购商品
  1484. loadGroup(groupTemplate) {
  1485. let _ts = this;
  1486. _ts.clearAllTimer(1);
  1487. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1488. let from = {
  1489. page: this.page,
  1490. limit: groupTemplate.number,
  1491. type: 2,
  1492. merchantId: this.merchant.merchantDTO.id,
  1493. sid: this.merchant.id
  1494. };
  1495. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1496. return new Promise((resolve,reject)=>{
  1497. req.getRequest('/api/shopProduct/list', from, res => {
  1498. res = res.list.map(it => {
  1499. it.isRemind = it.remindId;
  1500. return it;
  1501. });
  1502. let arrObjFilter;
  1503. arrObjFilter = {
  1504. displayStyle: groupTemplate.theme,
  1505. lineNumber: groupTemplate.lineNumber,
  1506. products: res.filter(ele => ele.end == false)
  1507. };
  1508. this.setData({
  1509. activityGroup: arrObjFilter,
  1510. activityGroupShow: true
  1511. });
  1512. _ts.initGroupTimer(1);
  1513. resolve();
  1514. });
  1515. })
  1516. }
  1517. if (this.merchant && this.merchant.type != 5) {
  1518. let from = {
  1519. page: 1,
  1520. limit: groupTemplate.number,
  1521. type: 1,
  1522. tag: 'home'
  1523. };
  1524. from.merchantId = this.merchant.id;
  1525. return new Promise((resolve,reject)=>{
  1526. req.getRequest('/api/activity/list', from, data => {
  1527. data = data.map(it => {
  1528. it.isRemind = it.remindId;
  1529. return it;
  1530. });
  1531. data = {
  1532. displayStyle: groupTemplate.theme,
  1533. lineNumber: groupTemplate.lineNumber,
  1534. products: data
  1535. };
  1536. _ts.setData({
  1537. activityGroup: data,
  1538. activityGroupShow: true
  1539. });
  1540. _ts.initGroupTimer(1);
  1541. resolve();
  1542. });
  1543. })
  1544. }
  1545. },
  1546. //拼团商品
  1547. joingroupListFun(joingroupTemplate) {
  1548. let _ts = this;
  1549. _ts.clearAllTimer(2);
  1550. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1551. let from = {
  1552. page: this.page,
  1553. limit: joingroupTemplate.number,
  1554. type: 4,
  1555. merchantId: this.merchant.merchantDTO.id,
  1556. sid: this.merchant.id
  1557. };
  1558. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1559. return new Promise((resolve,reject)=>{
  1560. req.getRequest('/api/shopProduct/list', from, res => {
  1561. res = res.list.map(it => {
  1562. it.isRemind = it.remindId;
  1563. return it;
  1564. });
  1565. let arrObjFilter;
  1566. arrObjFilter = {
  1567. displayStyle: joingroupTemplate.theme,
  1568. lineNumber: joingroupTemplate.lineNumber,
  1569. products: res.filter(ele => ele.end == false)
  1570. };
  1571. this.setData({
  1572. joingroupList: arrObjFilter,
  1573. joingroupShow: true
  1574. });
  1575. _ts.initGroupTimer(2);
  1576. resolve();
  1577. });
  1578. })
  1579. }
  1580. if (this.merchant && this.merchant.type != 5) {
  1581. let from = {
  1582. page: 1,
  1583. limit: joingroupTemplate.number,
  1584. type: 3,
  1585. dayType: 1,
  1586. tag: 'home'
  1587. };
  1588. from.merchantId = this.merchant.id;
  1589. return new Promise((resolve,reject)=>{
  1590. req.getRequest('/api/activity/listNew', from, data => {
  1591. data = data.list.map(it => {
  1592. it.isRemind = it.remindId;
  1593. return it;
  1594. });
  1595. let arrObjFilter;
  1596. arrObjFilter = {
  1597. displayStyle: joingroupTemplate.theme,
  1598. lineNumber: joingroupTemplate.lineNumber,
  1599. products: data.filter(ele => ele.end == false)
  1600. };
  1601. _ts.setData({
  1602. joingroupList: arrObjFilter,
  1603. joingroupShow: true
  1604. });
  1605. _ts.initGroupTimer(2);
  1606. resolve();
  1607. });
  1608. })
  1609. }
  1610. },
  1611. //砍价
  1612. bargainListFun(bargainTemplate) {
  1613. let _ts = this;
  1614. _ts.clearAllTimer(3);
  1615. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1616. let from = {
  1617. page: this.page,
  1618. limit: bargainTemplate.number,
  1619. type: 7,
  1620. merchantId: this.merchant.merchantDTO.id,
  1621. sid: this.merchant.id
  1622. };
  1623. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1624. return new Promise((resolve,reject)=>{
  1625. req.getRequest('/api/shopProduct/list', from, res => {
  1626. res = res.list.map(it => {
  1627. it.isRemind = it.remindId;
  1628. return it;
  1629. });
  1630. let arrObjFilter;
  1631. arrObjFilter = {
  1632. displayStyle: bargainTemplate.theme,
  1633. lineNumber: bargainTemplate.lineNumber,
  1634. products: res.filter(ele => ele.end == false)
  1635. };
  1636. this.setData({
  1637. bargainList: arrObjFilter,
  1638. bargainShow: true
  1639. });
  1640. _ts.initGroupTimer(3);
  1641. resolve();
  1642. });
  1643. })
  1644. }
  1645. if (this.merchant && this.merchant.type != 5) {
  1646. let from = {
  1647. page: 1,
  1648. limit: bargainTemplate.number,
  1649. type: 5,
  1650. tag: 'home'
  1651. };
  1652. from.merchantId = this.merchant.id;
  1653. return new Promise((resolve,reject)=>{
  1654. req.getRequest('/api/activity/listNew', from, data => {
  1655. data = data.list.map(it => {
  1656. it.isRemind = it.remindId;
  1657. return it;
  1658. });
  1659. let arrObjFilter;
  1660. arrObjFilter = {
  1661. displayStyle: bargainTemplate.theme,
  1662. lineNumber: bargainTemplate.lineNumber,
  1663. products: data.filter(ele => ele.end == false)
  1664. };
  1665. _ts.setData({
  1666. bargainList: arrObjFilter,
  1667. bargainShow: true
  1668. });
  1669. _ts.initGroupTimer(3);
  1670. resolve();
  1671. });
  1672. })
  1673. }
  1674. },
  1675. //秒杀商品
  1676. seckillListFun(seckillTemplate) {
  1677. let _ts = this;
  1678. _ts.clearAllTimer(5);
  1679. //获取小店推荐的产品
  1680. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1681. let from = {
  1682. page: this.page,
  1683. limit: seckillTemplate.number,
  1684. type: 3,
  1685. merchantId: this.merchant.merchantDTO.id,
  1686. sid: this.merchant.id
  1687. };
  1688. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1689. return new Promise((resolve,reject)=>{
  1690. req.getRequest('/api/shopProduct/list', from, res => {
  1691. res = res.list.map(it => {
  1692. it.isRemind = it.remindId;
  1693. return it;
  1694. });
  1695. let arrObjFilter;
  1696. arrObjFilter = {
  1697. displayStyle: seckillTemplate.theme,
  1698. lineNumber: seckillTemplate.lineNumber,
  1699. products: res.filter(ele => ele.end == false)
  1700. };
  1701. this.setData({
  1702. seckillList: arrObjFilter,
  1703. seckillShow: true
  1704. });
  1705. _ts.initGroupTimer(5);
  1706. resolve();
  1707. });
  1708. })
  1709. }
  1710. //获取门店推荐的产品
  1711. if (this.merchant && this.merchant.type != 5) {
  1712. let from = {
  1713. page: 1,
  1714. limit: seckillTemplate.number,
  1715. type: 2,
  1716. tag: 'home'
  1717. };
  1718. from.merchantId = this.merchant.id;
  1719. return new Promise((resolve,reject)=>{
  1720. req.getRequest('/api/activity/list', from, res => {
  1721. res = res.map(it => {
  1722. it.num = (it.sellStock / it.quantity) * 100;
  1723. it.isRemind = it.remindId;
  1724. return it;
  1725. });
  1726. res.sort(function(a, b) {
  1727. return Date.parse(a.startTime) - Date.parse(b.startTime);
  1728. });
  1729. let arrObjFilter;
  1730. arrObjFilter = {
  1731. displayStyle: seckillTemplate.theme,
  1732. lineNumber: seckillTemplate.lineNumber,
  1733. products: res.filter(ele => ele.end == false)
  1734. };
  1735. _ts.setData({
  1736. seckillList: arrObjFilter,
  1737. seckillShow: true
  1738. });
  1739. _ts.initGroupTimer(5);
  1740. resolve();
  1741. });
  1742. })
  1743. }
  1744. },
  1745. //1为社区团购,2为拼团,3为砍价
  1746. initGroupTimer(type) {
  1747. //社区拼图定时器
  1748. let _ts = this;
  1749. let list = [];
  1750. if (type == 1) list = this.activityGroup.products;
  1751. else if (type == 2) list = this.joingroupList.products;
  1752. else if (type == 3) list = this.bargainList.products;
  1753. else if (type == 4) list = this.customersList.products;
  1754. else if (type == 5) list = this.seckillList.products;
  1755. if (list && list.length > 0) {
  1756. // let activityGroup = this.data.activityGroup;
  1757. for (let i = 0, len = list.length; i < len; i++) {
  1758. let group = list[i];
  1759. let nowTime = new Date(group.nowTime.replace(/-/g, '/')).getTime();
  1760. let startTime = new Date(group.startTime.replace(/-/g, '/')).getTime();
  1761. let endTime = new Date(group.endTime.replace(/-/g, '/')).getTime();
  1762. if (!group.start) endTime = startTime;
  1763. let times = parseInt((endTime - nowTime) / 1000);
  1764. let timer = setInterval(() => {
  1765. times--;
  1766. let data = {};
  1767. if (times === 0) {
  1768. //重新加载列表
  1769. if (type == 1) data['activityGroup.products[' + i + '].end'] = true;
  1770. else if (type == 2) data['joingroupList.products[' + i + '].end'] = true;
  1771. else if (type == 3) data['bargainList.products[' + i + '].end'] = true;
  1772. else if (type == 4) data['customersList.products[' + i + '].end'] = true;
  1773. else if (type == 5) data['seckillList.products[' + i + '].end'] = true;
  1774. clearInterval(timer);
  1775. } else {
  1776. let n = utils.formatDayTimes(times);
  1777. if (type == 1) data['activityGroup.products[' + i + '].times'] = n;
  1778. else if (type == 2) data['joingroupList.products[' + i + '].times'] = n;
  1779. else if (type == 3) data['bargainList.products[' + i + '].times'] = n.split(/:|天/g);
  1780. else if (type == 4) data['customersList.products[' + i + '].times'] = n;
  1781. else if (type == 5) data['seckillList.products[' + i + '].times'] = n;
  1782. }
  1783. _ts.setData(data);
  1784. }, 1000);
  1785. if (type == 1) this.activityGroup.products[i]['timer'] = timer;
  1786. else if (type == 2) this.joingroupList.products[i]['timer'] = timer;
  1787. else if (type == 3) this.bargainList.products[i]['timer'] = timer;
  1788. else if (type == 4) this.customersList.products[i]['timer'] = timer;
  1789. // let fs = [];
  1790. else if (type == 5) this.seckillList.products[i]['timer'] = timer;
  1791. // fs['activityGroup[' + i + '].timer'] = timer;
  1792. // _ts.setData(fs);
  1793. }
  1794. }
  1795. },
  1796. getsupplierList(supplierTemplate) {
  1797. let form = {
  1798. page: 1,
  1799. limit: supplierTemplate.number,
  1800. merchantId: this.merchant.id,
  1801. supplier: supplierTemplate.contentId
  1802. }; // form.supplier="1351512705560240130"
  1803. return new Promise((resolve,reject)=>{
  1804. req.getRequest('/api/product/list', form, res => {
  1805. res = res.map(it => {
  1806. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1807. return it;
  1808. });
  1809. res = {
  1810. displayStyle: supplierTemplate.theme,
  1811. lineNumber: supplierTemplate.lineNumber,
  1812. products: res
  1813. };
  1814. this.setData({
  1815. supplierList: res,
  1816. supplierShow: true
  1817. });
  1818. resolve();
  1819. });
  1820. })
  1821. },
  1822. getBoutiqueList(boutiqueTemplate) {
  1823. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1824. let from = {
  1825. page: this.page,
  1826. limit: boutiqueTemplate.number,
  1827. type: 1,
  1828. merchantId: this.merchant.merchantDTO.id,
  1829. sid: this.merchant.id,
  1830. attr: 'boutique'
  1831. };
  1832. if (boutiqueTemplate.content != '') {
  1833. from.contentId = boutiqueTemplate.contentId;
  1834. }
  1835. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1836. return new Promise((resolve,reject)=>{
  1837. req.getRequest('/api/shopProduct/list', from, res => {
  1838. res = res.map(it => {
  1839. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1840. return it;
  1841. });
  1842. res = {
  1843. displayStyle: boutiqueTemplate.theme,
  1844. lineNumber: boutiqueTemplate.lineNumber,
  1845. products: res
  1846. };
  1847. this.setData({
  1848. boutiqueList: res,
  1849. boutiqueShow: true
  1850. });
  1851. resolve();
  1852. });
  1853. })
  1854. }
  1855. if (this.merchant && this.merchant.type != 5) {
  1856. let form = {
  1857. page: 1,
  1858. limit: boutiqueTemplate.number,
  1859. attr: 'boutique',
  1860. merchantId: this.merchant.id
  1861. };
  1862. if (boutiqueTemplate.content != '') {
  1863. form.contentId = boutiqueTemplate.contentId;
  1864. }
  1865. return new Promise((resolve,reject)=>{
  1866. req.getRequest('/api/product/list', form, res => {
  1867. res = res.map(it => {
  1868. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1869. return it;
  1870. });
  1871. res = {
  1872. displayStyle: boutiqueTemplate.theme,
  1873. lineNumber: boutiqueTemplate.lineNumber,
  1874. products: res
  1875. };
  1876. this.setData({
  1877. boutiqueList: res,
  1878. boutiqueShow: true
  1879. });
  1880. resolve();
  1881. });
  1882. })
  1883. }
  1884. },
  1885. // 新品上架
  1886. getArrivalsList(arrivalsTemplate) {
  1887. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1888. let from = {
  1889. page: this.page,
  1890. limit: arrivalsTemplate.number,
  1891. type: 1,
  1892. merchantId: this.merchant.merchantDTO.id,
  1893. sid: this.merchant.id,
  1894. attr: 'news'
  1895. };
  1896. if (arrivalsTemplate.content != '') {
  1897. from.contentId = arrivalsTemplate.contentId;
  1898. }
  1899. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1900. return new Promise((resolve,reject)=>{
  1901. req.getRequest('/api/shopProduct/list', from, res => {
  1902. res = res.map(it => {
  1903. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1904. return it;
  1905. });
  1906. res = {
  1907. displayStyle: arrivalsTemplate.theme,
  1908. lineNumber: arrivalsTemplate.lineNumber,
  1909. products: res
  1910. };
  1911. this.setData({
  1912. arrivalsList: res,
  1913. arrivalsShow: true
  1914. });
  1915. resolve();
  1916. });
  1917. })
  1918. }
  1919. if (this.merchant && this.merchant.type != 5) {
  1920. let form = {
  1921. page: 1,
  1922. limit: arrivalsTemplate.number,
  1923. attr: 'news',
  1924. merchantId: this.merchant.id
  1925. };
  1926. if (arrivalsTemplate.content != '') {
  1927. form.contentId = arrivalsTemplate.contentId;
  1928. }
  1929. return new Promise((resolve,reject)=>{
  1930. req.getRequest('/api/product/list', form, res => {
  1931. res = res.map(it => {
  1932. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1933. return it;
  1934. });
  1935. res = {
  1936. displayStyle: arrivalsTemplate.theme,
  1937. lineNumber: arrivalsTemplate.lineNumber,
  1938. products: res
  1939. };
  1940. this.setData({
  1941. arrivalsList: res,
  1942. arrivalsShow: true
  1943. });
  1944. resolve();
  1945. });
  1946. })
  1947. }
  1948. },
  1949. // 热门爆款
  1950. getHotList(hotTemplate) {
  1951. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  1952. let from = {
  1953. page: this.page,
  1954. limit: hotTemplate.number,
  1955. type: 1,
  1956. merchantId: this.merchant.merchantDTO.id,
  1957. sid: this.merchant.id,
  1958. attr: 'sell_well'
  1959. };
  1960. if (hotTemplate.content != '') {
  1961. from.contentId = hotTemplate.contentId;
  1962. }
  1963. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  1964. return new Promise((resolve,reject)=>{
  1965. req.getRequest('/api/shopProduct/list', from, res => {
  1966. res = res.map(it => {
  1967. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1968. return it;
  1969. });
  1970. res = {
  1971. displayStyle: hotTemplate.theme,
  1972. lineNumber: hotTemplate.lineNumber,
  1973. products: res
  1974. };
  1975. this.setData({
  1976. hotList: res,
  1977. hotShow: true
  1978. });
  1979. resolve();
  1980. });
  1981. })
  1982. }
  1983. if (this.merchant && this.merchant.type != 5) {
  1984. let form = {
  1985. page: 1,
  1986. limit: hotTemplate.number,
  1987. attr: 'sell_well',
  1988. merchantId: this.merchant.id
  1989. };
  1990. if (hotTemplate.content != '') {
  1991. form.contentId = hotTemplate.contentId;
  1992. }
  1993. return new Promise((resolve,reject)=>{
  1994. req.getRequest('/api/product/list', form, res => {
  1995. res = res.map(it => {
  1996. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  1997. return it;
  1998. });
  1999. res = {
  2000. displayStyle: hotTemplate.theme,
  2001. lineNumber: hotTemplate.lineNumber,
  2002. products: res
  2003. };
  2004. this.setData({
  2005. hotList: res,
  2006. hotShow: true
  2007. });
  2008. resolve();
  2009. });
  2010. })
  2011. }
  2012. },
  2013. getPageList() {
  2014. //Recommend
  2015. // console.log(this.isLoad); // if (!this.data.isLoad) return false;
  2016. // this.data.isLoad = false;
  2017. let that = this;
  2018. console.log('门店' + this.merchantId);
  2019. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  2020. let from = {
  2021. page: that.page,
  2022. limit: that.recommendTemplate.number,
  2023. type: 1,
  2024. merchantId: this.merchant.merchantDTO.id,
  2025. sid: this.merchant.id,
  2026. attr: 'Recommend'
  2027. };
  2028. if (that.recommendTemplate.content != '') {
  2029. from.contentId = that.recommendTemplate.contentId;
  2030. }
  2031. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  2032. return new Promise((resolve,reject)=>{
  2033. req.getRequest('/api/shopProduct/list', from, data => {
  2034. if (data && data.length >= 10) that.isLoad = true;
  2035. if (that.page > 1) data = that.pageList.concat(data);
  2036. // console.log(data);
  2037. data = data.map(it => {
  2038. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  2039. return it;
  2040. });
  2041. data = {
  2042. displayStyle: that.recommendTemplate.theme,
  2043. lineNumber: that.recommendTemplate.lineNumber,
  2044. products: data
  2045. };
  2046. that.setData({
  2047. pageList: data,
  2048. hasmore: data && data.length > 0,
  2049. recommendShow: true
  2050. });
  2051. resolve();
  2052. });
  2053. })
  2054. }
  2055. if (this.merchant && this.merchant.type != 5) {
  2056. let form = {
  2057. page: that.page,
  2058. limit: that.recommendTemplate.number,
  2059. attr: 'Recommend',
  2060. merchantId: this.merchant.id
  2061. };
  2062. if (that.recommendTemplate.content != '') {
  2063. form.contentId = that.recommendTemplate.contentId;
  2064. }
  2065. return new Promise((resolve,reject)=>{
  2066. req.getRequest('/api/product/list', form, res => {
  2067. if (res && res.length >= 10) that.isLoad = true;
  2068. if (that.page > 1) res = that.pageList.concat(res);
  2069. res = res.map(it => {
  2070. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  2071. return it;
  2072. });
  2073. res = {
  2074. displayStyle: that.recommendTemplate.theme,
  2075. lineNumber: that.recommendTemplate.lineNumber,
  2076. products: res
  2077. };
  2078. that.setData({
  2079. pageList: res,
  2080. hasmore: res && res.length > 0,
  2081. recommendShow: true
  2082. });
  2083. resolve();
  2084. });
  2085. })
  2086. }
  2087. },
  2088. getSinglePageList() {
  2089. //Recommend
  2090. // console.log(this.isLoad); // if (!this.data.isLoad) return false;
  2091. // this.data.isLoad = false;
  2092. let that = this;
  2093. console.log('门店' + this.merchantId);
  2094. if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
  2095. let from = {
  2096. page: that.singlePage,
  2097. limit: that.singleTemplate.number,
  2098. type: 1,
  2099. merchantId: this.merchant.merchantDTO.id,
  2100. sid: this.merchant.id
  2101. };
  2102. if (that.singleTemplate.content != '') {
  2103. from.contentId = that.singleTemplate.contentId;
  2104. delete from.attr;
  2105. } else {
  2106. from.attr = 'Recommend';
  2107. }
  2108. if (this.shopId && this.merchantId) (from.merchantId = this.merchantId), (from.sid = this.shopId);
  2109. return new Promise((resolve,reject)=>{
  2110. req.getRequest('/api/shopProduct/list', from, data => {
  2111. if (data && data.length >= 10) that.isLoadSingle = true;
  2112. if (that.singlePage > 1) data = that.singleList.concat(data);
  2113. // console.log(data);
  2114. data = data.map(it => {
  2115. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  2116. return it;
  2117. });
  2118. data = {
  2119. displayStyle: that.singleTemplate.theme,
  2120. lineNumber: that.singleTemplate.lineNumber,
  2121. products: data
  2122. };
  2123. that.setData({
  2124. singleList: data,
  2125. hasmoreSingle: data && data.length > 0,
  2126. singleShow: true
  2127. });
  2128. resolve();
  2129. });
  2130. })
  2131. }
  2132. if (this.merchant && this.merchant.type != 5) {
  2133. let form = {
  2134. page: that.singlePage,
  2135. limit: that.singleTemplate.number,
  2136. merchantId: this.merchant.id
  2137. };
  2138. if (that.singleTemplate.content != '') {
  2139. form.contentId = that.singleTemplate.contentId;
  2140. delete form.attr;
  2141. } else {
  2142. form.attr = 'Recommend';
  2143. }
  2144. return new Promise((resolve,reject)=>{
  2145. req.getRequest('/api/product/list', form, res => {
  2146. if (res && res.length >= 10) that.isLoadSingle = true;
  2147. if (that.singlePage > 1) res = that.singleList.concat(res);
  2148. res = res.map(it => {
  2149. if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it.isJs = true;
  2150. return it;
  2151. });
  2152. res = {
  2153. displayStyle: that.singleTemplate.theme,
  2154. lineNumber: that.singleTemplate.lineNumber,
  2155. products: res
  2156. };
  2157. that.setData({
  2158. singleList: res,
  2159. hasmoreSingle: res && res.length > 0,
  2160. singleShow: true
  2161. });
  2162. resolve();
  2163. });
  2164. })
  2165. }
  2166. },
  2167. getOfficeList() {
  2168. let form = {
  2169. page: 1,
  2170. limit: 4,
  2171. orderType: 1
  2172. }
  2173. return new Promise((resolve,reject)=>{
  2174. req.getRequest('/api/v3/moments/list', form, res => {
  2175. if(res&&res.length > 0){
  2176. res.map(it=>{
  2177. if(it.url){
  2178. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  2179. if(h.indexOf('mp4')<0&&h.indexOf('MP4')<0){
  2180. it.url = it.url.split(',');
  2181. }else{
  2182. it.isHaveVideo = true
  2183. it.isControls = false
  2184. it.isShowPlayBtn = true
  2185. }
  2186. }
  2187. it.content = '<div style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;word-break: break-all;">' + it.content + '</div>'
  2188. return it;
  2189. })
  2190. }
  2191. this.officeList = res;
  2192. resolve();
  2193. })
  2194. })
  2195. },
  2196. toDetail(e) {
  2197. let id = e.currentTarget.dataset.id;
  2198. let url = e.currentTarget.dataset.url;
  2199. app.globalData.openPage('product/detail/detail?id=' + id + url); // app.openPage("product/detail/detail?id=" + id)
  2200. },
  2201. // 新客列表
  2202. tocustomersList(event) {
  2203. const index = event.currentTarget.dataset.index;
  2204. const activity = this.customersList.products[index];
  2205. const url = event.currentTarget.dataset.url;
  2206. app.globalData.openPage('activity/newbornDetails/newbornDetails?acid=' + activity.id + '&id=' + activity.productId + url); // app.openPage('activity/newbornDetails/newbornDetails?acid=' + activity.id + "&id=" + activity.productId);
  2207. },
  2208. addShopCart(e) {
  2209. let state = e.currentTarget.dataset.state;
  2210. let skuId = e.currentTarget.dataset.skuid;
  2211. let id = e.currentTarget.dataset.id;
  2212. let _ts = this;
  2213. let params = {
  2214. skuId: skuId,
  2215. quantity: 1,
  2216. merchantId: this.merchant.id,
  2217. productId: id
  2218. }; // if(state!=1){
  2219. // return req.msg('您来晚了,商品已经下架')
  2220. // }
  2221. req.postRequest('/api/purchase/cart', params, res => {
  2222. _ts.setData({
  2223. isUpdate: !_ts.isUpdate
  2224. });
  2225. req.msg('加入购物车成功');
  2226. });
  2227. },
  2228. toGroupRemind(event) {
  2229. const index = event.currentTarget.dataset.index;
  2230. const activity = this.activityGroup.products[index];
  2231. const url = event.currentTarget.dataset.url;
  2232. app.globalData.openPage('product/groupDetail/groupDetail?acid=' + activity.id + '&id=' + activity.productId + url); // app.openPage('product/groupDetail/groupDetail?acid=' + activity.id + "&id=" + activity.productId);
  2233. },
  2234. toSeckillList(event) {
  2235. const index = event.currentTarget.dataset.index;
  2236. const activity = this.seckillList[index];
  2237. const url = event.currentTarget.dataset.url;
  2238. app.globalData.openPage('activity/seckillDetails/seckillDetails?acid=' + activity.id + '&id=' + activity.productId + url); // app.openPage('activity/seckillDetails/seckillDetails?acid=' + activity.id + "&id=" + activity.productId);
  2239. },
  2240. addActivityRemind(event) {
  2241. const index = event.currentTarget.dataset.index;
  2242. const id = event.currentTarget.dataset.id;
  2243. const type = event.currentTarget.dataset.type; // if(req.getStorage('userInfo')){
  2244. // }
  2245. req.postRequest(
  2246. '/api/activity/remind',
  2247. {
  2248. activityId: id
  2249. },
  2250. res => {
  2251. mes.remind().then(res => res);
  2252. // mes.remind().then(res=>res)
  2253. // mes.requsetmessage()
  2254. req.msg('订阅提醒成功');
  2255. let data = {};
  2256. if (type == 1) data['activityGroup.products[' + index + '].isRemind'] = true;
  2257. else if (type == 2) data['joingroupList.products[' + index + '].isRemind'] = true;
  2258. else if (type == 3) data['seckillList.products[' + index + '].isRemind'] = true;
  2259. else if (type == 4) data['bargainList.products[' + index + '].isRemind'] = true;
  2260. else if (type == 5) data['customersList.products[' + index + '].isRemind'] = true;
  2261. this.setData(data);
  2262. }
  2263. );
  2264. },
  2265. group(array, subGroupLength) {
  2266. let index = 0;
  2267. let newArray = [];
  2268. while (index < array.length) {
  2269. newArray.push(array.slice(index, (index += subGroupLength)));
  2270. }
  2271. return newArray;
  2272. },
  2273. cancelActivityRemind(event) {
  2274. const index = event.currentTarget.dataset.index;
  2275. const id = event.currentTarget.dataset.id;
  2276. const type = event.currentTarget.dataset.type;
  2277. if (req.header.appId == 'ZQ1VK5oc17I387E') {
  2278. } else {
  2279. req.postRequest(
  2280. '/api/activity/cancel/remind',
  2281. {
  2282. id: id
  2283. },
  2284. res => {
  2285. req.msg('取消提醒成功');
  2286. let data = {};
  2287. if (type == 1) data['activityGroup.products[' + index + '].isRemind'] = false;
  2288. else if (type == 2) data['joingroupList.products[' + index + '].isRemind'] = false;
  2289. else if (type == 3) data['seckillList.products[' + index + '].isRemind'] = false;
  2290. else if (type == 4) data['bargainList.products[' + index + '].isRemind'] = false;
  2291. else if (type == 5) data['customersList.products[' + index + '].isRemind'] = false;
  2292. this.setData(data);
  2293. }
  2294. );
  2295. }
  2296. },
  2297. clearAllTimer(type) {
  2298. // console.log(this.activityGroup, this.joingroupList, this.bargainList, this.customersList);
  2299. if (type == 1) {
  2300. this.activityGroup.products.forEach(it => clearInterval(it.timer));
  2301. this.activityGroup.products.forEach(it => clearInterval(it.times));
  2302. } else if (type == 2) {
  2303. this.joingroupList.products.forEach(it => clearInterval(it.timer));
  2304. this.joingroupList.products.forEach(it => clearInterval(it.times));
  2305. } else if (type == 3) {
  2306. this.bargainList.products.forEach(it => clearInterval(it.timer));
  2307. this.bargainList.products.forEach(it => clearInterval(it.times));
  2308. } else if (type == 4) {
  2309. this.customersList.products.forEach(it => clearInterval(it.timer));
  2310. this.customersList.products.forEach(it => clearInterval(it.times));
  2311. } else if (type == 5) {
  2312. this.seckillList.products.forEach(it => clearInterval(it.timer));
  2313. this.seckillList.products.forEach(it => clearInterval(it.times));
  2314. }
  2315. },
  2316. hideGuide() {
  2317. //关闭提示加入我的小程序
  2318. this.setData({
  2319. first: false
  2320. });
  2321. req.setStorage('first', false);
  2322. },
  2323. hideAd() {
  2324. //关闭广告
  2325. // if(this.data.first==false){
  2326. this.setData({
  2327. isLayerAd: false
  2328. }); // }
  2329. app.globalData.isLayerAd = false;
  2330. },
  2331. click(e) {
  2332. // console.log(e)
  2333. this.storeShow = e;
  2334. },
  2335. goUrl(event) {
  2336. //跳转链接
  2337. let url = event.currentTarget.dataset.url;
  2338. app.globalData.openPage(url);
  2339. },
  2340. },
  2341. beforeMount() {
  2342. const systemInfo = uni.getSystemInfoSync();
  2343. console.log('systemInfo==',systemInfo)
  2344. // px转换到rpx的比例
  2345. let pxToRpxScale = 750 / systemInfo.windowWidth;
  2346. this.pxToRpxScale = pxToRpxScale;
  2347. let systems = {
  2348. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  2349. navigationHeight: 44 * pxToRpxScale, // 导航栏的高度
  2350. windowHeight: systemInfo.screenHeight * pxToRpxScale ,// 导航栏的高度
  2351. safeBottomHeight: systemInfo.safeAreaInsets.bottom * pxToRpxScale
  2352. };
  2353. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  2354. systems.windowHeights = systems.windowHeight - 115- systems.safeBottomHeight;
  2355. // this.sheight = (500/pxToRpxScale)/2;
  2356. this.systems = systems;
  2357. console.log('systems==',systems)
  2358. },
  2359. onPageScroll(e) {
  2360. this.clientData.pageY = e.scrollTop;
  2361. let height = this.systems.barHeight/this.pxToRpxScale;
  2362. if (e.scrollTop > height) {
  2363. this.isScroll = true;
  2364. } else {
  2365. this.isScroll = false;
  2366. }
  2367. }
  2368. };
  2369. </script>
  2370. <style>
  2371. page{background-color: #fff;}
  2372. </style>
  2373. <style>
  2374. @import './index_yaofang.css';
  2375. </style>