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' ...@@ -4,9 +4,6 @@ import qs from 'qs'
// axios.defaults.baseURL = 'http://192.168.1.102:8300' // 本地钱 // axios.defaults.baseURL = 'http://192.168.1.102:8300' // 本地钱
axios.defaults.baseURL = 'http://139.196.213.18:8300' // beta环境 axios.defaults.baseURL = 'http://139.196.213.18:8300' // beta环境
let loadingInstance // 创建Loading 的实例 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 axios.defaults.headers['Authorization'] = `Bearer ${localStorage.getItem('token')}` // 设置请求头为 Authorization
// 配置发送请求前的拦截器可以设置token信息 // 配置发送请求前的拦截器可以设置token信息
axios.interceptors.request.use((config) => { axios.interceptors.request.use((config) => {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</div> </div>
<div> <div>
<label>截止日期</label> <label>截止日期</label>
<div>{{createTimeToStr(allowanceDetails.endTime) }}</div> <div>{{mwUtils.timeToStr(allowanceDetails.endTime) }}</div>
</div> </div>
<div> <div>
<label>津贴类型</label> <label>津贴类型</label>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</div> </div>
<div> <div>
<label>发放时间</label> <label>发放时间</label>
<div>{{createTimeToStr(allowanceDetails.createTime) }}</div> <div>{{mwUtils.timeToStr(allowanceDetails.createTime) }}</div>
</div> </div>
<div> <div>
<label>备注</label> <label>备注</label>
...@@ -41,10 +41,12 @@ ...@@ -41,10 +41,12 @@
<script> <script>
import { $http } from './../../../api/axios.js' import { $http } from './../../../api/axios.js'
import { mwUtils } from './../../../lib/utils.js'
export default { export default {
name: 'allowanceDetails', name: 'allowanceDetails',
data () { data () {
return { return {
mwUtils: mwUtils,
allowanceDetails: '' allowanceDetails: ''
} }
}, },
...@@ -54,16 +56,6 @@ export default { ...@@ -54,16 +56,6 @@ export default {
this.allowanceDetails = this.$route.params.allowanceDetails this.allowanceDetails = this.$route.params.allowanceDetails
}, },
methods: { 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 () { back () {
this.$router.go(-1) this.$router.go(-1)
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<!-- <span slot="grantNumber">单号</span> --> <!-- <span slot="grantNumber">单号</span> -->
<span slot="agentId">经办人</span> <span slot="agentId">经办人</span>
<span slot="createTime" slot-scope="createTime"> <span slot="createTime" slot-scope="createTime">
{{ createTimeToStr(createTime) }} {{ mwUtils.timeToStr(createTime) }}
</span> </span>
<span slot="remark">备注</span> <span slot="remark">备注</span>
<span slot="couponRecordStatus" slot-scope="couponRecordStatus"> <span slot="couponRecordStatus" slot-scope="couponRecordStatus">
...@@ -97,10 +97,12 @@ import { config } from './../../../api/config.js' ...@@ -97,10 +97,12 @@ import { config } from './../../../api/config.js'
import { $http } from './../../../api/axios.js' import { $http } from './../../../api/axios.js'
import { MINGPAY_SUBSIDY_STATUS } from './../../../api/constant' import { MINGPAY_SUBSIDY_STATUS } from './../../../api/constant'
import moment from 'moment' import moment from 'moment'
import { mwUtils } from './../../../lib/utils.js'
export default { export default {
name: 'AllowancePayment', name: 'AllowancePayment',
data () { data () {
return { return {
mwUtils: mwUtils,
MINGPAY_SUBSIDY_STATUS: MINGPAY_SUBSIDY_STATUS, MINGPAY_SUBSIDY_STATUS: MINGPAY_SUBSIDY_STATUS,
spinning: false, spinning: false,
delayTime: 100, delayTime: 100,
...@@ -126,10 +128,6 @@ export default { ...@@ -126,10 +128,6 @@ export default {
dataIndex: 'type', dataIndex: 'type',
scopedSlots: { customRender: 'type' } scopedSlots: { customRender: 'type' }
}, },
// {
// title: '单号',
// dataIndex: 'grantNumber'
// },
{ {
title: '经办人', title: '经办人',
dataIndex: 'agentId' dataIndex: 'agentId'
...@@ -225,16 +223,6 @@ export default { ...@@ -225,16 +223,6 @@ export default {
} }
callback() 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 // 清理选择帅选人list
clearUserMessage () { clearUserMessage () {
this.searchSource.UserMessage = { this.searchSource.UserMessage = {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<a-table :columns="columns" :dataSource="cashierManagementList" size="default" rowKey="id" :pagination="pagination" @change="handleTableChange"> <a-table :columns="columns" :dataSource="cashierManagementList" size="default" rowKey="id" :pagination="pagination" @change="handleTableChange">
<span slot="name">成员</span> <span slot="name">成员</span>
<span slot="createDate" slot-scope="createDate"> <span slot="createDate" slot-scope="createDate">
{{ createTimeToStr(createDate) }} {{ mwUtils.timeToStr(createDate) }}
</span> </span>
<span slot="action" slot-scope="text, record, index"> <span slot="action" slot-scope="text, record, index">
<a v-if="record.status === '0'" href="javascript:;" @click="showModel(record, text, index)">删除</a> <a v-if="record.status === '0'" href="javascript:;" @click="showModel(record, text, index)">删除</a>
...@@ -24,10 +24,12 @@ ...@@ -24,10 +24,12 @@
<script> <script>
import { config } from './../../../api/config.js' import { config } from './../../../api/config.js'
import { $http } from './../../../api/axios.js' import { $http } from './../../../api/axios.js'
import { mwUtils } from './../../../lib/utils.js'
export default { export default {
name: 'cashierManagement', name: 'cashierManagement',
data () { data () {
return { return {
mwUtils: mwUtils,
searchSource: { searchSource: {
UserMessage: { UserMessage: {
avatar: '', avatar: '',
......
...@@ -6,7 +6,6 @@ ...@@ -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-option v-for="(item, index) in agentList" :key="index" :value="item.ddUserId">{{ item.name }}</a-select-option>
</a-select> </a-select>
<a-select placeholder="状态" :allowClear="true" style="width: 120px;margin-right: 20px;" @change="selectHandlestatus"> <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="SUCCESS">已完成</a-select-option>
<a-select-option value="WAITING_PERMIT">审批中</a-select-option> <a-select-option value="WAITING_PERMIT">审批中</a-select-option>
<a-select-option value="FAILED">审批未通过</a-select-option> <a-select-option value="FAILED">审批未通过</a-select-option>
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
<span slot="agent" slot-scope="agent, record"> <span slot="agent" slot-scope="agent, record">
{{ agent === '' && record.payTypeCode === 'EXTERNAL_ALI_RECHAGE' ? '支付宝自充' : agent }} {{ agent === '' && record.payTypeCode === 'EXTERNAL_ALI_RECHAGE' ? '支付宝自充' : agent }}
</span> </span>
<!-- <span slot="orderNo">单号</span> -->
<span slot="orderStatus" slot-scope="orderStatus"> <span slot="orderStatus" slot-scope="orderStatus">
<a-badge v-if="orderStatus === MINGPAY_CHARGE_ORDERSTATUS.WAITING_PERMIT" status="processing" text="审批中" /> <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="已完成" /> <a-badge v-else-if="orderStatus === MINGPAY_CHARGE_ORDERSTATUS.SUCCESS" status="success" text="已完成" />
...@@ -72,12 +70,7 @@ export default { ...@@ -72,12 +70,7 @@ export default {
title: '经办人', title: '经办人',
dataIndex: 'agent', dataIndex: 'agent',
scopedSlots: { customRender: 'agent' } scopedSlots: { customRender: 'agent' }
}, }, {
// {
// title: '单号',
// dataIndex: 'orderNo'
// },
{
title: '状态', title: '状态',
dataIndex: 'orderStatus', dataIndex: 'orderStatus',
scopedSlots: { customRender: 'orderStatus' } scopedSlots: { customRender: 'orderStatus' }
...@@ -125,35 +118,6 @@ export default { ...@@ -125,35 +118,6 @@ export default {
this.agentList = res.data.data.recordList 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 () { choosePeople () {
config.ddready('ddchooseOne').then((res) => { 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