index.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194
  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" @closeUpdate="closeUpdate"></to-userinfo> -->
  303. <update-userinfonew :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfonew>
  304. </view>
  305. </template>
  306. <script>
  307. //index.js
  308. //获取应用实例
  309. const app = getApp();
  310. const req = require('../../utils/request.js');
  311. const api = require('../../utils/api.js');
  312. const utils = require('../../utils/util.js');
  313. const mes = require('../../utils/requestmessage.js');
  314. const route = require('../../utils/route');
  315. const QQMapWX = require("../../utils/qqmap.js");
  316. import foot from '../../components/nav-bar/index';
  317. import footerCopyright from '../../components/footer-copyright/footer-copyright';
  318. import banner from '../../template/banner/banner';
  319. import district from '../../template/king_kong_district/king_kong_district';
  320. import msgNumber from '../../components/msg-number/index.vue';
  321. export default {
  322. data() {
  323. return {
  324. picUrlss: req.public.picUrls,
  325. skinNotColor: req.public.skinNotColor,
  326. systems: {},
  327. header: req.header,
  328. bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
  329. bannerList: [],
  330. //产品分类列表
  331. page: 1,
  332. //产品列表
  333. merchant: {},
  334. activityGroup: {
  335. products: []
  336. },
  337. couponList: {}, //优惠券,
  338. isUpdate: false,
  339. // 是否更新消息
  340. first: true,
  341. //是否显示提示加入我的小程序
  342. isLayerAd: true,
  343. //广告
  344. homeTemplate: [],
  345. //首页栏目配置
  346. storeShow: true,
  347. templateType: {
  348. module_ad: 'ad',
  349. //广告
  350. module_type_district: 'type_district',
  351. //分类导航
  352. module_king_kong_district: 'king_kong_district', //金刚区
  353. },
  354. isNotice: false,
  355. joingroupList: {
  356. products: []
  357. },
  358. //拼团
  359. bargainList: {
  360. products: []
  361. },
  362. //砍价
  363. customersList: {
  364. products: []
  365. },
  366. //新客
  367. freshen: true,
  368. url: '',
  369. web: '',
  370. site: '',
  371. districtTemplate: {},
  372. contact: [],
  373. seckillList: {
  374. products: []
  375. },
  376. about: {},
  377. Is_Store_Price_Stock: '',
  378. guarantee: [],
  379. animationData: '',
  380. content: '',
  381. popAdList: {},
  382. iscouponAd: false,
  383. logo: false,
  384. top: Boolean,
  385. top_type: Boolean,
  386. switchStoreShow: Boolean,
  387. contactShow: true,
  388. districtShow: false,
  389. bannerShow: false,
  390. officeList: [], //互动
  391. hotActivityList: [], //热门活动
  392. matchList: [], //活动列表
  393. tbalName:'',
  394. tbalList: [], //投保案例
  395. tbalIndex: 0, //投保案例tab
  396. tbalContentList: [],
  397. lpalName:'',
  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. isShowUpdate: false, //是否显示更新信息弹窗
  409. isUpdateInfo: false,//更新用户信息
  410. isUpdateMobile: false,//绑定手机号
  411. firstLoad:true,//第一次加载页面
  412. };
  413. },
  414. components: {
  415. foot,
  416. footerCopyright,
  417. banner,
  418. district,
  419. msgNumber
  420. },
  421. props: {},
  422. onPullDownRefresh() {
  423. req.removeStorage('shareId')
  424. setTimeout(()=>{
  425. uni.stopPullDownRefresh()
  426. },1000)
  427. this.getHotActivity()
  428. this.getMatchList()
  429. this.getTbal()
  430. this.getLpal()
  431. this.getFx()
  432. QQMapWX.initMap();
  433. req.getLocation(res => {
  434. const to = {
  435. latitude: res.latitude,
  436. longitude: res.longitude
  437. };
  438. QQMapWX.reverseGeocoder(to, resp => {});
  439. this.getRecommendCard(to)
  440. });
  441. },
  442. onLoad: async function(options) {
  443. // console.log("扫码进去参数===" + JSON.stringify(options));
  444. // if (options.scene) {
  445. // // this.scene = options.scene || '1290926887903780865';
  446. // this.scene = options.scene;
  447. // await this.loadCodeParams();
  448. // }
  449. // wx.setNavigationBarColor({
  450. // frontColor: '#ffffff',
  451. // backgroundColor: req.public.titleTopBgColor,
  452. // })
  453. // this.getPopAd()
  454. this.query = options;
  455. // req.silenceLogin(options.userId, '');
  456. if (options.custom_params) {
  457. let obj = decodeURIComponent(opt.custom_params);
  458. obj = JSON.parse(obj);
  459. // console.log(obj)
  460. req.setStorage('pidCode', obj.userId);
  461. }
  462. if (options.isShare) {
  463. if (options.userId) {
  464. req.setStorage('pidCode', options.userId);
  465. }
  466. }
  467. setInterval(() => {
  468. this.setData({
  469. isNotice: true
  470. });
  471. }, 10000); // this.init();
  472. // QQMapWX.initMap();
  473. // req.getLocation(res => {
  474. // const to = {
  475. // latitude: res.latitude,
  476. // longitude: res.longitude
  477. // };
  478. // QQMapWX.reverseGeocoder(to, resp => {});
  479. // });
  480. },
  481. async onShow() {
  482. await req.silenceLogin(this.query.userId, '');
  483. let _ts = this;
  484. setTimeout(()=>{
  485. this.userInfo = req.getStorage('userInfo')
  486. console.log('onShow',req.getStorage('userInfo'))
  487. if (this.firstLoad==true) {
  488. req.saveBehaviorNew('',15,4)
  489. }
  490. this.getUpdate()
  491. this.firstLoad = false
  492. },500)
  493. await this.getConfig().then(res => {});
  494. await this.getHomeTemplateConfig();
  495. uni.setNavigationBarColor({
  496. frontColor: this.skinNotColor ? '#000' : '#ffffff',
  497. backgroundColor: req.public.titleTopBgColor
  498. });
  499. _ts.setData({
  500. isUpdate: !_ts.isUpdate
  501. });
  502. this.getHotActivity()
  503. this.getMatchList()
  504. this.getTbal()
  505. this.getLpal()
  506. this.getFx()
  507. QQMapWX.initMap();
  508. req.getLocation(res => {
  509. const to = {
  510. latitude: res.latitude,
  511. longitude: res.longitude
  512. };
  513. QQMapWX.reverseGeocoder(to, resp => {});
  514. this.getRecommendCard(to)
  515. });
  516. // console.log('this.freshen=='+this.freshen)
  517. let first = req.getStorage('first');
  518. if (first !== false)
  519. _ts.setData({
  520. first: true
  521. });
  522. else
  523. _ts.setData({
  524. first: false
  525. });
  526. },
  527. onUnload() {
  528. // this.isShowTime = false;
  529. this.clearAllTimer(1);
  530. this.clearAllTimer(2);
  531. this.clearAllTimer(3);
  532. this.clearAllTimer(4);
  533. },
  534. onHide() {
  535. // this.isShowTime = false;
  536. this.clearAllTimer(1);
  537. this.clearAllTimer(2);
  538. this.clearAllTimer(3);
  539. this.clearAllTimer(4);
  540. },
  541. onShareAppMessage: function() {
  542. },
  543. onShareTimeline() {
  544. },
  545. onReachBottom() {},
  546. methods: {
  547. jumpSingleChatRoom() {
  548. if (this.recommendCard) {
  549. req.jumpSingleChatRoom(this.recommendCard.userId, this.recommendCard.avatar, this.recommendCard
  550. .realName);
  551. req.saveBehaviorNew(this.recommendCard.id,1,14)
  552. }
  553. },
  554. jumpUrl(url) {
  555. if (req.isLogins(false)) {
  556. uni.navigateTo({
  557. url: url
  558. })
  559. }
  560. },
  561. // 获取推荐销售
  562. getRecommendCard(loction) {
  563. let params = loction
  564. if(req.getStorage("shareId")){
  565. params.shareSaleNo = req.getStorage("shareId")
  566. }
  567. req.getRequest('/api/visiting/card/recommendCardInfo', params, res => {
  568. this.recommendCard = res
  569. console.log('获取推荐销售》》》》》', res);
  570. setTimeout(() => {
  571. this.chatShow = false
  572. setTimeout(() => {
  573. this.chatShowText = false
  574. }, 450)
  575. }, 2000)
  576. // 判断销售员是否离职
  577. this.getEmploymentState()
  578. })
  579. },
  580. getEmploymentState(){
  581. req.getRequest('/api/visiting/card/saleIsDepart',{},res=>{
  582. let userInfo = req.getStorage('userInfo')
  583. req.getRequest('/api/user/info', {}, suc => {
  584. userInfo.manageSaleNo = suc.manageSaleNo
  585. req.setStorage('userInfo',userInfo)
  586. this.userInfo.manageSaleNo = suc.manageSaleNo
  587. });
  588. })
  589. },
  590. // 获取热门活动
  591. getHotActivity() {
  592. req.getRequest('/api/banner', {
  593. code: 'index_hot_activity'
  594. }, res => {
  595. this.hotActivityList = res?res:[]
  596. })
  597. },
  598. // 获取更多活动
  599. getMatchList() {
  600. req.getRequest('/api/match/list', {
  601. page: 1,
  602. limit: 10,
  603. shareSaleNo:req.getStorage("shareId")?req.getStorage("shareId"):null
  604. }, res => {
  605. this.matchList = res
  606. })
  607. },
  608. // 获取投保案例
  609. async getTbal() {
  610. this.tbalName =await this.getContentName(req.public.tbalCode)
  611. this.tbalList = await this.getContentList(req.public.tbalCode)
  612. this.tbalContentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
  613. .code)
  614. this.$forceUpdate()
  615. },
  616. // 获取理赔案例
  617. async getLpal() {
  618. this.lpalName =await this.getContentName(req.public.lpalCode)
  619. if(this.lpalList.length==0){
  620. this.lpalList = await this.getContentList(req.public.lpalCode)
  621. }else{
  622. // 防止页面onShow时内容闪动
  623. let lpal = await this.getContentList(req.public.lpalCode)
  624. for(let i=0;i<lpal.length;i++){
  625. let item = lpal[i]
  626. for(let j=0;j<this.lpalList.length;j++){
  627. let it = this.lpalList[i]
  628. if(it.id==item.id){
  629. item.contentList = it.contentList?it.contentList:[]
  630. }
  631. }
  632. }
  633. }
  634. this.lpalList.map(async item => {
  635. item.contentList = await this.getContentPageList(item.code)
  636. this.$forceUpdate()
  637. })
  638. },
  639. // 获取发现
  640. async getFx() {
  641. this.fxList = await this.getContentList('faxian')
  642. this.getFxContenteList(this.fxList[this.fxIndex].code)
  643. },
  644. // 获取文章栏目名称
  645. getContentName(code) {
  646. return new Promise((r, j) => {
  647. req.getRequest('/api/content/category/detailByCode', {
  648. code: code
  649. }, res => {
  650. r(res ? res.name : '')
  651. })
  652. })
  653. },
  654. // 获取文章栏目列表
  655. getContentList(code) {
  656. return new Promise((r, j) => {
  657. req.getRequest('/api/content/category/list', {
  658. parentCode: code
  659. }, res => {
  660. r(res ? res : [])
  661. })
  662. })
  663. },
  664. // 获取文章列表
  665. getContentPageList(code) {
  666. return new Promise((r, j) => {
  667. req.getRequest('/api/content/list', {
  668. code: code,
  669. page: 1,
  670. limit: 2,
  671. shareSaleNo : req.getStorage("shareId")?req.getStorage("shareId"):null
  672. }, res => {
  673. r(res ? res : [])
  674. })
  675. })
  676. },
  677. // 获取发现文章列表
  678. getFxContenteList(code) {
  679. return new Promise((r, j) => {
  680. req.getRequest('/api/content/list', {
  681. code: code,
  682. page: 1,
  683. limit: 10,
  684. shareSaleNo : req.getStorage("shareId")?req.getStorage("shareId"):null
  685. }, res => {
  686. this.fxContentList = res ? res : []
  687. r(res ? res : [])
  688. })
  689. })
  690. },
  691. // 投保案例tab切换
  692. async changeTbalTab(index) {
  693. if (this.tbalIndex == index) return false;
  694. this.tbalIndex = index
  695. this.tbalContentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
  696. .code)
  697. this.$forceUpdate()
  698. },
  699. // 发现tab切换
  700. changeFxTab(index) {
  701. if (this.fxIndex == index) return false;
  702. this.fxIndex = index
  703. this.getFxContenteList(this.fxList[this.fxIndex].code)
  704. },
  705. async getRqeDatas() {
  706. console.log('getRqeDatas');
  707. let that = this; //多门店
  708. // 金刚区
  709. let district = that.homeTemplate.filter(it => it.module == that.templateType
  710. .module_king_kong_district);
  711. if (district && district.length > 0 && district[0].state == 0) {
  712. let data = district[0];
  713. data.content = JSON.parse(district[0].content);
  714. that.districtTemplate = data;
  715. if (data.contentId == 2) {
  716. that.districtShow = true;
  717. }
  718. console.log(that.districtTemplate, '=============');
  719. }
  720. //顶部banner
  721. let ad = that.homeTemplate.filter(it => it.module == that.templateType.module_ad);
  722. if (ad && ad.length > 0 && ad[0].state == 0) {
  723. if (that.freshen) {
  724. await that.getBannerList(ad[0].module, ad[0].contentId);
  725. }
  726. }
  727. that.logo = true;
  728. },
  729. //获取首页模板配置
  730. getHomeTemplateConfig() {
  731. let _ts = this;
  732. let page = 'index';
  733. //荣康模板配置、小店产品==门店产品
  734. // if (this.merchant && this.merchant.type == 5 || this.shopId && this.merchantId) page = 'shopIndex'
  735. req.getRequest(
  736. '/api/template/getTemplate', {
  737. page: page
  738. },
  739. data => {
  740. let arr = [];
  741. data.forEach(it => {
  742. arr.push(it.module);
  743. });
  744. this.setData({
  745. contact: [...new Set(arr)],
  746. contactShow: false
  747. });
  748. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('store_options') != -1) {
  749. this.top = false;
  750. } else {
  751. this.top = true;
  752. }
  753. if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('type_district') != -1) {
  754. this.top_type = false;
  755. } else {
  756. this.top_type = true;
  757. }
  758. console.log(this.contact.indexOf('sou') != -1, this.contact.indexOf('store_options') != -1,
  759. this.contact.indexOf('type_district') != -1, this.top);
  760. console.log(this.contact);
  761. this.setData({
  762. homeTemplate: data
  763. });
  764. this.getRqeDatas();
  765. }
  766. );
  767. },
  768. getConfig() {
  769. var _this = this;
  770. return new Promise((res, rej) => {
  771. req.g(
  772. '/api/other/config',
  773. data => {
  774. req.setStorage('configRes', JSON.stringify(data));
  775. this.about = data;
  776. if (!data.Index_Store_Confirm || data.Index_Store_Confirm == 0) {
  777. _this.setData({
  778. switchStoreShow: false,
  779. storeShow: false
  780. });
  781. } else {
  782. _this.setData({
  783. switchStoreShow: true
  784. });
  785. }
  786. // console.log(data.Index_Store_Confirm, "====", !data.Index_Store_Confirm, typeof(res
  787. // .Index_Store_Confirm))
  788. uni.setNavigationBarTitle({
  789. // title: res['CONFIG_PROJECT_TITLE'],
  790. title: data['CONFIG_PROJECT_TITLE']
  791. });
  792. // console.log(data.Is_Store_Price_Stock);
  793. if (data.Is_Store_Price_Stock) {
  794. this.Is_Store_Price_Stock = data.Is_Store_Price_Stock;
  795. }
  796. this.setData({
  797. Is_Store_Price_Stock: data.Is_Store_Price_Stock
  798. });
  799. if (data.b2c_service_guarantee && data.b2c_service_guarantee != null) {
  800. this.setData({
  801. guarantee: data.b2c_service_guarantee.split(';').filter(it => {
  802. return (it = it && it.trim());
  803. })
  804. });
  805. }
  806. req.setStorage('appName', data['CONFIG_PROJECT_TITLE']);
  807. req.setStorage('productDiy', data['Product_Foot-Diy']);
  808. res(data);
  809. },
  810. true
  811. );
  812. });
  813. },
  814. merchantFun() {
  815. app.globalData.openPage('pages/nearby/nearby');
  816. },
  817. saoma() {
  818. var _this = this; // 允许从相机和相册扫码
  819. uni.scanCode({
  820. success: res => {
  821. uni.navigateTo({
  822. url: '/' + res.path
  823. }); // this.scene = '1290926887903780865';
  824. this.loadCodeParams();
  825. }
  826. });
  827. },
  828. update(content) {
  829. var that = this;
  830. var animation = uni.createAnimation(); // 旧消息向上平移
  831. animation.translateY(-50).step({
  832. duration: 1000,
  833. timingFunction: 'ease-in'
  834. }); // 为了实现下一条新内容向上平移的效果,必须把内容很快平移到下方,并且不能被用户看见,这里其原理类似轮播图的思路。
  835. // 实现方法:动画时间设置为1ms,过渡效果设置为’动画第一帧就跳至结束状态直到结束‘
  836. animation
  837. .opacity(0)
  838. .translateY(50)
  839. .step({
  840. duration: 1000,
  841. timingFunction: 'step-start'
  842. }); // 新消息向上平移的同时恢复透明
  843. animation
  844. .opacity(1)
  845. .translateY(0)
  846. .step({
  847. duration: 1000,
  848. timingFunction: 'ease-out'
  849. });
  850. that.setData({
  851. animationData: animation.export()
  852. }); // 更新内容的延时必须大于第一步动画时间
  853. setTimeout(() => {
  854. that.setData({
  855. content: content
  856. });
  857. }, 500000);
  858. },
  859. loadCodeParams() {
  860. let _ts = this;
  861. return new Promise((resolve, reject) => {
  862. if (!_ts.scene) {
  863. resolve();
  864. return false;
  865. }
  866. req.getRequest(
  867. '/api/code/params', {
  868. scene: _ts.scene
  869. },
  870. data => {
  871. req.setStorage('pidCode', data.userId);
  872. resolve();
  873. }
  874. );
  875. });
  876. },
  877. getBannerList(module, contentId) {
  878. //banner图
  879. let that = this;
  880. return new Promise((resolve, reject) => {
  881. req.getRequest(
  882. '/api/banner', {
  883. groupId: contentId
  884. },
  885. data => {
  886. if (module == that.templateType.module_ad) {
  887. that.setData({
  888. bannerList: data,
  889. bannerShow: true
  890. });
  891. } else {
  892. that.setData({
  893. popAdList: data[0]
  894. });
  895. }
  896. resolve();
  897. }
  898. );
  899. })
  900. },
  901. clearAllTimer(type) {
  902. // console.log(this.activityGroup, this.joingroupList, this.bargainList, this.customersList);
  903. if (type == 1) {
  904. this.activityGroup.products.forEach(it => clearInterval(it.timer));
  905. this.activityGroup.products.forEach(it => clearInterval(it.times));
  906. } else if (type == 2) {
  907. this.joingroupList.products.forEach(it => clearInterval(it.timer));
  908. this.joingroupList.products.forEach(it => clearInterval(it.times));
  909. } else if (type == 3) {
  910. this.bargainList.products.forEach(it => clearInterval(it.timer));
  911. this.bargainList.products.forEach(it => clearInterval(it.times));
  912. } else if (type == 4) {
  913. this.customersList.products.forEach(it => clearInterval(it.timer));
  914. this.customersList.products.forEach(it => clearInterval(it.times));
  915. } else if (type == 5) {
  916. this.seckillList.products.forEach(it => clearInterval(it.timer));
  917. this.seckillList.products.forEach(it => clearInterval(it.times));
  918. }
  919. },
  920. hideGuide() {
  921. //关闭提示加入我的小程序
  922. this.setData({
  923. first: false
  924. });
  925. req.setStorage('first', false);
  926. },
  927. hideAd() {
  928. //关闭广告
  929. // if(this.data.first==false){
  930. this.setData({
  931. isLayerAd: false
  932. }); // }
  933. app.globalData.isLayerAd = false;
  934. },
  935. click(e) {
  936. // console.log(e)
  937. this.storeShow = e;
  938. },
  939. goUrl(event) {
  940. //跳转链接
  941. let url = event.currentTarget.dataset.url;
  942. app.globalData.openPage(url);
  943. },
  944. showCodePop(){
  945. this.isShowCodePop = true
  946. req.saveBehaviorNew(this.recommendCard.id,1,18)
  947. },
  948. // 拨打电话
  949. callPhone(val) {
  950. if (!val) return false
  951. uni.makePhoneCall({
  952. phoneNumber: val,
  953. success(res){
  954. req.saveBehaviorNew(this.recommendCard.id,1,17,this.recommendCard.phone)
  955. }
  956. });
  957. },
  958. copy(val) {
  959. this.isShowCodePop = false
  960. uni.setClipboardData({
  961. data: val,
  962. complete() {
  963. req.msg('复制成功')
  964. }
  965. })
  966. },
  967. unitFormat(data) {
  968. return req.unitConverter(data).text
  969. },
  970. formatTime(date) {
  971. date = new Date(date.replace(/-/g, '/'))
  972. return utils.formatTime(date).t3
  973. },
  974. monthDayDiff(date) {
  975. return utils.monthDayDiff(date)
  976. },
  977. // 热门活动
  978. async getUrlHot(item) {
  979. console.log(item)
  980. var dt = item
  981. var url = "";
  982. var id = "";
  983. var acid = "";
  984. if (dt.content != "") {
  985. let conunt = dt.content.split("_");
  986. id = conunt[1];
  987. acid = conunt[0];
  988. }
  989. if (dt.type * 1 == 2 && dt.content != "") {
  990. url = "product/detail/detail?id=" + dt.content;
  991. } else if (dt.type * 1 == 3) {
  992. url = dt.content;
  993. console.log('url===',url)
  994. if(!url){
  995. req.msg('功能待接入')
  996. return false
  997. }
  998. if(url=='pages/index/index'||url=='pages/matchList/index'||url=='pages/interactive/index'||url=='pages/found/found'||url=='pages/user/user'){
  999. app.globalData.switchTab(url)
  1000. return false
  1001. }else{
  1002. if(url.indexOf('http')!=-1){
  1003. if(url.indexOf('${salesno}')!=-1){
  1004. // 如果打开的分享的销售员微页
  1005. if(req.getStorage('shareId')){
  1006. url = url.replace(/\${salesno}/g,'salesno='+req.getStorage('shareId'))
  1007. }else{
  1008. // 如果自己是销售员
  1009. if(req.getStorage('userInfo').saleNo){
  1010. url = url.replace(/\${salesno}/g,'salesno='+req.getStorage('userInfo').saleNo)
  1011. }else{
  1012. //当前绑定的微页或推荐的微页
  1013. let salesno = await new Promise((r,j)=>{
  1014. req.getLocation(res => {
  1015. const to = {
  1016. latitude: res.latitude,
  1017. longitude: res.longitude
  1018. };
  1019. req.getRequest('/api/visiting/card/recommendCardInfo', to, res => {
  1020. r(res.jobNumber?res.jobNumber:'')
  1021. })
  1022. });
  1023. })
  1024. url = url.replace(/\${salesno}/g,'salesno='+salesno)
  1025. }
  1026. }
  1027. }
  1028. app.globalData.openPage('pages/web/web?url='+encodeURIComponent(url));
  1029. return false
  1030. }
  1031. }
  1032. } else if (dt.type * 1 == 4) {
  1033. url = "product/groupDetail/groupDetail?acid=" + acid + "&id=" + id;
  1034. } else if (dt.type * 1 == 5) {
  1035. url = "product/coupon/coupon";
  1036. } else if (dt.type * 1 == 6) {
  1037. url = "pages/live/live";
  1038. } else if (dt.type * 1 == 7) {
  1039. url = "product/groupList/groupList" + dt.merchant;
  1040. } else if (dt.type * 1 == 9 && dt.content != "") {
  1041. url = "product/list/list?id=" + dt.content + '&title=' + dt.title + this.web;
  1042. } else if (dt.type * 1 == 10) {
  1043. url = "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + dt.content;
  1044. // console.log(
  1045. // url); // url=`plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${dt.content}`
  1046. } else if (dt.type * 1 == 11) {
  1047. url = "activity/group/index/index" + dt.merchant;
  1048. } else if (dt.type * 1 == 12) {
  1049. url = "activity/seckill/seckill" + dt.merchant;
  1050. } else if (dt.type * 1 == 13) {
  1051. url = "activity/bargain/index/index" + dt.merchant;
  1052. } else if (dt.type * 1 == 14) {
  1053. url = "activity/newbornZone/newbornZone" + dt.merchant;
  1054. } else if (dt.type * 1 == 15 && dt.content != "") {
  1055. url = "activity/newbornDetails/newbornDetails?acid=" + acid + "&id=" + id;
  1056. } else if (dt.type * 1 == 16 && dt.content != "") {
  1057. url = "activity/seckillDetails/seckillDetails?acid=" + acid + "&id=" + id;
  1058. } else if (dt.type * 1 == 17 && dt.content != "") {
  1059. url = "activity/bargain/detail/detail?acid=" + acid + "&id=" + id;
  1060. } else if (dt.type * 1 == 18 && dt.content != "") {
  1061. url = "activity/group/detail/detail?acid=" + acid + "&id=" + id;
  1062. }else if (dt.type * 1 == 19 && dt.content != "") {
  1063. url = "topic/content/content?id=" + dt.content;
  1064. }else if (dt.type * 1 == 27 && dt.content != "") {
  1065. url = "match/activityDetail/activityDetail?id=" + dt.content;
  1066. } else {
  1067. url = "";
  1068. }
  1069. if (dt.type * 1 == 6) app.globalData.switchTab(url);
  1070. else app.globalData.openPage(url);
  1071. this.hideAd();
  1072. },
  1073. closeUpdate(){
  1074. this.isShowUpdate = false
  1075. },
  1076. updateInfo(e){
  1077. this.isUpdateInfo = e;
  1078. },
  1079. updateMobile(e){
  1080. this.isUpdateMobile = e;
  1081. },
  1082. getUpdate() {
  1083. console.log('getUpdate')
  1084. let userInfos = req.getStorage('userInfo')
  1085. // if ((!userInfos.avatar || userInfos.avatar.indexOf('thirdwx.qlogo') > -1 || !userInfos.nickName || userInfos.nickName.indexOf('用户') > -1) ) {
  1086. // console.log('没有昵称')
  1087. // this.isShowUpdate = true;
  1088. // this.isUpdateInfo = true;
  1089. // return false;
  1090. // }
  1091. if(!userInfos.mobile){
  1092. console.log('没有手机号')
  1093. this.isShowUpdate = true
  1094. this.isUpdateMobile = true
  1095. return false;
  1096. }
  1097. return true;
  1098. },
  1099. },
  1100. mounted() {
  1101. const systemInfo = uni.getSystemInfoSync();
  1102. // px转换到rpx的比例
  1103. let pxToRpxScale = 750 / systemInfo.windowWidth;
  1104. let systems = {
  1105. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  1106. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  1107. };
  1108. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  1109. this.systems = systems;
  1110. }
  1111. };
  1112. </script>
  1113. <style>
  1114. @import './index.css';
  1115. </style>