#
whycq
2023-12-02 178d0ee433ecee57bbd57804cc29c593f3de7829
pages/business/goBusiness/modiReimburseOnlineDetl.vue
@@ -6,24 +6,16 @@
      <uni-nav-bar left-icon="left" :title="title" @clickLeft="back" @clickRight="scan"  :fixed="true"
         :border="false" rightWidth="160rpx" leftWidth="160rpx"
         >
         <!-- <block slot="right">
            <view class="city">
               <view>
                  <text class="uni-nav-bar-text">{{user.username}}</text>
               </view>
               <uni-icons type="arrowdown" color="#333333" size="20" />
            </view>
         </block> -->
       </uni-nav-bar>
      <view class="container">
         <view style="height: 16rpx;"></view>
         <view class="card" v-for="(item,index) in form">
            <view class="card-select" v-show="item.inputType != 'table'" style="width: 100%;">
            <view class="card-select" v-show="item.inputType != 'table' && !item.hide" style="width: 100%;">
               <view class="flex">
                  <view class="card-required" v-show="item.required">*</view>
                  <view >{{item.name}}</view>
               </view>
               <uni-combox :candidates="orderIds" placeholder="请选择项目" v-model="orderId"
               <uni-combox :candidates="orderIds" placeholder="请选择项目" v-model="item.value"
                  @input="getOrderId()" v-if="item.inputType == 'chose'">
               </uni-combox>
               <view class="flex">
@@ -87,8 +79,8 @@
         
      </view>
      
      <u-picker :show="reimburseId" :columns="reimburseIds" @confirm="reimburseIdConfirm"></u-picker>
      <u-picker :show="checkData" :columns="checkDatas" @confirm="checkDataConfirm"></u-picker>
      <u-picker :show="reimburseId" :columns="reimburseIds" @confirm="reimburseIdConfirm" @cancel="cancel"></u-picker>
      <u-picker :show="checkData" :columns="checkDatas" @confirm="checkDataConfirm" @cancel="cancel"></u-picker>
      
      <view>
         <!-- 普通弹窗 -->
@@ -148,7 +140,7 @@
            ],
            radiovalue2: '',
            form: [
               {name: '项目名',placeholder: '请选择',inputType: 'chose',type: 'orderId',value: '',submitVal: ''},
               {name: '项目名',placeholder: '请选择',inputType: 'chose',type: 'orderId',value: '',submitVal: '',hide: true},
               {name: '报销类型',placeholder: '请选择',required:true,inputType: 'select',type: 'reimburseId',value: '',submitVal: ''},
               {name: '是否冲账',placeholder: '请选择',required:true,inputType: 'select',type: 'checkData',value: '',submitVal: ''},
               {name: '报销明细',placeholder: '请选择',inputType: 'table'}
@@ -177,6 +169,7 @@
            dataRule: [
               {occupation: ''}
            ],
            reimburseId2: 0,
            reimburseId: false,
            reimburseIds: [['项目未完成','项目已完成在质保期内','非项目型报销','其他']],
            checkData: false,
@@ -204,20 +197,43 @@
                  updateTime: '',
                  updateUserName: ''
               },
            fixtype: 'modi',
            businessId: 0
         }
      },
      onLoad(option) {
         let _this = this
         this.getOrderId('')
         _this.list = []
         const eventChannel = this.getOpenerEventChannel();
         eventChannel.on('reimburseOnlineDetl', function(data) {
            console.log(data);
            if (data.data == 'add') {
               _this.title = '添加报销审批'
               _this.fixtype = 'add'
               _this.form[0].hide = false
            }
            console.log(data)
            console.log(_this.title)
            if (data.data == 'modi') {
               _this.form[1].value = data.detl.list.templateName
               _this.reimburseId2 = data.detl.list.id
               for (let k in _this.reimburseIds[0]) {
                  if (_this.reimburseIds[0][k] == data.detl.list.templateName) {
                     _this.form[1].submitVal = k
                  }
               }
               _this.form[2].value = data.detl.list.checkData
               _this.form[0].value = data.detl.list.orderId$
               _this.getOrderId(data.detl.list.orderId$)
               _this.tableData = data.detl.list.detl
            }
            // 出差申请报销
            if (data.data == 'add2') {
               _this.title = '添加报销审批'
               _this.fixtype = 'add2'
               _this.businessId = data.detl.id
            }
         })
         this.getOrderId('')
      },
      methods: {
         addDetl(type) {
@@ -228,7 +244,6 @@
         popChange(n) {
            // var detl=JSON.parse(JSON.stringify(this.newDetl));  // 牛逼
            let detl  = {...this.newDetl} // 牛逼
            console.log(this.radiovalue2);
            detl.expenseType$ = this.radiovalue2
            for (let k in this.radiolist2) {
               if (this.radiolist2[k].name == this.radiovalue2) {
@@ -239,7 +254,6 @@
            this.$refs.popup.close()
         },
         radioChange(n) {
            console.log('radioChange', n);
         },
         showPicker(e) {
            switch(e) {
@@ -282,18 +296,14 @@
            this.tableData.splice(index,1)
         },
         reimburseIdConfirm(e) {
            console.log('confirm', e)
            this.form[1].value = e.value[0]
            this.form[1].submitVal = e.indexs[0]
            this.reimburseId = false
            console.log(this.form);
         },
         checkDataConfirm(e) {
            console.log('confirm', e)
            this.form[2].value = e.value[0]
            this.form[2].submitVal = e.indexs[0]
            this.checkData = false
            console.log(this.form);
         },
         // 表单提交
         submit() {
@@ -307,8 +317,9 @@
                  
               ]
            }
            for (let element of this.orderIdList) {
               if(element.value == this.orderId) {
               if(element.value == this.form[0].value) {
                  param.orderId = element.id + ''
               }
            }
@@ -320,13 +331,8 @@
                  param.checkData = k.value
               }
            }
            console.log(this.form);
            console.log(param);
            param.reimburseId = this.reimburseId2
            param.reimburseOnlineDetls = this.tableData
            if (param.reimburseId == null || param.reimburseId === '') {
               uni.showToast({title: '报销类型不能为空', icon: "none", position: 'top'})
               return
            }
            if (param.checkData == '') {
               uni.showToast({title: '是否冲账不能为空', icon: "none", position: 'top'})
               return
@@ -335,10 +341,16 @@
               uni.showToast({title: '请添加报销明细', icon: "none", position: 'top'})
               return
            }
            // console.log(this.orderIdList);
            // console.log(this.orderIds);
            console.log(param);
            this.formAdd(param)
            if (this.fixtype == 'add') {
               this.formAdd(param)
            } else if (this.fixtype == 'add2') {
               param['businessId'] = this.businessId
               this.formAdd(param)
            } else {
               this.formModi(param)
            }
         },
         formAdd(param) {
            let _this = this
@@ -349,10 +361,36 @@
               method: 'POST',
               success(res) {
                  res = res.data
                  console.log(res);
                  if (res.code === 200) {
                     uni.navigateBack({})
                  } else if(res.code === 500) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                  }
               }
            })
         },
         formModi(param) {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/reimburseOnline/from/modify/auth`,
               header: { 'token': uni.getStorageSync('token') },
               data: JSON.stringify(param),
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     uni.navigateBack({delta:2})
                  } else if(res.code === 500) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                  }
               }
            })
         },
         cancel() {
            this.reimburseId = false
            this.checkData = false
         },
         back() {
            uni.navigateBack({})
         },