| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803 |
- <template>
- <view :style="[mainStyle]" v-if="showPage" style="background:#fff;">
- <view :class="'top-f' + (isScroll ? ' top-background' : '')" :style="'height:' + systems.barHeight + 'rpx;'"
- v-if="isSoution || (config&&config.is_hide_searchBox != 1)">
- <!-- #ifdef MP-WEIXIN -->
- <view class="top-nav ddflex"
- :style="'height:' + systems.navigationHeight + 'rpx;top:' + systems.ktxStatusHeight + 'rpx;'">
- <view class="top-home ddflex" @click="jumpHome()" v-if="isSoution">
- <image :src="picUrlss+'lvluo/home_ico.png'"></image>
- </view>
- <view class="search ddflex" @click="jumpUrl('/pages/search/search')"
- v-if="config&&config.is_hide_searchBox != 1">
- <image src="../../static/pages/images/ssico_white.png"></image>
- <view>找药品/搜品牌</view>
- </view>
- </view>
- <!-- #endif -->
- <!-- #ifndef MP-WEIXIN -->
- <view class="top-navc ddflex"
- :style="'height:' + systems.navigationHeight + 'rpx;top:' + systems.ktxStatusHeight + 'rpx;'">
- <view class="searchc ddflex" @click="jumpUrl('/pages/search/search')"
- v-if="config&&config.is_hide_searchBox != 1">
- <image src="../../static/pages/images/ssico_white.png"></image>
- <view>找药品/搜品牌</view>
- </view>
- </view>
- <!-- #endif -->
- </view>
- <view @touchstart="touchStart" @touchmove="move" @touchend="end">
- <view class="cons">
- <view :class="'banner'+(config.only_show_card == 1?' banner-bg':'')">
- <image :src="merchant.mainGraph" mode="aspectFill" :style="'height:'+(500+conTop) + 'rpx;'"
- :class="isPlay==1?'isPlay':isPlay==2?'isPlaasf':''"></image>
- </view>
- <!-- <view @click="saoma()" style="z-index: 999;position: relative;">扫码</view> -->
- <view class="con-ss" :style="'top:'+conTop+'rpx'">
- <view class="top">
- <view class="merchant ddflex" v-if="merchant">
- <image :src="merchant.logo" mode="aspectFill" class="m-logo"></image>
- <view class="fflex" v-if="merchant && merchant.title">
- <view class="m-name ddflex">
- <view class="fflex tover" @click="jumpUrl('/topic/about/about?id='+merchant.id)">
- {{ getMerchantTitle() }}
- </view>
- <view class="change ddflex" @click="merchantFun()" v-if="config.Many_Store == 1">
- <image src="../../static/pages/images/change.png"></image>
- </view>
- </view>
- <view class="poi" v-if="merchant.addressBrief || merchant.mDistance || merchant.range">
- <block v-if="merchant.addressBrief">{{merchant.addressBrief}}<text
- v-if="merchant.addressBrief&&(merchant.mDistance||merchant.range)">·</text>
- </block>
- <block v-if="merchant.mDistance||merchant.range">
- 距离{{merchant.mDistance < 1000 ? merchant.mDistance+'m' : merchant.range+'km'}}
- </block>
- </view>
- <view class="m-bot ddflex" v-if="merchant.label">
- <view class="m-tag ddflex fflex">
- <text v-for="(it,idx) in merchant.label.split(',')" :key="idx">{{it}}</text>
- </view>
- <!-- <image :src="picUrlss+'lvluo/gsjs_ico.png'" class="gsjs-ico" @click.stop="jumpUrl('/topic/about/about')"></image> -->
- </view>
- </view>
- <view class="fflex" v-else>
- <view class="m-name ddflex">
- 绿萝云·私域诊所系统
- <image src="../../static/pages/images/change.png"></image>
- </view>
- <view class="m-bot ddflex">
- <view class="m-tag ddflex fflex">
- <text>医疗营业许可</text>
- <text>到店分期</text>
- </view>
- <image :src="picUrlss+'lvluo/gsjs_ico.png'" class="gsjs-ico"
- @click.stop="jumpUrl('/topic/about/about')"></image>
- </view>
- </view>
- </view>
- <view :class="'card'+(config.only_show_card == 1?' card-spe':'')"
- :style="'height:'+cardHeight+'rpx;'">
- <image :src="picUrlss+'lvluo/logo_lv.png'" class="logo"></image>
- <image :src="picUrlss+'lvluo/card_logo.png'" mode="heightFix" class="card-logo"></image>
- <view class="card-top">
- <view class="card-no">NO.{{userinfoVip.userCode?userinfoVip.userCode:'000000'}}</view>
- <view class="card-info ddflex">
- <view class="fflex">
- <view class="card-name">{{userinfoVip.levelName?userinfoVip.levelName:'会员卡'}}
- </view>
- <view class="card-user">
- {{userinfoVip.realName?userinfoVip.realName:userinfoVip.nickName?userinfoVip.nickName:'代名'}}<text>{{userinfoVip.cardNo ? userinfoVip.cardNo:'8888**********8888'}}</text>
- </view>
- </view>
- <image :src="picUrlss +config.mainIconPath+ 'card_ma.png'" class="card-ma"
- @click="checkUpdate('/mine/payCode/payCode')" v-if="config.mainIconPath">
- </image>
- <image :src="picUrlss+ 'lvluo/card_ma.png'" class="card-ma"
- @click="checkUpdate('/mine/payCode/payCode')" v-else></image>
- </view>
- <image :src="userinfoVip.icon" mode="heightFix" class="vip-img" v-if="userinfoVip.icon">
- </image>
- </view>
- <view class="card-bot">
- <view class="datas ddflex">
- <view class="li" @click="checkUpdate('/wallet/index/index')">
- <view class="numbers" v-if="isShowBalance">
- {{userInfo.balance ? userInfo.balance : 0}}
- </view>
- <view class="numbers" v-else>****</view>
- <view class="ddflex">余额
- <image
- :src="picUrlss +config.mainIconPath+(isShowBalance?'eye_shows.png':'eye_hides.png')"
- class="card-eye" @click.stop="optBalance" v-if="config.mainIconPath">
- </image>
- <image
- :src="picUrlss +(isShowBalance?'lvluo/eye_shows.png':'lvluo/eye_hides.png')"
- class="card-eye" @click.stop="optBalance" v-else></image>
- </view>
- </view>
- <view class="li" @click="jumpUrl('/service/secondCard/secondCard')">
- <view class="numbers">{{cardCount?cardCount:0}}</view>
- <view>权益卡</view>
- </view>
- <view class="li" @click="jumpUrl('/mine/coupons/coupons')">
- <view class="numbers">{{userInfo.coupon?userInfo.coupon:0}}</view>
- <view>优惠券</view>
- </view>
- </view>
- <block v-if="config.is_not_fixed_contact == 1">
- <view class="zhuanshu-box" v-if="advisor&&advisor.id">
- <view class="zhuanshu-t ddflex">
- <image :src="picUrlss+config.mainIconPath+'card_zhuanshu.png'"
- v-if="config.mainIconPath"></image>
- <image :src="picUrlss+'lvluo/card_zhuanshu.png'" v-else></image>
- </view>
- <view class="zhuanshu-info ddflex" @click="jumpSingleChatRoom()">
- <image
- :src="advisor.headUrl ? advisor.headUrl : picUrlss+'lvluo/zhuanshu_img.png'"
- mode="aspectFill" class="zhuanshu-img"></image>
- <view class="fflex">
- <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>
- <view class="zhuanshu-mobile tover">
- <!-- {{advisor.mobile}} -->{{advisor.merchantTitle}}
- </view>
- </view>
- <image :src="picUrlss+config.mainIconPath+'zhuanshu_weixin.png'"
- class="zhuanshu-weixin" v-if="config.mainIconPath"></image>
- <image :src="picUrlss+'lvluo/zhuanshu_weixin.png'" class="zhuanshu-weixin"
- v-else></image>
- </view>
- </view>
- <button open-type="contact" hover-class="none" class="zhuanshu-box" v-else>
- <view class="zhuanshu-t ddflex">
- <image :src="picUrlss+config.mainIconPath+'card_zhuanshu.png'"
- v-if="config.mainIconPath"></image>
- <image :src="picUrlss+'lvluo/card_zhuanshu.png'" v-else></image>
- </view>
- <view class="zhuanshu-info ddflex">
- <image :src="picUrlss+'lvluo/zhuanshu_img.png'" mode="aspectFill"
- class="zhuanshu-img"></image>
- <view class="fflex">
- <view class="zhuanshu-name ddflex">官方客服</view>
- </view>
- <image :src="picUrlss+config.mainIconPath+'zhuanshu_weixin.png'"
- class="zhuanshu-weixin" v-if="config.mainIconPath"></image>
- <image :src="picUrlss+'lvluo/zhuanshu_weixin.png'" class="zhuanshu-weixin"
- v-else></image>
- </view>
- </button>
- </block>
- <block v-else>
- <view class="zhuanshu-box" v-if="doctor&&doctor.id">
- <view class="zhuanshu-t1 ddflex">
- <image :src="picUrlss+config.mainIconPath+'card_zhuanshu.png'"
- v-if="config.mainIconPath"></image>
- <image :src="picUrlss+'lvluo/card_zhuanshu.png'" v-else></image>
- </view>
- <view class="zhuanshu-info ddflex"
- @click="jumpUrl('/topic/teacherDet/teacherDet?id='+doctor.id)">
- <image
- :src="doctor.headUrl ? doctor.headUrl : picUrlss+'lvluo/zhuanshu_img.png'"
- mode="aspectFill" class="zhuanshu-img"></image>
- <view class="fflex">
- <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>
- <view class="zhuanshu-mobile">{{doctor.mobile}}</view>
- </view>
- <image :src="picUrlss+config.mainIconPath+'zhuanshu_weixin.png'"
- class="zhuanshu-weixin" v-if="config.mainIconPath"></image>
- <image :src="picUrlss+'lvluo/zhuanshu_weixin.png'" class="zhuanshu-weixin"
- v-else></image>
- </view>
- </view>
- </block>
- </view>
- <!-- #ifdef MP-WEIXIN -->
- <button class="open-card ddflex" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
- hover-class="none"
- v-if="!userinfoVip.levelGrade || (userinfoVip.levelGrade > 0 && userinfoVip.end)">
- <image :src="picUrlss+'lvluo/open_ico.png'"></image>
- <view>一键领取会员卡</view>
- </button>
- <!-- #endif -->
- <!-- #ifndef MP-WEIXIN -->
- <view class="open-card ddflex" @click="getGVip()" hover-class="none"
- v-if="!userinfoVip.levelGrade || (userinfoVip.levelGrade > 0 && userinfoVip.end)">
- <image :src="picUrlss+'lvluo/open_ico.png'"></image>
- <view>一键领取会员卡</view>
- </view>
- <!-- #endif -->
- </view>
- </view>
- <view v-for="(item, index) in contact" :key="index">
- <storeOptions
- v-if="item == 'store_options' || (item == 'sou' && top) || (item == 'type_district' && top_type)"
- :storeTemplate="storeTemplate" :merchant="merchant" :about="about" :guarantee="guarantee"
- :sousuoTemplate="sousuoTemplate" :typeDistrictTemplate="typeDistrictTemplate" :url="site"
- :web="url" :cloud="header.appId == 'ZQ1VK5oc17I387E' ? 'default' : ''"></storeOptions>
- <!-- 多门店选择模板和搜索模板 -->
- <popAd v-if="item == 'home_pop_up_ads'" :first="first" :popAdTemplate="popAdTemplate"
- :isLayerAd="isLayerAd" :popAdList="popAdList" :iscouponAd="iscouponAd"
- :storeShow="storeShow"></popAd>
- <!-- 弹窗广告 -->
- <banner v-if="item == 'ad' && bannerShow" :bannerList="bannerList" :url="site" :web="url"
- :config="about" :couponList="couponList" :officeList="officeList"
- :districtTemplate="districtTemplate"></banner>
- <!-- 走马灯 -->
- <bargain v-if="item == 'bargain' && bargainShow" :bargainList="bargainList" :url="site"
- :web="url" :bargainTemplate="bargainTemplate"></bargain>
- <!-- 砍价 -->
- <customers v-if="item == 'New_customers' && customersShow" :customersList="customersList"
- :url="site" :web="url" :customersTemplate="customersTemplate"></customers>
- <!-- 新客 -->
- <homecolumn v-if="item == 'homecolumn' && homecolumnShow" :homecolumnimg="homecolumnimg"
- :merchant-list="merchantList" :config="about"></homecolumn>
- <!-- 首页专区 -->
- <joingroup v-if="item == 'joingroup' && joingroupShow" :joingroupList="joingroupList"
- :url="site" :web="url" :joingroupTemplate="joingroupTemplate"></joingroup>
- <!-- 拼团 -->
- <group v-if="item == 'group' && activityGroupShow" :activityGroup="activityGroup" :url="site"
- :web="url" :groupTemplate="groupTemplate" :merchant="merchant" :freshen="freshen"></group>
- <!-- 社区团购 -->
- <!-- <pCategoryList
- v-if="item == 'p_list'"
- :homeTemplate="homeTemplate"
- :url="site"
- :web="url"
- :about="about"
- :templateType="templateType"
- :merchant="merchant"
- :freshen="freshen"
- :pCategoryList="pCategoryList"
- :pCategorShow="pCategorShow"
- ></pCategoryList> -->
- <block v-if="item == 'p_list'">
- <block v-for="(categoryItem, idx) in pCategoryList" :key="idx">
- <pCategoryList :homeTemplate="homeTemplate" :url="site" :web="url" :about="about"
- :templateType="templateType" :merchant="merchant" :freshen="freshen"
- :pCategorShow="categoryItem.pCategorShow" :categoryItem="categoryItem">
- </pCategoryList>
- </block>
- </block>
- <!-- 分类 -->
- <recommend v-if="item == 'recommend' && recommendShow" :pageList="pageList"
- :recommendTemplate="recommendTemplate" :url="site" :web="url" :about="about"
- :categoryList="categoryList"></recommend>
- <!-- 推荐 -->
- <seckill v-if="item == 'seckill' && seckillShow" :seckillList="seckillList" :url="site"
- :web="url" :seckillTemplate="seckillTemplate"></seckill>
- <!-- 秒杀 -->
- <selected v-if="item == 'chosen' && boutiqueShow" :boutiqueList="boutiqueList"
- :chosenTemplate="chosenTemplate" :url="site" :web="url" :about="about"></selected>
- <!-- 精选 -->
- <arrivals v-if="item == 'new_arrivals' && arrivalsShow" :arrivalsList="arrivalsList"
- :arrivalsTemplate="arrivalsTemplate" :url="site" :web="url" :about="about"></arrivals>
- <!-- 新品上架 -->
- <hot v-if="item == 'hot_money' && hotShow" :hotList="hotList" :hotTemplate="hotTemplate"
- :url="site" :web="url" :about="about"></hot>
- <!-- 热门爆款 -->
- <specialTopic v-if="item == 'special'" :specialList="specialList"></specialTopic>
- <!-- 专题 -->
- <redEnvelopes v-if="item == 'red_envelopes'" :storeShow="storeShow" :iscouponAd="iscouponAd"
- :first="first" :couponAd="couponAd" @iscouponAd="hidecouponAd"></redEnvelopes>
- <!-- 红包 -->
- <supplier v-if="item == 'supplier_premium' && supplierShow" :supplierTemplate="supplierTemplate"
- :web="merchant.type == 5 ? web : url" :supplierList="supplierList" :about="about">
- </supplier>
- <!-- 供应商优品 -->
- <district v-if="item == 'king_kong_district' && districtShow" :url="site" :web="url"
- :districtTemplate="districtTemplate"></district>
- <!-- 九宫格 金刚区 -->
- <suppliers v-if="item == 'sup_recommend' && supRecommendShow"
- :supRecommendList="supRecommendList" :url="site" :web="url"
- :supRecommendTemplate="supRecommendTemplate"></suppliers>
- <!-- 供应商推荐 -->
- <single v-if="item == 'single_product' && singleShow" :pageList="singleList"
- :singleTemplate="singleTemplate" :merchant="merchant" :url="site" :web="url" :about="about"
- :categoryList="categoryList"></single>
- <!-- 单产品推荐 -->
- </view>
- <content-list :pageList="contentList" :config="about" :content-obj="contentObj"
- v-if="contentList.length > 0"></content-list>
- <view class="bottom" v-if="config.company_permit">
- <view class="bot-name">{{config.company_permit.split(',')[0]}} </view>
- <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>
- </view>
- </view>
- </view>
- </view>
- <block v-if="config.is_not_fixed_contact != 1">
- <block v-if="config.only_show_card == 1">
- <!-- :url="'/other/contact/index?id='+advisor.id" -->
- <navigator @click="jumpSingleChatRoom()" hover-class="none" class="contact contact-spe"
- v-if="advisor&&advisor.id">
- <image :src="advisor.headUrl ? advisor.headUrl : picUrlss+'lvluo/fixed_img1.png'" mode="aspectFill">
- </image>
- <view class="contact-text">
- <view class="tover">{{advisor.realName}}</view><text>服务顾问</text>
- </view>
- <view v-if="unReadSpotNum>0" class="newsDot"></view>
- </navigator>
- <button open-type="contact" hover-class="none" class="contact contact-spe" v-else>
- <image :src="picUrlss+'lvluo/fixed_img1.png'"></image>
- <view class="contact-text">杨经理<text>服务顾问</text></view>
- </button>
- </block>
- <block v-else>
- <!-- :url="'/other/contact/index?id='+advisor.id" -->
- <navigator @click="jumpSingleChatRoom()" hover-class="none" class="contact ddflex"
- v-if="advisor&&advisor.id">
- <image :src="advisor.headUrl ? advisor.headUrl : picUrlss+'lvluo/fixed_img1.png'" mode="aspectFill">
- </image>
- <view class="contact-text">服务<text>顾问</text></view>
- <view v-if="unReadSpotNum>0" style="left: 55rpx;" class="newsDot"></view>
- </navigator>
- <button open-type="contact" hover-class="none" class="contact ddflex" v-else>
- <image :src="picUrlss+'lvluo/fixed_img1.png'"></image>
- <view class="contact-text">服务<text>顾问</text></view>
- </button>
- </block>
- </block>
- <view class="more-fa ddflex" @click="jumpHome()" v-if="query.isJump">
- <image :src="picUrlss+'back_white.png'"></image>更多方案
- </view>
- <footer-copyright></footer-copyright>
- <!-- #ifndef APP-PLUS -->
- <foot channel="home" :isUpdate="isUpdate"></foot>
- <!-- #endif -->
- <view style="height: 170rpx;" v-if="(newsList.length>0 || unReadSpotNum>0)&&isShowNews"></view>
- <view class="bot-gg savepadding ddflex" :class="specClass"
- v-if="(newsList.length>0 || unReadSpotNum>0)&&isShowNews">
- <view class="gg-ico ddflex" v-if="unReadSpotNum>0&&swiperNewsCurrent!=0">
- <image src="../../static/images/ggico2.png"></image>
- </view>
- <view class="gg-ico ddflex" v-else>
- <image src="../../static/images/ggico1.png"></image>
- </view>
- <view class="fflex">
- <swiper class="shishic" vertical="true" :autoplay="true" duration="500" interval="4000" circular="true"
- :disable-touch="disableTouch" @change="swiperNewsChange">
- <swiper-item v-if="unReadSpotNum>0" class="li"
- @tap="jumpConversation()">您有{{unReadSpotNum}}条新消息</swiper-item>
- <block v-for="(item, index) in newsList" :key="index">
- <swiper-item class="li"
- @tap="jumpUrlNews('/'+item.url)">{{item.title}}:{{item.brief}}</swiper-item>
- </block>
- </swiper>
- </view>
- <image src="../../static/images/close1.png" class="gg-close" @click="closeNews"></image>
- </view>
- <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate"
- @closeUpdate="closeUpdate"></update-userinfo>
- <privacy :is-update="true" @getLocations="initLocation"></privacy>
- </view>
- </template>
- <script>
- //index.js
- //获取应用实例
- const app = getApp();
- const req = require('../../utils/request.js');
- const api = require('../../utils/api.js');
- const utils = require('../../utils/util.js');
- const mes = require('../../utils/requestmessage.js');
- const route = require('../../utils/route');
- const QQMapWX = require('../../utils/qqmap.js');
- var timer; //定时器状态
- // let disp = require("../../hxChatSDK/utils/broadcast");
- import foot from '../../components/nav-bar/index';
- import footerCopyright from '../../components/footer-copyright/footer-copyright';
- import popAd from '../../template/popAd/popAd';
- import group from '../../template/activityGroup/activityGroup';
- import banner from '../../template/banner/banner';
- import bargain from '../../template/bargain/bargain';
- import customers from '../../template/customers/customers';
- import homecolumn from '../../template/homecolumn/homecolumn';
- import joingroup from '../../template/joingroup/joingroup';
- import pCategoryList from '../../template/pCategoryList/pCategoryList';
- import recommend from '../../template/recommend/recommend';
- import seckill from '../../template/seckill/seckill';
- import selected from '../../template/selected/selected';
- import arrivals from '../../template/arrivals/arrivals';
- import hot from '../../template/hot/hot';
- import specialTopic from '../../template/specialTopic/specialTopic';
- import storeOptions from '../../template/store_options/store_options';
- import redEnvelopes from '../../template/red_envelopes/index';
- import supplier from '../../template/supplier/supplier';
- import district from '../../template/king_kong_district/king_kong_district';
- import switchStore from '../../template/switchStore/switchStore';
- import suppliers from '../../template/suppliers/suppliers';
- import single from '../../template/single/single';
- import contentList from '../../template/contentList/index';
- export default {
- components: {
- foot,
- footerCopyright,
- banner,
- group,
- bargain,
- popAd,
- customers,
- homecolumn,
- joingroup,
- pCategoryList,
- recommend,
- seckill,
- selected,
- arrivals,
- hot,
- specialTopic,
- storeOptions,
- redEnvelopes,
- supplier,
- district,
- switchStore,
- suppliers,
- single,
- contentList
- },
- data() {
- return {
- mainStyle: app.globalData.mainStyle,
- isSoution: req.env[req.env.NODE_ENV].isSolution, //是否是方案库
- showPage: false,
- picUrlss: req.public.picUrls,
- isUpdate: false, // 是否更新消息
- query: '',
- config: '',
- systems: {},
- isScroll: false,
- merchant: '',
- cardHeight: 528,
- userinfoVip: {},
- userInfo: {},
- clientData: {
- // 用户手指Y轴
- clientStartY: '', //开始按下的位置
- clientMoveY: '', //按下
- clientEndY: '', //抬起
- // 页面Y轴
- pageY: ''
- },
- sheight: 100,
- isPlay: 0, //是否播放动画
- isRefresh: true,
- cardCount: '', //次卡数量
- isShowBalance: true,
- chatPrams: '', //客服类型
- conTop: '',
- pxToRpxScale: '', //比例
- doctor: '', //专属医生
- advisor: '', //服务顾问
- sessionKey: '',
- scene: '',
- poi: '',
- contact: [],
- bannerList: [],
- categoryList: [], //产品分类列表
- page: 1,
- boutiqueList: {}, //精品榜单
- arrivalsList: {},
- hotList: {},
- pageList: {}, //产品列表
- isLoad: true,
- hasmore: true,
- activityGroup: {
- products: []
- },
- couponList: {}, //优惠券,
- isRemind: false,
- first: true, //是否显示提示加入我的小程序
- isFirstLoadLocation: true, //加载定位并且拉取门店信息
- isLayerAd: true, //广告
- homeTemplate: [], //首页栏目配置
- pCategoryList: [],
- storeShow: true,
- joingroupList: {
- products: []
- },
- //拼团
- bargainList: {
- products: []
- },
- //砍价
- customersList: {
- products: []
- },
- //新客
- freshen: true,
- swiperHeight: 0,
- url: '',
- web: '',
- site: '',
- internet: '',
- storeTemplate: {},
- typeDistrictTemplate: {},
- sousuoTemplate: {},
- popAdTemplate: {},
- districtTemplate: {},
- timelyTemplate: {},
- homecolumnimg: [],
- customersTemplate: {},
- joingroupTemplate: {},
- supplierTemplate: {},
- seckillTemplate: {},
- bargainTemplate: {},
- specialTemplate: {},
- chosenTemplate: {},
- arrivalsTemplate: {},
- hotTemplate: {},
- groupTemplate: {},
- recommendTemplate: {},
- supRecommendTemplate: {},
- singleTemplate: {},
- specialList: [],
- seckillList: {
- products: []
- },
- about: {},
- Is_Store_Price_Stock: '',
- guarantee: [],
- current: '',
- animationData: '',
- content: '',
- popAdList: {},
- supplierList: {},
- supRecommendList: {},
- singlePage: 1,
- isLoadSingle: true,
- hasmoreSingle: true,
- singleList: {},
- iscouponAd: false,
- couponAd: {},
- logo: false,
- top: Boolean,
- top_type: Boolean,
- switchStoreShow: Boolean,
- bargainShow: Boolean,
- contactShow: true,
- seckillShow: false,
- joingroupShow: false,
- activityGroupShow: false,
- customersShow: false,
- homecolumnShow: false,
- districtShow: false,
- recommendShow: false,
- boutiqueShow: false,
- arrivalsShow: false,
- hotShow: false,
- supplierShow: false,
- supRecommendShow: false,
- singleShow: false,
- pCategorShow: false,
- bannerShow: false,
- List: [],
- marqueeOrderItemIndex: 0,
- marqueeOrderItem: '',
- officeList: [], //互动
- templateType: {
- module_ad: 'ad', //广告
- module_type_district: 'type_district', //分类导航
- module_p_list: 'p_list', //品类专区
- module_group: 'group', //团购
- module_live: 'live', //直播
- module_sou: 'sou', //搜索
- module_special: 'special', //专题
- module_chosen: 'chosen', //精选
- module_new_arrivals: 'new_arrivals', //新品上架
- module_hot_money: 'hot_money', //热门爆款
- module_recommend: 'recommend', //推荐产品
- module_store_options: 'store_options', //多门店选择
- module_home_pop_up_ads: 'home_pop_up_ads', //首页弹窗广告
- module_joingroup: 'joingroup', //拼团
- module_seckill: 'seckill', //秒杀
- module_bargain: 'bargain', //砍价
- module_customers: 'New_customers', //新客
- module_homecolumn: 'homecolumn', //首页专区
- module_supplier_premium: 'supplier_premium', //供应商模块
- module_red_envelopes: 'red_envelopes', //优惠券
- module_king_kong_district: 'king_kong_district', //金刚区
- module_sup_recommend: 'sup_recommend', //供应商推荐
- module_single_product: 'single_product' //供应商推荐
- },
- merchantList: [],
- specClass: 'hide',
- isShowNews: false,
- newsList: [], //公告
- unReadSpotNum: 0,
- swiperNewsCurrent: 0,
- isShowUpdate: false,
- isUpdateInfo: false,
- isUpdateMobile: false,
- contentList: [], //资讯
- contentObj: '', //资讯标题
- };
- },
- onLoad: async function(options) {
- // 如果是tab页面不往下执行跳转tab缓存页面
- await this.getConfig().then(async res => {
- if (req.isTabPage('home', this.config.solution_name)) {
- req.toTabBar('home', options)
- return false
- } else {
- console.log('onLoad onLoadPage options', options)
- this.onLoadPage(options)
- }
- });
- },
- onHide() {
- if (this.isPlay == 1) {
- this.isPlay = 2;
- }
- },
- async onShow() {
- // 如果是tab页面不往下执行跳转tab缓存页面
- await this.getConfig().then(async res => {
- if (req.isTabPage('home', this.config.solution_name)) {
- return false
- } else {
- this.onShowPage()
- }
- });
- },
- onShareAppMessage: function() {
- return {
- title: this.getShareTitle(),
- path: this.getSharePath()
- };
- },
- onShareTimeline() {
- return {
- title: this.getShareTitle(),
- query: this.getSharePath()
- };
- },
- onUnload() {
- this.isPlay = 2;
- },
- methods: {
- onLoadPage: async function(options) {
- console.log('options', options)
- if (options.appId) req.setStorage('appId', options.appId);
- this.query = options;
- // 获取配色后渲染页面
- if (app.globalData.mainStyle && Object.keys(app.globalData.mainStyle).length === 0)
- await app.globalData.upColor()
- this.mainStyle = app.globalData.mainStyle
- this.showPage = true
- if (options.scene) {
- this.scene = options.scene;
- await this.loadCode();
- } else {
- await req.silenceLogin(options.userId, '');
- }
- let isAuth = req.isAuth()
- console.log('req.isAuth() isAuth', isAuth)
- if (req.isAuth()) {
- this.getuserVip();
- this.getCardCount();
- await this.getUserInfo();
- this.getNews();
- this.onChatPageUnreadspot()
- }
- app.globalData.getCheckSessoin(json => {
- this.sessionKey = json.session_key;
- });
- },
- async onShowPage() {
- let _ts = this;
- _ts.getChatPrams();
- console.log('req.isAuth()==', req.isAuth())
- let isLogin = req.isAuth();
- if (isLogin) {
- _ts.getUserInfo();
- _ts.getuserVip();
- _ts.getCardCount();
- _ts.getNews();
- _ts.onChatPageUnreadspot()
- }
- await this.getConfig().then(async res => {
- // console.log('加载数据===========')
- // if (_ts.first && _ts.about.Many_Store == 1){
- // _ts.getLocation();
- // }
- if (_ts.isFirstLoadLocation) {
- _ts.isFirstLoadLocation = false;
- this.initLocation();
- }
- });
- },
- getToutiaoList() {
- let form = {
- page: 1,
- limit: 5,
- code: 'toutiao'
- }
- this.getToutiaoName();
- req.getRequest('/api/content/list', form, data => {
- this.contentList = data;
- })
- },
- getToutiaoName() {
- req.getRequest('/api/v2/category/list', {}, data => {
- if (data && data.length > 0) {
- data.map(it => {
- if (it.code == 'toutiao') this.contentObj = it
- })
- }
- })
- },
- getLocation() {
- // console.log('req.public.mapLBSKEY》》》》》》》》',req.public.mapLBSKEY);
- QQMapWX.initMap(req.public.mapLBSKEY);
- req.getLocation(res => {
- const to = {
- latitude: res.latitude,
- longitude: res.longitude
- };
- QQMapWX.reverseGeocoder(to, async resp => {});
- });
- },
- async initLocation() {
- let _ts = this;
- _ts.getMerchant();
- _ts.getToutiaoList();
- // await _ts.getMerchantList();
- if (this.config.only_show_card != 1) {
- await _ts.getHomeTemplateConfig();
- }
- if (this.isRefresh && this.config.only_show_card == 1) {
- await _ts.getViewInfo();
- }
- if (this.config.is_not_fixed_contact != 1) {
- await _ts.getDoctor();
- }
- await _ts.getAdvisor();
- console.log('数据>>>>>initLocation>>>>>44444')
- },
- onPageScrollPage(e) {
- this.clientData.pageY = e.scrollTop;
- if (e.scrollTop > this.sheight) {
- if (this.isPlay == 1) {
- this.isPlay = 2;
- }
- }
- if (this.isSoution || (this.config && this.config.is_hide_searchBox != 1)) {
- let height = this.systems.barHeight / this.pxToRpxScale;
- if (e.scrollTop > height) {
- this.isScroll = true;
- } else {
- this.isScroll = false;
- }
- }
- // console.log('开始滚动');
- // 只要滚动就清除状态
- clearTimeout(timer);
- // 告知标识 -> 开始滚动
- this.flag = false;
- this.specClass = 'show';
- // 检测是否停留了 N 秒
- // 如果停留则表示滚动结束
- // N: 500(定时器时间 毫秒) -> 0.5秒算停止滚动
- // 滚动后多长时间算停止滚动
- timer = setTimeout(() => {
- // console.log('结束滚动');
- // 告知标识 -> 结束滚动
- this.flag = true;
- this.specClass = 'hide';
- }, 500);
- this.$forceUpdate();
- },
- onShareAppMessagePage: function() {
- console.log('onShareAppMessagePage')
- return {
- title: this.getShareTitle(),
- path: this.getSharePath()
- };
- },
- onShareTimelinePage() {
- return {
- title: this.getShareTitle(),
- query: this.getSharePath()
- };
- },
- closeNews() {
- this.isShowNews = false;
- },
- // 公告
- getNews() {
- req.getRequest('/api/message/announcement', {}, data => {
- this.newsList = data;
- this.isShowNews = true
- })
- },
- // 消息
- onChatPageUnreadspot(message) {
- this.unReadSpotNum = getApp().globalData.unReadMessageNum > 99 ?
- "99+" : getApp().globalData.unReadMessageNum;
- if (this.unReadSpotNum > 0) this.isShowNews = true
- // setTimeout(()=>{
- // console.log('-------------------------------->onChatPageUnreadspot<---------------------------')
- // this.unReadSpotNum = 2
- // this.isShowNews = true
- // },1000)
- },
- jumpConversation() {
- if (!this.getUpdate()) return false;
- req.jumpConversation();
- },
- jumpSingleChatRoom() {
- if (!this.getUpdate()) return false;
- if (this.advisor) {
- req.jumpSingleChatRoom(this.advisor.id, this.advisor.headUrl, this.advisor
- .realName);
- }
- },
- swiperNewsChange(e) {
- this.swiperNewsCurrent = e.detail.current
- },
- jumpUrlNews(url, type) {
- if (!req.isLogin()) return false;
- if (type == 1) {
- uni.switchTab({
- url: url
- })
- } else {
- uni.navigateTo({
- url: url
- })
- }
- },
- loadCode() {
- let _ts = this;
- console.log('解码参数scene==', _ts.scene)
- return new Promise((resolve, reject) => {
- let form = {
- scene: _ts.scene
- };
- req.getRequest('/api/code/params', form, data => {
- console.log('解码参数==', data)
- req.silenceLogin(data.userId, '');
- req.setStorage('pidCode', data.userId);
- resolve();
- });
- });
- },
- getPhoneNumber(event) {
- // console.log('绑定手机号==',event)
- const detail = event.detail;
- const _ts = this;
- if (!detail || !detail.encryptedData || !detail.iv) return false;
- req.postRequest('/api/weixin/mobile', {
- encryptedData: detail.encryptedData,
- iv: detail.iv,
- sessionKey: _ts.sessionKey
- }, res => {
- console.log('res==', res)
- if (res.mobile) {
- var userInfo = req.getStorage('userInfo');
- userInfo.mobile = res.mobile;
- req.setStorage('userInfo', userInfo);
- _ts.jumpUrl('/open/info/index');
- }
- });
- },
- getGVip() {
- var userInfo = req.getStorage('userInfo');
- if (req.isLogins(true)) {
- if (userInfo.mobile) {
- this.jumpUrl('/open/info/index');
- } else { //弹出绑定手机号的窗口
- uni.showModal({
- title: '提示',
- content: '绑定手机号完成领取',
- cancelText: '取消',
- confirmText: '绑定领取',
- success(res) {
- if (res.confirm) {
- uni.navigateTo({
- url: '/topic/bind/index'
- })
- }
- }
- })
- }
- }
- },
- getDoctor() {
- return new Promise((resolve, reject) => {
- req.getRequest('/api/v3/user/doctor', {}, data => {
- console.log('医生==', data)
- this.doctor = data;
- resolve();
- })
- })
- },
- getAdvisor() {
- return new Promise((resolve, reject) => {
- req.getRequest('/api/distribution/advisorInfo', {}, data => {
- console.log('服务顾问==', data)
- this.advisor = data;
- resolve();
- })
- })
- },
- customerServiceChat() {
- let chatPrams = this.chatPrams;
- wx.openCustomerServiceChat({
- extInfo: {
- url: chatPrams.url
- },
- corpId: chatPrams.enterpriseId,
- success(res) {
- console.log('调用微信客服')
- }
- })
- },
- getChatPrams() {
- let that = this;
- let chatPrams = req.getStorage('chatService');
- if (chatPrams) {
- that.chatPrams = chatPrams;
- that.type = chatPrams.type;
- console.log('type==', that.type)
- that.$forceUpdate();
- }
- },
- optBalance() {
- this.isShowBalance = !this.isShowBalance;
- req.setStorage('isShowBalance', this.isShowBalance);
- },
- touchStart(e) {
- // console.log('开始移动==',e)
- this.clientData.clientStartY = e.changedTouches[0].clientY;
- },
- move(e) {
- // console.log('触摸移动==',e);
- if (this.clientData.pageY < 1) {
- let distance = e.changedTouches[0].clientY - this.clientData.clientStartY;
- if (this.isPlay != 1) {
- if (distance > 0) {
- if (distance > this.sheight) {
- this.conTop = this.sheight * this.pxToRpxScale;
- } else {
- this.conTop = distance * this.pxToRpxScale;
- }
- }
- }
- if (distance > this.sheight) {
- this.isPlay = 1;
- this.conTop = 0;
- } else {
- return;
- }
- }
- },
- // 手指抬起
- end(e) {
- let endY = e.changedTouches[0].clientY;
- let subY = endY - this.clientData.clientStartY;
- this.conTop = 0;
- if (subY < -50) {
- console.log('上滑')
- if (subY * -1 > this.sheight) {
- if (this.isPlay == 1) {
- uni.pageScrollTo({
- duration: 300,
- scrollTop: 0
- })
- this.isPlay = 2;
- }
- }
- } else if (subY > 50 && this.clientData.pageY < 1) {
- console.log('下滑')
- if (subY > this.sheight) {
- this.isPlay = 1;
- } else {
- uni.pageScrollTo({
- duration: 300,
- scrollTop: 0
- })
- }
- } else {
- if (this.isPlay == 1) {
- uni.pageScrollTo({
- duration: 300,
- scrollTop: 0
- })
- }
- }
- },
- getUserInfo() {
- return new Promise((resolve, reject) => {
- req.getRequest('/api/user/my', {}, data => {
- console.log('data==', data)
- if (data && (data.avatar || data.mobile || data.nickName)) {
- let userInfo = req.getStorage('userInfo');
- if (data.avatar) userInfo.avatar = data.avatar;
- if (data.mobile) userInfo.mobile = data.mobile;
- if (data.nickName) userInfo.nickName = data.nickName;
- req.setStorage('userInfo', userInfo)
- }
- this.userInfo = data;
- if (req.getStorage('isShowBalance') != '') {
- this.isShowBalance = req.getStorage('isShowBalance');
- } else {
- this.isShowBalance = true;
- }
- resolve();
- })
- })
- },
- getCardCount() {
- req.getRequest('/api/v3/secondary/card/count', {}, data => {
- this.cardCount = data;
- })
- },
- getuserVip() {
- return new Promise((resolve, reject) => {
- req.getRequest('/api/user/levelDetails', {}, data => {
- let expireTime = Array;
- if (data.expireTime) {
- expireTime = data.expireTime.split(' ');
- data.expireTime = data.expireTime.replace(/-/g, '/');
- }
- let nowTime = new Date().getTime();
- let endTime = new Date(data.expireTime).getTime();
- let times = parseInt((endTime - nowTime) / 1000);
- if (data.cardNo) data.cardNo = data.cardNo.replace(/(.{4}).*(.{4})/,
- '$1********$2');
- this.userinfoVip = data;
- this.userinfoVip.expireTime = expireTime[0];
- if (times <= 0) {
- this.userinfoVip.end = true;
- } else {
- this.userinfoVip.end = false;
- }
- resolve();
- });
- })
- },
- getSharePath() {
- let path = '';
- let isSolution = '';
- // #ifndef H5
- isSolution = req.env[req.env.NODE_ENV].isSolution;
- // #endif
- // #ifdef H5
- isSolution = false;
- // #endif
- if (isSolution) {
- console.log('方案')
- path = '/share/home/index?appId=' + req.getStorage('appId') + '&userId=' + req.getStorage('userInfo')
- .id;
- } else {
- path = '/pages/index/index?isShare=' + true + '&appId=' + req.getStorage('appId');
- if (req.getStorage('userInfo')) {
- path += '&userId=' + req.getStorage('userInfo').id;
- }
- if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
- path += '&merchantId=' + req.getStorage('MERCHANT').id;
- if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
- path += '&shopId=' + req.getStorage('smallShop').id;
- }
- }
- }
- console.log('path==', path)
- return path;
- },
- getShareTitle() {
- let title = '';
- if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
- title = this.merchant.title;
- } else {
- title = this.config.CONFIG_PROJECT_TITLE;
- }
- console.log('getShareTitle>>>>>>>>>' + title);
- return (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage(
- 'userInfo').nickName) : '') + '为你推荐' + title;
- },
- /**
- * 显示门店标题
- */
- getMerchantTitle() {
- let title = '';
- if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
- // if (this.merchant.title.length > 12) {
- // title = this.merchant.title.substring(0, 12) + '...';
- // } else {
- title = this.merchant.title + (this.merchant.titleBrief ? '(' + this.merchant.titleBrief + ')' : '');
- // }
- } else {
- title = this.config.CONFIG_PROJECT_TITLE;
- }
- return title;
- },
- callPhone() {
- uni.makePhoneCall({
- phoneNumber: this.merchant.phone
- });
- },
- merchantFun() {
- app.globalData.openPage('merchant/nearby/nearby');
- },
- getConfig() {
- return new Promise((resolve, reject) => {
- req.getRequest('/api/config', {}, data => {
- req.setStorage('configRes', JSON.stringify(data));
- this.config = data;
- this.about = data;
- resolve(data);
- });
- });
- },
- getMerchantList() {
- let that = this;
- let form = {
- page: 1,
- limie: 5
- }
- form.isBusiness = 1;
- if (req.getStorage('loctionAddressMap')) {
- form.lng = req.getStorage('loctionAddressMap').location.lng;
- form.lat = req.getStorage('loctionAddressMap').location.lat;
- }
- req.getRequest('/api/merchant/page', form, data => {
- console.log('门店列表==', data)
- data.map(it => {
- if (it.range > 0) it.range = parseFloat(it.range).toFixed(2), it.mDistance =
- parseFloat(it.mDistance).toFixed(0);
- return it;
- });
- that.merchantList = data
- });
- },
- getMerchant() {
- let _ts = this;
- //获取默认的门店,确保进入到页面后能立即渲染数据
- api.defaultMerchant(req, '', defaultRes => {
- _ts.merchant = defaultRes;
- console.log('获取的默认门店_ts.merchant======', defaultRes);
- });
- //使用定位获取门店
- api.getMerchant('', req, data => {
- console.log('===', data);
- if (data == 1) {
- if (_ts.about.Many_Store == 1) {
- api.locationShow()
- } else {
- if (req.getStorage('defaultMerchant')) {
- _ts.merchant = req.getStorage('defaultMerchant');
- }
- }
- } else {
- _ts.merchant = data;
- }
- console.log('通过定位逻辑再获取到的默认门店_ts.merchant======', _ts.merchant);
- });
- },
- getViewInfo() {
- let that = this;
- const systemInfo = uni.getSystemInfoSync();
- let pxToRpxScale = 750 / systemInfo.windowWidth;
- return new Promise((resolve, reject) => {
- const query = uni.createSelectorQuery().in(this);
- query.select('.merchant').boundingClientRect(res => {
- let height = res.height * pxToRpxScale + res.top * pxToRpxScale + 40
- that.cardHeight = that.systems.windowHeight - height;
- }).exec();
- setTimeout(res => {
- query.select('.bottom').boundingClientRect(data => {
- let height = data.height * pxToRpxScale;
- that.cardHeight = that.cardHeight - height - 115 - that.systems
- .safeBottomHeight;
- that.isRefresh = false;
- }).exec();
- }, 200)
- resolve();
- })
- },
- jumpVip(url) {
- if (req.isLogins(true)) {
- let userInfo = req.getStorage('userInfo');
- if (userInfo.levelId && userInfo.levelId > 0) {
- uni.navigateTo({
- url: '/mine/vip/vip'
- });
- } else {
- uni.navigateTo({
- url: url
- });
- }
- }
- },
- jumpUrl(url) {
- if (req.isLogins(true)) {
- uni.navigateTo({
- url: url
- });
- }
- },
- scanCode() {
- var _this = this; // 允许从相机和相册扫码
- uni.scanCode({
- success: res => {
- console.log('扫码结果1111==', res)
- let path = res.path.split('?scene=')[0];
- let scene = res.path.split('?scene=')[1];
- let paths = '/' + path + '?scene=' + encodeURIComponent(scene);
- console.log('paths===', paths)
- uni.navigateTo({
- url: paths
- });
- }
- });
- },
- jumpUrlColumn(item) {
- app.globalData.clickBanner(item);
- },
- //获取首页模板配置
- getHomeTemplateConfig() {
- let _ts = this;
- let page = 'shopIndex';
- //荣康模板配置、小店产品==门店产品
- req.getRequest(
- '/api/template/getTemplate', {
- page: page
- },
- data => {
- let arr = [];
- data.forEach(it => {
- arr.push(it.module);
- });
- this.setData({
- contact: [...new Set(arr)],
- contactShow: false
- });
- if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('store_options') != -1) {
- this.top = false;
- } else {
- this.top = true;
- }
- if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('type_district') != -1) {
- this.top_type = false;
- } else {
- this.top_type = true;
- }
- console.log(this.contact.indexOf('sou') != -1, this.contact.indexOf('store_options') != -1,
- this.contact.indexOf('type_district') != -1, this.top);
- console.log(this.contact);
- this.setData({
- homeTemplate: data
- });
- this.getRqeDatas();
- }
- );
- },
- async getRqeDatas() {
- let that = this; //多门店
- await that.getCategory();
- let store = that.homeTemplate.filter(it => it.module == that.templateType.module_store_options);
- that.setData({
- storeTemplate: store[0]
- }); //搜索
- let sousuo = that.homeTemplate.filter(it => it.module == that.templateType.module_sou);
- that.setData({
- sousuoTemplate: sousuo[0]
- });
- //分类导航
- let typeDistrict = that.homeTemplate.filter(it => it.module == that.templateType.module_type_district);
- that.setData({
- typeDistrictTemplate: typeDistrict[0]
- });
- //弹窗广告
- let popAd = that.homeTemplate.filter(it => it.module == that.templateType.module_home_pop_up_ads);
- if (popAd && popAd.length > 0 && popAd[0].state == 0) {
- that.setData({
- popAdTemplate: popAd[0]
- });
- if (that.freshen) {
- await that.getBannerList(popAd[0].module, popAd[0].contentId);
- }
- }
- // 金刚区
- let district = that.homeTemplate.filter(it => it.module == that.templateType
- .module_king_kong_district);
- if (district && district.length > 0 && district[0].state == 0) {
- let data = district[0];
- data.content = JSON.parse(district[0].content);
- that.districtTemplate = data;
- if (data.contentId == 2) {
- that.districtShow = true;
- }
- console.log(that.districtTemplate, '=============');
- }
- //顶部banner
- let ad = that.homeTemplate.filter(it => it.module == that.templateType.module_ad);
- if (ad && ad.length > 0 && ad[0].state == 0) {
- if (that.freshen) {
- await that.getBannerList(ad[0].module, ad[0].contentId);
- }
- } //首页专区
- let homecolumn = that.homeTemplate.filter(it => it.module == that.templateType.module_homecolumn);
- if (homecolumn.length > 0 && homecolumn[0].state == 0) {
- let homecolumnimg = JSON.parse(homecolumn[0].content).selectDataKingLength;
- that.homecolumnimg = homecolumnimg;
- that.homecolumnShow = true;
- } // 新客
- let customers = that.homeTemplate.filter(it => it.module == that.templateType.module_customers);
- if (customers && customers.length > 0 && customers[0].state == 0) {
- that.setData({
- customersTemplate: customers[0]
- });
- await that.customersListFun(customers[0]);
- } //拼团
- let joingroup = that.homeTemplate.filter(it => it.module == that.templateType.module_joingroup);
- if (joingroup && joingroup.length > 0 && joingroup[0].state == 0) {
- that.setData({
- joingroupTemplate: joingroup[0]
- });
- await that.joingroupListFun(joingroup[0]);
- } // 供应商
- let supplier = that.homeTemplate.filter(it => it.module == that.templateType.module_supplier_premium);
- if (supplier && supplier.length > 0 && supplier[0].state == 0) {
- that.setData({
- supplierTemplate: supplier[0]
- });
- if (that.freshen) {
- await that.getsupplierList(supplier[0]);
- }
- } //秒杀
- let seckill = that.homeTemplate.filter(it => it.module == that.templateType.module_seckill);
- if (seckill && seckill.length > 0 && seckill[0].state == 0) {
- that.setData({
- seckillTemplate: seckill[0]
- });
- await that.seckillListFun(seckill[0]);
- } //砍价
- let bargain = that.homeTemplate.filter(it => it.module == that.templateType.module_bargain);
- if (bargain && bargain.length > 0 && bargain[0].state == 0) {
- that.setData({
- bargainTemplate: bargain[0]
- });
- await that.bargainListFun(bargain[0]);
- } //专题
- let special = that.homeTemplate.filter(it => it.module == that.templateType.module_special);
- if (special && special.length > 0 && special[0].state == 0) {
- that.setData({
- specialTemplate: special[0]
- });
- if (that.freshen) {
- await that.getSpecialList(special[0]);
- }
- } //精选
- let chosen = that.homeTemplate.filter(it => it.module == that.templateType.module_chosen);
- if (chosen && chosen.length > 0 && chosen[0].state == 0) {
- that.setData({
- chosenTemplate: chosen[0]
- });
- if (that.freshen) {
- await that.getBoutiqueList(chosen[0]);
- } // }
- } //团购
- //新品上架
- let arrivals = that.homeTemplate.filter(it => it.module == that.templateType.module_new_arrivals);
- if (arrivals && arrivals.length > 0 && arrivals[0].state == 0) {
- that.setData({
- arrivalsTemplate: arrivals[0]
- });
- if (that.freshen) {
- await that.getArrivalsList(arrivals[0]);
- } // }
- }
- //热门爆款
- let hot = that.homeTemplate.filter(it => it.module == that.templateType.module_hot_money);
- if (hot && hot.length > 0 && hot[0].state == 0) {
- that.setData({
- hotTemplate: hot[0]
- });
- if (that.freshen) {
- await that.getHotList(hot[0]);
- } // }
- }
- let group = that.homeTemplate.filter(it => it.module == that.templateType.module_group);
- if (group && group.length > 0 && group[0].state == 0) {
- that.setData({
- groupTemplate: group[0]
- });
- await that.loadGroup(group[0]);
- }
- //推荐产品
- let recommend = that.homeTemplate.filter(it => it.module == that.templateType.module_recommend);
- if (recommend && recommend.length > 0 && recommend[0].state == 0) {
- that.setData({
- recommendTemplate: recommend[0]
- });
- if (that.freshen) {
- await that.getPageList();
- }
- }
- //单产品推荐
- let single = that.homeTemplate.filter(it => it.module == that.templateType.module_single_product);
- if (single && single.length > 0 && single[0].state == 0) {
- that.setData({
- singleTemplate: single[0]
- });
- if (that.freshen) {
- await that.getSinglePageList();
- }
- }
- //品类专区
- let p_list = that.homeTemplate.filter(it => it.module == that.templateType.module_p_list && it.state ==
- 0);
- that.List = p_list;
- if (that.freshen) {
- // if (!that.pCategorShow) {
- for (var i = 0; i < that.List.length; i++) {
- await that.getPListProduct(that.List[i], i).then(data => {
- data = data.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- var res = {
- displayStyle: that.List[i].theme,
- lineNumber: that.List[i].lineNumber,
- products: data
- };
- that.List[i].productList = res;
- let arr = [];
- that.List.forEach(it => {
- if (it.productList) {
- it.pCategorShow = true;
- arr.push(it);
- }
- });
- that.pCategoryList = that.List;
- if (arr.length == that.List.length) {
- that.pCategorShow = true;
- }
- });
- await that.getCateCoupon(that.List[i], i).then(suc => {
- that.List[i].couponList = suc;
- })
- }
- }
- // 红包优惠券
- let coupon = that.homeTemplate.filter(it => it.module == that.templateType.module_red_envelopes && app
- .globalData.isredenvelopes);
- if (coupon && coupon.length > 0 && coupon[0].state == 0) {
- if (!req.getStorage('userInfo')) {
- that.setData({
- iscouponAd: true,
- couponAd: coupon[0]
- });
- } else {
- req.getRequest(
- '/api/coupon/checkCoupon', {
- id: coupon[0].contentId
- },
- res => {
- if (res == 1) {
- that.setData({
- iscouponAd: true,
- couponAd: coupon[0]
- });
- } else if (res == 0) {
- that.setData({
- iscouponAd: false
- });
- }
- }
- );
- }
- } else {
- that.iscouponAd = false;
- }
- // 供应商推荐
- let supRecommend = that.homeTemplate.filter(it => it.module == that.templateType.module_sup_recommend);
- if (supRecommend && supRecommend.length > 0 && supRecommend[0].state == 0) {
- that.setData({
- supRecommendTemplate: supRecommend[0]
- });
- if (that.freshen) {
- await that.getSupRecommendList();
- }
- }
- that.setData({
- freshen: false
- });
- that.logo = true;
- },
- getBannerList(module, contentId) {
- //banner图
- let that = this;
- return new Promise((resolve, reject) => {
- req.getRequest(
- '/api/banner', {
- groupId: contentId
- },
- data => {
- if (module == that.templateType.module_ad) {
- that.setData({
- bannerList: data,
- bannerShow: true
- });
- } else {
- that.setData({
- popAdList: data[0]
- });
- }
- resolve();
- }
- );
- })
- },
- getCategory() {
- //产品分类
- let that = this;
- return new Promise((resolve, reject) => {
- req.getRequest(
- '/api/category/list', {
- pid: 0
- },
- res => {
- if (res && res.length > 0) {
- res = res.map((it, index) => {
- it.index = index;
- return it;
- });
- let newList = this.group(res, 8);
- let data = newList;
- if (data && data.length > 0 && data[0].length <= 4) {
- this.setData({
- swiperHeight: '100px'
- });
- } else {
- this.setData({
- swiperHeight: '200px'
- });
- }
- that.setData({
- categoryList: data
- });
- }
- resolve();
- }
- );
- })
- },
- //产品分类优惠券
- getCateCoupon(pCategory, idx) {
- let form = {
- page: 1,
- limit: 2,
- categoryId: pCategory.contentId,
- bindType: 'use'
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/coupon/list', form, data => {
- resolve(data);
- })
- })
- },
- // 动态产品分类
- getPListProduct(pCategory, idx) {
- let that = this;
- let pList = [];
- let form = {
- limit: pCategory.number,
- categoryId: pCategory.contentId // isRecommend:1
- };
- //非小店
- if (that.merchant && that.merchant.type != 5) {
- form.merchantId = that.merchant.id;
- return new Promise((resolve, reject) => {
- req.getRequest('/api/product/list', form, data => {
- resolve(data);
- });
- });
- }
- },
- //新客
- customersListFun(customersTemplate) {
- let _ts = this;
- _ts.clearAllTimer(4);
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: customersTemplate.number,
- type: 6,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id
- };
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: customersTemplate.theme,
- lineNumber: customersTemplate.lineNumber,
- products: res.filter(ele => ele.end == false)
- };
- this.setData({
- customersList: arrObjFilter,
- customersShow: true
- });
- _ts.initGroupTimer(4);
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let from = {
- page: 1,
- limit: customersTemplate.number,
- type: 4,
- tag: 'home'
- };
- from.merchantId = this.merchant.id;
- return new Promise((resolve, reject) => {
- req.getRequest('/api/activity/list', from, data => {
- data = data.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: customersTemplate.theme,
- lineNumber: customersTemplate.lineNumber,
- products: data.filter(ele => ele.end == false)
- };
- _ts.setData({
- customersList: arrObjFilter,
- customersShow: true
- });
- _ts.initGroupTimer(4);
- resolve();
- });
- })
- }
- },
- getSupRecommendList() {
- return new Promise((resolve, reject) => {
- req.getRequest('/api/supplier/recommend', {}, res => {
- if (res && res.length > 0) {
- this.supRecommendList = res;
- this.supRecommendShow = true;
- }
- });
- });
- },
- // 获取专题
- getSpecialList(special) {
- let that = this;
- let form = {
- page: 1,
- limit: special.number
- };
- return new Promise((resolve, reject) => {
- req.getRequest('/api/special/list', form, async data => {
- if (data) {
- for (var i = 0; i < data.length; i++) {
- await that.getSpecialProduct(data[i].id).then(datas => {
- var res = {
- displayStyle: datas.displayStyle,
- lineNumber: datas.lineNumber,
- products: datas.products
- };
- data[i].productList = res;
- that.specialList = data
- });
- }
- }
- resolve();
- });
- })
- },
- getSpecialProduct(id) {
- let form = {
- id: id,
- page: 1,
- limit: 6
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/special/detail', form, data => {
- resolve(data);
- })
- })
- },
- //社区团购商品
- loadGroup(groupTemplate) {
- let _ts = this;
- _ts.clearAllTimer(1);
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: groupTemplate.number,
- type: 2,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id
- };
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: groupTemplate.theme,
- lineNumber: groupTemplate.lineNumber,
- products: res.filter(ele => ele.end == false)
- };
- this.setData({
- activityGroup: arrObjFilter,
- activityGroupShow: true
- });
- _ts.initGroupTimer(1);
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let from = {
- page: 1,
- limit: groupTemplate.number,
- type: 1,
- tag: 'home'
- };
- from.merchantId = this.merchant.id;
- return new Promise((resolve, reject) => {
- req.getRequest('/api/activity/list', from, data => {
- data = data.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- data = {
- displayStyle: groupTemplate.theme,
- lineNumber: groupTemplate.lineNumber,
- products: data
- };
- _ts.setData({
- activityGroup: data,
- activityGroupShow: true
- });
- _ts.initGroupTimer(1);
- resolve();
- });
- })
- }
- },
- //拼团商品
- joingroupListFun(joingroupTemplate) {
- let _ts = this;
- _ts.clearAllTimer(2);
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: joingroupTemplate.number,
- type: 4,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id
- };
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: joingroupTemplate.theme,
- lineNumber: joingroupTemplate.lineNumber,
- products: res.filter(ele => ele.end == false)
- };
- this.setData({
- joingroupList: arrObjFilter,
- joingroupShow: true
- });
- _ts.initGroupTimer(2);
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let from = {
- page: 1,
- limit: joingroupTemplate.number,
- type: 3,
- dayType: 1,
- tag: 'home'
- };
- from.merchantId = this.merchant.id;
- return new Promise((resolve, reject) => {
- req.getRequest('/api/activity/listNew', from, data => {
- data = data.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: joingroupTemplate.theme,
- lineNumber: joingroupTemplate.lineNumber,
- products: data.filter(ele => ele.end == false)
- };
- _ts.setData({
- joingroupList: arrObjFilter,
- joingroupShow: true
- });
- _ts.initGroupTimer(2);
- resolve();
- });
- })
- }
- },
- //砍价
- bargainListFun(bargainTemplate) {
- let _ts = this;
- _ts.clearAllTimer(3);
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: bargainTemplate.number,
- type: 7,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id
- };
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: bargainTemplate.theme,
- lineNumber: bargainTemplate.lineNumber,
- products: res.filter(ele => ele.end == false)
- };
- this.setData({
- bargainList: arrObjFilter,
- bargainShow: true
- });
- _ts.initGroupTimer(3);
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let from = {
- page: 1,
- limit: bargainTemplate.number,
- type: 5,
- tag: 'home'
- };
- from.merchantId = this.merchant.id;
- return new Promise((resolve, reject) => {
- req.getRequest('/api/activity/listNew', from, data => {
- data = data.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: bargainTemplate.theme,
- lineNumber: bargainTemplate.lineNumber,
- products: data.filter(ele => ele.end == false)
- };
- _ts.setData({
- bargainList: arrObjFilter,
- bargainShow: true
- });
- _ts.initGroupTimer(3);
- resolve();
- });
- })
- }
- },
- //秒杀商品
- seckillListFun(seckillTemplate) {
- let _ts = this;
- _ts.clearAllTimer(5);
- //获取小店推荐的产品
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: seckillTemplate.number,
- type: 3,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id
- };
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.list.map(it => {
- it.isRemind = it.remindId;
- return it;
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: seckillTemplate.theme,
- lineNumber: seckillTemplate.lineNumber,
- products: res.filter(ele => ele.end == false)
- };
- this.setData({
- seckillList: arrObjFilter,
- seckillShow: true
- });
- _ts.initGroupTimer(5);
- resolve();
- });
- })
- }
- //获取门店推荐的产品
- if (this.merchant && this.merchant.type != 5) {
- let from = {
- page: 1,
- limit: seckillTemplate.number,
- type: 2,
- tag: 'home'
- };
- from.merchantId = this.merchant.id;
- return new Promise((resolve, reject) => {
- req.getRequest('/api/activity/list', from, res => {
- res = res.map(it => {
- it.num = (it.sellStock / it.quantity) * 100;
- it.isRemind = it.remindId;
- return it;
- });
- res.sort(function(a, b) {
- return Date.parse(a.startTime) - Date.parse(b.startTime);
- });
- let arrObjFilter;
- arrObjFilter = {
- displayStyle: seckillTemplate.theme,
- lineNumber: seckillTemplate.lineNumber,
- products: res.filter(ele => ele.end == false)
- };
- _ts.setData({
- seckillList: arrObjFilter,
- seckillShow: true
- });
- _ts.initGroupTimer(5);
- resolve();
- });
- })
- }
- },
- //1为社区团购,2为拼团,3为砍价
- initGroupTimer(type) {
- //社区拼图定时器
- let _ts = this;
- let list = [];
- if (type == 1) list = this.activityGroup.products;
- else if (type == 2) list = this.joingroupList.products;
- else if (type == 3) list = this.bargainList.products;
- else if (type == 4) list = this.customersList.products;
- else if (type == 5) list = this.seckillList.products;
- if (list && list.length > 0) {
- // let activityGroup = this.data.activityGroup;
- for (let i = 0, len = list.length; i < len; i++) {
- let group = list[i];
- let nowTime = new Date(group.nowTime.replace(/-/g, '/')).getTime();
- let startTime = new Date(group.startTime.replace(/-/g, '/')).getTime();
- let endTime = new Date(group.endTime.replace(/-/g, '/')).getTime();
- if (!group.start) endTime = startTime;
- let times = parseInt((endTime - nowTime) / 1000);
- let timer = setInterval(() => {
- times--;
- let data = {};
- if (times === 0) {
- //重新加载列表
- if (type == 1) data['activityGroup.products[' + i + '].end'] = true;
- else if (type == 2) data['joingroupList.products[' + i + '].end'] = true;
- else if (type == 3) data['bargainList.products[' + i + '].end'] = true;
- else if (type == 4) data['customersList.products[' + i + '].end'] = true;
- else if (type == 5) data['seckillList.products[' + i + '].end'] = true;
- clearInterval(timer);
- } else {
- let n = utils.formatDayTimes(times);
- if (type == 1) data['activityGroup.products[' + i + '].times'] = n;
- else if (type == 2) data['joingroupList.products[' + i + '].times'] = n;
- else if (type == 3) data['bargainList.products[' + i + '].times'] = n.split(
- /:|天/g);
- else if (type == 4) data['customersList.products[' + i + '].times'] = n;
- else if (type == 5) data['seckillList.products[' + i + '].times'] = n;
- }
- _ts.setData(data);
- }, 1000);
- if (type == 1) this.activityGroup.products[i]['timer'] = timer;
- else if (type == 2) this.joingroupList.products[i]['timer'] = timer;
- else if (type == 3) this.bargainList.products[i]['timer'] = timer;
- else if (type == 4) this.customersList.products[i]['timer'] = timer;
- // let fs = [];
- else if (type == 5) this.seckillList.products[i]['timer'] = timer;
- // fs['activityGroup[' + i + '].timer'] = timer;
- // _ts.setData(fs);
- }
- }
- },
- getsupplierList(supplierTemplate) {
- let form = {
- page: 1,
- limit: supplierTemplate.number,
- merchantId: this.merchant.id,
- supplier: supplierTemplate.contentId
- }; // form.supplier="1351512705560240130"
- return new Promise((resolve, reject) => {
- req.getRequest('/api/product/list', form, res => {
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: supplierTemplate.theme,
- lineNumber: supplierTemplate.lineNumber,
- products: res
- };
- this.setData({
- supplierList: res,
- supplierShow: true
- });
- resolve();
- });
- })
- },
- getBoutiqueList(boutiqueTemplate) {
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: boutiqueTemplate.number,
- type: 1,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id,
- attr: 'boutique'
- };
- if (boutiqueTemplate.content != '') {
- from.contentId = boutiqueTemplate.contentId;
- }
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: boutiqueTemplate.theme,
- lineNumber: boutiqueTemplate.lineNumber,
- products: res
- };
- this.setData({
- boutiqueList: res,
- boutiqueShow: true
- });
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let form = {
- page: 1,
- limit: boutiqueTemplate.number,
- attr: 'boutique',
- merchantId: this.merchant.id
- };
- if (boutiqueTemplate.content != '') {
- form.contentId = boutiqueTemplate.contentId;
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/product/list', form, res => {
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: boutiqueTemplate.theme,
- lineNumber: boutiqueTemplate.lineNumber,
- products: res
- };
- this.setData({
- boutiqueList: res,
- boutiqueShow: true
- });
- resolve();
- });
- })
- }
- },
- // 新品上架
- getArrivalsList(arrivalsTemplate) {
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: arrivalsTemplate.number,
- type: 1,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id,
- attr: 'news'
- };
- if (arrivalsTemplate.content != '') {
- from.contentId = arrivalsTemplate.contentId;
- }
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: arrivalsTemplate.theme,
- lineNumber: arrivalsTemplate.lineNumber,
- products: res
- };
- this.setData({
- arrivalsList: res,
- arrivalsShow: true
- });
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let form = {
- page: 1,
- limit: arrivalsTemplate.number,
- attr: 'news',
- merchantId: this.merchant.id
- };
- if (arrivalsTemplate.content != '') {
- form.contentId = arrivalsTemplate.contentId;
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/product/list', form, res => {
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: arrivalsTemplate.theme,
- lineNumber: arrivalsTemplate.lineNumber,
- products: res
- };
- this.setData({
- arrivalsList: res,
- arrivalsShow: true
- });
- resolve();
- });
- })
- }
- },
- // 热门爆款
- getHotList(hotTemplate) {
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: this.page,
- limit: hotTemplate.number,
- type: 1,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id,
- attr: 'sell_well'
- };
- if (hotTemplate.content != '') {
- from.contentId = hotTemplate.contentId;
- }
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, res => {
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: hotTemplate.theme,
- lineNumber: hotTemplate.lineNumber,
- products: res
- };
- this.setData({
- hotList: res,
- hotShow: true
- });
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let form = {
- page: 1,
- limit: hotTemplate.number,
- attr: 'sell_well',
- merchantId: this.merchant.id
- };
- if (hotTemplate.content != '') {
- form.contentId = hotTemplate.contentId;
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/product/list', form, res => {
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: hotTemplate.theme,
- lineNumber: hotTemplate.lineNumber,
- products: res
- };
- this.setData({
- hotList: res,
- hotShow: true
- });
- resolve();
- });
- })
- }
- },
- getPageList() {
- //Recommend
- // console.log(this.isLoad); // if (!this.data.isLoad) return false;
- // this.data.isLoad = false;
- let that = this;
- console.log('门店' + this.merchantId);
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: that.page,
- limit: that.recommendTemplate.number,
- type: 1,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id,
- attr: 'Recommend'
- };
- if (that.recommendTemplate.content != '') {
- from.contentId = that.recommendTemplate.contentId;
- }
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, data => {
- if (data && data.length >= 10) that.isLoad = true;
- if (that.page > 1) data = that.pageList.concat(data);
- // console.log(data);
- data = data.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- data = {
- displayStyle: that.recommendTemplate.theme,
- lineNumber: that.recommendTemplate.lineNumber,
- products: data
- };
- that.setData({
- pageList: data,
- hasmore: data && data.length > 0,
- recommendShow: true
- });
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let form = {
- page: that.page,
- limit: that.recommendTemplate.number,
- attr: 'Recommend',
- merchantId: this.merchant.id
- };
- if (that.recommendTemplate.content != '') {
- form.contentId = that.recommendTemplate.contentId;
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/product/list', form, res => {
- if (res && res.length >= 10) that.isLoad = true;
- if (that.page > 1) res = that.pageList.concat(res);
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: that.recommendTemplate.theme,
- lineNumber: that.recommendTemplate.lineNumber,
- products: res
- };
- that.setData({
- pageList: res,
- hasmore: res && res.length > 0,
- recommendShow: true
- });
- resolve();
- });
- })
- }
- },
- getSinglePageList() {
- //Recommend
- // console.log(this.isLoad); // if (!this.data.isLoad) return false;
- // this.data.isLoad = false;
- let that = this;
- console.log('门店' + this.merchantId);
- if ((this.merchant && this.merchant.type == 5) || (this.shopId && this.merchantId)) {
- let from = {
- page: that.singlePage,
- limit: that.singleTemplate.number,
- type: 1,
- merchantId: this.merchant.merchantDTO.id,
- sid: this.merchant.id
- };
- if (that.singleTemplate.content != '') {
- from.contentId = that.singleTemplate.contentId;
- delete from.attr;
- } else {
- from.attr = 'Recommend';
- }
- if (this.shopId && this.merchantId)(from.merchantId = this.merchantId), (from.sid = this.shopId);
- return new Promise((resolve, reject) => {
- req.getRequest('/api/shopProduct/list', from, data => {
- if (data && data.length >= 10) that.isLoadSingle = true;
- if (that.singlePage > 1) data = that.singleList.concat(data);
- // console.log(data);
- data = data.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- data = {
- displayStyle: that.singleTemplate.theme,
- lineNumber: that.singleTemplate.lineNumber,
- products: data
- };
- that.setData({
- singleList: data,
- hasmoreSingle: data && data.length > 0,
- singleShow: true
- });
- resolve();
- });
- })
- }
- if (this.merchant && this.merchant.type != 5) {
- let form = {
- page: that.singlePage,
- limit: that.singleTemplate.number,
- merchantId: this.merchant.id
- };
- if (that.singleTemplate.content != '') {
- form.contentId = that.singleTemplate.contentId;
- delete form.attr;
- } else {
- form.attr = 'Recommend';
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/product/list', form, res => {
- if (res && res.length >= 10) that.isLoadSingle = true;
- if (that.singlePage > 1) res = that.singleList.concat(res);
- res = res.map(it => {
- if (it.deliverWay && JSON.parse(it.deliverWay).indexOf(3) != -1) it
- .isJs = true;
- return it;
- });
- res = {
- displayStyle: that.singleTemplate.theme,
- lineNumber: that.singleTemplate.lineNumber,
- products: res
- };
- that.setData({
- singleList: res,
- hasmoreSingle: res && res.length > 0,
- singleShow: true
- });
- resolve();
- });
- })
- }
- },
- getOfficeList() {
- let form = {
- page: 1,
- limit: 4,
- orderType: 1
- }
- return new Promise((resolve, reject) => {
- req.getRequest('/api/v3/moments/list', form, res => {
- if (res && res.length > 0) {
- res.map(it => {
- if (it.url) {
- let h = it.url.substring(it.url.lastIndexOf('.') + 1)
- if (h.indexOf('mp4') < 0 && h.indexOf('MP4') < 0) {
- it.url = it.url.split(',');
- } else {
- it.isHaveVideo = true
- it.isControls = false
- it.isShowPlayBtn = true
- }
- }
- 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>'
- return it;
- })
- }
- this.officeList = res;
- resolve();
- })
- })
- },
- toDetail(e) {
- let id = e.currentTarget.dataset.id;
- let url = e.currentTarget.dataset.url;
- app.globalData.openPage('product/detail/detail?id=' + id +
- url); // app.openPage("product/detail/detail?id=" + id)
- },
- // 新客列表
- tocustomersList(event) {
- const index = event.currentTarget.dataset.index;
- const activity = this.customersList.products[index];
- const url = event.currentTarget.dataset.url;
- app.globalData.openPage('activity/newbornDetails/newbornDetails?acid=' + activity.id + '&id=' + activity
- .productId + url
- ); // app.openPage('activity/newbornDetails/newbornDetails?acid=' + activity.id + "&id=" + activity.productId);
- },
- addShopCart(e) {
- let state = e.currentTarget.dataset.state;
- let skuId = e.currentTarget.dataset.skuid;
- let id = e.currentTarget.dataset.id;
- let _ts = this;
- let params = {
- skuId: skuId,
- quantity: 1,
- merchantId: this.merchant.id,
- productId: id
- }; // if(state!=1){
- // return req.msg('您来晚了,商品已经下架')
- // }
- req.postRequest('/api/purchase/cart', params, res => {
- _ts.setData({
- isUpdate: !_ts.isUpdate
- });
- req.msg('加入购物车成功');
- });
- },
- toGroupRemind(event) {
- const index = event.currentTarget.dataset.index;
- const activity = this.activityGroup.products[index];
- const url = event.currentTarget.dataset.url;
- app.globalData.openPage('product/groupDetail/groupDetail?acid=' + activity.id + '&id=' + activity
- .productId + url
- ); // app.openPage('product/groupDetail/groupDetail?acid=' + activity.id + "&id=" + activity.productId);
- },
- toSeckillList(event) {
- const index = event.currentTarget.dataset.index;
- const activity = this.seckillList[index];
- const url = event.currentTarget.dataset.url;
- app.globalData.openPage('activity/seckillDetails/seckillDetails?acid=' + activity.id + '&id=' + activity
- .productId + url
- ); // app.openPage('activity/seckillDetails/seckillDetails?acid=' + activity.id + "&id=" + activity.productId);
- },
- addActivityRemind(event) {
- const index = event.currentTarget.dataset.index;
- const id = event.currentTarget.dataset.id;
- const type = event.currentTarget.dataset.type; // if(req.getStorage('userInfo')){
- // }
- req.postRequest(
- '/api/activity/remind', {
- activityId: id
- },
- res => {
- mes.remind().then(res => res);
- // mes.remind().then(res=>res)
- // mes.requsetmessage()
- req.msg('订阅提醒成功');
- let data = {};
- if (type == 1) data['activityGroup.products[' + index + '].isRemind'] = true;
- else if (type == 2) data['joingroupList.products[' + index + '].isRemind'] = true;
- else if (type == 3) data['seckillList.products[' + index + '].isRemind'] = true;
- else if (type == 4) data['bargainList.products[' + index + '].isRemind'] = true;
- else if (type == 5) data['customersList.products[' + index + '].isRemind'] = true;
- this.setData(data);
- }
- );
- },
- group(array, subGroupLength) {
- let index = 0;
- let newArray = [];
- while (index < array.length) {
- newArray.push(array.slice(index, (index += subGroupLength)));
- }
- return newArray;
- },
- cancelActivityRemind(event) {
- const index = event.currentTarget.dataset.index;
- const id = event.currentTarget.dataset.id;
- const type = event.currentTarget.dataset.type;
- if (req.header.appId == 'ZQ1VK5oc17I387E') {} else {
- req.postRequest(
- '/api/activity/cancel/remind', {
- id: id
- },
- res => {
- req.msg('取消提醒成功');
- let data = {};
- if (type == 1) data['activityGroup.products[' + index + '].isRemind'] = false;
- else if (type == 2) data['joingroupList.products[' + index + '].isRemind'] = false;
- else if (type == 3) data['seckillList.products[' + index + '].isRemind'] = false;
- else if (type == 4) data['bargainList.products[' + index + '].isRemind'] = false;
- else if (type == 5) data['customersList.products[' + index + '].isRemind'] = false;
- this.setData(data);
- }
- );
- }
- },
- clearAllTimer(type) {
- // console.log(this.activityGroup, this.joingroupList, this.bargainList, this.customersList);
- if (type == 1) {
- this.activityGroup.products.forEach(it => clearInterval(it.timer));
- this.activityGroup.products.forEach(it => clearInterval(it.times));
- } else if (type == 2) {
- this.joingroupList.products.forEach(it => clearInterval(it.timer));
- this.joingroupList.products.forEach(it => clearInterval(it.times));
- } else if (type == 3) {
- this.bargainList.products.forEach(it => clearInterval(it.timer));
- this.bargainList.products.forEach(it => clearInterval(it.times));
- } else if (type == 4) {
- this.customersList.products.forEach(it => clearInterval(it.timer));
- this.customersList.products.forEach(it => clearInterval(it.times));
- } else if (type == 5) {
- this.seckillList.products.forEach(it => clearInterval(it.timer));
- this.seckillList.products.forEach(it => clearInterval(it.times));
- }
- },
- hideGuide() {
- //关闭提示加入我的小程序
- this.setData({
- first: false
- });
- req.setStorage('first', false);
- },
- hideAd() {
- //关闭广告
- // if(this.data.first==false){
- this.setData({
- isLayerAd: false
- }); // }
- app.globalData.isLayerAd = false;
- },
- click(e) {
- // console.log(e)
- this.storeShow = e;
- },
- goUrl(event) {
- //跳转链接
- let url = event.currentTarget.dataset.url;
- app.globalData.openPage(url);
- },
- jumpHome() {
- app.globalData.reLaunchTo('pages/home/index');
- },
- getUpdate() {
- let userInfos = req.getStorage('userInfo');
- if (!userInfos.mobile) {
- console.log('没有手机号')
- this.isShowUpdate = true;
- this.isUpdateMobile = true;
- req.setStorage('isShowUpdateMobile', true)
- return false;
- }
- if (!userInfos.avatar || userInfos.avatar.indexOf('thirdwx.qlogo') > -1 || userInfos.nickName.indexOf(
- '用户') > -1) {
- console.log('没有昵称')
- this.isShowUpdate = true;
- this.isUpdateInfo = true;
- req.setStorage('isShowUpdateInfo', true)
- return false;
- }
- return true;
- },
- checkUpdate(url) {
- if (!req.isLogins(true)) return false;
- if (this.getUpdate()) this.jumpUrl(url);
- },
- closeUpdate() {
- this.isShowUpdate = false
- this.isUpdateInfo = false;
- this.isUpdateMobile = false;
- },
- updateMobileInfo(e) {
- if (e == 1) { //更新昵称头像
- this.getuserVip();
- this.getUserInfo();
- } else { //绑定手机号
- this.jumpUrl('/open/info/index');
- }
- }
- },
- beforeMount() {
- const systemInfo = uni.getSystemInfoSync();
- console.log('systemInfo==', systemInfo)
- // px转换到rpx的比例
- let pxToRpxScale = 750 / systemInfo.windowWidth;
- this.pxToRpxScale = pxToRpxScale;
- let systems = {
- ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
- navigationHeight: 44 * pxToRpxScale, // 导航栏的高度
- windowHeight: systemInfo.screenHeight * pxToRpxScale, // 导航栏的高度
- safeBottomHeight: systemInfo.safeAreaInsets.bottom * pxToRpxScale
- };
- systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
- systems.windowHeights = systems.windowHeight - 115 - systems.safeBottomHeight;
- // this.sheight = (500/pxToRpxScale)/2;
- this.systems = systems;
- console.log('systems==', systems)
- },
- onPageScroll(e) {
- this.clientData.pageY = e.scrollTop;
- if (e.scrollTop > this.sheight) {
- if (this.isPlay == 1) {
- this.isPlay = 2;
- }
- }
- if (this.isSoution || (this.config && this.config.is_hide_searchBox != 1)) {
- let height = this.systems.barHeight / this.pxToRpxScale;
- if (e.scrollTop > height) {
- this.isScroll = true;
- } else {
- this.isScroll = false;
- }
- }
- }
- };
- </script>
- <style>
- page {
- background-color: #fff;
- }
- </style>
- <style scoped>
- @import './index.css';
- </style>
|