Browse Source

查看关联盲票

lsx 2 years ago
parent
commit
420a3152d6
3 changed files with 104 additions and 1 deletions
  1. 10 0
      src/api/business/goods.js
  2. 74 0
      src/components/Association/index.vue
  3. 20 1
      src/views/business/goods/index.vue

+ 10 - 0
src/api/business/goods.js

@@ -97,3 +97,13 @@ export function cradCamiloList(urlParams, data) {
   })
 }
 
+// 查看关联商品
+export function associationList(urlParams, data) {
+  return request({
+    url: '/api/v1/mp/admin/goods/detail/relationTicket',
+    method: 'post',
+    data,
+    urlParams
+  })
+}
+

+ 74 - 0
src/components/Association/index.vue

@@ -0,0 +1,74 @@
+<template>
+  <div>
+    <el-dialog title="查看关联盲票" :visible.sync="associationShow" :before-close="close">
+      <el-table :data="associationData">
+        <el-table-column property="boxId" label="盲票组Id" min-width="250" align="center"></el-table-column>
+        <el-table-column property="title" label="盲票组名称" min-width="250" align="center"></el-table-column>
+        <el-table-column property="status" label="状态" min-width="250" align="center">
+          <template slot-scope="{row}">
+            {{ row.status && JSON.parse(row.status).desc }}
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination :total="total" :page.sync="pageParams.pageNum" :limit.sync="pageParams.pageSize"
+                  @pagination="getList()"/>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {associationList} from "../../api/business/goods";
+
+export default {
+  name: "camilo",
+  props: {
+    associationShow: {
+      type: Boolean,
+      default: true
+    },
+    associationGoodsId: {
+      type: Number,
+      default: 0
+    },
+  },
+  data() {
+    return {
+      pageParams: {
+        pageNum: 1,
+        pageSize: 10
+      },
+      loading: false,
+      associationData: [],
+      total: 0,
+    };
+  },
+  mounted() {
+    this.getList()
+  },
+  methods: {
+    close() {
+      this.$emit('cancel')
+    },
+    getList() {
+      if (this.loading) {
+        return
+      }
+      this.loading = true
+      associationList('pageNum=' + this.pageParams.pageNum + '&pageSize=' + this.pageParams.pageSize + '&', {goodsId: this.associationGoodsId}).then(res => {
+        this.loading = false
+        if (res.code === 0) {
+          this.associationData = res.rows
+          this.total = res.total
+        }
+      }).catch(() => {
+        this.loading = false
+      })
+    },
+
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 20 - 1
src/views/business/goods/index.vue

@@ -170,6 +170,7 @@
       </el-table-column>
       <el-table-column fixed="right" align="center" label="操作" width="140">
         <template slot-scope="{row}">
+          <el-button  v-hasPermi="['business:goods:edit']" type="text" @click="toAssociation(row.goodsId)">查看关联盲票</el-button>
           <!-- <el-button v-hasPermi="['business:goods:query']" type="text">查看</el-button> -->
           <el-button v-hasPermi="['business:goods:edit']" type="text" @click="handleCamilo(row.goodsId)" v-if="row.type === 2">
             查看卡密
@@ -189,6 +190,7 @@
           <el-button v-if="JSON.parse(row.status).value === 'init'" v-hasPermi="['business:coupon:remove']" class="del"
                      type="text" @click="del(row)">删除
           </el-button>
+          
         </template>
       </el-table-column>
     </el-table>
@@ -232,11 +234,14 @@
         <el-button type="primary" @click="submitFileForm">确 定</el-button>
       </div>
     </el-dialog>
+    <!--    查询关联盲票弹框-->
+    <Association v-if="associationShow" @cancel="associationTicket" :associationShow="associationShow" :associationGoodsId="associationGoodsId"></Association>
   </div>
 </template>
 <script>
 
 import Camilo from '@/components/Camilo'
+import Association from '@/components/Association'
 import {publicFileGetUrl} from "@/api/common"
 import {
   getGoodsList,
@@ -256,7 +261,8 @@ import {getToken, getSign} from "@/utils/auth";
 export default {
   name: 'List',
   components: {
-    Camilo
+    Camilo,
+    Association
   },
   data() {
     return {
@@ -280,6 +286,8 @@ export default {
       },
       reqData: {},
       camiloGoodsId: null,
+      associationShow: false,
+      associationGoodsId: '',
     }
   },
   created() {
@@ -331,6 +339,17 @@ export default {
       this.camiloGoodsId = id
       this.camiloShow = true
     },
+    //查看关联盲票
+    toAssociation(id) {
+      this.associationShow = true
+      this.associationGoodsId = id
+      
+    },
+    //关闭关联盲票弹框
+    associationTicket() {
+      this.associationShow = false
+      this.associationGoodsId = ''
+    },
     //上传卡密按钮操作
     handleImport(id) {
       this.camiloGoodsId = id