C端小程序
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

136 行
3.1 KiB

  1. var config = require("../../config/config.js");
  2. var app = getApp();
  3. const Http = require("../../utils/HttpBasics");
  4. const util = require("../../utils/util");
  5. const imgurl = require("../../utils/imgurl");
  6. Page({
  7. data: {
  8. fenxiangUrl: imgurl.fenxiang.url,
  9. clockUrl: imgurl.clock.url,
  10. teljpgUrl: imgurl.teljpg.url,
  11. closedUrl: imgurl.closed.url,
  12. quesGouUrl: imgurl.ques_gou.url,
  13. headbgUrl: imgurl.headbg.url,
  14. quesBgUrl: imgurl.ques_bg.url,
  15. cardDetail:null,
  16. data: {
  17. title: null
  18. },
  19. showPage: false,
  20. questions1: null,
  21. questions2: null,
  22. carList: [],
  23. couponChannelId: null,
  24. couponId: null,
  25. orderId: "",
  26. hour: null,
  27. minute: "",
  28. tempFilePaths: null,
  29. userInfo: {},
  30. hasUserInfo: false,
  31. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  32. id: null,
  33. result: [],
  34. end_time: null,
  35. checked: false,
  36. clock: "已经截止",
  37. questionnaire: {},
  38. questionId: null,
  39. widthScreen: null,
  40. moveData: null,
  41. rotateData: null,
  42. alphaData: null,
  43. scaleData: null,
  44. skewData: null,
  45. matrixData: null,
  46. opacity: 0,
  47. queueData: null,
  48. zIndex: 11,
  49. display: "none",
  50. showbutton: false
  51. },
  52. phone: function (e) {
  53. let that = this;
  54. wx.makePhoneCall({
  55. phoneNumber: e.target.dataset.merchantlinkphone
  56. });
  57. },
  58. onLoad(options) {
  59. let that = this;
  60. console.log(options.cardId)
  61. that.cardpayList(options.cardId);
  62. that.cardDetail(options.cardId);
  63. },
  64. cardpayList: function (cardId) {
  65. let that = this;
  66. wx.showLoading({
  67. title: "加载中..."
  68. });
  69. var parmer = {
  70. url: config.api.cardpayList,
  71. data: {
  72. cardId: cardId,
  73. pageNum: 1,
  74. pageSize: 100
  75. }
  76. };
  77. Http.get(parmer)
  78. .then(res => {
  79. console.log(res);
  80. if (res.code == 200 && res.data.list.length > 0) {
  81. that.setData({
  82. showPage: true
  83. })
  84. } else {
  85. wx.showModal({
  86. title: '抱歉',
  87. content: '暂无消费记录',
  88. showCancel: false,
  89. success: function (res) {
  90. }
  91. })
  92. }
  93. wx.hideLoading();
  94. res.data.list.map(file => {
  95. file.updateDate = util.formatTime(file.updateDate, "yyyy-MM-dd hh:mm:ss")
  96. })
  97. that.setData({
  98. data: res.data.list
  99. });
  100. }).catch(err => {
  101. wx.showToast({
  102. title: err.message,
  103. icon: 'none',
  104. duration: 2000,
  105. mask: false
  106. });
  107. })
  108. },
  109. cardDetail: function (couponOrderId) {
  110. let that = this;
  111. Http.get({
  112. url: config.api.cardDetail,
  113. data: {
  114. couponOrderId: couponOrderId
  115. }
  116. })
  117. .then(res => {
  118. console.log(res)
  119. if (res.code == 200) {
  120. res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss")
  121. that.setData({
  122. showPage: true,
  123. cardDetail:res.data
  124. })
  125. }
  126. })
  127. .catch(err => {
  128. console.log(err)
  129. })
  130. },
  131. onShow() {
  132. this.setData({
  133. showbutton: false
  134. })
  135. },
  136. });