|
@@ -6,10 +6,10 @@
|
|
|
<template slot="subTitle">
|
|
|
<a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
|
|
|
<span style="margin: 0 15px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
|
|
|
- <div style="margin: 0 15px;display:inline-block;color: #666;">
|
|
|
+ <!-- <div style="margin: 0 15px;display:inline-block;color: #666;">
|
|
|
<span>出库仓库:</span>
|
|
|
<chooseWarehouse style="width:200px" :allowClear="false" ref="warehouse" v-model="warehouseSn" @change="handleWarehouse"></chooseWarehouse>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<a-card size="small" :bordered="false" class="salesEdit-cont">
|
|
@@ -47,38 +47,45 @@
|
|
|
</div>
|
|
|
</a-alert>
|
|
|
<!-- 筛选条件 -->
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :span="24">
|
|
|
- <div class="table-page-search-wrapper" style="position: relative;width: 100%;">
|
|
|
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="产品编码" prop="productCode">
|
|
|
- <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="产品名称" prop="productName">
|
|
|
- <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
|
|
|
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- </a-form>
|
|
|
- <div style="position: absolute;right: 0;top: 3px;">
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="4" :sm="24">
|
|
|
+ <a-form-item label="出库仓库" prop="warehouseSn">
|
|
|
+ <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="4" :sm="24">
|
|
|
+ <a-form-item label="产品编码" prop="productCode">
|
|
|
+ <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="4" :sm="24">
|
|
|
+ <a-form-item label="产品名称" prop="productName">
|
|
|
+ <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="4" :sm="24">
|
|
|
+ <a-form-item label="品牌">
|
|
|
+ <ProductBrand id="salesEdit-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="4" :sm="24">
|
|
|
+ <a-form-item label="产品分类">
|
|
|
+ <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="salesEdit-productType"></productTypeAll>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="24" :sm="24" style="text-align:right;">
|
|
|
<span>已选{{ selectTotal }}项</span>
|
|
|
- <!-- <a-button
|
|
|
- style="margin:0 15px;"
|
|
|
- size="small"
|
|
|
- type="danger"
|
|
|
- class="button-info"
|
|
|
- id="salesEdit-plDel-btn"
|
|
|
- @click="handleBatchDel">批量删除</a-button> -->
|
|
|
<a-dropdown>
|
|
|
<a-menu slot="overlay" @click="handleMenuClick">
|
|
|
+ <a-menu-item key="0">
|
|
|
+ 仓库设置
|
|
|
+ </a-menu-item>
|
|
|
<a-menu-item key="1">
|
|
|
删除已选项
|
|
|
</a-menu-item>
|
|
@@ -89,17 +96,15 @@
|
|
|
<a-button
|
|
|
style="margin:0 15px;"
|
|
|
type="primary"
|
|
|
- ghost
|
|
|
- id="salesEdit-plDel-btn"> 批量删除 <a-icon type="down" /> </a-button>
|
|
|
+ ghost> 批量操作 <a-icon type="down" /> </a-button>
|
|
|
</a-dropdown>
|
|
|
<a-button
|
|
|
type="default"
|
|
|
- id="salesEdit-import-btn"
|
|
|
@click="openGuideModal=true">导入产品</a-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
<!-- 已选配件列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
@@ -153,6 +158,10 @@
|
|
|
</div>
|
|
|
<span v-else>--</span>
|
|
|
</template>
|
|
|
+ <!-- 出库仓库 -->
|
|
|
+ <template slot="warehouseBox" slot-scope="text, record">
|
|
|
+ <chooseWarehouse style="width:100%;" :allowClear="false" ref="warehouseBox" v-model="record.warehouseSn" @change="handleWarehouseBox(record)"></chooseWarehouse>
|
|
|
+ </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button
|
|
@@ -214,6 +223,10 @@
|
|
|
@close="closeActive"></ChooseActive>
|
|
|
<!-- 导入产品 -->
|
|
|
<importGuideModal :openModal="openGuideModal" :params="{salesBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
|
|
|
+ <!-- 仓库设置 -->
|
|
|
+ <setWarehouse :show="openWarehouseModal" @ok="chooseWarehouseOk" @cancel="openWarehouseModal=false"></setWarehouse>
|
|
|
+ <!-- 价格更新弹窗 -->
|
|
|
+ <setPriceModal :show="priceUpdateModal" :totalRealAmount="updataData.totalRealAmount" :totalAmount="updataData.totalAmount" @ok="updatePrice" @cancel="priceUpdateModal=false"></setPriceModal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -224,13 +237,27 @@ import queryPart from './queryPart.vue'
|
|
|
import queryPromotable from './queryPromotable.vue'
|
|
|
import ChooseActive from './chooseActive.vue'
|
|
|
import ImportGuideModal from './importGuideModal.vue'
|
|
|
+import setWarehouse from './setWarehouse.vue'
|
|
|
+import setPriceModal from './setPriceModal.vue'
|
|
|
import chooseWarehouse from '@/views/common/chooseWarehouse'
|
|
|
-import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll } from '@/api/sales'
|
|
|
+import ProductBrand from '@/views/common/productBrand.js'
|
|
|
+import productTypeAll from '@/views/common/productTypeAll.js'
|
|
|
+import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll, submitCheck, updateBatch, updateWarehouse } from '@/api/sales'
|
|
|
import { salesDetailStockList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, salesDetailDelAll, addPromoGoods, salesBatchInsert } from '@/api/salesDetail'
|
|
|
export default {
|
|
|
name: 'SalesEdit',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { STable, VSelect, queryPart, queryPromotable, ChooseActive, ImportGuideModal, chooseWarehouse },
|
|
|
+ components: { STable,
|
|
|
+ VSelect,
|
|
|
+ queryPart,
|
|
|
+ queryPromotable,
|
|
|
+ ChooseActive,
|
|
|
+ ImportGuideModal,
|
|
|
+ chooseWarehouse,
|
|
|
+ setWarehouse,
|
|
|
+ setPriceModal,
|
|
|
+ ProductBrand,
|
|
|
+ productTypeAll },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -246,6 +273,7 @@ export default {
|
|
|
salesBillSn: '',
|
|
|
promotionFlag: 0
|
|
|
},
|
|
|
+ openWarehouseModal: false, // 打开仓库设置
|
|
|
warehouseSn: undefined,
|
|
|
activeName: '', // 促销活动
|
|
|
nowData: null,
|
|
@@ -271,10 +299,21 @@ export default {
|
|
|
},
|
|
|
openGuideModal: false, // 导入产品引导
|
|
|
queryParam: {
|
|
|
+ warehouseSn: undefined,
|
|
|
productCode: '',
|
|
|
- productName: ''
|
|
|
+ productName: '',
|
|
|
+ productBrandSn: undefined,
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '' // 产品三级分类
|
|
|
},
|
|
|
- rowSelectionInfo: null
|
|
|
+ productType: [],
|
|
|
+ rowSelectionInfo: null,
|
|
|
+ priceUpdateModal: false, // 价格更新弹窗
|
|
|
+ updataData: {
|
|
|
+ totalRealAmount: '',
|
|
|
+ totalAmount: ''
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -284,11 +323,12 @@ export default {
|
|
|
columns () {
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '20%', align: 'center', sorter: true },
|
|
|
- { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '25%', align: 'left' },
|
|
|
+ { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center', sorter: true },
|
|
|
+ { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '20%', align: 'left' },
|
|
|
// { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '8%', align: 'center' },
|
|
|
{ title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '8%', align: 'center' },
|
|
|
+ { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '15%', align: 'center' },
|
|
|
{ title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
// { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
@@ -301,6 +341,49 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 设置单个出库仓库
|
|
|
+ handleWarehouseBox (row) {
|
|
|
+ const snArr = [row.salesBillDetailSn]
|
|
|
+ const ajax_data = {
|
|
|
+ warehouseSn: row.warehouseSn,
|
|
|
+ salesBillDetailSnList: snArr,
|
|
|
+ salesBillSn: this.$route.params.sn
|
|
|
+ }
|
|
|
+ this.setWarehouseInfo(ajax_data)
|
|
|
+ },
|
|
|
+ chooseWarehouseOk (sn) {
|
|
|
+ const _this = this
|
|
|
+ const snArr = []
|
|
|
+ _this.rowSelectionInfo.selectedRows.forEach(item => {
|
|
|
+ snArr.push(item.salesBillDetailSn)
|
|
|
+ })
|
|
|
+ const ajax_data = {
|
|
|
+ warehouseSn: sn,
|
|
|
+ salesBillDetailSnList: snArr,
|
|
|
+ salesBillSn: _this.$route.params.sn
|
|
|
+ }
|
|
|
+ _this.setWarehouseInfo(ajax_data)
|
|
|
+ },
|
|
|
+ setWarehouseInfo (data) {
|
|
|
+ const _this = this
|
|
|
+ _this.spinning = true
|
|
|
+ updateWarehouse(data).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.openWarehouseModal = false
|
|
|
+ _this.resetSearchForm(true)
|
|
|
+ _this.$refs.promotable.resetCurForm()
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ }
|
|
|
+ _this.$refs.table.refresh(true)
|
|
|
+ _this.spinning = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 产品分类 change
|
|
|
+ changeProductType (val, opt) {
|
|
|
+ this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
+ this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
+ this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
+ },
|
|
|
// 选择仓库
|
|
|
handleWarehouse (val) {
|
|
|
this.warehouseSn = val
|
|
@@ -311,7 +394,7 @@ export default {
|
|
|
warehouseSn: val
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
- _this.$refs.partQuery.resetCurForm(val)
|
|
|
+ _this.$refs.partQuery.resetCurForm()
|
|
|
_this.$refs.table.refresh(true)
|
|
|
_this.spinning = false
|
|
|
} else {
|
|
@@ -321,7 +404,14 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleMenuClick (e) {
|
|
|
- if (e.key == 1) { // 删除已选项
|
|
|
+ const _this = this
|
|
|
+ if (e.key == 0) { // 仓库设置
|
|
|
+ if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
+ _this.$message.warning('请先选择要设置的产品!')
|
|
|
+ } else {
|
|
|
+ _this.openWarehouseModal = true
|
|
|
+ }
|
|
|
+ } else if (e.key == 1) { // 删除已选项
|
|
|
this.handleBatchDel()
|
|
|
} else {
|
|
|
this.handleBatchDelAll()
|
|
@@ -410,12 +500,19 @@ export default {
|
|
|
chooseResetSearchForm () {
|
|
|
this.queryParam.productCode = ''
|
|
|
this.queryParam.productName = ''
|
|
|
+ this.queryParam.warehouseSn = undefined
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
// 重置
|
|
|
resetSearchForm (flag) {
|
|
|
this.queryParam.productCode = ''
|
|
|
this.queryParam.productName = ''
|
|
|
+ this.queryParam.warehouseSn = undefined
|
|
|
+ this.queryParam.productBrandSn = undefined
|
|
|
+ this.queryParam.productTypeSn1 = ''
|
|
|
+ this.queryParam.productTypeSn2 = ''
|
|
|
+ this.queryParam.productTypeSn3 = ''
|
|
|
+ this.productType = []
|
|
|
this.$refs.table.refresh(!!flag)
|
|
|
this.getPromoacActiveList()
|
|
|
this.getOrderDetail(false)
|
|
@@ -499,7 +596,8 @@ export default {
|
|
|
purchaseBillNo: this.detailData.purchaseBillNo,
|
|
|
stockSn: row.stockSn,
|
|
|
promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
|
|
|
- promotionFlag: promotionFlag // 促销标记 正品传0,促销品传1
|
|
|
+ promotionFlag: promotionFlag, // 促销标记 正品传0,促销品传1
|
|
|
+ warehouseSn: row.warehouseSn
|
|
|
}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.resetSearchForm()
|
|
@@ -519,15 +617,38 @@ export default {
|
|
|
if (res.status == 200) {
|
|
|
this.detailData = res.data
|
|
|
if (flag) {
|
|
|
- this.$refs.partQuery.pageInit(this.detailData && this.detailData.buyerSn || '', this.warehouseSn)
|
|
|
+ this.$refs.partQuery.pageInit(this.detailData && this.detailData.buyerSn || '')
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 提交销售单
|
|
|
handleSubmit () {
|
|
|
+ // 先不提交,先判断是否有价格更新 (下级创建时判断)
|
|
|
+ if (this.detailData && this.detailData.salesBillSource && this.detailData.salesBillSource == 'PURCHASE') {
|
|
|
+ submitCheck({ salesBillSn: this.salesBillSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ if (res.data.detailList.length > 0) {
|
|
|
+ this.updataData = res.data
|
|
|
+ const _this = this
|
|
|
+ this.$nextTick(() => {
|
|
|
+ _this.priceUpdateModal = true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const ajax_data = { salesBillSn: this.salesBillSn }
|
|
|
+ this.submitResult(ajax_data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const ajax_data = { salesBillSn: this.salesBillSn }
|
|
|
+ this.submitResult(ajax_data)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ submitResult (data) {
|
|
|
this.spinning = true
|
|
|
- salesWriteSubmit({ salesBillSn: this.salesBillSn }).then(res => {
|
|
|
+ salesWriteSubmit(data).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.handleBack()
|
|
|
this.$message.success(res.message)
|
|
@@ -537,6 +658,27 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 选择价格类型 并更新
|
|
|
+ updatePrice (type) {
|
|
|
+ const _this = this
|
|
|
+ if (type == 0) {
|
|
|
+ const ajax_data = {
|
|
|
+ salesBillSn: _this.salesBillSn,
|
|
|
+ productPriceChangeFlag: type
|
|
|
+ }
|
|
|
+ _this.submitResult(ajax_data)
|
|
|
+ } else {
|
|
|
+ updateBatch(_this.updataData.detailList).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ const ajax_data = {
|
|
|
+ salesBillSn: _this.salesBillSn,
|
|
|
+ productPriceChangeFlag: type
|
|
|
+ }
|
|
|
+ _this.submitResult(ajax_data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取促销活动
|
|
|
getPromoacActiveList () {
|
|
|
const _this = this
|
|
@@ -550,6 +692,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
// 选择促销品
|
|
|
handleSelCx (row) {
|
|
|
// this.nowData = row
|
|
@@ -679,9 +822,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .redBg-row{
|
|
|
- background-color: #f5cdc8;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
</style>
|