myCustomer.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. // pages/my/myCustomer/myCustomer.js
  2. let App = getApp();
  3. let util = require("../../../utils/util.js");
  4. var WxParse = require("../../../wxParse/wxParse.js");
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. appAssetsUrl: App.appAssetsUrl,
  11. items: [],
  12. wgFillInfo: {},
  13. richtext: null,
  14. parm: {
  15. cardno: util.getCardNo(),
  16. fbtype: "",
  17. feedback: "",
  18. },
  19. },
  20. // radio
  21. radioChange (e) {
  22. this.data.parm.fbtype = e.currentTarget.dataset.item.itemcode;
  23. this.setData({
  24. parm: this.data.parm,
  25. });
  26. },
  27. /**
  28. * 生命周期函数--监听页面加载
  29. */
  30. onLoad: function (options) {
  31. this.loadDic();
  32. this.loadkfInfo();
  33. },
  34. loadkfInfo () {
  35. let _this = this;
  36. App._post_form(
  37. "wgfillinfo/apiSelectwgfillinfo",
  38. "application/json",
  39. null,
  40. function (res) {
  41. if (res.code === 0) {
  42. _this.setData({
  43. richtext: res.wgFillInfo.ccs.replace(
  44. /<img/g,
  45. `<img style=' max-width:100%;'`
  46. ),
  47. });
  48. WxParse.wxParse("article", "html", res.wgFillInfo.ccs, _this, 5);
  49. }
  50. }
  51. );
  52. },
  53. loadDic () {
  54. let _this = this;
  55. App._post_form(
  56. "bizcatelog/apiSelectBizcatelog/fbtype",
  57. "application/json",
  58. null,
  59. function (res) {
  60. if (res.code === 0) {
  61. _this.data.parm.fbtype = res.dictList[0].itemcode;
  62. _this.setData({
  63. items: res.dictList,
  64. });
  65. }
  66. }
  67. );
  68. },
  69. input (e) {
  70. if (e.detail.value) {
  71. this.data.parm.feedback = e.detail.value;
  72. }
  73. },
  74. sub () {
  75. let _this = this;
  76. if (util.UserLoginStatus()) {
  77. if (this.data.parm.feedback === "") {
  78. wx.showToast({
  79. title: "请输入您的想法",
  80. icon: "none",
  81. });
  82. return;
  83. }
  84. App._post_form(
  85. "WgMemberFb/apiInsertWgMemberFb",
  86. "application/json",
  87. JSON.stringify(_this.data.parm),
  88. function (res) {
  89. if (res.code === 0) {
  90. wx.showToast({
  91. title: "提交成功!",
  92. duration: 1500,
  93. });
  94. setTimeout(function () {
  95. wx.switchTab({
  96. url: "/pages/my/index/index",
  97. });
  98. }, 1500);
  99. }
  100. }
  101. );
  102. }
  103. },
  104. /**
  105. * 生命周期函数--监听页面初次渲染完成
  106. */
  107. onReady: function () { },
  108. /**
  109. * 生命周期函数--监听页面显示
  110. */
  111. onShow: function () { },
  112. /**
  113. * 生命周期函数--监听页面隐藏
  114. */
  115. onHide: function () { },
  116. /**
  117. * 生命周期函数--监听页面卸载
  118. */
  119. onUnload: function () { },
  120. /**
  121. * 页面相关事件处理函数--监听用户下拉动作
  122. */
  123. onPullDownRefresh: function () { },
  124. /**
  125. * 页面上拉触底事件的处理函数
  126. */
  127. onReachBottom: function () { },
  128. /**
  129. * 用户点击右上角分享
  130. */
  131. onShareAppMessage: function () { },
  132. });