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.

844 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. if (total_micro_second > 0) {
  302. that.setData({
  303. clock: obj,
  304. day: obj.a1,
  305. hour: obj.b1,
  306. min: obj.c1,
  307. sec: obj.d1,
  308. })
  309. } else {
  310. that.setData({
  311. clock: "00",
  312. day: "00",
  313. hour: "00",
  314. min: "00",
  315. sec: "00",
  316. })
  317. //如果倒计时结束,需要重新查询一下券的状态
  318. // 给getDetail一个标识
  319. that.getDetail(that.data.couponChannelId,'endclock');
  320. }
  321. total_micro_second -= 1000;
  322. },
  323. countdown: function(end_time) {
  324. let that = this;
  325. that.setIntervalTime(end_time);
  326. that.data.setInterval = setInterval(function() {
  327. that.setIntervalTime(end_time);
  328. }, 1000)
  329. },
  330. // 时间格式化输出,如11:03 25:19 每1s都会调用一次
  331. dateformat(micro_second) {
  332. // 总秒数
  333. var second = Math.floor(micro_second / 1000);
  334. // 天数
  335. var day = Math.floor(second / 3600 / 24) < 10 ? "0" + Math.floor(second / 3600 / 24) : Math.floor(second / 3600 / 24);
  336. // 小时
  337. var hr = Math.floor(second / 3600 % 24) < 10 ? "0" + Math.floor(second / 3600 % 24) : Math.floor(second / 3600 % 24);
  338. // 分钟
  339. var min = Math.floor(second / 60 % 60) < 10 ? "0" + Math.floor(second / 60 % 60) : Math.floor(second / 60 % 60);
  340. // 秒
  341. var sec = Math.floor(second % 60) < 10 ? "0" + Math.floor(second % 60) : Math.floor(second % 60);
  342. // return day + "天" + hr + "小时" + min + "分钟" + sec + "秒";
  343. return {
  344. a1: day,
  345. b1: hr,
  346. c1: min,
  347. d1: sec
  348. }
  349. },
  350. /**
  351. * 获取用户信息
  352. */
  353. onLoad(options) {
  354. let that = this;
  355. wx.showLoading({
  356. title: "加载中..."
  357. });
  358. that.setData({
  359. onshow:false
  360. })
  361. that.getDetail(options.couponChannelId,'notendclock');
  362. /**
  363. * 转赠判断
  364. */
  365. if (options.cuserId) {
  366. this.setData({
  367. showCardOffer: true,
  368. cardData: options
  369. })
  370. this.getUserInfo()
  371. }
  372. that.setData({
  373. couponChannelId: options.couponChannelId,
  374. title: that.data.data.title ? that.data.data.title : '',
  375. });
  376. if (options.cardType) {
  377. that.setData({
  378. cardType: options.cardType
  379. })
  380. }
  381. },
  382. getDetail: function (couponChannelId, flag) {
  383. let that = this;
  384. var parmer = {
  385. url: config.api.couponDetail,
  386. data: {
  387. couponChannelId: couponChannelId
  388. }
  389. };
  390. Http.get(parmer)
  391. .then(res => {
  392. that.setData({
  393. couponId: res.data.couponId
  394. })
  395. if (res.code == 200) {
  396. that.setData({
  397. showPage: true
  398. })
  399. }
  400. if (res.data.type == 100) {
  401. wx.setNavigationBarTitle({
  402. title: "卡详情"
  403. })
  404. }
  405. var EndTime = res.data.validStartDate;
  406. var NowTime = new Date().getTime();
  407. console.log(flag);
  408. if (res.data.endTime && res.data.beginTime) {
  409. that.setData({
  410. begin_time: res.data.beginTime,
  411. end_time: res.data.endTime,
  412. })
  413. //activityStatus==0 活动未开始
  414. //activityStatus==1 活动已开始
  415. // flag == endclock 说明倒计时已经结束
  416. if (res.data.activityStatus == 0 && flag != 'endclock') {
  417. that.countdown(res.data.beginTime);
  418. } else if (res.data.activityStatus != 0 && flag != 'endclock'){
  419. that.countdown(res.data.endTime);
  420. }else{
  421. clearInterval(that.data.setInterval)
  422. }
  423. if (res.data.activityStatus == 0) {
  424. var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss");
  425. if (util.timechuo(beginTime).indexOf('-') == 0) {
  426. that.setData({
  427. beginTime: "活动已结束",
  428. });
  429. } else {
  430. that.setData({
  431. beginTime: util.timechuo(beginTime)
  432. });
  433. }
  434. } else {
  435. var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss");
  436. if (util.timechuo(endTime).indexOf('-') == 0) {
  437. that.setData({
  438. endtime: "活动已结束",
  439. });
  440. } else {
  441. that.setData({
  442. endtime: util.timechuo(endTime)
  443. });
  444. }
  445. }
  446. }
  447. wx.hideLoading();
  448. that.setData({
  449. data: res.data
  450. });
  451. if (that.data.data.merchantVoList && that.data.data.merchantVoList.length <= 4) {
  452. that.setData({
  453. height: that.data.data.merchantVoList.length * 140 + 'rpx',
  454. showMore: false
  455. })
  456. } else if (that.data.data.merchantVoList && that.data.data.merchantVoList.length > 4) {
  457. that.setData({
  458. height: 4 * 140 + 'rpx'
  459. })
  460. }
  461. if (res.data.validType == 1) {
  462. that.setData({
  463. validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"),
  464. validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"),
  465. });
  466. } else {
  467. if (res.data.validDays) {
  468. that.setData({
  469. validDays: res.data.validDays
  470. });
  471. }
  472. }
  473. }).catch(err => {
  474. wx.showToast({
  475. title: err.message,
  476. icon: 'none',
  477. duration: 2000,
  478. mask: false
  479. });
  480. })
  481. },
  482. /**
  483. * 邀请好友继续砍价
  484. */
  485. inviteFriend: function() {
  486. let that = this;
  487. that.orderFunc("discount");
  488. that.setData({
  489. showbutton1: true
  490. })
  491. },
  492. /**
  493. * 支付订单更新
  494. */
  495. payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => {
  496. let that = this;
  497. // 支付成功
  498. Http.post({
  499. url: config.api.payOrderUpdate,
  500. data: {
  501. payOrderId: payOrderId,
  502. orderId: orderId,
  503. status: status,
  504. reason: reason
  505. }
  506. })
  507. .then(res => {
  508. wx.hideLoading()
  509. // 有价券
  510. if (!type && type != 'free') {
  511. wx.navigateTo({
  512. url: `/pages/order/detail/index?orderId=${
  513. orderId
  514. }&cardIf=true`
  515. });
  516. } else if (type == 'free') {
  517. wx.navigateTo({
  518. url: `/pages/order/detail/index?orderId=${
  519. orderId
  520. }`
  521. });
  522. }
  523. })
  524. .catch(err => {
  525. console.log(err);
  526. if (!type) {
  527. setTimeout(function() {
  528. _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this);
  529. }, 2000)
  530. }
  531. })
  532. },
  533. checkPhoneStatus: function() {
  534. let that = this;
  535. Http.get({
  536. url: config.api.checkPhoneStatus,
  537. data: {}
  538. })
  539. .then(res => {
  540. console.log(666, '授权成功!')
  541. that.receiveCard()
  542. })
  543. .catch(err => {
  544. if (err.code == 11005) {
  545. // 用户手机未授权
  546. /**
  547. * 将值传到用户手机号授权的页面
  548. *
  549. */
  550. wx.redirectTo({
  551. 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,
  552. });
  553. } else if (err.code == 11006) {
  554. // 用户手机已加密
  555. wx.redirectTo({
  556. 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,
  557. });
  558. } else {
  559. wx.showToast({
  560. title: err.message,
  561. icon: 'none',
  562. duration: 2000,
  563. mask: false
  564. });
  565. }
  566. })
  567. },
  568. /**
  569. * 发起支付
  570. */
  571. orderFunc(discount) {
  572. console.log(discount)
  573. var that = this;
  574. Http.get({
  575. url: config.api.checkPhoneStatus,
  576. data: {}
  577. })
  578. .then(res => {
  579. if (discount == 'discount') {
  580. var data = {
  581. couponChannelId: "" + that.data.couponChannelId,
  582. couponId: "" + that.data.couponId,
  583. press: true
  584. }
  585. } else if (discount == 'discount1') {
  586. var data = {
  587. couponChannelId: "" + that.data.couponChannelId,
  588. couponId: "" + that.data.couponId,
  589. press: false
  590. }
  591. } else if (that.data.couponChannelId == null) {
  592. var data = {
  593. couponId: "" + that.data.couponId
  594. };
  595. } else {
  596. var data = {
  597. couponChannelId: "" + that.data.couponChannelId,
  598. couponId: "" + that.data.couponId,
  599. }
  600. }
  601. /**
  602. * orderSave 下单
  603. */
  604. return Http.post({
  605. url: config.api.orderSave,
  606. data: data
  607. });
  608. })
  609. .catch(err => {
  610. console.log(err);
  611. that.setData({
  612. showbutton: false,
  613. showbutton1: false
  614. })
  615. if (err.code == 2011) {
  616. wx.showToast({
  617. title: "商户信息没找到",
  618. image: './../../../assets/images/fail.png',
  619. duration: 2000,
  620. mask: false
  621. });
  622. } else if (err.code == 2013) {
  623. wx.showToast({
  624. title: "商户信息禁用",
  625. image: './../../../assets/images/fail.png',
  626. duration: 2000,
  627. mask: false
  628. });
  629. } else if (err.code == 3000) {
  630. wx.showToast({
  631. title: "库存不足",
  632. image: './../../../assets/images/fail.png',
  633. duration: 2000,
  634. mask: false
  635. });
  636. } else if (err.code == 3001) {
  637. wx.showToast({
  638. title: "超过限购条件",
  639. image: './../../../assets/images/fail.png',
  640. duration: 2000,
  641. mask: false
  642. });
  643. } else if (err.code == 3002) {
  644. wx.showToast({
  645. title: "订单失败",
  646. image: './../../../assets/images/fail.png',
  647. duration: 2000,
  648. mask: false
  649. });
  650. } else if (err.code == 3003) {
  651. wx.showToast({
  652. title: "订单不存在",
  653. image: './../../../assets/images/fail.png',
  654. duration: 2000,
  655. mask: false
  656. });
  657. } else if (err.code == 3004) {
  658. wx.showToast({
  659. title: "订单不存在",
  660. image: './../../../assets/images/fail.png',
  661. duration: 2000,
  662. mask: false
  663. });
  664. } else if (err.code == 4003) {
  665. wx.showToast({
  666. title: "卡券已作废",
  667. image: './../../../assets/images/fail.png',
  668. duration: 2000,
  669. mask: false
  670. });
  671. } else if (err.code == 11005) {
  672. /**
  673. * 将值传到用户手机号授权的页面
  674. *
  675. */
  676. wx.redirectTo({
  677. url: "/pages/getphoneInfo/index?couponChannelId=" +
  678. that.data.couponChannelId
  679. });
  680. } else if (err.code == 11006) {
  681. // 用户手机已加密
  682. wx.redirectTo({
  683. url: "/pages/phoneinput/phoneinput?couponChannelId=" +
  684. that.data.couponChannelId
  685. });
  686. } else {
  687. wx.showToast({
  688. title: err.message,
  689. icon: 'none',
  690. duration: 2000,
  691. mask: false
  692. });
  693. }
  694. })
  695. .then(res => {
  696. console.log(res)
  697. if (discount != 'discount') {
  698. if (typeof(res) != "undefined") {
  699. let orderId = "" + res.data.id;
  700. that.setData({
  701. orderId: orderId
  702. });
  703. if (res.data.payment > 0) {
  704. // 支付金额不为0
  705. /**
  706. * 支付订单创建
  707. */
  708. Http.post({
  709. url: config.api.payOrderCreate,
  710. data: {
  711. orderId: orderId
  712. }
  713. })
  714. .then(res => {
  715. var payOrderId = "" + res.data.payOrderId;
  716. wx.hideLoading();
  717. wx.requestPayment({
  718. timeStamp: res.data.timeStamp,
  719. nonceStr: res.data.nonceStr,
  720. package: res.data.package,
  721. signType: (res.data.signType) ? res.data.signType : "MD5",
  722. paySign: res.data.paySign,
  723. success: res => {
  724. wx.showLoading({
  725. title: '订单正在处理中...',
  726. })
  727. setTimeout(function() {
  728. wx.hideLoading()
  729. }, 5000)
  730. that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
  731. if (res.errMsg == "requestPayment:ok") {
  732. setTimeout(function() {
  733. wx.hideLoading();
  734. }, 2000);
  735. /**
  736. * 用户支付成功以后跳转到券包列表
  737. */
  738. if (that.data.cardType == 100) {
  739. wx.setStorage({
  740. key: 'couponNum2',
  741. data: "couponNum2"
  742. })
  743. } else if (that.data.data.type != 5) {
  744. wx.setStorage({
  745. key: 'couponNum',
  746. data: "couponNum"
  747. })
  748. }
  749. }
  750. },
  751. fail: res => {
  752. /**
  753. * 支付失败,需要更新订单的状态
  754. */
  755. that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
  756. that.setData({
  757. showbutton: false
  758. })
  759. return;
  760. },
  761. complete: res => {}
  762. });
  763. /// End payment --------
  764. })
  765. .catch(err => {
  766. wx.showToast({
  767. title: err.message,
  768. icon: 'none',
  769. duration: 2000,
  770. mask: false
  771. });
  772. })
  773. } else {
  774. console.log(that.data.type)
  775. // 免费券
  776. that.payOrderUpdate(orderId, "0", 1, '', 'free');
  777. if (that.data.cardType == 100) {
  778. wx.setStorage({
  779. key: 'couponNum2',
  780. data: "couponNum2"
  781. })
  782. } else if (that.data.data.type != "5") {
  783. wx.setStorage({
  784. key: 'couponNum',
  785. data: "couponNum"
  786. })
  787. }
  788. }
  789. }
  790. } else {
  791. if (res) {
  792. wx.navigateTo({
  793. url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.id}`,
  794. })
  795. }
  796. }
  797. })
  798. },
  799. onShow() {
  800. this.setData({
  801. showbutton: false,
  802. showbutton1:false
  803. })
  804. if(this.data.end_time){
  805. this.countdown(this.data.end_time)
  806. }
  807. },
  808. onUnload:function(){
  809. let that = this;
  810. clearInterval(that.data.setInterval)
  811. },
  812. onHide: function () {
  813. let that = this;
  814. clearInterval(that.data.setInterval)
  815. },
  816. onShareAppMessage: function(options) {
  817. var that = this;
  818. var shareObj = {
  819. title: that.data.data.title,
  820. path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`,
  821. success: function(res) {
  822. if (res.errMsg == 'shareAppMessage:ok') {}
  823. },
  824. fail: function(error) {
  825. if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {}
  826. }
  827. };
  828. // 来自页面内的按钮的转发
  829. if (options.from == 'button') {
  830. var eData = options.target.dataset.id;
  831. shareObj.path = `/pages/index/index?couponChannelId=${eData}`;
  832. }
  833. // 返回shareObj
  834. return shareObj;
  835. },
  836. // 下拉刷新
  837. onPullDownRefresh: function() {
  838. this.getDetail(this.data.couponChannelId);
  839. wx.stopPullDownRefresh()
  840. }
  841. });