index.vue 29 KB

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