2024-08-05 16:15:43 +08:00
< template >
< a-modal
class = "allUserPoeration_modal generalModel"
v - model : visible = "operationsModal"
: footer = "null"
width = "50%"
: maskClosable = "false"
: centered = "true"
: closable = "false"
: mask = "false"
wrapClassName = "#app"
: keyboard = "false"
>
< div class = "generalModel_btn" >
< div class = "generalModel_closeIcon" @click.stop ="cancelDsign()" >
< i class = "fi fi-rr-cross-small" > < / i >
< / div >
< / div >
< div class = "modal_title_text" >
< div > { { title } } User < / div >
< / div >
< div class = "allUserPoeration_center admin_page" >
< div class = "admin_state_item" >
2024-09-13 14:38:35 +08:00
< span > User Name : < span > * < / span > < / span >
2024-08-05 16:15:43 +08:00
< input
: readonly = "title != 'Add'"
: class = "{active:title != 'Add'}"
v - model = "userName"
placeholder = "Please enter user name"
type = "text"
style = "width: 250px"
/ >
< / div >
< div class = "admin_state_item" >
2024-09-13 14:38:35 +08:00
< span > User Email : < span > * < / span > < / span >
2024-08-05 16:15:43 +08:00
< input
: readonly = "title != 'Add'"
: class = "{active:title != 'Add'}"
v - model = "userEmail"
placeholder = "Please enter email"
type = "text"
style = "width: 250px"
/ >
< / div >
< div class = "admin_state_item" >
2024-09-13 14:38:35 +08:00
< span > Create Time : < span > * < / span > < / span >
2024-08-05 16:15:43 +08:00
< a-date-picker : disabled = "title != 'Add'" style = "width: 250px" valueFormat = "YYYY-MM-DDTHH:mm:ss" class = "range_picker" show -time placeholder = "Create Time" v -model :value = "validStartTime" >
< template # suffixIcon >
< span
class = "icon iconfont range_picker_icon icon-rili"
> < / span >
< / template >
< / a-date-picker >
< / div >
< div class = "admin_state_item" >
2024-09-13 14:38:35 +08:00
< span > End Time : < span > * < / span > < / span >
2024-08-05 16:15:43 +08:00
< a-date-picker style = "width: 250px" valueFormat = "YYYY-MM-DDTHH:mm:ss" class = "range_picker" show -time placeholder = "End Time" v -model :value = "validEndTime" >
< template # suffixIcon >
< span
class = "icon iconfont range_picker_icon icon-rili"
> < / span >
< / template >
< / a-date-picker >
< / div >
< div class = "admin_state_item" >
2024-09-13 14:38:35 +08:00
< span > User Type : < span > * < / span > < / span >
2024-08-05 16:15:43 +08:00
< a-select
v - model : value = "systemUser"
size = "large"
style = "width: 250px"
optionFilterProp = "label"
: options = "state"
placeholder = "Please select"
allowClear
show - search
> < / a-select >
< / div >
< div class = "admin_state_item" >
2024-08-06 10:05:50 +08:00
< span > Credits : < / span >
2024-08-05 16:15:43 +08:00
< input
v - model = "credits"
placeholder = "Please enter credits"
type = "text"
style = "width: 250px"
/ >
< / div >
< div class = "admin_state_item" >
2024-08-06 10:05:50 +08:00
< span > Country : < / span >
2024-08-05 16:15:43 +08:00
< input
: readonly = "title != 'Add'"
: class = "{active:title != 'Add'}"
v - model = "country"
placeholder = "Please enter country"
type = "text"
style = "width: 250px"
/ >
< / div >
< / div >
< div class = "allUserPoeration_btn admin_page" >
< div class = "admin_search_item" @click ="cancelDsign" >
Close
< / div >
< div class = "admin_search_item" @click ="setOk" >
OK
< / div >
< / div >
< / a-modal >
< div class = "mark_loading" v-show = "loadingShow" >
< a-spin size = "large" / >
< / div >
< / template >
< script >
import { defineComponent , ref , reactive , watch , onMounted , nextTick , toRefs } from "vue" ;
import { Https } from "@/tool/https" ;
import { setCookie , getCookie } from "@/tool/cookie" ;
import { Modal , message } from "ant-design-vue" ;
import { ExclamationCircleOutlined } from "@ant-design/icons-vue" ;
import { formatTime } from "@/tool/util" ;
import allOrder from "@/component/Pay/allOrder.vue" ;
import creditsDetail from "@/component/Pay/creditsDetail.vue" ;
import { exportSele , JSRectUpdata , JSchangeType , JScanvasMouseDown , JSSetRemoveImage , JScreateCheck , JSSetTexture } from "@/tool/canvasDrawing" ;
import { useI18n } from "vue-i18n" ;
export default defineComponent ( {
components : {
creditsDetail ,
allOrder ,
} ,
emits : [ 'searchHistoryList' ] ,
setup ( props , { emit } ) {
let operations = reactive ( {
operationsModal : false ,
operationsEdit : false ,
loadingShow : false ,
title : ''
} )
let operationsData = reactive ( {
accountId : - 1 ,
userName : '' ,
userEmail : '' ,
validStartTime : '' ,
validEndTime : '' ,
systemUser : '' ,
credits : '' ,
country : '' ,
} )
let state = ref ( [
{
label : 'visitor' ,
value : '0' ,
} ,
{
label : 'yearly' ,
value : '1' ,
} ,
{
label : 'monthly' ,
value : '2' ,
} ,
{
label : 'trial' ,
value : '3' ,
} ,
] ) ;
let init = ( funStr , data ) => {
operations . operationsModal = true
operations . operationsEdit = true
operations . title = funStr
if ( funStr == 'Add' ) operations . operationsEdit = false
if ( funStr == 'Edit' ) {
let startTime = data . validStartTime ? formatTime ( data . validStartTime / 1000 , "YYYY-MM-DDThh:mm:ss" ) : ''
let endTime = data . validEndTime ? formatTime ( data . validEndTime / 1000 , "YYYY-MM-DDThh:mm:ss" ) : ''
operationsData . accountId = data . id
operationsData . userName = data . userName
operationsData . userEmail = data . userEmail
// operationsData.validStartTime='2024-08-05T00:00:06'
// operationsData.validEndTime='2024-08-05T00:00:06'
operationsData . validStartTime = startTime
operationsData . validEndTime = endTime
operationsData . systemUser = String ( data . systemUser )
operationsData . credits = data . credits
operationsData . country = data . country
// operationsData.accountId = data.accountId
// operationsData.userName = data.userName
// operationsData.userEmail = data.userEmail
// operationsData.validStartTime = formatTime(data.validStartTime)
// operationsData.validEndTime = formatTime(data.validEndTime)
}
}
let setTime = ( time ) => {
2024-08-06 10:05:50 +08:00
if ( time ) {
const date = new Date ( time ) ;
const timestamp = date . getTime ( ) ; // 转换为秒数
return timestamp
} else {
return ''
}
2024-08-05 16:15:43 +08:00
}
let setAddData = ( ) => {
return {
"country" : operationsData . country ,
"credits" : operationsData . credits ,
"systemUser" : operationsData . systemUser ,
"userEmail" : operationsData . userEmail ,
"userName" : operationsData . userName ,
"validEndTime" : setTime ( operationsData . validEndTime ) ,
"validStartTime" : setTime ( operationsData . validStartTime )
}
}
let setEditData = ( ) => {
return {
"accountId" : operationsData . accountId ,
"credits" : operationsData . credits ,
"systemUser" : operationsData . systemUser ,
"validEndTime" : setTime ( operationsData . validEndTime ) ,
}
}
let cancelDsign = ( ) => {
operationsData . accountId = - 1
operationsData . userName = ''
operationsData . userEmail = ''
operationsData . validStartTime = ''
operationsData . validEndTime = ''
operationsData . systemUser = ''
operationsData . credits = ''
operationsData . country = ''
operations . operationsModal = false
}
let setOk = ( ) => {
let data
if ( operations . title == 'Add' ) {
data = setAddData ( )
2024-09-13 14:38:35 +08:00
if ( ! data . userName || ! data . userEmail || ! data . validStartTime || ! data . validEndTime || ! data . systemUser ) return message . warning ( 'Please check the input box marked with *' )
2024-08-05 16:15:43 +08:00
Https . axiosPost ( Https . httpUrls . adminAddUser , data ) . then (
( rv ) => {
if ( rv ) {
cancelDsign ( )
emit ( 'searchHistoryList' )
}
}
) ;
} else {
data = setEditData ( )
2024-09-13 14:38:35 +08:00
if ( ! data . userName || ! data . userEmail || ! data . validStartTime || ! data . validEndTime || ! data . systemUser ) return message . warning ( 'Please check the input box marked with *' )
2024-08-05 16:15:43 +08:00
Https . axiosPost ( Https . httpUrls . modifyUser , { } , { params : data } ) . then (
( rv ) => {
if ( rv ) {
cancelDsign ( )
emit ( 'searchHistoryList' )
}
}
) ;
}
}
return {
... toRefs ( operations ) ,
... toRefs ( operationsData ) ,
state ,
cancelDsign ,
init ,
setOk ,
} ;
} ,
data ( ) {
return {
} ;
} ,
mounted ( ) { } ,
methods : {
} ,
} ) ;
< / script >
< style lang = "less" >
. allUserPoeration _modal {
. ant - modal - body {
height : auto ;
}
}
< / style >
< style lang = "less" scoped >
. allUserPoeration _modal {
. closeIcon {
z - index : 2 ;
}
. allUserPoeration _btn {
display : flex ;
flex - direction : row ;
height : auto ;
justify - content : flex - end ;
padding : 1 rem 0 ;
. admin _search _item {
margin - bottom : 0 ;
}
}
. allUserPoeration _center {
height : 85 % ;
2024-08-06 10:05:50 +08:00
overflow - y : auto ;
flex - direction : row ;
flex - wrap : wrap ;
2024-08-05 16:15:43 +08:00
}
}
< / style >