fcxx.js 4.4 KB

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