123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <a-modal
- centered
- class="setPrice-basicInfo-modal"
- :footer="null"
- :maskClosable="false"
- :title="title"
- v-model="isShow"
- @cancel="cancel"
- :width="800">
- <a-spin :spinning="spinning" tip="Loading...">
- <div class="setPrice-title">
- <div>以下产品没有成本价,无法进行财务盘点审核!</div>
- <div>请先设置成本价,然后再审核。</div>
- </div>
- <div class="setPrice-table">
- <a-table
- class="sTable fixPagination"
- ref="table"
- size="small"
- :rowKey="(record,index) => record.id +'-'+ index"
- :columns="columns"
- :data-source="list"
- :scroll="{ y:400 }"
- :pagination="false"
- bordered>
- <template slot="action" slot-scope="text,record">
- <a-input-number
- style="width: 100%;"
- size="small"
- v-model="record.lastStockCost"
- :precision="2"
- :min="0"
- :max="999999"
- placeholder="请输入成本价"
- />
- </template>
- </a-table>
- </div>
- <div class="btn-cont">
- <a-button type="primary" @click="handleSubmit">保存</a-button>
- <a-button @click="cancel" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { stockWarnSaveBatch } from '@/api/checkWarehouse'
- export default {
- name: 'SettleModal',
- components: {},
- mixins: [commonMixin],
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- title: {
- type: String,
- default: '设置成本价'
- }
- },
- data () {
- return {
- spinning: false,
- confirmLoading: false,
- isShow: this.openModal, // 是否打开弹框
- row: null,
- list: [],
- // 表头
- columns: [
- { title: '产品编码', dataIndex: 'productCode', width: '30%', align: 'center', customRender: function (text) { return ((text || text != ' ') ? text : '--') } },
- { title: '产品名称', dataIndex: 'productName', width: '50%', align: 'left', customRender: function (text) { return (text || '--') } },
- { title: '成本价', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }
- ]
- }
- },
- methods: {
- // 保存
- handleSubmit (e) {
- const _this = this
- const hasEmpty = this.list.filter(item => !item.lastStockCost && item.lastStockCost != 0)
- if (hasEmpty.length) {
- this.$message.info('成本价不能为空!')
- return
- }
- const params = []
- this.list.map(item => {
- params.push({
- 'id': item.id,
- 'lastStockCost': item.lastStockCost
- })
- })
- stockWarnSaveBatch(params).then(res => {
- _this.isShow = false
- _this.$emit('ok', _this.row, true)
- })
- },
- cancel () {
- this.isShow = false
- },
- // 编辑信息
- setData (data, row) {
- this.list = data
- this.row = row
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- }
- }
- }
- }
- </script>
- <style lang="less">
- .setPrice-basicInfo-modal{
- .setPrice-title{
- text-align: center;
- padding-bottom: 20px;
- line-height: 24px;
- }
- .btn-cont{
- padding: 30px 0 0;
- text-align: center;
- }
- }
- </style>
|