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. }
  74. // else {
  75. // this.setData({
  76. // hidden: "",
  77. // height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx',
  78. // more: "点击查看更多",
  79. // showMore: false
  80. // })
  81. // }
  82. },
  83. onLoad(options) {
  84. let that = this;
  85. console.log(options.cardId)
  86. that.cardpayList(options.cardId);
  87. that.cardDetail(options.cardId);
  88. },
  89. cardpayList: function(cardId) {
  90. let that = this;
  91. wx.showLoading({
  92. title: "加载中..."
  93. });
  94. var parmer = {
  95. url: config.api.cardpayList,
  96. data: {
  97. cardId: cardId,
  98. pageNum: 1,
  99. pageSize: 100
  100. }
  101. };
  102. Http.get(parmer)
  103. .then(res => {
  104. console.log(res);
  105. if (res.code == 200 && res.data.list.length > 0) {
  106. that.setData({
  107. showPage: true
  108. })
  109. } else {}
  110. wx.hideLoading();
  111. res.data.list.map(file => {
  112. file.updateDate = util.formatTime(file.updateDate, "yyyy-MM-dd hh:mm:ss")
  113. })
  114. that.setData({
  115. data: res.data.list
  116. });
  117. }).catch(err => {
  118. wx.showToast({
  119. title: err.message,
  120. icon: 'none',
  121. duration: 2000,
  122. mask: false
  123. });
  124. })
  125. },
  126. cardDetail: function(couponOrderId) {
  127. let that = this;
  128. Http.get({
  129. url: config.api.cardDetail,
  130. data: {
  131. couponOrderId: couponOrderId
  132. }
  133. })
  134. .then(res => {
  135. console.log(res)
  136. if (res.code == 200) {
  137. res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss")
  138. that.setData({
  139. showPage: true,
  140. cardDetail: res.data
  141. })
  142. if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length<=4){
  143. that.setData({
  144. height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx'
  145. })
  146. } else if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length >= 4){
  147. that.setData({
  148. height: 4 * 140 + 'rpx'
  149. })
  150. }
  151. }
  152. })
  153. .catch(err => {
  154. console.log(err)
  155. })
  156. },
  157. onShow() {
  158. let that = this;
  159. that.setData({
  160. showbutton: false
  161. })
  162. },
  163. });