123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <template>
- <a-modal
- v-model="opened"
- :title="title"
- centered
- :maskClosable="false"
- :confirmLoading="confirmLoading"
- :width="960"
- :footer="null"
- @cancel="cancel"
- >
- <a-spin :spinning="spinning" tip="Loading...">
- <a-descriptions v-if="currentData">
- <a-descriptions-item label="调回单号">{{ currentData.recallBillNo||'--' }}</a-descriptions-item>
- <a-descriptions-item label="创建时间">{{ currentData.createDate||'--' }}</a-descriptions-item>
- </a-descriptions>
- <a-table
- class="sTable fixPagination"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data-source="list"
- :scroll="{ y:500 }"
- :pagination="false"
- bordered>
- <template slot="confirmQty" slot-scope="text,record,index">
- <a-input-number
- size="small"
- id="recallModal-inputNumber"
- @focus="currentInd=index"
- @change="changeNum"
- v-model="record.confirmQty"
- :precision="0"
- :min="0"
- :max="record.qty"
- placeholder="请输入"
- />
- </template>
- </a-table>
- <div class="btn-cont">
- <a-button type="primary" id="recallManagement-confirm-modal-save" @click="handleSave">确认退库</a-button>
- <a-button id="recallManagement-confirm-modal-back" @click="cancel" style="margin-left: 15px;">取消</a-button>
- </div>
- </a-spin>
- </a-modal>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable } from '@/components'
- import { warehouseCascadeList, shelfRecallDetailList } from '@/api/shelfRecall.js'
- export default {
- components: { STable },
- mixins: [commonMixin],
- props: {
- isOpenModal: {
- type: Boolean,
- default: false
- },
- currentData: {
- type: Object,
- default: function () {
- return {}
- }
- }
- },
- data () {
- return {
- currentInd: 0,
- formItemLayout: {
- labelCol: { span: 6 },
- wrapperCol: { span: 15 }
- },
- opened: this.isOpenModal,
- confirmLoading: false,
- spinning: false,
- rules: [],
- columns: [
- { title: '产品编码', dataIndex: 'product.code', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'product.name', width: '30%', align: 'left', customRender: function (text) { return text || '--' } },
- { title: '调回数量', dataIndex: 'qty', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '实退数量', width: '15%', align: 'center', scopedSlots: { customRender: 'confirmQty' } },
- { title: '单位', dataIndex: 'product.unit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
- ],
- list: []
- }
- },
- computed: {
- title () {
- return '调回单退库' + ' —— ' + (this.currentData && this.currentData.shelfInfo ? this.currentData.shelfInfo.shelfName : '')
- }
- },
- methods: {
- changeNum (val) {
- console.log(val)
- this.list[this.currentInd].confirmQty = val
- this.list.splice()
- console.log(this.list[this.currentInd].confirmQty, '调回数量')
- },
- // 保存
- handleSave () {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '调回产品将退回至经销商仓库,确认退库吗?',
- centered: true,
- onOk () {
- // _this.$emit('close')
- _this.spinning = true
- const arr = []
- _this.list.map((item, index) => {
- if (item.confirmQty || item.confirmQty == 0) {
- arr.push({
- productSn: item.productSn,
- confirmQty: item.confirmQty,
- recallBillDetailSn: item.recallBillDetailSn
- })
- }
- })
- const params = {
- shelfSn: _this.list[0].shelfSn,
- recallBillSn: _this.list[0].recallBillSn,
- recallBillNo: _this.list[0].recallBillNo,
- detailList: arr
- }
- warehouseCascadeList(params).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.spinning = false
- _this.$emit('refresh')
- _this.cancel()
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- getData () {
- this.spinning = true
- shelfRecallDetailList({ recallBillSn: this.currentData.recallBillSn }).then(res => {
- if (res.status == 200) {
- this.list = res.data
- const no = 0
- for (var i = 0; i < this.list.length; i++) {
- this.list[i].no = no + i + 1
- this.list[i].confirmQty = this.list[i].qty
- }
- } else {
- this.list = []
- }
- this.spinning = false
- })
- },
- // 取消
- cancel () {
- this.$emit('close')
- }
- },
- watch: {
- isOpenModal (nVal, oVal) {
- this.opened = nVal
- if (nVal) {
- this.getData()
- // if (this.currentData) {
- // this.currentData.map((item, index) => {
- // item.no = index + 1
- // item.confirmQty = item.qty
- // })
- // }
- // this.list = JSON.parse(JSON.stringify(this.currentData || []))
- }
- }
- }
- }
- </script>
- <style lang="less">
- .btn-cont {
- text-align: center;
- margin: 25px 0 10px;
- }
- </style>
|