C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

163 行
3.9 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. dingdanUrl: imgurl.dingdan.url,
  16. cardDetail: null,
  17. data: {
  18. title: null
  19. },
  20. showPage: false,
  21. questions1: null,
  22. questions2: null,
  23. carList: [],
  24. couponChannelId: null,
  25. couponId: null,
  26. orderId: "",
  27. hour: null,
  28. minute: "",
  29. tempFilePaths: null,
  30. userInfo: {},
  31. hasUserInfo: false,
  32. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  33. id: null,
  34. result: [],
  35. end_time: null,
  36. checked: false,
  37. clock: "已经截止",
  38. questionnaire: {},
  39. questionId: null,
  40. widthScreen: null,
  41. moveData: null,
  42. rotateData: null,
  43. alphaData: null,
  44. scaleData: null,
  45. skewData: null,
  46. matrixData: null,
  47. opacity: 0,
  48. queueData: null,
  49. zIndex: 11,
  50. display: "none",
  51. showbutton: false,
  52. hidden: "hidden",
  53. height: "auto",
  54. more: "点击查看更多",
  55. showMore: true
  56. },
  57. phone: function(e) {
  58. let that = this;
  59. wx.makePhoneCall({
  60. phoneNumber: e.target.dataset.merchantlinkphone
  61. });
  62. },
  63. // 点击查看更多
  64. more: function() {
  65. let that = this;
  66. if (that.data.height == 'auto') {
  67. this.setData({
  68. hidden: "hidden",
  69. height: "auto",
  70. more: "点击查看更多",
  71. showMore: true
  72. })
  73. } else {
  74. this.setData({
  75. hidden: "",
  76. height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx',
  77. more: "",
  78. showMore: false
  79. })
  80. }
  81. },
  82. onLoad(options) {
  83. let that = this;
  84. console.log(options.cardId)
  85. that.cardpayList(options.cardId);
  86. that.cardDetail(options.cardId);
  87. },
  88. cardpayList: function(cardId) {
  89. let that = this;
  90. wx.showLoading({
  91. title: "加载中..."
  92. });
  93. var parmer = {
  94. url: config.api.cardpayList,
  95. data: {
  96. cardId: cardId,
  97. pageNum: 1,
  98. pageSize: 100
  99. }
  100. };
  101. Http.get(parmer)
  102. .then(res => {
  103. console.log(res);
  104. if (res.code == 200 && res.data.list.length > 0) {
  105. that.setData({
  106. showPage: true
  107. })
  108. } else {}
  109. wx.hideLoading();
  110. res.data.list.map(file => {
  111. file.updateDate = util.formatTime(file.updateDate, "yyyy-MM-dd hh:mm:ss")
  112. })
  113. that.setData({
  114. data: res.data.list
  115. });
  116. }).catch(err => {
  117. wx.showToast({
  118. title: err.message,
  119. icon: 'none',
  120. duration: 2000,
  121. mask: false
  122. });
  123. })
  124. },
  125. cardDetail: function(couponOrderId) {
  126. let that = this;
  127. Http.get({
  128. url: config.api.cardDetail,
  129. data: {
  130. couponOrderId: couponOrderId
  131. }
  132. })
  133. .then(res => {
  134. console.log(res)
  135. if (res.code == 200) {
  136. res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss")
  137. that.setData({
  138. showPage: true,
  139. cardDetail: res.data
  140. })
  141. if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length<=4){
  142. that.setData({
  143. height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx'
  144. })
  145. } else if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length >= 4){
  146. that.setData({
  147. height: 4 * 140 + 'rpx'
  148. })
  149. }
  150. }
  151. })
  152. .catch(err => {
  153. console.log(err)
  154. })
  155. },
  156. onShow() {
  157. let that = this;
  158. that.setData({
  159. showbutton: false
  160. })
  161. },
  162. });