index.vue 35 KB

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