index.vue 30 KB

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