dev01 1 year ago
parent
commit
87e03f7afa

+ 12 - 29
src/pages/accountFrom/index.jsx

@@ -82,26 +82,23 @@ class AccountFrom extends Component {
       ...data,
       ...{ eaid, type, }
     }
-    this.setState({
-      loading: true,
-    });
+    Taro.showLoading({ title: '保存中...' });
     detailsAdd(obj)
       .then((v) => {
-        this.setState({
-          loading: false,
-        });
+        Taro.hideLoading()
         if (v.error.length === 0) {
           Taro.showToast({
             title: "保存成功!",
             icon: "none",
           });
-          const _this = this
-          setTimeout(function () {
-            Taro.navigateBack();
-            _this.setState({
-              loading: false,
-            });
-          }, 400);
+          Taro.navigateBack();
+          // const _this = this
+          // setTimeout(function () {
+          //   Taro.navigateBack();
+          //   _this.setState({
+          //     loading: false,
+          //   });
+          // }, 400);
         } else {
           Taro.showToast({
             title: v.error[0].message,
@@ -110,9 +107,7 @@ class AccountFrom extends Component {
         }
       })
       .catch(() => {
-        this.setState({
-          loading: false,
-        });
+        Taro.hideLoading()
       });
   }
 
@@ -121,20 +116,9 @@ class AccountFrom extends Component {
     const pickerList = ["普票", "专票"]
     return (
       <View className="accountFrom">
-        {/* <View className="textareaFormItem" style={{ display: this.getShow(type, "remarks") }}>
-          <AtTextarea
-            value={data.remarks}
-            onChange={e => {
-              let obj = { remarks: e }
-              this.setState({ data: { ...data, ...obj } })
-            }}
-            maxLength={50}
-            placeholder="请填写报销事由"
-          />
-        </View> */}
         <View className="inputFormItem" style={{ display: this.getShow(type, "agreeTimes") }}>
           <View className="ifCustom">
-            <View className="iftitle">需付款时间:</View>
+            <View className="iftitle">{type == 5 ? "支付时间:" : "需付款时间:"}</View>
             <Picker
               mode='date'
               onChange={(e) => {
@@ -283,7 +267,6 @@ class AccountFrom extends Component {
         <View className="bottom">
           <AtButton
             loading={this.state.loading}
-            disabled={this.state.loading}
             type="primary"
             circle
             onClick={() => {

+ 2 - 0
src/pages/applyReimbursement/index.jsx

@@ -45,10 +45,12 @@ class applyReimbursement extends Component {
   // 不需要prid绑定,直接发起
   creatOrder() {
     const { type, other, } = this.state
+    Taro.showLoading({ title: '处理中...' });
     creatOrder({
       type,
       typeOther: other,
     }).then(v => {
+      Taro.hideLoading()
       if (v.error.length === 0) {
         Taro.redirectTo({
           url: '/pages/drafts/index?id=' + v.data

+ 63 - 40
src/pages/drafts/index.jsx

@@ -344,7 +344,7 @@ class Drafts extends Component {
 
   // 提交申请
   onSubmit() {
-    const { data, bankData } = this.state
+    const { data, bankData, list } = this.state
     if (data.type == 1) {
       if (!data.userNames) {
         Taro.showToast({ title: "请填写公出客户名称", icon: "none" });
@@ -367,6 +367,16 @@ class Drafts extends Component {
       Taro.showToast({ title: "请填写报销事由", icon: "none" });
       return;
     }
+    if (list.length == 0) {
+      Taro.showToast({ title: "请先添加报销/申请费用详细", icon: "none" });
+      return;
+    }
+    if (data.type == 5) {
+      if (!data.debitId) {
+        Taro.showToast({ title: "请选择需抵扣的借支", icon: "none" });
+        return;
+      }
+    }
 
     this.setState({
       loading: true,
@@ -378,12 +388,12 @@ class Drafts extends Component {
       type: data.type, // 报销类型
       typeOther: data.type == 0 ? data.typeOther : undefined, // 其他类型
       remarks: data.remarks, // 报销事由
-      applyDep: data.applyDep, // 申请部门
+      applyDep: (data.type == 4 || data.type == 5) ? undefined : data.applyDep, // 申请部门(借支抵扣不需要)
       attachmentUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","), // 附件
-      payDep: (data.type == 4 || data.type == 5) ? undefined : data.payDep, // 支付部门(借支抵扣不需要)
+      payDep: data.payDep, // 支付部门
       orderNo: (data.type == 4 || data.type == 5) ? undefined : data.orderNo, // 订单编号(借支抵扣不需要)
       debitId: data.type == 4 ? undefined : data.debitId, // 预支单
-      eaaid: data.type == 3 ? undefined : bankData.id, // 报销账户(第三方付款不需要)
+      eaaid: (data.type == 3 || data.type == 5) ? undefined : bankData.id, // 报销账户(第三方付款和抵扣不需要)
       // 差旅费
       userNames: data.type == 1 ? data.userNames : undefined, // 公出客户名称
       districtName: data.type == 1 ? data.districtName : undefined, // 公出地点
@@ -591,7 +601,7 @@ class Drafts extends Component {
             </View>
           </View>}
         <View className="formTitle">
-          报销详细
+          {(data.type == 4 || data.type == 5) ? "申请详细" : "报销详细"}
         </View>
         <View className="formItem">
           <View className="formName">申请人:</View>
@@ -620,7 +630,10 @@ class Drafts extends Component {
           </View>
         }
         <View className="formItem">
-          <View className="formName">支付公司:</View>
+          <View className="formName">
+            {data.type == 4
+              ? "预借支公司:" : data.type == 5
+                ? "抵扣公司:" : "支付公司:"}</View>
           <View className="formValue">
             <Picker
               value={departmentArr.findIndex(item => item.id === data.payDep)}
@@ -639,7 +652,7 @@ class Drafts extends Component {
           </View>
         </View>
         <View className="formItem">
-          <View className="formName">报销事由:</View>
+          <View className="formName">{(data.type == 4 || data.type == 5) ? "说明:" : "报销事由:"}</View>
           <View className="formValues">
             <AtTextarea
               value={data.remarks == null ? "" : data.remarks}
@@ -651,12 +664,12 @@ class Drafts extends Component {
               }}
               height={75}
               maxLength={50}
-              placeholder="请填写报销事由"
+              placeholder={(data.type == 4 || data.type == 5) ? "请填写说明:" : "请填写报销事由"}
             />
           </View>
         </View>
         <View className="formTitle">
-          报销费用详细
+          {data.type != 4 && data.type != 5 && "报销"}费用详细
           <Button className="ftBottom" size='mini' type='primary'
             onClick={() => {
               data.type == 1
@@ -736,8 +749,7 @@ class Drafts extends Component {
                     });
                   }}
                 >删除</View>
-              </View>)
-        }
+              </View>)}
         {/* 通用 */}
         {(data.type == 0 || data.type == 2 || data.type == 4 || data.type == 5) &&
           list?.map(item =>
@@ -756,16 +768,19 @@ class Drafts extends Component {
               >删除</View>
               {/* <View className="edit">编辑</View> */}
               <View className="formItem">
-                <View className="formName">需付款时间:</View>
+                <View className="formName">{data.type == 5 ? "支付时间:" : "需付款时间:"}</View>
                 <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
               </View>
               <View className="formItem">
-                <View className="formName">金额:</View>
+                <View className="formName">
+                  {data.type == 4
+                    ? "预借支金额:" : data.type == 5
+                      ? "抵扣金额:" : "金额:"}
+                </View>
                 <View className="formValue">{item.amount}(元)</View>
               </View>
             </View>
-          )
-        }
+          )}
         {/* 第三方付款 */}
         {data.type == 3 &&
           list?.map(item =>
@@ -820,12 +835,10 @@ class Drafts extends Component {
                 <View className="formValue">{item.amount}</View>
               </View>
             </View>
-          )
-        }
-        {
-          data.type != 4 &&
+          )}
+        {data.type != 4 &&
           <View className="formItem">
-            <View className="formName">预借支:</View>
+            <View className="formName">{data.type == 5 ? "抵扣借支:" : "抵扣:"}</View>
             <View className="formValue"
               onClick={() => {
                 Taro.navigateTo({
@@ -834,21 +847,23 @@ class Drafts extends Component {
               }}
             >
               {!data.debitId
-                ? <Button size='mini' type='primary' style={{ marginRight: 0 }}>选择借支订单</Button>
+                ? <Button size='mini' type='primary' style={{ marginRight: 0 }}>{'抵扣借支'}</Button>
                 : <View>已选择<Text style={{ color: "red" }}>{data.debitTotalAmount}</Text>元借支订单
                   <AtIcon value="chevron-right" size="20" color="#000000" />
                 </View>}
             </View>
-          </View>
-        }
-        <View className="formItem" style={{ paddingTop: "10px" }}>
-          <View className="formName">总金额:</View>
-          <View className="formValue"><Text style={{ color: "red" }}>{total}</Text>(元)</View>
-        </View>
-        <View className="formItem" style={{ paddingTop: "10px" }}>
-          <View className="formName">实报金额:</View>
-          <View className="formValue"><Text style={{ color: "red" }}>{this.state.reality}</Text>(元)</View>
-        </View>
+          </View>}
+        {data.type != 4 && data.type != 5 && < View className="tips">注:如需抵扣借支,请选择对应的借支订单</View>}
+        {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 className="formItem" style={{ paddingTop: "10px" }}>
+            <View className="formName">实报金额:</View>
+            <View className="formValue"><Text style={{ color: "red" }}>{this.state.reality}</Text>(元)</View>
+          </View>}
         <View className="formItem" style={{ display: "block", paddingBottom: 0 }}>
           <View className="formName">附件:</View>
           <View
@@ -869,11 +884,14 @@ class Drafts extends Component {
         <View className="tips">①需要提供发票报销</View>
         <View className="tips">②需要填写报销明细表</View>
         <View className="tips">③招待费需要提供报备截图</View>
-        {data.type != 3 &&
+        {
+          data.type != 3 &&
           <View className="formTitle" style={{ marginTop: "20px" }}>
             报销收款账户
-          </View>}
-        {data.type != 3 &&
+          </View>
+        }
+        {
+          data.type != 3 && data.type != 5 &&
           <View className="unobstructedList">
             {(!bankData.id)
               ? <View className="noAccout" onClick={() => { this.setState({ accountvisible: true }) }}>
@@ -901,7 +919,8 @@ class Drafts extends Component {
                   <View className="formName">收款账户:{bankData.accounts}</View>
                 </View>
               </View>}
-          </View>}
+          </View>
+        }
         <View className="bottom">
           <AtButton
             disabled={this.state.loading}
@@ -939,13 +958,15 @@ class Drafts extends Component {
           }}
         />
         {/* 收款账户添加 */}
-        {this.state.accountvisible != "" &&
+        {
+          this.state.accountvisible != "" &&
           <AccountModal
             isSub={true}
             visible={this.state.accountvisible}
             onClose={this.onAccountClose.bind(this)}
             onOk={this.onAccountOk.bind(this)}
-          />}
+          />
+        }
         {/* 收款账户列表 */}
         <AtModal isOpened={this.state.upaccount}>
           <AtModalHeader>请选择收款账户</AtModalHeader>
@@ -962,15 +983,17 @@ class Drafts extends Component {
           </AtModalAction>
         </AtModal>
         {/* 申请类型修改 */}
-        {this.state.typeVisible != "" &&
+        {
+          this.state.typeVisible != "" &&
           <Select
             visible={this.state.typeVisible}
             onClose={this.onTypeClose.bind(this)}
             onOk={this.onTypeOk.bind(this)}
             type={data.type}
             other={data.typeOther}
-          />}
-      </View>
+          />
+        }
+      </View >
     );
   }
 }

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

@@ -161,7 +161,7 @@
       align-items: baseline;
 
       .formName {
-        width: 150px;
+        min-width: 150px;
         margin-right: 16px;
         white-space: nowrap;
         display: flex;

+ 33 - 18
src/pages/draftsdetail/index.jsx

@@ -136,6 +136,7 @@ class Drafts extends Component {
 
   // 审批
   examine(val) {
+    Taro.showLoading({ title: '处理中...' });
     AccountExamine({
       id: this.state.data.id,
       reason: this.state.reason,
@@ -215,7 +216,7 @@ class Drafts extends Component {
             </View>
           </View>}
         <View className="formTitle">
-          报销详细
+          {(data.type == 4 || data.type == 5) ? "申请详细" : "报销详细"}
         </View>
         <View className="formItem">
           <View className="formName">申请人:</View>
@@ -229,15 +230,19 @@ class Drafts extends Component {
           </View>
         }
         <View className="formItem">
-          <View className="formName">支付公司:</View>
+          <View className="formName">
+            {data.type == 4
+              ? "预借支公司:" : data.type == 5
+                ? "抵扣公司:" : "支付公司:"}
+          </View>
           <View className="formValue">{data.payDepName}</View>
         </View>
         <View className="formItem">
-          <View className="formName">报销事由:</View>
+          <View className="formName">{(data.type == 4 || data.type == 5) ? "说明:" : "报销事由:"}</View>
           <View className="formValue">{data.remarks}</View>
         </View>
         <View className="formTitle">
-          报销费用详细
+          {data.type != 4 && data.type != 5 && "报销"}费用详细
         </View>
         {/* 差旅费显示 */}
         {data.type == 1 &&
@@ -280,11 +285,15 @@ class Drafts extends Component {
           list?.map(item =>
             <View className="unItem" key={item.id}>
               <View className="formItem">
-                <View className="formName">需付款时间:</View>
+                <View className="formName">{data.type == 5 ? "支付时间:" : "需付款时间:"}</View>
                 <View className="formValue">{item.agreeTimeStr.slice(0, 10)}</View>
               </View>
               <View className="formItem">
-                <View className="formName">金额(元):</View>
+                <View className="formName">
+                  {data.type == 4
+                    ? "预借支金额:" : data.type == 5
+                      ? "抵扣金额:" : "金额:"}
+                </View>
                 <View className="formValue">{item.amount}(元)</View>
               </View>
             </View>
@@ -340,16 +349,22 @@ class Drafts extends Component {
             <View className="formValue"><Text style={{ color: "red" }}>{data.debitTotalAmount}</Text>(元)</View>
           </View>
         }
-        <View className="formItem">
-          <View className="formName">总金额:</View>
-          <View className="formValue"><Text style={{ color: "red" }}>{total}</Text>(元)</View>
-        </View>
-        <View className="formItem">
-          <View className="formName">实报金额:</View>
-          <View className="formValue"><Text style={{ color: "red" }}>
-            {(total > data.debitTotalAmount) ? commonAdd(total, -data.debitTotalAmount) : 0}
-          </Text>(元)</View>
-        </View>
+        {
+          data.type != 4 && data.type != 5 &&
+          <View className="formItem">
+            <View className="formName">总金额:</View>
+            <View className="formValue"><Text style={{ color: "red" }}>{total}</Text>(元)</View>
+          </View>
+        }
+        {
+          data.type != 4 && data.type != 5 &&
+          <View className="formItem">
+            <View className="formName">实报金额:</View>
+            <View className="formValue"><Text style={{ color: "red" }}>
+              {(total > data.debitTotalAmount) ? commonAdd(total, -data.debitTotalAmount) : 0}
+            </Text>(元)</View>
+          </View>
+        }
         <View className="formItem" style={{ display: "block", paddingBottom: 0 }}>
           <View className="formName">附件:</View>
           <View
@@ -363,11 +378,11 @@ class Drafts extends Component {
               />}
           </View>
         </View>
-        {data.type != 3 &&
+        {data.type != 3 && data.type != 5 &&
           <View className="formTitle" style={{ marginTop: "20px" }}>
             报销至收款账户
           </View>}
-        {data.type != 3 &&
+        {data.type != 3 && data.type != 5 &&
           <View className="unobstructedList">
             {<View className="unItem" >
               <View className="formItem">

+ 1 - 1
src/utils/tools/config.js

@@ -66,7 +66,7 @@ export const accountList = [
   { label: '差旅费', value: 1, desc: '公出产生的交通费、住宿费等' },
   { label: '非业务报销', value: 2, desc: '房租、物业水电费、网络费、话费、顺丰月结、打印费、办公物料、装修费、固定资产等' },
   { label: '第三方付款', value: 3, desc: '向第三方公司支付、招投标费用等' },
-  { label: '申请借支', value: 4, desc: '提前预支付费用' },
+  { label: '申请借支', value: 4, desc: '提前预支付费用' },
   { label: '申请抵扣', value: 5, desc: '返还费用抵扣' },
   { label: '其他', value: 0,desc: '自行填写' }
 ]