|
@@ -14,61 +14,54 @@
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<a-card size="small" :bordered="false" class="salesEdit-cont">
|
|
|
+ <div slot="title">
|
|
|
+ <div class="p-title">
|
|
|
+ 选择产品
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<!-- 查询配件列表 -->
|
|
|
<queryPart ref="partQuery" :buyerSn="detailData&&detailData.buyerSn" :priceType="$route.params.priceType" :newLoading="isInster" @add="insterProduct"></queryPart>
|
|
|
</a-card>
|
|
|
- <a-card size="small" :bordered="false" class="salesEdit-cont">
|
|
|
+ <a-card :bordered="false" class="salesEdit-cont">
|
|
|
+ <div slot="title">
|
|
|
+ <a-row :gutter="15" type="flex">
|
|
|
+ <a-col :span="2">
|
|
|
+ <div class="p-title">
|
|
|
+ 已选产品
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="16">
|
|
|
+ <div class="p-notes">
|
|
|
+ <a-icon style="color: #FF9900;" type="bell" /> 已选产品可参加<span>【买10副刹车片送2个滤清器】、【买电瓶送滤清器】</span>的促销活动,促销产品为指定产品
|
|
|
+ </div>
|
|
|
+ </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>
|
|
|
<!-- 总计 -->
|
|
|
- <a-alert style="margin-bottom: 15px;" type="info">
|
|
|
+ <a-alert type="info">
|
|
|
<div slot="message" class="total-bar">
|
|
|
<div>
|
|
|
总售价:<strong>¥{{ detailData&&detailData.totalAmount || 0 }}</strong>;
|
|
|
总款数:<strong>{{ detailData&&detailData.totalCategory || 0 }}</strong>;
|
|
|
总数量:<strong>{{ detailData&&detailData.totalQty || 0 }}</strong>;
|
|
|
- 赠品总数量:<strong>{{ detailData&&detailData.giftQty || 0 }}</strong>;
|
|
|
</div>
|
|
|
<div>
|
|
|
- <div>
|
|
|
- 折扣金额:
|
|
|
- <a-input-number id="discount" v-model="detailData.discountAmount" :min="0" :precision="2" :max="999999"/>
|
|
|
- <a-button type="primary" @click="salesDiscount" class="button-info">打折</a-button>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- 折扣:<strong>{{ detailData&&detailData.discountRate || 0 }}%</strong>;
|
|
|
- 折后总售价:<strong>¥{{ detailData&&detailData.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" 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>
|
|
|
+
|
|
|
<!-- 已选配件列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
@@ -77,34 +70,21 @@
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
- :scroll="{ x: 1560, y: 300 }"
|
|
|
- :rowClassName="(record, index) => record.cost > record.price ? 'redBg-row':''"
|
|
|
+ :scroll="{ y: 300 }"
|
|
|
bordered>
|
|
|
- <!-- 产品编码 -->
|
|
|
- <template slot="productCode" slot-scope="text, record">
|
|
|
- <a-badge count="急" v-if="record.oosFlag == 1">
|
|
|
+ <!-- 产品名称 -->
|
|
|
+ <template slot="productName" slot-scope="text, record">
|
|
|
+ <a-badge count="活动" v-if="record.oosFlag == 1">
|
|
|
<div style="padding-right: 15px;">{{ text }}</div>
|
|
|
</a-badge>
|
|
|
<span v-else>{{ text }}</span>
|
|
|
</template>
|
|
|
- <!-- 售价 -->
|
|
|
- <template slot="price" slot-scope="text, record">
|
|
|
- <editable-cell
|
|
|
- size="small"
|
|
|
- :text="text"
|
|
|
- id="salesEdit-price"
|
|
|
- :max="999999"
|
|
|
- :min="0"
|
|
|
- :precision="2"
|
|
|
- punit="¥"
|
|
|
- @change="onCellChange(record.id, 'price', $event)" />
|
|
|
- </template>
|
|
|
+
|
|
|
<!-- 销售数量 -->
|
|
|
<template slot="salesNums" slot-scope="text, record">
|
|
|
<editable-cell
|
|
|
size="small"
|
|
|
:text="record.qty"
|
|
|
- id="salesEdit-salesNums"
|
|
|
:max="999999"
|
|
|
:min="1"
|
|
|
:precision="0"
|
|
@@ -118,7 +98,14 @@
|
|
|
:loading="delLoading"
|
|
|
class="button-error"
|
|
|
@click="handleDel(record)"
|
|
|
- id="productInfoList-Del">删除</a-button>
|
|
|
+ >删除</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ :loading="delLoading"
|
|
|
+ class="button-warning"
|
|
|
+ @click="handleSelCx(record)"
|
|
|
+ >选择促销品</a-button>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-card>
|
|
@@ -135,7 +122,7 @@
|
|
|
</div>
|
|
|
</a-affix>
|
|
|
<!-- 选择客户弹框 -->
|
|
|
- <choose-custom-modal ref="custModal" :show="openModal" @updateData="updateData" @cancel="openModal=false" />
|
|
|
+ <choose-custom-modal ref="custModal" :show="openModal" @cancel="openModal=false" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -143,15 +130,14 @@
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import queryPart from './queryPart.vue'
|
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
|
-import { salesDetail, salesWriteSubmit, salesWriteDiscount } from '@/api/sales'
|
|
|
+import { salesDetailBySn, salesWriteSubmit } from '@/api/sales'
|
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
|
-import { salesDetailList, salesDetailInsert, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll } from '@/api/salesDetail'
|
|
|
+import { salesDetailList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll } from '@/api/salesDetail'
|
|
|
export default {
|
|
|
name: 'SalesDetail',
|
|
|
components: { STable, VSelect, queryPart, chooseCustomModal, EditableCell },
|
|
|
data () {
|
|
|
return {
|
|
|
- orderId: null, // 销售单id
|
|
|
salesBillSn: null, // 销售单sn
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
isInster: false, // 是否正在添加产品
|
|
@@ -160,24 +146,18 @@ export default {
|
|
|
detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
|
|
|
dataSource: [],
|
|
|
productForm: {
|
|
|
- productName: '',
|
|
|
- productCode: ''
|
|
|
+ salesBillSn: ''
|
|
|
},
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'productCode' }, width: 140, align: 'center', sorter: true },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, 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: 150, align: 'center' },
|
|
|
+ { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: 140, align: 'center', sorter: true },
|
|
|
+ { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '售价', dataIndex: '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: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
- { title: '折后小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
@@ -205,21 +185,11 @@ export default {
|
|
|
row[key] = Number(value)
|
|
|
this.dataSource = dataSource
|
|
|
}
|
|
|
- // 修改价格
|
|
|
- if (key == 'price') {
|
|
|
- salesDetailUpdatePrice({
|
|
|
- salesBillSn: row.salesBillSn,
|
|
|
- productSn: row.productSn,
|
|
|
- price: row.price
|
|
|
- }).then(res => {
|
|
|
- this.resetSearchForm(true)
|
|
|
- this.$message.info(res.message)
|
|
|
- })
|
|
|
- }
|
|
|
if (key == 'qty') {
|
|
|
salesDetailUpdateQty({
|
|
|
- id: row.id,
|
|
|
- qty: row.qty
|
|
|
+ salesBillDetailSn: row.salesBillDetailSn,
|
|
|
+ qty: row.qty,
|
|
|
+ salesBillSn: this.salesBillSn
|
|
|
}).then(res => {
|
|
|
this.resetSearchForm(true)
|
|
|
if (res.status == 200) {
|
|
@@ -236,15 +206,6 @@ export default {
|
|
|
this.$refs.custModal.editCust(this.detailData)
|
|
|
}, 500)
|
|
|
},
|
|
|
- // 更新产品列表
|
|
|
- updateData (priceType) {
|
|
|
- // 价格类型变更
|
|
|
- if (priceType != this.$route.params.priceType) {
|
|
|
- this.$router.push({ name: 'salesEdit', params: { id: this.orderId, sn: this.salesBillSn, priceType: priceType } })
|
|
|
- } else {
|
|
|
- this.getOrderDetail()
|
|
|
- }
|
|
|
- },
|
|
|
// 重置
|
|
|
resetSearchForm (flag) {
|
|
|
this.$refs.table.refresh(!!flag)
|
|
@@ -252,32 +213,12 @@ export default {
|
|
|
},
|
|
|
// 重置列表
|
|
|
resetForm () {
|
|
|
- this.productForm = {
|
|
|
- productName: '',
|
|
|
- productCode: ''
|
|
|
- }
|
|
|
this.$refs.table.refresh()
|
|
|
},
|
|
|
// 返回
|
|
|
handleBack () {
|
|
|
this.$router.push({ name: 'salesQueryList' })
|
|
|
},
|
|
|
- // 打折
|
|
|
- salesDiscount () {
|
|
|
- if (this.detailData.discountAmount < 0) {
|
|
|
- return
|
|
|
- }
|
|
|
- console.log(this.detailData)
|
|
|
- salesWriteDiscount({
|
|
|
- discountAmount: this.detailData.discountAmount,
|
|
|
- salesBillSn: this.detailData.salesBillSn,
|
|
|
- id: this.detailData.id
|
|
|
- }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.resetSearchForm()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 整单删除
|
|
|
delSalerDetailAll () {
|
|
|
const _this = this
|
|
@@ -288,11 +229,11 @@ export default {
|
|
|
closable: true,
|
|
|
onOk () {
|
|
|
_this.delLoading = true
|
|
|
- salesDetailDelAll({ salesBillSn: _this.detailData.salesBillSn }).then(res => {
|
|
|
+ salesDetailDelAll({ salesBillSn: _this.salesBillSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.resetSearchForm()
|
|
|
+ _this.$message.success(res.message)
|
|
|
}
|
|
|
- _this.$message.info(res.message)
|
|
|
_this.delLoading = false
|
|
|
})
|
|
|
}
|
|
@@ -308,11 +249,11 @@ export default {
|
|
|
closable: true,
|
|
|
onOk () {
|
|
|
_this.delLoading = true
|
|
|
- salesDetailDel({ id: row.id }).then(res => {
|
|
|
+ salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.resetSearchForm(true)
|
|
|
+ _this.$message.success(res.message)
|
|
|
}
|
|
|
- _this.$message.info(res.message)
|
|
|
_this.delLoading = false
|
|
|
})
|
|
|
}
|
|
@@ -365,8 +306,6 @@ export default {
|
|
|
buyerSn: this.detailData.buyerSn,
|
|
|
productSn: row.productSn,
|
|
|
cost: row.putCost,
|
|
|
- // productCode: row.productCode,
|
|
|
- // productOrigCode: row.productOrigCode,
|
|
|
price: row.salePrice,
|
|
|
qty: row.salesNums,
|
|
|
salesBillSn: this.detailData.salesBillSn,
|
|
@@ -385,7 +324,7 @@ export default {
|
|
|
},
|
|
|
// 销售单详情
|
|
|
getOrderDetail () {
|
|
|
- salesDetail({ id: this.$route.params.id }).then(res => {
|
|
|
+ salesDetailBySn({ salesBillSn: this.$route.params.sn }).then(res => {
|
|
|
console.log('getOrderDetail')
|
|
|
if (res.status == 200) {
|
|
|
this.detailData = res.data
|
|
@@ -395,7 +334,7 @@ export default {
|
|
|
},
|
|
|
// 提交销售单
|
|
|
handleSubmit () {
|
|
|
- salesWriteSubmit({ id: this.orderId }).then(res => {
|
|
|
+ salesWriteSubmit({ salesBillSn: this.salesBillSn }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.handleBack()
|
|
|
this.$message.success(res.message)
|
|
@@ -405,12 +344,11 @@ export default {
|
|
|
},
|
|
|
mounted () {
|
|
|
this.getOrderDetail()
|
|
|
- this.orderId = this.$route.params.id
|
|
|
- this.salesBillSn = this.$route.params.sn
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {
|
|
|
console.log('beforeRouteEnter')
|
|
|
+ vm.salesBillSn = vm.$route.params.sn
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -421,6 +359,17 @@ export default {
|
|
|
.salesEdit-cont{
|
|
|
margin-top: 15px;
|
|
|
}
|
|
|
+ .sTable{
|
|
|
+ margin-top: 15px;
|
|
|
+ }
|
|
|
+ .p-title{
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .p-notes{
|
|
|
+ span{
|
|
|
+ color: #FF9900;
|
|
|
+ }
|
|
|
+ }
|
|
|
.total-bar{
|
|
|
display: flex;
|
|
|
align-items: center;
|