|
@@ -23,7 +23,7 @@
|
|
|
</a-card>
|
|
|
<a-card size="small" :bordered="false" class="salesEdit-cont">
|
|
|
<!-- 总计 -->
|
|
|
- <a-alert style="margin-bottom: 15px;" type="info">
|
|
|
+ <a-alert style="margin-bottom: 10px;" type="info">
|
|
|
<div slot="message" class="total-bar">
|
|
|
<div>
|
|
|
总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? '¥'+detailData.totalAmount : '--' }}</strong>;
|
|
@@ -44,35 +44,45 @@
|
|
|
</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" allowClear placeholder="输入产品编码" />
|
|
|
- </a-form-model-item>
|
|
|
- <a-form-model-item label="产品名称">
|
|
|
- <a-input v-model="productForm.productName" allowClear 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="salesEdit-refresh">查询</a-button>
|
|
|
- <a-button style="margin: 0 0 18px 8px" @click="resetForm" id="salesEdit-reset">重置</a-button>
|
|
|
- </a-form-model-item>
|
|
|
- </a-form-model>
|
|
|
- </a-col>
|
|
|
- <a-col :span="6">
|
|
|
- <div style="float:right;overflow: hidden;">
|
|
|
- <!-- <a-button size="small" id="salesEdit-dru">导入明细</a-button> -->
|
|
|
- <a-button
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- @click="delSalerDetailAll"
|
|
|
- :loading="delLoading"
|
|
|
- style="margin-left: 10px"
|
|
|
- id="salesEdit-del-all">整单删除</a-button>
|
|
|
- </div>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :span="18">
|
|
|
+ <a-form-model :model="productForm" layout="inline" @keyup.enter.native="$refs.table.refresh(true)" >
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="8" :sm="24">
|
|
|
+ <a-form-model-item label="产品编码">
|
|
|
+ <a-input v-model="productForm.productCode" allowClear placeholder="输入产品编码" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="8" :sm="24">
|
|
|
+ <a-form-model-item label="产品名称">
|
|
|
+ <a-input v-model="productForm.productName" allowClear placeholder="输入产品名称" />
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="8" :sm="24">
|
|
|
+ <a-form-model-item>
|
|
|
+ <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
|
|
|
+ <a-button style="margin: 0 0 18px 8px" @click="resetForm" id="salesEdit-reset">重置</a-button>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form-model>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="6">
|
|
|
+ <div style="float:right;overflow: hidden;">
|
|
|
+ <!-- <a-button size="small" id="salesEdit-dru">导入明细</a-button> -->
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="delSalerDetailAll"
|
|
|
+ :loading="delLoading"
|
|
|
+ style="margin-left: 10px"
|
|
|
+ id="salesEdit-del-all">整单删除</a-button>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </div>
|
|
|
<!-- 已选配件列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
@@ -81,7 +91,7 @@
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
- :scroll="{ x: 1940, y: 300 }"
|
|
|
+ :scroll="{ x: 1300, y: 300 }"
|
|
|
:rowClassName="(record, index) => record.cost > record.price ? 'redBg-row':''"
|
|
|
bordered>
|
|
|
<!-- 产品编码 -->
|
|
@@ -93,26 +103,29 @@
|
|
|
</template>
|
|
|
<!-- 售价 -->
|
|
|
<template slot="price" slot-scope="text, record">
|
|
|
- <editable-cell
|
|
|
- size="small"
|
|
|
- :text="text"
|
|
|
+ <a-input-number
|
|
|
id="salesEdit-price"
|
|
|
- :max="999999"
|
|
|
- :min="0"
|
|
|
+ size="small"
|
|
|
+ v-model="record.price"
|
|
|
:precision="2"
|
|
|
- punit="¥"
|
|
|
- @change="onCellChange(record.id, 'price', $event)" />
|
|
|
+ :min="0"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="请输入"
|
|
|
+ @blur="e => priceBlur(e.target.value, record)"
|
|
|
+ style="width: 100%;" />
|
|
|
</template>
|
|
|
<!-- 销售数量 -->
|
|
|
<template slot="salesNums" slot-scope="text, record">
|
|
|
- <editable-cell
|
|
|
- size="small"
|
|
|
- :text="record.qty"
|
|
|
+ <a-input-number
|
|
|
id="salesEdit-salesNums"
|
|
|
- :max="999999"
|
|
|
- :min="1"
|
|
|
+ size="small"
|
|
|
+ v-model="record.qty"
|
|
|
:precision="0"
|
|
|
- @change="onCellChange(record.id, 'qty', $event)" />
|
|
|
+ :min="1"
|
|
|
+ :max="999999"
|
|
|
+ placeholder="请输入"
|
|
|
+ @blur="e => qtyBlur(e.target.value, record)"
|
|
|
+ style="width: 100%;" />
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
@@ -151,11 +164,10 @@ import { STable, VSelect } from '@/components'
|
|
|
import queryPart from './queryPart.vue'
|
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
|
import { salesDetail, salesWriteSubmit, salesWriteDiscount, salesDetailPrint } from '@/api/sales'
|
|
|
-import EditableCell from '@/views/common/editInput.js'
|
|
|
import { salesDetailList, salesDetailInsert, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll } from '@/api/salesDetail'
|
|
|
export default {
|
|
|
name: 'SalesDetail',
|
|
|
- components: { STable, VSelect, queryPart, chooseCustomModal, EditableCell },
|
|
|
+ components: { STable, VSelect, queryPart, chooseCustomModal },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -174,18 +186,18 @@ export default {
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'productCode' }, width: 220, align: 'center', sorter: true },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
- { title: '仓库', dataIndex: 'warehouseEntity.name', width: 150, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
- { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '售价', dataIndex: 'price', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' },
|
|
|
- { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
|
|
|
- { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
|
|
|
- { title: '折后小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
+ { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'productCode' }, width: 150, align: 'center', sorter: true },
|
|
|
+ { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '仓库', dataIndex: 'warehouseEntity.name', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '售价', dataIndex: 'price', scopedSlots: { customRender: 'price' }, width: 100, align: 'center' },
|
|
|
+ { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 100, align: 'center' },
|
|
|
+ { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '售价小计', dataIndex: 'totalAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '折后小计', dataIndex: 'discountedAmount', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
@@ -196,6 +208,8 @@ export default {
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
+ data.list[i].qtyBackups = data.list[i].qty
|
|
|
+ data.list[i].priceBackups = data.list[i].price
|
|
|
}
|
|
|
this.disabled = false
|
|
|
this.dataSource = data.list
|
|
@@ -206,39 +220,47 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- onCellChange (id, key, value) {
|
|
|
- const dataSource = [...this.dataSource]
|
|
|
- const row = dataSource.find(item => item.id === id)
|
|
|
- if (row) {
|
|
|
- row[key] = Number(value)
|
|
|
- this.dataSource = dataSource
|
|
|
- }
|
|
|
- // 修改价格
|
|
|
- if (key == 'price') {
|
|
|
+ // 已选产品 销售数量 blur
|
|
|
+ qtyBlur (val, record) {
|
|
|
+ this.dataSource = record
|
|
|
+ if (val && val != record.qtyBackups) {
|
|
|
this.spinning = true
|
|
|
- salesDetailUpdatePrice({
|
|
|
- salesBillSn: row.salesBillSn,
|
|
|
- productSn: row.productSn,
|
|
|
- price: row.price
|
|
|
+ salesDetailUpdateQty({
|
|
|
+ id: record.id,
|
|
|
+ qty: record.qty
|
|
|
}).then(res => {
|
|
|
this.resetSearchForm(true)
|
|
|
- this.$message.info(res.message)
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$refs.partQuery.resetCurForm()
|
|
|
+ this.$message.info(res.message)
|
|
|
+ }
|
|
|
this.spinning = false
|
|
|
})
|
|
|
+ } else {
|
|
|
+ record.qty = record.qtyBackups
|
|
|
}
|
|
|
- if (key == 'qty') {
|
|
|
+ },
|
|
|
+ // 已选产品 售价 blur
|
|
|
+ priceBlur (val, record) {
|
|
|
+ this.dataSource = record
|
|
|
+ // 光标移出,值发生改变再调用编辑接口
|
|
|
+ if (val && val != record.priceBackups) {
|
|
|
this.spinning = true
|
|
|
- salesDetailUpdateQty({
|
|
|
- id: row.id,
|
|
|
- qty: row.qty
|
|
|
+ salesDetailUpdatePrice({
|
|
|
+ salesBillSn: record.salesBillSn,
|
|
|
+ productSn: record.productSn,
|
|
|
+ price: record.price
|
|
|
}).then(res => {
|
|
|
this.resetSearchForm(true)
|
|
|
if (res.status == 200) {
|
|
|
- this.$refs.partQuery.resetCurForm()
|
|
|
+ this.$message.info(res.message)
|
|
|
+ this.spinning = false
|
|
|
+ } else {
|
|
|
+ this.spinning = false
|
|
|
}
|
|
|
- this.$message.info(res.message)
|
|
|
- this.spinning = false
|
|
|
})
|
|
|
+ } else {
|
|
|
+ record.price = record.priceBackups
|
|
|
}
|
|
|
},
|
|
|
// 打印预览/快捷打印
|
|
@@ -275,13 +297,6 @@ export default {
|
|
|
window.frames['printf'].print()
|
|
|
}
|
|
|
},
|
|
|
- // 编辑客户信息
|
|
|
- handleEdit () {
|
|
|
- this.openModal = true
|
|
|
- setTimeout(() => {
|
|
|
- this.$refs.custModal.editCust(this.detailData)
|
|
|
- }, 500)
|
|
|
- },
|
|
|
// 更新产品列表
|
|
|
updateData (priceType) {
|
|
|
// 价格类型变更
|
|
@@ -383,7 +398,6 @@ export default {
|
|
|
this.$message.info('该产品已在当前销售单中存在!')
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
// 库存不足时
|
|
|
if (row.currentQty < row.salesNums) {
|
|
|
this.$confirm({
|
|
@@ -478,7 +492,7 @@ export default {
|
|
|
<style lang="less">
|
|
|
.salesEdit-wrap{
|
|
|
.salesEdit-cont{
|
|
|
- margin-top: 15px;
|
|
|
+ margin-top: 10px;
|
|
|
}
|
|
|
.total-bar{
|
|
|
display: flex;
|