index.vue 32 KB

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