This commit is contained in:
lonetrinity
2018-09-12 20:35:28 +08:00
parent 51e4072a00
commit a999d92b05
6 changed files with 14815 additions and 14375 deletions
+3 -2
View File
@@ -402,6 +402,7 @@ class BookingController extends Controller
if($bankslip_file = $request->file('file')) if($bankslip_file = $request->file('file'))
{ {
/* End Validation */ /* End Validation */
$filename = $bankslip_file->getClientOriginalName(); $filename = $bankslip_file->getClientOriginalName();
@@ -414,7 +415,7 @@ class BookingController extends Controller
$upload_path = Storage::disk('public')->putFileAs( $upload_path = Storage::disk('public')->putFileAs(
'user_bankslip', $bankslip_file, $unique_image_path 'user_bankslip', $bankslip_file, $unique_image_path
); );
$user_bankslip = $booking->userBankSlip()->first(); $user_bankslip = $booking->userBankSlip()->first();
// if user bankslip not exist, create new one // if user bankslip not exist, create new one
@@ -441,7 +442,7 @@ class BookingController extends Controller
if(!$user_bankslip){ if(!$user_bankslip){
return response()->json(["message"=> "not found"],400); return response()->json(["message"=> "not found"],400);
} }
// update booking status // update booking status
$booking->status = 3; $booking->status = 3;
$booking->admin_status = 2; $booking->admin_status = 2;
+11984 -12616
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -24,10 +24,10 @@
"element-ui": "^2.4.4", "element-ui": "^2.4.4",
"jquery": "^3.3.1", "jquery": "^3.3.1",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"npm": "^6.0.1", "npm": "^6.4.1",
"popper.js": "^1.14.1", "popper.js": "^1.14.1",
"sweetalert2": "^7.15.1", "sweetalert2": "^7.15.1",
"vee-validate": "^2.1.0-beta.5", "vee-validate": "^2.1.0-beta.9",
"vform": "^1.0.0", "vform": "^1.0.0",
"vue": "^2.5.16", "vue": "^2.5.16",
"vue-axios": "^2.1.1", "vue-axios": "^2.1.1",
@@ -47,10 +47,12 @@
"babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-syntax-dynamic-import": "^6.18.0",
"cross-env": "^5.1.4", "cross-env": "^5.1.4",
"eslint": "^4.19.1", "eslint": "^4.19.1",
"laravel-mix": "^2.1.1", "laravel-mix": "^2.1.14",
"vue-template-compiler": "^2.5.16", "vue-template-compiler": "^2.5.16",
"vuepress": "^0.14.2",
"webpack": "^3.11.0", "webpack": "^3.11.0",
"webpack-bundle-analyzer": "^2.13.1", "webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.0.8" "webpack-cli": "^3.0.8",
"webpack-dev-server": "^3.1.8"
} }
} }
+1 -1
View File
@@ -4,4 +4,4 @@
"/js/lang-en.31386792460363b93c17.js": "/js/lang-en.31386792460363b93c17.js", "/js/lang-en.31386792460363b93c17.js": "/js/lang-en.31386792460363b93c17.js",
"/js/app.js": "/js/app.js", "/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css" "/css/app.css": "/css/app.css"
} }
@@ -1,61 +1,71 @@
<template> <template>
<el-main> <el-main>
<progress-track v-model="status"/> <x2-progress-track v-if="(booking.status == 'x2_cash' || booking.status == 'x2_cheque' || booking.status == 'x2_ba')"
<div align="center" v-if="booking.user_bankslip_path"> v-model="trackerConfig" />
<h4 style="margin-top:5%" > <progress-track v-else v-model="trackerConfig" />
Your Bankslip Has Been Rejected, Please Reupload Your Bankslip <br> <div align="center" v-if="booking.user_bankslip_path">
Reason : {{ booking.reject_reason }} <h4 style="margin-top:5%">
</h4> Your Bankslip Has Been Rejected, Please Reupload Your Bankslip
<br> <br> Reason : {{ booking.reject_reason }}
<br> </h4>
</div> <br>
<div v-else align="center"> <br>
<h1>Waiting For Payment</h1> </div>
</div> <div v-else align="center">
<h1>Please Upload Bankslip</h1>
</div>
<div class="row"> <div class="row">
<table class="table table-striped"> <table class="table table-striped">
<tbody> <tbody>
<tr> <tr>
<td>Amount : </td> <td>Amount : </td>
<td><b>RMB {{ booking.amount }}</b></td> <td>
</tr> <b>RMB {{ booking.amount }}</b>
<tr> </td>
<td>Bankin Amount : </td> </tr>
<td><b> MYR {{ booking.bankin_amount }}</b></td> <tr>
</tr> <td>Bankin Amount : </td>
<tr> <td>
<td colspan="2"> <b> MYR {{ booking.bankin_amount }}</b>
<b>{{ bankDetail.company_name }}</b><br> </td>
{{ bankDetail.bank_name }} : {{ bankDetail.acc_no }} </tr>
</td> <tr>
</tr> <td colspan="2">
</tbody> <b>{{ bankDetail.company_name }}</b>
</table> <br> {{ bankDetail.bank_name }} : {{ bankDetail.acc_no }}
</div> </td>
<div class="row timer"> </tr>
<div class="col"> </tbody>
<vue-countdown :countdownend="handleCoutdownend" :time="booking.timeout"> </table>
<template slot-scope="props">Time Remaining<br>{{ props.days }} days, {{ props.hours }} hours, {{ props.minutes }} minutes, {{ props.seconds }} seconds.</template>
</vue-countdown>
</div> </div>
</div> <div class="row timer">
<!-- upload image --> <div class="col">
<div class="row upload"> <vue-countdown :countdownend="handleCoutdownend" :time="booking.timeout">
<div class="col"> <template slot-scope="props">Time Remaining
<el-upload :action="'/api/booking/' + booking_id + '/upload-user-bankslip'" <br>{{ props.days }} days, {{ props.hours }} hours, {{ props.minutes }} minutes, {{ props.seconds }} seconds.</template>
:on-preview="handlePictureCardPreview" </vue-countdown>
:on-remove="handleRemove" </div>
:on-error="uploadError"
accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf"
list-type="picture-card" align="center">
<i class="el-icon-plus" />
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img :src="dialogImageUrl" width="100%" alt="">
</el-dialog>
</div> </div>
</div> <!-- upload image -->
<div class="row upload">
<div class="col">
<!-- <el-upload :action="'/api/booking/' + booking_id + '/upload-user-bankslip'" :show-file-list="false" :on-preview="handlePictureCardPreview"
:on-remove="handleRemove" :on-error="uploadError" accept=".jpeg, .jpg, .png, .bmp, .doc, .docx, .xls, .xlsx, .pdf" list-type="picture-card"
align="center">
<i class="el-icon-plus" />
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img :src="dialogImageUrl" width="100%" alt="">
</el-dialog> -->
<el-upload class="avatar-uploader" :action="'/api/booking/' + booking_id + '/upload-user-bankslip'" :show-file-list="false"
:on-success="handleUploadSuccess" :before-upload="beforeFileUpload" algin="center">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div>
</div>
<!-- upload image end --> <!-- upload image end -->
<div class="row bankinAmount"> <div class="row bankinAmount">
<div class="col"> <div class="col">
@@ -67,34 +77,39 @@
<el-form-item> <el-form-item>
<el-button :loading="loading" type="primary" @click="submitUserSlip('user_slip_form')">Submit</el-button> <el-button :loading="loading" type="primary" @click="submitUserSlip('user_slip_form')">Submit</el-button>
<router-link :to="{ name: 'home' }" class="small ml-auto my-auto"> <router-link :to="{ name: 'home' }" class="small ml-auto my-auto">
Upload Later Next Order
</router-link> </router-link>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
</div>
</el-main> </el-main>
</template> </template>
<style> <style>
h1 { h1 {
margin-top:5%; margin-top: 5%;
font-size:3vw; font-size: 3vw;
text-align:center; text-align: center;
margin-bottom:3%; margin-bottom: 3%;
} }
.timer, .upload, .bankinAmount {
.timer,
.upload,
.bankinAmount {
text-align: center; text-align: center;
} }
.transferAmountInput { .transferAmountInput {
width: 20%; width: 20%;
} }
.row { .row {
margin-bottom: 3%; margin-bottom: 3%;
}
td:last-child {
text-align:center;
} }
td:last-child {
text-align: center;
}
@media screen and (max-width: 767px) { @media screen and (max-width: 767px) {
.transferAmountInput { .transferAmountInput {
width: 60%; width: 60%;
@@ -103,200 +118,280 @@
font-size: 3.5vmin; font-size: 3.5vmin;
} }
h1 { h1 {
font-size: 1em; font-size: 1em;
} }
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
} }
</style> </style>
<script> <script>
import VueCountdown from '@xkeshi/vue-countdown' import VueCountdown from '@xkeshi/vue-countdown'
import ProgressTrack from '~/components/ProgressTrack' import ProgressTrack from '~/components/ProgressTrack'
import axios from 'axios' import X2ProgressTrack from '~/components/X2ProgressTrack'
import axios from 'axios'
export default { export default {
middleware: ['auth'], middleware: ['auth'],
name: 'MyComponent', name: 'MyComponent',
components: { components: {
'vue-countdown': VueCountdown, 'vue-countdown': VueCountdown,
'progress-track': ProgressTrack 'progress-track': ProgressTrack,
}, 'x2-progress-track': X2ProgressTrack
data () { },
return { data() {
status: 2, return {
start: false, trackerConfig: {
loading: false, status: 2,
dialogImageUrl: '', term: null
dialogVisible: false, },
booking_id: this.$route.params.id, start: false,
user_slip_form: { loading: false,
transfer_amount: '' dialogImageUrl: '',
}, imageUrl: null,
booking: { dialogVisible: false,
amount: '', booking_id: this.$route.params.id,
bankin_amount: '', user_slip_form: {
timeout: 1, transfer_amount: ''
term : '123', },
user_bankslip_path: null, booking: {
reject_reason: null, amount: '',
}, bankin_amount: '',
rules: { timeout: 1,
transfer_amount: [{ term: '123',
required: true, user_bankslip_path: null,
message: 'Please input amount', reject_reason: null,
trigger: 'change' },
}] rules: {
}, transfer_amount: [{
active_bank_setting: { required: true,
x1_bank_id: null, message: 'Please input amount',
x2_bank_id: null, trigger: 'change'
beneficiary_id: null }]
}, },
bankDetail: {} active_bank_setting: {
} x1_bank_id: null,
}, x2_bank_id: null,
beforeCreate () { beneficiary_id: null
const loading = this.$loading({ },
lock: true, bankDetail: {}
text: 'Please wait..', }
spinner: 'el-icon-loading', },
background: 'rgba(0, 0, 0, 0.7)' beforeCreate() {
}) const loading = this.$loading({
lock: true,
axios.get('/api/booking/' + this.$route.params.id) text: 'Please wait..',
.then((response) => { spinner: 'el-icon-loading',
this.booking.amount = response.data.amount; background: 'rgba(0, 0, 0, 0.7)'
this.booking.bankin_amount = response.data.bia;
this.booking.timeout = response.data.timeout * 1000;
this.booking.term = response.data.term;
if (response.data.user_bankslip_path)
{
this.booking.user_bankslip_path = response.data.user_bankslip_path
this.booking.reject_reason = response.data.reject_reason
}
console.log(this.booking);
this.start = true;
if (this.booking.timeout < 0){
this.$message({
showClose: true,
message: 'Booking timeout, please make another booking.',
type: 'error',
duration: 30000
}) })
this.$router.push({
name: 'home'
})
}
}).catch((error) => {
this.$router.push({
name: 'notfound'
})
console.log(error)
})
axios.get('/api/active-bank')
.then((response) => {
this.active_bank_setting = response.data;
var url = '';
if(this.booking.term === 'x1_cash' || this.booking.term === 'x1_cheque' ||this.booking.term === 'x1_ba'){
url = '/api/malaysia-bank/' + this.active_bank_setting.x1_bank_id;
}
else if(this.booking.term === 'x2_cash' || this.booking.term === 'x2_cheque' ||this.booking.term === 'x2_ba'){
url = '/api/malaysia-bank/' + this.active_bank_setting.x2_bank_id;
}
axios.get(url) axios.get('/api/booking/' + this.$route.params.id)
.then((response) => { .then((response) => {
this.bankDetail = response.data; this.booking.amount = response.data.amount;
loading.close() this.booking.bankin_amount = response.data.bia;
}) this.booking.timeout = response.data.timeout * 1000;
.catch((error) => { this.booking.term = response.data.term;
loading.close() this.booking.status = response.data.status;
console.log(error); this.trackerConfig.term = response.data.term
if (response.data.user_bankslip_path) {
this.booking.user_bankslip_path = response.data.user_bankslip_path
this.booking.reject_reason = response.data.reject_reason
}
console.log(this.booking);
this.start = true;
if (this.booking.timeout < 0) {
this.$message({ this.$message({
showClose: true, showClose: true,
message: 'Fetch data fail', message: 'Booking timeout, please make another booking.',
type: 'error', type: 'error',
duration: 10000 duration: 30000
})
this.$router.push({
name: 'home'
})
}
}).catch((error) => {
this.$router.push({
name: 'notfound'
})
console.log(error)
})
axios.get('/api/active-bank')
.then((response) => {
this.active_bank_setting = response.data;
var url = '';
if (this.booking.term === 'x1_cash' || this.booking.term === 'x1_cheque' || this.booking.term === 'x1_ba') {
url = '/api/malaysia-bank/' + this.active_bank_setting.x1_bank_id;
} else if (this.booking.term === 'x2_cash' || this.booking.term === 'x2_cheque' || this.booking.term === 'x2_ba') {
url = '/api/malaysia-bank/' + this.active_bank_setting.x2_bank_id;
}
axios.get(url)
.then((response) => {
this.bankDetail = response.data;
loading.close()
})
.catch((error) => {
loading.close()
console.log(error);
this.$message({
showClose: true,
message: 'Fetch data fail',
type: 'error',
duration: 10000
});
}); });
})
.catch((error) => {
console.log(error);
this.$message({
showClose: true,
message: 'Fetch bank details fail',
type: 'error',
duration: 10000
}); });
}) });
.catch((error) => { },
console.log(error); methods: {
handleUploadSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
this.$message({ this.$message({
showClose: true, showClose: true,
message: 'Fetch data fail', message: 'Uploaded.',
type: 'error', type: 'success',
duration: 10000 duration: 5000
});
});
},
methods: {
handleCoutdownend () {
this.$message({
showClose: true,
message: 'Booking timeout, please make another booking.',
type: 'error',
duration: 30000
})
this.$router.push({
name: 'home'
})
},
handleRemove (file, fileList) {
// console.log(file, fileList)
},
uploadError(file,fileList){
this.$message.warning(`Incorrect file format or file size too big.`)
},
handlePictureCardPreview (file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
submitUserSlip (formName) {
this.loading = true
this.$refs[formName].validate((valid) => {
if (valid) {
let newConfirmation = {
amount: this.booking.amount,
term: this.term
}
} else {
this.loading = false
}
})
let newUserSlip = {
transfer_amount: this.user_slip_form.transfer_amount
}
axios.patch('/api/booking/' + this.booking_id + '/bankslip-amount', newUserSlip)
.then((response) => {
this.$message({
showClose: true,
message: 'Your bankinslip has been submitted, please wait admin to approve.',
type: 'success',
duration: 5000
}) })
},
beforeFileUpload(file) {
//const isJPG = file.type === 'image/jpeg';
const isLt10M = file.size / 10240 / 10240 < 2;
// if (!isJPG) {
// this.$message.error('Avatar picture must be JPG format!');
// }
if (!isLt10M) {
this.$message.error('File size can not exceed 10MB!');
}
this.$router.push({
name: 'home'
})
})
.catch((error) => {
this.loading = false
this.$message({ this.$message({
showClose: true, showClose: true,
message: 'Please upload your bankin slip first.', message: 'Uploading..',
type: 'warning', type: 'success',
duration: 10000 duration: 5000
}) })
console.log(error) // return isJPG && isLt2M;
}) return isLt10M;
}, },
handleTimeExpire () {
alert('Booking expired') handleCoutdownend() {
}, this.$message({
startTimer () { showClose: true,
this.start = true; message: 'Booking timeout, please make another booking.',
type: 'error',
duration: 30000
})
this.$router.push({
name: 'home'
})
},
handleRemove(file, fileList) {
// console.log(file, fileList)
},
uploadError(file, fileList) {
this.$message.warning(`Incorrect file format or file size too big.`)
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
submitUserSlip(formName) {
this.loading = true
if (this.booking.amount == '') {
this.$message({
showClose: true,
message: 'Please key in your bankin amount first.',
type: 'warning',
duration: 10000
})
return;
}
this.$refs[formName].validate((valid) => {
if (valid) {
let newConfirmation = {
amount: this.booking.amount,
term: this.term
}
} else {
this.loading = false
}
})
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.',
type: 'success',
duration: 5000
})
this.$router.push({
name: 'home'
})
}).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')
},
startTimer() {
this.start = true;
}
} }
} }
} </script>
</script>
+2482 -1508
View File
File diff suppressed because it is too large Load Diff