commission-Payment.vue 13.2 KB
Newer Older
邓春圆's avatar
邓春圆 committed
1 2 3 4 5 6 7 8 9 10
<template>
  <div style="padding: 20px">
    <el-card  class="box-card">
      <div slot="header" class="clearfix" style="font-size: 20px;">
        {{$t('佣金付款单')}}
      </div>
      <el-form  label-width="80px" label-position="left">
        <el-row :gutter="30">
          <el-col :span="7">
            <el-form-item :label="$t('付款单号')">
邓春圆's avatar
邓春圆 committed
11
              <el-input :placeholder="$t('请输入付款单号')" v-model="queryParams.paymentNo"></el-input>
邓春圆's avatar
邓春圆 committed
12 13 14 15
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="$t('客户')">
邓春圆's avatar
邓春圆 committed
16
              <el-input :placeholder="$t('请输入客户')" v-model="queryParams.searchKey"></el-input>
邓春圆's avatar
邓春圆 committed
17 18 19 20
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="$t('状态')">
邓春圆's avatar
邓春圆 committed
21
              <dict-selector clearable :type="DICT_TYPE.ECW_PAYMENT_STATE" v-model="queryParams.state" />
邓春圆's avatar
邓春圆 committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item :label="$t('业务员')">
              <el-select v-model="queryParams.salesmanName" :placeholder="$t('请选择业务员')">
                <el-option
                  v-for="item in creatorData"
                  :key="item.id"
                  :label="item.nickname"
                  :value="item.nickname"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="7">
            <el-form-item :label="$t('创建时间')">
邓春圆's avatar
邓春圆 committed
40 41 42 43
                <el-date-picker
                  style="width:100%;"
                  v-model="selectDate"
                  type="datetimerange"
44
                  value-format="yyyy-MM-dd HH:mm:ss"
邓春圆's avatar
邓春圆 committed
45 46 47 48
                  range-separator="至"
                  :start-placeholder="$t('开始日期')"
                  :end-placeholder="$t('结束日期')">
                </el-date-picker>
邓春圆's avatar
邓春圆 committed
49 50 51 52 53
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item :label="$t('发票状态')">
              <el-select
邓春圆's avatar
邓春圆 committed
54
                clearable
邓春圆's avatar
邓春圆 committed
55 56 57 58 59 60 61 62
                v-model="queryParams.invoiceStatus"
                :placeholder="$t('请选择是否开票')">
                <el-option :label="$t('未开票')" value="0" />
                <el-option :label="$t('已开票')" value="1" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
63
            <el-form-item :label="$t('账单号')">
邓春圆's avatar
邓春圆 committed
64
              <el-input :placeholder="$t('请输入账单号')" v-model="queryParams.accountNumber"></el-input>
邓春圆's avatar
邓春圆 committed
65 66 67 68
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-form-item>
邓春圆's avatar
邓春圆 committed
69
              <el-button size="mini" type="primary" @click="queryParams.page = 1;getList()">{{$t('查找')}}</el-button>
邓春圆's avatar
邓春圆 committed
70
              <el-button type="success" size="mini" @click="$router.push({path:'/financial/commission-requestFunds',query:{payableId:0}})"  v-has-permi="['ecw:commission-Payment:add']" >{{$t('新增请款单')}}</el-button>
邓春圆's avatar
邓春圆 committed
71 72 73 74 75 76
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>

77 78 79 80 81 82 83 84 85
    <el-table border  :data="list" style="margin-top: 30px">
      <el-table-column align="center" type="index" :label="$t('序号')"></el-table-column>
      <el-table-column align="center"  prop="paymentNo" :label="$t('付款单号')">
        <template v-slot="{row}">
          <router-link :to="{path:'/financial/commission-requestFunds',query:{[[0].includes(row.state) ? 'id' : 'lookId' ]:row.id}}">{{row.paymentNo}} </router-link>
        </template>
      </el-table-column>
      <el-table-column align="center" prop="customerName" :label="$t('客户')"></el-table-column>
      <el-table-column align="center" :label="$t('创建时间')">
邓春圆's avatar
邓春圆 committed
86 87 88 89
        <template v-slot="{row}">
          {{parseTime(row.createTime)}}
        </template>
      </el-table-column>
90
      <el-table-column align="center" :label="$t('最后付款时间')">
邓春圆's avatar
邓春圆 committed
91 92 93 94
        <template v-slot="{row}">
          {{parseTime(row.latestPayAt)}}
        </template>
      </el-table-column>
95
      <el-table-column align="center" prop="invoiceStatus" :label="$t('发票')">
邓春圆's avatar
邓春圆 committed
96 97 98 99
        <template v-slot="{row}">
          {{row.invoiceStatus ? $t('已开票') : $t('未开票')}}
        </template>
      </el-table-column>
100
      <el-table-column align="center" :label="$t('状态')" prop="state" >
邓春圆's avatar
邓春圆 committed
101 102 103 104 105
        <template slot-scope="scope">
          <dict-tag
            :type="DICT_TYPE.ECW_PAYMENT_STATE"
            :value="scope.row.state"
          />
邓春圆's avatar
邓春圆 committed
106
          <span v-if="[2,4,6].includes(scope.row.state) && scope.row.comment" :title="scope.row.comment"><i class="el-icon-question"></i></span>
邓春圆's avatar
邓春圆 committed
107 108 109 110
        </template>
      </el-table-column>
      <el-table-column :label="$t('操作')">
       <template v-slot="{row}">
邓春圆's avatar
邓春圆 committed
111 112
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:edit']" v-if="[0,2].includes(row.state)" @click="$router.push({path:'/financial/commission-requestFunds',query:{id:row.id}})" >{{$t('编辑')}}</el-button>
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:delete']" @click="deleteFn(row)" v-if="[0,2].includes(row.state)" > {{$t('删除')}}</el-button>
113
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:details']"  v-if="[7,3,1,5].includes(row.state)" @click="$router.push({path:'/bpm/process-instance/detail',query:{id:row.bmpId}})"   >{{$t('审核详情')}}</el-button>
114 115 116
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:Unapprove']" v-if="[1].includes(row.state)" @click="bridgeFn($t('取消审核'),7, row, $t('取消审核') )"  >{{$t('取消审核')}}</el-button>
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:De-approval']" v-if="[4,].includes(row.state)" @click="bridgeFn($t('佣金付款单反审核'), 1, row, $t('提交反审核'),)" >{{$t('反审核')}}</el-button>
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:Write-off']" v-if="[4,].includes(row.state)" @click="bridgeFn($t('佣金付款单核销申请'), 2, row, $t('提交核销'))"  >{{$t('核销')}}</el-button>
邓春圆's avatar
邓春圆 committed
117
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:print']" v-if="[4,6].includes(row.state)" @click="$router.push({path:'/financial/printPaymentVoucherCommission',query:{id:row.id}})"  >{{$t('打印')}}</el-button>
118 119 120 121
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:CancelWrite-off']" v-if="[6,].includes(row.state)" @click="bridgeFn($t('佣金付款单反核销申请'), 3, row, $t('提交反核销'))" >{{$t('反核销')}}</el-button>
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:CancelDe-approval']" v-if="[3].includes(row.state)" @click="bridgeFn($t('取消佣金付款单反审核'),4, row, $t('提交取消反审核') )" >{{$t('取消反审核')}}</el-button>
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:CancelWrite-off']" v-if="[5].includes(row.state)"  @click="bridgeFn($t('取消佣金付款单核销'),5, row, $t('取消付款单核销') )" > {{$t('取消核销')}} </el-button>
         <el-button type="text" size="mini" v-has-permi="['ecw:commission-Payment:CancelCancellingWrite-off']"  v-if="[7].includes(row.state)"  @click="bridgeFn($t('取消佣金付款单反核销'),6, row, $t('取消付款单反核销') )" > {{$t('取消反核销')}} </el-button>
邓春圆's avatar
邓春圆 committed
122 123 124 125 126 127 128 129 130 131 132
       </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.page"
      :limit.sync="queryParams.rows"
      @pagination="getList"
    />
    <!--对话框 审核 -->
133
    <el-dialog @close="paymentValue = ''"  width="30%" :title="paymentTitle" :visible.sync="paymentShow">
邓春圆's avatar
邓春圆 committed
134 135
      <div class="cancel_content">
        <span>{{ $t('申请理由') }}</span>
邓春圆's avatar
邓春圆 committed
136
        <el-input type="textarea" :rows="6" v-model="paymentValue" :placeholder="[1,2,3].includes(paymentIndex) ? $t('请输入申请理由') : $t('请输入取消理由')"></el-input>
邓春圆's avatar
邓春圆 committed
137 138 139
      </div>
      <span slot="footer" class="dialog-footers">
        <el-button type="primary" @click="cancelWriteOffClick()">{{ $t(butTitle) }}</el-button>
140
        <el-button @click="paymentShow = false; paymentValue = ''">{{ $t('取消') }}</el-button>
邓春圆's avatar
邓春圆 committed
141 142
      </span>
    </el-dialog>
143
<!--    <commission-payment-details :id="6"></commission-payment-details>-->
邓春圆's avatar
邓春圆 committed
144 145 146 147 148 149
  </div>
</template>

<script>
import {listSimpleUsers} from "@/api/system/user";
import {
150
  commissionPaymentCancelFinancePaymentApproval,
邓春圆's avatar
邓春圆 committed
151 152 153 154 155 156 157 158 159 160
  commissionPaymentCancelFinancePaymentApprovalNo,
  commissionPaymentCancelFinancePaymentWriteOff,
  commissionPaymentCancelFinancePaymentWriteOffNo,
  commissionPaymentDelete,
  commissionPaymentPage,
  commissionPaymentVerification,
  commissionPaymentVerificationCancel,
  commissionPaymentVerifyCancel
} from "@/api/ecw/financial";
import {parseTime} from "../../../utils/ruoyi";
161 162
import Template from "@/views/cms/template/index.vue";
import commissionPaymentDetails from "@/views/ecw/financial/components/commissionPaymentDetails.vue";
邓春圆's avatar
邓春圆 committed
163 164

export default {
165
  name: "EcwFinancialCommission-payment",
166
  components: {Template,commissionPaymentDetails},
167 168 169
  activated(){
    this.getList()
  },
邓春圆's avatar
邓春圆 committed
170 171 172 173 174
  created() {
    // 业务员
    listSimpleUsers().then((res) => (this.creatorData = res.data));
    this.getList();
    },
邓春圆's avatar
邓春圆 committed
175 176
  watch:{
    selectDate(val){
邓春圆's avatar
邓春圆 committed
177
      if(val !== null && val.length){
邓春圆's avatar
邓春圆 committed
178
         this.queryParams.beginCreateTime = val[0]
邓春圆's avatar
邓春圆 committed
179
         this.queryParams.endCreateTime = val[1]
邓春圆's avatar
邓春圆 committed
180
      }else {
邓春圆's avatar
邓春圆 committed
181 182
        this.queryParams.beginCreateTime = null;
        this.queryParams.endCreateTime = null;
邓春圆's avatar
邓春圆 committed
183 184 185
      }
    }
  },
邓春圆's avatar
邓春圆 committed
186 187 188
  data(){
    return {
      queryParams:{
189
        accountNumber:null,
邓春圆's avatar
邓春圆 committed
190 191 192 193
        invoiceStatus:null,
        state:null,
        salesmanName:null,
        searchKey:null,
194
        paymentNo:null,
邓春圆's avatar
邓春圆 committed
195 196
        beginCreateTime:null,
        endCreateTime:null,
邓春圆's avatar
邓春圆 committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
        page:1,
        rows:10,
      },
      selectDate:[],
      creatorData:[],
      list:[],
      total:0,
      paymentRow:{},
      paymentIndex:0,
      paymentTitle:'',
      butTitle:'',
      paymentShow:false,
      paymentValue:''
    }
  },
  methods:{
    parseTime,
    getList(){
      commissionPaymentPage(this.queryParams).then(r => {
         this.list = r.data.list
        this.total = r.data.total
      })
    },
  // 删除
    deleteFn(row){
      this.$confirm(this.$t('是否删除此条佣金付款单'), this.$t('提示'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(() => {
        commissionPaymentDelete({id:row.id}).then(r => {
          this.$message({
            type: 'success',
            message:this.$t('删除成功!')
          });
          this.getList();
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: this.$t('已取消删除')
        });
      });
    },
    bridgeFn(title, index ,row, butTitle = '提交'){
      this.paymentTitle =  title;
      this.butTitle = butTitle;
      this.paymentIndex = index;
      this.paymentRow = row;
      this.paymentShow = true;
    },
  //提交
    cancelWriteOffClick(){
      if(!this.paymentValue) return this.$message.warning(this.$t('请输入理由!'))
邓春圆's avatar
邓春圆 committed
251
      let resolve = (val = '操作成功')=>{
邓春圆's avatar
邓春圆 committed
252 253 254
        this.getList();
        this.paymentShow = false;
        this.paymentValue = ''
邓春圆's avatar
邓春圆 committed
255
        this.$message.success(val);
邓春圆's avatar
邓春圆 committed
256 257 258 259

      }
      let reject = ()=>{
        this.paymentShow = false;
260
        this.paymentValue = ''
邓春圆's avatar
邓春圆 committed
261 262 263 264 265
      }
      let p = {
        "paymentId": this.paymentRow.id,
        "paymentNo": this.paymentRow.paymentNo,
        "remark":this.paymentValue,
266
         "reason":this.paymentValue
邓春圆's avatar
邓春圆 committed
267 268 269
      }
      switch (this.paymentIndex){
        case 1:
270
          // 反审核佣金付款单
邓春圆's avatar
邓春圆 committed
271
          commissionPaymentVerifyCancel(p).then(()=>resolve(this.$t('提交佣金付款单反审核成功,请耐心等待审核结果!')), reject)
邓春圆's avatar
邓春圆 committed
272 273
          break;
        case 2:
274
          // 佣金付款单核销
邓春圆's avatar
邓春圆 committed
275
          commissionPaymentVerification(p).then(() =>resolve(this.$t('提交佣金付款单核销成功,请耐心等待审核结果!')), reject)
邓春圆's avatar
邓春圆 committed
276 277
          break;
        case 3:
278
          // 付款单反核销申请
邓春圆's avatar
邓春圆 committed
279
          commissionPaymentVerificationCancel(p).then(() =>resolve(this.$t('提交佣金付款单反核销申请成功,请耐心等待审核结果')), reject)
邓春圆's avatar
邓春圆 committed
280 281
          break;
        case 4:
282
          // 取消付款单反审核
邓春圆's avatar
邓春圆 committed
283
          commissionPaymentCancelFinancePaymentApprovalNo(p).then(() =>resolve(this.$t('取消佣金付款单反审核成功!')), reject)
邓春圆's avatar
邓春圆 committed
284 285
          break;
        case 5:
286
          // 取消付款单核销
邓春圆's avatar
邓春圆 committed
287
          commissionPaymentCancelFinancePaymentWriteOff(p).then(() =>resolve(this.$t('取消佣金付款单核销成功!')), reject)
邓春圆's avatar
邓春圆 committed
288 289
          break
        case 6:
290
          // 取消付款单反核销
邓春圆's avatar
邓春圆 committed
291
          commissionPaymentCancelFinancePaymentWriteOffNo(p).then(() =>resolve(this.$t('取消佣金付款单反核销成功!')), reject)
292
          break;
邓春圆's avatar
邓春圆 committed
293
        case 7:
294
          // 取消付款单审核
邓春圆's avatar
邓春圆 committed
295
          commissionPaymentCancelFinancePaymentApproval(p).then(() =>resolve(this.$t('取消佣金付款单审核成功!')), reject)
296
          break;
邓春圆's avatar
邓春圆 committed
297 298 299 300 301 302 303 304 305 306
      }

    }
  }
}
</script>

<style scoped>

</style>