dev01 1 year ago
parent
commit
87b512f2a6

+ 2 - 2
src/pages/debitnote/index.jsx

@@ -71,7 +71,7 @@ class DebitNote extends Component {
                     className="bt"
                     type='primary'
                     size="mini"
-                    disabled={v.liquidationStatus == 2 || v.liquidationStatus == 3}
+                    disabled={v.liquidationStatus == 2}
                     onClick={() => {
                       let pages = Taro.getCurrentPages();
                       let prevPage = pages[pages.length - 2];
@@ -83,7 +83,7 @@ class DebitNote extends Component {
                         delta: 1
                       })
                     }}
-                  >{(v.liquidationStatus == 2 || v.liquidationStatus == 3) ? "已抵消" : "选择"}</Button>
+                  >{(v.liquidationStatus == 2) ? "已抵消" : "选择"}</Button>
                 </View>
               ))
             }

+ 49 - 23
src/pages/drafts/index.jsx

@@ -25,6 +25,7 @@ import {
   detailsDelete,
   subAccount,
   getDepartmentList,
+  updateDebitld,
 } from "../../utils/servers/servers";
 import {
   getNumHourse,
@@ -75,25 +76,31 @@ class Drafts extends Component {
     this.getDepartmentList()
     this.$instance.router.params && this.$instance.router.params.id &&
       (
-        this.getDetail(),
-        this.state.data.type != 2 && this.getMyList()
+        this.getDetail()
+        // this.state.data.type != 2 && this.getMyList()
       )
   }
 
   componentDidShow() { // 对应onShow,只有在onShow中才会监听到当前页面的改变
+
+    // this.state.data.type != 2 && this.getMyList()
+
     let pages = Taro.getCurrentPages();
     let currPage = pages[pages.length - 1]; // 获取当前页面
     const { data } = this.state
-    const obj = {
+    const obj =
+    {
       buyerName: currPage.data.name || data.buyerName,
       contractNo: currPage.data.contractNo || data.contractNo,
       orderNo: currPage.data.orderNo || data.orderNo,
       debitId: currPage.data.debitId || data.debitId,
-      debitTotalAmount: currPage.data.totalAmount || data.debitTotalAmount || 0,
+      // debitTotalAmount: currPage.data.totalAmount || data.debitTotalAmount || 0,
+      debitTotalAmount: currPage.data.totalAmount || data.debitTotalAmount,
     }
     this.setState({
       data: { ...this.state.data, ...obj },
     })
+
     this.getAccountList();
 
   }
@@ -130,7 +137,6 @@ class Drafts extends Component {
       })
     })
   }
-
   // 图片上传操作
   onChange(value, type) {
     let arr = this.state.imgs.concat([]);
@@ -143,32 +149,27 @@ class Drafts extends Component {
       imgs: arr,
     });
   }
-
   onInputChange(title, value) {
 
   }
-
   // 取消添加
   onAccountClose() {
     this.setState({
       accountvisible: "",
     })
   }
-
   // 添加收款账户
   onAccountOk() {
     this.setState({
       accountvisible: "",
     }, () => { this.getMyList() })
   }
-
   // 类型修改 取消
   onTypeClose() {
     this.setState({
       typeVisible: "",
     })
   }
-
   // 类型修改 确定
   onTypeOk(type, typeOther, noType, others) {
     const oldType = this.state.data.type
@@ -218,7 +219,6 @@ class Drafts extends Component {
         });
     }
   }
-
   // 费用弹窗
   onClose() {
     this.setState({
@@ -226,7 +226,6 @@ class Drafts extends Component {
     })
     this.getAccountList()
   }
-
   // 报销账户列表
   getMyList(sta) {
     let data1 = { status: 1 }
@@ -258,7 +257,6 @@ class Drafts extends Component {
       })
     })
   }
-
   // 确认收款账户
   selectOn() {
     let list = this.state.accountsList
@@ -271,7 +269,6 @@ class Drafts extends Component {
       }
     }
   }
-
   // 报销单详情
   getDetail() {
     this.setState({
@@ -299,7 +296,7 @@ class Drafts extends Component {
           totalDuration: v.data.duration,
           imgs: list,
         })
-        // this.getAccountList()
+        this.getAccountList()
       } else {
         Taro.showToast({ title: v.error[0].message, icon: 'none' })
       }
@@ -313,7 +310,6 @@ class Drafts extends Component {
       })
     })
   }
-
   // 报销详情金额列表
   getAccountList() {
     this.setState({
@@ -332,7 +328,8 @@ class Drafts extends Component {
           // sum += v.data[i].amount
           sum = commonAdd(sum, v.data[i].amount)
         }
-        let reality = (sum > data.debitTotalAmount) ? commonAdd(sum, -data.debitTotalAmount) : 0
+        let amount = data.debitTotalAmount
+        let reality = (sum > amount) ? commonAdd(sum, -amount) : 0
         this.setState({
           list: v.data,
           total: sum,
@@ -356,7 +353,6 @@ class Drafts extends Component {
       })
     })
   }
-
   // 删除报销详情
   detailsDelete(id) {
     detailsDelete({
@@ -375,6 +371,31 @@ class Drafts extends Component {
       })
     })
   }
+  // 撤销抵扣
+  updateDebitld(id) {
+    updateDebitld({
+      id,
+    }).then(v => {
+      if (v.error.length === 0) {
+        let obj = {
+          debitId: "",
+          debitTotalAmount: "",
+        }
+        this.setState({
+          data: { ...this.state.data, ...obj }
+        }, () => {
+          this.getAccountList();
+        })
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: 'none' })
+      }
+    }).catch(() => {
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
 
   // 提交申请
   onSubmit() {
@@ -960,15 +981,20 @@ class Drafts extends Component {
             <View className="formName">{data.type == 5 ? "抵扣借支:" : "抵扣:"}</View>
             <View className="formValue"
               onClick={() => {
-                Taro.navigateTo({
-                  url: `/pages/debitnote/index?depId=${data.applyDep}&id=${data.id}`
-                })
+                !data.debitId &&
+                  Taro.navigateTo({
+                    url: `/pages/debitnote/index?depId=${data.applyDep}&id=${data.id}`
+                  })
               }}
             >
               {!data.debitId
                 ? <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 className="fdeduction">已选择<Text style={{ color: "red" }}>{data.debitTotalAmount}</Text>元借支订单
+                  {/* <AtIcon value="chevron-right" size="20" color="#000000" /> */}
+                  <View className="fclose"
+                    onClick={() => {
+                      this.updateDebitld(data.id)
+                    }}>撤销</View>
                 </View>}
             </View>
           </View>

+ 22 - 2
src/pages/drafts/index.less

@@ -56,7 +56,7 @@
           // justify-content: center;
         }
 
-        .seltime{
+        .seltime {
           color: #333;
           opacity: 0.3;
         }
@@ -70,6 +70,26 @@
         overflow: hidden;
         white-space: nowrap;
       }
+
+      .fdeduction {
+        display: flex;
+        flex-direction: row;
+        align-items: center;
+
+        .fclose {
+          position: absolute;
+          right: 30px;
+          font-size: 26px;
+          background: red;
+          color: #fff;
+          padding: 10px;
+          border-radius: 8px;
+
+        }
+
+
+      }
+
     }
 
     .formValues {
@@ -457,7 +477,7 @@
         height: 20px;
       }
 
-      .icons{
+      .icons {
         width: 200px;
         height: 40px;
       }

+ 1 - 1
src/pages/draftsdetail/index.jsx

@@ -292,7 +292,7 @@ class Drafts extends Component {
         {
           data.type != 4 && data.type != 5 &&
           <View className="formItem">
-            <View className="formName">实报金额:</View>
+            <View className="formName">本次报销金额:</View>
             <View className="formValue"><Text style={{ color: "red" }}>
               {(total > data.debitTotalAmount) ? commonAdd(total, -data.debitTotalAmount) : 0}
             </Text>(元)</View>

+ 25 - 5
src/pages/examine/index.jsx

@@ -31,6 +31,11 @@ class Examine extends Component {
       starts: {},
       list: [],
       visible: false,
+      searchType: { title: "按编号", id: 0 },
+      search: [
+        { title: "按编号", id: 0 },
+        { title: "按企业名称", id: 1 },
+      ]
     }
   }
 
@@ -95,7 +100,9 @@ class Examine extends Component {
       // endTime: this.state.rangeEndMinuteVal || undefined,
       listStatus: this.state.current,
       processStatus: 1,
-      checkNo: this.state.searchValue,
+      // checkNo: this.state.searchValue,
+      username: this.state.searchType.id == 1 ? this.state.searchValue : undefined,
+      checkNo: this.state.searchType.id == 0 ? this.state.searchValue : undefined,
     }
     let msg = await getNewRecordList(removeNull(data));
     if (msg.error.length === 0) {
@@ -143,14 +150,27 @@ class Examine extends Component {
 
 
   render() {
-    const { list } = this.state
+    const { list, searchType, search } = this.state
     return (
       <View className='indexPage' >
         <View className='searchContent'>
           <View className='searchTop'>
+            <Picker
+              value={searchType.id}
+              range={search} rangeKey='title' mode='selector'
+              onChange={(e) => {
+                this.setState({
+                  searchType: search[e.detail.value],
+                })
+              }}>
+              <View className='shortValuecontent'>
+                <View className='selectTitle'>{searchType.title}</View>
+                <View className='iconContent'><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
+              </View>
+            </Picker>
             <AtSearchBar
               showActionButton
-              placeholder='请输入报销编号'
+              placeholder='请输入'
               value={this.state.searchValue}
               onActionClick={() => {
                 this.getPublicReleaseList();
@@ -199,7 +219,7 @@ class Examine extends Component {
                       >
                         {/* {item.status == 1 && <View className='lbt' onClick={e => { e.stopPropagation(); this.setState({ visible: true, id: item.id }) }}>查看审核详情</View>} */}
                         <View className='line' style={{ color: "#6190E8" }}>报销编号:{item.checkNo}</View>
-                        <View className='line' style={{ color: "#6190E8" }}>总金额:{item.totalAmount}元</View>
+                        <View className='line' style={{ color: "#6190E8" }}>总金额:{item.amount}元</View>
                         <View className='line'>报销人:{item.aname}</View>
                         <View className='line'>报销部门:{item.applyDepName}</View>
                         <View className='line'>报销时间:{item.createTimeStr}</View>
@@ -207,7 +227,7 @@ class Examine extends Component {
                         {
                           item.sonList?.map((it) =>
                             <View key={it.id} style={{ marginTop: 10 }}>
-                              <View className='line'>报销金额(元):{it.totalAmount}</View>
+                              <View className='line'>报销金额(元):{it.amount}</View>
                               <View className='line'>报销类型:
                                 {getAccountName(it.type, it.typeOther)}
                                 {it.type == 2 && (" - " + getSecondaryAccountName(it.secondaryType, it.secondaryTypeOther))}

+ 41 - 0
src/pages/examine/index.less

@@ -11,6 +11,47 @@
 
     .searchTop {
       z-index: 1000;
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+      justify-content: space-between;
+
+      .at-search-bar{
+        width: 70%;
+      }
+
+      .shortValuecontent {
+        position: relative;
+        display: flex;
+        align-items: center;
+        text-align: center;
+        width: 200px;
+        background: #6190E8;
+        border-radius: 100px;
+        padding: 10px 0;
+        margin-left: 10px;
+        font-size: 25px;
+        color: #FFFFFF;
+
+        .selectValue {
+          width: 100%;
+          text-align: center;
+          white-space: nowrap;
+        }
+
+        .selectTitle {
+          width: 100%;
+          text-align: center;
+        }
+
+        .iconContent {
+          position: absolute;
+          right: 0;
+          width: 60px;
+          text-align: center;
+        }
+      }
+
     }
 
     .searchBottom {

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

@@ -230,7 +230,10 @@ class Drafts extends Component {
             title: "操作成功",
             icon: "none",
           });
-          this.getDetail()
+          Taro.navigateBack({
+            delta: 1
+          })
+          // this.getDetail()
         } else {
           Taro.showToast({ title: v.error[0].message, icon: "none" });
         }
@@ -337,10 +340,10 @@ class Drafts extends Component {
             onClick={e => { e.stopPropagation(); copyText(data.checkNo) }}
           >复制编号</View>
         </View>}
-        <View className="formItem">
+        {/* <View className="formItem">
           <View className="formName" >总金额:</View>
           <View className="formValue">{data.totalAmount}元</View>
-        </View>
+        </View> */}
         <View className="formItem">
           <View className="formName">报销至订单:</View>
           <View className="formValue"
@@ -441,11 +444,11 @@ class Drafts extends Component {
         {
           data.sonList?.map((it) =>
             <View key={it.id} style={{ borderTop: "1px solid #eae8e8" }}>
-              <View className="formItem">
+              <View className="formItem" style={{ fontWeight: "bold" }}>
                 <View className="formName">报销金额:</View>
-                <View className="formValue">{it.totalAmount}(元)</View>
+                <View className="formValue">{it.amount}(元)</View>
               </View>
-              <View className="formItem">
+              <View className="formItem" style={{ fontWeight: "bold" }}>
                 <View className="formName">报销类型:</View>
                 <View className="formValue">
                   {getAccountName(it.type, it.typeOther)}
@@ -549,6 +552,13 @@ class Drafts extends Component {
                   </View>
                 )
               }
+              {
+                it.settlementAmount != 0 && it.type != 4 && it.type != 5 &&
+                <View className="formItem">
+                  <View className="formName">抵扣金额:</View>
+                  <View className="formValue">{it.settlementAmount}(元)</View>
+                </View>
+              }
               <View className="formItem" style={{ display: "block", paddingBottom: 0 }}>
                 <View className="formName">附件:</View>
                 <View
@@ -573,18 +583,18 @@ class Drafts extends Component {
             <View className="formValue"><Text style={{ color: "red" }}>{data.debitTotalAmount}</Text>(元)</View>
           </View>
         }
-        {
+        {/* {
           data.type != 4 && data.type != 5 &&
           <View className="formItem">
             <View className="formName">总金额:</View>
             <View className="formValue"><Text style={{ color: "red" }}>{data.totalAmount}</Text>(元)</View>
           </View>
-        }
+        } */}
         {
           data.type != 4 && data.type != 5 &&
-          <View className="formItem">
-            <View className="formName">实报金额:</View>
-            <View className="formValue"><Text style={{ color: "red" }}>{data.realAmount}</Text>(元)</View>
+          <View className="formItem" style={{ fontWeight: "bold" }}>
+            <View className="formName">本次报销金额:</View>
+            <View className="formValue"><Text style={{ color: "red" }}>{data.amount}</Text>(元)</View>
           </View>
         }
         <View className="formTitle" style={{ marginTop: "20px" }}>
@@ -725,7 +735,14 @@ class Drafts extends Component {
               type="primary"
               circle
               onClick={() => {
-                this.onSubmit(4)
+                this.setState({
+                  isInquiryOpened: true,
+                  inquiryTitle: "提醒",
+                  inquiryContent: "您确定取消该报销订单吗?",
+                  inquiryFn: () => {
+                    this.onSubmit(4);
+                  },
+                });
               }}
             >
               取消报销订单

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

@@ -171,7 +171,7 @@ class MyBusiness extends Component {
             })
           } else {
             Taro.showToast({
-              title: "不能重复发起",
+              title: "不能重复发起报销",
               icon: "none"
             })
           }

+ 1 - 1
src/pages/mymerge/index.config.js

@@ -3,6 +3,6 @@ export default {
   enablePullDownRefresh: true,
   onReachBottomDistance: 50,
   usingComponents: {
-    // timePicker: '../../components/common/timePicker/timePicker'
+    timePicker: '../../components/common/timePicker/timePicker'
   }
 }

+ 111 - 7
src/pages/mymerge/index.jsx

@@ -31,6 +31,11 @@ class Examine extends Component {
       starts: {},
       list: [],
       visible: false,
+      searchType: { title: "按编号", id: 0 },
+      search: [
+        { title: "按编号", id: 0 },
+        { title: "按企业名称", id: 1 },
+      ]
     }
   }
 
@@ -91,11 +96,13 @@ class Examine extends Component {
     let data = {
       pageNo: pageNo,
       pageSize: 10,
-      // startTime: this.state.rangeStartMinuteVal || undefined,
-      // endTime: this.state.rangeEndMinuteVal || undefined,
+      startTime: this.state.rangeStartMinuteVal || undefined,
+      endTime: this.state.rangeEndMinuteVal || undefined,
       listStatus: this.state.current,
       processStatus: 0,
-      checkNo: this.state.searchValue,
+      status: isNaN(parseInt(this.state.starts.id)) ? undefined : String(this.state.starts.id),
+      username: this.state.searchType.id == 1 ? this.state.searchValue : undefined,
+      checkNo: this.state.searchType.id == 0 ? this.state.searchValue : undefined,
     }
     let msg = await getNewRecordList(removeNull(data));
     if (msg.error.length === 0) {
@@ -143,7 +150,7 @@ class Examine extends Component {
 
 
   render() {
-    const { list } = this.state
+    const { list, searchType, search } = this.state
     return (
       <View className='indexPage' >
         <View className="heads">
@@ -158,9 +165,22 @@ class Examine extends Component {
         </View>
         <View className='searchContent'>
           <View className='searchTop'>
+            <Picker
+              value={searchType.id}
+              range={search} rangeKey='title' mode='selector'
+              onChange={(e) => {
+                this.setState({
+                  searchType: search[e.detail.value],
+                })
+              }}>
+              <View className='shortValuecontent'>
+                <View className='selectTitle'>{searchType.title}</View>
+                <View className='iconContent'><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
+              </View>
+            </Picker>
             <AtSearchBar
               showActionButton
-              placeholder='请输入报销编号'
+              placeholder='请输入'
               value={this.state.searchValue}
               onActionClick={() => {
                 this.getPublicReleaseList();
@@ -177,6 +197,90 @@ class Examine extends Component {
               }}
             />
           </View>
+          <ScrollView className={this.state.openSearch ? 'searchBottomLOL' : ''} scrollX style={{ width: '100%' }}>
+            <View className='searchBottom'>
+              <View className='searchItem' style={{ paddingLeft: '5px' }}>
+                <Picker
+                  value={this.state.starts.id}
+                  range={accountLtate} rangeKey='title' mode='selector'
+                  onChange={(e) => {
+                    this.setState({
+                      starts: accountLtate[e.detail.value],
+                    }, () => {
+                      this.getPublicReleaseList();
+                    })
+                  }}>
+                  {
+                    !this.state.starts.title ?
+                      <View className='shortValuecontent'>
+                        <View className='selectTitle'>状态</View>
+                        <View className='iconContent'><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
+                      </View> :
+                      <View className='shortValuecontent'>
+                        <View className='selectValue'>
+                          {this.state.starts.title}
+                        </View>
+                        <View className='iconContent' />
+                      </View>
+                  }
+                </Picker>
+                {
+                  this.state.starts.title &&
+                  <View className='searchSelectContent'>
+                    <View className='selectIcon'
+                      onClick={(e) => {
+                        e.stopPropagation();
+                        this.setState({
+                          starts: {}
+                        }, () => {
+                          this.getPublicReleaseList();
+                        })
+                      }}>
+                      <AtIcon value='close-circle' size='10' color='#FFFFFF' />
+                    </View>
+                  </View>
+                }
+              </View>
+              <View className='searchItem' onClick={() => {
+                this.setState({
+                  isPickerRender: true
+                })
+              }}>
+                <View>
+                  {
+                    !this.state.rangeStartMinuteVal ?
+                      <View className='valuecontent'>
+                        <View className='selectTitle'>开始及结束时间</View>
+                        <View className='iconContent' ><AtIcon value='chevron-down' size='10' color='#FFFFFF' /></View>
+                      </View> :
+                      <View className='valuecontent'>
+                        <View className='selectValue' >
+                          {this.state.rangeStartMinuteVal + "~" + this.state.rangeEndMinuteVal}
+                        </View>
+                        <View className='iconContent' />
+                      </View>
+                  }
+                </View>
+                {
+                  this.state.rangeStartMinuteVal &&
+                  <View className='searchSelectContent'>
+                    <View className='selectIcon'
+                      onClick={(e) => {
+                        e.stopPropagation();
+                        this.setState({
+                          rangeStartMinuteVal: '',
+                          rangeEndMinuteVal: '',
+                        }, () => {
+                          this.getPublicReleaseList();
+                        })
+                      }}>
+                      <AtIcon value='close-circle' size='10' color='#FFFFFF' />
+                    </View>
+                  </View>
+                }
+              </View>
+            </View>
+          </ScrollView>
         </View>
         <AtTabs
           swipeable={false}
@@ -209,7 +313,7 @@ class Examine extends Component {
                       >
                         {/* {item.status == 1 && <View className='lbt' onClick={e => { e.stopPropagation(); this.setState({ visible: true, id: item.id }) }}>查看审核详情</View>} */}
                         <View className='line' style={{ color: "#6190E8" }}>报销编号:{item.checkNo}</View>
-                        <View className='line' style={{ color: "#6190E8" }}>总金额:{item.totalAmount}元</View>
+                        <View className='line' style={{ color: "#6190E8" }}>总金额:{item.amount}元</View>
                         <View className='line'>报销人:{item.aname}</View>
                         <View className='line'>报销部门:{item.applyDepName}</View>
                         <View className='line'>报销时间:{item.createTimeStr}</View>
@@ -217,7 +321,7 @@ class Examine extends Component {
                         {
                           item.sonList?.map((it) =>
                             <View key={it.id} style={{ marginTop: 10 }}>
-                              <View className='line'>报销金额(元):{it.totalAmount}</View>
+                              <View className='line'>报销金额(元):{it.amount}</View>
                               <View className='line'>报销类型:
                                 {getAccountName(it.type, it.typeOther)}
                                 {it.type == 2 && (" - " + getSecondaryAccountName(it.secondaryType, it.secondaryTypeOther))}

+ 41 - 0
src/pages/mymerge/index.less

@@ -26,6 +26,47 @@
 
     .searchTop {
       z-index: 1000;
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+      justify-content: space-between;
+
+      .at-search-bar{
+        width: 70%;
+      }
+
+      .shortValuecontent {
+        position: relative;
+        display: flex;
+        align-items: center;
+        text-align: center;
+        width: 200px;
+        background: #6190E8;
+        border-radius: 100px;
+        padding: 10px 0;
+        margin-left: 10px;
+        font-size: 25px;
+        color: #FFFFFF;
+
+        .selectValue {
+          width: 100%;
+          text-align: center;
+          white-space: nowrap;
+        }
+
+        .selectTitle {
+          width: 100%;
+          text-align: center;
+        }
+
+        .iconContent {
+          position: absolute;
+          right: 0;
+          width: 60px;
+          text-align: center;
+        }
+      }
+
     }
 
     .searchBottom {

+ 5 - 0
src/utils/servers/servers.js

@@ -165,4 +165,9 @@ export const subMrge= (postData = {}) => {
 // 修改主报销
 export const subMainAccount = (postData = {}) => {
   return HTTPREQUEST.post('/api/admin/expenseAccount/updateMain', postData)
+}
+
+// 撤销已选抵扣
+export const updateDebitld = (postData = {}) => {
+  return HTTPREQUEST.post('/api/admin/expenseAccount/updateDebitId', postData)
 }