C端小程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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