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.

81 rinda
2.0 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  2. const util = require("../../../utils/util");
  3. const config = require("../../../config/config.js");
  4. const Http = require("../../../utils/HttpBasics");
  5. //券详情页面
  6. Page({
  7. data: {
  8. navigationBarHeight,
  9. data: {},
  10. createDate: "",
  11. expiredTime: "",
  12. updateDate: "",
  13. //存储计时器
  14. setInter: "",
  15. showPage:false,
  16. curHtml:"",
  17. },
  18. onUnload: function () {
  19. let that = this;
  20. clearInterval(that.data.setInter);
  21. },
  22. onHide: function () {
  23. let that = this;
  24. clearInterval(that.data.setInter);
  25. },
  26. onLoad: function (options) {
  27. let that = this;
  28. console.log(options.quancode)
  29. this.getHtml(options.quancode)
  30. Http.get({
  31. url: config.api.couponOrderDetail,
  32. data: {
  33. couponOrderId: options.quancode
  34. }
  35. }).then(res => {
  36. that.setData({
  37. data: res.data,
  38. showPage:true
  39. });
  40. that.setData({
  41. expiredTime: util.fmtDate(that.data.data.expiredTime),
  42. updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"),
  43. createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss")
  44. });
  45. // util.barcode("barcode", options.quancode, 510, 100);
  46. util.qrcode("qrcode", options.quancode, 350, 350);
  47. })
  48. .catch(err => {
  49. wx.showToast({
  50. title: err.errMsg,
  51. icon: 'none',
  52. duration: 2000,
  53. mask: false
  54. });
  55. })
  56. },
  57. getHtml(couponChannelId) {
  58. Http.get({
  59. url: config.api.couponHtmlDetailForPkg,
  60. data: {
  61. // couponChannelId: '433119630735183872'
  62. couponOrderId: couponChannelId
  63. }
  64. }).then(res => {
  65. if (res.code == 200 && res.data.html) {
  66. this.setData({
  67. curHtml: decodeURI(res.data.html)
  68. })
  69. }
  70. })
  71. },
  72. phone: function () {
  73. let that = this;
  74. if (that.data.data.merchantLinkPhone) {
  75. wx.makePhoneCall({
  76. phoneNumber: that.data.data.merchantLinkPhone
  77. });
  78. }
  79. }
  80. });