|
@@ -24,62 +24,22 @@
|
|
|
</a-page-header>
|
|
|
</a-affix>
|
|
|
|
|
|
- <a-card size="small" :bordered="false" class="pages-wrap">
|
|
|
+ <a-card size="small" :bordered="false" class="pages-wrap" v-if="ordeDetail&&ordeDetail.salesReturnBillSource=='SALES'">
|
|
|
<!-- 查询配件列表 -->
|
|
|
- <queryPart :buyerSn="$route.params.buyerSn" :priceType="ordeDetail.priceType" grabFlag="0" :newLoading="isInster" @add="saveProduct"></queryPart>
|
|
|
+ <queryPart :buyerSn="$route.params.buyerSn" grabFlag="0" :newLoading="isInster" @add="saveProduct"></queryPart>
|
|
|
</a-card>
|
|
|
<a-card size="small" :bordered="false" class="pages-wrap">
|
|
|
<!-- alert -->
|
|
|
<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"
|
|
@@ -100,42 +60,9 @@
|
|
|
:precision="0"
|
|
|
@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>
|
|
|
- <!-- 价格 -->
|
|
|
- <template slot="price" slot-scope="text, record">
|
|
|
- <editable-cell
|
|
|
- size="small"
|
|
|
- :text="text"
|
|
|
- :max="999999"
|
|
|
- :min="0"
|
|
|
- :precision="2"
|
|
|
- punit="¥"
|
|
|
- @change="onCellChange(record.id, 'price', $event)" />
|
|
|
- </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"
|
|
|
- :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
|
|
|
- id="bulkWarehousingOrderEdit-warehouseCascade"
|
|
|
- placeholder="请选择仓库仓位"
|
|
|
- style="width: 100%;" />
|
|
|
+ <!-- 退货原因 -->
|
|
|
+ <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="action" slot-scope="text, record">
|
|
@@ -161,8 +88,6 @@
|
|
|
id="salesReturn-handleSubmit">提交</a-button>
|
|
|
</div>
|
|
|
</a-affix>
|
|
|
- <!-- 选择客户弹框 -->
|
|
|
- <choose-custom-modal :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></choose-custom-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -170,17 +95,21 @@
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import queryPart from './queryPart.vue'
|
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
|
-import chooseCustomModal from './chooseCustomModal.vue'
|
|
|
-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',
|
|
|
+ name: 'SalesReturnEdit',
|
|
|
components: {
|
|
|
STable,
|
|
|
VSelect,
|
|
|
queryPart,
|
|
|
- EditableCell,
|
|
|
- chooseCustomModal
|
|
|
+ EditableCell
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
@@ -188,18 +117,14 @@ export default {
|
|
|
orderSn: null,
|
|
|
buyerSn: null,
|
|
|
disabled: false,
|
|
|
- openModal: false,
|
|
|
isInster: false, // 是否正在添加产品
|
|
|
ordeDetail: { discountAmount: 0 },
|
|
|
delLoading: false,
|
|
|
- warehouseCascadeData: [], // 仓库仓位
|
|
|
// 已选产品
|
|
|
dataSource: [],
|
|
|
productForm: {
|
|
|
- productCode: '',
|
|
|
- productName: ''
|
|
|
+ salesReturnBillSn: ''
|
|
|
},
|
|
|
- countData: null,
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{
|
|
@@ -221,18 +146,18 @@ export default {
|
|
|
width: 200
|
|
|
},
|
|
|
{
|
|
|
- title: '原厂编码',
|
|
|
- dataIndex: 'dealerProductEntity.origCode',
|
|
|
+ title: '退货数量',
|
|
|
+ dataIndex: 'qty',
|
|
|
align: 'center',
|
|
|
- width: 160,
|
|
|
- customRender: function (text) { return text || '--' }
|
|
|
+ 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: '单位',
|
|
@@ -240,32 +165,19 @@ export default {
|
|
|
align: 'center',
|
|
|
width: 100
|
|
|
},
|
|
|
- { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 200, align: 'center' },
|
|
|
{
|
|
|
- title: '退货数量',
|
|
|
- dataIndex: 'qty',
|
|
|
- align: 'center',
|
|
|
- width: 150,
|
|
|
- scopedSlots: { customRender: 'qty' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '废品数量',
|
|
|
- dataIndex: 'celQty',
|
|
|
- align: 'center',
|
|
|
- width: 150,
|
|
|
- scopedSlots: { customRender: 'celQty' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '退货金额小计',
|
|
|
+ title: '退货小计',
|
|
|
align: 'center',
|
|
|
- scopedSlots: { customRender: 'returnAmount' },
|
|
|
+ dataIndex: 'totalAmount',
|
|
|
+ customRender: function (text) { return '¥' + (text || 0) },
|
|
|
width: 100
|
|
|
},
|
|
|
{
|
|
|
- title: '折后金额小计',
|
|
|
- dataIndex: 'discountedAmount',
|
|
|
+ title: '退货原因',
|
|
|
+ dataIndex: 'remarks',
|
|
|
align: 'center',
|
|
|
- width: 100
|
|
|
+ width: 150,
|
|
|
+ scopedSlots: { customRender: 'remarks' }
|
|
|
},
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
@@ -275,21 +187,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
|
|
@@ -303,123 +205,45 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'salesReturnList' })
|
|
|
},
|
|
|
- // 选择客户成功
|
|
|
- chooseCustomOk (data) {
|
|
|
-
|
|
|
- },
|
|
|
- handleEditCustom () {
|
|
|
- this.openModal = true
|
|
|
- },
|
|
|
+ // 修改退货数量
|
|
|
onCellChange (id, key, value) {
|
|
|
const chooseLoadData = [...this.chooseLoadData]
|
|
|
const row = chooseLoadData.find(item => item.id === id)
|
|
|
if (row) {
|
|
|
row[key] = Number(value)
|
|
|
- if (row.celQty > row.qty) {
|
|
|
- this.$message.info('废品数量不可大于本次退货数量')
|
|
|
- } 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
|
|
@@ -446,7 +270,7 @@ export default {
|
|
|
this.getOrderDetail()
|
|
|
},
|
|
|
// 添加或修改产品
|
|
|
- saveProduct (row, type) {
|
|
|
+ saveProduct (row) {
|
|
|
console.log(row)
|
|
|
// 防止多次添加产品
|
|
|
if (this.isInster) {
|
|
@@ -455,27 +279,16 @@ export default {
|
|
|
this.isInster = true
|
|
|
const params = {
|
|
|
'salesReturnBillSn': this.orderSn,
|
|
|
- 'salesReturnBillNo': this.ordeDetail.salesReturnBillNo,
|
|
|
- 'salesBillSn': row.salesBillSn,
|
|
|
- 'salesBillNo': row.salesBillNo,
|
|
|
- 'salesBillDetailSn': row.salesBillDetailSn,
|
|
|
- 'price': row.price,
|
|
|
- 'cost': row.cost,
|
|
|
+ 'price': row.productPrice,
|
|
|
+ 'cost': row.lastStockCost,
|
|
|
'productSn': row.productSn,
|
|
|
- 'celQty': row.celQty,
|
|
|
- 'hasReturnQty': row.hasReturnQty,
|
|
|
- 'warehouseLocationSn': row.warehouseLocationSn,
|
|
|
- 'warehouseSn': row.warehouseSn
|
|
|
+ 'qty': row.qty
|
|
|
}
|
|
|
- // 编辑
|
|
|
- if (type == 'edit') {
|
|
|
- params.id = row.id
|
|
|
- params.qty = row.qty
|
|
|
- } else {
|
|
|
- params.salesQty = row.qty
|
|
|
- }
|
|
|
- salesReturnSaveProduct(params).then(res => {
|
|
|
- this.resetSearchForm(true)
|
|
|
+ salesReturnDetailInsert(params).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.resetSearchForm(true)
|
|
|
+ this.$message.success(res.message)
|
|
|
+ }
|
|
|
this.isInster = false
|
|
|
})
|
|
|
},
|
|
@@ -490,11 +303,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.orderId = this.$route.params.id
|
|
|
this.orderSn = this.$route.params.sn
|
|
|
this.buyerSn = this.$route.params.buyerSn
|
|
|
this.getOrderDetail()
|
|
|
- this.getWarehouseCascade()
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|