dev01 1 year ago
parent
commit
e7ff6fa0c5

+ 1 - 0
src/pages/debitnote/index.jsx

@@ -32,6 +32,7 @@ class DebitNote extends Component {
   getList() {
     getDrbitNote({
       depId: this.$instance.router.params.depId,
+      id: this.$instance.router.params.id
     }).then((msg) => {
       if (msg.error.length === 0) {
         this.setState({

+ 38 - 16
src/pages/drafts/index.jsx

@@ -96,6 +96,10 @@ class Drafts extends Component {
 
   }
 
+  componentWillUnmount() {
+    this.imagePickerRef && this.imagePickerRef.clear();
+  }
+
   // 部门数据
   getDepartmentList() {
     getDepartmentList({}).then(v => {
@@ -283,7 +287,7 @@ class Drafts extends Component {
       }
     }).catch(() => {
       Taro.showToast({
-        title: '系统错误,请稍后再试',
+        title: '系统错误,请稍后再试',
         icon: 'none'
       })
     })
@@ -383,7 +387,18 @@ class Drafts extends Component {
         return;
       }
     }
-
+    let imgUrls = []
+    if (this.state.imgs.length) {
+      let picArr = [];
+      this.state.imgs.map(function (item) {
+        if (item.url) {
+          picArr.push(item.url.substring(resourceAddress.length));
+        } else {
+          picArr.push(item)
+        }
+      });
+      imgUrls = picArr.join(",");
+    }
     this.setState({
       loading: true,
     });
@@ -395,7 +410,7 @@ class Drafts extends Component {
       typeOther: data.type == 0 ? data.typeOther : undefined, // 其他类型
       remarks: data.remarks, // 报销事由
       applyDep: (data.type == 4 || data.type == 5) ? undefined : data.applyDep, // 申请部门(借支抵扣不需要)
-      attachmentUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","), // 附件
+      attachmentUrl: this.state.imgs.length === 0 ? "" : imgUrls, // 附件
       payDep: data.payDep, // 支付部门
       orderNo: (data.type == 4 || data.type == 5) ? undefined : data.orderNo, // 订单编号(借支抵扣不需要)
       debitId: data.type == 4 ? undefined : data.debitId, // 预支单
@@ -434,7 +449,6 @@ class Drafts extends Component {
       });
   }
 
-
   getNumHourse(startTime, endTime) {
     this.setState({
       totalDuration: getNumHourse(
@@ -808,10 +822,11 @@ class Drafts extends Component {
                 }}
               >删除</View>
               {/* <View className="edit">编辑</View> */}
-              <View className="formItem">
-                <View className="formName">需付款时间:</View>
-                <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
-              </View>
+              {!!item.agreeTimeStr &&
+                <View className="formItem">
+                  <View className="formName">需付款时间:</View>
+                  <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
+                </View>}
               <View className="formItem">
                 <View className="formName">付款方式:</View>
                 <View className="formValue">{["公对公转账"][item.payType]}</View>
@@ -845,14 +860,16 @@ class Drafts extends Component {
                 <View className="formValue">{item.amount}</View>
               </View>
             </View>
-          )}
-        {data.type != 4 &&
+          )
+        }
+        {
+          data.type != 4 &&
           <View className="formItem">
             <View className="formName">{data.type == 5 ? "抵扣借支:" : "抵扣:"}</View>
             <View className="formValue"
               onClick={() => {
                 Taro.navigateTo({
-                  url: `/pages/debitnote/index?depId=${data.applyDep}`
+                  url: `/pages/debitnote/index?depId=${data.applyDep}&id=${data.id}`
                 })
               }}
             >
@@ -862,18 +879,23 @@ class Drafts extends Component {
                   <AtIcon value="chevron-right" size="20" color="#000000" />
                 </View>}
             </View>
-          </View>}
+          </View>
+        }
         {data.type != 4 && data.type != 5 && < View className="tips">注:如需抵扣借支,请选择对应的借支订单</View>}
-        {data.type != 4 && data.type != 5 &&
+        {
+          data.type != 4 && data.type != 5 &&
           <View className="formItem" style={{ paddingTop: "10px" }}>
             <View className="formName">总金额:</View>
             <View className="formValue"><Text style={{ color: "red" }}>{total}</Text>(元)</View>
-          </View>}
-        {data.type != 4 && data.type != 5 &&
+          </View>
+        }
+        {
+          data.type != 4 && data.type != 5 &&
           <View className="formItem" style={{ paddingTop: "10px" }}>
             <View className="formName">实报金额:</View>
             <View className="formValue"><Text style={{ color: "red" }}>{this.state.reality}</Text>(元)</View>
-          </View>}
+          </View>
+        }
         <View className="formItem" style={{ display: "block", paddingBottom: 0 }}>
           <View className="formName">附件:</View>
           <View

+ 10 - 8
src/pages/draftsdetail/index.jsx

@@ -286,10 +286,11 @@ class Drafts extends Component {
         {(data.type == 0 || data.type == 2 || data.type == 4 || data.type == 5) &&
           list?.map(item =>
             <View className="unItem" key={item.id}>
-              <View className="formItem">
-                <View className="formName">{data.type == 5 ? "支付时间:" : "需付款时间:"}</View>
-                <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
-              </View>
+              {!!item.agreeTimeStr &&
+                <View className="formItem">
+                  <View className="formName">{data.type == 5 ? "支付时间:" : "需付款时间:"}</View>
+                  <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
+                </View>}
               <View className="formItem">
                 <View className="formName">
                   {data.type == 4
@@ -305,10 +306,11 @@ class Drafts extends Component {
         {data.type == 3 &&
           list?.map(item =>
             <View className="unItem" key={item.id}>
-              <View className="formItem">
-                <View className="formName">需付款时间:</View>
-                <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
-              </View>
+              {!!item.agreeTimeStr &&
+                <View className="formItem">
+                  <View className="formName">需付款时间:</View>
+                  <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
+                </View>}
               <View className="formItem">
                 <View className="formName">付款方式:</View>
                 <View className="formValue">{["公对公转账"][item.payType]}</View>

+ 89 - 1
src/pages/mybusiness/index.jsx

@@ -1,7 +1,7 @@
 import React, { Component } from 'react';
 import Taro from '@tarojs/taro';
 import { View, Picker, ScrollView, Button } from '@tarojs/components'
-import { getPublicReleaseList, } from '../../utils/servers/servers';
+import { getPublicReleaseList, selectByPrid, creatOrder } from '../../utils/servers/servers';
 import dayjs from 'dayjs';
 import {
   AtSearchBar,
@@ -21,6 +21,7 @@ import "taro-ui/dist/style/components/search-bar.scss";
 import "taro-ui/dist/style/components/button.scss";
 
 import MyList from './list';
+import InquiryModal from "../../components/common/inquiryModal";
 
 class MyBusiness extends Component {
 
@@ -155,6 +156,65 @@ class MyBusiness extends Component {
     }
   }
 
+  // 公出报销查询
+  getByDrafts(id) {
+    selectByPrid({
+      prid: id,
+      status: 0, //  0=草稿,1=审核中,2=完成,3=驳回
+    }).then((v) => {
+      if (v.error.length === 0) {
+        if (v.data) {
+          // 1有草稿未提交
+          Taro.navigateTo({
+            url: '/pages/drafts/index?id=' + v.data
+          })
+        } else {
+          this.creatOrder(id)
+          // this.setState({
+          //   id,
+          //   visible: "add",
+          // })
+        }
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: "none" });
+      }
+    }).catch((err) => {
+      Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
+    });
+  }
+
+  // 发起差旅费报销
+  creatOrder(prid) {
+    creatOrder({
+      prid,
+      type: 1,
+    }).then(v => {
+      if (v.error.length === 0) {
+        Taro.redirectTo({
+          url: '/pages/drafts/index?id=' + v.data
+        })
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: 'none' })
+      }
+    }).catch(() => {
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
+
+  onPup(id) {
+    this.setState({
+      isInquiryOpened: true,
+      inquiryTitle: "温馨提醒",
+      inquiryContent: "您确定要发起此次公出费用报销吗?",
+      inquiryFn: () => {
+        this.getByDrafts(id)
+      },
+    });
+  }
+
 
   render() {
     return (
@@ -362,6 +422,10 @@ class MyBusiness extends Component {
                   onRefresh={() => {
                     this.getPublicReleaseList(true);
                   }}
+                  initiate={(id) => {
+                    this.onPup(id)
+                  }}
+
                 />
               </AtTabsPane>
             )
@@ -386,6 +450,30 @@ class MyBusiness extends Component {
             this.onSetPickerTime(v)
           }}>
         </timePicker>
+        {/* 二级确认弹窗 */}
+        <InquiryModal
+          isOpened={this.state.isInquiryOpened}
+          title={this.state.inquiryTitle}
+          content={this.state.inquiryContent}
+          onClose={() => {
+            this.setState({
+              isInquiryOpened: false,
+              inquiryTitle: "",
+              inquiryContent: "",
+              isNo: true,
+            });
+          }}
+          onDetermine={() => {
+            this.state.inquiryFn();
+            this.setState({
+              isInquiryOpened: false,
+              inquiryTitle: "",
+              inquiryContent: "",
+              isNo: true,
+              inquiryFn: () => { },
+            });
+          }}
+        />
       </View>
     )
   }

+ 1 - 1
src/pages/mybusiness/index.less

@@ -324,4 +324,4 @@
   align-items: center;
   right: -31px;
   bottom: 60px;
-}
+}

+ 1 - 82
src/pages/mybusiness/list.jsx

@@ -3,9 +3,7 @@ import Taro from "@tarojs/taro";
 import { View, Image, Button } from "@tarojs/components";
 import Skeleton from "taro-skeleton";
 import { getClockState } from "../../utils/tools";
-import { selectByPrid, creatOrder } from '../../utils/servers/servers';
 import ListBottomStart from "../../components/common/listBottomStart";
-import InquiryModal from "../../components/common/inquiryModal";
 import Select from "../applyReimbursement/select";
 import "./index.less";
 
@@ -24,54 +22,6 @@ class List extends Component {
     })
   }
 
-  // 公出报销查询
-  getByDrafts(id) {
-    selectByPrid({
-      prid: id,
-      status: 0, //  0=草稿,1=审核中,2=完成,3=驳回
-    }).then((v) => {
-      if (v.error.length === 0) {
-        if (v.data) {
-          // 1有草稿未提交
-          Taro.navigateTo({
-            url: '/pages/drafts/index?id=' + v.data
-          })
-        } else {
-          this.creatOrder(id)
-          // this.setState({
-          //   id,
-          //   visible: "add",
-          // })
-        }
-      } else {
-        Taro.showToast({ title: v.error[0].message, icon: "none" });
-      }
-    }).catch((err) => {
-      // Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
-    });
-  }
-
-  // 发起差旅费报销
-  creatOrder(prid) {
-    creatOrder({
-      prid,
-      type: 1,
-    }).then(v => {
-      if (v.error.length === 0) {
-        Taro.redirectTo({
-          url: '/pages/drafts/index?id=' + v.data
-        })
-      } else {
-        Taro.showToast({ title: v.error[0].message, icon: 'none' })
-      }
-    }).catch(() => {
-      Taro.showToast({
-        title: '系统错误,请稍后再试',
-        icon: 'none'
-      })
-    })
-  }
-
   render() {
     return (
       <View className="indexPage">
@@ -110,14 +60,7 @@ class List extends Component {
                   <View
                     className="punchClock"
                     onClick={() => {
-                      this.setState({
-                        isInquiryOpened: true,
-                        inquiryTitle: "温馨提醒",
-                        inquiryContent: "您确定要发起此次公出费用报销吗?",
-                        inquiryFn: () => {
-                          this.getByDrafts(v.id)
-                        },
-                      });
+                      this.props.initiate(v.id)
                     }}
                   >
                     发起报销
@@ -160,30 +103,6 @@ class List extends Component {
             }}
           />
         </View>
-        {/* 二级确认弹窗 */}
-        <InquiryModal
-          isOpened={this.state.isInquiryOpened}
-          title={this.state.inquiryTitle}
-          content={this.state.inquiryContent}
-          onClose={() => {
-            this.setState({
-              isInquiryOpened: false,
-              inquiryTitle: "",
-              inquiryContent: "",
-              isNo: true,
-            });
-          }}
-          onDetermine={() => {
-            this.state.inquiryFn();
-            this.setState({
-              isInquiryOpened: false,
-              inquiryTitle: "",
-              inquiryContent: "",
-              isNo: true,
-              inquiryFn: () => { },
-            });
-          }}
-        />
         {/* 发起报销类型选择 */}
         {/* {this.state.visible != "" &&
           <Select