Sfoglia il codice sorgente

feature 投诉建议和用户报修

xiahan 4 mesi fa
parent
commit
18d5b5b4fb

+ 2 - 0
app.js

@@ -101,6 +101,8 @@ App({
       billList: baseIp+ '/wechat/bill/list', // 首页获取用水量等信息
       accountList: baseIp+ '/wechat/account/list', // 首页获取用水量等信息
       accountUnbind: baseIp+ '/wechat/account/unbind', // 户号解绑方法
+      repairRegistration: baseIp+  '/wechat/registration/repair',//报修登记
+      feedback: baseIp+  '/wechat/registration/feedback',//投诉建议
     },
     imgPreviewUrl: "http://192.168.0.215:9000/common/sys/sysfile/preview?fileId=",
     // 统一管理图片路径

+ 30 - 15
pages/baoxiudj/baoxiudj.js

@@ -1,6 +1,7 @@
+const app=getApp();
 Page({
   data: {
-    address: '安平镇安坪村安平小区12栋305室',
+    address: app.globalData.currentAccountInfo.address,
     contact: '',
     phone: '',
     repairType: '',
@@ -100,11 +101,11 @@ Page({
       success: function(res) {
         let tempFiles = res.tempFiles;
         let validFiles = [];
-        
+        debugger;
         for (let i = 0; i < tempFiles.length; i++) {
           const file = tempFiles[i];
           if (file.size <= 5 * 1024 * 1024) {
-            validFiles.push(file.tempFilePath);
+            validFiles.push(file);
           } else {
             wx.showToast({
               title: '图片大小不能超过5M',
@@ -182,7 +183,13 @@ Page({
       });
       return;
     }
-    
+    const fileManager = wx.getFileSystemManager();
+    this.data.imageList.map(imgInfo=>{
+      const base64 = fileManager.readFileSync(imgInfo.tempFilePath, 'base64');
+      imgInfo.base64=base64;
+      return imgInfo;
+    })
+  
     const submitData = {
       address: this.data.address,
       contact: this.data.contact,
@@ -197,20 +204,28 @@ Page({
     wx.showLoading({
       title: '提交中...',
     });
-    
-    setTimeout(() => {
-      wx.hideLoading();
-      wx.showToast({
-        icon: 'success',
-        duration: 2000,
-        success: function() {
-          setTimeout(() => {
+    wx.request({
+      url: app.globalData.interfaceUrls.repairRegistration,
+      method: 'POST',
+      header: {
+        'content-type': 'application/json', // 默认值
+        'token': app.globalData.userWxInfo.token,
+        'source': "wc",
+        '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
+      },
+      data:submitData,
+      success(res) {
+        wx.hideLoading();
+        if(res.data.code=='200'){
             wx.navigateTo({
               url: '/pages/baoxiuSuccess/baoxiuSuccess',
             });
-          }, 2000);
         }
-      });
-    }, 1500);
+      },
+      fail(error) {
+        wx.hideLoading()
+        utils.simleInfo('登记失败,请稍后再试')
+      }
+    })
   }
 }); 

+ 3 - 2
pages/baoxiudj/baoxiudj.wxml

@@ -11,7 +11,8 @@
   <view class="bill-card first-card">
     <view class="bill-row">
       <text>地址</text>
-      <text class="bill-row-address">{{address}}</text>
+      <textarea auto-height='true' class="bill-row-address" value="{{address}}">
+      </textarea>
     </view>
     <view class="divider"></view>
     <view class="bill-row">
@@ -52,7 +53,7 @@
       <view class="image-preview" wx:if="{{imageList.length > 0}}">
         <block wx:for="{{imageList}}" wx:key="index">
           <view class="image-item">
-            <image src="{{item}}" mode="aspectFill" bindtap="previewImage" data-index="{{index}}"></image>
+            <image src="{{item.tempFilePath}}" mode="aspectFill" bindtap="previewImage" data-index="{{index}}"></image>
             <view class="delete-icon" catchtap="deleteImage" data-index="{{index}}">×</view>
           </view>
         </block>

+ 2 - 2
pages/tongzhiList/tongzhiList.wxml

@@ -24,8 +24,8 @@
     </block>
     
     <!-- 只显示近3个月记录提示放在滚动区域内的最后 -->
-    <view class="notice-footer">
+    <!-- <view class="notice-footer">
       只显示近3个月记录
-    </view>
+    </view> -->
   </scroll-view>
 </view>

+ 28 - 15
pages/tousujianyi/tousujianyi.js

@@ -1,3 +1,4 @@
+const  app= getApp();
 Page({
   data: {
     address: '安平镇安坪村安平小区12栋305室',
@@ -91,7 +92,7 @@ Page({
         for (let i = 0; i < tempFiles.length; i++) {
           const file = tempFiles[i];
           if (file.size <= 10 * 1024 * 1024) {
-            validFiles.push(file.tempFilePath);
+            validFiles.push(file);
           } else {
             wx.showToast({
               title: '图片大小不能超过10M',
@@ -173,7 +174,13 @@ Page({
       });
       return;
     }
-    
+    debugger;
+    const fileManager = wx.getFileSystemManager();
+    this.data.imageList.map(imgInfo=>{
+      const base64 = fileManager.readFileSync(imgInfo.tempFilePath, 'base64');
+      imgInfo.base64=base64;
+      return imgInfo;
+    })
     // 构建提交数据
     const submitData = {
       category: this.data.category,
@@ -188,23 +195,29 @@ Page({
     wx.showLoading({
       title: '提交中...',
     });
-    
-    setTimeout(() => {
-      wx.hideLoading();
-      //保存成功
-      wx.showToast({
-        title: '提交成功',
-        icon: 'success',
-        duration: 2000,
-        success: function() {
-          setTimeout(() => {
+    wx.request({
+      url: app.globalData.interfaceUrls.feedback,
+      method: 'POST',
+      header: {
+        'content-type': 'application/json', // 默认值
+        'token': app.globalData.userWxInfo.token,
+        'source': "wc",
+        '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
+      },
+      data:submitData,
+      success(res) {
+        wx.hideLoading();
+        if(res.data.code=='200'){
             wx.navigateTo({
               url: '/pages/tousujianyiSuccess/tousujianyiSuccess',
             });
-          }, 2000);
         }
-      });
-    }, 1500);
+      },
+      fail(error) {
+        wx.hideLoading()
+        utils.simleInfo('登记失败,请稍后再试')
+      }
+    })
   },
 
   submitRepair: function() {

+ 1 - 1
pages/tousujianyi/tousujianyi.wxml

@@ -51,7 +51,7 @@
       <view class="image-preview" wx:if="{{imageList.length > 0}}">
         <block wx:for="{{imageList}}" wx:key="index">
           <view class="image-item">
-            <image src="{{item}}" mode="aspectFill" bindtap="previewImage" data-index="{{index}}"></image>
+            <image src="{{item.tempFilePath}}" mode="aspectFill" bindtap="previewImage" data-index="{{index}}"></image>
             <view class="delete-icon" catchtap="deleteImage" data-index="{{index}}">×</view>
           </view>
         </block>