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.

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