C端小程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

836 righe
23 KiB

  1. var config = require("../../../config/config.js");
  2. var app = getApp();
  3. const Http = require("../../../utils/HttpBasics");
  4. const util = require("../../../utils/util");
  5. const imgurl = require("../../../utils/imgurl");
  6. Page({
  7. data: {
  8. fenxiangUrl: imgurl.fenxiang.url,
  9. clockUrl: imgurl.clock.url,
  10. teljpgUrl: imgurl.teljpg.url,
  11. closedUrl: imgurl.closed.url,
  12. quesGouUrl: imgurl.ques_gou.url,
  13. headbgUrl: imgurl.headbg.url,
  14. quesBgUrl: imgurl.ques_bg.url,
  15. close02: imgurl.close02.url,
  16. hidden: "hidden",
  17. height: "",
  18. more: "点击查看更多",
  19. showMore: true,
  20. data: {
  21. title: null
  22. },
  23. showPage: false,
  24. questions1: null,
  25. questions2: null,
  26. carList: [],
  27. couponChannelId: null,
  28. orderId: "",
  29. hour: null,
  30. day: null,
  31. month: null,
  32. year: null,
  33. minute: "",
  34. tempFilePaths: null,
  35. userInfo: {},
  36. hasUserInfo: false,
  37. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  38. id: null,
  39. result: [],
  40. end_time: null,
  41. checked: false,
  42. questionnaire: {},
  43. questionId: null,
  44. widthScreen: null,
  45. moveData: null,
  46. rotateData: null,
  47. alphaData: null,
  48. scaleData: null,
  49. skewData: null,
  50. matrixData: null,
  51. opacity: 0,
  52. queueData: null,
  53. zIndex: 11,
  54. display: "none",
  55. showbutton: false,
  56. cardData: null,
  57. showCardOffer: false,
  58. isSamePeople: true,
  59. statusText: '',
  60. isReceived: false,
  61. receivedDisabled: false,
  62. clock: "结束",
  63. day: "00",
  64. hour: "00",
  65. min: "00",
  66. sec: "00",
  67. clock02: "00",
  68. day02: "00",
  69. hour02: "00",
  70. min02: "00",
  71. sec02: "00",
  72. countdown: "",
  73. showbutton1:false
  74. },
  75. phone: function(e) {
  76. let that = this;
  77. wx.makePhoneCall({
  78. phoneNumber: e.target.dataset.merchantlinkphone
  79. });
  80. },
  81. // 点击查看更多
  82. more: function() {
  83. let that = this;
  84. if (that.data.more == '点击查看更多') {
  85. this.setData({
  86. hidden: "",
  87. height: that.data.data.merchantVoList.length * 140 + 'rpx',
  88. more: "点击收起",
  89. showMore: true
  90. })
  91. } else {
  92. this.setData({
  93. hidden: "hidden",
  94. height: 4 * 140 + 'rpx',
  95. more: "点击查看更多",
  96. showMore: true
  97. })
  98. }
  99. },
  100. //获取当前登录用户信息
  101. getUserInfo: function() {
  102. let that = this;
  103. // 获取用户信息
  104. Http.get({
  105. url: config.api.getScore,
  106. data: {}
  107. })
  108. .then(res => {
  109. console.log(res)
  110. that.getQueryCardStatus()
  111. if (that.data.cardData.cuserId != res.data.id) {
  112. console.log(2222, 6666)
  113. that.setData({
  114. isSamePeople: false
  115. })
  116. }
  117. })
  118. },
  119. //获取卡转赠状态
  120. getQueryCardStatus() {
  121. let that = this;
  122. let param = {
  123. id: this.data.cardData.couponOrderId,
  124. cUserId: this.data.cardData.cuserId,
  125. updateDate: util.formatTime(Number(that.data.cardData.updateDate), "yyyy-MM-dd hh:mm:ss")
  126. }
  127. Http.get({
  128. url: config.api.queryCardStatus,
  129. data: param
  130. })
  131. .then(res => {
  132. console.log(res, 333333333333)
  133. })
  134. .catch(err => {
  135. that.setData({
  136. isReceived: true,
  137. statusText: err.message
  138. })
  139. })
  140. },
  141. receiveCard() {
  142. let that = this;
  143. let param = {
  144. id: this.data.cardData.couponOrderId,
  145. cUserId: this.data.cardData.cuserId,
  146. updateDate: util.formatTime(Number(this.data.cardData.updateDate), "yyyy-MM-dd hh:mm:ss")
  147. }
  148. this.setData({
  149. receivedDisabled: true
  150. })
  151. Http.post({
  152. url: config.api.cardAccept,
  153. data: param
  154. })
  155. .then(res => {
  156. wx.showToast({
  157. title: '领取成功!',
  158. icon: 'none',
  159. duration: 2000,
  160. mask: false
  161. });
  162. wx.reLaunch({
  163. url: '/pages/complete/index?couponOrderId=' + this.data.cardData.couponOrderId,
  164. })
  165. })
  166. .catch(err => {
  167. wx.showToast({
  168. title: err.message,
  169. icon: 'none',
  170. duration: 2000,
  171. mask: false
  172. });
  173. that.setData({
  174. receivedDisabled: false
  175. })
  176. })
  177. },
  178. closeAlert() {
  179. this.setData({
  180. showCardOffer: false
  181. })
  182. },
  183. goback: function() {
  184. wx.switchTab({
  185. url: '/pages/main/index',
  186. })
  187. },
  188. /**
  189. * 点击提交问题单选
  190. */
  191. formSubmit: function(e) {
  192. console.log(e);
  193. let that = this;
  194. /**
  195. * 多选
  196. */
  197. if (e.currentTarget.dataset.flags == 'multi') {
  198. if (that.data.anwserId.length == 0) {
  199. var answserIs = null
  200. } else {
  201. var answserIs = that.data.anwserId.join(",");
  202. }
  203. } else if (e.currentTarget.dataset.flags == 'single') {
  204. var answserIs = e.detail.value;
  205. }
  206. console.log(answserIs)
  207. console.log(e.currentTarget.dataset.questionid)
  208. Http.post({
  209. url: config.api.answerQuestion,
  210. data: {
  211. answer: answserIs,
  212. questionId: e.currentTarget.dataset.questionid
  213. }
  214. })
  215. .then(res => {
  216. that.closeQuestion();
  217. })
  218. .catch(err => {
  219. wx.showToast({
  220. title: err.message,
  221. icon: 'none',
  222. duration: 2000,
  223. mask: false
  224. });
  225. })
  226. },
  227. /**
  228. * 多选
  229. */
  230. checkboxChange: function(e) {
  231. console.log(e)
  232. this.setData({
  233. anwserId: e.detail.value
  234. })
  235. },
  236. closeQuestion: function() {
  237. let that = this;
  238. that.setData({
  239. display: "none",
  240. zIndex: 11,
  241. opacity: 0
  242. })
  243. setTimeout(function() {
  244. that.orderFunc();
  245. }, 500)
  246. },
  247. /**
  248. * gotopay
  249. */
  250. gotopay: function(e) {
  251. let that = this;
  252. var discount = e.currentTarget.dataset.discount;
  253. that.setData({
  254. queueData: null,
  255. showbutton: true
  256. })
  257. Http.get({
  258. url: config.api.getQuestion,
  259. data: {
  260. couponType: JSON.stringify(that.data.data.type)
  261. }
  262. })
  263. .then(res => {
  264. console.log(res);
  265. if (res.data == undefined) {
  266. that.orderFunc(discount);
  267. that.setData({
  268. flag: false
  269. })
  270. } else if (res.data) {
  271. var animation = wx.createAnimation({});
  272. animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({
  273. duration: 500
  274. })
  275. that.setData({
  276. queueData: animation.export(),
  277. zIndex: 9,
  278. opacity: 1,
  279. display: "block",
  280. questionnaire: JSON.parse(res.data.content),
  281. questionId: res.data.id
  282. });
  283. }
  284. })
  285. .catch(err => {
  286. wx.showToast({
  287. title: err.message,
  288. icon: 'none',
  289. duration: 2000,
  290. mask: false
  291. });
  292. })
  293. },
  294. setIntervalTime(end_time) {
  295. let that = this;
  296. var EndTime = end_time;
  297. var NowTime = new Date().getTime();
  298. var total_micro_second = EndTime - NowTime || [];
  299. // 渲染倒计时时钟
  300. let obj = that.dateformat(total_micro_second);
  301. console.log(total_micro_second)
  302. if (total_micro_second > 0) {
  303. that.setData({
  304. clock: obj,
  305. day: obj.a1,
  306. hour: obj.b1,
  307. min: obj.c1,
  308. sec: obj.d1,
  309. })
  310. } else {
  311. that.setData({
  312. clock: "00",
  313. day: "00",
  314. hour: "00",
  315. min: "00",
  316. sec: "00",
  317. })
  318. //如果倒计时结束,需要重新查询一下券的状态
  319. // 给getDetail一个标识
  320. that.getDetail(that.data.couponChannelId,'endclock');
  321. }
  322. total_micro_second -= 1000;
  323. },
  324. countdown: function(end_time) {
  325. let that = this;
  326. that.setIntervalTime(end_time);
  327. that.data.setInterval = setInterval(function() {
  328. that.setIntervalTime(end_time);
  329. }, 1000)
  330. },
  331. // 时间格式化输出,如11:03 25:19 每1s都会调用一次
  332. dateformat(micro_second) {
  333. // 总秒数
  334. var second = Math.floor(micro_second / 1000);
  335. // 天数
  336. var day = Math.floor(second / 3600 / 24) < 10 ? "0" + Math.floor(second / 3600 / 24) : Math.floor(second / 3600 / 24);
  337. // 小时
  338. var hr = Math.floor(second / 3600 % 24) < 10 ? "0" + Math.floor(second / 3600 % 24) : Math.floor(second / 3600 % 24);
  339. // 分钟
  340. var min = Math.floor(second / 60 % 60) < 10 ? "0" + Math.floor(second / 60 % 60) : Math.floor(second / 60 % 60);
  341. // 秒
  342. var sec = Math.floor(second % 60) < 10 ? "0" + Math.floor(second % 60) : Math.floor(second % 60);
  343. // return day + "天" + hr + "小时" + min + "分钟" + sec + "秒";
  344. return {
  345. a1: day,
  346. b1: hr,
  347. c1: min,
  348. d1: sec
  349. }
  350. },
  351. /**
  352. * 获取用户信息
  353. */
  354. onLoad(options) {
  355. let that = this;
  356. wx.showLoading({
  357. title: "加载中..."
  358. });
  359. that.getDetail(options.couponChannelId,'notendclock');
  360. /**
  361. * 转赠判断
  362. */
  363. if (options.cuserId) {
  364. this.setData({
  365. showCardOffer: true,
  366. cardData: options
  367. })
  368. this.getUserInfo()
  369. }
  370. that.setData({
  371. couponChannelId: options.couponChannelId,
  372. title: that.data.data.title ? that.data.data.title : '',
  373. });
  374. if (options.cardType) {
  375. that.setData({
  376. cardType: options.cardType
  377. })
  378. }
  379. },
  380. getDetail: function (couponChannelId, flag) {
  381. let that = this;
  382. var parmer = {
  383. url: config.api.couponDetail,
  384. data: {
  385. couponChannelId: couponChannelId
  386. }
  387. };
  388. Http.get(parmer)
  389. .then(res => {
  390. that.setData({
  391. couponId: res.data.couponId
  392. })
  393. if (res.code == 200) {
  394. that.setData({
  395. showPage: true
  396. })
  397. }
  398. if (res.data.type == 100) {
  399. wx.setNavigationBarTitle({
  400. title: "卡详情"
  401. })
  402. }
  403. var EndTime = res.data.validStartDate;
  404. var NowTime = new Date().getTime();
  405. if (EndTime - NowTime > 0) {
  406. that.setData({
  407. showbutton1: true
  408. })
  409. }
  410. console.log(flag);
  411. if (res.data.endTime && res.data.beginTime) {
  412. //activityStatus==0 活动未开始
  413. //activityStatus==1 活动已开始
  414. // flag == endclock 说明倒计时已经结束
  415. if (res.data.activityStatus == 0 && flag != 'endclock') {
  416. that.countdown(res.data.beginTime);
  417. } else if (res.data.activityStatus != 0 && flag != 'endclock'){
  418. that.countdown(res.data.endTime);
  419. }else{
  420. clearInterval(that.data.setInterval)
  421. }
  422. if (res.data.activityStatus == 0) {
  423. var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss");
  424. if (util.timechuo(beginTime).indexOf('-') == 0) {
  425. that.setData({
  426. beginTime: "活动已结束",
  427. });
  428. } else {
  429. that.setData({
  430. beginTime: util.timechuo(beginTime)
  431. });
  432. }
  433. } else {
  434. var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss");
  435. if (util.timechuo(endTime).indexOf('-') == 0) {
  436. that.setData({
  437. endtime: "活动已结束",
  438. });
  439. } else {
  440. that.setData({
  441. endtime: util.timechuo(endTime)
  442. });
  443. }
  444. }
  445. }
  446. wx.hideLoading();
  447. that.setData({
  448. data: res.data
  449. });
  450. if (that.data.data.merchantVoList && that.data.data.merchantVoList.length <= 4) {
  451. that.setData({
  452. height: that.data.data.merchantVoList.length * 140 + 'rpx',
  453. showMore: false
  454. })
  455. } else if (that.data.data.merchantVoList && that.data.data.merchantVoList.length > 4) {
  456. that.setData({
  457. height: 4 * 140 + 'rpx'
  458. })
  459. }
  460. if (res.data.validType == 1) {
  461. that.setData({
  462. validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"),
  463. validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"),
  464. });
  465. } else {
  466. if (res.data.validDays) {
  467. that.setData({
  468. validDays: res.data.validDays
  469. });
  470. }
  471. }
  472. }).catch(err => {
  473. wx.showToast({
  474. title: err.message,
  475. icon: 'none',
  476. duration: 2000,
  477. mask: false
  478. });
  479. })
  480. },
  481. /**
  482. * 邀请好友继续砍价
  483. */
  484. inviteFriend: function() {
  485. let that = this;
  486. that.orderFunc("discount");
  487. that.setData({
  488. showbutton1: true
  489. })
  490. },
  491. /**
  492. * 支付订单更新
  493. */
  494. payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => {
  495. let that = this;
  496. // 支付成功
  497. Http.post({
  498. url: config.api.payOrderUpdate,
  499. data: {
  500. payOrderId: payOrderId,
  501. orderId: orderId,
  502. status: status,
  503. reason: reason
  504. }
  505. })
  506. .then(res => {
  507. wx.hideLoading()
  508. // 有价券
  509. if (!type && type != 'free') {
  510. wx.navigateTo({
  511. url: `/pages/order/detail/index?orderId=${
  512. orderId
  513. }&cardIf=true`
  514. });
  515. } else if (type == 'free') {
  516. wx.navigateTo({
  517. url: `/pages/order/detail/index?orderId=${
  518. orderId
  519. }`
  520. });
  521. }
  522. })
  523. .catch(err => {
  524. console.log(err);
  525. if (!type) {
  526. setTimeout(function() {
  527. _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this);
  528. }, 2000)
  529. }
  530. })
  531. },
  532. checkPhoneStatus: function() {
  533. let that = this;
  534. Http.post({
  535. url: config.api.checkPhoneStatus,
  536. data: {}
  537. })
  538. .then(res => {
  539. console.log(666, '授权成功!')
  540. that.receiveCard()
  541. })
  542. .catch(err => {
  543. if (err.code == 11005) {
  544. // 用户手机未授权
  545. /**
  546. * 将值传到用户手机号授权的页面
  547. *
  548. */
  549. wx.redirectTo({
  550. url: "/pages/getphoneInfo/index?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate,
  551. });
  552. } else if (err.code == 11006) {
  553. // 用户手机已加密
  554. wx.redirectTo({
  555. url: "/pages/phoneinput/phoneinput?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate,
  556. });
  557. } else {
  558. wx.showToast({
  559. title: err.message,
  560. icon: 'none',
  561. duration: 2000,
  562. mask: false
  563. });
  564. }
  565. })
  566. },
  567. /**
  568. * 发起支付
  569. */
  570. orderFunc(discount) {
  571. console.log(discount)
  572. var that = this;
  573. Http.post({
  574. url: config.api.checkPhoneStatus,
  575. data: {}
  576. })
  577. .then(res => {
  578. if (discount == 'discount') {
  579. var data = {
  580. couponChannelId: "" + that.data.couponChannelId,
  581. couponId: "" + that.data.couponId,
  582. press: true
  583. }
  584. } else if (discount == 'discount1') {
  585. var data = {
  586. couponChannelId: "" + that.data.couponChannelId,
  587. couponId: "" + that.data.couponId,
  588. press: false
  589. }
  590. } else if (that.data.couponChannelId == null) {
  591. var data = {
  592. couponId: "" + that.data.couponId
  593. };
  594. } else {
  595. var data = {
  596. couponChannelId: "" + that.data.couponChannelId,
  597. couponId: "" + that.data.couponId,
  598. }
  599. }
  600. /**
  601. * orderSave 下单
  602. */
  603. return Http.post({
  604. url: config.api.orderSave,
  605. data: data
  606. });
  607. })
  608. .catch(err => {
  609. console.log(err);
  610. that.setData({
  611. showbutton: false,
  612. showbutton1: false
  613. })
  614. if (err.code == 2011) {
  615. wx.showToast({
  616. title: "商户信息没找到",
  617. image: './../../../assets/images/fail.png',
  618. duration: 2000,
  619. mask: false
  620. });
  621. } else if (err.code == 2013) {
  622. wx.showToast({
  623. title: "商户信息禁用",
  624. image: './../../../assets/images/fail.png',
  625. duration: 2000,
  626. mask: false
  627. });
  628. } else if (err.code == 3000) {
  629. wx.showToast({
  630. title: "库存不足",
  631. image: './../../../assets/images/fail.png',
  632. duration: 2000,
  633. mask: false
  634. });
  635. } else if (err.code == 3001) {
  636. wx.showToast({
  637. title: "超过限购条件",
  638. image: './../../../assets/images/fail.png',
  639. duration: 2000,
  640. mask: false
  641. });
  642. } else if (err.code == 3002) {
  643. wx.showToast({
  644. title: "订单失败",
  645. image: './../../../assets/images/fail.png',
  646. duration: 2000,
  647. mask: false
  648. });
  649. } else if (err.code == 3003) {
  650. wx.showToast({
  651. title: "订单不存在",
  652. image: './../../../assets/images/fail.png',
  653. duration: 2000,
  654. mask: false
  655. });
  656. } else if (err.code == 3004) {
  657. wx.showToast({
  658. title: "订单不存在",
  659. image: './../../../assets/images/fail.png',
  660. duration: 2000,
  661. mask: false
  662. });
  663. } else if (err.code == 4003) {
  664. wx.showToast({
  665. title: "卡券已作废",
  666. image: './../../../assets/images/fail.png',
  667. duration: 2000,
  668. mask: false
  669. });
  670. } else if (err.code == 11005) {
  671. /**
  672. * 将值传到用户手机号授权的页面
  673. *
  674. */
  675. wx.redirectTo({
  676. url: "/pages/getphoneInfo/index?couponChannelId=" +
  677. that.data.couponChannelId
  678. });
  679. } else if (err.code == 11006) {
  680. // 用户手机已加密
  681. wx.redirectTo({
  682. url: "/pages/phoneinput/phoneinput?couponChannelId=" +
  683. that.data.couponChannelId
  684. });
  685. } else {
  686. wx.showToast({
  687. title: err.message,
  688. icon: 'none',
  689. duration: 2000,
  690. mask: false
  691. });
  692. }
  693. })
  694. .then(res => {
  695. console.log(res)
  696. if (discount != 'discount') {
  697. if (typeof(res) != "undefined") {
  698. let orderId = "" + res.data.id;
  699. that.setData({
  700. orderId: orderId
  701. });
  702. if (res.data.payment > 0) {
  703. // 支付金额不为0
  704. /**
  705. * 支付订单创建
  706. */
  707. Http.post({
  708. url: config.api.payOrderCreate,
  709. data: {
  710. orderId: orderId
  711. }
  712. })
  713. .then(res => {
  714. var payOrderId = "" + res.data.payOrderId;
  715. wx.hideLoading();
  716. wx.requestPayment({
  717. timeStamp: res.data.timeStamp,
  718. nonceStr: res.data.nonceStr,
  719. package: res.data.package,
  720. signType: (res.data.signType) ? res.data.signType : "MD5",
  721. paySign: res.data.paySign,
  722. success: res => {
  723. wx.showLoading({
  724. title: '订单正在处理中...',
  725. })
  726. setTimeout(function() {
  727. wx.hideLoading()
  728. }, 5000)
  729. that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
  730. if (res.errMsg == "requestPayment:ok") {
  731. setTimeout(function() {
  732. wx.hideLoading();
  733. }, 2000);
  734. /**
  735. * 用户支付成功以后跳转到券包列表
  736. */
  737. if (that.data.cardType == 100) {
  738. wx.setStorage({
  739. key: 'couponNum2',
  740. data: "couponNum2"
  741. })
  742. } else if (that.data.data.type != 5) {
  743. wx.setStorage({
  744. key: 'couponNum',
  745. data: "couponNum"
  746. })
  747. }
  748. }
  749. },
  750. fail: res => {
  751. /**
  752. * 支付失败,需要更新订单的状态
  753. */
  754. that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
  755. that.setData({
  756. showbutton: false
  757. })
  758. return;
  759. },
  760. complete: res => {}
  761. });
  762. /// End payment --------
  763. })
  764. .catch(err => {
  765. wx.showToast({
  766. title: err.message,
  767. icon: 'none',
  768. duration: 2000,
  769. mask: false
  770. });
  771. })
  772. } else {
  773. console.log(that.data.type)
  774. // 免费券
  775. that.payOrderUpdate(orderId, "0", 1, '', 'free');
  776. if (that.data.cardType == 100) {
  777. wx.setStorage({
  778. key: 'couponNum2',
  779. data: "couponNum2"
  780. })
  781. } else if (that.data.data.type != "5") {
  782. wx.setStorage({
  783. key: 'couponNum',
  784. data: "couponNum"
  785. })
  786. }
  787. }
  788. }
  789. } else {
  790. if (res) {
  791. wx.navigateTo({
  792. url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.id}`,
  793. })
  794. }
  795. }
  796. })
  797. },
  798. onShow() {
  799. this.setData({
  800. showbutton: false,
  801. showbutton1:false
  802. })
  803. },
  804. onUnload:function(){
  805. let that = this;
  806. clearInterval(that.data.setInterval)
  807. },
  808. onShareAppMessage: function(options) {
  809. var that = this;
  810. var shareObj = {
  811. title: that.data.data.title,
  812. path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`,
  813. success: function(res) {
  814. if (res.errMsg == 'shareAppMessage:ok') {}
  815. },
  816. fail: function(error) {
  817. if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {}
  818. }
  819. };
  820. // 来自页面内的按钮的转发
  821. if (options.from == 'button') {
  822. var eData = options.target.dataset.id;
  823. shareObj.path = `/pages/index/index?couponChannelId=${eData}`;
  824. }
  825. // 返回shareObj
  826. return shareObj;
  827. },
  828. // 下拉刷新
  829. onPullDownRefresh: function() {
  830. this.getDetail(this.data.couponChannelId);
  831. wx.stopPullDownRefresh()
  832. }
  833. });