index.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154
  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||recommendCard.wechatCode" @click="showCodePop()">
  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;" v-if="bannerList&&bannerList.length>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">{{tbalName}}</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">{{lpalName}}</text>
  148. <view class="fx-header-more ddflex"
  149. @click="jumpUrl('/topic/contentList/contentList?code='+lpalCode+'&title='+lpalName)">
  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: 502rpx;">
  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 tovers3">{{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 tovers3">{{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'" mode="aspectFill"></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)" v-if="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. tbalName:'',
  386. tbalList: [], //投保案例
  387. tbalIndex: 0, //投保案例tab
  388. tbalContentList: [],
  389. lpalName:'',
  390. lpalList: [], //理赔案例
  391. fxList: [], //发现
  392. fxIndex: 0,
  393. fxContentList: [],
  394. recommendCard: '', //销售
  395. isShowCodePop: false,
  396. lpalCode: req.public.lpalCode,
  397. chatShow: true,
  398. chatShowText: true,
  399. userInfo:{},
  400. isShowUpdate: false, //是否显示更新信息弹窗
  401. firstLoad:true,//第一次加载页面
  402. };
  403. },
  404. components: {
  405. foot,
  406. footerCopyright,
  407. banner,
  408. district,
  409. msgNumber
  410. },
  411. props: {},
  412. onPullDownRefresh() {
  413. req.removeStorage('shareId')
  414. setTimeout(()=>{
  415. uni.stopPullDownRefresh()
  416. },1000)
  417. this.getHotActivity()
  418. this.getMatchList()
  419. this.getTbal()
  420. this.getLpal()
  421. this.getFx()
  422. QQMapWX.initMap();
  423. req.getLocation(res => {
  424. const to = {
  425. latitude: res.latitude,
  426. longitude: res.longitude
  427. };
  428. QQMapWX.reverseGeocoder(to, resp => {});
  429. this.getRecommendCard(to)
  430. });
  431. },
  432. onLoad: async function(options) {
  433. // console.log("扫码进去参数===" + JSON.stringify(options));
  434. // if (options.scene) {
  435. // // this.scene = options.scene || '1290926887903780865';
  436. // this.scene = options.scene;
  437. // await this.loadCodeParams();
  438. // }
  439. // wx.setNavigationBarColor({
  440. // frontColor: '#ffffff',
  441. // backgroundColor: req.public.titleTopBgColor,
  442. // })
  443. // this.getPopAd()
  444. this.query = options;
  445. // req.silenceLogin(options.userId, '');
  446. if (options.custom_params) {
  447. let obj = decodeURIComponent(opt.custom_params);
  448. obj = JSON.parse(obj);
  449. // console.log(obj)
  450. req.setStorage('pidCode', obj.userId);
  451. }
  452. if (options.isShare) {
  453. if (options.userId) {
  454. req.setStorage('pidCode', options.userId);
  455. }
  456. }
  457. setInterval(() => {
  458. this.setData({
  459. isNotice: true
  460. });
  461. }, 10000); // this.init();
  462. // QQMapWX.initMap();
  463. // req.getLocation(res => {
  464. // const to = {
  465. // latitude: res.latitude,
  466. // longitude: res.longitude
  467. // };
  468. // QQMapWX.reverseGeocoder(to, resp => {});
  469. // });
  470. },
  471. async onShow() {
  472. await req.silenceLogin(this.query.userId, '');
  473. let _ts = this;
  474. setTimeout(()=>{
  475. this.userInfo = req.getStorage('userInfo')
  476. console.log('onShow',req.getStorage('userInfo'))
  477. if (this.firstLoad==true) {
  478. this.isShowUpdate = true;
  479. req.saveBehaviorNew('',15,4)
  480. }
  481. this.firstLoad = false
  482. },500)
  483. await this.getConfig().then(res => {});
  484. await this.getHomeTemplateConfig();
  485. uni.setNavigationBarColor({
  486. frontColor: this.skinNotColor ? '#000' : '#ffffff',
  487. backgroundColor: req.public.titleTopBgColor
  488. });
  489. _ts.setData({
  490. isUpdate: !_ts.isUpdate
  491. });
  492. this.getHotActivity()
  493. this.getMatchList()
  494. this.getTbal()
  495. this.getLpal()
  496. this.getFx()
  497. QQMapWX.initMap();
  498. req.getLocation(res => {
  499. const to = {
  500. latitude: res.latitude,
  501. longitude: res.longitude
  502. };
  503. QQMapWX.reverseGeocoder(to, resp => {});
  504. this.getRecommendCard(to)
  505. });
  506. // console.log('this.freshen=='+this.freshen)
  507. let first = req.getStorage('first');
  508. if (first !== false)
  509. _ts.setData({
  510. first: true
  511. });
  512. else
  513. _ts.setData({
  514. first: false
  515. });
  516. },
  517. onUnload() {
  518. // this.isShowTime = false;
  519. this.clearAllTimer(1);
  520. this.clearAllTimer(2);
  521. this.clearAllTimer(3);
  522. this.clearAllTimer(4);
  523. },
  524. onHide() {
  525. // this.isShowTime = false;
  526. this.clearAllTimer(1);
  527. this.clearAllTimer(2);
  528. this.clearAllTimer(3);
  529. this.clearAllTimer(4);
  530. },
  531. onShareAppMessage: function() {
  532. },
  533. onShareTimeline() {
  534. },
  535. onReachBottom() {},
  536. methods: {
  537. jumpSingleChatRoom() {
  538. if (this.recommendCard) {
  539. req.jumpSingleChatRoom(this.recommendCard.userId, this.recommendCard.avatar, this.recommendCard
  540. .realName);
  541. req.saveBehaviorNew(this.recommendCard.id,1,14)
  542. }
  543. },
  544. jumpUrl(url) {
  545. if (req.isLogins(false)) {
  546. uni.navigateTo({
  547. url: url
  548. })
  549. }
  550. },
  551. // 获取推荐销售
  552. getRecommendCard(loction) {
  553. let params = loction
  554. if(req.getStorage("shareId")){
  555. params.shareSaleNo = req.getStorage("shareId")
  556. }
  557. req.getRequest('/api/visiting/card/recommendCardInfo', params, res => {
  558. this.recommendCard = res
  559. console.log('获取推荐销售》》》》》', res);
  560. setTimeout(() => {
  561. this.chatShow = false
  562. setTimeout(() => {
  563. this.chatShowText = false
  564. }, 450)
  565. }, 2000)
  566. })
  567. },
  568. // 获取热门活动
  569. getHotActivity() {
  570. req.getRequest('/api/banner', {
  571. code: 'index_hot_activity'
  572. }, res => {
  573. this.hotActivityList = res?res:[]
  574. })
  575. },
  576. // 获取更多活动
  577. getMatchList() {
  578. req.getRequest('/api/match/list', {
  579. page: 1,
  580. limit: 10,
  581. shareSaleNo:req.getStorage("shareId")?req.getStorage("shareId"):null
  582. }, res => {
  583. this.matchList = res
  584. })
  585. },
  586. // 获取投保案例
  587. async getTbal() {
  588. this.tbalName =await this.getContentName(req.public.tbalCode)
  589. this.tbalList = await this.getContentList(req.public.tbalCode)
  590. this.tbalContentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
  591. .code)
  592. this.$forceUpdate()
  593. },
  594. // 获取理赔案例
  595. async getLpal() {
  596. this.lpalName =await this.getContentName(req.public.lpalCode)
  597. if(this.lpalList.length==0){
  598. this.lpalList = await this.getContentList(req.public.lpalCode)
  599. }else{
  600. // 防止页面onShow时内容闪动
  601. let lpal = await this.getContentList(req.public.lpalCode)
  602. for(let i=0;i<lpal.length;i++){
  603. let item = lpal[i]
  604. for(let j=0;j<this.lpalList.length;j++){
  605. let it = this.lpalList[i]
  606. if(it.id==item.id){
  607. item.contentList = it.contentList?it.contentList:[]
  608. }
  609. }
  610. }
  611. }
  612. this.lpalList.map(async item => {
  613. item.contentList = await this.getContentPageList(item.code)
  614. this.$forceUpdate()
  615. })
  616. },
  617. // 获取发现
  618. async getFx() {
  619. this.fxList = await this.getContentList('faxian')
  620. this.getFxContenteList(this.fxList[this.fxIndex].code)
  621. },
  622. // 获取文章栏目名称
  623. getContentName(code) {
  624. return new Promise((r, j) => {
  625. req.getRequest('/api/content/category/detailByCode', {
  626. code: code
  627. }, res => {
  628. r(res ? res.name : '')
  629. })
  630. })
  631. },
  632. // 获取文章栏目列表
  633. getContentList(code) {
  634. return new Promise((r, j) => {
  635. req.getRequest('/api/content/category/list', {
  636. parentCode: code
  637. }, res => {
  638. r(res ? res : [])
  639. })
  640. })
  641. },
  642. // 获取文章列表
  643. getContentPageList(code) {
  644. return new Promise((r, j) => {
  645. req.getRequest('/api/content/list', {
  646. code: code,
  647. page: 1,
  648. limit: 2,
  649. shareSaleNo : req.getStorage("shareId")?req.getStorage("shareId"):null
  650. }, res => {
  651. r(res ? res : [])
  652. })
  653. })
  654. },
  655. // 获取发现文章列表
  656. getFxContenteList(code) {
  657. return new Promise((r, j) => {
  658. req.getRequest('/api/content/list', {
  659. code: code,
  660. page: 1,
  661. limit: 10,
  662. shareSaleNo : req.getStorage("shareId")?req.getStorage("shareId"):null
  663. }, res => {
  664. this.fxContentList = res ? res : []
  665. r(res ? res : [])
  666. })
  667. })
  668. },
  669. // 投保案例tab切换
  670. async changeTbalTab(index) {
  671. if (this.tbalIndex == index) return false;
  672. this.tbalIndex = index
  673. this.tbalContentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
  674. .code)
  675. this.$forceUpdate()
  676. },
  677. // 发现tab切换
  678. changeFxTab(index) {
  679. if (this.fxIndex == index) return false;
  680. this.fxIndex = index
  681. this.getFxContenteList(this.fxList[this.fxIndex].code)
  682. },
  683. async getRqeDatas() {
  684. console.log('getRqeDatas');
  685. let that = this; //多门店
  686. // 金刚区
  687. let district = that.homeTemplate.filter(it => it.module == that.templateType
  688. .module_king_kong_district);
  689. if (district && district.length > 0 && district[0].state == 0) {
  690. let data = district[0];
  691. data.content = JSON.parse(district[0].content);
  692. that.districtTemplate = data;
  693. if (data.contentId == 2) {
  694. that.districtShow = true;
  695. }
  696. console.log(that.districtTemplate, '=============');
  697. }
  698. //顶部banner
  699. let ad = that.homeTemplate.filter(it => it.module == that.templateType.module_ad);
  700. if (ad && ad.length > 0 && ad[0].state == 0) {
  701. if (that.freshen) {
  702. await that.getBannerList(ad[0].module, ad[0].contentId);
  703. }
  704. }
  705. that.logo = true;
  706. },
  707. //获取首页模板配置
  708. getHomeTemplateConfig() {
  709. let _ts = this;
  710. let page = 'index';
  711. //荣康模板配置、小店产品==门店产品
  712. // if (this.merchant && this.merchant.type == 5 || this.shopId && this.merchantId) page = 'shopIndex'
  713. req.getRequest(
  714. '/api/template/getTemplate', {
  715. page: page
  716. },
  717. data => {
  718. let arr = [];
  719. data.forEach(it => {
  720. arr.push(it.module);
  721. });
  722. this.setData({
  723. contact: [...new Set(arr)],
  724. contactShow: false
  725. });
  726. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('store_options') != -1) {
  727. this.top = false;
  728. } else {
  729. this.top = true;
  730. }
  731. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('type_district') != -1) {
  732. this.top_type = false;
  733. } else {
  734. this.top_type = true;
  735. }
  736. console.log(this.contact.indexOf('sou') != -1, this.contact.indexOf('store_options') != -1,
  737. this.contact.indexOf('type_district') != -1, this.top);
  738. console.log(this.contact);
  739. this.setData({
  740. homeTemplate: data
  741. });
  742. this.getRqeDatas();
  743. }
  744. );
  745. },
  746. getConfig() {
  747. var _this = this;
  748. return new Promise((res, rej) => {
  749. req.g(
  750. '/api/other/config',
  751. data => {
  752. req.setStorage('configRes', JSON.stringify(data));
  753. this.about = data;
  754. if (!data.Index_Store_Confirm || data.Index_Store_Confirm == 0) {
  755. _this.setData({
  756. switchStoreShow: false,
  757. storeShow: false
  758. });
  759. } else {
  760. _this.setData({
  761. switchStoreShow: true
  762. });
  763. }
  764. // console.log(data.Index_Store_Confirm, "====", !data.Index_Store_Confirm, typeof(res
  765. // .Index_Store_Confirm))
  766. uni.setNavigationBarTitle({
  767. // title: res['CONFIG_PROJECT_TITLE'],
  768. title: data['CONFIG_PROJECT_TITLE']
  769. });
  770. // console.log(data.Is_Store_Price_Stock);
  771. if (data.Is_Store_Price_Stock) {
  772. this.Is_Store_Price_Stock = data.Is_Store_Price_Stock;
  773. }
  774. this.setData({
  775. Is_Store_Price_Stock: data.Is_Store_Price_Stock
  776. });
  777. if (data.b2c_service_guarantee && data.b2c_service_guarantee != null) {
  778. this.setData({
  779. guarantee: data.b2c_service_guarantee.split(';').filter(it => {
  780. return (it = it && it.trim());
  781. })
  782. });
  783. }
  784. req.setStorage('appName', data['CONFIG_PROJECT_TITLE']);
  785. req.setStorage('productDiy', data['Product_Foot-Diy']);
  786. res(data);
  787. },
  788. true
  789. );
  790. });
  791. },
  792. merchantFun() {
  793. app.globalData.openPage('pages/nearby/nearby');
  794. },
  795. saoma() {
  796. var _this = this; // 允许从相机和相册扫码
  797. uni.scanCode({
  798. success: res => {
  799. uni.navigateTo({
  800. url: '/' + res.path
  801. }); // this.scene = '1290926887903780865';
  802. this.loadCodeParams();
  803. }
  804. });
  805. },
  806. update(content) {
  807. var that = this;
  808. var animation = uni.createAnimation(); // 旧消息向上平移
  809. animation.translateY(-50).step({
  810. duration: 1000,
  811. timingFunction: 'ease-in'
  812. }); // 为了实现下一条新内容向上平移的效果,必须把内容很快平移到下方,并且不能被用户看见,这里其原理类似轮播图的思路。
  813. // 实现方法:动画时间设置为1ms,过渡效果设置为’动画第一帧就跳至结束状态直到结束‘
  814. animation
  815. .opacity(0)
  816. .translateY(50)
  817. .step({
  818. duration: 1000,
  819. timingFunction: 'step-start'
  820. }); // 新消息向上平移的同时恢复透明
  821. animation
  822. .opacity(1)
  823. .translateY(0)
  824. .step({
  825. duration: 1000,
  826. timingFunction: 'ease-out'
  827. });
  828. that.setData({
  829. animationData: animation.export()
  830. }); // 更新内容的延时必须大于第一步动画时间
  831. setTimeout(() => {
  832. that.setData({
  833. content: content
  834. });
  835. }, 500000);
  836. },
  837. loadCodeParams() {
  838. let _ts = this;
  839. return new Promise((resolve, reject) => {
  840. if (!_ts.scene) {
  841. resolve();
  842. return false;
  843. }
  844. req.getRequest(
  845. '/api/code/params', {
  846. scene: _ts.scene
  847. },
  848. data => {
  849. req.setStorage('pidCode', data.userId);
  850. resolve();
  851. }
  852. );
  853. });
  854. },
  855. getBannerList(module, contentId) {
  856. //banner图
  857. let that = this;
  858. return new Promise((resolve, reject) => {
  859. req.getRequest(
  860. '/api/banner', {
  861. groupId: contentId
  862. },
  863. data => {
  864. if (module == that.templateType.module_ad) {
  865. that.setData({
  866. bannerList: data,
  867. bannerShow: true
  868. });
  869. } else {
  870. that.setData({
  871. popAdList: data[0]
  872. });
  873. }
  874. resolve();
  875. }
  876. );
  877. })
  878. },
  879. clearAllTimer(type) {
  880. // console.log(this.activityGroup, this.joingroupList, this.bargainList, this.customersList);
  881. if (type == 1) {
  882. this.activityGroup.products.forEach(it => clearInterval(it.timer));
  883. this.activityGroup.products.forEach(it => clearInterval(it.times));
  884. } else if (type == 2) {
  885. this.joingroupList.products.forEach(it => clearInterval(it.timer));
  886. this.joingroupList.products.forEach(it => clearInterval(it.times));
  887. } else if (type == 3) {
  888. this.bargainList.products.forEach(it => clearInterval(it.timer));
  889. this.bargainList.products.forEach(it => clearInterval(it.times));
  890. } else if (type == 4) {
  891. this.customersList.products.forEach(it => clearInterval(it.timer));
  892. this.customersList.products.forEach(it => clearInterval(it.times));
  893. } else if (type == 5) {
  894. this.seckillList.products.forEach(it => clearInterval(it.timer));
  895. this.seckillList.products.forEach(it => clearInterval(it.times));
  896. }
  897. },
  898. hideGuide() {
  899. //关闭提示加入我的小程序
  900. this.setData({
  901. first: false
  902. });
  903. req.setStorage('first', false);
  904. },
  905. hideAd() {
  906. //关闭广告
  907. // if(this.data.first==false){
  908. this.setData({
  909. isLayerAd: false
  910. }); // }
  911. app.globalData.isLayerAd = false;
  912. },
  913. click(e) {
  914. // console.log(e)
  915. this.storeShow = e;
  916. },
  917. goUrl(event) {
  918. //跳转链接
  919. let url = event.currentTarget.dataset.url;
  920. app.globalData.openPage(url);
  921. },
  922. showCodePop(){
  923. this.isShowCodePop = true
  924. req.saveBehaviorNew(this.recommendCard.id,1,18)
  925. },
  926. // 拨打电话
  927. callPhone(val) {
  928. if (!val) return false
  929. uni.makePhoneCall({
  930. phoneNumber: val
  931. });
  932. },
  933. copy(val) {
  934. this.isShowCodePop = false
  935. uni.setClipboardData({
  936. data: val,
  937. complete() {
  938. req.msg('复制成功')
  939. }
  940. })
  941. },
  942. unitFormat(data) {
  943. return req.unitConverter(data).text
  944. },
  945. formatTime(date) {
  946. date = new Date(date.replace(/-/g, '/'))
  947. return utils.formatTime(date).t3
  948. },
  949. monthDayDiff(date) {
  950. return utils.monthDayDiff(date)
  951. },
  952. // 热门活动
  953. async getUrlHot(item) {
  954. console.log(item)
  955. var dt = item
  956. var url = "";
  957. var id = "";
  958. var acid = "";
  959. if (dt.content != "") {
  960. let conunt = dt.content.split("_");
  961. id = conunt[1];
  962. acid = conunt[0];
  963. }
  964. if (dt.type * 1 == 2 && dt.content != "") {
  965. url = "product/detail/detail?id=" + dt.content;
  966. } else if (dt.type * 1 == 3) {
  967. url = dt.content;
  968. console.log('url===',url)
  969. if(!url){
  970. req.msg('功能待接入')
  971. return false
  972. }
  973. if(url=='pages/index/index'||url=='pages/matchList/index'||url=='pages/interactive/index'||url=='pages/found/found'||url=='pages/user/user'){
  974. app.globalData.switchTab(url)
  975. return false
  976. }else{
  977. if(url.indexOf('http')!=-1){
  978. if(url.indexOf('${salesno}')!=-1){
  979. // 如果打开的分享的销售员微页
  980. if(req.getStorage('shareId')){
  981. url = url.replace(/\${salesno}/g,'salesno='+req.getStorage('shareId'))
  982. }else{
  983. // 如果自己是销售员
  984. if(req.getStorage('userInfo').saleNo){
  985. url = url.replace(/\${salesno}/g,'salesno='+req.getStorage('userInfo').saleNo)
  986. }else{
  987. //当前绑定的微页或推荐的微页
  988. let salesno = await new Promise((r,j)=>{
  989. req.getLocation(res => {
  990. const to = {
  991. latitude: res.latitude,
  992. longitude: res.longitude
  993. };
  994. req.getRequest('/api/visiting/card/recommendCardInfo', to, res => {
  995. r(res.jobNumber?res.jobNumber:'')
  996. })
  997. });
  998. })
  999. url = url.replace(/\${salesno}/g,'salesno='+salesno)
  1000. }
  1001. }
  1002. }
  1003. app.globalData.openPage('pages/web/web?url='+encodeURIComponent(url));
  1004. return false
  1005. }
  1006. }
  1007. } else if (dt.type * 1 == 4) {
  1008. url = "product/groupDetail/groupDetail?acid=" + acid + "&id=" + id;
  1009. } else if (dt.type * 1 == 5) {
  1010. url = "product/coupon/coupon";
  1011. } else if (dt.type * 1 == 6) {
  1012. url = "pages/live/live";
  1013. } else if (dt.type * 1 == 7) {
  1014. url = "product/groupList/groupList" + dt.merchant;
  1015. } else if (dt.type * 1 == 9 && dt.content != "") {
  1016. url = "product/list/list?id=" + dt.content + '&title=' + dt.title + this.web;
  1017. } else if (dt.type * 1 == 10) {
  1018. url = "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + dt.content;
  1019. // console.log(
  1020. // url); // url=`plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${dt.content}`
  1021. } else if (dt.type * 1 == 11) {
  1022. url = "activity/group/index/index" + dt.merchant;
  1023. } else if (dt.type * 1 == 12) {
  1024. url = "activity/seckill/seckill" + dt.merchant;
  1025. } else if (dt.type * 1 == 13) {
  1026. url = "activity/bargain/index/index" + dt.merchant;
  1027. } else if (dt.type * 1 == 14) {
  1028. url = "activity/newbornZone/newbornZone" + dt.merchant;
  1029. } else if (dt.type * 1 == 15 && dt.content != "") {
  1030. url = "activity/newbornDetails/newbornDetails?acid=" + acid + "&id=" + id;
  1031. } else if (dt.type * 1 == 16 && dt.content != "") {
  1032. url = "activity/seckillDetails/seckillDetails?acid=" + acid + "&id=" + id;
  1033. } else if (dt.type * 1 == 17 && dt.content != "") {
  1034. url = "activity/bargain/detail/detail?acid=" + acid + "&id=" + id;
  1035. } else if (dt.type * 1 == 18 && dt.content != "") {
  1036. url = "activity/group/detail/detail?acid=" + acid + "&id=" + id;
  1037. }else if (dt.type * 1 == 19 && dt.content != "") {
  1038. url = "topic/content/content?id=" + dt.content;
  1039. }else if (dt.type * 1 == 27 && dt.content != "") {
  1040. url = "match/activityDetail/activityDetail?id=" + dt.content;
  1041. } else {
  1042. url = "";
  1043. }
  1044. if (dt.type * 1 == 6) app.globalData.switchTab(url);
  1045. else app.globalData.openPage(url);
  1046. this.hideAd();
  1047. },
  1048. closeUpdate() {
  1049. this.isShowUpdate = false;
  1050. },
  1051. updateInfo(e) {
  1052. this.isUpdateInfo = e;
  1053. this.getMy();
  1054. },
  1055. updateMobile(e) {
  1056. this.isUpdateMobile = e;
  1057. },
  1058. },
  1059. mounted() {
  1060. const systemInfo = uni.getSystemInfoSync();
  1061. // px转换到rpx的比例
  1062. let pxToRpxScale = 750 / systemInfo.windowWidth;
  1063. let systems = {
  1064. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  1065. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  1066. };
  1067. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  1068. this.systems = systems;
  1069. }
  1070. };
  1071. </script>
  1072. <style>
  1073. @import './index.css';
  1074. </style>