index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  1. <template>
  2. <view>
  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 class="bg">
  17. <image :src="about.INDEX_PIC"></image>
  18. </view>
  19. <view v-if="!recommendCard">
  20. <view class="top-title ddflex" :style="'height: '+ systems.navigationHeight + 'rpx;top:' + systems.ktxStatusHeight + 'rpx;'">
  21. <image :src="about.CONFIG_PROJECT_LOGO" mode="heightFix"></image>
  22. {{about.CONFIG_PROJECT_TITLE?about.CONFIG_PROJECT_TITLE:''}}
  23. </view>
  24. </view>
  25. <view class="service-person" :style="'top:' + systems.ktxStatusHeight + 'rpx;'" v-if="recommendCard">
  26. <view class="ddflex" @click="jumpUrl('/card/index/index?cardId='+recommendCard.id)">
  27. <image class="service-person-header"
  28. :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
  29. <view>
  30. <view class="service-person-name ddflex">
  31. <view>{{recommendCard.realName}}的微页</view>
  32. <image src="/static/images/rico2.png" class="rico"></image>
  33. </view>
  34. <view class="service-person-number">(工号:{{recommendCard.jobNumber}}) 欢迎您来到我的微页</view>
  35. </view>
  36. </view>
  37. <view style="margin: 20rpx 30rpx 0;justify-content: space-between;" class="ddflex">
  38. <view>
  39. <view class="ddflex">
  40. <view class="service-person-tag">{{recommendCard.companyName}}</view>
  41. <view class="service-person-tag">{{recommendCard.jobName}}</view>
  42. </view>
  43. <view class="service-person-options ddflex">
  44. <view class="service-person-option ddflex">
  45. <image src="/static/pages/images/dz.png"></image>
  46. <view>{{recommendCard.favorableComment}}%</view>
  47. </view>
  48. <view class="service-person-option ddflex">
  49. <image src="/static/pages/images/cy.png"></image>
  50. <view>入司{{recommendCard.inDate?getAge(recommendCard.inDate):1}}年</view>
  51. </view>
  52. <view class="service-person-option ddflex">
  53. <image src="/static/pages/images/fw.png"></image>
  54. <view>为{{recommendCard.cntCust?recommendCard.cntCust:0}}人服务</view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="ddflex">
  59. <view class="service-person-phone" v-if="recommendCard.phone"
  60. @click="callPhone(recommendCard.phone)">
  61. <image src="../../static/pages/images/dh.png"></image>
  62. <view>电话</view>
  63. </view>
  64. <view class="service-person-phone" v-if="recommendCard.wechat" @click="isShowCodePop=true">
  65. <image src="../../static/pages/images/wx.png"></image>
  66. <view>微信</view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view style="height: 610rpx;"></view>
  72. <view v-for="(item, index) in contact" :key="index">
  73. <!-- 弹窗广告 -->
  74. <view style="position: absolute;top:290rpx;left: 0;right: 0;">
  75. <banner v-if="item == 'ad' && bannerShow" :bannerList="bannerList" :url="site" :web="url"
  76. :config="about" :couponList="couponList" :officeList="officeList"
  77. :districtTemplate="districtTemplate"></banner>
  78. </view>
  79. <district v-if="item == 'king_kong_district' && districtShow" :url="site" :web="url"
  80. :districtTemplate="districtTemplate"></district>
  81. </view>
  82. <view class="index-box" style="margin-top: 10rpx;" v-if="hotActivityList.length>0">
  83. <view class="index-box-title">热门活动</view>
  84. <view class="ddflex" style="margin-top: 20rpx;">
  85. <view style="margin-right: 20rpx;">
  86. <image class="pic230" :src="hotActivityList[0].pic" @click="getUrl2(hotActivityList[0])"></image>
  87. <image class="pic230" style="margin-top: 20rpx;" :src="hotActivityList[1].pic" @click="getUrl2(hotActivityList[1])"></image>
  88. </view>
  89. <image class="pic480" :src="hotActivityList[2].pic" @click="getUrl2(hotActivityList[2])"></image>
  90. </view>
  91. </view>
  92. <!-- 参与活动 -->
  93. <view class="index-box" style="margin-top: 50rpx;" v-if="matchList.length>0">
  94. <view class="index-box-title">更多活动</view>
  95. <view class="map-ac">
  96. <scroll-view scroll-x="true" class="map-acs">
  97. <view class="li" v-for="(item,index) in matchList" :key="index"
  98. @click="jumpUrl('/match/activityDetail/activityDetail?id='+item.id)">
  99. <view style="position: relative;border-radius: 20rpx;overflow: hidden;">
  100. <image :src="item.pic ? item.pic : '/static/images/def_zw1.png'" mode="aspectFill"></image>
  101. <view class="ac-type" v-if="item.categoryName">{{ item.categoryName }}</view>
  102. </view>
  103. <view class="ac-title tovers">{{ item.title }}</view>
  104. </view>
  105. </scroll-view>
  106. </view>
  107. </view>
  108. <!-- 投保案例 -->
  109. <view class="index-box" style="margin:0;padding: 30rpx;background-color: #f5f5f5;" v-if="tbalList.length>0">
  110. <view class="index-box-title">投保案例</view>
  111. <view>
  112. <view class="tbal-nav ddflex">
  113. <view :class="'tbal-nav-item '+(tbalIndex==index?'tbal-nav-item-active':'' )"
  114. v-for="item,index in tbalList" @click="changeTbalTab(index)" :key="index">
  115. <view>{{item.name}}</view>
  116. <view class="tbal-nav-label" v-if="index==0">20~30岁</view>
  117. <view class="tbal-nav-label" v-else-if="index==1">25-35岁</view>
  118. <view class="tbal-nav-label" v-else-if="index==2">30-50岁</view>
  119. <view class="tbal-nav-label" v-else-if="index==3">50-65岁</view>
  120. </view>
  121. <!-- <view class="tbal-nav-item">
  122. <view>形成期</view>
  123. <view class="tbal-nav-label">20~30岁</view>
  124. </view>
  125. <view class="tbal-nav-item">
  126. <view>成长期</view>
  127. <view class="tbal-nav-label">20~30岁</view>
  128. </view>
  129. <view class="tbal-nav-item">
  130. <view>成熟期</view>
  131. <view class="tbal-nav-label">20~30岁</view>
  132. </view> -->
  133. </view>
  134. <block v-if="tbalList[tbalIndex].contentList&&tbalList[tbalIndex].contentList.length>0">
  135. <view class="tbal-item ddflex" v-for="it in tbalList[tbalIndex].contentList"
  136. @click="jumpUrl('/topic/alContent/alContent?id='+it.id)">
  137. <image class="tbal-pic" :src="it.pic?it.pic:'/static/images/lj_img.png'"></image>
  138. <view class="flex">
  139. <view class="tbal-title">{{it.title}}</view>
  140. <view class="ddflex">
  141. <view class="ddflex flex">
  142. <view class="tbal-price">
  143. {{it.fieldValues&&it.fieldValues.yearMoney?it.fieldValues.yearMoney:'0'}}
  144. </view>
  145. <view class="tbal-price-text">年缴费</view>
  146. </view>
  147. <view class="tbal-line"></view>
  148. <view class="ddflex flex">
  149. <view class="tbal-price">
  150. {{it.fieldValues&&it.fieldValues.allMoney?it.fieldValues.allMoney:'0'}}
  151. </view>
  152. <view class="tbal-price-text">总保额 </view>
  153. </view>
  154. </view>
  155. <view class="tbal-btn">去看看</view>
  156. </view>
  157. <view class="tbal-tag" v-if="it.fieldValues&&it.fieldValues.version">{{it.fieldValues.version}}
  158. </view>
  159. </view>
  160. </block>
  161. <view class="nodata" v-else style="padding-top: 0rpx;">
  162. <image :src="picUrlss+'empty_dd.png'"></image>
  163. <text>暂无数据</text>
  164. </view>
  165. </view>
  166. </view>
  167. <!-- 真实理赔故事 -->
  168. <view class="index-box" v-if="lpalList.length>0">
  169. <view class="index-box-title ddflex">
  170. <text class="fflex">真实理赔故事</text>
  171. <view class="fx-header-more ddflex"
  172. @click="jumpUrl('/topic/contentList/contentList?code='+lpalCode+'&title=理赔案例')">
  173. 更多
  174. <image src="/static/pages/images/more.png"></image>
  175. </view>
  176. </view>
  177. <view class="map-ac">
  178. <scroll-view scroll-x="true" class="map-acs ddflex" style="height: 430rpx;">
  179. <view class="lpgs-item" v-for="items,indexs in lpalList ">
  180. <image class="lpgs-icon" src="../../static/images/lpgs_icon.png"></image>
  181. <view :class="'lpgs-header '+(indexs%2==0?'':'lpgs-header-c')">
  182. <view>{{items.name}}</view>
  183. </view>
  184. <view class="lpgs-content" v-if="items.contentList&&items.contentList.length>0">
  185. <view class="lpgs-item-content ddflex" v-for="item,index in items.contentList" :key="index"
  186. @click="jumpUrl('/topic/content/content?id='+item.id)">
  187. <view class="flex" style="min-width: 0;">
  188. <view class="lpgs-item-content-title tovers">{{item.title}}</view>
  189. <view class="lpgs-item-content-look ddflex">
  190. <image src="/static/images/eyes.png"></image>
  191. <view>{{unitFormat(item.browse)}}</view>
  192. </view>
  193. </view>
  194. <image class="lpgs-item-content-pic"
  195. :src="item.pic?item.pic:'/static/images/lj_img.png'"></image>
  196. </view>
  197. </view>
  198. <view class="lpgs-content" v-else>
  199. <view class="nodata" style="padding-top: 40rpx;padding-bottom: 40rpx;">
  200. <image :src="picUrlss+'empty_dd.png'" style="margin: 0 auto 0rpx;width: 208rpx;height: 139rpx;" mode="aspectFill"></image>
  201. <text>暂无数据</text>
  202. </view>
  203. </view>
  204. </view>
  205. </scroll-view>
  206. </view>
  207. </view>
  208. <!-- 发现 -->
  209. <view class="index-box" style="margin:0;padding: 30rpx;background-color: #f5f5f5;" v-if="fxList.length>0">
  210. <view class="map-ac">
  211. <scroll-view scroll-x="true" class="map-acs ddflex" style="height: 70rpx;">
  212. <view :class="'fx-nav '+(fxIndex==index?'fx-nav-active':'')" v-for="item,index in fxList"
  213. @click="changeFxTab(index)">{{item.name}}</view>
  214. </scroll-view>
  215. </view>
  216. <view class="fx-bar">
  217. <view class="fx-header ddflex">
  218. <view class="ddflex">
  219. <view class="fx-header-title">{{fxList[fxIndex].name}}</view>
  220. <view class="fx-header-more">{{unitFormat(fxList[fxIndex].shareCount?fxList[fxIndex].shareCount:0)}}人浏览</view>
  221. </view>
  222. <view class="fx-header-more ddflex"
  223. @click="jumpUrl('/topic/contentList/contentList?code='+fxList[fxIndex].code+'&title='+fxList[fxIndex].name)">
  224. 更多
  225. <image src="/static/pages/images/more.png"></image>
  226. </view>
  227. </view>
  228. <view v-if="fxContentList.length>0">
  229. <view class="fx-item ddflex" v-for="item in fxContentList"
  230. @click="jumpUrl('/topic/content/content?id='+item.id)">
  231. <view class="flex" style="min-width: 0;">
  232. <view class="fx-item-title tovers">{{item.title}}</view>
  233. <view class="ddflex" style="margin-top: 24rpx;">
  234. <view class="fx-item-time">{{formatTime(item.createDate)}}</view>
  235. <view class="fx-item-look ddflex">
  236. <image src="/static/images/eyes.png"></image>
  237. <view>{{unitFormat(item.browse)}}</view>
  238. </view>
  239. </view>
  240. </view>
  241. <image class="fx-item-pic" :src="item.pic?item.pic:'../../static/images/lj_img.png'"></image>
  242. </view>
  243. </view>
  244. <view class="nodata" v-else style="padding-top: 0rpx;padding-bottom: 40rpx;">
  245. <image :src="picUrlss+'empty_dd.png'" style="margin: 0 auto 0rpx;width: 208rpx;height: 139rpx;" mode="aspectFill"></image>
  246. <text>暂无数据</text>
  247. </view>
  248. </view>
  249. </view>
  250. <!-- <component v-for="(item,index) in contact" ></component> -->
  251. <!-- <ad></ad> -->
  252. <block v-if="contactShow">
  253. <view class="spinner">
  254. <view class="spinner-container container1">
  255. <view class="circle1"></view>
  256. <view class="circle2"></view>
  257. <view class="circle3"></view>
  258. <view class="circle4"></view>
  259. </view>
  260. <view class="spinner-container container2">
  261. <view class="circle1"></view>
  262. <view class="circle2"></view>
  263. <view class="circle3"></view>
  264. <view class="circle4"></view>
  265. </view>
  266. <view class="spinner-container container3">
  267. <view class="circle1"></view>
  268. <view class="circle2"></view>
  269. <view class="circle3"></view>
  270. <view class="circle4"></view>
  271. </view>
  272. </view>
  273. <view class="lond">加载中···</view>
  274. </block>
  275. <view class="foot-logo">
  276. <image src="/static/images/zgrs_logo.png"></image>
  277. </view>
  278. <!-- <footer-copyright v-if="logo"></footer-copyright> -->
  279. <!-- <contact-button img-url="/static/pages/images/kfico1_1.png" class-name="contact_index" button-text="客服"></contact-button> -->
  280. <!-- <view class="guide" @tap="hideGuide" v-if="first">
  281. <image src="/static/pages/images/guide.png" mode="widthFix"></image>
  282. </view> -->
  283. <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 115) + 'rpx'"></view> -->
  284. <foot channel="home" :isUpdate="isUpdate"></foot>
  285. <view class="ceng2" v-if="isShowCodePop" @click="isShowCodePop = false" @touchmove.stop.prevent="moveHandle">
  286. </view>
  287. <view class="code-pop" v-if="isShowCodePop">
  288. <view class="code-content" v-if="recommendCard.wechatCode">
  289. <image :src="recommendCard.wechatCode?recommendCard.wechatCode:'/static/images/wxCode.jpg'"
  290. show-menu-by-longpress="true"></image>
  291. <view style="text-align: center;font-size: 24rpx;color: #999;margin-bottom: 50rpx;">长按识别微信二维码</view>
  292. </view>
  293. <view class="code-text" v-else>
  294. <view>微信号</view>
  295. <view>{{recommendCard.wechat}}</view>
  296. </view>
  297. <view class="code-btn" @click="copy(recommendCard.wechat)">
  298. 复制微信号
  299. </view>
  300. </view>
  301. <msgNumber :bottom="recommendCard?'350rpx':'230rpx'"></msgNumber>
  302. <!-- <view class="chat-fixed" v-if="recommendCard">
  303. <view class="chat-box ddflex" @click="jumpSingleChatRoom()">
  304. <image :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
  305. <view class="chat-lyl">聊一聊</view>
  306. </view>
  307. </view> -->
  308. <view :class="'chat-fixed '+(chatShow?'chat-fixed-long':'')" v-if="recommendCard">
  309. <view class="chat-box ddflex" @click="jumpSingleChatRoom()">
  310. <image :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
  311. <view v-if="chatShowText" class="fflex tover"
  312. style="font-size: 24rpx;color: #333333;margin-left: 20rpx;">您好,我是{{recommendCard.realName}},欢迎访问我的微页
  313. </view>
  314. <view :class="'chat-lyl '+(!chatShowText?'chat-lyl2':'')">聊一聊</view>
  315. </view>
  316. </view>
  317. </view>
  318. </template>
  319. <script>
  320. //index.js
  321. //获取应用实例
  322. const app = getApp();
  323. const req = require('../../utils/request.js');
  324. const api = require('../../utils/api.js');
  325. const utils = require('../../utils/util.js');
  326. const mes = require('../../utils/requestmessage.js');
  327. const route = require('../../utils/route');
  328. const QQMapWX = require("../../utils/qqmap.js");
  329. import foot from '../../components/nav-bar/index';
  330. import footerCopyright from '../../components/footer-copyright/footer-copyright';
  331. import banner from '../../template/banner/banner';
  332. import district from '../../template/king_kong_district/king_kong_district';
  333. import msgNumber from '../../components/msg-number/index.vue';
  334. export default {
  335. data() {
  336. return {
  337. picUrlss: req.public.picUrls,
  338. skinNotColor: req.public.skinNotColor,
  339. systems: {},
  340. header: req.header,
  341. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  342. bannerList: [],
  343. //产品分类列表
  344. page: 1,
  345. //产品列表
  346. merchant: {},
  347. activityGroup: {
  348. products: []
  349. },
  350. couponList: {}, //优惠券,
  351. isUpdate: false,
  352. // 是否更新消息
  353. // first: true,
  354. //是否显示提示加入我的小程序
  355. isLayerAd: true,
  356. //广告
  357. homeTemplate: [],
  358. //首页栏目配置
  359. storeShow: true,
  360. templateType: {
  361. module_ad: 'ad',
  362. //广告
  363. module_type_district: 'type_district',
  364. //分类导航
  365. module_king_kong_district: 'king_kong_district', //金刚区
  366. },
  367. isNotice: false,
  368. joingroupList: {
  369. products: []
  370. },
  371. //拼团
  372. bargainList: {
  373. products: []
  374. },
  375. //砍价
  376. customersList: {
  377. products: []
  378. },
  379. //新客
  380. freshen: true,
  381. url: '',
  382. web: '',
  383. site: '',
  384. districtTemplate: {},
  385. contact: [],
  386. seckillList: {
  387. products: []
  388. },
  389. about: {},
  390. Is_Store_Price_Stock: '',
  391. guarantee: [],
  392. animationData: '',
  393. content: '',
  394. popAdList: {},
  395. iscouponAd: false,
  396. logo: false,
  397. top: Boolean,
  398. top_type: Boolean,
  399. switchStoreShow: Boolean,
  400. contactShow: true,
  401. districtShow: false,
  402. bannerShow: false,
  403. officeList: [], //互动
  404. hotActivityList: [], //热门活动
  405. matchList: [], //活动列表
  406. tbalList: [], //投保案例
  407. tbalIndex: 0, //投保案例tab
  408. lpalList: [], //理赔案例
  409. fxList: [], //发现
  410. fxIndex: 0,
  411. fxContentList: [],
  412. recommendCard: '', //销售
  413. isShowCodePop: false,
  414. lpalCode: req.public.lpalCode,
  415. chatShow: true,
  416. chatShowText: true
  417. };
  418. },
  419. components: {
  420. foot,
  421. footerCopyright,
  422. banner,
  423. district,
  424. msgNumber
  425. },
  426. props: {},
  427. onLoad: async function(options) {
  428. // console.log("扫码进去参数===" + JSON.stringify(options));
  429. // if (options.scene) {
  430. // // this.scene = options.scene || '1290926887903780865';
  431. // this.scene = options.scene;
  432. // await this.loadCodeParams();
  433. // }
  434. // wx.setNavigationBarColor({
  435. // frontColor: '#ffffff',
  436. // backgroundColor: req.public.titleTopBgColor,
  437. // })
  438. // this.getPopAd()
  439. this.query = options;
  440. req.silenceLogin(options.userId, '');
  441. if (options.custom_params) {
  442. let obj = decodeURIComponent(opt.custom_params);
  443. obj = JSON.parse(obj);
  444. // console.log(obj)
  445. req.setStorage('pidCode', obj.userId);
  446. }
  447. if (options.isShare) {
  448. if (options.userId) {
  449. req.setStorage('pidCode', options.userId);
  450. }
  451. }
  452. setInterval(() => {
  453. this.setData({
  454. isNotice: true
  455. });
  456. }, 10000); // this.init();
  457. // QQMapWX.initMap();
  458. // req.getLocation(res => {
  459. // const to = {
  460. // latitude: res.latitude,
  461. // longitude: res.longitude
  462. // };
  463. // QQMapWX.reverseGeocoder(to, resp => {});
  464. // });
  465. },
  466. async onShow() {
  467. let _ts = this;
  468. await this.getConfig().then(res => {});
  469. await this.getHomeTemplateConfig();
  470. uni.setNavigationBarColor({
  471. frontColor: this.skinNotColor ? '#000' : '#ffffff',
  472. backgroundColor: req.public.titleTopBgColor
  473. });
  474. _ts.setData({
  475. isUpdate: !_ts.isUpdate
  476. });
  477. this.getHotActivity()
  478. this.getMatchList()
  479. this.getTbal()
  480. this.getLpal()
  481. this.getFx()
  482. QQMapWX.initMap();
  483. req.getLocation(res => {
  484. const to = {
  485. latitude: res.latitude,
  486. longitude: res.longitude
  487. };
  488. QQMapWX.reverseGeocoder(to, resp => {});
  489. this.getRecommendCard(to)
  490. });
  491. // console.log('this.freshen=='+this.freshen)
  492. // let first = req.getStorage('first');
  493. // if (first !== false)
  494. // _ts.setData({
  495. // first: true
  496. // });
  497. // else
  498. // _ts.setData({
  499. // first: false
  500. // });
  501. },
  502. onUnload() {
  503. // this.isShowTime = false;
  504. this.clearAllTimer(1);
  505. this.clearAllTimer(2);
  506. this.clearAllTimer(3);
  507. this.clearAllTimer(4);
  508. },
  509. onHide() {
  510. // this.isShowTime = false;
  511. this.clearAllTimer(1);
  512. this.clearAllTimer(2);
  513. this.clearAllTimer(3);
  514. this.clearAllTimer(4);
  515. },
  516. onShareAppMessage: function() {
  517. },
  518. onShareTimeline() {
  519. },
  520. onReachBottom() {},
  521. methods: {
  522. jumpSingleChatRoom() {
  523. if (this.recommendCard) {
  524. req.jumpSingleChatRoom(this.recommendCard.userId, this.recommendCard.avatar, this.recommendCard
  525. .realName);
  526. }
  527. },
  528. jumpUrl(url) {
  529. if (req.isLogins(false)) {
  530. uni.navigateTo({
  531. url: url
  532. })
  533. }
  534. },
  535. // 获取推荐销售
  536. getRecommendCard(loction) {
  537. let params = loction
  538. req.getRequest('/api/visiting/card/recommendCardInfo', params, res => {
  539. this.recommendCard = res
  540. console.log('获取推荐销售》》》》》', res);
  541. setTimeout(() => {
  542. this.chatShow = false
  543. setTimeout(() => {
  544. this.chatShowText = false
  545. }, 450)
  546. }, 2000)
  547. })
  548. },
  549. // 获取热门活动
  550. getHotActivity() {
  551. req.getRequest('/api/banner', {
  552. code: 'index_hot_activity'
  553. }, res => {
  554. this.hotActivityList = res
  555. })
  556. },
  557. // 获取更多活动
  558. getMatchList() {
  559. req.getRequest('/api/match/list', {
  560. page: 1,
  561. limit: 10
  562. }, res => {
  563. this.matchList = res
  564. })
  565. },
  566. // 获取投保案例
  567. async getTbal() {
  568. this.tbalList = await this.getContentList(req.public.tbalCode)
  569. this.tbalList[this.tbalIndex].contentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
  570. .code)
  571. this.$forceUpdate()
  572. },
  573. // 获取理赔案例
  574. async getLpal() {
  575. this.lpalList = await this.getContentList(req.public.lpalCode)
  576. this.lpalList.map(async item => {
  577. item.contentList = await this.getContentPageList(item.code)
  578. this.$forceUpdate()
  579. })
  580. },
  581. // 获取发现
  582. async getFx() {
  583. this.fxList = await this.getContentList('faxian')
  584. this.getFxContenteList(this.fxList[this.fxIndex].code)
  585. },
  586. // 获取文章栏目列表
  587. getContentList(code) {
  588. return new Promise((r, j) => {
  589. req.getRequest('/api/content/category/list', {
  590. parentCode: code
  591. }, res => {
  592. r(res ? res : [])
  593. })
  594. })
  595. },
  596. // 获取文章列表
  597. getContentPageList(code) {
  598. return new Promise((r, j) => {
  599. req.getRequest('/api/content/list', {
  600. code: code,
  601. page: 1,
  602. limit: 2
  603. }, res => {
  604. r(res ? res : [])
  605. })
  606. })
  607. },
  608. // 获取发现文章列表
  609. getFxContenteList(code) {
  610. return new Promise((r, j) => {
  611. req.getRequest('/api/content/list', {
  612. code: code,
  613. page: 1,
  614. limit: 10
  615. }, res => {
  616. this.fxContentList = res ? res : []
  617. r(res ? res : [])
  618. })
  619. })
  620. },
  621. // 投保案例tab切换
  622. async changeTbalTab(index) {
  623. if (this.tbalIndex == index) return false;
  624. this.tbalIndex = index
  625. this.tbalList[this.tbalIndex].contentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
  626. .code)
  627. },
  628. // 发现tab切换
  629. changeFxTab(index) {
  630. if (this.fxIndex == index) return false;
  631. this.fxIndex = index
  632. this.getFxContenteList(this.fxList[this.fxIndex].code)
  633. },
  634. async getRqeDatas() {
  635. console.log('getRqeDatas');
  636. let that = this; //多门店
  637. // 金刚区
  638. let district = that.homeTemplate.filter(it => it.module == that.templateType
  639. .module_king_kong_district);
  640. if (district && district.length > 0 && district[0].state == 0) {
  641. let data = district[0];
  642. data.content = JSON.parse(district[0].content);
  643. that.districtTemplate = data;
  644. if (data.contentId == 2) {
  645. that.districtShow = true;
  646. }
  647. console.log(that.districtTemplate, '=============');
  648. }
  649. //顶部banner
  650. let ad = that.homeTemplate.filter(it => it.module == that.templateType.module_ad);
  651. if (ad && ad.length > 0 && ad[0].state == 0) {
  652. if (that.freshen) {
  653. await that.getBannerList(ad[0].module, ad[0].contentId);
  654. }
  655. }
  656. that.logo = true;
  657. },
  658. //获取首页模板配置
  659. getHomeTemplateConfig() {
  660. let _ts = this;
  661. let page = 'index';
  662. //荣康模板配置、小店产品==门店产品
  663. // if (this.merchant && this.merchant.type == 5 || this.shopId && this.merchantId) page = 'shopIndex'
  664. req.getRequest(
  665. '/api/template/getTemplate', {
  666. page: page
  667. },
  668. data => {
  669. let arr = [];
  670. data.forEach(it => {
  671. arr.push(it.module);
  672. });
  673. this.setData({
  674. contact: [...new Set(arr)],
  675. contactShow: false
  676. });
  677. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('store_options') != -1) {
  678. this.top = false;
  679. } else {
  680. this.top = true;
  681. }
  682. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('type_district') != -1) {
  683. this.top_type = false;
  684. } else {
  685. this.top_type = true;
  686. }
  687. console.log(this.contact.indexOf('sou') != -1, this.contact.indexOf('store_options') != -1,
  688. this.contact.indexOf('type_district') != -1, this.top);
  689. console.log(this.contact);
  690. this.setData({
  691. homeTemplate: data
  692. });
  693. this.getRqeDatas();
  694. }
  695. );
  696. },
  697. getConfig() {
  698. var _this = this;
  699. return new Promise((res, rej) => {
  700. req.g(
  701. '/api/other/config',
  702. data => {
  703. req.setStorage('configRes', JSON.stringify(data));
  704. this.about = data;
  705. if (!data.Index_Store_Confirm || data.Index_Store_Confirm == 0) {
  706. _this.setData({
  707. switchStoreShow: false,
  708. storeShow: false
  709. });
  710. } else {
  711. _this.setData({
  712. switchStoreShow: true
  713. });
  714. }
  715. // console.log(data.Index_Store_Confirm, "====", !data.Index_Store_Confirm, typeof(res
  716. // .Index_Store_Confirm))
  717. uni.setNavigationBarTitle({
  718. // title: res['CONFIG_PROJECT_TITLE'],
  719. title: data['CONFIG_PROJECT_TITLE']
  720. });
  721. // console.log(data.Is_Store_Price_Stock);
  722. if (data.Is_Store_Price_Stock) {
  723. this.Is_Store_Price_Stock = data.Is_Store_Price_Stock;
  724. }
  725. this.setData({
  726. Is_Store_Price_Stock: data.Is_Store_Price_Stock
  727. });
  728. if (data.b2c_service_guarantee && data.b2c_service_guarantee != null) {
  729. this.setData({
  730. guarantee: data.b2c_service_guarantee.split(';').filter(it => {
  731. return (it = it && it.trim());
  732. })
  733. });
  734. }
  735. req.setStorage('appName', data['CONFIG_PROJECT_TITLE']);
  736. req.setStorage('productDiy', data['Product_Foot-Diy']);
  737. res(data);
  738. },
  739. true
  740. );
  741. });
  742. },
  743. merchantFun() {
  744. app.globalData.openPage('pages/nearby/nearby');
  745. },
  746. saoma() {
  747. var _this = this; // 允许从相机和相册扫码
  748. uni.scanCode({
  749. success: res => {
  750. uni.navigateTo({
  751. url: '/' + res.path
  752. }); // this.scene = '1290926887903780865';
  753. this.loadCodeParams();
  754. }
  755. });
  756. },
  757. update(content) {
  758. var that = this;
  759. var animation = uni.createAnimation(); // 旧消息向上平移
  760. animation.translateY(-50).step({
  761. duration: 1000,
  762. timingFunction: 'ease-in'
  763. }); // 为了实现下一条新内容向上平移的效果,必须把内容很快平移到下方,并且不能被用户看见,这里其原理类似轮播图的思路。
  764. // 实现方法:动画时间设置为1ms,过渡效果设置为’动画第一帧就跳至结束状态直到结束‘
  765. animation
  766. .opacity(0)
  767. .translateY(50)
  768. .step({
  769. duration: 1000,
  770. timingFunction: 'step-start'
  771. }); // 新消息向上平移的同时恢复透明
  772. animation
  773. .opacity(1)
  774. .translateY(0)
  775. .step({
  776. duration: 1000,
  777. timingFunction: 'ease-out'
  778. });
  779. that.setData({
  780. animationData: animation.export()
  781. }); // 更新内容的延时必须大于第一步动画时间
  782. setTimeout(() => {
  783. that.setData({
  784. content: content
  785. });
  786. }, 500000);
  787. },
  788. loadCodeParams() {
  789. let _ts = this;
  790. return new Promise((resolve, reject) => {
  791. if (!_ts.scene) {
  792. resolve();
  793. return false;
  794. }
  795. req.getRequest(
  796. '/api/code/params', {
  797. scene: _ts.scene
  798. },
  799. data => {
  800. req.setStorage('pidCode', data.userId);
  801. resolve();
  802. }
  803. );
  804. });
  805. },
  806. getBannerList(module, contentId) {
  807. //banner图
  808. let that = this;
  809. return new Promise((resolve, reject) => {
  810. req.getRequest(
  811. '/api/banner', {
  812. groupId: contentId
  813. },
  814. data => {
  815. if (module == that.templateType.module_ad) {
  816. that.setData({
  817. bannerList: data,
  818. bannerShow: true
  819. });
  820. } else {
  821. that.setData({
  822. popAdList: data[0]
  823. });
  824. }
  825. resolve();
  826. }
  827. );
  828. })
  829. },
  830. clearAllTimer(type) {
  831. // console.log(this.activityGroup, this.joingroupList, this.bargainList, this.customersList);
  832. if (type == 1) {
  833. this.activityGroup.products.forEach(it => clearInterval(it.timer));
  834. this.activityGroup.products.forEach(it => clearInterval(it.times));
  835. } else if (type == 2) {
  836. this.joingroupList.products.forEach(it => clearInterval(it.timer));
  837. this.joingroupList.products.forEach(it => clearInterval(it.times));
  838. } else if (type == 3) {
  839. this.bargainList.products.forEach(it => clearInterval(it.timer));
  840. this.bargainList.products.forEach(it => clearInterval(it.times));
  841. } else if (type == 4) {
  842. this.customersList.products.forEach(it => clearInterval(it.timer));
  843. this.customersList.products.forEach(it => clearInterval(it.times));
  844. } else if (type == 5) {
  845. this.seckillList.products.forEach(it => clearInterval(it.timer));
  846. this.seckillList.products.forEach(it => clearInterval(it.times));
  847. }
  848. },
  849. // hideGuide() {
  850. // //关闭提示加入我的小程序
  851. // this.setData({
  852. // first: false
  853. // });
  854. // req.setStorage('first', false);
  855. // },
  856. hideAd() {
  857. //关闭广告
  858. // if(this.data.first==false){
  859. this.setData({
  860. isLayerAd: false
  861. }); // }
  862. app.globalData.isLayerAd = false;
  863. },
  864. click(e) {
  865. // console.log(e)
  866. this.storeShow = e;
  867. },
  868. goUrl(event) {
  869. //跳转链接
  870. let url = event.currentTarget.dataset.url;
  871. app.globalData.openPage(url);
  872. },
  873. // 拨打电话
  874. callPhone(val) {
  875. if (!val) return false
  876. uni.makePhoneCall({
  877. phoneNumber: val
  878. });
  879. },
  880. copy(val) {
  881. this.isShowCodePop = false
  882. uni.setClipboardData({
  883. data: val,
  884. complete() {
  885. req.msg('复制成功')
  886. }
  887. })
  888. },
  889. unitFormat(data) {
  890. return req.unitConverter(data).text
  891. },
  892. formatTime(date) {
  893. date = new Date(date.replace(/-/g, '/'))
  894. return utils.formatTime(date).t3
  895. },
  896. getAge(date) {
  897. return utils.getAge(date)
  898. },
  899. // 热门活动
  900. getUrl2(item) {
  901. console.log(item)
  902. var dt = item
  903. var url = "";
  904. var id = "";
  905. var acid = "";
  906. if (dt.content != "") {
  907. let conunt = dt.content.split("_");
  908. id = conunt[1];
  909. acid = conunt[0];
  910. }
  911. if (dt.type * 1 == 2 && dt.content != "") {
  912. url = "product/detail/detail?id=" + dt.content;
  913. } else if (dt.type * 1 == 3) {
  914. url = dt.content;
  915. console.log('url===',url)
  916. if(!url){
  917. req.msg('功能待接入')
  918. return false
  919. }
  920. if(url=='pages/index/index'||url=='pages/matchList/index'||url=='pages/interactive/index'||url=='pages/found/found'||url=='pages/user/user'){
  921. app.globalData.switchTab(url)
  922. return false
  923. }else{
  924. if(url.indexOf('http')!=-1){
  925. app.globalData.openPage('pages/web/web?url='+url);
  926. return false
  927. }
  928. }
  929. } else if (dt.type * 1 == 4) {
  930. url = "product/groupDetail/groupDetail?acid=" + acid + "&id=" + id;
  931. } else if (dt.type * 1 == 5) {
  932. url = "product/coupon/coupon";
  933. } else if (dt.type * 1 == 6) {
  934. url = "pages/live/live";
  935. } else if (dt.type * 1 == 7) {
  936. url = "product/groupList/groupList" + dt.merchant;
  937. } else if (dt.type * 1 == 9 && dt.content != "") {
  938. url = "product/list/list?id=" + dt.content + '&title=' + dt.title + this.web;
  939. } else if (dt.type * 1 == 10) {
  940. url = "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + dt.content;
  941. // console.log(
  942. // url); // url=`plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${dt.content}`
  943. } else if (dt.type * 1 == 11) {
  944. url = "activity/group/index/index" + dt.merchant;
  945. } else if (dt.type * 1 == 12) {
  946. url = "activity/seckill/seckill" + dt.merchant;
  947. } else if (dt.type * 1 == 13) {
  948. url = "activity/bargain/index/index" + dt.merchant;
  949. } else if (dt.type * 1 == 14) {
  950. url = "activity/newbornZone/newbornZone" + dt.merchant;
  951. } else if (dt.type * 1 == 15 && dt.content != "") {
  952. url = "activity/newbornDetails/newbornDetails?acid=" + acid + "&id=" + id;
  953. } else if (dt.type * 1 == 16 && dt.content != "") {
  954. url = "activity/seckillDetails/seckillDetails?acid=" + acid + "&id=" + id;
  955. } else if (dt.type * 1 == 17 && dt.content != "") {
  956. url = "activity/bargain/detail/detail?acid=" + acid + "&id=" + id;
  957. } else if (dt.type * 1 == 18 && dt.content != "") {
  958. url = "activity/group/detail/detail?acid=" + acid + "&id=" + id;
  959. }else if (dt.type * 1 == 19 && dt.content != "") {
  960. url = "topic/content/content?id=" + dt.content;
  961. } else {
  962. url = "";
  963. }
  964. if (dt.type * 1 == 6) app.globalData.switchTab(url);
  965. else app.globalData.openPage(url);
  966. this.hideAd();
  967. },
  968. },
  969. mounted() {
  970. const systemInfo = uni.getSystemInfoSync();
  971. // px转换到rpx的比例
  972. let pxToRpxScale = 750 / systemInfo.windowWidth;
  973. let systems = {
  974. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  975. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  976. };
  977. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  978. this.systems = systems;
  979. }
  980. };
  981. </script>
  982. <style>
  983. @import './index.css';
  984. </style>