#
whycq
2023-11-22 3913b3c5c8cde03f8c92d1c738d28c4a9bae7e55
pages/business/goBusiness/modiReimburseOnlineDetl.vue
@@ -53,8 +53,12 @@
                        <tr v-for="(item,index) in tableData">
                           <td class="scroll-item" v-for="(subitem,i) in table">
                              <view class="item-content" v-if="subitem.type != 'options'">
                                 <input type="text" v-model="item[subitem.type]">
                                 <input type="text" v-model="item[subitem.type]">
                              </view>
                              <!-- <view class="item-content" v-if="subitem.type != 'options' && !subitem.isInput">
                                 <text>{{item[subitem.type]}}</text> <text v-if="subitem.type == 'taxRate' || subitem.type == 'reimbursementRatio' ">%</text>
                              </view> -->
                              
                              <view v-if="subitem.type == 'options'" style="color: red;" @click="delItem(index)">删除</view>
                           </td>
@@ -83,8 +87,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>
         <!-- 普通弹窗 -->
@@ -120,24 +124,29 @@
            title: '修改报销审批',
            radiolist2: [{
                  name: '餐费',
                  id: 1,
                  disabled: false
               },
               {
                  name: '住宿费',
                  id: 2,
                  disabled: false
               },
               {
                  name: '车费',
                  id: 3,
                  disabled: false
               }, {
                  name: '油费',
                  id: 4,
                  disabled: false
               }, {
                  name: '其他',
                  id: 5,
                  disabled: false
               }
            ],
            radiovalue2: '餐费',
            radiovalue2: '',
            form: [
               {name: '项目名',placeholder: '请选择',inputType: 'chose',type: 'orderId',value: '',submitVal: ''},
               {name: '报销类型',placeholder: '请选择',required:true,inputType: 'select',type: 'reimburseId',value: '',submitVal: ''},
@@ -145,7 +154,7 @@
               {name: '报销明细',placeholder: '请选择',inputType: 'table'}
            ],
            table: [
               {name:'事由',type: 'occupation'},
               {name:'事由',type: 'occupation',isInput:true},
               {name:'费用类型',type: 'expenseType$'},
               {name:'税率',type: 'taxRate'},
               {name:'未税本币金额',type: 'untaxedAmountInLocalCurrency'},
@@ -164,42 +173,6 @@
               {name:'操作',type: 'options'}
            ],
            tableData: [
               {
                  occupation: 'CRMREIMBURSE1699507854268',
                  expenseType$: '1',
                  taxRate: '0.0',
                  untaxedAmountInLocalCurrency: '1.1',
                  untaxedAmount: '1.3',
                  taxAmount: 'aaa',
                  invoiceValue: '213',
                  invoiceAmountInLocalCurrency: '123213',
                  reimbursementRatio: '0.0',
                  reimbursementAmount: 11,
                  reimbursementAmountInLocalCurrency:12,
                  cashierConfirmationAmount: 123,
                  userId$: '123',
                  deptId$: '财务部',
                  updateTime: '2023-11-11',
                  updateUserName: 'name'
               },
               {
                  occupation: '请选择',
                  expenseType$: '1',
                  taxRate: '0.0',
                  untaxedAmountInLocalCurrency: '1.1',
                  untaxedAmount: '1.3',
                  taxAmount: 'aaa',
                  invoiceValue: '213',
                  invoiceAmountInLocalCurrency: 'CRMREIMBURSE1699507854268',
                  reimbursementRatio: '0.0',
                  reimbursementAmount: 11,
                  reimbursementAmountInLocalCurrency:12,
                  cashierConfirmationAmount: 123,
                  userId$: '123',
                  deptId$: '财务部',
                  updateTime: '2023-11-11',
                  updateUserName: 'name'
               },
            ],
            dataRule: [
               {occupation: ''}
@@ -214,36 +187,51 @@
            orderIdList: [],
            newDetl: {
                  occupation: '',
                  expenseType$: '1',
                  taxRate: '0.0',
                  untaxedAmountInLocalCurrency: '1.1',
                  untaxedAmount: '1.3',
                  taxAmount: 'aaa',
                  invoiceValue: '213',
                  invoiceAmountInLocalCurrency: '123213',
                  reimbursementRatio: '0.0',
                  reimbursementAmount: 11,
                  reimbursementAmountInLocalCurrency:12,
                  cashierConfirmationAmount: 123,
                  userId$: '123',
                  deptId$: '财务部',
                  updateTime: '2023-11-11',
                  updateUserName: 'name'
                  expenseType$: '',
                  expenseType: null,
                  taxRate: 0,
                  untaxedAmountInLocalCurrency: 0,
                  untaxedAmount: 0,
                  taxAmount: 0,
                  invoiceValue: 0,
                  invoiceAmountInLocalCurrency: 0,
                  reimbursementRatio: 0,
                  reimbursementAmount: 0,
                  reimbursementAmountInLocalCurrency:0,
                  cashierConfirmationAmount: 0,
                  userId$: '',
                  deptId$: '',
                  updateTime: '',
                  updateUserName: ''
               },
            type: 'modi'
         }
      },
      onLoad(option) {
         let _this = this
         this.getOrderId('')
         _this.list = []
         const eventChannel = this.getOpenerEventChannel();
         eventChannel.on('reimburseOnlineDetl', function(data) {
            if (data.data == 'add') {
               _this.title = '添加报销审批'
               _this.type = 'add'
            }
            console.log(data)
            console.log(_this.title)
            if (data.data == 'modi') {
               // _this.title = '添加报销审批'
               _this.form[1].value = data.detl.list.templateName
               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.name$
               _this.getOrderId(data.detl.list.name$)
               _this.tableData = data.detl.list.detl
            }
         })
         this.getOrderId('')
      },
      methods: {
         addDetl(type) {
@@ -254,14 +242,16 @@
         popChange(n) {
            // var detl=JSON.parse(JSON.stringify(this.newDetl));  // 牛逼
            let detl  = {...this.newDetl} // 牛逼
            console.log('groupChange', n);
            console.log(this.radiovalue2);
            detl.expenseType$ = this.radiovalue2
            for (let k in this.radiolist2) {
               if (this.radiolist2[k].name == this.radiovalue2) {
                  detl.expenseType = this.radiolist2[k].id
               }
            }
            this.tableData.push(detl)
            this.$refs.popup.close()
         },
         radioChange(n) {
            console.log('radioChange', n);
         },
         showPicker(e) {
            switch(e) {
@@ -304,18 +294,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() {
@@ -342,8 +328,6 @@
                  param.checkData = k.value
               }
            }
            console.log(this.form);
            console.log(param);
            param.reimburseOnlineDetls = this.tableData
            if (param.reimburseId == null || param.reimburseId === '') {
               uni.showToast({title: '报销类型不能为空', icon: "none", position: 'top'})
@@ -357,11 +341,52 @@
               uni.showToast({title: '请添加报销明细', icon: "none", position: 'top'})
               return
            }
            // console.log(this.orderIdList);
            // console.log(this.orderIds);
            console.log(param);
            if (this.type == 'add') {
               this.formAdd(param)
            } else {
               this.formModi(param)
            }
         },
         formAdd(param) {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/reimburseOnline/from/add/auth`,
               header: { 'token': uni.getStorageSync('token') },
               data: JSON.stringify(param),
               method: 'POST',
               success(res) {
                  res = res.data
                  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({})
                  } else if(res.code === 500) {
                     uni.showToast({title: res.msg, icon: "none", position: 'top'})
                  }
               }
            })
         },
         cancel() {
            this.reimburseId = false
            this.checkData = false
         },
         back() {
            uni.navigateBack({})
         },