Blame view

src/views/extend/order/GoodsBox.vue 2.88 KB
4424f41c   monkeyhouyi   网信执法、清单管理静态页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  <template>
    <el-dialog title="选择商品" :close-on-click-modal="false" :visible.sync="visible"
      class="NCC-dialog NCC-dialog_center" lock-scroll append-to-body width="700px">
      <el-row class="NCC-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>
          <el-col :span="10">
            <el-form-item label="关键词">
              <el-input v-model="keyword" placeholder="请输入关键词查询" clearable
                @keyup.enter.native="init()" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" @click="init()">{{$t('common.search')}}
              </el-button>
              <el-button icon="el-icon-refresh-right" @click="refresh()">{{$t('common.reset')}}
              </el-button>
            </el-form-item>
          </el-col>
        </el-form>
        <div class="NCC-common-search-box-right">
          <el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
            <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false"
              @click="refresh()" />
          </el-tooltip>
        </div>
      </el-row>
      <NCC-table v-loading="listLoading" :data="list" hasC @selection-change="handleSelectionChange"
        :border="false">
        <el-table-column prop="text" label="商品名称" width="200" />
        <el-table-column prop="code" label="商品编码" />
        <el-table-column prop="specifications" label="规格型号" />
        <el-table-column prop="unit" label="单位" />
        <el-table-column prop="price" label="售价" />
      </NCC-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{$t('common.cancelButton')}}</el-button>
        <el-button type="primary" @click="select()">{{$t('common.confirmButton')}}</el-button>
      </span>
    </el-dialog>
  </template>
  
  <script>
  import { GoodsList } from '@/api/extend/order'
  export default {
    data() {
      return {
        visible: false,
        listLoading: true,
        keyword: '',
        list: [],
        total: 0,
        checked: []
      }
    },
    methods: {
      init() {
        this.visible = true
        this.listLoading = true
        let query = { keyword: this.keyword }
        GoodsList(query).then(res => {
          this.list = res.data.list
          this.listLoading = false
        })
      },
      refresh() {
        this.keyword = ''
        this.init()
      },
      select() {
        if (!this.checked.length) return
        this.visible = false
        this.$emit('refreshDataList', this.checked)
      },
      handleSelectionChange(val) {
        this.checked = val
      }
    }
  }
  </script>
  <style lang="scss" scoped>
  >>> .el-dialog__body {
    height: 70vh;
    padding: 0 0 10px !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    .NCC-common-search-box {
      margin-bottom: 0;
      .NCC-common-search-box-right {
        padding: 10px 10px 0 0;
      }
    }
  }
  </style>