zhaoxiaohai 3 năm trước cách đây
mục cha
commit
4f1e885f32
3 tập tin đã thay đổi với 96 bổ sung15 xóa
  1. 49 13
      pages/submission/details.js
  2. 28 0
      pages/submission/details.scss
  3. 19 2
      pages/submission/details.wxml

+ 49 - 13
pages/submission/details.js

@@ -5,10 +5,12 @@ Page({
      * 页面的初始数据
      */
     data: {
-        detailsData: {},
-        butText: false,
-        content: "",
-        loading: false,
+        detailsData: {}, //详情数据
+        butText: false, //底部按钮文本
+        content: "", //提交内容
+        loading: false, //按钮加载状态
+        recordL: {}, //记录
+        isCommit: false, //是否提交
     },
 
     /**
@@ -20,18 +22,31 @@ Page({
             detailsData,
             butText: options.type
         })
-        console.log("是否一事一报", detailsData.oneToOne)
-
         /* 详情计数 */
-        if (options.type == '开始提报') _Http.basic({
+        if (options.type == '开始提报') {
+            this.select_submitdetailed();
+        } else if (options.type == 'false') {
+            /* 查看记录 */
+            this.setData({
+                recordL: JSON.parse(options.record)
+            })
+        }
+        console.log("是否一事一报", detailsData.oneToOne)
+    },
+    /* 查询详情 */
+    select_submitdetailed() {
+        _Http.basic({
             "classname": "saletool.submitedit.submitedit",
             "method": "select_submitdetailed",
             "content": {
-                "sat_submiteditmodelid": detailsData.sat_submiteditmodelid
+                "sat_submiteditmodelid": this.data.detailsData.sat_submiteditmodelid
             }
         }).then(res => {
             console.log("提报详情", res)
-        })
+            this.setData({
+                'detailsData.submitedit': res.data[0].submitedit
+            })
+        });
     },
     /* 文本域输入 */
     textareaInput(e) {
@@ -46,6 +61,10 @@ Page({
                 url: './details?type=保存&item=' + JSON.stringify(this.data.detailsData),
             })
         } else {
+            if (this.data.isCommit) return wx.showToast({
+                title: '请勿重新提交',
+                icon: "none"
+            })
             if (!this.data.content) return wx.showToast({
                 title: '您还未输入提报内容',
                 icon: "none"
@@ -66,7 +85,6 @@ Page({
                     "sat_submiteditid": 0
                 }
             }).then(res => {
-                console.log(res)
                 this.setData({
                     loading: false
                 })
@@ -74,21 +92,39 @@ Page({
                     title: res.data,
                     icon: "none"
                 });
+                this.setData({
+                    isCommit: true
+                })
+                let pages = getCurrentPages();
+                let prevPage = pages[pages.length - 2];
+                if (prevPage.data.butText == '开始提报') prevPage.select_submitdetailed();
                 wx.showToast({
                     title: '提交成功',
                     icon: "success"
-                })
+                });
+                setTimeout(() => {
+                    wx.navigateBack({
+                        delta: 0,
+                    })
+                }, 300)
             })
         }
     },
-
+    /* 查看提报记录 */
+    seeHistory(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        wx.navigateTo({
+            url: `./details?type=false&item=${JSON.stringify(this.data.detailsData)}&record=${JSON.stringify(item)}`,
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
     onReady() {
 
     },
-
     /**
      * 生命周期函数--监听页面显示
      */

+ 28 - 0
pages/submission/details.scss

@@ -29,6 +29,34 @@
     }
 }
 
+/* 历史 */
+.history {
+    width: 690rpx;
+    padding: 30rpx;
+    padding-top: 28rpx;
+    box-sizing: border-box;
+    background: #ffffff;
+    border-radius: 16rpx;
+    overflow: hidden;
+    margin-top: 20rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    font-size: 28rpx;
+
+
+    .line-2 {
+        color: #333333;
+        line-height: 44rpx;
+    }
+
+    .data {
+        display: flex;
+        justify-content: space-between;
+        font-size: 24rpx;
+        color: #999999;
+        margin-top: 20rpx;
+    }
+}
+
 /* 文本域 */
 .textarea {
     width: 690rpx;

+ 19 - 2
pages/submission/details.wxml

@@ -10,11 +10,18 @@
 <block wx:if="{{butText=='开始提报'}}">
     <view class="box" style="background: none;">
         <view class="title multi-line">提报记录</view>
+        <navigator class="history" url="#" wx:for="{{detailsData.submitedit}}" data-item="{{item}}" bindtap="seeHistory">
+            <view class="line-2">{{item.content}}</view>
+            <view class="data">
+                <text>提交时间:{{item.createdate}}</text>
+                <text>附件数量:1</text>
+            </view>
+        </navigator>
     </view>
-    <My_empty />
+    <My_empty wx:if="{{!detailsData.submitedit.length}}" />
 </block>
 
-<!-- 提报详情 -->
+<!-- 开始提报 -->
 <view class="box" wx:elif="{{butText=='保存'}}" style="background: none;">
     <view class="title multi-line">提报内容</view>
     <textarea class="textarea" placeholder="请输入提报内容" bindinput="textareaInput" />
@@ -22,6 +29,16 @@
     <My_accessory />
 </view>
 
+<!-- 提报详情 -->
+<view class="box" wx:else style="background: none;">
+    <view class="title multi-line">提报内容</view>
+    <view class="history" style="margin-bottom: 30rpx;">
+        {{recordL.content}}
+    </view>
+    <view class="title multi-line">提报附件<text>已上传2个</text></view>
+    <My_accessory />
+</view>
+
 <view class="footer" wx:if="{{butText!='false'}}">
     <van-button round custom-class='button' loading='{{loading}}' disabled="{{butText=='保存'&&content==''||loading}}" bindtap="toDetails">{{butText}}</van-button>
 </view>