index.vue 33 KB

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