index.vue 37 KB

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