index.vue 73 KB

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