|
@@ -159,8 +159,8 @@
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="anniu" v-if="showBtn">
|
|
|
- <el-button type="primary" size="mini">交流洽谈</el-button>
|
|
|
- <el-button type="success" size="mini">供求对接</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="btnPhone()">交流洽谈</el-button>
|
|
|
+ <el-button type="success" size="mini" @click="onSubmit()">供求对接</el-button>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -170,31 +170,101 @@
|
|
|
<el-table-column prop="patentstatus" label="专利状态" align="center"> </el-table-column>
|
|
|
</el-table>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog title="对接" :visible.sync="dialogTableVisible" destroy-on-close>
|
|
|
+ <chat :room="room"></chat>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import chat from '@c/chat.vue';
|
|
|
import _ from 'lodash';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: personRoom } = createNamespacedHelpers('personRoom');
|
|
|
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
|
|
|
export default {
|
|
|
name: 'detailInfo',
|
|
|
props: {
|
|
|
form: { type: Object },
|
|
|
showBtn: { type: Boolean, default: () => true },
|
|
|
},
|
|
|
- components: {},
|
|
|
+ components: { chat },
|
|
|
data: function() {
|
|
|
return {
|
|
|
dialogTableVisible1: false,
|
|
|
+ dialogTableVisible: false,
|
|
|
+ room: {},
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
|
- methods: {},
|
|
|
+ methods: {
|
|
|
+ ...personRoom(['create']),
|
|
|
+ ...transaction({ getTran: 'query', createTran: 'create' }),
|
|
|
+ async btnPhone() {
|
|
|
+ if (!this.room.id) {
|
|
|
+ //TODO 请求房间号
|
|
|
+ let obj = {};
|
|
|
+ if (!_.get(this.user, 'id')) {
|
|
|
+ // this.$message.error('游客身份无法与卖家对话,请先注册');
|
|
|
+ this.$message({
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message: '<strong><a href="http://broadcast.waityou24.cn/live/login" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ obj.p1_id = this.user.id;
|
|
|
+ obj.p1 = this.user.name;
|
|
|
+ }
|
|
|
+ if (!this.form.user_id) {
|
|
|
+ this.$message.error('缺少卖家信息,请联系卖家或管理员');
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ obj.p2_id = this.form.user_id;
|
|
|
+ obj.p2 = this.form.contacts;
|
|
|
+ }
|
|
|
+ let res = await this.create(obj);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `room`, res.data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dialogTableVisible = true;
|
|
|
+ },
|
|
|
+ //供求对接
|
|
|
+ async onSubmit() {
|
|
|
+ const data = _.cloneDeep(this.form);
|
|
|
+ const obj = {
|
|
|
+ dock_id: this.dock_id,
|
|
|
+ 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, dock_id: this.dock_id });
|
|
|
+ if (list.total > 0) {
|
|
|
+ this.$message.warning('您已申请供求对接,无需再次申请!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const res = await this.createTran(obj);
|
|
|
+ this.$checkRes(res, '对接成功', res.errmsg || '对接失败');
|
|
|
+ },
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
pageTitle() {
|
|
|
return `${this.$route.meta.title}`;
|
|
|
},
|
|
|
+ dock_id() {
|
|
|
+ return this.$route.query.dock_id;
|
|
|
+ },
|
|
|
},
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|