paycustom.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. var app = getApp();
  4. Page({
  5. data: {
  6. DayNumber: 365,
  7. Price: 199,
  8. SearchUserID: "",
  9. Remark: ""
  10. },
  11. onLoad: function (options) {
  12. var that = this;
  13. that.setData({
  14. Containnerheight: main.getWindowHeight(),
  15. ShareDisabled:true,
  16. });
  17. },
  18. onKeyInput: function (e) {
  19. var value = e.detail.value;
  20. var inputType = e.currentTarget.dataset.type;
  21. var that = this;
  22. that.data[inputType] = value;
  23. if (!that.data.SearchUserID || !that.data.DayNumber || !that.data.Price || !that.data.Remark){
  24. that.data["ShareDisabled"] = true;
  25. }
  26. else
  27. that.data["ShareDisabled"] = false;
  28. that.setData(that.data);
  29. },
  30. getUserInfo: function (e) {
  31. var that = this;
  32. if (!that.data.SearchUserID) {
  33. that.showToast('输入用户ID');
  34. }
  35. else {
  36. main.getData("GetMiaoguoWXUserInfo?FieldStr=UserID,NickName,NickNameRemark,AvatarUrl &GetWechatUserID=1&UserID=" + that.data.SearchUserID, function (data) {
  37. if (data) {
  38. that.setData({
  39. UserInfo: data,
  40. })
  41. }
  42. else {
  43. that.showToast('无效用户ID');
  44. }
  45. });
  46. }
  47. },
  48. showToast: function (str) {
  49. wx.showToast({
  50. title: str,
  51. image: "../images/universalpic_wrong_white_120x120.png",
  52. });
  53. },
  54. onShareAppMessage: function () {
  55. var that = this;
  56. var path = '/pages/index/index?type=paycustom&PayUserID=' + that.data.SearchUserID;
  57. path += "&DayNumber=" + that.data.DayNumber;
  58. path += "&Price=" + that.data.Price;
  59. path += "&Remark=" + that.data.Remark;
  60. var time = common.formatTime(new Date());
  61. console.log(path);
  62. return {
  63. title: "点开续费 "+time,
  64. path: path,
  65. imageUrl: app.globalData.uploadImageUrl + "web/program_screenshot_custompayment.png",
  66. };
  67. },
  68. })