awaitStateFromList.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // pages/awaitState/awaitState.js
  2. var app = getApp()
  3. Page({
  4. data: {
  5. src : '',
  6. msg : '',
  7. url : '',
  8. name : '',
  9. order_number : '',
  10. order_userid :'',
  11. sendUserId : '',
  12. recHidden : false,
  13. sendHidden: false,
  14. time : '',
  15. uploadImg : []
  16. },
  17. onLoad: function (options) {
  18. var that = this;
  19. this.setData({
  20. src: options.src,
  21. msg: options.msg,
  22. url : options.url,
  23. name : options.name,
  24. order_number: options.order_number,
  25. order_userid: options.order_userid,
  26. time: options.time,
  27. uploadImg: JSON.parse(options.list)
  28. })
  29. console.log(options.list);
  30. var host = getApp().globalData.servsers;
  31. var un_id = getApp().globalData.un_id;
  32. if (un_id != undefined && un_id != '' && un_id != null){
  33. wx.request({
  34. url: host + "forunionidapi/select",
  35. data: {
  36. user_id: un_id
  37. },
  38. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  39. header: {
  40. 'Accept': 'application/json'
  41. },
  42. success: function (res) {
  43. if (that.data.order_userid != res.data.unionid) {//当前浏览的用户为收礼物者
  44. that.setData({
  45. recHidden: true,
  46. sendHidden: false
  47. })
  48. } else {
  49. that.setData({
  50. sendHidden: true,
  51. recHidden: false
  52. })
  53. }
  54. that.setData({
  55. receiveUserId: res.code
  56. })
  57. if (res == null || res.data == null) {
  58. console.error('网络请求失败');
  59. return;
  60. }
  61. }
  62. });
  63. }
  64. },
  65. selectWuliu : function(){
  66. var that = this;
  67. wx.navigateTo({
  68. url: '/pages/wuliu/wuliu?id=' + that.data.order_number,
  69. success: function(res) {},
  70. fail: function(res) {},
  71. complete: function(res) {},
  72. })
  73. },
  74. wantSent : function(e){
  75. wx.switchTab({
  76. url: '/pages/index/index'
  77. })
  78. },
  79. previewImg: function (e) {//banner图预览
  80. var that = this;
  81. var currentUrl = e.currentTarget.dataset.src;
  82. wx.previewImage({
  83. current: currentUrl,
  84. urls: that.data.uploadImg.imgList
  85. })
  86. }
  87. })