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.

85 lines
2.1 KiB

  1. const util = require("../../../utils/util");
  2. const config = require("../../../config/config.js");
  3. const Http = require("../../../utils/HttpBasics");
  4. //券详情页面
  5. Page({
  6. data: {
  7. code: "",
  8. data: {},
  9. createDate: "",
  10. expiredTime: "",
  11. updateDate: "",
  12. //存储计时器
  13. setInter: ""
  14. },
  15. onUnload: function() {
  16. let that = this;
  17. clearInterval(that.data.setInter);
  18. },
  19. onLoad: function(options) {
  20. console.log(options);
  21. let that = this;
  22. that.setData({
  23. code: options.quancode
  24. });
  25. //获得优惠券的详情
  26. that.data.setInter = setInterval(function() {
  27. if (
  28. options.quancode != null &&
  29. options.quancode != "" &&
  30. options.quancode != undefined &&
  31. options.couponorderstatus == 0
  32. ) {
  33. Http.get({
  34. url: config.api.couponOrderDetail,
  35. data: {
  36. couponOrderId: options.quancode
  37. }
  38. }).then(res => {
  39. console.log(res);
  40. that.setData({
  41. data: res.data
  42. });
  43. that.setData({
  44. expiredTime: util.fmtDate(that.data.data.expiredTime),
  45. updateDate: util.fmtDate(that.data.data.updateDate),
  46. createDate: util.fmtDate(that.data.data.createDate)
  47. });
  48. });
  49. }
  50. }, 2000);
  51. // if (options.couponorderstatus != "0") {
  52. Http.get({
  53. url: config.api.couponOrderDetail,
  54. data: {
  55. couponOrderId: options.quancode
  56. }
  57. }).then(res => {
  58. console.log(res);
  59. that.setData({
  60. data: res.data
  61. });
  62. that.setData({
  63. expiredTime: util.fmtDate(that.data.data.expiredTime),
  64. updateDate: util.fmtDate(that.data.data.updateDate),
  65. createDate: util.fmtDate(that.data.data.createDate)
  66. });
  67. util.barcode("barcode", options.quancode, 510, 100);
  68. util.qrcode("qrcode", options.quancode, 350, 350);
  69. });
  70. // }
  71. },
  72. phone: function() {
  73. let that = this;
  74. console.log(that.data);
  75. if (that.data.data.merchantLinkPhone) {
  76. wx.makePhoneCall({
  77. phoneNumber: that.data.data.merchantLinkPhone
  78. });
  79. }
  80. }
  81. });