index.vue 29 KB

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