added relationship for invoice and booking

added confirm invoice feature (after user upload the image)
This commit is contained in:
Jack Goh
2018-06-28 15:22:25 +08:00
parent 105b61eab3
commit 4e448afc60
5 changed files with 73 additions and 82 deletions
@@ -5,7 +5,7 @@
<div align="center">
<h4 style="margin-top:5%;"></h4>
<br>
<div v-if="user_po_path">
<div v-if="user_po_path !== null">
<h4>Upload Invoice</h4>
</div>
<div v-else>
@@ -173,42 +173,24 @@
<!---->
<!---->
</div>
<!---->
<!---->
<!---->
<!---->
<div class="el-table__column-resize-proxy" style="display: none;"></div>
</div>
</div>
</div>
<!-- <el-row :gutter="12">
<el-col :span="12">
<el-table :data="bookingConfirmTable" :show-header="false" align="center">
<el-table-column prop="data1" align="right" width="200" />
<el-table-column prop="data2" align="left" width="200" />
</el-table>
</el-col>
<el-col :span="12">
<el-table :data="bookingConfirmTable2" :show-header="false" align="center">
<el-table-column prop="data1" align="right" width="200" />
<el-table-column prop="data2" align="left" width="200" />
</el-table>
</el-col>
</el-row> -->
</el-card>
</el-row>
<br>
<el-row :gutter="12" justify="center" align="center">
<el-row v-if="user_po_path !== null" :gutter="12" justify="center" align="center">
<el-col :span="12">
<el-card class="box-card">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>Upload Invoice</span>
<!-- <el-button style="float: right; padding: 3px 0" type="text">Operation button</el-button> -->
</div>
<!-- upload image -->
<el-upload :action="'/api/booking/' + booking_id + '/upload-po'" :on-exceed="handleExceed" :on-preview="handlePreview"
<el-upload :action="'/api/booking/' + booking_id + '/upload-invoice'" :on-exceed="handleExceed" :on-preview="handlePreview"
:on-remove="handleRemove"
class="upload-demo"
drag
@@ -223,7 +205,7 @@
<br>
<div class="bottom clearfix" style="text-align:right;">
<el-button :loading="loading" type="primary" @click="uploadPo">Submit</el-button>
<el-button :loading="loading_btn" type="primary" @click="confirmInvoice">Submit</el-button>
</div>
<!-- upload image end -->
@@ -357,50 +339,32 @@
},
methods: {
uploadPo(formName) {
this.loading_btn = true
this.$refs[formName].validate((valid) => {
if (valid) {
let newChinaSlip = {
date: this.chinaSlipForm.date,
actual_transfer_amount: this.chinaSlipForm.actual_transfer_amount,
details: this.chinaSlipForm.details,
}
axios.patch('/api/booking/' + this.booking_id + '/update-china-bankslip', newChinaSlip)
.then((response) => {
this.$message({
showClose: true,
message: 'Your bankinslip has been submitted, please wait admin to approve.',
type: 'success',
duration: 5000
})
console.log(response)
this.$router.push({
name: 'home'
})
})
.catch((error) => {
this.loading = false
this.$message({
showClose: true,
message: 'Please upload your bankin slip first.',
type: 'warning',
duration: 10000
})
console.log(error)
this.loading_btn = false
})
} else {
this.loading_btn = false
}
confirmInvoice () {
this.loading_btn = true
axios
.post('/api/booking/' + this.$route.params.id + '/confirm-invoice')
.then((response) => {
console.log(response)
this.$message({
showClose: true,
message: 'Your invoice has been uploaded. Order completed !',
type: 'success',
duration: 5000
})
this.$router.push({
name: 'home'
})
this.loading_btn = false
}).catch((error) => {
this.$message({
showClose: true,
message: 'Please upload invoice',
type: 'error',
duration: 30000
})
this.loading_btn = false
})
},
},
handleRemove(file, fileList) {
console.log(file, fileList);
},