C端小程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

64 řádky
1.6 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. if (
  27. options.quancode != null &&
  28. (options.quancode != "" && options.quancode) != undefined
  29. ) {
  30. that.data.setInter = setInterval(function(){
  31. Http.get({
  32. url: config.api.couponOrderDetail,
  33. data: {
  34. couponOrderId: options.quancode
  35. }
  36. }).then(res => {
  37. console.log(res);
  38. that.setData({
  39. data: res.data
  40. });
  41. that.setData({
  42. expiredTime: util.fmtDate(that.data.data.expiredTime),
  43. updateDate: util.fmtDate(that.data.data.updateDate),
  44. createDate: util.fmtDate(that.data.data.createDate)
  45. });
  46. });
  47. }, 200);
  48. }
  49. util.barcode("barcode", options.quancode, 510, 100);
  50. util.qrcode("qrcode", options.quancode, 350, 350);
  51. },
  52. phone: function() {
  53. let that = this;
  54. console.log(that.data);
  55. if (that.data.data.merchantLinkPhone) {
  56. wx.makePhoneCall({
  57. phoneNumber: that.data.data.merchantLinkPhone
  58. });
  59. }
  60. }
  61. });