Commit 9891e837 by liang ce

token和orgId封装

parent 58a97299
......@@ -38,14 +38,15 @@ axios.interceptors.response.use(res => {
if (err && err.response) {
switch (err.response.status) {
case 401:
message.error('网络异常请重试')
refreshToken().then(res => {
console.log('refreshToken1', res)
resolve(err)
})
break
case 426:
message.error('网络异常请重试')
getToken().then((res) => {
console.log('getToken1', res)
resolve(err)
})
break
......
......@@ -2,6 +2,7 @@ import * as dd from 'dingtalk-jsapi'
import router from '../router'
import axios from 'axios'
import qs from 'qs'
import { message } from 'ant-design-vue'
var instance = axios.create()
const BASE_URL = process.env.VUE_APP_API_URL
......
<template>
<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>
......@@ -9,7 +10,7 @@
</div>
<div>
<label>截止日期</label>
<div>{{ allowanceDetails.endTime }}</div>
<div>{{ allowanceDetails.endTime }} <span class="changeEndTime" @click="changeEndTimeModel">修改</span></div>
</div>
<div>
<label>单号</label>
......@@ -50,19 +51,54 @@
<span v-for="(item,index) in allowanceDetails.grantSubsidyUserName" :class="searchData.trim() === item ? 'searchData': ''" :key="index">{{item}}</span>
</div>
</div>
<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>
</div>
</a-spin>
</template>
<script>
import { $http } from './../../../api/axios.js'
import moment from 'moment'
export default {
name: 'allowanceDetails',
data () {
return {
moment,
grantNumber: '',
allowanceDetails: '',
searchData: '',
isshow: false
isshow: false,
visible: false,
spinning: false,
delayTime: 100,
form: this.$form.createForm(this),
config: {
rules: [{ type: 'object', required: true, message: '请选择时间' }]
},
formItemLayout: {
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
}
}
}
},
watch: {},
......@@ -72,6 +108,11 @@ export default {
this.getStatisticalProductPage()
},
methods: {
disabledDate (current) {
// Can not select days before today and today
console.log(moment().endOf('day'))
return current < moment(Date.now()).add(-1, 'day')
},
getStatisticalProductPage () {
let data = {
grantNumber: this.grantNumber
......@@ -86,6 +127,38 @@ export default {
},
changeIsShow () {
this.isshow = !this.isshow
},
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('修改失败')
}
})
})
}
}
}
......@@ -147,4 +220,9 @@ export default {
.clickshowsearchUserMessage{
margin-bottom: 20px;
}
.changeEndTime{
margin-left: 15px;
color: #1890ff;
cursor: pointer;
}
</style>
......@@ -2,15 +2,36 @@
<a-spin :spinning="spinning" :delay="delayTime">
<div class="AllowancePayment">
<div class="searchBox">
<a-select placeholder="津贴类型" :allowClear="true" style="width: 120px;margin-right: 20px;" @change="selectHandType">
<div style="width: 75px">截止时间:</div>
<a-date-picker
:disabledDate="disabledStartDate"
format="YYYY-MM-DD"
v-model="startValue"
style="120px"
placeholder="开始日期"
@change="onChangeStartValue"
@openChange="handleStartOpenChange"
/>
<div></div>
<a-date-picker
:disabledDate="disabledEndDate"
format="YYYY-MM-DD"
placeholder="结束日期"
style="120px"
@change="onChangeEndValue"
v-model="endValue"
:open="endOpen"
@openChange="handleEndOpenChange"
/>
<a-select placeholder="津贴类型" :allowClear="true" style="width: 100px;margin-left: 15px;" @change="selectHandType">
<a-select-option value="TRAVEL">交通补助</a-select-option>
<a-select-option value="MEAL">餐补</a-select-option>
</a-select>
<a-select placeholder="经办人" :allowClear="true" style="width: 120px;margin-right: 20px;" @change="selectAgent">
<a-select placeholder="经办人" :allowClear="true" style="width: 100px;margin-left: 15px;" @change="selectAgent">
<a-select-option v-for="(item, index) in agentList" :key="index" :value="item.ddUserId">{{ item.name }}</a-select-option>
</a-select>
<a-button type="primary" @click="search()">查询</a-button>
<a-button type="primary" @click="changeModel()" style="margin-left: 20px;"><a-icon type="pay-circle" />发放津贴</a-button>
<a-button type="primary" @click="search()" style="margin-left: 15px;">查询</a-button>
<a-button type="primary" @click="changeModel()" style="margin-left: 15px;"><a-icon type="pay-circle" />发放津贴</a-button>
</div>
<a-table :columns="columns" :dataSource="recordsList" size="default" rowKey="grantNumber" :pagination="pagination" @change="handleTableChange">
<span slot="recipient">成员</span>
......@@ -19,7 +40,7 @@
</span>
<span slot="type" slot-scope="type">{{ type === 'TRAVEL' ? '交通补助' : '餐补' }}</span>
<span slot="agentId">经办人</span>
<span slot="createTime">时间</span>
<span slot="endTime">截止时间</span>
<span slot="remark">备注</span>
<span slot="couponRecordStatus" slot-scope="couponRecordStatus">
<a-badge v-if="couponRecordStatus === MINGPAY_SUBSIDY_STATUS.WAITING_PERMIT" status="processing" text="审批中" />
......@@ -128,8 +149,8 @@ export default {
title: '备注',
dataIndex: 'remark'
}, {
title: '时间',
dataIndex: 'createTime'
title: '截止时间',
dataIndex: 'endTime'
}, {
title: '操作',
dataIndex: 'action',
......@@ -159,14 +180,49 @@ export default {
},
userIdListObj: [],
departmentIdListObj: [],
agentList: []
agentList: [],
startValue: null,
endValue: null,
startTime: '',
endTime: '',
endOpen: false
}
},
created: function () {
this.queryRecordList()
this.queryCouponRecordList()
this.getAgentList()
},
methods: {
// 时间筛选
moment,
disabledStartDate (startValue) {
const endValue = this.endValue
if (!startValue || !endValue) {
return false
}
return startValue.valueOf() > endValue.valueOf() || startValue.valueOf() >= moment().endOf('day').valueOf()
},
disabledEndDate (endValue) {
const startValue = this.startValue
if (!endValue || !startValue) {
return false
}
return startValue.valueOf() > endValue.valueOf()
},
handleStartOpenChange (open) {
if (!open) {
this.endOpen = true
}
},
handleEndOpenChange (open) {
this.endOpen = open
},
onChangeStartValue (date, dateString) {
this.startTime = dateString
},
onChangeEndValue (date, dateString) {
this.endTime = dateString
},
// 获取收银员列表
getAgentList () {
let AgentData = {
......@@ -187,13 +243,15 @@ export default {
console.log(moment().endOf('day'))
return current < moment(Date.now()).add(-1, 'day')
},
// 获取消费列表
queryRecordList () {
// 获取津贴列表
queryCouponRecordList () {
let RecordData = {
currentPage: this.pagination.current,
pageNumber: this.pagination.defaultPageSize,
subsidyType: this.searchSource.type,
agentId: this.searchSource.agentId
agentId: this.searchSource.agentId,
startTime: this.startTime,
endTime: this.endTime
}
$http.get(`/mingpay/v1/isv/account/list_couponRecord`, RecordData).then((res) => {
let data = res.data.data
......@@ -248,7 +306,7 @@ export default {
},
handleTableChange (pagination, filters, sorter) {
this.pagination.current = pagination.current
this.queryRecordList()
this.queryCouponRecordList()
},
// 搜索条件津贴类型
selectHandType (value) {
......@@ -304,7 +362,7 @@ export default {
this.departmentIdListObj = []
this.spinning = false
this.$message.success(res.data.data)
this.queryRecordList()
this.queryCouponRecordList()
} else {
this.spinning = false
this.$message.error(res.data.message)
......@@ -324,7 +382,7 @@ export default {
},
search () {
this.pagination.current = 1
this.queryRecordList()
this.queryCouponRecordList()
}
}
}
......@@ -333,6 +391,7 @@ export default {
<style lang="less" scoped>
.searchBox{
display: flex;
align-items: center;
margin-bottom: 20px;
}
.searchBox > input {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment