|
@@ -4,7 +4,7 @@
|
|
|
<animates>
|
|
|
<el-col :span="24" class="container">
|
|
|
<el-col :span="24" class="info">
|
|
|
- <data-table
|
|
|
+ <!-- <data-table
|
|
|
:fields="fields"
|
|
|
:data="list"
|
|
|
:opera="opera"
|
|
@@ -21,7 +21,44 @@
|
|
|
<el-option v-for="(item, index) in nameList" :key="index" :value="item.id" :label="item.name"></el-option>
|
|
|
</template>
|
|
|
</template>
|
|
|
- </data-table>
|
|
|
+ </data-table> -->
|
|
|
+ <el-row v-if="!dialog">
|
|
|
+ <el-row type="flex">
|
|
|
+ <el-col :span="22">
|
|
|
+ <search-bar v-model="sform" :clientList="clientList" :userList="userList"></search-bar>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="2">
|
|
|
+ <el-button type="primary" @click="search">查询</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-table :data="list" style="width: 95%" border>
|
|
|
+ <el-table-column prop="order_no" label="订单号" sortable width="300"></el-table-column>
|
|
|
+ <el-table-column label="客户" width="300">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ getClient(scope.row.client) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="当前订单负责人" width="300">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ getUser(scope.row.principal) }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="mini" type="text" @click="see(scope.row)">查看</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="page">
|
|
|
+ <page @query="search" :limit="limit" :total="total"></page>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-row>
|
|
|
<el-col :span="24" class="detail" v-else>
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="top">
|
|
@@ -63,9 +100,9 @@
|
|
|
<el-tabs v-model="editableTabsValue" type="card" closable @tab-remove="removeTab">
|
|
|
<el-tab-pane v-for="(item, index) in detailForm.out_bill" :key="index" :label="`支出${index + 1}`" :name="`${index + 1}`">
|
|
|
<el-col :span="24">
|
|
|
- <el-form v-model="item.item" ref="form" label-width="90px" :inline="true">
|
|
|
+ <el-form ref="form" label-width="90px" :inline="true">
|
|
|
<el-form-item label="支出项">
|
|
|
- <el-select v-model="item.cost" placeholder="请选择支出项">
|
|
|
+ <el-select v-model="item.item" placeholder="请选择支出项">
|
|
|
<el-option v-for="(item, index) in costList" :key="index" :label="item.label" :value="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -100,7 +137,7 @@
|
|
|
</el-tabs>
|
|
|
<el-row>
|
|
|
<el-col :span="24" style="text-align:center">
|
|
|
- <el-button type="primary" size="mini" @click="save(detailForm.out_bill)" style="margin:10px 0px">
|
|
|
+ <el-button type="primary" size="mini" @click="save(detailForm)" style="margin:10px 0px">
|
|
|
保存
|
|
|
</el-button>
|
|
|
</el-col>
|
|
@@ -119,7 +156,12 @@ import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: order } = createNamespacedHelpers('order');
|
|
|
const { mapActions: client } = createNamespacedHelpers('client');
|
|
|
const { mapActions: dictionary } = createNamespacedHelpers('dictionary');
|
|
|
-
|
|
|
+const { mapActions: outBill } = createNamespacedHelpers('outBill');
|
|
|
+const { mapActions: user } = createNamespacedHelpers('user');
|
|
|
+// 分页
|
|
|
+import page from '@f/components/pagination.vue';
|
|
|
+//查询search
|
|
|
+import searchBar from './index-parts/search-bar.vue';
|
|
|
const _ = require('lodash');
|
|
|
export default {
|
|
|
metaInfo() {
|
|
@@ -127,46 +169,27 @@ export default {
|
|
|
},
|
|
|
name: 'out',
|
|
|
props: {},
|
|
|
- components: {},
|
|
|
+ components: { searchBar, page },
|
|
|
data: function() {
|
|
|
return {
|
|
|
dialog: false,
|
|
|
- fields: [
|
|
|
- { label: '订单号', model: 'order_no', filter: 'input' },
|
|
|
- { label: '客户', model: 'client', filter: 'select', format: true },
|
|
|
- // { label: '合同', model: 'contract', notable: 'true', filter: 'select' },
|
|
|
- // { label: '项目', model: 'project', notable: 'true', filter: 'select' },
|
|
|
- // { label: '线路', model: 'route', notable: 'true', filter: 'select' },
|
|
|
- // { label: '付费方式', model: 'way', notable: 'true', filter: 'select' },
|
|
|
- ],
|
|
|
- list: [
|
|
|
- // {
|
|
|
- // id: '1',
|
|
|
- // name: 'xxx有限公司',
|
|
|
- // num: 'AW-YS-ZF-2018-005',
|
|
|
- // money: 100,
|
|
|
- // way: '银行转账',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // id: '2',
|
|
|
- // name: 'xxx有限公司',
|
|
|
- // num: 'AW-YS-ZF-2018-005',
|
|
|
- // money: 200,
|
|
|
- // way: '银行转账',
|
|
|
- // },
|
|
|
- ],
|
|
|
+ // fields: [
|
|
|
+ // { label: '订单号', model: 'order_no', filter: 'input' },
|
|
|
+ // { label: '客户', model: 'client', filter: 'select', format: true },
|
|
|
+ // { label: '合同', model: 'contract', notable: 'true', filter: 'select' },
|
|
|
+ // { label: '项目', model: 'project', notable: 'true', filter: 'select' },
|
|
|
+ // { label: '线路', model: 'route', notable: 'true', filter: 'select' },
|
|
|
+ // ],
|
|
|
+ list: [],
|
|
|
total: 0,
|
|
|
+ limit: 10,
|
|
|
opera: [{ label: '查看', method: 'see' }],
|
|
|
//客户列表
|
|
|
- nameList: [],
|
|
|
- //合同列表
|
|
|
- contractList: [{ name: '合同一' }, { name: '合同二' }],
|
|
|
- //项目列表
|
|
|
- projectList: [{ name: '项目一' }, { name: '项目二' }],
|
|
|
- //线路列表
|
|
|
- routeList: [{ name: '线路一' }, { name: '线路二' }],
|
|
|
- //付费方式列表
|
|
|
- wayList: [{ name: '方式一' }, { name: '方式二' }],
|
|
|
+ // nameList: [],
|
|
|
+ clientList: [],
|
|
|
+ //用户列表
|
|
|
+ userList: [],
|
|
|
+ sform: {},
|
|
|
detailFields: [
|
|
|
{ label: '货物名', model: 'name' },
|
|
|
{ label: '数量', model: 'number' },
|
|
@@ -174,25 +197,12 @@ export default {
|
|
|
{ label: '体积(m²)', model: 'volume' },
|
|
|
{ label: '备注', model: 'remark' },
|
|
|
],
|
|
|
- detailList: [
|
|
|
- // {
|
|
|
- // goods: '真皮',
|
|
|
- // number: '3',
|
|
|
- // weight: '40',
|
|
|
- // volume: '50',
|
|
|
- // current: '0000',
|
|
|
- // ordernumber: '9999',
|
|
|
- // },
|
|
|
- ],
|
|
|
+ detailList: [],
|
|
|
editableTabsValue: '1',
|
|
|
editableTabs: [],
|
|
|
tabIndex: 1,
|
|
|
//支出项列表
|
|
|
costList: [],
|
|
|
- //供应商列表
|
|
|
- supplierList: [{ name: '供应商一' }, { name: '供应商二' }],
|
|
|
- //车辆列表
|
|
|
- carList: [{ name: '车辆一' }, { name: '车辆二' }],
|
|
|
//税率列表
|
|
|
rateList: [],
|
|
|
cost1: 0,
|
|
@@ -202,17 +212,27 @@ export default {
|
|
|
detailForm: {},
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.search();
|
|
|
+ async created() {
|
|
|
+ await this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
...order(['query', 'create', 'update', 'delete', 'fetch']),
|
|
|
...client({ clientQuery: 'query' }),
|
|
|
...dictionary(['tree']),
|
|
|
+ ...outBill(['outBill']),
|
|
|
+ ...user({ getUserList: 'query' }),
|
|
|
|
|
|
- async search({ skip = 0, limit = 8, ...info } = {}) {
|
|
|
+ async search({ skip = 0, limit = this.limit } = {}) {
|
|
|
//查订单
|
|
|
- const res = await this.query({ skip, limit, ...info });
|
|
|
+ let duplicate = _.cloneDeep(this.sform);
|
|
|
+ let { date, ...info } = duplicate;
|
|
|
+ let querys = { skip, limit, ...info };
|
|
|
+ if (date && date.length === 2) {
|
|
|
+ querys[`rq_send_time@start`] = date[0];
|
|
|
+ querys[`rq_send_time@end`] = date[1];
|
|
|
+ }
|
|
|
+ if (this.user.role !== '0') querys.principal = this.user.id;
|
|
|
+ const res = await this.query(querys);
|
|
|
if (this.$checkRes(res)) {
|
|
|
const { data, total } = res;
|
|
|
this.$set(this, `list`, data);
|
|
@@ -222,23 +242,34 @@ export default {
|
|
|
const res1 = await this.clientQuery({ type: '客户' });
|
|
|
if (this.$checkRes(res1)) {
|
|
|
const { data, total } = res1;
|
|
|
- this.$set(this, `nameList`, data);
|
|
|
+ // this.$set(this, `nameList`, data);
|
|
|
+ this.$set(this, `clientList`, data);
|
|
|
}
|
|
|
//查询其他收费项
|
|
|
const res2 = await this.tree('zc');
|
|
|
if (res2) {
|
|
|
- this.$set(this, `costList`, res2[0].children);
|
|
|
+ this.$set(this, `costList`, res2);
|
|
|
}
|
|
|
//查其他收费项的税率
|
|
|
const res3 = await this.tree('sl');
|
|
|
if (res3) {
|
|
|
- this.$set(this, `rateList`, res3[0].children);
|
|
|
+ this.$set(this, `rateList`, res3);
|
|
|
+ }
|
|
|
+ //查用户
|
|
|
+ const res4 = await this.getUserList();
|
|
|
+ if (this.$checkRes(res4)) {
|
|
|
+ const { data, total } = res4;
|
|
|
+ this.$set(this, `userList`, data);
|
|
|
}
|
|
|
},
|
|
|
//查看
|
|
|
- async see({ data }) {
|
|
|
+ async see(data) {
|
|
|
const res = await this.fetch(data.id);
|
|
|
+ // console.log(res);
|
|
|
if (res) this.$set(this, `detailForm`, res);
|
|
|
+ if (this.detailForm.out_bill.length > 0) {
|
|
|
+ this.computRate();
|
|
|
+ }
|
|
|
this.dialog = true;
|
|
|
},
|
|
|
//添加选项卡
|
|
@@ -247,13 +278,10 @@ export default {
|
|
|
if (this.editableTabsValue == '0') {
|
|
|
this.editableTabsValue = '1';
|
|
|
}
|
|
|
- // this.detailForm.out_bill.push({ taxes: '1', item: '保费' });
|
|
|
- //????总是显示最后一个
|
|
|
this.detailForm.out_bill.push({ taxes: 1 });
|
|
|
},
|
|
|
//删除选项卡
|
|
|
removeTab(targetName) {
|
|
|
- console.log(targetName);
|
|
|
const name1 = Number(targetName);
|
|
|
const form1 = this.detailForm.out_bill[name1 - 1];
|
|
|
if (name1 > -1) {
|
|
@@ -285,6 +313,7 @@ export default {
|
|
|
this.$set(outForm, `sh_ss`, sh_ss);
|
|
|
this.computRate();
|
|
|
},
|
|
|
+ //计算
|
|
|
async computRate() {
|
|
|
let num1 = 0;
|
|
|
let num2 = 0;
|
|
@@ -312,10 +341,8 @@ export default {
|
|
|
},
|
|
|
//保存
|
|
|
async save(data) {
|
|
|
- console.log(data);
|
|
|
- //owner不能为空????
|
|
|
- let owner = this.user.id;
|
|
|
- const res = await this.update(data);
|
|
|
+ // console.log(data);
|
|
|
+ const res = await this.outBill(this.detailForm);
|
|
|
if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) {
|
|
|
this.back();
|
|
|
}
|
|
@@ -329,11 +356,15 @@ export default {
|
|
|
this.cost3 = 0;
|
|
|
this.cost4 = 0;
|
|
|
},
|
|
|
- roleSelect({ model, value }) {
|
|
|
- if (model == 'client') {
|
|
|
- let arr = this.nameList.find(i => i.id === value);
|
|
|
- if (arr) return arr.name;
|
|
|
- }
|
|
|
+ //过滤客户
|
|
|
+ getClient(client) {
|
|
|
+ const obj = this.clientList.find(i => i.id === client);
|
|
|
+ if (obj) return obj.name;
|
|
|
+ },
|
|
|
+ //过滤用户
|
|
|
+ getUser(data) {
|
|
|
+ const obj = this.userList.find(i => i.id === data);
|
|
|
+ if (obj) return obj.name;
|
|
|
},
|
|
|
},
|
|
|
computed: {
|
|
@@ -383,7 +414,10 @@ export default {
|
|
|
background: #ecf5ff;
|
|
|
border-color: #b3d8ff;
|
|
|
}
|
|
|
-/deep/.el-form--inline .el-form-item__content {
|
|
|
- width: 166px;
|
|
|
+// /deep/.el-form--inline .el-form-item__content {
|
|
|
+// width: 166px;
|
|
|
+// }
|
|
|
+/deep/.el-table .cell {
|
|
|
+ text-align: center;
|
|
|
}
|
|
|
</style>
|