fixUploadBankInSlip

This commit is contained in:
lonetrinity
2018-09-06 14:23:55 +08:00
parent 9aaafd24d6
commit 872ada9aee
2 changed files with 37 additions and 9 deletions
+7 -1
View File
@@ -620,6 +620,7 @@ class BookingController extends Controller
);
if($upload_path){
$user_bankslip = $booking->userBankSlip()->first();
// if user bankslip not exist, create new one
@@ -651,7 +652,12 @@ class BookingController extends Controller
if(!$user_bankslip){
return response()->json(["message"=> "not found"],400);
}
}
// validate transfer amount exist
if(!$request->input('transfer_amount')){
return response()->json(['message' => 'Please input amount'], 400);
}
// update booking status
$booking->status = 3;
@@ -217,7 +217,8 @@
this.booking.bankin_amount = response.data.bia;
this.booking.timeout = response.data.timeout * 1000;
this.booking.term = response.data.term;
this.booking.status = response.data.status; this.trackerConfig.term = response.data.term
this.booking.status = response.data.status;
this.trackerConfig.term = response.data.term
if (response.data.user_bankslip_path) {
this.booking.user_bankslip_path = response.data.user_bankslip_path
@@ -334,6 +335,16 @@
},
submitUserSlip(formName) {
this.loading = true
if (this.booking.amount == '') {
this.$message({
showClose: true,
message: 'Please upload your bankin slip first.',
type: 'warning',
duration: 10000
})
return;
}
this.$refs[formName].validate((valid) => {
if (valid) {
let newConfirmation = {
@@ -342,18 +353,22 @@
}
} else {
this.loading = false
return;
}
})
let newUserSlip = {
transfer_amount: this.user_slip_form.transfer_amount
}
axios.patch('/api/booking/' + this.booking_id + '/bankslip-amount/', newUserSlip)
.then((response) => {
console.log(response);
this.$message({
showClose: true,
message: 'Your bankinslip has been submitted, please wait admin to approve.',
message: 'Your bankin slip has been submitted, please wait admin to approve.',
type: 'success',
duration: 5000
})
@@ -361,19 +376,26 @@
this.$router.push({
name: 'home'
})
})
.catch((error) => {
this.loading = false
}).catch((error) => {
this.$message({
showClose: true,
message: 'Please upload your bankin slip first.',
type: 'warning',
duration: 10000
})
this.loading = false
console.log(error)
})
})
},
handleTimeExpire() {
alert('Booking expired')
},