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.

66 lines
1.5 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. showPage:false
  15. },
  16. onUnload: function () {
  17. let that = this;
  18. clearInterval(that.data.setInter);
  19. },
  20. onHide: function () {
  21. let that = this;
  22. clearInterval(that.data.setInter);
  23. },
  24. onLoad: function (options) {
  25. let that = this;
  26. that.setData({
  27. code: options.quancode
  28. });
  29. Http.get({
  30. url: config.api.couponOrderDetail,
  31. data: {
  32. couponOrderId: options.quancode
  33. }
  34. }).then(res => {
  35. that.setData({
  36. data: res.data,
  37. showPage:true
  38. });
  39. that.setData({
  40. expiredTime: util.fmtDate(that.data.data.expiredTime),
  41. updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"),
  42. createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss")
  43. });
  44. // util.barcode("barcode", options.quancode, 510, 100);
  45. util.qrcode("qrcode", options.quancode, 350, 350);
  46. })
  47. .catch(err => {
  48. wx.showToast({
  49. title: err.errMsg,
  50. icon: 'none',
  51. duration: 2000,
  52. mask: false
  53. });
  54. })
  55. },
  56. phone: function () {
  57. let that = this;
  58. if (that.data.data.merchantLinkPhone) {
  59. wx.makePhoneCall({
  60. phoneNumber: that.data.data.merchantLinkPhone
  61. });
  62. }
  63. }
  64. });