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.

113 Zeilen
2.0 KiB

  1. // pages/spellGroup/mySpellGroup/index.js
  2. var config = require("../../../config/config.js");
  3. const Http = require("../../../utils/HttpBasics");
  4. const imgurl = require("../../../utils/imgurl");
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. couponChannelId:'',
  11. couponId:'',
  12. detailData:[],
  13. spellData:null
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad: function (options) {
  19. this.setData({
  20. couponChannelId: options.couponChannelId,
  21. couponId: options.couponId
  22. })
  23. this.getDetail(options.couponChannelId);
  24. this.getOneSpell(options.couponId)
  25. },
  26. /**
  27. * 获取一个拼团信息
  28. */
  29. getOneSpell(couponId){
  30. let that = this;
  31. Http.get({
  32. url: config.api.queryRemainOne,
  33. data: {
  34. couponId: couponId
  35. }
  36. }).then(res => {
  37. if(res.data){
  38. that.setData({
  39. spellData: res.data
  40. });
  41. }
  42. });
  43. },
  44. /**
  45. * 获取券详情信息
  46. */
  47. getDetail(couponChannelId){
  48. let that = this;
  49. Http.get({
  50. url: config.api.couponDetail,
  51. data: {
  52. couponChannelId: couponChannelId
  53. }
  54. }).then(res => {
  55. let data = res.data;
  56. data.price = (data.price / 100).toFixed(2)
  57. data.salePrice = (data.salePrice / 100).toFixed(2)
  58. that.setData({
  59. detailData: data
  60. });
  61. });
  62. },
  63. /**
  64. * 生命周期函数--监听页面初次渲染完成
  65. */
  66. onReady: function () {
  67. },
  68. /**
  69. * 生命周期函数--监听页面显示
  70. */
  71. onShow: function () {
  72. },
  73. /**
  74. * 生命周期函数--监听页面隐藏
  75. */
  76. onHide: function () {
  77. },
  78. /**
  79. * 生命周期函数--监听页面卸载
  80. */
  81. onUnload: function () {
  82. },
  83. /**
  84. * 页面相关事件处理函数--监听用户下拉动作
  85. */
  86. onPullDownRefresh: function () {
  87. },
  88. /**
  89. * 页面上拉触底事件的处理函数
  90. */
  91. onReachBottom: function () {
  92. },
  93. /**
  94. * 用户点击右上角分享
  95. */
  96. onShareAppMessage: function () {
  97. }
  98. })