Commit 7b33387f by liang ce

时间处理函数封装

parent 2ac9214d
const avatarFn = {
avatarCanvas: (name) => {
let canvas = document.createElement('canvas')
let con = canvas.getContext('2d')
con.fillStyle = '#1890ff'
con.fillRect(0, 0, 32, 32)
con.fillStyle = '#ffffff'
con.font = '18px Arial'
con.textAlign = 'center'
con.fillText(name, 50, 55)
con.toDataURL()
return canvas.toDataURL()
}
}
export default { avatarFn }
......@@ -4,9 +4,6 @@ import qs from 'qs'
// axios.defaults.baseURL = 'http://192.168.1.102:8300' // 本地钱
axios.defaults.baseURL = 'http://139.196.213.18:8300' // beta环境
let loadingInstance // 创建Loading 的实例
// axios.defaults.headers.post['Content-Type'] = 'application/json; charset=utf-8'
// axios.defaults.crossDomain = true
// axios.defaults.withCredentials = true // 设置cross跨域 并设置访问权限 允许跨域携带cookie信息
axios.defaults.headers['Authorization'] = `Bearer ${localStorage.getItem('token')}` // 设置请求头为 Authorization
// 配置发送请求前的拦截器可以设置token信息
axios.interceptors.request.use((config) => {
......
......@@ -13,7 +13,7 @@
</div>
<div>
<label>截止日期</label>
<div>{{createTimeToStr(allowanceDetails.endTime) }}</div>
<div>{{mwUtils.timeToStr(allowanceDetails.endTime) }}</div>
</div>
<div>
<label>津贴类型</label>
......@@ -29,7 +29,7 @@
</div>
<div>
<label>发放时间</label>
<div>{{createTimeToStr(allowanceDetails.createTime) }}</div>
<div>{{mwUtils.timeToStr(allowanceDetails.createTime) }}</div>
</div>
<div>
<label>备注</label>
......@@ -41,10 +41,12 @@
<script>
import { $http } from './../../../api/axios.js'
import { mwUtils } from './../../../lib/utils.js'
export default {
name: 'allowanceDetails',
data () {
return {
mwUtils: mwUtils,
allowanceDetails: ''
}
},
......@@ -54,16 +56,6 @@ export default {
this.allowanceDetails = this.$route.params.allowanceDetails
},
methods: {
// 表格时间处理
createTimeToStr (time) {
let timeData = new Date(parseInt(time))
let year = timeData.getFullYear()
let month = timeData.getMonth() + 1
let date = timeData.getDate()
let hour = timeData.getHours()
let minute = timeData.getMinutes()
return `${year}${month}${date}${hour}:${minute}`
},
back () {
this.$router.go(-1)
}
......
......@@ -27,7 +27,7 @@
<!-- <span slot="grantNumber">单号</span> -->
<span slot="agentId">经办人</span>
<span slot="createTime" slot-scope="createTime">
{{ createTimeToStr(createTime) }}
{{ mwUtils.timeToStr(createTime) }}
</span>
<span slot="remark">备注</span>
<span slot="couponRecordStatus" slot-scope="couponRecordStatus">
......@@ -97,10 +97,12 @@ import { config } from './../../../api/config.js'
import { $http } from './../../../api/axios.js'
import { MINGPAY_SUBSIDY_STATUS } from './../../../api/constant'
import moment from 'moment'
import { mwUtils } from './../../../lib/utils.js'
export default {
name: 'AllowancePayment',
data () {
return {
mwUtils: mwUtils,
MINGPAY_SUBSIDY_STATUS: MINGPAY_SUBSIDY_STATUS,
spinning: false,
delayTime: 100,
......@@ -126,10 +128,6 @@ export default {
dataIndex: 'type',
scopedSlots: { customRender: 'type' }
},
// {
// title: '单号',
// dataIndex: 'grantNumber'
// },
{
title: '经办人',
dataIndex: 'agentId'
......@@ -225,16 +223,6 @@ export default {
}
callback()
},
// 表格时间处理
createTimeToStr (time) {
let timeData = new Date(parseInt(time))
let year = timeData.getFullYear()
let month = timeData.getMonth() + 1
let date = timeData.getDate()
let hour = timeData.getHours()
let minute = timeData.getMinutes()
return `${year}${month}${date}${hour}:${minute}`
},
// 清理选择帅选人list
clearUserMessage () {
this.searchSource.UserMessage = {
......
......@@ -11,7 +11,7 @@
<a-table :columns="columns" :dataSource="cashierManagementList" size="default" rowKey="id" :pagination="pagination" @change="handleTableChange">
<span slot="name">成员</span>
<span slot="createDate" slot-scope="createDate">
{{ createTimeToStr(createDate) }}
{{ mwUtils.timeToStr(createDate) }}
</span>
<span slot="action" slot-scope="text, record, index">
<a v-if="record.status === '0'" href="javascript:;" @click="showModel(record, text, index)">删除</a>
......@@ -24,10 +24,12 @@
<script>
import { config } from './../../../api/config.js'
import { $http } from './../../../api/axios.js'
import { mwUtils } from './../../../lib/utils.js'
export default {
name: 'cashierManagement',
data () {
return {
mwUtils: mwUtils,
searchSource: {
UserMessage: {
avatar: '',
......
......@@ -6,7 +6,6 @@
<a-select-option v-for="(item, index) in agentList" :key="index" :value="item.ddUserId">{{ item.name }}</a-select-option>
</a-select>
<a-select placeholder="状态" :allowClear="true" style="width: 120px;margin-right: 20px;" @change="selectHandlestatus">
<!-- <a-select-option value="WAITING_PAYMENT">等待支付</a-select-option> -->
<a-select-option value="SUCCESS">已完成</a-select-option>
<a-select-option value="WAITING_PERMIT">审批中</a-select-option>
<a-select-option value="FAILED">审批未通过</a-select-option>
......@@ -33,7 +32,6 @@
<span slot="agent" slot-scope="agent, record">
{{ agent === '' && record.payTypeCode === 'EXTERNAL_ALI_RECHAGE' ? '支付宝自充' : agent }}
</span>
<!-- <span slot="orderNo">单号</span> -->
<span slot="orderStatus" slot-scope="orderStatus">
<a-badge v-if="orderStatus === MINGPAY_CHARGE_ORDERSTATUS.WAITING_PERMIT" status="processing" text="审批中" />
<a-badge v-else-if="orderStatus === MINGPAY_CHARGE_ORDERSTATUS.SUCCESS" status="success" text="已完成" />
......@@ -72,12 +70,7 @@ export default {
title: '经办人',
dataIndex: 'agent',
scopedSlots: { customRender: 'agent' }
},
// {
// title: '单号',
// dataIndex: 'orderNo'
// },
{
}, {
title: '状态',
dataIndex: 'orderStatus',
scopedSlots: { customRender: 'orderStatus' }
......@@ -125,35 +118,6 @@ export default {
this.agentList = res.data.data.recordList
})
},
// 充值状态
// returnStatus (str) {
// let status = ''
// switch (str) {
// case MINGPAY_CHARGE_ORDERSTATUS.WAITING_PERMIT:
// status = '审批中'
// break
// case MINGPAY_CHARGE_ORDERSTATUS.SUCCESS:
// status = '已完成'
// break
// case MINGPAY_CHARGE_ORDERSTATUS.FAILED:
// status = '审批未通过'
// break
// case MINGPAY_CHARGE_ORDERSTATUS.WAITING_PAYMENT:
// status = '等待支付'
// break
// }
// return status
// },
// 表格时间格式处理
createTimeToStr (time) {
let timeData = new Date(parseInt(time))
let year = timeData.getFullYear()
let month = timeData.getMonth() + 1
let date = timeData.getDate()
let hour = timeData.getHours()
let minute = timeData.getMinutes()
return `${year}${month}${date}${hour}:${minute}`
},
// 选人组件调用
choosePeople () {
config.ddready('ddchooseOne').then((res) => {
......
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