C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ConsumeDetail.js 6.9 KiB

6 vuotta sitten
6 vuotta sitten
6 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
6 vuotta sitten
2 vuotta sitten
6 vuotta sitten
2 vuotta sitten
6 vuotta sitten
2 vuotta sitten
6 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
1 vuosi sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
6 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
2 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px';
  2. var config = require("../../config/config.js");
  3. var app = getApp();
  4. const Http = require("../../utils/HttpBasics");
  5. const util = require("../../utils/util");
  6. const imgurl = require("../../utils/imgurl");
  7. Page({
  8. data: {
  9. navigationBarHeight,
  10. fenxiangUrl: imgurl.fenxiang.url,
  11. clockUrl: imgurl.clock.url,
  12. teljpgUrl: imgurl.teljpg.url,
  13. closedUrl: imgurl.closed.url,
  14. quesGouUrl: imgurl.ques_gou.url,
  15. headbgUrl: imgurl.headbg.url,
  16. quesBgUrl: imgurl.ques_bg.url,
  17. dingdanUrl: imgurl.dingdan.url,
  18. weixinTitle: imgurl.weixinTitle.url,
  19. home: imgurl.home.url,
  20. cardDetail: null,
  21. data: {
  22. title: null
  23. },
  24. showPage: false,
  25. questions1: null,
  26. questions2: null,
  27. carList: [],
  28. couponChannelId: null,
  29. couponId: null,
  30. orderId: "",
  31. hour: null,
  32. minute: "",
  33. tempFilePaths: null,
  34. userInfo: {},
  35. hasUserInfo: false,
  36. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  37. id: null,
  38. result: [],
  39. end_time: null,
  40. checked: false,
  41. clock: "已经截止",
  42. questionnaire: {},
  43. questionId: null,
  44. widthScreen: null,
  45. moveData: null,
  46. rotateData: null,
  47. alphaData: null,
  48. scaleData: null,
  49. skewData: null,
  50. matrixData: null,
  51. opacity: 0,
  52. queueData: null,
  53. zIndex: 11,
  54. display: "none",
  55. showbutton: false,
  56. hidden: "hidden",
  57. height: "",
  58. more: "点击查看更多",
  59. showMore: true,
  60. supportTransfer: 1,
  61. showIndexReuturn: false,
  62. pageNum: 1
  63. },
  64. phone: function (e) {
  65. let that = this;
  66. wx.makePhoneCall({
  67. phoneNumber: e.target.dataset.merchantlinkphone
  68. });
  69. },
  70. /**
  71. * 跳转到门店列表的详情页面
  72. */
  73. gotoDetail(e) {
  74. if (e.currentTarget.dataset.id == undefined) {
  75. return
  76. }
  77. wx.navigateTo({
  78. url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}`
  79. })
  80. },
  81. gotoIndex() {
  82. wx.navigateTo({
  83. url: '/pages/index/index',
  84. })
  85. },
  86. goToTranser() {
  87. this.onShareAppMessage();
  88. // wx.navigateTo({
  89. // url: '/pages/index/index?couponChannelId=316424281708658688&cuserId=316369316574887936&couponId=316424281708658688&coverImg=https://iformall-net.s3.cn-northwest-1.amazonaws.com.cn/456/90d50e2d-547c-43e1-a801-2f6e15f622d2.jpg&userName=轻泉漪溪&avatarUrl=https://wx.qlogo.cn/mmopen/vi_32/oibIKqnzXT21eZJdjKVKY91A36FqLbD3ibEFc2oxIC4iahLniccDQKVu1Tgp4kJupxRZjtEpW0ravJ9QW1HuncGVjA/132&couponOrderId=316424688259530752&updateDate=1564553135000',
  90. // })
  91. },
  92. onShareAppMessage: function (res) {
  93. let _this = this;
  94. console.log(_this.data, '_this');
  95. app.globalData.previewFlag = true
  96. if (res.from === 'button') {
  97. console.log(this.data.cardDetail)
  98. // 来自页面内转发按钮
  99. return {
  100. title: _this.data.userName + '赠送您一张' + _this.data.cardDetail.title,
  101. imageUrl: _this.data.cardDetail.coverImg,
  102. path: `/pages/index/index?couponChannelId=${_this.data.cardDetail.couponChannelId}&avatarUrl=${_this.data.cardDetail.avatarUrl}&cuserId=${_this.data.cardDetail.ownerId}&userName=${_this.data.userName}&couponId=${_this.data.cardDetail.couponId}&couponOrderId=${_this.data.cardDetail.id}&updateDate=${_this.data.cardDetail.updateDate}&coverImg=${_this.data.cardDetail.coverImg}&tenantId=${_this.data.cardDetail.tenantId}`,
  103. success: function (res) {
  104. // 转发成功
  105. },
  106. fail: function (res) {
  107. // 转发失败
  108. }
  109. }
  110. } else {
  111. console.log(res, 444444444444444444)
  112. }
  113. },
  114. // 点击查看更多
  115. more: function () {
  116. let that = this;
  117. if (that.data.more == '点击查看更多') {
  118. this.setData({
  119. hidden: "",
  120. height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx',
  121. more: "点击收起",
  122. showMore: true
  123. })
  124. }
  125. else {
  126. this.setData({
  127. hidden: "hidden",
  128. height: 4 * 140 + 'rpx',
  129. more: "点击查看更多",
  130. showMore: true
  131. })
  132. }
  133. },
  134. onLoad(options) {
  135. let that = this;
  136. if (options.cardId) {
  137. that.cardpayList(options.cardId);
  138. that.cardDetail(options.cardId);
  139. }
  140. if (options.from) {
  141. this.setData({
  142. showIndexReuturn: true
  143. })
  144. }
  145. wx.hideShareMenu()
  146. },
  147. cardpayList: function (cardId) {
  148. let that = this;
  149. wx.showLoading({
  150. title: "加载中..."
  151. });
  152. var parmer = {
  153. url: config.api.cardpayList,
  154. data: {
  155. cardId: cardId,
  156. pageNum: 1,
  157. pageSize: 500
  158. }
  159. };
  160. Http.get(parmer)
  161. .then(res => {
  162. console.log(res);
  163. if (res.code == 200 && res.data.list && res.data.list.length > 0) {
  164. wx.hideLoading();
  165. res.data.list.map(item => {
  166. item.updateDate = util.formatTime(item.updateDate, "yyyy-MM-dd hh:mm:ss")
  167. item.createDate = util.formatTime(item.createDate, "yyyy-MM-dd hh:mm:ss")
  168. })
  169. that.setData({
  170. showPage: true,
  171. data: res.data.list
  172. })
  173. } else {
  174. wx.hideLoading();
  175. }
  176. }).catch(err => {
  177. console.log(err, 'err');
  178. wx.showToast({
  179. title: err.message,
  180. icon: 'none',
  181. duration: 2000,
  182. mask: false
  183. });
  184. })
  185. },
  186. getUserInfo: function () {
  187. let that = this;
  188. // 获取用户信息
  189. Http.get({
  190. url: config.api.getScore,
  191. data: {}
  192. })
  193. .then(res => {
  194. console.log(res)
  195. that.setData({
  196. userName: res.data.nickName,
  197. avatarUrl: res.data.avatarUrl
  198. })
  199. })
  200. },
  201. cardDetail: function (couponOrderId) {
  202. let that = this;
  203. Http.get({
  204. url: config.api.cardDetail,
  205. data: {
  206. couponOrderId: couponOrderId
  207. }
  208. })
  209. .then(res => {
  210. console.log(res)
  211. if (res.code == 200) {
  212. res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss")
  213. that.setData({
  214. showPage: true,
  215. cardDetail: res.data,
  216. supportTransfer: res.data.supportTransfer
  217. })
  218. /**
  219. * 若可转赠获取用户头像信息
  220. */
  221. if (res.data.supportTransfer) {
  222. that.getUserInfo()
  223. }
  224. if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length <= 4) {
  225. that.setData({
  226. height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx',
  227. showMore: false
  228. })
  229. } else if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length > 4) {
  230. that.setData({
  231. height: 4 * 140 + 'rpx'
  232. })
  233. }
  234. }
  235. })
  236. .catch(err => {
  237. console.log(err)
  238. })
  239. },
  240. onShow() {
  241. let that = this;
  242. that.setData({
  243. showbutton: false
  244. })
  245. },
  246. onReachBottom() {
  247. },
  248. });