zhaojs
2023-09-15 51d3abe71fdd8171d059e0468e3f5a237bcc815b
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
96
97
98
99
100
101
102
103
104
105
106
<template>
  <a-modal
    title="修改价格"
    :width="940"
    :visible="visible"
    :confirmLoading="loading"
    @ok="() => { $emit('ok') }"
    @cancel="() => { $emit('cancel') }"
  >
    <a-spin :spinning="loading">
      <a-table
        rowKey="id"
        ref="table"
        size="default"
        :columns="columns"
        :data-source="data"
        :pagination="false"
      >
        <span slot="props" slot-scope="text, record">
          {{
            getProps(record)
          }}
        </span>
        <span slot="yzPrice" slot-scope="text, record">
          <a-input-number @change="changehand" v-model:value="record.yzSkuPrice"/>
        </span>
      </a-table>
    </a-spin>
  </a-modal>
</template>
 
    <script>
import pick from 'lodash.pick'
    const columns = [
    {
      title: '规格',
      scopedSlots: { customRender: 'props' }
    },
    {
      title: '1688是否包邮',
      dataIndex: 'isAliPost',
      customRender: (text, record) => text == true ? '是' : '否'
    },
    {
      title: '1688价格',
      dataIndex: 'aliSkuPrice'
    },
    {
      title: '有赞价格',
      dataIndex: 'yzSkuPrice',
      scopedSlots: { customRender: 'yzPrice' }
    }
  ]
    export default {
      props: {
        visible: {
          type: Boolean,
          required: true
        },
        loading: {
          type: Boolean,
          default: () => false
        },
 
        model: {
          type: Array,
          default: () => null
        }
      },
      data () {
        this.formLayout = {
          labelCol: {
            xs: { span: 24 },
            sm: { span: 7 }
          },
          wrapperCol: {
            xs: { span: 24 },
            sm: { span: 13 }
          }
        }
        return {
            columns,
            data: []
        }
      },
      created () {
       // 当 model 发生改变时,为表单设置值
       this.$watch('model', () => {
         this.data = this.model
        })
      },
      methods: {
        getProps (record) {
            var txt = ''
            record.props.forEach(element => {
                txt += element.name + ':'
                txt += element.value + ';'
            })
            return txt
        },
        changehand (value) {
            console.log(this.data)
        }
      }
    }
    </script>