C端小程序
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

884 行
22 KiB

  1. const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  2. let ifStoreApp = extConfig.attr.ifStoreApp;
  3. const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
  4. const Http = require("../utils/HttpBasics");
  5. const imgurl = require("../utils/imgurl");
  6. const config = require("../config/config");
  7. const QR = require("../utils/memberqrcode.js");
  8. const util = require("../utils/util");
  9. const bgColor = require("../utils/bgColor.js")
  10. let app = getApp();
  11. Page({
  12. data: {
  13. typeLsit:{},
  14. showLocationIf: true,
  15. ifStoreApp: ifStoreApp,
  16. navigationBarTitle: '首页',
  17. navigationBarHeight,
  18. chengzhangBox: bgColor.colorFirst.main.chengzhangBox,
  19. activeColor: bgColor.colorFirst.main.activeColor,
  20. qg: bgColor.colorFirst.main.qg,
  21. newUrl: "",
  22. cover: "",
  23. kanjia: imgurl.kanjia.url,
  24. pintuan: imgurl.pintuan.url,
  25. xiaofeika: imgurl.xiaofeika.url,
  26. xingyun: imgurl.xingyun.url,
  27. jfshangcheng: imgurl.jfshangcheng.url,
  28. toutiao: imgurl.toutiao.url,
  29. more: imgurl.more.url,
  30. giftHr: imgurl.giftHr.url,
  31. giftHr: imgurl.giftHr.url,
  32. next: imgurl.next.url,
  33. usergift: imgurl.usergift.url,
  34. guanbi1: imgurl.guanbi1.url,
  35. icon0001: imgurl.icon0001.url,
  36. icon0002: imgurl.icon0002.url,
  37. icon0003: imgurl.icon0003.url,
  38. icon0004: imgurl.icon0004.url,
  39. icon0005: imgurl.icon0005.url,
  40. icon0006: imgurl.icon0006.url,
  41. icon0007: imgurl.icon0007.url,
  42. icon0008: imgurl.icon0008.url,
  43. barcode: imgurl.barcode.url,
  44. leftarrows: imgurl.leftarrows.url,
  45. newcard: imgurl.newcard.url,
  46. newseckill: imgurl.newseckill.url,
  47. newbargain: imgurl.newbargain.url,
  48. newgroup: imgurl.newgroup.url,
  49. product: imgurl.product.url,
  50. barginicon: imgurl.barginicon.url,
  51. pintuan: imgurl.pintuan.url,
  52. live: imgurl.live.url,
  53. duihuan: imgurl.duihuan.url,
  54. market: app.globalData.market,
  55. list: [],
  56. xslist: [],
  57. loading: true,
  58. fistLogin: null,
  59. alphaData: null,
  60. alphaData1: null,
  61. swiperCurrent: 0,
  62. title: null,
  63. weappShareTitle: '', //分享标题
  64. weappShareCoverImg: '', //分享图片
  65. desc: null,
  66. scrollTop: 0,
  67. showGame: false,
  68. showTopic: false,
  69. showQg: false,
  70. gamedata: {},
  71. couponId: '', //游戏返回时传回的字段
  72. played: false, //从游戏页面跳回首页返回true
  73. havePlayEd: app.globalData.havePlayEd,
  74. havePlayEd1: app.globalData.havePlayEd1,
  75. staticGamedata: {},
  76. showIf: false,
  77. showPages: false,
  78. display: 'none',
  79. display1: 'none',
  80. optionsData: null,
  81. page: 1, // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载
  82. openId: '',
  83. showGg: false,
  84. ggdata: {},
  85. liveFlag: 0, //直播按钮显隐标志位
  86. squareName: "", //当前广场
  87. isShowSqare: false,
  88. },
  89. //获取当前广场名
  90. //跳转到每日签到
  91. goSign(){
  92. wx.navigateTo({
  93. url: '/pages/activityCalendar/activityCalendar',
  94. })
  95. },
  96. //活动日历
  97. goCalendar(){
  98. wx.navigateTo({
  99. url: '/pages/dateLsit/dateLsit',
  100. })
  101. },
  102. //跳转到其他广场列表
  103. goSquareList() {
  104. wx.navigateTo({
  105. url: '/pages/location/location',
  106. })
  107. },
  108. goLive() {
  109. wx.navigateTo({
  110. url: '/pages2/live/livelist/index',
  111. })
  112. },
  113. alphaClick1: function(even) {
  114. var animation = wx.createAnimation({})
  115. animation.opacity(0).step({
  116. duration: 2000
  117. })
  118. this.setData({
  119. alphaData: animation.export()
  120. })
  121. },
  122. alphaClick: function(even) {
  123. var animation = wx.createAnimation({})
  124. animation.opacity(0).step({
  125. duration: 2000
  126. })
  127. this.setData({
  128. alphaData1: animation.export()
  129. })
  130. },
  131. // 我的卡包
  132. mycard: function() {
  133. wx.navigateTo({
  134. url: '/pages/cardorder/index/index',
  135. })
  136. },
  137. //我的券包
  138. mycoupon: function() {
  139. wx.navigateTo({
  140. url: '/pages/couponorder/index/index',
  141. })
  142. },
  143. gotoSpellGroup: function() {
  144. wx.navigateTo({
  145. url: '/pages/spellGroup/spellGroup',
  146. })
  147. },
  148. qrcode: function() {
  149. var that = this;
  150. let memberId = that.data.memberId;
  151. if (memberId) {
  152. wx.navigateTo({
  153. url: '/pages/specialcourtesy/specialcourtesy'
  154. })
  155. }
  156. },
  157. //跳往限时秒杀
  158. gotoRushBuy: function() {
  159. wx.navigateTo({
  160. url: '/pages/rushToBuy/index',
  161. })
  162. },
  163. swiperChange: function(e) {
  164. this.setData({
  165. swiperCurrent: e.detail.current
  166. });
  167. },
  168. gotogame: function() {
  169. let that = this;
  170. if (!that.data.showIf) {
  171. wx.showToast({
  172. title: '暂无游戏频道',
  173. icon: "none",
  174. duration: 3000
  175. })
  176. } else {
  177. Http.get({
  178. url: config.api.checkPhoneStatus,
  179. data: {}
  180. })
  181. .then(res => {
  182. var data = {
  183. couponChannelId: "" + that.data.couponChannelId,
  184. couponId: "" + that.data.couponId
  185. };
  186. if (that.data.couponChannelId == null) {
  187. var data = {
  188. couponId: "" + that.data.couponId
  189. };
  190. }
  191. wx.redirectTo({
  192. url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
  193. })
  194. })
  195. .catch(err => {
  196. if (err.code == 11005) {
  197. // 用户手机未授权
  198. /**
  199. * 将值传到用户手机号授权的页面
  200. *
  201. */
  202. wx.redirectTo({
  203. url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
  204. });
  205. } else if (err.code == 11006) {
  206. // 用户手机已加密
  207. wx.redirectTo({
  208. url: "/pages/phoneinput/phoneinput?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId,
  209. });
  210. } else {
  211. wx.showToast({
  212. title: err.message,
  213. icon: 'none',
  214. duration: 2000,
  215. mask: false
  216. });
  217. }
  218. })
  219. }
  220. },
  221. mySpecial: function() {
  222. console.log("special");
  223. wx.navigateTo({
  224. url: '/pages/specialcourtesy/specialcourtesy',
  225. })
  226. },
  227. //是否属于集团
  228. ifShowSqare() {
  229. if (wx.getStorageSync("squareList")) {
  230. this.setData({
  231. isShowSqare: true
  232. })
  233. } else {
  234. this.setData({
  235. isShowSqare: false
  236. })
  237. }
  238. },
  239. /**
  240. * 获取全局样式
  241. */
  242. getType() {
  243. Http.get({
  244. url: config.api.setType,
  245. data:{}
  246. }).then(res=>{
  247. const{code ,data}=res
  248. if(code==200){
  249. app.globalData.typeLsit=data
  250. this.setData({
  251. typeLsit: data,
  252. })
  253. }
  254. })
  255. },
  256. /**
  257. * 生命周期函数--监听页面初次渲染完成
  258. */
  259. onLoad: function(options) {
  260. this.getType()
  261. this.getLocation();
  262. let that = this;
  263. let optionss;
  264. let openId = wx.getStorageSync('openId')
  265. if (openId) {
  266. that.setData({
  267. openId: openId
  268. })
  269. }
  270. if (wx.getStorageSync('options')) {
  271. optionss = JSON.parse(wx.getStorageSync('options'));
  272. }
  273. if (options.played == "true") {
  274. that.setData({
  275. played: true
  276. })
  277. }
  278. if (optionss && optionss.couponChannelId || optionss && optionss.orderId) {
  279. that.setData({
  280. optionsData: optionss
  281. })
  282. that.getWeapNote(optionss.couponChannelId, optionss.orderId);
  283. } else {
  284. that.getWeapNote()
  285. }
  286. //获取条形码
  287. // util.barcode("barcode", optionss.quancode, 510, 100);
  288. // console.log(Http.headers.token, "?")
  289. },
  290. /**
  291. * 获得经纬度
  292. */
  293. getLocation() {
  294. let that = this;
  295. wx.getLocation({
  296. type: "wgs84",
  297. success: function(res) {
  298. console.log(res, 9999)
  299. if (res && res.longitude && res.latitude) {
  300. Http.post({
  301. url: config.api.updateLBS,
  302. data: {
  303. latitude: res.latitude,
  304. longitude: res.longitude
  305. }
  306. }).then(res => {
  307. console.log(res, 9999)
  308. })
  309. }
  310. },
  311. fail: error => {
  312. console.log(error);
  313. }
  314. })
  315. },
  316. onUnload() {
  317. // wx.removeStorageSync('squareList')
  318. },
  319. onShow: function() {
  320. this.ifShowSqare();
  321. if (wx.getStorageSync("squareList")) {
  322. var temp = wx.getStorageSync("squareList").filter(item => item.tenantId == wx.getStorageSync("selectedMall"))[0].name
  323. this.setData({
  324. squareName: temp
  325. })
  326. }
  327. if (typeof this.getTabBar === 'function' &&
  328. this.getTabBar()) {
  329. this.getTabBar().setData({
  330. selected: 0
  331. })
  332. }
  333. let that = this;
  334. that.setData({
  335. havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false,
  336. havePlayEd1: app.globalData.havePlayEd1 ? app.globalData.havePlayEd1 : false
  337. })
  338. /**
  339. * couponNum 是否有普通的优惠券购买
  340. * couponNum2 是否有新买的消费卡
  341. */
  342. let num = wx.getStorageSync('couponNum');
  343. let num1 = wx.getStorageSync('couponNum2');
  344. if (num == 'couponNum' || num1 == 'couponNum2') {
  345. wx.showTabBarRedDot({
  346. index: 3
  347. })
  348. } else {
  349. wx.hideTabBarRedDot({
  350. index: 3
  351. })
  352. }
  353. if (app.globalData.score) {
  354. that.setData({
  355. fistLogin: app.globalData.score
  356. })
  357. }
  358. // 如果有游戏
  359. setTimeout(function() {
  360. that.alphaClick();
  361. }, 8000)
  362. // 如果有广告
  363. setTimeout(function() {
  364. // debugger
  365. that.alphaClick1();
  366. }, 8000)
  367. },
  368. getmemberId: function(token) {
  369. let that = this;
  370. Http.get({
  371. url: config.api.getScore,
  372. data: {
  373. token: token
  374. }
  375. }).then(res => {
  376. that.setData({
  377. levelName: res.data.levelName,
  378. upgradePercent: res.data.upgradePercent,
  379. upgradeScore: res.data.upgradeScore,
  380. memberId: res.data.id,
  381. })
  382. })
  383. .catch(err => {
  384. wx.showModal({
  385. title: '提示',
  386. content: err.message,
  387. showCancel: false
  388. })
  389. })
  390. },
  391. gotoChengzhangzhi: function() {
  392. wx.navigateTo({
  393. url: '/pages/czdetail/czdetail',
  394. })
  395. },
  396. gotoBargain: function() {
  397. wx.navigateTo({
  398. url: '/pages/bargain/bargain',
  399. })
  400. },
  401. gotoSpellGroup: function() {
  402. wx.navigateTo({
  403. url: '/pages/spellGroup/spellGroup',
  404. })
  405. },
  406. gotoCard: function() {
  407. wx.navigateTo({
  408. url: '/pages/discountCardList/discountCardList',
  409. })
  410. },
  411. // gotoGame: function () {
  412. // wx.navigateTo({
  413. // url: '/pages/game/index',
  414. // })
  415. // },
  416. gotoJfsc: function() {
  417. wx.navigateTo({
  418. url: '/pages/integralmall/index',
  419. })
  420. },
  421. /**
  422. *
  423. * @param {code,page}
  424. * 子组件向父组件传值
  425. */
  426. onGetCode: function(e) {
  427. this.setData({
  428. code: e.detail.val,
  429. page: e.detail.pageNum,
  430. });
  431. console.log(e.detail.val)
  432. console.log(e.detail.pageNum)
  433. },
  434. getWeapNote: function(couponChannelId, couponId, orderId) {
  435. var that = this;
  436. if (app.globalData.token) {
  437. // 登录
  438. console.log(app.globalData.token)
  439. that.getmemberId(app.globalData.token);
  440. that.getBannerlist();
  441. that.topicShow();
  442. that.getxsList();
  443. that.getMallInfo(app.globalData.token);
  444. if (app.couponChannelListCallback) {
  445. app.couponChannelListCallback(app.globalData.token);
  446. }
  447. if (app.couponListCallback) {
  448. app.couponListCallback(app.globalData.token);
  449. }
  450. if (app.businessListCallback) {
  451. app.businessListCallback(app.globalData.token);
  452. }
  453. Http.get({
  454. url: config.api.getWeapNote,
  455. data: {
  456. appId: config.weapp.AppId,
  457. }
  458. })
  459. .then(res => {
  460. console.log(33333333333)
  461. console.log(app.globalData.token)
  462. console.log(res)
  463. console.log(33333333333)
  464. // that.getGameOne(app.globalData.token)
  465. that.getStaticGame(app.globalData.token)
  466. that.getGg(app.globalData.token)
  467. let weapNote = JSON.parse(res.data.weapNote);
  468. that.setData({
  469. desc: weapNote.firstpage.desc,
  470. title: weapNote.firstpage.title
  471. })
  472. })
  473. .catch(err => {
  474. // that.getGameOne(app.globalData.token)
  475. that.getStaticGame(app.globalData.token)
  476. that.getGg(app.globalData.token)
  477. wx.showModal({
  478. title: "提示",
  479. content: err.errMsg,
  480. showCancel: false
  481. });
  482. });
  483. } else {
  484. app.tokenCallback = token => {
  485. // 登录
  486. console.log(app.globalData.token)
  487. that.getmemberId(app.globalData.token);
  488. that.getBannerlist();
  489. that.topicShow();
  490. that.getxsList();
  491. that.getMallInfo(app.globalData.token);
  492. if (app.couponChannelListCallback) {
  493. app.couponChannelListCallback(app.globalData.token);
  494. }
  495. if (app.couponListCallback) {
  496. app.couponListCallback(app.globalData.token);
  497. }
  498. if (app.businessListCallback) {
  499. app.businessListCallback(app.globalData.token);
  500. }
  501. Http.get({
  502. url: config.api.getWeapNote,
  503. data: {
  504. appId: config.weapp.AppId,
  505. }
  506. })
  507. .then(res => {
  508. console.log(33333333333)
  509. console.log(app.globalData.token)
  510. console.log(res)
  511. console.log(33333333333)
  512. // that.getGameOne(app.globalData.token)
  513. that.getStaticGame(app.globalData.token)
  514. that.getGg(app.globalData.token)
  515. let weapNote = JSON.parse(res.data.weapNote);
  516. that.setData({
  517. desc: weapNote.firstpage.desc,
  518. title: weapNote.firstpage.title
  519. })
  520. })
  521. .catch(err => {
  522. // that.getGameOne(app.globalData.token)
  523. that.getStaticGame(app.globalData.token)
  524. that.getGg(app.globalData.token)
  525. wx.showModal({
  526. title: "提示",
  527. content: err.errMsg,
  528. showCancel: false
  529. });
  530. });
  531. }
  532. }
  533. },
  534. getStaticGame(token) {
  535. let _this = this;
  536. Http.get({
  537. url: config.api.getGame,
  538. data: {
  539. triggleAction: 2, // 固定入口
  540. token: token
  541. }
  542. }).then(res => {
  543. if (res.data.id) {
  544. _this.setData({
  545. showIf: true,
  546. newUrl: res.data.imgUrl
  547. })
  548. } else {
  549. _this.setData({
  550. showIf: false
  551. })
  552. }
  553. _this.setData({
  554. staticGamedata: res.data
  555. })
  556. })
  557. .catch(err => {
  558. _this.setData({
  559. showIf: false
  560. })
  561. console.log(err)
  562. })
  563. },
  564. getGameOne: function(token) {
  565. let _this = this;
  566. Http.get({
  567. url: config.api.getGame,
  568. data: {
  569. triggleAction: 1, // 登录触发
  570. token: token
  571. }
  572. }).then(res => {
  573. if (res.data.id) {
  574. _this.setData({
  575. showGame: true,
  576. })
  577. } else {
  578. _this.setData({
  579. showGame: false
  580. })
  581. }
  582. _this.setData({
  583. gamedata: res.data
  584. })
  585. })
  586. .catch(err => {
  587. _this.setData({
  588. showGame: false
  589. })
  590. this.alphaClick();
  591. })
  592. },
  593. /**
  594. * mallinfo
  595. */
  596. getMallInfo: function(token) {
  597. let that = this;
  598. Http.get({
  599. url: config.api.getMallInfo,
  600. data: {
  601. token: token,
  602. }
  603. }).then(res => {
  604. that.setData({
  605. liveFlag: res.data.liveSupport,
  606. weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null,
  607. weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null,
  608. });
  609. console.log(that.data.liveFlag, "||||")
  610. })
  611. .catch(err => {
  612. // 不需要错误提示
  613. });
  614. },
  615. //获取限时抢购列表
  616. getxsList() {
  617. let that = this;
  618. Http.get({
  619. url: config.api.couponChannelList,
  620. data: {
  621. pageNum: 1,
  622. pageSize: 3,
  623. targetAd: 2
  624. }
  625. }).then(res => {
  626. if (res && res.data.total > 0) {
  627. that.setData({
  628. xslist: res.data.list,
  629. showQg: true
  630. });
  631. } else {
  632. that.setData({
  633. showQg: false
  634. })
  635. }
  636. })
  637. .catch(err => {
  638. console.log(err)
  639. wx.showToast({
  640. title: err.errMsg,
  641. icon: 'none',
  642. duration: 2000,
  643. mask: false
  644. });
  645. })
  646. },
  647. /**
  648. * banner
  649. */
  650. getBannerlist: function() {
  651. let that = this;
  652. Http.get({
  653. url: config.api.bannerlist,
  654. data: {
  655. pageNum: 1,
  656. pageSize: 7
  657. }
  658. }).then(res => {
  659. that.getmemberId(app.globalData.token);
  660. // that.checkUserCarStatus();
  661. that.setData({
  662. list: res.data.list
  663. });
  664. })
  665. .catch(err => {
  666. that.getmemberId(app.globalData.token);
  667. // that.checkUserCarStatus();
  668. });
  669. },
  670. // 专题显示
  671. topicShow: function() {
  672. let that = this;
  673. Http.get({
  674. url: config.api.topicShow,
  675. data: {
  676. token: app.globalData.token
  677. }
  678. }).then(res => {
  679. if (res && res.data) {
  680. that.setData({
  681. name: res.data.name,
  682. cover: res.data.cover,
  683. id: res.data.id,
  684. showTopic: true
  685. })
  686. } else {
  687. that.setData({
  688. showTopic: false
  689. })
  690. }
  691. })
  692. .catch(err => {
  693. console.log(err);
  694. })
  695. },
  696. gotoTopic() {
  697. wx.navigateTo({
  698. url: `/pages/topicDetail/index?id=${this.data.id}`
  699. })
  700. },
  701. /**
  702. * 检查用户是否有车
  703. */
  704. // checkUserCarStatus: function() {
  705. // var that = this;
  706. // Http.get({
  707. // url: config.api.userCarCount,
  708. // data: {}
  709. // }).then(res => {
  710. // if (res.data > 0) {
  711. // // 用户名下有车
  712. // app.globalData.phone = res.data.phone;
  713. // app.globalData.supportCar = true;
  714. // // 共同登录
  715. // that.userCarLogin();
  716. // }
  717. // });
  718. // },
  719. /**
  720. * car共同登录
  721. */
  722. // userCarLogin: function() {
  723. // var that = this;
  724. // if (!app.globalData.carLogin) {
  725. // // 共同登录
  726. // Http.post({
  727. // url: config.api.carInit,
  728. // data: {
  729. // phone: app.globalData.phone
  730. // }
  731. // }).then(res => {
  732. // app.globalData.carLogin = true;
  733. // app.globalData.parkVendor = res.data.vendor;
  734. // if (res.data.token != "undefined") {
  735. // app.globalData.etcpToken = res.data.token;
  736. // }
  737. // });
  738. // }
  739. // },
  740. /**
  741. * 获取用户信息
  742. */
  743. // getUserInfo: function() {
  744. // // 获取用户信息
  745. // wx.getSetting({
  746. // success: res => {
  747. // if (res.authSetting["scope.userInfo"]) {
  748. // // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
  749. // wx.getUserInfo({
  750. // success: res => {
  751. // // 可以将 res 发送给后台解码出 unionId
  752. // }
  753. // });
  754. // }
  755. // }
  756. // });
  757. // },
  758. gotoBargain: function() {
  759. wx.navigateTo({
  760. url: '/pages/bargain/bargain'
  761. })
  762. },
  763. //限时抢购的详情页面
  764. gotodetail: function(e) {
  765. wx.navigateTo({
  766. url: `/pages/coupon/detail/index?couponChannelId=${
  767. e.currentTarget.dataset.couponchannelid
  768. }&couponId=${e.currentTarget.dataset.couponid}`
  769. });
  770. },
  771. //浮层广告
  772. getGg: function(token) {
  773. let that = this
  774. Http.get({
  775. url: config.api.getGg,
  776. data: {
  777. token: token,
  778. appId: config.weapp.AppId,
  779. openId: that.data.openId
  780. }
  781. }).then(res => {
  782. console.log(res)
  783. if (res.data.id) {
  784. that.setData({
  785. showGg: true,
  786. })
  787. console.log(that.data.showGg, 1111111111111)
  788. } else {
  789. that.setData({
  790. showGg: false
  791. })
  792. that.getGameOne(app.globalData.token)
  793. console.log(that.data.showGg, 222222222222222222)
  794. }
  795. that.setData({
  796. ggdata: res.data
  797. })
  798. })
  799. .catch(err => {
  800. this.setData({
  801. showGg: false
  802. })
  803. that.getGameOne(app.globalData.token)
  804. that.alphaClick1();
  805. })
  806. },
  807. /**
  808. * 刷新
  809. */
  810. onPullDownRefresh: function(e) {
  811. let that = this;
  812. that.getWeapNote();
  813. that.setData({
  814. page: 1
  815. })
  816. if (this.data.optionsData != null && (this.data.optionsData.couponChannelId || this.data.optionsData.orderId)) {
  817. this.getWeapNote(this.data.optionsData.couponChannelId, this.data.optionsData.orderId);
  818. } else {
  819. this.getWeapNote()
  820. }
  821. if (that.data.code == 0 || that.data.code == undefined) {
  822. that.selectComponent("#lists").getList(0, 1, "refresh");
  823. wx.stopPullDownRefresh();
  824. } else {
  825. that.selectComponent("#lists").getList(that.data.code, 1, "refresh");
  826. wx.stopPullDownRefresh();
  827. };
  828. // 砍价下拉刷新
  829. // that.selectComponent("#bargain").getList();
  830. // that.selectComponent("#spellGroup").getList();
  831. // that.selectComponent("#rushtobyCard").getList();
  832. wx.stopPullDownRefresh();
  833. //爆款专区下拉刷新
  834. that.selectComponent("#hot").getList();
  835. that.getxsList();
  836. that.topicShow();
  837. },
  838. //加载更多
  839. onReachBottom: function() {
  840. let that = this;
  841. that.data.page++;
  842. that.setData({
  843. page: that.data.page
  844. });
  845. console.log("加载更多页数" + that.data.page);
  846. console.log("加载更多key" + that.data.code);
  847. //父组件获得子组件的方法
  848. //如果code == 0
  849. if (that.data.code == 0 || that.data.code == undefined) {
  850. that.selectComponent("#lists").getList(0, that.data.page);
  851. } else {
  852. that.selectComponent("#lists").getList(that.data.code, that.data.page);
  853. }
  854. },
  855. // 用户点击右上角分享
  856. onShareAppMessage: function() {
  857. app.globalData.previewFlag = true
  858. return {
  859. title: this.data.weappShareTitle,
  860. imageUrl: this.data.weappShareCoverImg,
  861. // desc: this.data.desc,
  862. success: function(res) {
  863. wx.showToast({
  864. title: "分享成功",
  865. duration: 1000,
  866. icon: "success"
  867. });
  868. }
  869. };
  870. }
  871. });