dev01 2 years ago
parent
commit
df2b31a443

+ 5 - 2
src/app.config.js

@@ -1,11 +1,14 @@
 export default {
   pages: [
     'pages/mybusiness/index', // 我的公出
-    'pages/login/index',//登录
+    'pages/login/index',// 登录
     'pages/applyReimbursement/index',// 申请报销
+    'pages/accountFrom/index', // 添加报销数据
     'pages/drafts/index', // 报销提交
-    'pages/myinfo/index', // 我的账户
+    'pages/dataindex/index', // 数据索引
+    'pages/draftsdetail/index', // 报销详情
     'pages/recordlist/index', // 报销记录
+    'pages/myinfo/index', // 我的账户
   ],
   tabBar: {
     list: [

+ 43 - 41
src/components/common/listBottomStart/index.jsx

@@ -22,36 +22,9 @@ class ListBottomStart extends Component {
   render() {
     const { state } = this.props;
     return (
-      this.props.type === 'pagination' ? <View className='listBottomStartComponent'>
-        {
-          state === 'RELOAD' ?
-            <View className='reload'>
-              <View>加载失败</View>
-              <View className='operation' onClick={() => {
-                this.props.reload && this.props.reload();
-              }}>点击重新加载</View>
-            </View> :
-            state === 'NO_DATA' ?
-              <View className='noData'>
-                <Image src={noData} className='noDataImg' />
-                <View className='noDataTitle'>暂时没有数据</View>
-              </View>
-              : <AtPagination
-                icon
-                total={this.props.total}
-                pageSize={this.props.pageSize}
-                current={this.props.current}
-                onPageChange={v => {
-                  this.props.onPageChange(v.type, v.current)
-                }}
-              />
-        }
-      </View> : <View className='listBottomStartComponent'>
-        {
-          state === 'NO_MORE_DATA' ?
-            <View className='noMoreData'>
-              没有更多了
-            </View> :
+      this.props.type === 'pagination'
+        ? <View className='listBottomStartComponent'>
+          {
             state === 'RELOAD' ?
               <View className='reload'>
                 <View>加载失败</View>
@@ -59,18 +32,47 @@ class ListBottomStart extends Component {
                   this.props.reload && this.props.reload();
                 }}>点击重新加载</View>
               </View> :
-              state === 'LOADING' ?
-                <View>
-                  <AtActivityIndicator content='加载中...' />
+              state === 'NO_DATA' ?
+                <View className='noData'>
+                  <Image src={noData} className='noDataImg' />
+                  <View className='noDataTitle'>暂时没有数据</View>
+                </View>
+                : <AtPagination
+                  icon
+                  total={this.props.total}
+                  pageSize={this.props.pageSize}
+                  current={this.props.current}
+                  onPageChange={v => {
+                    this.props.onPageChange(v.type, v.current)
+                  }}
+                />
+          }
+        </View>
+        : <View className='listBottomStartComponent'>
+          {
+            state === 'NO_MORE_DATA' ?
+              <View className='noMoreData'>
+                没有更多了
+              </View> :
+              state === 'RELOAD' ?
+                <View className='reload'>
+                  <View>加载失败</View>
+                  <View className='operation' onClick={() => {
+                    this.props.reload && this.props.reload();
+                  }}>点击重新加载</View>
                 </View> :
-                state === 'NO_DATA' ?
-                  <View className='noData'>
-                    <Image src={noData} className='noDataImg' />
-                    <View className='noDataTitle'>暂时没有数据</View>
-                  </View>
-                  : null
-        }
-      </View>
+                state === 'LOADING' ?
+                  <View>
+                    <AtActivityIndicator content='加载中...' />
+                  </View> :
+                  state === 'NO_DATA' ?
+                    <View className='noData'>
+                      <Image src={noData} className='noDataImg' />
+                      <View className='noDataTitle'>暂时没有数据</View>
+                    </View>
+                    : null
+          }
+        </View>
     )
   }
 }

+ 0 - 140
src/components/common/userquery/index.jsx

@@ -1,140 +0,0 @@
-import React, { Component } from "react";
-import { View, Button, Text } from "@tarojs/components";
-import { AtModal, AtModalContent, AtSearchBar, AtList, AtListItem } from "taro-ui";
-import { getadminByName } from "../../../utils/servers/servers";
-import { isOneself } from "../../../utils/tools"
-import './index.less';
-import "taro-ui/dist/style/components/modal.scss";
-import Taro from "@tarojs/taro";
-
-class UserQuery extends Component {
-  constructor(props) {
-    super(props);
-    this.state = {
-      value: "",
-      list: [],
-      listState: "NO_DATA",
-      pageNo: 1,
-      listVisible: false,
-      listValue: {},
-    };
-    this.onChange = this.onChange.bind(this);
-  }
-
-  onChange(value, lv = true) {
-    this.setState({
-      value,
-    });
-    if (value.length < 2 && !lv) {
-      Taro.showToast({ title: "最少输入两个字符", icon: "none" });
-      return;
-    }
-    if (value.length < 4 && lv) {
-      return;
-    }
-    this.getList(value);
-  }
-
-  getList(value = this.state.value, pageNo = 1) {
-    this.setState({
-      listState: "LOADING",
-    });
-    getadminByName({
-      adminName: value,
-      pageNo: pageNo,
-      pageSize: 10,
-    })
-      .then((msg) => {
-        if (msg.error.length === 0) {
-          this.setState({
-            list: msg.data
-          })
-        } else {
-          Taro.showToast({ title: msg.error[0].message, icon: "none" });
-          this.setState({
-            listState: msg.error[0].field === "403" ? "NO_DATA" : "RELOAD",
-          });
-        }
-      })
-      .catch(() => {
-        this.setState({
-          listState: "RELOAD",
-        });
-      });
-  }
-
-
-  render() {
-    //selList 本次共出的协单人或协单助手
-    //req是否调用接口添加   addClick接口
-    const { selList = [], coorderList, cList, req = false, addClick } = this.props
-    return (
-      <AtModal
-        isOpened={this.props.isOpened}
-        onClose={this.props.onDesc}
-      >
-        <AtModalContent>
-          <AtSearchBar
-            placeholder="请输入协单人/助手姓名"
-            showActionButton
-            value={this.state.value}
-            onChange={this.onChange}
-            onActionClick={() => {
-              this.onChange(this.state.value, false);
-            }}
-            onConfirm={() => {
-              this.onChange(this.state.value, false);
-            }}
-            onClear={() => {
-              this.setState({
-                value: "",
-                list: [],
-                listState: "NO_DATA",
-                pageNo: 1,
-                listVisible: false,
-              });
-            }}
-          />
-          <AtList>
-            {
-              this.state.list.map(v =>
-                <View key={v.id}>
-                  <AtListItem
-                    title={v.name}
-                    onClick={() => {
-                      if (coorderList.includes(v.id)) {
-                        Taro.showToast({ title: "你已经邀请过Ta了~", icon: "none" });
-                        return
-                      } else if (isOneself(v.id)) {
-                        Taro.showToast({ title: "你不能邀请自己哦~", icon: "none" });
-                        return
-                      } else if (selList.includes(v.id)) {
-                        Taro.showToast({ title: "本次公出已经邀请过Ta了", icon: "none" });
-                        return
-                      } else {
-                        if (req) {
-                          addClick(v.id)
-                        } else {
-                          coorderList.push(v.id);
-                          cList.push(v);
-                          this.props.setList(cList, coorderList);
-                          this.props.onDesc();
-                        }
-                      }
-                    }}
-                  />
-                </View>
-              )
-            }
-          </AtList>
-          <View
-            style={{ color: "red", margin: "20px auto 0", textAlign: "center" }}
-            onClick={this.props.onDesc}
-          >点击关闭弹窗</View>
-        </AtModalContent>
-      </AtModal>
-    );
-  }
-}
-
-export default UserQuery;

+ 0 - 4
src/components/common/userquery/index.less

@@ -1,4 +0,0 @@
-.main {
-  width: 90%;
-
-}

+ 3 - 0
src/pages/accountFrom/index.config.js

@@ -0,0 +1,3 @@
+export default {
+  navigationBarTitleText: '请完善报销信息',
+}

+ 301 - 0
src/pages/accountFrom/index.jsx

@@ -0,0 +1,301 @@
+import React, { Component } from "react";
+import Taro, { getCurrentInstance } from "@tarojs/taro";
+import { Text, Picker, View } from "@tarojs/components";
+import { AtInput, AtTextarea, AtButton, AtIcon } from "taro-ui";
+import { detailsAdd } from "../../utils/servers/servers";
+import "./index.less";
+
+class AccountFrom extends Component {
+  $instance = getCurrentInstance();
+
+  constructor(props) {
+    super(props);
+    this.state = {
+      type: 3,
+      data: {},
+      eaid: "",
+      list: [
+        { type: 0, postlist: ["amount"] },
+        { type: 2, postlist: ["agreeTimes", "amount"] },
+        {
+          type: 3, postlist: ["agreeTimes", "payType", "invoiceType",
+            "invoiceNo", "payerName", "openBank", "bankAccounts", "openBankAddress", "amount"]
+        },
+        { type: 4, postlist: ["agreeTimes", "amount"] },
+        { type: 5, postlist: ["agreeTimes", "amount"] },
+      ],
+      toast: [
+        { key: "agreeTimes", value: "请选择需付款时间!" },
+        { key: "invoiceType", value: "请选择发票类型!" }, { key: "invoiceNo", value: "请填写发票号!" },
+        { key: "payerName", value: "请填写付款单位!" }, { key: "openBank", value: "请填写开户银行!" },
+        { key: "bankAccounts", value: "请填写银行账户!" }, { key: "openBankAddress", value: "请填写开户行地址!" },
+        { key: "amount", value: "请填写金额!" },
+      ],
+    };
+
+  }
+
+  componentDidMount() {
+    this.setState({
+      type: this.$instance.router.params.type,
+      eaid: this.$instance.router.params.id,
+    })
+
+  }
+
+  getShow(type, name) {
+    const { list } = this.state
+    let display = "none"
+    for (var i = 0; i < list.length; i++) {
+      if (list[i].type == type) {
+        for (var j = 0; j < list[i].postlist.length; j++) {
+          if (list[i].postlist[j] == name) {
+            display = "block"
+          }
+        }
+      }
+    }
+    return display
+  }
+
+  onSubmit() {
+    const { data, eaid, type, list, toast } = this.state
+    // 校验必填
+    for (var i = 0; i < list.length; i++) {
+      if (list[i].type == type) {
+        let newList = list[i].postlist
+        for (var j = 0; j < newList.length; j++) {
+          for (var k = 0; k < toast.length; k++) {
+            if (newList[j] == toast[k].key && !data[newList[j]] && data[newList[j]] != 0) {
+              Taro.showToast({
+                title: toast[k].value,
+                icon: "none",
+              });
+              return
+            }
+          }
+        }
+      }
+    }
+
+    let obj = {
+      ...data,
+      ...{ eaid, type, }
+    }
+    this.setState({
+      loading: true,
+    });
+    detailsAdd(obj)
+      .then((v) => {
+        this.setState({
+          loading: false,
+        });
+        if (v.error.length === 0) {
+          Taro.showToast({
+            title: "保存成功!",
+            icon: "none",
+          });
+          const _this = this
+          setTimeout(function () {
+            Taro.navigateBack();
+            _this.setState({
+              loading: false,
+            });
+          }, 400);
+        } else {
+          Taro.showToast({
+            title: v.error[0].message,
+            icon: "none",
+          });
+        }
+      })
+      .catch(() => {
+        this.setState({
+          loading: false,
+        });
+      });
+  }
+
+  render() {
+    const { type, data } = this.state
+    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>
+            <Picker
+              mode='date'
+              onChange={(e) => {
+                let obj = { agreeTimes: e.detail.value }
+                this.setState({ data: { ...data, ...obj } })
+              }}
+            >
+              <View className='picker'>
+                {!data.agreeTimes ? <View className="ifvalues">点击选择</View> : <View className="ifvalue">{data.agreeTimes}</View>}
+              </View>
+            </Picker>
+          </View>
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "payType") }}>
+          <View className="ifCustom">
+            <View className="iftitle">付款方式:</View>
+            <Picker
+              value={data.payType}
+              range={["公对公转账"]} mode='selector'
+              onChange={e => {
+                const obj = { payType: e.detail.value }
+                this.setState({
+                  data: { ...data, ...obj }
+                })
+              }}
+            >
+              {
+                data.payType == 0
+                  ? <View className="ifvalue">公对公转账户</View>
+                  : <View className="ifvalues">点击选择</View>
+              }
+            </Picker>
+          </View>
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "invoiceType") }}>
+          <View className="ifCustom">
+            <View className="iftitle">发票类型:</View>
+            <Picker
+              value={data.invoiceType}
+              range={pickerList} mode='selector'
+              onChange={e => {
+                const obj = { invoiceType: e.detail.value }
+                this.setState({
+                  data: { ...data, ...obj }
+                })
+              }}
+            >
+              {
+                data.invoiceType == 0
+                  ? <View className="ifvalue">普票</View> : data.invoiceType == 1
+                    ? <View className="ifvalue">专票</View> : <View className="ifvalues">点击选择</View>
+              }
+            </Picker>
+          </View>
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "invoiceNo") }}>
+          <AtInput
+            name='invoiceNo'
+            title='发票号:'
+            type='text'
+            placeholder='请填写发票号'
+            value={data.invoiceNo}
+            onChange={e => {
+              const obj = { invoiceNo: e }
+              this.setState({
+                data: { ...data, ...obj }
+              })
+            }}
+          />
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "payerName") }}>
+          <AtInput
+            name='payerName'
+            title='付款单位:'
+            type='text'
+            placeholder='请填写付款单位'
+            value={data.payerName}
+            onChange={e => {
+              const obj = { payerName: e }
+              this.setState({
+                data: { ...data, ...obj }
+              })
+            }}
+          />
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "openBank") }}>
+          <AtInput
+            name='openBank'
+            title='开户银行:'
+            type='text'
+            placeholder='请填写开户银行'
+            value={data.openBank}
+            onChange={e => {
+              const obj = { openBank: e }
+              this.setState({
+                data: { ...data, ...obj }
+              })
+            }}
+          />
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "bankAccounts") }}>
+          <AtInput
+            name='bankAccounts'
+            title='银行账户:'
+            type='text'
+            placeholder='请填写银行账户'
+            value={data.bankAccounts}
+            onChange={e => {
+              const obj = { bankAccounts: e }
+              this.setState({
+                data: { ...data, ...obj }
+              })
+            }}
+          />
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "openBankAddress") }}>
+          <AtInput
+            name='openBankAddress'
+            title='开户行地址:'
+            type='text'
+            placeholder='请填写开户行地址'
+            value={data.openBankAddress}
+            onChange={e => {
+              const obj = { openBankAddress: e }
+              this.setState({
+                data: { ...data, ...obj }
+              })
+            }}
+          />
+        </View>
+        <View className="inputFormItem" style={{ display: this.getShow(type, "amount") }}>
+          <AtInput
+            name='amount'
+            title={type == 4 ? "借支金额:" : "金额:"}
+            type='number'
+            placeholder='请填写金额(元)'
+            value={data.amount}
+            onChange={e => {
+              const obj = { amount: e }
+              this.setState({
+                data: { ...data, ...obj }
+              })
+            }}
+          />
+        </View>
+        <View className="bottom">
+          <AtButton
+            loading={this.state.loading}
+            disabled={this.state.loading}
+            type="primary"
+            circle
+            onClick={() => {
+              this.onSubmit()
+            }}
+          >
+            保存
+          </AtButton>
+        </View>
+      </View>
+    );
+  }
+}
+
+export default AccountFrom;

+ 57 - 0
src/pages/accountFrom/index.less

@@ -0,0 +1,57 @@
+.accountFrom {
+  padding: 30px;
+
+  .textareaFormItem{
+    margin-bottom: 10px;
+  }
+
+  .inputFormItem {
+
+    .ifCustom {
+      position: relative;
+      display: flex;
+      flex-direction: row;
+      padding: 24px 0;
+      color: #333;
+      background-color: #FFF;
+      margin-bottom: 1PX;
+      position: relative;
+      border-bottom: 1px solid rgba(212, 225, 235, 0.5);
+
+      .iftitle {
+        margin-right: 16px;
+        width: 172px;
+        font-size: 32px;
+        line-height: 1.5;
+        vertical-align: middle;
+        text-align: left;
+
+      }
+
+      .ifvalue {
+        width: 500px;
+        line-height: 1.5;
+
+      }
+
+      .ifvalues {
+        width: 500px;
+        color: #CCC;
+        line-height: 1.5;
+
+      }
+
+    }
+
+  }
+
+  .bottom {
+    margin: 40px auto;
+
+  }
+
+}
+
+.at-input {
+  margin-left: 0;
+}

+ 10 - 6
src/pages/applyReimbursement/select.jsx

@@ -19,8 +19,12 @@ class Select extends Component {
     };
   }
 
-  componentDidShow() {
-    const { } = this.state
+  componentDidMount() {
+    const { type, other } = this.props
+    this.setState({
+      type,
+      other
+    })
   }
 
   handleChange(e) {
@@ -35,7 +39,6 @@ class Select extends Component {
     })
   }
 
-
   creatOrder() {
     const { prid, onClose } = this.props
     const { type, other, } = this.state
@@ -49,7 +52,6 @@ class Select extends Component {
         Taro.redirectTo({
           url: '/pages/drafts/index?id=' + v.data
         })
-        console.log("000")
       } else {
         Taro.showToast({ title: v.error[0].message, icon: 'none' })
       }
@@ -63,7 +65,7 @@ class Select extends Component {
 
 
   render() {
-    const { visible = "", onClose } = this.props
+    const { visible = "", onClose, noPost = false, onOk } = this.props
     const { type, other } = this.state
     return (
       <AtModal
@@ -102,7 +104,9 @@ class Select extends Component {
                 icon: 'none'
               })
             } else {
-              this.creatOrder()
+              noPost
+                ? this.creatOrder()
+                : onOk(type, other)
             }
           }}>确定</Button>
         </AtModalAction>

+ 3 - 0
src/pages/dataindex/index.config.js

@@ -0,0 +1,3 @@
+export default {
+  navigationBarTitleText: '修改/报销至订单',
+}

+ 259 - 0
src/pages/dataindex/index.jsx

@@ -0,0 +1,259 @@
+import React, { Component } from "react";
+import Taro from "@tarojs/taro";
+import { Text, View } from "@tarojs/components";
+import { AtSearchBar, AtListItem, AtButton, AtIcon } from "taro-ui";
+import { getUserByName, getOrderByUid } from "../../utils/servers/servers";
+import "taro-ui/dist/style/components/search-bar.scss";
+import "taro-ui/dist/style/components/button.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import "taro-ui/dist/style/components/list.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import ListBottomStart from "../../components/common/listBottomStart";
+
+// import "../drafts/index.less";
+
+class DataIndex extends Component {
+  constructor(props) {
+    super(props);
+    this.state = {
+      value: "",
+      list: [],
+      listState: "NO_DATA",
+      pageNo: 1,
+      listVisible: false,
+    };
+    this.onChange = this.onChange.bind(this);
+    this.getList = this.getList.bind(this);
+  }
+
+  componentDidMount() {
+    // Taro.eventCenter.on("result", () => {
+    //   this.setState({
+    //     value: "",
+    //     list: [],
+    //     newList: [],
+    //     listState: "NO_DATA",
+    //     pageNo: 1,
+    //   });
+    // });
+    // Taro.eventCenter.on("applyDepartSearchList", () => {
+    //   this.getList(this.state.value, this.state.pageNo + 1);
+    // });
+  }
+
+  onReachBottom() {
+    this.getList(this.state.value, this.state.pageNo + 1);
+  }
+
+  onChange(value, lv = true) {
+    this.setState({
+      value,
+    });
+    if (value.length < 2 && !lv) {
+      Taro.showToast({ title: "最少输入两个字符", icon: "none" });
+      return;
+    }
+    if (value.length < 4 && lv) {
+      return;
+    }
+    this.getList(value);
+  }
+
+  getByUid(val) {
+    this.setState({
+      listState: "LOADING",
+    });
+    getOrderByUid({
+      uid: val.id,
+    }).then((msg) => {
+      if (msg.error.length === 0) {
+        let data = msg.data;
+        this.setState({
+          listState: "NO_MORE_DATA",
+          orderNo: data,
+          listVisible: true,
+          listValue: val,
+        });
+      } else {
+        Taro.showToast({ title: msg.error[0].message, icon: "none" });
+        this.setState({
+          listState: msg.error[0].field === "403" ? "NO_DATA" : "RELOAD",
+        });
+      }
+    });
+  }
+
+  getList(value = this.state.value, pageNo = 1) {
+    this.setState({
+      listState: "LOADING",
+    });
+    getUserByName({
+      name: value,
+      type: 1,
+      pageNo: pageNo,
+      pageSize: 20,
+    })
+      .then((msg) => {
+        if (msg.error.length === 0) {
+          if (msg.data.totalCount === 0) {
+            this.setState({
+              listState: "NO_DATA",
+            });
+          } else if (
+            msg.data.totalCount === this.state.list.length &&
+            pageNo !== 1
+          ) {
+            Taro.showToast({ title: "没有更多数据了", icon: "none" });
+            this.setState({
+              listState: "NO_MORE_DATA",
+            });
+          } else {
+            if (
+              msg.data.totalCount ===
+              (pageNo === 1
+                ? msg.data.list
+                : this.state.list.concat(msg.data.list)
+              ).length
+            ) {
+              this.setState({
+                listState: "NO_MORE_DATA",
+              });
+            }
+          }
+          this.setState({
+            list:
+              pageNo === 1
+                ? msg.data.list
+                : this.state.list.concat(msg.data.list),
+            pageNo: msg.data.pageNo,
+          });
+        } else {
+          Taro.showToast({ title: msg.error[0].message, icon: "none" });
+          this.setState({
+            listState: msg.error[0].field === "403" ? "NO_DATA" : "RELOAD",
+          });
+        }
+      })
+      .catch(() => {
+        this.setState({
+          listState: "RELOAD",
+        });
+      });
+  }
+
+
+  render() {
+    const { } = this.state
+    return (
+      <>
+        <AtSearchBar
+          placeholder="请输入企业名称"
+          showActionButton
+          value={this.state.value}
+          onChange={this.onChange}
+          onActionClick={() => {
+            this.setState({
+              listVisible: false,
+            });
+            this.onChange(this.state.value, false);
+          }}
+          onConfirm={() => {
+            this.onChange(this.state.value, false);
+          }}
+          onClear={() => {
+            this.setState({
+              value: "",
+              list: [],
+              listState: "NO_DATA",
+              pageNo: 1,
+              listVisible: false,
+            });
+          }}
+        />
+        <View>
+          {!this.state.listVisible &&
+            this.state.list.map((v, k) => (
+              <View key={k}>
+                <AtListItem
+                  title={v.name}
+                  arrow="right"
+                  iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+                  onClick={() => {
+                    this.getByUid(v);
+                  }}
+                />
+              </View>
+            ))}
+          {this.state.listVisible &&
+            <View>
+              <AtListItem
+                title={this.state.listValue.name}
+                arrow="right"
+                iconInfo={{ size: 25, color: "#000000", value: "bookmark" }}
+              />
+              <View style={{ marginTop: "10px" }}>
+                {this.state.orderNo.length > 0 ? (
+                  <View>
+                    {this.state.orderNo.map((v, k) => (
+                      <View
+                        key={k}
+                        style={{
+                          display: "flex",
+                          justifyContent: " center",
+                          marginBottom: "20px",
+                        }}
+                      >
+                        编号:<View>{v.contractNo}</View>
+                        <View
+                          style={{
+                            width: "60px",
+                            height: "24px",
+                            backgroundColor: "#5599FF",
+                            borderRadius: "15px",
+                            textAlign: "center",
+                            lineHeight: "24px",
+                            marginLeft: "20px",
+                            color: "white",
+                          }}
+                          circle
+                          onClick={() => {
+                            let pages = Taro.getCurrentPages();
+                            let prevPage = pages[pages.length - 2];
+                            prevPage.setData({
+                              name: this.state.listValue.name,
+                              contractNo: v.contractNo,
+                              orderNo: v.orderNo,
+                            });
+                            Taro.navigateBack({
+                              delta: 1
+                            })
+                          }}
+                        >
+                          选择
+                        </View>
+                      </View>
+                    ))}{" "}
+                    <View style={{ color: "red", textAlign: "center" }}>
+                      注:请搜索订单对应的企业名称
+                    </View>
+                  </View>
+                ) : (
+                  <View style={{ color: "red", textAlign: "center" }}>
+                    该企业暂无订单
+                  </View>
+                )}
+              </View>
+            </View>}
+          <ListBottomStart
+            state={this.state.listState}
+            reload={() => {
+              this.onChange(this.state.value);
+            }}
+          />
+        </View>
+      </>
+    );
+  }
+}
+
+export default DataIndex;

+ 453 - 166
src/pages/drafts/index.jsx

@@ -1,18 +1,29 @@
 import React, { Component } from "react";
 import Taro, { getCurrentInstance } from "@tarojs/taro";
-import { Button, Text, View } from "@tarojs/components";
+import { Button, Picker, Text, View } from "@tarojs/components";
 import dayjs from "dayjs";
-import "./index.less";
 import ImagePicker from "../../components/common/imagePicker";
 import InquiryModal from "../../components/common/inquiryModal";
 import AccountModal from "../../components/common/accountModal";
-import { AtButton, AtInput, AtModal, AtModalHeader, AtModalContent, AtRadio, AtModalAction } from "taro-ui";
+import Select from "../applyReimbursement/select";
+import {
+  AtButton,
+  AtInput,
+  AtModal,
+  AtTextarea,
+  AtModalHeader,
+  AtModalContent,
+  AtRadio,
+  AtModalAction,
+  AtIcon,
+} from "taro-ui";
 import {
   getPridDetail,
   getAccountList,
   selectList,
   detailsDelete,
   subAccount,
+  getDepartmentList,
 } from "../../utils/servers/servers";
 import {
   getNumHourse,
@@ -27,7 +38,6 @@ import "taro-ui/dist/style/components/form.scss";
 import "taro-ui/dist/style/components/button.scss";
 import "taro-ui/dist/style/components/loading.scss";
 import "taro-ui/dist/style/components/icon.scss";
-import "taro-ui/dist/style/components/icon.scss";
 import "taro-ui/dist/style/components/textarea.scss";
 import "taro-ui/dist/style/components/input.scss";
 
@@ -46,15 +56,20 @@ class Drafts extends Component {
       list: [],
       total: 0,
       accountvisible: "",
+      typeVisible: "",
       bankData: {},
       upaccount: false,
       accountsList: [],
+      attachmentUrl: [],
+      orderName: "",
+      contractNo: "",
     };
     this.onChange = this.onChange.bind(this);
     this.getNumHourse = this.getNumHourse.bind(this);
   }
 
   componentDidMount() {
+    this.getDepartmentList()
     this.$instance.router.params && this.$instance.router.params.id &&
       (
         this.getDetail(),
@@ -63,6 +78,48 @@ class Drafts extends Component {
       )
   }
 
+  componentDidShow() { // 对应onShow,只有在onShow中才会监听到当前页面的改变
+    let pages = Taro.getCurrentPages();
+    let currPage = pages[pages.length - 1]; // 获取当前页面
+    this.setState({
+      orderName: currPage.data.name,
+      contractNo: currPage.data.contractNo,
+      orderNo: currPage.data.orderNo,
+    })
+    this.getAccountList();
+
+  }
+
+  // 部门数据
+  getDepartmentList() {
+    getDepartmentList({}).then(v => {
+      let thedata = v.data;
+      let theArr = [];
+      if (!thedata) {
+        if (v.error && v.error.length) {
+          Taro.showToast({ title: v.error[0].message, icon: 'none' })
+        }
+      } else {
+        thedata.map(function (item, index) {
+          theArr.push({
+            key: index,
+            name: item.name,
+            id: item.id
+          });
+        });
+      }
+      this.setState({
+        departmentArr: theArr
+      });
+    }).catch(() => {
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
+
+  // 图片上传操作
   onChange(value, type) {
     let arr = this.state.imgs.concat([]);
     if (type === "add") {
@@ -79,18 +136,69 @@ class Drafts extends Component {
 
   }
 
+  // 取消添加
   onAccountClose() {
     this.setState({
       accountvisible: "",
     })
   }
 
+  // 添加收款账户
   onAccountOk() {
     this.setState({
       accountvisible: "",
     }, () => { this.getMyList() })
   }
 
+  // 类型修改 取消
+  onTypeClose() {
+    this.setState({
+      typeVisible: "",
+    })
+  }
+
+  // 类型修改 确定
+  onTypeOk(type, typeOther) {
+    const oldType = this.state.data.type
+    const oldTypeOther = this.state.data.typeOther
+    if ((oldType == type) && (typeOther == oldTypeOther)) {
+      this.setState({
+        typeVisible: "",
+      })
+    } else {
+      let data = {
+        updateType: 1,
+        id: this.$instance.router.params.id,
+        type,
+        typeOther,
+      }
+      subAccount(removeNull(data))
+        .then((v) => {
+          if (v.error.length === 0) {
+            this.getAccountList()
+            // 手动刷新
+            const obj = { type, typeOther }
+            this.setState({
+              data: { ...this.state.data, ...obj },
+              typeVisible: "",
+            })
+            Taro.showToast({
+              title: "修改成功!",
+              icon: "none",
+            });
+          } else {
+            Taro.showToast({
+              title: v.error[0].message,
+              icon: "none",
+            });
+          }
+        })
+        .catch(() => {
+
+        });
+    }
+  }
+
   // 费用弹窗
   onClose() {
     this.setState({
@@ -131,6 +239,7 @@ class Drafts extends Component {
     })
   }
 
+  // 确认收款账户
   selectOn() {
     let list = this.state.accountsList
     for (var i = 0; i < list.length; i++) {
@@ -215,44 +324,48 @@ class Drafts extends Component {
 
   onSubmit() {
     const { data, bankData } = this.state
-    if (!data.userNames) {
-      Taro.showToast({ title: "请填写公出客户名称", icon: "none" });
-      return;
-    }
-    if (!data.districtName) {
-      Taro.showToast({ title: "请填写公出地点", icon: "none" });
-      return;
-    }
-    if (!this.state.rangeStartMinuteVal) {
-      Taro.showToast({ title: "请选择公出时间", icon: "none" });
-      return;
-    }
-    if (!this.state.rangeEndMinuteVal) {
-      Taro.showToast({ title: "请选择公出时间", icon: "none" });
-      return;
+    if (data.type == 0) {
+      if (!data.userNames) {
+        Taro.showToast({ title: "请填写公出客户名称", icon: "none" });
+        return;
+      }
+      if (!data.districtName) {
+        Taro.showToast({ title: "请填写公出地点", icon: "none" });
+        return;
+      }
+      if (!this.state.rangeStartMinuteVal) {
+        Taro.showToast({ title: "请选择公出时间", icon: "none" });
+        return;
+      }
+      if (!this.state.rangeEndMinuteVal) {
+        Taro.showToast({ title: "请选择公出时间", icon: "none" });
+        return;
+      }
     }
+
     this.setState({
       loading: true,
     });
-    let datas = {
+    let comData = {
+      updateType: 0,
       id: this.$instance.router.params.id,
       status: 1,  // 提交审核
-      type: data.type,
-      typeOther: data.typeOther,
-      userNames: data.userNames,
-      districtName: data.districtName,
-      releaseStart: this.state.rangeStartMinuteVal,
-      releaseEnd: this.state.rangeEndMinuteVal,
-      duration: this.state.totalDuration,
-      orderNo: data.orderNo,
-      applyDep: data.applyDep,
-      payDep: data.payDep,
-      attachmentUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
-      eaaid: bankData.id,
-    };
-    console.log("-----", datas)
-    // return
-    subAccount(removeNull(datas))
+      type: data.type, // 报销类型
+      typeOther: data.type == 0 ? data.typeOther : undefined, // 其他类型
+      remarks: data.remarks, // 报销事由
+      applyDep: data.applyDep, // 申请部门
+      attachmentUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","), // 附件
+      payDep: (data.type == 4 || data.type == 5) ? undefined : data.payDep, // 支付部门(借支抵扣不需要)
+      orderNo: (data.type == 4 || data.type == 5) ? undefined : data.orderNo, // 支付部门(借支抵扣不需要)
+      eaaid: data.type != 3 ? bankData.id : undefined, // 报销账户(第三方付款不需要)
+      // 差旅费
+      userNames: data.type == 1 ? data.userNames : undefined, // 公出客户名称
+      districtName: data.type == 1 ? data.districtName : undefined, // 公出地点
+      releaseStart: data.type == 1 ? this.state.rangeStartMinuteVal : undefined, // 开始时间
+      releaseEnd: data.type == 1 ? this.state.rangeEndMinuteVal : undefined, // 结束时间
+      duration: data.type == 1 ? this.state.totalDuration : undefined, // 公出时长
+    }
+    subAccount(removeNull(comData))
       .then((v) => {
         this.setState({
           loading: false,
@@ -330,102 +443,123 @@ class Drafts extends Component {
 
 
   render() {
-    const { data, list, total, bankData, } = this.state
+    const { data, list, total, bankData, attachmentUrl } = this.state
+    const departmentArr = this.state.departmentArr || [];
     return (
       <View className="subform">
-        <View className="title">{[data.typeOther, "差旅费报销", "餐费报销", "第三方付款", "申请预借支"][data.type]}</View>
-        <View className="inputFormItem">
-          <AtInput
-            name='userNames'
-            title='公出企业:'
-            type='text'
-            placeholder='请填写公出企业'
-            value={data.userNames}
-            onChange={e => { data.userNames = e }}
-          />
-        </View>
-        <View className="inputFormItem">
-          <AtInput
-            name='districtName'
-            title='公出地点:'
-            type='text'
-            placeholder='请填写公出地点'
-            value={data.districtName}
-            onChange={e => { data.districtName = e }}
-          />
-        </View>
+        <View className="title">{getAccountName(data.type, data.typeOther)}</View>
+        {data.type == 1 &&
+          <View className="inputFormItem">
+            <AtInput
+              name='userNames'
+              title='公出企业:'
+              type='text'
+              placeholder='请填写公出企业'
+              value={data.userNames}
+              onChange={e => { data.userNames = e }}
+            />
+          </View>}
+        {data.type == 1 &&
+          <View className="inputFormItem">
+            <AtInput
+              name='districtName'
+              title='公出地点:'
+              type='text'
+              placeholder='请填写公出地点'
+              value={data.districtName}
+              onChange={e => { data.districtName = e }}
+            />
+          </View>}
+        {data.type == 1 &&
+          <View className="formItem">
+            <View className="formName">公出时间:</View>
+            <View className="formValue">
+              <View
+                className="time"
+                onClick={() => {
+                  this.setState({
+                    isPickerRender: true,
+                  });
+                }}
+              >
+                {this.state.rangeStartMinuteVal &&
+                  this.state.rangeEndMinuteVal ? (
+                  <View className="timeContent">
+                    <View style={{ textAlign: "center" }}>{this.state.rangeStartMinuteVal}</View>
+                    &nbsp;&nbsp;至&nbsp;&nbsp;
+                    <View style={{ textAlign: "center" }}>{this.state.rangeEndMinuteVal}</View>
+                  </View>
+                ) : (
+                  "请选择时间"
+                )}
+              </View>
+              <timePicker
+                config={{
+                  endDate: true,
+                  column: "minute",
+                  dateLimit: false,
+                  limitStartTime: dayjs()
+                    .subtract(3, "year")
+                    .format("YYYY-MM-DD HH:mm:ss"),
+                  limitEndTime: dayjs()
+                    .add(3, "year")
+                    .format("YYYY-MM-DD HH:mm:ss"),
+                }}
+                isPartition
+                pickerShow={this.state.isPickerRender}
+                onconditionaljudgment={(v) => {
+                  let a = dayjs(
+                    dayjs(v.detail.endTime)
+                      .second(0)
+                      .format("YYYY-MM-DD HH:mm:ss")
+                  );
+                }}
+                onhidepicker={() => {
+                  this.onPickerHide();
+                }}
+                onsetpickertime={(v) => {
+                  this.onSetPickerTime(v);
+                }}
+              />
+            </View>
+          </View>}
+        {data.type == 1 &&
+          <View className="formItem">
+            <View className="formName">公出时长:</View>
+            <View className="formValue">{this.state.totalDuration}小时</View>
+          </View>}
         <View className="formItem">
-          <View className="formName">公出时间:</View>
-          <View className="formValue">
-            <View
-              className="time"
-              onClick={() => {
+          <View className="formName">申请类型:</View>
+          <View className="formValue" onClick={() => {
+            this.setState({
+              isInquiryOpened: true,
+              inquiryTitle: "温馨提示",
+              inquiryContent: "您是否需要重新选择费用类型?原报销数据将清空后,需重新填写!!!",
+              inquiryFn: () => {
                 this.setState({
-                  isPickerRender: true,
-                });
-              }}
-            >
-              {this.state.rangeStartMinuteVal &&
-                this.state.rangeEndMinuteVal ? (
-                <View className="timeContent">
-                  <View style={{ textAlign: "center" }}>{this.state.rangeStartMinuteVal}</View>
-                  &nbsp;&nbsp;至&nbsp;&nbsp;
-                  <View style={{ textAlign: "center" }}>{this.state.rangeEndMinuteVal}</View>
-                </View>
-              ) : (
-                "请选择时间"
-              )}
-            </View>
-            <timePicker
-              config={{
-                endDate: true,
-                column: "minute",
-                dateLimit: false,
-                limitStartTime: dayjs()
-                  .subtract(3, "year")
-                  .format("YYYY-MM-DD HH:mm:ss"),
-                limitEndTime: dayjs()
-                  .add(3, "year")
-                  .format("YYYY-MM-DD HH:mm:ss"),
-              }}
-              isPartition
-              pickerShow={this.state.isPickerRender}
-              onconditionaljudgment={(v) => {
-                let a = dayjs(
-                  dayjs(v.detail.endTime)
-                    .second(0)
-                    .format("YYYY-MM-DD HH:mm:ss")
-                );
-                // let b = dayjs(dayjs().second(0).format("YYYY-MM-DD HH:mm:ss"));
-                // if (a.isBefore(b)) {
-                //   Taro.showToast({
-                //     title: "结束时间不能小于当前时间",
-                //     icon: "none",
-                //   });
-                //   v.detail.setLv(false);
-                // }
-              }}
-              onhidepicker={() => {
-                this.onPickerHide();
-              }}
-              onsetpickertime={(v) => {
-                this.onSetPickerTime(v);
-              }}
-            />
+                  typeVisible: "edit"
+                })
+              },
+            });
+          }}>
+            {getAccountName(data.type, data.typeOther)}
+            <AtIcon value="chevron-right" size="20" color="#000000" />
           </View>
         </View>
         <View className="formItem">
-          <View className="formName">公出时长:</View>
-          <View className="formValue">{this.state.totalDuration}小时</View>
-        </View>
-        <View className="formItem">
-          <View className="formName">申请类型:</View>
-          <View className="formValue">{getAccountName(data.type, data.typeOther)}</View>
-        </View>
-        {/* <View className="formItem">
           <View className="formName">报销至订单:</View>
-          <View className="formValue"></View>
-        </View> */}
+          <View className="formValue" onClick={() => {
+            Taro.navigateTo({
+              url: "/pages/dataindex/index"
+            })
+          }}>
+            <View>
+              <View>{this.state.orderName}</View>
+              <View>{this.state.contractNo}</View>
+            </View>
+            <AtIcon value="chevron-right" size="20" color="#000000" />
+          </View>
+        </View>
         <View className="formTitle">
           报销详细
         </View>
@@ -433,19 +567,72 @@ class Drafts extends Component {
           <View className="formName">申请人:</View>
           <View className="formValue">{data.aname}</View>
         </View>
+        {
+          data.type != 4 && data.type != 5 &&
+          <View className="formItem">
+            <View className="formName">报销公司:</View>
+            <View className="formValue">
+              <Picker
+                value={departmentArr.findIndex(item => item.id === data.applyDep)}
+                range={departmentArr} rangeKey='name' mode='selector'
+                onChange={(e) => {
+                  const obj = { applyDep: departmentArr[e.detail.value].id, appDepName: departmentArr[e.detail.value].name }
+                  this.setState({
+                    data: { ...data, ...obj },
+                  })
+                }}>
+                <View>
+                  {data.appDepName}
+                  <AtIcon value="chevron-right" size="20" color="#000000" />
+                </View>
+              </Picker>
+            </View>
+          </View>
+        }
         <View className="formItem">
-          <View className="formName">报销公司:</View>
-          <View className="formValue">{data.appDepName}</View>
+          <View className="formName">支付公司:</View>
+          <View className="formValue">
+            <Picker
+              value={departmentArr.findIndex(item => item.id === data.payDep)}
+              range={departmentArr} rangeKey='name' mode='selector'
+              onChange={(e) => {
+                const obj = { payDep: departmentArr[e.detail.value].id, payDepName: departmentArr[e.detail.value].name }
+                this.setState({
+                  data: { ...data, ...obj },
+                })
+              }}>
+              <View>
+                {data.payDepName}
+                <AtIcon value="chevron-right" size="20" color="#000000" />
+              </View>
+            </Picker>
+          </View>
         </View>
         <View className="formItem">
-          <View className="formName">支付公司:</View>
-          <View className="formValue">{data.payDepName}</View>
+          <View className="formName">报销事由:</View>
+          <View className="formValues">
+            <AtTextarea
+              value={data.remarks == null ? "" : data.remarks}
+              onChange={e => {
+                const obj = { remarks: e }
+                this.setState({
+                  data: { ...data, ...obj }
+                })
+              }}
+              maxLength={30}
+              placeholder="请填写报销事由"
+            />
+          </View>
         </View>
         <View className="formTitle">
           报销费用详细
           <Button className="ftBottom" size='mini' type='primary'
             onClick={() => {
-              this.setState({ visible: "add" })
+              data.type == 1
+                ? this.setState({ visible: "add" })
+                : Taro.navigateTo({
+                  url: `/pages/accountFrom/index?type=${data.type}&id=${this.$instance.router.params.id}`
+                })
             }}>+ 增加</Button>
         </View>
         {this.state.visible != "" &&
@@ -454,9 +641,76 @@ class Drafts extends Component {
             visible={this.state.visible}
             onClose={this.onClose.bind(this)}
           />}
-        {list?.map(item =>
-          item.type == 1
-            ? <View className="unItem" key={item.id}>
+        {/* 差旅费显示 */}
+        {data.type == 1 &&
+          list?.map(item =>
+            item.type == 1
+              ? <View className="unItem" key={item.id}>
+                <View className="close"
+                  onClick={() => {
+                    this.setState({
+                      isInquiryOpened: true,
+                      inquiryTitle: "提醒",
+                      inquiryContent: "您确定要删除吗?",
+                      inquiryFn: () => {
+                        this.detailsDelete(item.id);
+                      },
+                    });
+                  }}
+                >删除</View>
+                {/* <View className="edit">编辑</View> */}
+                <View className="formItem">
+                  <View className="formName">交通工具:</View>
+                  <View className="formValue">{getVehicleName(item.vehicle, item.vehicleOther)}</View>
+                </View>
+                <View className="formItem">
+                  <View className="formName">时间:</View>
+                  <View className="formValue">
+                    <View className="ftxt">{item.startTimeStr}</View>
+                    &nbsp;&nbsp;至&nbsp;&nbsp;
+                    <View className="ftxt">{item.endTimeStr}</View>
+                  </View>
+                </View>
+                <View className="formItem">
+                  <View className="formName">地点:</View>
+                  <View className="formValue">
+                    <View className="ftxt">{item.startDistrict}</View>
+                    &nbsp;&nbsp;至&nbsp;&nbsp;
+                    <View className="ftxt">{item.endDistrict}</View>
+                  </View>
+                </View>
+                <View className="formItem">
+                  <View className="formName">金额:</View>
+                  <View className="formValue">{item.amount}(元)</View>
+                </View>
+              </View>
+              : <View className="inputFormItems" key={item.id}>
+                <AtInput
+                  name={item.id}
+                  title={getTypeName(item.type) + ":"}
+                  type='number'
+                  placeholder='请输入金额(元)'
+                  value={item.amount}
+                />
+                (元)
+                <View className="close"
+                  onClick={() => {
+                    this.setState({
+                      isInquiryOpened: true,
+                      inquiryTitle: "提醒",
+                      inquiryContent: "您确定要删除吗?",
+                      inquiryFn: () => {
+                        this.detailsDelete(item.id);
+                      },
+                    });
+                  }}
+                >删除</View>
+              </View>)
+        }
+        {/* 通用 */}
+        {(data.type == 0 || data.type == 2 || data.type == 4 || data.type == 5) &&
+          list?.map(item =>
+            <View className="unItem" key={item.id}>
               <View className="close"
                 onClick={() => {
                   this.setState({
@@ -469,42 +723,22 @@ class Drafts extends Component {
                   });
                 }}
               >删除</View>
-              <View className="edit">编辑</View>
-              <View className="formItem">
-                <View className="formName">交通工具:</View>
-                <View className="formValue">{getVehicleName(item.vehicle, item.vehicleOther)}</View>
-              </View>
+              {/* <View className="edit">编辑</View> */}
               <View className="formItem">
-                <View className="formName">时间:</View>
-                <View className="formValue">
-                  <View className="ftxt">{item.startTimeStr}</View>
-                  &nbsp;&nbsp;至&nbsp;&nbsp;
-                  <View className="ftxt">{item.endTimeStr}</View>
-                </View>
-              </View>
-              <View className="formItem">
-                <View className="formName">地点:</View>
-                <View className="formValue">
-                  <View className="ftxt">{item.startDistrict}</View>
-                  &nbsp;&nbsp;至&nbsp;&nbsp;
-                  <View className="ftxt">{item.endDistrict}</View>
-                </View>
+                <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.amount}(元)</View>
               </View>
             </View>
-            : <View className="inputFormItems" key={item.id}>
-              <AtInput
-                name={item.id}
-                title={getTypeName(item.type) + ":"}
-                type='number'
-                placeholder='请输入金额(元)'
-                value={item.amount}
-              // onChange={e => { console.log("---", e) }}
-              />
-              (元)
+          )
+        }
+        {/* 第三方付款 */}
+        {data.type == 3 &&
+          list?.map(item =>
+            <View className="unItem" key={item.id}>
               <View className="close"
                 onClick={() => {
                   this.setState({
@@ -517,7 +751,50 @@ class Drafts extends Component {
                   });
                 }}
               >删除</View>
-            </View>)}
+              {/* <View className="edit">编辑</View> */}
+              <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>
+              </View>
+              <View className="formItem">
+                <View className="formName">发票类型:</View>
+                <View className="formValue">{["普票", "专票"][item.invoiceType]}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">发票号:</View>
+                <View className="formValue">{item.invoiceNo}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">付款单位:</View>
+                <View className="formValue">{item.payerName}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">开户银行:</View>
+                <View className="formValue">{item.openBank}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">银行账户:</View>
+                <View className="formValue">{item.bankAccounts}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">开户行地址:</View>
+                <View className="formValue">{item.openBankAddress}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">金额:</View>
+                <View className="formValue">{item.amount}</View>
+              </View>
+            </View>
+          )
+        }
+        <View className="formItem">
+          <View className="formName">预借支:</View>
+          <View className="formValue"></View>
+        </View>
         <View className="formItem" style={{ paddingTop: "10px" }}>
           <View className="formName">总金额:</View>
           <View className="formValue"><Text style={{ color: "red" }}>{total}</Text>(元)</View>
@@ -540,10 +817,11 @@ class Drafts extends Component {
         <View className="tips">①需要提供发票报销</View>
         <View className="tips">②需要填写报销明细表</View>
         <View className="tips">③招待费需要提供报备截图</View>
-        <View className="formTitle" style={{ marginTop: "20px" }}>
-          报销收款账户
-        </View>
-        {data.type != 2 &&
+        {data.type != 3 &&
+          <View className="formTitle" style={{ marginTop: "20px" }}>
+            报销收款账户
+          </View>}
+        {data.type != 3 &&
           <View className="unobstructedList">
             {(!bankData.id)
               ? <View className="noAccout" onClick={() => { this.setState({ accountvisible: true }) }}>
@@ -630,6 +908,15 @@ class Drafts extends Component {
             <Button type='primary' onClick={() => { this.selectOn() }}>确定</Button>
           </AtModalAction>
         </AtModal>
+        {/* 申请类型修改 */}
+        {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>
     );
   }

+ 34 - 4
src/pages/drafts/index.less

@@ -10,7 +10,8 @@
 
   .formItem {
     display: flex;
-    align-items: center;
+    // align-items: center;
+    align-items: flex-start;
     font-size: 30px;
     padding: 15px 0;
 
@@ -21,6 +22,18 @@
 
     }
 
+    .formValues {
+      display: flex;
+      flex: 1;
+      margin-left: 20px;
+
+      .at-textarea__textarea {
+        font-size: 30px;
+      }
+
+    }
+
+
     .formValue {
       text-align: right;
       flex: 1;
@@ -29,6 +42,11 @@
       align-items: center;
       justify-content: flex-end;
 
+      picker {
+        flex: 1;
+        margin-left: 20px;
+      }
+
       .button {
         font-size: 22px;
         padding: 0 10px;
@@ -59,6 +77,12 @@
         white-space: nowrap;
       }
     }
+
+    .formValues {
+      display: flex;
+      flex: 1;
+      flex-flow: row nowrap;
+    }
   }
 
   .formTitle {
@@ -126,16 +150,22 @@
 
     .formItem {
       display: flex;
-      align-items: center;
       font-size: 30px;
       padding: 15px 0;
+      align-items: baseline;
 
       .formName {
-        width: 136px;
+        width: 150px;
         margin-right: 16px;
         white-space: nowrap;
         display: flex;
-        align-items: center;
+
+      }
+
+      .formValues {
+        display: flex;
+        flex: 1;
+
       }
 
       .formValue {

+ 39 - 12
src/pages/drafts/modal.jsx

@@ -3,7 +3,7 @@ import Taro from "@tarojs/taro";
 import { View, Icon, Button, Picker, Input } from '@tarojs/components'
 import { AtButton, AtIcon, AtInput, AtModal, AtModalHeader, AtModalContent, AtModalAction } from "taro-ui";
 import { typeList, vehiclelist } from '../../utils/tools/config';
-import { getNumHourse } from "../../utils/tools";
+import { getNumHourse, removeNull } from "../../utils/tools";
 import { detailsAdd } from "../../utils/servers/servers";
 
 import dayjs from "dayjs";
@@ -71,29 +71,56 @@ class Modal extends Component {
     });
   }
 
+  // 差旅费报销
   onSubmit() {
     const { data } = this.state
     const { eaid } = this.props
-    if (!data.type) {
+    let type = data.type.value
+    if (!type && type != 0) {
       Taro.showToast({ title: "请选择费用类型", icon: "none", });
       return
     }
-    data.type = data.type.value
-    if (data.type == 1) {
-      data.vehicle = data.vehicle.value
+    if (type == 1) {
+      if (!data.vehicle.value && data.vehicle.value != 0) {
+        Taro.showToast({ title: "请选择交通工具", icon: "none", });
+        return
+      }
+      if (data.vehicle.value == 0 && !data.vehicleOther) {
+        Taro.showToast({ title: "请填写其他工具说明", icon: "none", });
+        return
+      }
+      if (!this.state.rangeStartMinuteVal || !this.state.rangeEndMinuteVal) {
+        Taro.showToast({ title: "请选择时间", icon: "none", });
+        return
+      }
+      if (!data.startDistrict) {
+        Taro.showToast({ title: "请填写始发地", icon: "none", });
+        return
+      }
+      if (!data.endDistrict) {
+        Taro.showToast({ title: "请填写目的地", icon: "none", });
+        return
+      }
+    }
+    if (!data.amount) {
+      Taro.showToast({ title: "请填写报销金额", icon: "none", });
+      return
+    }
+    if (type == 1) {
       data.startTime = this.state.rangeStartMinuteVal
       data.endTime = this.state.rangeEndMinuteVal
-    } else {
-      delete data.vehicle
+    }
+    if (data.vehicle.value != 0) {
+      data.vehicleOther = undefined
     }
     let obj = {
-      eaid,
-      ...data
+      ...data,
+      ...{ eaid, type: data.type.value, vehicle: data.vehicle.value, }
     }
     this.setState({
       loading: true,
     });
-    detailsAdd(obj)
+    detailsAdd(removeNull(obj))
       .then((v) => {
         this.setState({
           loading: false,
@@ -130,7 +157,7 @@ class Modal extends Component {
             <View className="picker">
               <View className="ptit"><View style={{ color: "red" }}>*&nbsp;</View>类型:</View>
               <Picker
-                value={data.type.value}
+                value={data.type.value == 0 ? typeList.length - 1 : data.type.value - 1}
                 range={typeList} rangeKey='label' mode='selector'
                 onChange={(e) => {
                   this.setState({
@@ -164,7 +191,7 @@ class Modal extends Component {
               <View className="picker">
                 <View className="ptit"><View style={{ color: "red" }}>*&nbsp;</View>交通工具:</View>
                 <Picker
-                  value={data.vehicle.value}
+                  value={data.vehicle.value == 0 ? vehiclelist.length - 1 : data.vehicle.value - 1}
                   range={vehiclelist} rangeKey='label' mode='selector'
                   onChange={(e) => {
                     this.setState({

+ 3 - 0
src/pages/draftsdetail/index.config.js

@@ -0,0 +1,3 @@
+export default {
+  navigationBarTitleText: '报销信息详情',
+}

+ 268 - 0
src/pages/draftsdetail/index.jsx

@@ -0,0 +1,268 @@
+import React, { Component } from "react";
+import Taro, { getCurrentInstance } from "@tarojs/taro";
+import { Text, View } from "@tarojs/components";
+import ImagePicker from "../../components/common/imagePicker";
+import {
+  getPridDetail,
+  getAccountList,
+  selectList,
+} from "../../utils/servers/servers";
+import {
+  getAccountName,
+  getTypeName,
+  getVehicleName,
+  commonAdd,
+} from "../../utils/tools";
+import { resourceAddress } from "../../utils/config";
+import "taro-ui/dist/style/components/form.scss";
+import "taro-ui/dist/style/components/button.scss";
+import "taro-ui/dist/style/components/loading.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import "taro-ui/dist/style/components/icon.scss";
+import "taro-ui/dist/style/components/textarea.scss";
+import "taro-ui/dist/style/components/input.scss";
+
+import "../drafts/index.less";
+
+class Drafts extends Component {
+  $instance = getCurrentInstance();
+
+  constructor(props) {
+    super(props);
+    this.state = {
+      data: {},
+      list: [],
+      total: 0,
+      bankData: {},
+    };
+  }
+
+  componentDidMount() {
+    this.$instance.router.params && this.$instance.router.params.id &&
+      (
+        this.getDetail(),
+        this.getAccountList()
+      )
+  }
+
+  // 报销账户列表
+  getMyList(id) {
+    let data = {
+      pageNo: 1,
+      pageSize: 99,
+    }
+    selectList(data).then(v => {
+      if (v.error.length === 0) {
+        let list = v.data.list || []
+        for (var i = 0; i < list.length; i++) {
+          if (list[i].aid == id) {
+            this.setState({
+              bankData: list[i]
+            })
+          }
+        }
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: 'none' })
+      }
+    }).catch(() => {
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
+
+  // 报销单详情
+  getDetail() {
+    getPridDetail({
+      id: this.$instance.router.params.id,
+    }).then(v => {
+      if (v.error.length === 0) {
+        let list = [];
+        for (let i of (v.data.attachmentUrl || '').split(',')) {
+          if (i) {
+            list.push({ 'url': resourceAddress + i })
+          }
+        }
+        this.setState({
+          data: v.data,
+          rangeStartMinuteVal: v.data.releaseStartStr,
+          rangeEndMinuteVal: v.data.releaseEndStr,
+          totalDuration: v.data.duration,
+          attachmentUrl: list,
+        })
+        v.data.aid && this.getMyList(v.data.aid)
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: 'none' })
+      }
+    }).catch(() => {
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
+
+  // 报销详情金额列表
+  getAccountList() {
+    getAccountList({
+      eaid: this.$instance.router.params.id,
+    }).then(v => {
+      if (v.error.length === 0) {
+        let sum = 0
+        for (var i = 0; i < v.data.length; i++) {
+          // sum += v.data[i].amount
+          sum = commonAdd(sum, v.data[i].amount)
+        }
+        this.setState({
+          list: v.data,
+          total: sum,
+        })
+
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: 'none' })
+      }
+    }).catch(() => {
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
+
+
+  render() {
+    const { data, list, total, bankData, attachmentUrl } = this.state
+    return (
+      <View className="subform">
+        <View className="title">{[data.typeOther, "差旅费报销", "餐费报销", "第三方付款", "申请预借支","申请抵扣"][data.type]}</View>
+        <View className="formItem">
+          <View className="formName" style={{ width: "86px" }}>公出企业:</View>
+          <View className="formValues">{data.userNames}</View>
+        </View>
+        <View className="formItem">
+          <View className="formName" style={{ width: "86px" }}>公出地点:</View>
+          <View className="formValues">{data.districtName}</View>
+        </View>
+        <View className="formItem">
+          <View className="formName">公出时间:</View>
+          <View className="formValue">
+            <View
+              className="time"
+              onClick={() => {
+                this.setState({
+                  isPickerRender: true,
+                });
+              }}
+            >
+              <View className="timeContent">
+                <View style={{ textAlign: "center" }}>{this.state.rangeStartMinuteVal}</View>
+                &nbsp;&nbsp;至&nbsp;&nbsp;
+                <View style={{ textAlign: "center" }}>{this.state.rangeEndMinuteVal}</View>
+              </View>
+            </View>
+
+          </View>
+        </View>
+        <View className="formItem">
+          <View className="formName">公出时长:</View>
+          <View className="formValue">{this.state.totalDuration}小时</View>
+        </View>
+        <View className="formItem">
+          <View className="formName">申请类型:</View>
+          <View className="formValue">{getAccountName(data.type, data.typeOther)}</View>
+        </View>
+        {/* <View className="formItem">
+          <View className="formName">报销至订单:</View>
+          <View className="formValue"></View>
+        </View> */}
+        <View className="formTitle">
+          报销详细
+        </View>
+        <View className="formItem">
+          <View className="formName">申请人:</View>
+          <View className="formValue">{data.aname}</View>
+        </View>
+        <View className="formItem">
+          <View className="formName">报销公司:</View>
+          <View className="formValue">{data.appDepName}</View>
+        </View>
+        <View className="formItem">
+          <View className="formName">支付公司:</View>
+          <View className="formValue">{data.payDepName}</View>
+        </View>
+        <View className="formTitle">
+          报销费用详细
+        </View>
+        {list?.map(item =>
+          item.type == 1
+            ? <View className="unItem" key={item.id}>
+              <View className="formItem">
+                <View className="formName">交通工具:</View>
+                <View className="formValue">{getVehicleName(item.vehicle, item.vehicleOther)}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">时间:</View>
+                <View className="formValue">
+                  <View className="ftxt">{item.startTimeStr}</View>
+                  &nbsp;&nbsp;至&nbsp;&nbsp;
+                  <View className="ftxt">{item.endTimeStr}</View>
+                </View>
+              </View>
+              <View className="formItem">
+                <View className="formName">地点:</View>
+                <View className="formValue">
+                  <View className="ftxt">{item.startDistrict}</View>
+                  &nbsp;&nbsp;至&nbsp;&nbsp;
+                  <View className="ftxt">{item.endDistrict}</View>
+                </View>
+              </View>
+              <View className="formItem">
+                <View className="formName">金额:</View>
+                <View className="formValue">{item.amount}(元)</View>
+              </View>
+            </View>
+            : <View className="formItem" key={item.id}>
+              <View className="formName" style={{ width: "86px" }}>{getTypeName(item.type) + ":"}</View>
+              <View className="formValues">{item.amount}(元)</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={{ display: "block", paddingBottom: 0 }}>
+          <View className="formName">附件:</View>
+          <View
+            className="formValue"
+            style={{ paddingTop: "10px", textAlign: "left" }}
+          >
+            {attachmentUrl && attachmentUrl.length > 0 &&
+              <ImagePicker
+                files={attachmentUrl}
+                showAddBtn={false}
+              />}
+          </View>
+        </View>
+        <View className="formTitle" style={{ marginTop: "20px" }}>
+          报销收款账户
+        </View>
+        {data.type != 2 &&
+          <View className="unobstructedList">
+            {<View className="unItem" >
+              <View className="formItem">
+                <View className="formName">收款人:{bankData.name}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">收款银行:{bankData.bank}</View>
+              </View>
+              <View className="formItem">
+                <View className="formName">收款账户:{bankData.accounts}</View>
+              </View>
+            </View>}
+          </View>}
+      </View>
+    );
+  }
+}
+
+export default Drafts;

+ 66 - 13
src/pages/mybusiness/list.jsx

@@ -3,8 +3,9 @@ import Taro from "@tarojs/taro";
 import { View, Image, Button } from "@tarojs/components";
 import Skeleton from "taro-skeleton";
 import { getClockState } from "../../utils/tools";
-import { selectByPrid } from '../../utils/servers/servers';
+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";
 
@@ -23,8 +24,8 @@ class List extends Component {
     })
   }
 
-  getByDrafts(id, e) {
-    e.stopPropagation();
+  // 公出报销查询
+  getByDrafts(id) {
     selectByPrid({
       prid: id,
       status: 0, //  0=草稿,1=审核中,2=完成,3=驳回
@@ -36,14 +37,11 @@ class List extends Component {
             url: '/pages/drafts/index?id=' + v.data
           })
         } else {
-          this.setState({
-            id,
-            visible: "add",
-          })
-          // Taro.switchTab({
-          //   url: '/pages/applyReimbursement/index'
+          this.creatOrder(id)
+          // this.setState({
+          //   id,
+          //   visible: "add",
           // })
-          // 0
         }
       } else {
         Taro.showToast({ title: v.error[0].message, icon: "none" });
@@ -53,6 +51,27 @@ class List extends Component {
     });
   }
 
+  // 发起差旅费报销
+  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">
@@ -90,7 +109,16 @@ class List extends Component {
                   v.status == 2 &&
                   <View
                     className="punchClock"
-                    onClick={this.getByDrafts.bind(this, v.id)}
+                    onClick={() => {
+                      this.setState({
+                        isInquiryOpened: true,
+                        inquiryTitle: "温馨提醒",
+                        inquiryContent: "您确定要发起此次公出费用报销吗?",
+                        inquiryFn: () => {
+                          this.getByDrafts(v.id)
+                        },
+                      });
+                    }}
                   >
                     发起报销
                   </View>
@@ -132,12 +160,37 @@ class List extends Component {
             }}
           />
         </View>
-        {this.state.visible != "" &&
+        {/* 二级确认弹窗 */}
+        <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
             prid={this.state.id}
             visible={this.state.visible}
             onClose={this.onClose.bind(this)}
-          />}
+          />} */}
 
       </View>
     );

+ 8 - 20
src/pages/recordlist/index.jsx

@@ -1,7 +1,7 @@
 import React, { Component } from 'react';
 import Taro from '@tarojs/taro';
 import { View, Picker, ScrollView, } from '@tarojs/components'
-import { getRecordList, getAudit } from '../../utils/servers/servers';
+import { getRecordList, } from '../../utils/servers/servers';
 import dayjs from 'dayjs';
 import { AtIcon, } from 'taro-ui';
 import { getAccountName } from '../../utils/tools';
@@ -137,22 +137,6 @@ class Examine extends Component {
   }
 
 
-  selAudit(id, e) {
-    e.stopPropagation();
-    getAudit({
-      eaid: id,
-    }).then((v) => {
-      if (v.error.length === 0) {
-
-      } else {
-        Taro.showToast({ title: v.error[0].message, icon: "none" });
-      }
-    }).catch((err) => {
-      Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
-    });
-  }
-
-
   render() {
     const { list } = this.state
     return (
@@ -248,9 +232,13 @@ class Examine extends Component {
             list?.map((item) =>
               <View className='item' key={item.id}
                 onClick={() => {
-                  Taro.navigateTo({
-                    url: '/pages/drafts/index?id=' + item.id
-                  })
+                  item.status == 0 ?
+                    Taro.navigateTo({
+                      url: '/pages/drafts/index?id=' + item.id
+                    }) :
+                    Taro.navigateTo({
+                      url: '/pages/draftsdetail/index?id=' + item.id
+                    })
                 }}
               >
                 {item.status == 1 && <View className='lbt' onClick={e => { e.stopPropagation(); this.setState({ visible: true, id: item.id }) }}>查看审核详情</View>}

+ 1 - 1
src/utils/config.js

@@ -1,5 +1,5 @@
 // 本地
-export const resourceAddress = 'http://172.16.0.255:3000/upload;'
+export const resourceAddress = 'http://172.16.0.255:3000/upload';
 // 生产
 // export const resourceAddress = 'https://s.jishutao.com/upload';
 // 测试

+ 20 - 1
src/utils/servers/servers.js

@@ -48,16 +48,30 @@ export const getWorkingHours = (postData = {}) => {
   return HTTPREQUEST.get('/api/admin/department/workingHours/get', postData)
 }
 
-//测试
+// 测试
 export const test = (postData = {}) => {
   return HTTPREQUEST.get('/open/getVCode', postData)
 }
 
+// 查询客户订单
+export const getOrderByUid = (postData = {}) => {
+  return HTTPREQUEST.get('/api/admin/release/selectOrderByUid', postData)
+}
+
+export const getUserByName = (postData = {}) => {
+  return HTTPREQUEST.get('/api/admin/customer/getUserByNames', postData)
+}
+
 // 我的公出列表
 export const getPublicReleaseList = (postData = {}) => {
   return HTTPREQUEST.get('/api/admin/release/listPublicRelease', postData)
 }
 
+// 部门列表
+export const getDepartmentList = (postData = {}) => {
+  return HTTPREQUEST.get('/api/admin/organization/selectSuperId', postData)
+}
+
 // 新增报销
 export const creatOrder = (postData = {}) => {
   return HTTPREQUEST.post('/api/admin/expenseAccount/add', postData)
@@ -123,3 +137,8 @@ export const subAccount = (postData = {}) => {
   return HTTPREQUEST.post('/api/admin/expenseAccount/update', postData)
 }
 
+// 获取借支列表
+export const getDrbitNote = (postData = {}) => {
+  return HTTPREQUEST.get('/api/admin/expenseAccount/selectDebitOrder', postData)
+}
+

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

@@ -67,6 +67,7 @@ export const accountList = [
   { label: '非业务报销', value: 2, },
   { label: '第三方付款', value: 3, },
   { label: '申请借支', value: 4 },
+  { label: '申请抵扣', value: 5 },
   { label: '其他', value: 0, }
 ]