AllowanceDetails.vue 6.27 KB
Newer Older
liang ce committed
1
<template>
liang ce committed
2 3 4 5 6 7 8 9 10 11 12
  <a-spin :spinning="spinning" :delay="delayTime">
    <div class="allowanceDetails">
      <a-button type="primary" @click="back()"><img style="margin-top:-4px;margin-right: 6px;width: 14px" src="../../../assets/back.png"/>返回</a-button>
      <div class="title">津贴详情</div>
      <div class="allowanceDetailsBox" v-if="allowanceDetails">
        <div>
          <label>津贴类型</label>
          <div>{{allowanceDetails.subsidyType === 'TRAVEL' ? '交通补贴' : '餐补'}}</div>
        </div>
        <div>
          <label>截止日期</label>
liang ce committed
13
          <div>{{ allowanceDetails.endTime }} <span v-if="isshowChange" class="changeEndTime" @click="changeEndTimeModel">修改</span></div>
liang ce committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
        </div>
        <div>
          <label>单号</label>
          <div>{{allowanceDetails.grantNumber}}</div>
        </div>
        <div>
          <label>经办人</label>
          <div>{{allowanceDetails.agentName}}</div>
        </div>
        <div>
          <label>发放时间</label>
          <div>{{ allowanceDetails.createTime }}</div>
        </div>
        <div>
          <label>备注</label>
          <div>{{allowanceDetails.remark}}</div>
        </div>
        <div>
          <label>单笔金额</label>
          <div>{{allowanceDetails.subsidyAmount.toFixed(2)}}</div>
        </div>
        <div>
          <label>发放笔数</label>
          <div>{{allowanceDetails.subsidyQuantity}}</div>
        </div>
        <div>
          <label>发放对象</label>
          <div>{{allowanceDetails.recipient}}</div>
        </div>
liang ce committed
43
      </div>
liang ce committed
44 45 46 47 48 49 50 51 52
      <div class="clickshowsearchUserMessage" @click="changeIsShow"><a href="javascript:;">查看具体成员</a></div>
      <div class="searchUserMessage" v-if="isshow">
        <div class="positionDiv"></div>
        <div style="margin-bottom: 8px">
          <label>请输入查询人员:</label><a-input style="width:220px" v-model="searchData" placeholder="" />
        </div>
        <div class="userList">
          <span v-for="(item,index) in allowanceDetails.grantSubsidyUserName" :class="searchData.trim() === item ? 'searchData': ''" :key="index">{{item}}</span>
        </div>
liang ce committed
53
      </div>
liang ce committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
      <a-modal title="修改截止日期" v-model="visible" @ok="changeEndTime()">
        <a-form :form="form">
          <a-form-item
            v-bind="formItemLayout"
            label="截止日期"
          >
            <a-date-picker
              placeholder="请选择截止日期"
              :disabledDate="disabledDate"
              :showToday="false"
              v-decorator="['date-picker', config]"
            />
          </a-form-item>
        </a-form>
      </a-modal>
liang ce committed
69
    </div>
liang ce committed
70
  </a-spin>
liang ce committed
71 72 73
</template>

<script>
liang ce committed
74
import { $http } from './../../../api/axios.js'
liang ce committed
75
import moment from 'moment'
liang ce committed
76 77 78 79
export default {
  name: 'allowanceDetails',
  data () {
    return {
liang ce committed
80
      moment,
liang ce committed
81 82 83
      grantNumber: '',
      allowanceDetails: '',
      searchData: '',
liang ce committed
84 85 86 87 88
      isshow: false,
      visible: false,
      spinning: false,
      delayTime: 100,
      form: this.$form.createForm(this),
liang ce committed
89
      isshowChange: false,
liang ce committed
90 91 92 93 94 95 96 97 98 99 100 101 102
      config: {
        rules: [{ type: 'object', required: true, message: '请选择时间' }]
      },
      formItemLayout: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        }
      }
liang ce committed
103 104 105 106 107
    }
  },
  watch: {},
  computed: {},
  created: function () {
liang ce committed
108 109
    this.grantNumber = this.$route.params.allowanceDetails
    this.getStatisticalProductPage()
liang ce committed
110 111
  },
  methods: {
liang ce committed
112 113 114 115 116
    disabledDate (current) {
      // Can not select days before today and today
      console.log(moment().endOf('day'))
      return current < moment(Date.now()).add(-1, 'day')
    },
liang ce committed
117
    getStatisticalProductPage () {
liang ce committed
118
      let data = {
liang ce committed
119
        grantNumber: this.grantNumber
liang ce committed
120 121
      }
      $http.get(`/mingpay/v1/isv/account/coupon_record_detail`, data).then((res) => {
liang ce committed
122
        console.log(res)
liang ce committed
123
        this.isshowChange = new Date(res.data.data.endTime).getTime() > new Date().getTime()
liang ce committed
124 125 126
        this.allowanceDetails = res.data.data
      })
    },
liang ce committed
127 128
    back () {
      this.$router.go(-1)
liang ce committed
129 130 131
    },
    changeIsShow () {
      this.isshow = !this.isshow
liang ce committed
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
    },
    changeEndTimeModel () {
      this.visible = !this.visible
    },
    changeEndTime () {
      let that = this
      this.form.validateFields((err, fieldsValue) => {
        if (err) {
          this.$message.error('请完整填写津贴相关信息')
          return
        }
        this.visible = false
        this.spinning = true
        // Should format date value before submit.
        const values = {
          ...fieldsValue,
          'date-picker': fieldsValue['date-picker'].format('YYYY-MM-DD')
        }
        let RecordData = {
          endTime: `${values['date-picker']} 23:59:59`,
          grantNumber: this.grantNumber
        }
        $http.post(`/mingpay/v1/isv/account/update_coupon_record`, RecordData).then((res) => {
          if (res.data.resultCode === 0) {
            that.allowanceDetails.endTime = `${values['date-picker']} 23:59:59`
            that.spinning = !that.spinning
            that.$message.success('修改成功')
          } else {
            that.$message.error('修改失败')
          }
        })
      })
liang ce committed
164 165 166 167 168 169 170 171
    }
  }
}
</script>

<style lang="less" scoped>
.title{
  font-weight: bold;
liang ce committed
172
  margin-top: 20px;
liang ce committed
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
}
.allowanceDetailsBox{
  width: 100%;
  line-height: 30px;
}
.allowanceDetailsBox>div{
  display: flex;
  margin: 10px 0;
}
.allowanceDetailsBox>div>label{
  width: 80px;
  text-align: right;
  font-weight: bold;
  margin-right: 20px;
}
.allowanceDetailsBox>div>div{
  flex: 1;
}
liang ce committed
191 192 193 194 195 196 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
.searchUserMessage{
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 14px;
  padding: 8px 8px;
  padding-right: 20px;
  border: 1px solid #cccccc;
  margin-bottom: 15px;
  border-radius: 8px;
  position: relative;
}
.positionDiv{
  height: 12px;
  width: 12px;
  transform:rotate(45deg);
  border-left: 1px solid #cccccc;
  border-top: 1px solid #cccccc;
  position: absolute;
  top: -7px;
  left: 30px;
  background: white;
  z-index: 99;
}
.searchData{
  color: red;
}
.userList>span{
  padding: 6px;
}
.clickshowsearchUserMessage{
  margin-bottom: 20px;
}
liang ce committed
225 226 227 228 229
.changeEndTime{
  margin-left: 15px;
  color: #1890ff;
  cursor: pointer;
}
liang ce committed
230
</style>