@ -1212,6 +1212,8 @@ const contractNewApply = ()=>{
secondPayDeadline : secondPayDeadline ,
total_items : total_items ,
files : [ ] ,
removefiles : [ ] ,
originfiles : originfiles ,
} ,
pays : {
1 : {
@ -1297,6 +1299,7 @@ const contractNewApply = ()=>{
form . append ( 'user_id' , user_id ) ;
form . append ( 'pays' , JSON . stringify ( this . pays ) ) ;
form . append ( 'status' , 0 ) ;
form . append ( 'removefiles' , JSON . stringify ( this . data . removefiles ) )
form . append ( 'salesman_comment' , this . data . salesman_comment ) ;
for ( var i = 0 ; i < this . data . files . length ; i ++ ) {
form . append ( 'files[]' , this . data . files [ i ] ) ;
@ -1305,11 +1308,11 @@ const contractNewApply = ()=>{
if ( res . status === 201 ) {
alert ( '暫存成功' ) ;
console . log ( res . data ) ;
window . location . reload ( ) ;
// window.location.reload();
} else if ( res . status === 200 ) {
alert ( '更新成功' ) ;
console . log ( res . data ) ;
window . location . reload ( ) ;
// window.location.reload();
}
this . isLoading = false
} ) . catch ( error => {
@ -1400,9 +1403,7 @@ const contractNewApply = ()=>{
} )
} ,
disagree ( ) {
if ( ! confirm ( '確定退回嗎?' ) ) {
return ;
}
if ( ! confirm ( '確定退回嗎?' ) ) return ;
this . isLoading = true
const form = new FormData ( ) ;
form . append ( 'contract_new_apply_id' , contract_new_apply_id ) ;
@ -1415,7 +1416,7 @@ const contractNewApply = ()=>{
if ( res . status === 200 ) {
alert ( '退回成功' ) ;
console . log ( res . data ) ;
window . location . reload ( ) ;
// window.location.reload();
}
this . isLoading = false
} ) . catch ( error => {
@ -1426,6 +1427,13 @@ const contractNewApply = ()=>{
uploadFiles ( e ) {
this . data . files = e . target . files
} ,
removeFile ( id ) {
if ( ! confirm ( '確定移除該檔案嗎?' ) ) return ;
console . log ( id ) ;
this . data . removefiles . push ( id ) ;
this . data . originfiles . splice ( id , 1 ) ;
this . data . originfiles = this . data . originfiles . filter ( file => file . id != id )
}
}
}