fcxx.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. const Parser = require('../xml/xmldom/dom-parser');
  2. var app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. type:'',
  9. table:[]
  10. },
  11. /**
  12. * 生命周期函数--监听页面显示
  13. */
  14. onShow: function () {
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (optitons) {
  20. wx.showToast({
  21. title: '加载中',
  22. icon: 'loading',
  23. duration: 1000
  24. })
  25. var that = this;
  26. var method='Getfdc_pm_owner';
  27. var wsdlurl=app.webUrl;
  28. var targetNamespace='http://tempuri.org/';
  29. var datacopy= '<?xml version="1.0" encoding="utf-8"?>';
  30. datacopy += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
  31. datacopy += '<soap:Header><MySoapHeader xmlns="http://tempuri.org/">';
  32. datacopy += `<UserName>${app.UserName}</UserName>`;
  33. datacopy += `<PassWord>${app.PassWord}</PassWord>`;
  34. datacopy += '</MySoapHeader></soap:Header>';
  35. datacopy += '<soap:Body>';
  36. datacopy += '<Getfdc_pm_owner xmlns="http://tempuri.org/">';
  37. datacopy += `<weixinid>${optitons.openid}</weixinid>`;
  38.    datacopy += `<ownerid>${optitons.phone}</ownerid>`;
  39.     datacopy += '</Getfdc_pm_owner >';
  40.     datacopy += '</soap:Body>';
  41.     datacopy += '</soap:Envelope>';
  42. wx.request({
  43. url: wsdlurl,
  44. data: datacopy,
  45. method: 'POST',
  46. header: {
  47. 'Content-Type':'text/xml; charset=utf-8',
  48. 'SOAPAction':targetNamespace+method,
  49. },
  50. success:function(res){
  51. var XMLParser = new Parser.DOMParser();
  52. var doc = XMLParser.parseFromString(res.data);
  53. var Getfdc_pm_ownerResult = JSON.parse(doc.getElementsByTagName("Getfdc_pm_ownerResult")[0].firstChild.nodeValue)
  54. var talone = [];
  55. var itemone = {
  56. id:0,
  57. pname:'',
  58. house:[]
  59. }
  60. // 判断当前客户只有一套房产直接跳转报事界面
  61. // if(Getfdc_pm_ownerResult.Table.length==1){
  62. // wx.navigateTo({
  63. // url: `../baoxiu/baoxiu?ownerid=${Getfdc_pm_ownerResult.Table[0].ownerid}&hname=${Getfdc_pm_ownerResult.Table[0].hname}&tel=${Getfdc_pm_ownerResult.Table[0].tel}&hcode=${Getfdc_pm_ownerResult.Table[0].hcode}&ownername=${Getfdc_pm_ownerResult.Table[0].ownername}`,
  64. // })
  65. // }
  66. for (let index = 0; index < Getfdc_pm_ownerResult.Table.length; index++) {
  67. if(itemone.pname!=Getfdc_pm_ownerResult.Table[index].pname){
  68. itemone.id = Getfdc_pm_ownerResult.Table[index].ownerid;
  69. itemone.pname = Getfdc_pm_ownerResult.Table[index].pname;
  70. for (let l = 0; l < Getfdc_pm_ownerResult.Table.length; l++) {
  71. var a = {
  72. hname:Getfdc_pm_ownerResult.Table[l].hname,
  73. ownerid: Getfdc_pm_ownerResult.Table[l].ownerid,
  74. hcode: Getfdc_pm_ownerResult.Table[l].hcode,
  75. ownername:Getfdc_pm_ownerResult.Table[l].ownername,
  76. tel: Getfdc_pm_ownerResult.Table[l].tel,
  77. }
  78. itemone.house.push(a);
  79. }
  80. talone.push(itemone);
  81. }
  82. }
  83. if(optitons.type==undefined){
  84. that.setData({
  85. table:talone
  86. })
  87. }
  88. else{
  89. that.setData({
  90. table:talone,
  91. type:optitons.type
  92. })
  93. }
  94. }
  95. })
  96. },
  97. texturlBX:function(e){
  98. // 判断是否从【我要报修】页面还是从【房产信息】页面跳转而来
  99. if(this.data.type==1){
  100. wx.navigateTo({
  101. url: `../baoxiu/baoxiu?ownerid=${e.target.dataset.ownerid}&hname=${e.target.dataset.hname}&tel=${e.target.dataset.tel}&hcode=${e.target.dataset.hcode}&ownername=${e.target.dataset.ownername}`,
  102. })
  103. }
  104. },
  105. })