C端小程序
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

131 Zeilen
3.2 KiB

  1. let config = require("../../../config/config.js");
  2. let util = require("../../../utils/util");
  3. let Http = require("../../../utils/HttpBasics");
  4. let app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. showModalStatus: false,
  11. flag: 0
  12. },
  13. /**
  14. * 点击弹出二维码
  15. * 然后再关闭
  16. */
  17. powerDrawer: function(e) {
  18. var currentStatu = e.currentTarget.dataset.statu;
  19. console.log(e.currentTarget.dataset.statu);
  20. console.log(e.currentTarget.dataset.quancode);
  21. this.utils(currentStatu, e.currentTarget.dataset.quancode);
  22. },
  23. utils: function(currentStatu, quancode) {
  24. /* 动画部分 */
  25. // 第1步:创建动画实例
  26. var animation = wx.createAnimation({
  27. duration: 200, //动画时长
  28. timingFunction: "linear", //线性
  29. delay: 0 //0则不延迟
  30. }); // 第2步:这个动画实例赋给当前的动画实例
  31. this.animation = animation; // 第3步:执行第一组动画
  32. animation.opacity(0).step(); // 第4步:导出动画对象赋给数据对象储存
  33. this.setData({
  34. animationData: animation.export()
  35. }); // 第5步:设置定时器到指定时候后,执行第二组动画
  36. setTimeout(
  37. function() {
  38. // 执行第二组动画
  39. animation.opacity(1).step(); // 给数据对象储存的第一组动画,更替为执行完第二组动画的动画对象
  40. this.setData({
  41. animationData: animation
  42. }); //关闭
  43. if (currentStatu == "close") {
  44. this.setData({
  45. showModalStatus: false
  46. });
  47. }
  48. }.bind(this),
  49. 20
  50. );
  51. // 显示
  52. if (currentStatu == "open") {
  53. this.setData({
  54. showModalStatus: true
  55. });
  56. this.data.flag++;
  57. console.log(this.data.flag);
  58. util.barcode("barcode" + this.data.flag, quancode, 500, 100);
  59. util.qrcode("qrcode" + this.data.flag, quancode, 350, 350);
  60. this.setData({
  61. flag: this.data.flag
  62. });
  63. }
  64. },
  65. /**
  66. * 生命周期函数--监听页面加载
  67. */
  68. onLoad: function(options) {
  69. let that = this;
  70. console.log(options.orderId);
  71. Http.get({
  72. url: config.api.orderDetail,
  73. data: {
  74. orderId: options.orderId
  75. }
  76. }).then(res => {
  77. console.log(res);
  78. console.log("我是订单详情");
  79. that.setData({
  80. data: res.data
  81. });
  82. //createDate 创建时间
  83. var createDate = util.fmtDate(res.data.createDate);
  84. console.log(createDate);
  85. that.setData({
  86. createDate:createDate,
  87. })
  88. });
  89. },
  90. /**
  91. * 生命周期函数--监听页面初次渲染完成
  92. */
  93. onReady: function() {},
  94. /**
  95. * 生命周期函数--监听页面显示
  96. */
  97. onShow: function(options) {},
  98. /**
  99. * 生命周期函数--监听页面隐藏
  100. */
  101. onHide: function() {},
  102. /**
  103. * 生命周期函数--监听页面卸载
  104. */
  105. onUnload: function() {},
  106. /**
  107. * 页面相关事件处理函数--监听用户下拉动作
  108. */
  109. onPullDownRefresh: function() {},
  110. /**
  111. * 页面上拉触底事件的处理函数
  112. */
  113. onReachBottom: function() {},
  114. /**
  115. * 用户点击右上角分享
  116. */
  117. onShareAppMessage: function() {}
  118. });