C端小程序
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

848 rindas
24 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. if (EndTime - NowTime > 0) {
  408. that.setData({
  409. showbutton1: true
  410. })
  411. }
  412. console.log(flag);
  413. if (res.data.endTime && res.data.beginTime) {
  414. that.setData({
  415. begin_time: res.data.beginTime,
  416. end_time: res.data.endTime,
  417. })
  418. //activityStatus==0 活动未开始
  419. //activityStatus==1 活动已开始
  420. // flag == endclock 说明倒计时已经结束
  421. if (res.data.activityStatus == 0 && flag != 'endclock') {
  422. that.countdown(res.data.beginTime);
  423. } else if (res.data.activityStatus != 0 && flag != 'endclock'){
  424. that.countdown(res.data.endTime);
  425. }else{
  426. clearInterval(that.data.setInterval)
  427. }
  428. if (res.data.activityStatus == 0) {
  429. var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss");
  430. if (util.timechuo(beginTime).indexOf('-') == 0) {
  431. that.setData({
  432. beginTime: "活动已结束",
  433. });
  434. } else {
  435. that.setData({
  436. beginTime: util.timechuo(beginTime)
  437. });
  438. }
  439. } else {
  440. var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss");
  441. if (util.timechuo(endTime).indexOf('-') == 0) {
  442. that.setData({
  443. endtime: "活动已结束",
  444. });
  445. } else {
  446. that.setData({
  447. endtime: util.timechuo(endTime)
  448. });
  449. }
  450. }
  451. }
  452. wx.hideLoading();
  453. that.setData({
  454. data: res.data
  455. });
  456. if (that.data.data.merchantVoList && that.data.data.merchantVoList.length <= 4) {
  457. that.setData({
  458. height: that.data.data.merchantVoList.length * 140 + 'rpx',
  459. showMore: false
  460. })
  461. } else if (that.data.data.merchantVoList && that.data.data.merchantVoList.length > 4) {
  462. that.setData({
  463. height: 4 * 140 + 'rpx'
  464. })
  465. }
  466. if (res.data.validType == 1) {
  467. that.setData({
  468. validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"),
  469. validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"),
  470. });
  471. } else {
  472. if (res.data.validDays) {
  473. that.setData({
  474. validDays: res.data.validDays
  475. });
  476. }
  477. }
  478. }).catch(err => {
  479. wx.showToast({
  480. title: err.message,
  481. icon: 'none',
  482. duration: 2000,
  483. mask: false
  484. });
  485. })
  486. },
  487. /**
  488. * 邀请好友继续砍价
  489. */
  490. inviteFriend: function() {
  491. let that = this;
  492. that.orderFunc("discount");
  493. that.setData({
  494. showbutton1: true
  495. })
  496. },
  497. /**
  498. * 支付订单更新
  499. */
  500. payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => {
  501. let that = this;
  502. // 支付成功
  503. Http.post({
  504. url: config.api.payOrderUpdate,
  505. data: {
  506. payOrderId: payOrderId,
  507. orderId: orderId,
  508. status: status,
  509. reason: reason
  510. }
  511. })
  512. .then(res => {
  513. wx.hideLoading()
  514. // 有价券
  515. if (!type && type != 'free') {
  516. wx.navigateTo({
  517. url: `/pages/order/detail/index?orderId=${
  518. orderId
  519. }&cardIf=true`
  520. });
  521. } else if (type == 'free') {
  522. wx.navigateTo({
  523. url: `/pages/order/detail/index?orderId=${
  524. orderId
  525. }`
  526. });
  527. }
  528. })
  529. .catch(err => {
  530. console.log(err);
  531. if (!type) {
  532. setTimeout(function() {
  533. _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this);
  534. }, 2000)
  535. }
  536. })
  537. },
  538. checkPhoneStatus: function() {
  539. let that = this;
  540. Http.post({
  541. url: config.api.checkPhoneStatus,
  542. data: {}
  543. })
  544. .then(res => {
  545. console.log(666, '授权成功!')
  546. that.receiveCard()
  547. })
  548. .catch(err => {
  549. if (err.code == 11005) {
  550. // 用户手机未授权
  551. /**
  552. * 将值传到用户手机号授权的页面
  553. *
  554. */
  555. wx.redirectTo({
  556. 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,
  557. });
  558. } else if (err.code == 11006) {
  559. // 用户手机已加密
  560. wx.redirectTo({
  561. 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,
  562. });
  563. } else {
  564. wx.showToast({
  565. title: err.message,
  566. icon: 'none',
  567. duration: 2000,
  568. mask: false
  569. });
  570. }
  571. })
  572. },
  573. /**
  574. * 发起支付
  575. */
  576. orderFunc(discount) {
  577. console.log(discount)
  578. var that = this;
  579. Http.post({
  580. url: config.api.checkPhoneStatus,
  581. data: {}
  582. })
  583. .then(res => {
  584. if (discount == 'discount') {
  585. var data = {
  586. couponChannelId: "" + that.data.couponChannelId,
  587. couponId: "" + that.data.couponId,
  588. press: true
  589. }
  590. } else if (discount == 'discount1') {
  591. var data = {
  592. couponChannelId: "" + that.data.couponChannelId,
  593. couponId: "" + that.data.couponId,
  594. press: false
  595. }
  596. } else if (that.data.couponChannelId == null) {
  597. var data = {
  598. couponId: "" + that.data.couponId
  599. };
  600. } else {
  601. var data = {
  602. couponChannelId: "" + that.data.couponChannelId,
  603. couponId: "" + that.data.couponId,
  604. }
  605. }
  606. /**
  607. * orderSave 下单
  608. */
  609. return Http.post({
  610. url: config.api.orderSave,
  611. data: data
  612. });
  613. })
  614. .catch(err => {
  615. console.log(err);
  616. that.setData({
  617. showbutton: false,
  618. showbutton1: false
  619. })
  620. if (err.code == 2011) {
  621. wx.showToast({
  622. title: "商户信息没找到",
  623. image: './../../../assets/images/fail.png',
  624. duration: 2000,
  625. mask: false
  626. });
  627. } else if (err.code == 2013) {
  628. wx.showToast({
  629. title: "商户信息禁用",
  630. image: './../../../assets/images/fail.png',
  631. duration: 2000,
  632. mask: false
  633. });
  634. } else if (err.code == 3000) {
  635. wx.showToast({
  636. title: "库存不足",
  637. image: './../../../assets/images/fail.png',
  638. duration: 2000,
  639. mask: false
  640. });
  641. } else if (err.code == 3001) {
  642. wx.showToast({
  643. title: "超过限购条件",
  644. image: './../../../assets/images/fail.png',
  645. duration: 2000,
  646. mask: false
  647. });
  648. } else if (err.code == 3002) {
  649. wx.showToast({
  650. title: "订单失败",
  651. image: './../../../assets/images/fail.png',
  652. duration: 2000,
  653. mask: false
  654. });
  655. } else if (err.code == 3003) {
  656. wx.showToast({
  657. title: "订单不存在",
  658. image: './../../../assets/images/fail.png',
  659. duration: 2000,
  660. mask: false
  661. });
  662. } else if (err.code == 3004) {
  663. wx.showToast({
  664. title: "订单不存在",
  665. image: './../../../assets/images/fail.png',
  666. duration: 2000,
  667. mask: false
  668. });
  669. } else if (err.code == 4003) {
  670. wx.showToast({
  671. title: "卡券已作废",
  672. image: './../../../assets/images/fail.png',
  673. duration: 2000,
  674. mask: false
  675. });
  676. } else if (err.code == 11005) {
  677. /**
  678. * 将值传到用户手机号授权的页面
  679. *
  680. */
  681. wx.redirectTo({
  682. url: "/pages/getphoneInfo/index?couponChannelId=" +
  683. that.data.couponChannelId
  684. });
  685. } else if (err.code == 11006) {
  686. // 用户手机已加密
  687. wx.redirectTo({
  688. url: "/pages/phoneinput/phoneinput?couponChannelId=" +
  689. that.data.couponChannelId
  690. });
  691. } else {
  692. wx.showToast({
  693. title: err.message,
  694. icon: 'none',
  695. duration: 2000,
  696. mask: false
  697. });
  698. }
  699. })
  700. .then(res => {
  701. console.log(res)
  702. if (discount != 'discount') {
  703. if (typeof(res) != "undefined") {
  704. let orderId = "" + res.data.id;
  705. that.setData({
  706. orderId: orderId
  707. });
  708. if (res.data.payment > 0) {
  709. // 支付金额不为0
  710. /**
  711. * 支付订单创建
  712. */
  713. Http.post({
  714. url: config.api.payOrderCreate,
  715. data: {
  716. orderId: orderId
  717. }
  718. })
  719. .then(res => {
  720. var payOrderId = "" + res.data.payOrderId;
  721. wx.hideLoading();
  722. wx.requestPayment({
  723. timeStamp: res.data.timeStamp,
  724. nonceStr: res.data.nonceStr,
  725. package: res.data.package,
  726. signType: (res.data.signType) ? res.data.signType : "MD5",
  727. paySign: res.data.paySign,
  728. success: res => {
  729. wx.showLoading({
  730. title: '订单正在处理中...',
  731. })
  732. setTimeout(function() {
  733. wx.hideLoading()
  734. }, 5000)
  735. that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
  736. if (res.errMsg == "requestPayment:ok") {
  737. setTimeout(function() {
  738. wx.hideLoading();
  739. }, 2000);
  740. /**
  741. * 用户支付成功以后跳转到券包列表
  742. */
  743. if (that.data.cardType == 100) {
  744. wx.setStorage({
  745. key: 'couponNum2',
  746. data: "couponNum2"
  747. })
  748. } else if (that.data.data.type != 5) {
  749. wx.setStorage({
  750. key: 'couponNum',
  751. data: "couponNum"
  752. })
  753. }
  754. }
  755. },
  756. fail: res => {
  757. /**
  758. * 支付失败,需要更新订单的状态
  759. */
  760. that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
  761. that.setData({
  762. showbutton: false
  763. })
  764. return;
  765. },
  766. complete: res => {}
  767. });
  768. /// End payment --------
  769. })
  770. .catch(err => {
  771. wx.showToast({
  772. title: err.message,
  773. icon: 'none',
  774. duration: 2000,
  775. mask: false
  776. });
  777. })
  778. } else {
  779. console.log(that.data.type)
  780. // 免费券
  781. that.payOrderUpdate(orderId, "0", 1, '', 'free');
  782. if (that.data.cardType == 100) {
  783. wx.setStorage({
  784. key: 'couponNum2',
  785. data: "couponNum2"
  786. })
  787. } else if (that.data.data.type != "5") {
  788. wx.setStorage({
  789. key: 'couponNum',
  790. data: "couponNum"
  791. })
  792. }
  793. }
  794. }
  795. } else {
  796. if (res) {
  797. wx.navigateTo({
  798. url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.id}`,
  799. })
  800. }
  801. }
  802. })
  803. },
  804. onShow() {
  805. this.setData({
  806. showbutton: false,
  807. showbutton1:false
  808. })
  809. if(this.data.end_time){
  810. this.countdown(this.data.end_time)
  811. }
  812. },
  813. onUnload:function(){
  814. let that = this;
  815. clearInterval(that.data.setInterval)
  816. },
  817. onHide: function () {
  818. let that = this;
  819. clearInterval(that.data.setInterval)
  820. },
  821. onShareAppMessage: function(options) {
  822. var that = this;
  823. var shareObj = {
  824. title: that.data.data.title,
  825. path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`,
  826. success: function(res) {
  827. if (res.errMsg == 'shareAppMessage:ok') {}
  828. },
  829. fail: function(error) {
  830. if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {}
  831. }
  832. };
  833. // 来自页面内的按钮的转发
  834. if (options.from == 'button') {
  835. var eData = options.target.dataset.id;
  836. shareObj.path = `/pages/index/index?couponChannelId=${eData}`;
  837. }
  838. // 返回shareObj
  839. return shareObj;
  840. },
  841. // 下拉刷新
  842. onPullDownRefresh: function() {
  843. this.getDetail(this.data.couponChannelId);
  844. wx.stopPullDownRefresh()
  845. }
  846. });