C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

834 lines
22 KiB

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