giftinfo.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. List: [],
  7. },
  8. onLoad: function (options) {
  9. this.setData({
  10. Containnerheight: common.getSystemHeight(),
  11. ProgramList: server.getProgramList(),
  12. ProgramID:app.globalData.ProgramID,
  13. canGive:false,
  14. });
  15. this.init(options.id);
  16. },
  17. init: function (id) {
  18. var that = this;
  19. var url = "GetGiftInfoByUserID500?ID=" + id + "&ProductID=" + app.globalData.ProgramID;
  20. server.getData(url, function (data) {
  21. if (data) {
  22. that.setData({
  23. GiftInfo: data,
  24. });
  25. }
  26. });
  27. },
  28. gotoFeedback: function () {
  29. server.gotoFeedback();
  30. },
  31. getRemind:function(){
  32. var that=this;
  33. wx.getSetting({
  34. success(res) {
  35. if (!res.authSetting['scope.userInfo']) {
  36. wx.navigateTo({
  37. url: '../../pages/index/userlogin?url=giftinfo'
  38. });
  39. }
  40. else {
  41. wx.showModal({
  42. title: '慎重转发',
  43. content: '请勿转发到群。如误转,只能在聊天窗口中撤回(1分钟内)。',
  44. confirmText: '知道了',
  45. showCancel: false,
  46. });
  47. that.setData({
  48. canGive: true,
  49. });
  50. }
  51. }
  52. });
  53. },
  54. onShareAppMessage: function () {
  55. if (this.data.GiftInfo.PayType == 5 && this.data.GiftInfo.ExchangeUserID>0){
  56. return {
  57. title: app.globalData.ShareTitle,
  58. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  59. imageUrl: app.globalData.ShareImage,
  60. }
  61. }
  62. else{
  63. return {
  64. title: "有价商品尽快领取",
  65. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID + '&GiftID=' + this.data.GiftInfo.ID,
  66. imageUrl: '../images/program_screenshot_giftcard.png',
  67. }
  68. }
  69. },
  70. })