cps-jd.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. const WXAPI = require('apifm-wxapi')
  2. const AUTH = require('../../../utils/auth')
  3. import Poster from 'wxa-plugin-canvas/poster/poster'
  4. Page({
  5. data: {
  6. wxlogin: true,
  7. createTabs: false, //绘制tabs
  8. tabs: [{
  9. tabs_name: '商品简介',
  10. view_id: 'swiper-container',
  11. topHeight: 0
  12. }, {
  13. tabs_name: '商品详情',
  14. view_id: 'goods-des-info',
  15. topHeight: 0,
  16. }],
  17. goodsDetail: {},
  18. hasMoreSelect: false,
  19. selectSizePrice: 0,
  20. selectSizeOPrice: 0,
  21. totalScoreToPay: 0,
  22. shopNum: 0,
  23. hideShopPopup: true,
  24. buyNumber: 1,
  25. buyNumMin: 1,
  26. buyNumMax: 0,
  27. propertyChildIds: "",
  28. propertyChildNames: "",
  29. canSubmit: false, // 选中规格尺寸时候是否允许加入购物车
  30. shopType: "addShopCar", //购物类型,加入购物车或立即购买,默认为加入购物车
  31. },
  32. bindscroll(e) {
  33. if (this.data.tabclicked) {
  34. return
  35. }
  36. //计算页面 轮播图、详情、评价(砍价)view 高度
  37. this.getTopHeightFunction()
  38. var tabsHeight = this.data.tabsHeight //顶部距离(tabs高度)
  39. if (this.data.tabs[0].topHeight-tabsHeight<=0 && 0 < this.data.tabs[1].topHeight-tabsHeight) { //临界值,根据自己的需求来调整
  40. this.setData({
  41. active: this.data.tabs[0].tabs_name //设置当前标签栏
  42. })
  43. } else if (this.data.tabs[1].topHeight-tabsHeight<=0) {
  44. this.setData({
  45. active: this.data.tabs[1].tabs_name
  46. })
  47. }
  48. },
  49. onLoad(e) {
  50. // e.id = 802819
  51. // 读取分享链接中的邀请人编号
  52. if (e && e.inviter_id) {
  53. wx.setStorageSync('referrer', e.inviter_id)
  54. }
  55. // 读取小程序码中的邀请人编号
  56. if (e && e.scene) {
  57. const scene = decodeURIComponent(e.scene) // 处理扫码进商品详情页面的逻辑
  58. if (scene && scene.split(',').length >= 2) {
  59. e.id = scene.split(',')[0]
  60. wx.setStorageSync('referrer', scene.split(',')[1])
  61. }
  62. }
  63. // 静默式授权注册/登陆
  64. AUTH.checkHasLogined().then(isLogined => {
  65. if (!isLogined) {
  66. AUTH.authorize().then( aaa => {
  67. AUTH.bindSeller()
  68. })
  69. } else {
  70. AUTH.bindSeller()
  71. }
  72. })
  73. this.data.goodsId = e.id
  74. this.goodsDetail()
  75. },
  76. async goodsDetail() {
  77. const token = wx.getStorageSync('token')
  78. const res = await WXAPI.goodsDetail(this.data.goodsId, token ? token : '')
  79. if (res.code == 0) {
  80. this.setData({
  81. goodsDetail: res.data,
  82. })
  83. this.cpsJdGoodsDetail(res.data.basicInfo.yyId)
  84. }
  85. },
  86. async cpsJdGoodsDetail(skuId) {
  87. const res = await WXAPI.cpsJdGoodsDetail({
  88. skuIds: skuId
  89. })
  90. if (res.code == 0) {
  91. const _data = res.data[0]
  92. if (_data.detailImages) {
  93. _data.detailImagesArray = _data.detailImages.split(',')
  94. }
  95. this.setData({
  96. cpsJdGoodsDetail: _data
  97. })
  98. }
  99. },
  100. selectAddress: function () {
  101. wx.navigateTo({
  102. url: "/pages/select-address/index"
  103. })
  104. },
  105. onShow (){
  106. this.setData({
  107. createTabs: true //绘制tabs
  108. })
  109. //计算tabs高度
  110. var query = wx.createSelectorQuery();
  111. query.select('#tabs').boundingClientRect((rect) => {
  112. var tabsHeight = rect.height
  113. this.setData({
  114. tabsHeight:tabsHeight
  115. })
  116. }).exec()
  117. AUTH.checkHasLogined().then(isLogined => {
  118. if (isLogined) {
  119. this.setData({
  120. wxlogin: isLogined
  121. })
  122. this.goodsFavCheck()
  123. }
  124. })
  125. },
  126. getTopHeightFunction() {
  127. var that = this
  128. var tabs = that.data.tabs
  129. tabs.forEach((element, index) => {
  130. var viewId = "#" + element.view_id
  131. that.getTopHeight(viewId, index)
  132. });
  133. },
  134. getTopHeight(viewId, index) {
  135. var query = wx.createSelectorQuery();
  136. query.select(viewId).boundingClientRect((rect) => {
  137. if (!rect) {
  138. return
  139. }
  140. let top = rect.top
  141. var tabs = this.data.tabs
  142. tabs[index].topHeight = top
  143. this.setData({
  144. tabs: tabs
  145. })
  146. }).exec()
  147. },
  148. async goodsFavCheck() {
  149. const res = await WXAPI.goodsFavCheck(wx.getStorageSync('token'), this.data.goodsId)
  150. if (res.code == 0) {
  151. this.setData({
  152. faved: true
  153. })
  154. } else {
  155. this.setData({
  156. faved: false
  157. })
  158. }
  159. },
  160. async addFav(){
  161. AUTH.checkHasLogined().then(isLogined => {
  162. this.setData({
  163. wxlogin: isLogined
  164. })
  165. if (isLogined) {
  166. if (this.data.faved) {
  167. // 取消收藏
  168. WXAPI.goodsFavDeleteV2({
  169. token: wx.getStorageSync('token'),
  170. goodsId: this.data.goodsId,
  171. type: 1
  172. }).then(res => {
  173. this.goodsFavCheck()
  174. })
  175. } else {
  176. const extJsonStr = {
  177. wxaurl: `/packageCps/pages/goods-details/cps-jd?id=${this.data.goodsId}`,
  178. skuId: this.data.goodsId,
  179. pic: this.data.goodsDetail.basicInfo.pic,
  180. name: this.data.goodsDetail.basicInfo.name
  181. }
  182. // 加入收藏
  183. WXAPI.goodsFavAdd({
  184. token: wx.getStorageSync('token'),
  185. goodsId: this.data.goodsId,
  186. type: 1,
  187. extJsonStr: JSON.stringify(extJsonStr)
  188. }).then(res => {
  189. this.goodsFavCheck()
  190. })
  191. }
  192. }
  193. })
  194. },
  195. goShopCar: function() {
  196. wx.reLaunch({
  197. url: "/pages/shop-cart/index"
  198. });
  199. },
  200. toAddShopCar: function() {
  201. this.setData({
  202. shopType: "addShopCar"
  203. })
  204. this.bindGuiGeTap();
  205. },
  206. async tobuy() {
  207. const token = wx.getStorageSync('token')
  208. if (!token) {
  209. wx.showToast({
  210. title: '请先登陆',
  211. icon: 'none'
  212. })
  213. return
  214. }
  215. const res = await WXAPI.cpsJdGoodsShotUrl(token, this.data.goodsDetail.basicInfo.yyId)
  216. if (res.code != 0) {
  217. wx.showToast({
  218. title: res.msg,
  219. icon: 'none'
  220. })
  221. return
  222. }
  223. // res.data.shortURL
  224. const url = encodeURIComponent(res.data.shortURL)
  225. wx.navigateToMiniProgram({
  226. appId: 'wx91d27dbf599dff74',
  227. path: `/pages/union/proxy/proxy?spreadUrl=${url}`
  228. })
  229. },
  230. toPingtuan: function(e) {
  231. let pingtuanopenid = 0
  232. if (e.currentTarget.dataset.pingtuanopenid) {
  233. pingtuanopenid = e.currentTarget.dataset.pingtuanopenid
  234. }
  235. this.setData({
  236. shopType: "toPingtuan",
  237. selectSizePrice: this.data.goodsDetail.basicInfo.pingtuanPrice,
  238. selectSizeOPrice: this.data.goodsDetail.basicInfo.originalPrice,
  239. pingtuanopenid: pingtuanopenid,
  240. hideShopPopup: false,
  241. skuGoodsPic: this.data.goodsDetail.basicInfo.pic
  242. });
  243. },
  244. /**
  245. * 规格选择弹出框
  246. */
  247. bindGuiGeTap: function() {
  248. this.setData({
  249. hideShopPopup: false
  250. })
  251. },
  252. /**
  253. * 规格选择弹出框隐藏
  254. */
  255. closePopupTap: function() {
  256. this.setData({
  257. hideShopPopup: true
  258. })
  259. },
  260. stepChange(event) {
  261. this.setData({
  262. buyNumber: event.detail
  263. })
  264. },
  265. /**
  266. * 选择商品规格
  267. */
  268. async labelItemTap(e) {
  269. const propertyindex = e.currentTarget.dataset.propertyindex
  270. const propertychildindex = e.currentTarget.dataset.propertychildindex
  271. const property = this.data.goodsDetail.properties[propertyindex]
  272. const child = property.childsCurGoods[propertychildindex]
  273. // 取消该分类下的子栏目所有的选中状态
  274. property.childsCurGoods.forEach(child => {
  275. child.active = false
  276. })
  277. // 设置当前选中状态
  278. property.optionValueId = child.id
  279. child.active = true
  280. // 获取所有的选中规格尺寸数据
  281. const needSelectNum = this.data.goodsDetail.properties.length
  282. let curSelectNum = 0;
  283. let propertyChildIds = "";
  284. let propertyChildNames = "";
  285. this.data.goodsDetail.properties.forEach(p => {
  286. p.childsCurGoods.forEach(c => {
  287. if (c.active) {
  288. curSelectNum++;
  289. propertyChildIds = propertyChildIds + p.id + ":" + c.id + ",";
  290. propertyChildNames = propertyChildNames + p.name + ":" + c.name + " ";
  291. }
  292. })
  293. })
  294. let canSubmit = false;
  295. if (needSelectNum == curSelectNum) {
  296. canSubmit = true;
  297. }
  298. let skuGoodsPic = this.data.skuGoodsPic
  299. if (this.data.goodsDetail.subPics && this.data.goodsDetail.subPics.length > 0) {
  300. const _subPic = this.data.goodsDetail.subPics.find(ele => {
  301. return ele.optionValueId == child.id
  302. })
  303. if (_subPic) {
  304. skuGoodsPic = _subPic.pic
  305. }
  306. }
  307. this.setData({
  308. goodsDetail: this.data.goodsDetail,
  309. canSubmit,
  310. skuGoodsPic,
  311. propertyChildIds,
  312. propertyChildNames,
  313. })
  314. this.calculateGoodsPrice()
  315. },
  316. async calculateGoodsPrice() {
  317. // 计算最终的商品价格
  318. let price = this.data.goodsDetail.basicInfo.minPrice
  319. let originalPrice = this.data.goodsDetail.basicInfo.originalPrice
  320. let totalScoreToPay = this.data.goodsDetail.basicInfo.minScore
  321. let buyNumMax = this.data.goodsDetail.basicInfo.stores
  322. let buyNumber = this.data.goodsDetail.basicInfo.minBuyNumber
  323. if (this.data.shopType == 'toPingtuan') {
  324. price = this.data.goodsDetail.basicInfo.pingtuanPrice
  325. }
  326. // 计算 sku 价格
  327. if (this.data.canSubmit) {
  328. const token = wx.getStorageSync('token')
  329. const res = await WXAPI.goodsPriceV2({
  330. token: token ? token : '',
  331. goodsId: this.data.goodsDetail.basicInfo.id,
  332. propertyChildIds: this.data.propertyChildIds
  333. })
  334. if (res.code == 0) {
  335. price = res.data.price
  336. if (this.data.shopType == 'toPingtuan') {
  337. price = res.data.pingtuanPrice
  338. }
  339. originalPrice = res.data.originalPrice
  340. totalScoreToPay = res.data.score
  341. buyNumMax = res.data.stores
  342. }
  343. }
  344. // 计算配件价格
  345. if (this.data.goodsAddition) {
  346. this.data.goodsAddition.forEach(big => {
  347. big.items.forEach(small => {
  348. if (small.active) {
  349. price = (price*100 + small.price*100) / 100
  350. }
  351. })
  352. })
  353. }
  354. this.setData({
  355. selectSizePrice: price,
  356. selectSizeOPrice: originalPrice,
  357. totalScoreToPay: totalScoreToPay,
  358. buyNumMax,
  359. buyNumber: (buyNumMax >= buyNumber) ? buyNumber : 0
  360. });
  361. },
  362. /**
  363. * 选择可选配件
  364. */
  365. async labelItemTap2(e) {
  366. const propertyindex = e.currentTarget.dataset.propertyindex
  367. const propertychildindex = e.currentTarget.dataset.propertychildindex
  368. const goodsAddition = this.data.goodsAddition
  369. const property = goodsAddition[propertyindex]
  370. const child = property.items[propertychildindex]
  371. if (child.active) {
  372. // 该操作为取消选择
  373. child.active = false
  374. this.setData({
  375. goodsAddition
  376. })
  377. this.calculateGoodsPrice()
  378. return
  379. }
  380. // 单选配件取消所有子栏目选中状态
  381. if (property.type == 0) {
  382. property.items.forEach(child => {
  383. child.active = false
  384. })
  385. }
  386. // 设置当前选中状态
  387. child.active = true
  388. this.setData({
  389. goodsAddition
  390. })
  391. this.calculateGoodsPrice()
  392. },
  393. /**
  394. * 组建立即购买信息
  395. */
  396. buliduBuyNowInfo: function(shoptype) {
  397. var shopCarMap = {};
  398. shopCarMap.goodsId = this.data.goodsId;
  399. shopCarMap.pic = this.data.imageDomain + this.data.price.pic;
  400. shopCarMap.name = this.data.price.skuName;
  401. shopCarMap.price = this.data.price.priceSale;
  402. shopCarMap.left = "";
  403. shopCarMap.active = true;
  404. shopCarMap.number = this.data.buyNumber;
  405. var buyNowInfo = {};
  406. buyNowInfo.shopNum = 0;
  407. buyNowInfo.shopList = [shopCarMap];
  408. return buyNowInfo;
  409. },
  410. onShareAppMessage() {
  411. let _data = {
  412. title: this.data.goodsDetail.basicInfo.name,
  413. path: '/packageCps/pages/goods-details/cps-jd?id=' + this.data.goodsId + '&inviter_id=' + wx.getStorageSync('uid'),
  414. success: function(res) {
  415. // 转发成功
  416. },
  417. fail: function(res) {
  418. // 转发失败
  419. }
  420. }
  421. if (this.data.kjJoinUid) {
  422. _data.title = this.data.curKanjiaprogress.joiner.nick + '邀请您帮TA砍价'
  423. _data.path += '&kjJoinUid=' + this.data.kjJoinUid
  424. }
  425. return _data
  426. },
  427. reputation: function(goodsId) {
  428. var that = this;
  429. WXAPI.goodsReputation({
  430. goodsId: goodsId
  431. }).then(function(res) {
  432. if (res.code == 0) {
  433. res.data.forEach(ele => {
  434. if (ele.goods.goodReputation == 0) {
  435. ele.goods.goodReputation = 1
  436. } else if (ele.goods.goodReputation == 1) {
  437. ele.goods.goodReputation = 3
  438. } else if (ele.goods.goodReputation == 2) {
  439. ele.goods.goodReputation = 5
  440. }
  441. })
  442. that.setData({
  443. reputation: res.data
  444. });
  445. }
  446. })
  447. },
  448. pingtuanList: function(goodsId) {
  449. var that = this;
  450. WXAPI.pingtuanList({
  451. goodsId: goodsId,
  452. status: 0
  453. }).then(function(res) {
  454. if (res.code == 0) {
  455. that.setData({
  456. pingtuanList: res.data.result
  457. });
  458. }
  459. })
  460. },
  461. getVideoSrc: function(videoId) {
  462. var that = this;
  463. WXAPI.videoDetail(videoId).then(function(res) {
  464. if (res.code == 0) {
  465. that.setData({
  466. videoMp4Src: res.data.fdMp4
  467. });
  468. }
  469. })
  470. },
  471. joinKanjia(){
  472. AUTH.checkHasLogined().then(isLogined => {
  473. if (isLogined) {
  474. this.doneJoinKanjia();
  475. } else {
  476. this.setData({
  477. wxlogin: false
  478. })
  479. }
  480. })
  481. },
  482. doneJoinKanjia: function() { // 报名参加砍价活动
  483. const _this = this;
  484. if (!_this.data.curGoodsKanjia) {
  485. return;
  486. }
  487. wx.showLoading({
  488. title: '加载中',
  489. mask: true
  490. })
  491. WXAPI.kanjiaJoin(wx.getStorageSync('token'), _this.data.curGoodsKanjia.id).then(function(res) {
  492. wx.hideLoading()
  493. if (res.code == 0) {
  494. _this.setData({
  495. kjJoinUid: wx.getStorageSync('uid'),
  496. myHelpDetail: null
  497. })
  498. _this.getGoodsDetailAndKanjieInfo(_this.data.goodsDetail.basicInfo.id)
  499. } else {
  500. wx.showToast({
  501. title: res.msg,
  502. icon: 'none'
  503. })
  504. }
  505. })
  506. },
  507. joinPingtuan: function(e) {
  508. let pingtuanopenid = e.currentTarget.dataset.pingtuanopenid
  509. wx.navigateTo({
  510. url: "/pages/to-pay-order/index?orderType=buyNow&pingtuanOpenId=" + pingtuanopenid
  511. })
  512. },
  513. goIndex() {
  514. wx.switchTab({
  515. url: '/pages/index/index',
  516. });
  517. },
  518. helpKanjia() {
  519. const _this = this;
  520. AUTH.checkHasLogined().then(isLogined => {
  521. _this.setData({
  522. wxlogin: isLogined
  523. })
  524. if (isLogined) {
  525. _this.helpKanjiaDone()
  526. }
  527. })
  528. },
  529. helpKanjiaDone(){
  530. const _this = this;
  531. WXAPI.kanjiaHelp(wx.getStorageSync('token'), _this.data.kjId, _this.data.kjJoinUid, '').then(function (res) {
  532. if (res.code != 0) {
  533. wx.showToast({
  534. title: res.msg,
  535. icon: 'none'
  536. })
  537. return;
  538. }
  539. _this.setData({
  540. myHelpDetail: res.data
  541. });
  542. wx.showModal({
  543. title: '成功',
  544. content: '成功帮TA砍掉 ' + res.data.cutPrice + ' 元',
  545. showCancel: false
  546. })
  547. _this.getGoodsDetailAndKanjieInfo(_this.data.goodsDetail.basicInfo.id)
  548. })
  549. },
  550. cancelLogin() {
  551. this.setData({
  552. wxlogin: true
  553. })
  554. },
  555. closePop(){
  556. this.setData({
  557. posterShow: false
  558. })
  559. },
  560. async drawSharePic() {
  561. const _this = this
  562. const qrcodeRes = await WXAPI.wxaQrcode({
  563. scene: _this.data.goodsId + ',' + wx.getStorageSync('uid'),
  564. page: '/packageCps/pages/goods-details/cps-jd',
  565. is_hyaline: true,
  566. autoColor: true,
  567. expireHours: 1
  568. })
  569. if (qrcodeRes.code != 0) {
  570. wx.showToast({
  571. title: qrcodeRes.msg,
  572. icon: 'none'
  573. })
  574. return
  575. }
  576. const qrcode = qrcodeRes.data
  577. const pic = _this.data.goodsDetail.basicInfo.pic
  578. wx.getImageInfo({
  579. src: pic,
  580. success(res) {
  581. const height = 490 * res.height / res.width
  582. _this.drawSharePicDone(height, qrcode)
  583. },
  584. fail(e) {
  585. console.error(e)
  586. }
  587. })
  588. },
  589. drawSharePicDone(picHeight, qrcode) {
  590. const _this = this
  591. const _baseHeight = 74 + (picHeight + 120)
  592. this.setData({
  593. posterConfig: {
  594. width: 750,
  595. height: picHeight + 660,
  596. backgroundColor: '#fff',
  597. debug: false,
  598. blocks: [
  599. {
  600. x: 76,
  601. y: 74,
  602. width: 604,
  603. height: picHeight + 120,
  604. borderWidth: 2,
  605. borderColor: '#c2aa85',
  606. borderRadius: 8
  607. }
  608. ],
  609. images: [
  610. {
  611. x: 133,
  612. y: 133,
  613. url: _this.data.goodsDetail.basicInfo.pic, // 商品图片
  614. width: 490,
  615. height: picHeight
  616. },
  617. {
  618. x: 76,
  619. y: _baseHeight + 199,
  620. url: qrcode, // 二维码
  621. width: 222,
  622. height: 222
  623. }
  624. ],
  625. texts: [
  626. {
  627. x: 375,
  628. y: _baseHeight + 80,
  629. width: 650,
  630. lineNum:2,
  631. text: _this.data.goodsDetail.basicInfo.name,
  632. textAlign: 'center',
  633. fontSize: 40,
  634. color: '#333'
  635. },
  636. {
  637. x: 375,
  638. y: _baseHeight + 180,
  639. text: '¥' + _this.data.goodsDetail.basicInfo.minPrice,
  640. textAlign: 'center',
  641. fontSize: 50,
  642. color: '#e64340'
  643. },
  644. {
  645. x: 352,
  646. y: _baseHeight + 320,
  647. text: '长按识别小程序码',
  648. fontSize: 28,
  649. color: '#999'
  650. }
  651. ],
  652. }
  653. }, () => {
  654. Poster.create();
  655. });
  656. },
  657. onPosterSuccess(e) {
  658. console.log('success:', e)
  659. this.setData({
  660. posterImg: e.detail,
  661. showposterImg: true
  662. })
  663. },
  664. onPosterFail(e) {
  665. console.error('fail:', e)
  666. },
  667. savePosterPic() {
  668. const _this = this
  669. wx.saveImageToPhotosAlbum({
  670. filePath: this.data.posterImg,
  671. success: (res) => {
  672. wx.showModal({
  673. content: '已保存到手机相册',
  674. showCancel: false,
  675. confirmText: '知道了',
  676. confirmColor: '#333'
  677. })
  678. },
  679. complete: () => {
  680. _this.setData({
  681. showposterImg: false
  682. })
  683. },
  684. fail: (res) => {
  685. wx.showToast({
  686. title: res.errMsg,
  687. icon: 'none',
  688. duration: 2000
  689. })
  690. }
  691. })
  692. },
  693. previewImage(e) {
  694. const url = e.currentTarget.dataset.url
  695. wx.previewImage({
  696. current: url, // 当前显示图片的http链接
  697. urls: [url] // 需要预览的图片http链接列表
  698. })
  699. },
  700. onTabsChange(e) {
  701. var index = e.detail.index
  702. this.setData({
  703. toView: this.data.tabs[index].view_id,
  704. tabclicked: true
  705. })
  706. setTimeout(() => {
  707. this.setData({
  708. tabclicked: false
  709. })
  710. }, 1000);
  711. },
  712. backToHome() {
  713. wx.switchTab({
  714. url: '/pages/index/index',
  715. })
  716. }
  717. })