|
@@ -1,41 +1,43 @@
|
|
|
<template>
|
|
|
<div style="padding:10px" v-loading="loading">
|
|
|
- <ul style="width:100%;margin-bottom:10px;display:flex;justify-content:flex-end;margin-top:10px;align-items:center;">
|
|
|
- <li style="line-height:30px;margin-right:20px">
|
|
|
- <span>非税总报价 : </span>
|
|
|
- <span>{{Number(total.notTaxTotal).toFixed(2)}}</span>
|
|
|
- </li>
|
|
|
-
|
|
|
- <li style="line-height:30px;margin-right:20px">
|
|
|
- <span>含税总报价 : </span>
|
|
|
- <span>{{Number(total.includeTaxTotal).toFixed(2)}}</span>
|
|
|
- </li>
|
|
|
-
|
|
|
- <li style="line-height:30px;margin-right:20px">
|
|
|
- <span>总税额 : </span>
|
|
|
- <span>{{Number(total.total).toFixed(2)}}</span>
|
|
|
- </li>
|
|
|
-
|
|
|
- <li>
|
|
|
- <el-button size="mini" type="primary" @click="onSubmit">保存</el-button>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <div style="display:flex;">
|
|
|
+ <el-tooltip content="返回">
|
|
|
+ <el-button size="mini" icon="el-icon-d-arrow-left" @click="back" />
|
|
|
+ </el-tooltip>
|
|
|
+
|
|
|
+ <ul style="width:100%;margin-bottom:10px;display:flex;justify-content:flex-end;margin-top:10px;align-items:center;">
|
|
|
+ <li style="line-height:30px;margin-right:20px">
|
|
|
+ <span>非税总报价 : </span>
|
|
|
+ <span>{{Number(total.notTaxTotal).toFixed(2)}}</span>
|
|
|
+ </li>
|
|
|
+
|
|
|
+ <li style="line-height:30px;margin-right:20px">
|
|
|
+ <span>含税总报价 : </span>
|
|
|
+ <span>{{Number(total.includeTaxTotal).toFixed(2)}}</span>
|
|
|
+ </li>
|
|
|
+
|
|
|
+ <li style="line-height:30px;margin-right:20px">
|
|
|
+ <span>总税额 : </span>
|
|
|
+ <span>{{Number(total.total).toFixed(2)}}</span>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
|
|
|
<ex-table
|
|
|
:columns="[ ...columns,{ _slot_: 'action', label: '操作', width: '160px' } ]"
|
|
|
:table="table"
|
|
|
- :data="tableData.assessinfo"
|
|
|
+ :data="tableData.planinfo"
|
|
|
style="margin: 15px 0 0 0"
|
|
|
:noPagination="true"
|
|
|
>
|
|
|
<template #action={scope}>
|
|
|
- <el-button size="mini" type="text" @click="copyItem(scope.row)">复制</el-button>
|
|
|
- <el-button size="mini" type="text" @click="updateItem(scope.$index)">编辑</el-button>
|
|
|
+ <el-button size="mini" type="text" @click="handleItem(scope.$index, ModalTypes.copy)">复制</el-button>
|
|
|
+ <el-button size="mini" type="text" @click="handleItem(scope.$index, ModalTypes.update)">编辑</el-button>
|
|
|
<el-button size="mini" type="text" @click="deleteItem(scope.$index)">删除</el-button>
|
|
|
</template>
|
|
|
</ex-table>
|
|
|
|
|
|
- <update-modal :sitem="sitem" :visible.sync="visible" @save="handleSave" />
|
|
|
+ <update-modal @refresh="onSearch" :storeId="tableData.store_id" :type="modalType" :sitem="sitem" :visible.sync="visible" @save="handleSave" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -46,6 +48,7 @@ import UpdateModal from "./modal.vue"
|
|
|
|
|
|
import {
|
|
|
columns,
|
|
|
+ ModalTypes
|
|
|
} from './_template'
|
|
|
|
|
|
export default {
|
|
@@ -54,6 +57,8 @@ export default {
|
|
|
components:{ UpdateModal },
|
|
|
data() {
|
|
|
return {
|
|
|
+ ModalTypes,
|
|
|
+ modalType: ModalTypes.create,
|
|
|
columns,
|
|
|
visible: false,
|
|
|
loading: false,
|
|
@@ -69,8 +74,7 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
total(){
|
|
|
- console.log(this.tableData.assessinfo)
|
|
|
- const list = this.tableData.assessinfo || []
|
|
|
+ const list = this.tableData.planinfo || []
|
|
|
|
|
|
return list.reduce((prev,current) => ({
|
|
|
notTaxTotal:Number(prev.notTaxTotal) + Number( current.pay_fee),
|
|
@@ -95,14 +99,17 @@ export default {
|
|
|
this.onSearch()
|
|
|
},
|
|
|
methods: {
|
|
|
+ back(){
|
|
|
+ this.$router.back()
|
|
|
+ },
|
|
|
async deleteItem(index){
|
|
|
- const item = this.tableData.assessinfo[index]
|
|
|
+ const item = this.tableData.planinfo[index]
|
|
|
|
|
|
this.$confirm(`是否确认删除预算函 ${item.name}?`, {
|
|
|
type:'warning'
|
|
|
}).then(async () => {
|
|
|
if(!item.id) {
|
|
|
- this.tableData.assessinfo.splice(index, 1)
|
|
|
+ this.tableData.planinfo.splice(index, 1)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -111,14 +118,9 @@ export default {
|
|
|
this.loading = false
|
|
|
if(code !== 1) return
|
|
|
|
|
|
- this.tableData.assessinfo.splice(index, 1)
|
|
|
+ this.tableData.planinfo.splice(index, 1)
|
|
|
})
|
|
|
},
|
|
|
- updateItem(index){
|
|
|
- this.sitem = this.tableData.assessinfo[index]
|
|
|
- this.index = index
|
|
|
- this.visible = true
|
|
|
- },
|
|
|
async onSearch(){
|
|
|
this.loading = true
|
|
|
|
|
@@ -131,29 +133,27 @@ export default {
|
|
|
|
|
|
this.tableData = data
|
|
|
},
|
|
|
- async copyItem(row){
|
|
|
- const item = JSON.parse(JSON.stringify(row))
|
|
|
- delete item.id
|
|
|
- this.tableData.assessinfo.push(item)
|
|
|
+ handleItem(index, type = ModalTypes.copy ){
|
|
|
+ this.sitem = this.tableData.planinfo[index]
|
|
|
+ this.index = index
|
|
|
+ this.visible = true
|
|
|
+ this.modalType = type
|
|
|
},
|
|
|
async onSubmit() {
|
|
|
this.loading = true
|
|
|
const param = {
|
|
|
- plan_info:this.tableData.assessinfo.map(({
|
|
|
- name, service_cat, price,unit, num, tax, id
|
|
|
- }) => ({
|
|
|
- name, service_cat, price, unit, num, tax, id
|
|
|
- })),
|
|
|
+ plan_info: this.tableData.planinfo.map(({name, service_cat, price,unit, num, tax, id }) => ({ name, service_cat, price, unit, num, tax, id })),
|
|
|
plan_id:this.$route.query.id,
|
|
|
store_id:this.tableData.store_id
|
|
|
}
|
|
|
+
|
|
|
this.loading = false
|
|
|
const { code } = await asyncRequest.planUpdate(param)
|
|
|
if(code !== 1) return
|
|
|
this.$router.back()
|
|
|
},
|
|
|
handleSave(data){
|
|
|
- this.$set(this.tableData.assessinfo, this.index, data)
|
|
|
+ this.$set(this.tableData.planinfo, this.index, data)
|
|
|
}
|
|
|
}
|
|
|
}
|