|
@@ -4,7 +4,7 @@
|
|
|
<component :is="model" :list="list"></component>
|
|
|
</list-page>
|
|
|
<template v-else>
|
|
|
- <dmodel :displayBtn="true" :data="detail" v-if="detail">
|
|
|
+ <dmodel :displayBtn="true" :data="detail" v-if="detail" @submit="toSubmit">
|
|
|
<el-button size="mini" type="primary" @click="$router.push({ path: './list', query: { index: $route.query.index } })"> 返回</el-button>
|
|
|
</dmodel>
|
|
|
</template>
|
|
@@ -15,10 +15,15 @@
|
|
|
import listPage from '@c/list/list-page.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: product } = createNamespacedHelpers('product');
|
|
|
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
|
|
|
export default {
|
|
|
name: 'technolgy',
|
|
|
props: ['listModel'],
|
|
|
- components: { listPage, model3: () => import('@c/list/list-model/model-3.vue'), dmodel: () => import('./detail-model/model-5.vue') },
|
|
|
+ components: {
|
|
|
+ listPage,
|
|
|
+ model3: () => import('@c/list/list-model/model-3.vue'),
|
|
|
+ dmodel: () => import('./detail-model/model-5.vue'),
|
|
|
+ },
|
|
|
data: function() {
|
|
|
return {
|
|
|
list: [],
|
|
@@ -30,6 +35,7 @@ export default {
|
|
|
this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...transaction({ getTran: 'query', createTran: 'create' }),
|
|
|
...product(['query', 'fetch']),
|
|
|
// 查询相关
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
@@ -54,12 +60,35 @@ export default {
|
|
|
},
|
|
|
// 查询详情
|
|
|
async searchInfo() {
|
|
|
- console.log(this.id);
|
|
|
let res = await this.fetch(this.id);
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `detail`, res.data);
|
|
|
}
|
|
|
},
|
|
|
+ //供求对接
|
|
|
+ async toSubmit(data) {
|
|
|
+ const obj = {
|
|
|
+ supplier: _.get(data, 'user_id'),
|
|
|
+ s_name: _.get(data, 'contacts'),
|
|
|
+ s_phone: _.get(data, 'phone'),
|
|
|
+ product_id: _.get(data, 'id'),
|
|
|
+ product: _.get(data, 'name'),
|
|
|
+ demander: _.get(this.user, 'id'),
|
|
|
+ d_name: _.get(this.user, 'name'),
|
|
|
+ d_phone: _.get(this.user, 'phone'),
|
|
|
+ };
|
|
|
+ if (obj.demander === obj.supplier) {
|
|
|
+ this.$message.error('您不能对自己的成果进行对接!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const list = await this.getTran({ product_id: obj.product_id, demander: obj.demander });
|
|
|
+ if (list.total > 0) {
|
|
|
+ this.$message.warning('您已申请供求对接,无需再次申请!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await this.createTran(obj);
|
|
|
+ this.$checkRes(res, '对接成功', res.errmsg || '对接失败');
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user', 'menuParams']),
|