lrf402788946 5 năm trước cách đây
mục cha
commit
39eff560c0
2 tập tin đã thay đổi với 19 bổ sung0 xóa
  1. 2 0
      src/store/index.js
  2. 17 0
      src/views/hall/dock/dockDetail.vue

+ 2 - 0
src/store/index.js

@@ -7,6 +7,7 @@ import apply from '@common/store/live/apply';
 import dock from '@common/store/live/dock';
 import news from '@common/store/live/news';
 import market from '@common/store/market/market';
+import transaction from '@common/store/market/transaction';
 import marketproduct from '@common/store/market/marketproduct';
 import talentExperts from '@common/store/market/talentExperts';
 import * as ustate from '@common/store/user/state';
@@ -31,5 +32,6 @@ export default new Vuex.Store({
     login,
     personalchat,
     personalroom,
+    transaction,
   },
 });

+ 17 - 0
src/views/hall/dock/dockDetail.vue

@@ -17,6 +17,9 @@
                 <el-col :span="24">
                   <el-button type="danger" icon="el-icon-phone-outline" @click="btnPhone">对接</el-button>
                 </el-col>
+                <el-col :span="24">
+                  <el-button type="success" icon="el-icon-check" @click="btnTrade">申请交易</el-button>
+                </el-col>
               </el-col>
               <el-col :span="18" class="mainInfo">
                 <el-col :span="24" v-if="display === '1'">
@@ -63,6 +66,7 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 import chat from './parts/chat.vue';
 const { mapActions: mapProduct } = createNamespacedHelpers('marketproduct');
 const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
+const { mapActions: transaction } = createNamespacedHelpers('transaction');
 export default {
   name: 'dockDetail',
   props: {},
@@ -81,6 +85,7 @@ export default {
   methods: {
     ...mapProduct(['fetch']),
     ...personalRoom(['create']),
+    ...transaction({ buyProduct: 'create' }),
     async searchInfo() {
       let res = await this.fetch(this.$route.query.id);
       if (res.errcode === 0) {
@@ -118,6 +123,18 @@ export default {
       }
       this.display = '2';
     },
+    async btnTrade() {
+      let form = {};
+      form.userid = this.user.uid;
+      form.username = this.user.name;
+      form.product_id = this.productInfo.id;
+      form.product_name = this.productInfo.name;
+      form.market_userid = this.productInfo.userid;
+      form.market_username = this.productInfo.contact_user;
+      form.status = '0';
+      let res = await this.buyProduct(form);
+      this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
+    },
   },
   computed: {
     ...mapState(['user']),