index.vue 33 KB

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