index.vue 32 KB

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