|
@@ -33,53 +33,13 @@
|
|
|
<a-alert style="margin-bottom: 10px;" type="info">
|
|
|
<div slot="message" class="total-bar">
|
|
|
<div>
|
|
|
- <span>退货总金额:{{ countData&&countData.totalAmount }}元;</span>
|
|
|
- <span>总款数:{{ countData&&countData.totalCategory }};</span>
|
|
|
- <span>总数量:{{ countData&&countData.totalQty }};</span>
|
|
|
- <span>废品总数量:{{ countData&&countData.totalCelQty }};</span>
|
|
|
+ <span>退货总金额:{{ ordeDetail&&ordeDetail.totalAmount }}元;</span>
|
|
|
+ <span>退货总数量:{{ ordeDetail&&ordeDetail.totalQty }};</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <div>
|
|
|
- 折扣金额:
|
|
|
- <a-input-number id="discount" v-model="ordeDetail.discountAmount" :min="0" :precision="2" :max="999999"/>
|
|
|
- <a-button type="primary" @click="salesReturnDiscount" class="button-info">打折</a-button>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- 折扣:<strong>{{ ordeDetail&&ordeDetail.discountRate || 0 }}%</strong>;
|
|
|
- 折后总售价:<strong>¥{{ ordeDetail&&ordeDetail.discountedAmount || 0 }}</strong>;
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</a-alert>
|
|
|
- <!-- 查询条件 -->
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="18">
|
|
|
- <a-form-model layout="inline" :model="productForm">
|
|
|
- <a-form-model-item label="产品编码">
|
|
|
- <a-input v-model="productForm.productCode" placeholder="输入产品编码" />
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="产品名称">
|
|
|
- <a-input v-model="productForm.productName" placeholder="输入产品名称" />
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item>
|
|
|
- <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesReturn-refresh">查询</a-button>
|
|
|
- <a-button style="margin: 0 0 18px 8px" @click="resetForm" id="salesReturn-reset">重置</a-button>
|
|
|
- </a-form-model-item>
|
|
|
- </a-form-model>
|
|
|
- </a-col>
|
|
|
- <a-col :span="6">
|
|
|
- <div style="float:right;overflow: hidden;">
|
|
|
- <a-button id="salesReturn-dru">导入明细</a-button>
|
|
|
- <a-button
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- @click="salesReturnDelAll"
|
|
|
- :loading="delLoading"
|
|
|
- style="margin-left: 10px"
|
|
|
- id="salesReturn-del-all">整单删除</a-button>
|
|
|
- </div>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
<!-- 已选配件列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
@@ -101,32 +61,13 @@
|
|
|
@change="onCellChange(record.id, 'qty', $event)" />
|
|
|
</template>
|
|
|
<!-- 废品数量 -->
|
|
|
- <template slot="celQty" slot-scope="text, record">
|
|
|
- <editable-cell
|
|
|
- size="small"
|
|
|
- :text="record.celQty"
|
|
|
- :max="999999"
|
|
|
- :min="0"
|
|
|
- :precision="0"
|
|
|
- @change="onCellChange(record.id, 'celQty', $event)" />
|
|
|
+ <template slot="remarks" slot-scope="text, record">
|
|
|
+ <a-input placeholder="30个字符内" maxlength="30" v-model="record.remarks" @change="updateRemark(record)"></a-input>
|
|
|
</template>
|
|
|
<!-- 退货金额小计 -->
|
|
|
<template slot="returnAmount" slot-scope="text, record">
|
|
|
¥{{ (record.price * record.qty).toFixed(2) }}
|
|
|
</template>
|
|
|
- <!-- 仓库仓位 -->
|
|
|
- <template slot="warehouse" slot-scope="text, record, index">
|
|
|
- <a-cascader
|
|
|
- @change="e => changeWarehouseCascade(e, record, index)"
|
|
|
- v-model="record.warehouseCascade"
|
|
|
- expand-trigger="hover"
|
|
|
- :options="warehouseCascadeData"
|
|
|
- :allowClear="false"
|
|
|
- :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
|
|
|
- id="bulkWarehousingOrderEdit-warehouseCascade"
|
|
|
- placeholder="请选择仓库仓位"
|
|
|
- style="width: 100%;" />
|
|
|
- </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button
|
|
@@ -158,8 +99,14 @@
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import queryPart from './queryPart.vue'
|
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
|
-import { warehouseCascadeList } from '@/api/warehouse'
|
|
|
-import { salesReturnDetail, salesReturnQueryCount, salesReturnDetailList, salesReturnDiscount, salesReturnDelAll, salesReturnDetailDel, salesReturnSaveProduct, salesReturnSubmit } from '@/api/salesReturn'
|
|
|
+import { salesReturnDetail, salesReturnSubmit } from '@/api/salesReturn'
|
|
|
+import {
|
|
|
+ salesReturnDetailList,
|
|
|
+ salesReturnDetailDel,
|
|
|
+ salesReturnDetailInsert,
|
|
|
+ salesReturnDetailUpdateQty,
|
|
|
+ salesReturnDetailUpdateReason
|
|
|
+} from '@/api/salesReturnDetail'
|
|
|
export default {
|
|
|
name: 'SalesDetail',
|
|
|
components: {
|
|
@@ -181,10 +128,8 @@ export default {
|
|
|
// 已选产品
|
|
|
dataSource: [],
|
|
|
productForm: {
|
|
|
- productCode: '',
|
|
|
- productName: ''
|
|
|
+ salesReturnBillSn: ''
|
|
|
},
|
|
|
- countData: null,
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{
|
|
@@ -193,6 +138,12 @@ export default {
|
|
|
align: 'center',
|
|
|
width: 100
|
|
|
},
|
|
|
+ {
|
|
|
+ title: '采购单号',
|
|
|
+ dataIndex: 'purchaseBillNo',
|
|
|
+ align: 'center',
|
|
|
+ width: 200
|
|
|
+ },
|
|
|
{
|
|
|
title: '产品编码',
|
|
|
dataIndex: 'dealerProductEntity.code',
|
|
@@ -206,24 +157,24 @@ export default {
|
|
|
width: 200
|
|
|
},
|
|
|
{
|
|
|
- title: '原厂编码',
|
|
|
- dataIndex: 'dealerProductEntity.origCode',
|
|
|
+ title: '剩余可退数量',
|
|
|
+ dataIndex: 'refundableQty',
|
|
|
align: 'center',
|
|
|
- width: 160,
|
|
|
- customRender: function (text) { return text || '--' }
|
|
|
+ width: 100
|
|
|
},
|
|
|
{
|
|
|
- title: '销售单号',
|
|
|
- dataIndex: 'salesBillNo',
|
|
|
+ title: '本次退货数量',
|
|
|
+ dataIndex: 'qty',
|
|
|
align: 'center',
|
|
|
- width: 200
|
|
|
+ width: 150,
|
|
|
+ scopedSlots: { customRender: 'qty' }
|
|
|
},
|
|
|
{
|
|
|
- title: '售价',
|
|
|
+ title: '退货单价',
|
|
|
dataIndex: 'price',
|
|
|
+ customRender: function (text) { return '¥' + (text || 0) },
|
|
|
align: 'center',
|
|
|
- width: 150,
|
|
|
- scopedSlots: { customRender: 'price' }
|
|
|
+ width: 150
|
|
|
},
|
|
|
{
|
|
|
title: '单位',
|
|
@@ -232,37 +183,18 @@ export default {
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
- title: '销售数量',
|
|
|
- dataIndex: 'salesQty',
|
|
|
+ title: '退货小计',
|
|
|
align: 'center',
|
|
|
+ dataIndex: 'totalAmount',
|
|
|
+ customRender: function (text) { return '¥' + (text || 0) },
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
- title: '本次退货数量',
|
|
|
- dataIndex: 'qty',
|
|
|
+ title: '退货原因',
|
|
|
+ dataIndex: 'remarks',
|
|
|
align: 'center',
|
|
|
width: 150,
|
|
|
- scopedSlots: { customRender: 'qty' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '废品数量',
|
|
|
- dataIndex: 'celQty',
|
|
|
- align: 'center',
|
|
|
- width: 150,
|
|
|
- scopedSlots: { customRender: 'celQty' }
|
|
|
- },
|
|
|
- { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
|
|
|
- {
|
|
|
- title: '退货金额小计',
|
|
|
- align: 'center',
|
|
|
- scopedSlots: { customRender: 'returnAmount' },
|
|
|
- width: 100
|
|
|
- },
|
|
|
- {
|
|
|
- title: '折后金额小计',
|
|
|
- dataIndex: 'discountedAmount',
|
|
|
- align: 'center',
|
|
|
- width: 100
|
|
|
+ scopedSlots: { customRender: 'remarks' }
|
|
|
},
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
@@ -272,21 +204,11 @@ export default {
|
|
|
this.disabled = true
|
|
|
// 查询总计
|
|
|
this.productForm.salesReturnBillSn = this.$route.params.sn
|
|
|
- this.getQueryCount(Object.assign(parameter, this.productForm))
|
|
|
return salesReturnDetailList(Object.assign(parameter, this.productForm)).then(res => {
|
|
|
const data = res.data
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
- const warehouseSn = data.list[i].warehouseSn || undefined
|
|
|
- const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
|
|
|
- if (warehouseSn || warehouseLocationSn) {
|
|
|
- data.list[i].warehouseSnBackups = warehouseSn
|
|
|
- data.list[i].warehouseLocationSnBackups = warehouseLocationSn
|
|
|
- data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
|
|
|
- } else {
|
|
|
- data.list[i].warehouseCascade = undefined
|
|
|
- }
|
|
|
}
|
|
|
this.disabled = false
|
|
|
this.chooseLoadData = data.list
|
|
@@ -300,118 +222,50 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'salesReturnList' })
|
|
|
},
|
|
|
+ // 修改退货数量
|
|
|
onCellChange (id, key, value) {
|
|
|
const chooseLoadData = [...this.chooseLoadData]
|
|
|
const row = chooseLoadData.find(item => item.id === id)
|
|
|
if (row) {
|
|
|
row[key] = Number(value)
|
|
|
- console.log(row.celQty, row.qty)
|
|
|
- if (row.celQty > row.qty) {
|
|
|
- this.$message.info('废品数量不可大于本次退货数量')
|
|
|
+ if (row.qty > row.refundableQty) {
|
|
|
+ this.$message.info('本次退货数量不可大于剩余可退数量')
|
|
|
this.$refs.table.refresh(true)
|
|
|
} else {
|
|
|
- this.saveProduct(row, 'edit')
|
|
|
+ salesReturnDetailUpdateQty({
|
|
|
+ salesReturnDetailSn: row.salesReturnDetailSn,
|
|
|
+ qty: row.qty
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.resetSearchForm(true)
|
|
|
+ this.$message.success(res.message)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- // 仓库仓位 级联 列表
|
|
|
- getWarehouseCascade () {
|
|
|
- warehouseCascadeList({}).then(res => {
|
|
|
+ // 修改退货原因
|
|
|
+ updateRemark (row) {
|
|
|
+ salesReturnDetailUpdateReason({
|
|
|
+ salesReturnDetailSn: row.salesReturnDetailSn,
|
|
|
+ remarks: row.remarks
|
|
|
+ }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- res.data.map(item => {
|
|
|
- item.sn = item.warehouseSn
|
|
|
- if (item.warehouseLocationList) {
|
|
|
- item.warehouseLocationList.map(subItem => {
|
|
|
- subItem.sn = subItem.warehouseLocationSn
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- this.warehouseCascadeData = res.data
|
|
|
- } else {
|
|
|
- this.warehouseCascadeData = []
|
|
|
+ this.resetSearchForm(true)
|
|
|
+ this.$message.success(res.message)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 修改仓库仓位
|
|
|
- changeWarehouseCascade (val, opt, ind) {
|
|
|
- console.log(val, opt, ind)
|
|
|
- let loadData = this.chooseLoadData[ind]
|
|
|
- if (val.length < 2) {
|
|
|
- this.$message.warning('当前仓库无仓位,请选择其他仓库')
|
|
|
- const warehouseSnBackups = loadData.warehouseSnBackups || undefined
|
|
|
- const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
|
|
|
- loadData.warehouseSn = warehouseSnBackups
|
|
|
- loadData.warehouseLocationSn = warehouseLocationSnBackups
|
|
|
- if (warehouseSnBackups || warehouseLocationSnBackups) {
|
|
|
- loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
|
|
|
- } else {
|
|
|
- loadData.warehouseCascade = undefined
|
|
|
- }
|
|
|
- } else {
|
|
|
- loadData.warehouseSn = val[0] ? val[0] : ''
|
|
|
- loadData.warehouseLocationSn = val[1] ? val[1] : ''
|
|
|
- loadData.warehouseSnBackups = val[0] ? val[0] : ''
|
|
|
- loadData.warehouseLocationSnBackups = val[1] ? val[1] : ''
|
|
|
- loadData = this.chooseLoadData[ind]
|
|
|
- console.log(loadData)
|
|
|
- this.saveProduct(loadData, 'edit')
|
|
|
- }
|
|
|
- },
|
|
|
// 重置列表
|
|
|
resetForm () {
|
|
|
- this.productForm = {
|
|
|
- productName: '',
|
|
|
- productCode: ''
|
|
|
- }
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
- // 明细统计
|
|
|
- getQueryCount (params) {
|
|
|
- salesReturnQueryCount(params).then(res => {
|
|
|
- this.countData = res.data || null
|
|
|
- })
|
|
|
- },
|
|
|
// 获取单据详细
|
|
|
getOrderDetail () {
|
|
|
salesReturnDetail({ sn: this.orderSn }).then(res => {
|
|
|
this.ordeDetail = res.data || null
|
|
|
})
|
|
|
},
|
|
|
- // 打折
|
|
|
- salesReturnDiscount () {
|
|
|
- if (this.ordeDetail.discountAmount < 0) {
|
|
|
- return
|
|
|
- }
|
|
|
- salesReturnDiscount({
|
|
|
- discountAmount: this.ordeDetail.discountAmount,
|
|
|
- salesReturnSn: this.ordeDetail.salesReturnSn,
|
|
|
- id: this.ordeDetail.id
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.resetSearchForm()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 整单删除
|
|
|
- salesReturnDelAll () {
|
|
|
- const _this = this
|
|
|
- this.$confirm({
|
|
|
- title: '提示',
|
|
|
- content: '确认要整单删除吗?',
|
|
|
- centered: true,
|
|
|
- closable: true,
|
|
|
- onOk () {
|
|
|
- _this.delLoading = true
|
|
|
- salesReturnDelAll({ sn: _this.ordeDetail.salesReturnSn }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- _this.resetSearchForm()
|
|
|
- }
|
|
|
- _this.$message.info(res.message)
|
|
|
- _this.delLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 删除产品
|
|
|
handleDel (row) {
|
|
|
const _this = this
|
|
@@ -466,7 +320,7 @@ export default {
|
|
|
} else {
|
|
|
params.salesQty = row.qty
|
|
|
}
|
|
|
- salesReturnSaveProduct(params).then(res => {
|
|
|
+ salesReturnDetailInsert(params).then(res => {
|
|
|
this.resetSearchForm(true)
|
|
|
this.isInster = false
|
|
|
})
|
|
@@ -485,7 +339,6 @@ export default {
|
|
|
this.orderSn = this.$route.params.sn
|
|
|
this.buyerSn = this.$route.params.buyerSn
|
|
|
this.getOrderDetail()
|
|
|
- this.getWarehouseCascade()
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|