index.vue 33 KB

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