|
@@ -1,18 +1,27 @@
|
|
|
<template>
|
|
|
- <div id="supplier">
|
|
|
+ <div id="client">
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="info">
|
|
|
- <data-table :fields="fields" :data="list" :total="total" :size="50" :step="10" @query="search" :select="true" @handleSelect="toSelect">
|
|
|
+ <data-table
|
|
|
+ ref="table"
|
|
|
+ :fields="fields"
|
|
|
+ :data="list"
|
|
|
+ :total="total"
|
|
|
+ :size="50"
|
|
|
+ :step="10"
|
|
|
+ @query="search"
|
|
|
+ :select="true"
|
|
|
+ :usePage="false"
|
|
|
+ @handleSelect="toSelect"
|
|
|
+ >
|
|
|
<template #options="{item}">
|
|
|
- <template v-if="item.model == 'name'">
|
|
|
- <el-option v-for="(item, index) in nameList" :key="index" :value="item.name" :label="item.name"></el-option>
|
|
|
+ <template v-if="item.model == 'client'">
|
|
|
+ <el-option v-for="(item, index) in clientList" :key="index" :value="item._id" :label="item.name"></el-option>
|
|
|
</template>
|
|
|
</template>
|
|
|
<template #filterEnd>
|
|
|
- <el-button v-if="selected.length <= 0" type="primary" :disabled="true">未选择任何合同</el-button>
|
|
|
- <el-button v-else type="primary" @click="toExport">导出选中合同</el-button>
|
|
|
- <el-button v-if="selected.length <= 0" type="primary" :disabled="true">未选择任何数据</el-button>
|
|
|
- <el-button v-else type="primary" @click="add">生成单据</el-button>
|
|
|
+ <el-button v-if="selected.length <= 0" type="primary" :disabled="true">未选择数据</el-button>
|
|
|
+ <el-button v-else type="primary" @click="toExport">导出结算单</el-button>
|
|
|
</template>
|
|
|
</data-table>
|
|
|
</el-col>
|
|
@@ -22,59 +31,75 @@
|
|
|
|
|
|
<script>
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: transport } = createNamespacedHelpers('transport');
|
|
|
+const { mapActions: client } = createNamespacedHelpers('client');
|
|
|
+
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
|
},
|
|
|
- name: 'supplier',
|
|
|
+ name: 'clientCalculate',
|
|
|
props: {},
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
return {
|
|
|
fields: [
|
|
|
- { label: '发货日期', model: 'time' },
|
|
|
- { label: '供应商', model: 'name', filter: 'select' },
|
|
|
- { label: '订单号', model: 'num' },
|
|
|
- { label: '单价(不含税)', model: 'price' },
|
|
|
- { label: '运费合计(不含税)', model: 'cont' },
|
|
|
- { label: '税率', model: 'rate' },
|
|
|
- { label: '应付运费', model: 'freight' },
|
|
|
- ],
|
|
|
- list: [
|
|
|
- {
|
|
|
- name: '哈哈哈',
|
|
|
- num: '3333',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '哈哈哈1',
|
|
|
- num: '333113',
|
|
|
- },
|
|
|
+ { label: '供应商', model: 'client', notable: true, filter: 'select' },
|
|
|
+ { label: '第三方车号', model: 'car_no', notable: true, filter: true },
|
|
|
+ { label: '', model: 'date', notable: true, filter: 'date' },
|
|
|
+ { label: '发货时间', model: 'send_time' },
|
|
|
+ { label: '订单号', model: 'order_nos' },
|
|
|
+ { label: '线路', model: 'route' },
|
|
|
+ { label: '货物', model: 'goods', format: i => i.map(g => g.name).join(';') },
|
|
|
+ { label: '运费(不含税)', model: 't_sq_ys' },
|
|
|
+ { label: '税率', model: 'taxes' },
|
|
|
+ { label: '运费税后', model: 't_sh_ys' },
|
|
|
],
|
|
|
+ list: [],
|
|
|
total: 0,
|
|
|
//选择的数据列表
|
|
|
selected: [],
|
|
|
- //用户列表
|
|
|
- nameList: [{ name: '名字一' }],
|
|
|
+ clientList: [],
|
|
|
+ client: undefined, //选择的客户
|
|
|
};
|
|
|
},
|
|
|
- created() {},
|
|
|
+ created() {
|
|
|
+ this.getOtherList();
|
|
|
+ },
|
|
|
methods: {
|
|
|
- async search() {
|
|
|
- console.log('查询');
|
|
|
+ ...transport(['supplierCalculate', 'supplierExport', 'js']),
|
|
|
+ ...client({ getClientList: 'query' }),
|
|
|
+ async search(data) {
|
|
|
+ const { client } = data;
|
|
|
+ this.$set(this, `client`, client);
|
|
|
+ const res = await this.supplierCalculate(data);
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `list`, res.data);
|
|
|
},
|
|
|
//选中的数据
|
|
|
toSelect(data) {
|
|
|
- console.log('选择');
|
|
|
- console.log(data);
|
|
|
this.selected = data;
|
|
|
},
|
|
|
//导出
|
|
|
- toExport() {
|
|
|
- console.log('导出');
|
|
|
+ async toExport() {
|
|
|
+ const ids = this.selected.map(i => i._id);
|
|
|
+ const res = await this.supplierExport({ ids });
|
|
|
+ if (this.$checkRes(res)) window.open(res);
|
|
|
+ this.$confirm('是否结算选择的订单?', '结算提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(async () => {
|
|
|
+ const jsRes = await this.js({ ids, client: this.client, owner: this.user.id });
|
|
|
+ if (this.$checkRes(jsRes, '结算成功', '结算失败')) {
|
|
|
+ this.$refs.table.selectReset();
|
|
|
+ this.list = [];
|
|
|
+ this.selected = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- //生成单据
|
|
|
- add() {
|
|
|
- console.log('生成单据');
|
|
|
+ async getOtherList() {
|
|
|
+ const cRes = await this.getClientList({ type: '供应商' });
|
|
|
+ if (this.$checkRes(cRes)) this.$set(this, `clientList`, cRes.data);
|
|
|
},
|
|
|
},
|
|
|
computed: {
|
|
@@ -84,7 +109,7 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
-/deep/.el-col-4 {
|
|
|
- width: 270px;
|
|
|
+/deep/.el-col-20 {
|
|
|
+ width: 1200px;
|
|
|
}
|
|
|
</style>
|