|
@@ -6,7 +6,7 @@
|
|
|
<template slot="subTitle">
|
|
|
<a id="purchaseOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
|
|
|
<p class="billno">单号:{{ detail&&detail.purchaseBillNo }}</p>
|
|
|
- <a-button type="primary" ghost @click="isShowBisiceInfo=!isShowBisiceInfo" style="margin-left:30px;vertical-align:middle;">
|
|
|
+ <a-button id="purchaseOrderEdit-editInfo-btn" type="primary" ghost @click="isShowBisiceInfo=!isShowBisiceInfo" style="margin-left:30px;vertical-align:middle;">
|
|
|
基础信息
|
|
|
<a-icon :type="isShowBisiceInfo ? 'up' : 'down'"/>
|
|
|
</a-button>
|
|
@@ -40,9 +40,9 @@
|
|
|
{{ detail&&detail.shippingAddressCityName || '' }}
|
|
|
{{ detail&&detail.shippingAddressCountyName || '' }}
|
|
|
{{ detail&&detail.shippingAddress || '' }}
|
|
|
- <a-button type="link" @click="openAddrModal=true">更换地址 >></a-button>
|
|
|
+ <a-button type="link" id="purchaseOrderEdit-upAddr-btn" @click="openAddrModal=true">更换地址 >></a-button>
|
|
|
</div>
|
|
|
- <div v-else><a-button type="link" @click="openAddrModal=true">选择地址 >></a-button></div>
|
|
|
+ <div v-else><a-button type="link" id="purchaseOrderEdit-chooseAddr-btn" @click="openAddrModal=true">选择地址 >></a-button></div>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-collapse-panel>
|
|
@@ -94,7 +94,7 @@
|
|
|
<a-col flex="auto" style="margin-bottom: 10px;">
|
|
|
<a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseOrderEdit-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="purchaseOrderEdit-reset">重置</a-button>
|
|
|
- <a @click="advanced=!advanced" style="margin:0 30px 0 10px">
|
|
|
+ <a @click="advanced=!advanced" style="margin:0 30px 0 10px" id="purchaseOrderEdit-advanced-btn">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
</a>
|
|
@@ -121,6 +121,7 @@
|
|
|
width="30"
|
|
|
height="30"
|
|
|
style="cursor: pointer;"
|
|
|
+ :id="'purchaseOrderEdit-viewImg-'+record.id"
|
|
|
@click="handlePicDetail(record)" />
|
|
|
</template>
|
|
|
<!-- 包装数 -->
|
|
@@ -141,6 +142,7 @@
|
|
|
<template slot="storageQuantity" slot-scope="text, record">
|
|
|
<a-input-number
|
|
|
size="small"
|
|
|
+ :id="'purchaseOrderEdit-qty-'+record.id"
|
|
|
v-model="record.qty"
|
|
|
:precision="0"
|
|
|
:min="0"
|
|
@@ -153,6 +155,7 @@
|
|
|
<a-button
|
|
|
size="small"
|
|
|
type="link"
|
|
|
+ :id="'purchaseOrderEdit-add-'+record.id"
|
|
|
class="button-primary"
|
|
|
:loading="addLoading"
|
|
|
@click="handleAdd(record,0)"
|
|
@@ -184,18 +187,18 @@
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="8" :sm="24">
|
|
|
<a-form-model-item label="产品编码">
|
|
|
- <a-input v-model.trim="productForm.productCode" allowClear placeholder="输入产品编码" />
|
|
|
+ <a-input id="purchaseOrderEdit-cp-productCode" v-model.trim="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.trim="productForm.productName" allowClear placeholder="输入产品名称" />
|
|
|
+ <a-input id="purchaseOrderEdit-cp-productName" v-model.trim="productForm.productName" allowClear placeholder="输入产品名称" />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="8" :sm="24">
|
|
|
<a-form-model-item style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="$refs.purchaseTable.refresh(true)" :disabled="purchaseDisabled" id="purchaseOrderEdit-refresh">查询</a-button>
|
|
|
- <a-button style="margin-left: 5px" @click="resetPurchaseForm" id="purchaseOrderEdit-reset">重置</a-button>
|
|
|
+ <a-button type="primary" @click="$refs.purchaseTable.refresh(true)" :disabled="purchaseDisabled" id="purchaseOrderEdit-cp-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetPurchaseForm" id="purchaseOrderEdit-cp-reset">重置</a-button>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -203,8 +206,8 @@
|
|
|
</a-col>
|
|
|
<a-col :span="6">
|
|
|
<div style="float:right;overflow: hidden;">
|
|
|
- <a-button v-if="!isDealerUp" type="primary" class="button-primary" id="purchaseOrderEdit-import-btn" @click="handleOutStock">导入缺货</a-button>
|
|
|
- <a-button id="purchaseOrderEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
|
|
|
+ <a-button v-if="!isDealerUp" type="primary" class="button-primary" id="purchaseOrderEdit-cp-importQh-btn" @click="handleOutStock">导入缺货</a-button>
|
|
|
+ <a-button id="purchaseOrderEdit-cp-importCp-btn" @click="openGuideModal=true">导入产品</a-button>
|
|
|
</div>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -224,7 +227,7 @@
|
|
|
<template slot="storageQuantity" slot-scope="text, record">
|
|
|
<a-input-number
|
|
|
size="small"
|
|
|
- id="purchaseOrderEdit-qty"
|
|
|
+ :id="'purchaseOrderEdit-cp-qty-'+record.id"
|
|
|
v-model="record.qty"
|
|
|
:precision="0"
|
|
|
:min="1"
|
|
@@ -241,7 +244,7 @@
|
|
|
class="button-error"
|
|
|
:loading="delLoading"
|
|
|
@click="handleDel(record)"
|
|
|
- id="purchaseOrderEdit-del-btn">删除</a-button>
|
|
|
+ :id="'purchaseOrderEdit-cp-del-btn-'+record.id">删除</a-button>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</div>
|
|
@@ -280,6 +283,10 @@
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
+import defImg from '@/assets/def_img@2x.png'
|
|
|
+import Print from '@/views/common/print.vue'
|
|
|
+import { hdPrint } from '@/libs/JGPrint'
|
|
|
+// 组件
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import ImportGuideModal from './importGuideModal.vue'
|
|
|
import outStockModal from './outStockModal.vue'
|
|
@@ -287,29 +294,28 @@ import outStockListModal from './outStockListModal.vue'
|
|
|
import chooseAddressModal from '@/views/common/receivingAddress/chooseAddressModal.vue'
|
|
|
import ProductType from '../../common/productType.js'
|
|
|
import ProductBrand from '../../common/productBrand.js'
|
|
|
+// 接口
|
|
|
import { purchaseDetailBySn, purchaseWriteSubmit, purchaseDetailPrint, purchaseDetailExport, purchaseDetailAddress } from '@/api/purchase'
|
|
|
import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel } from '@/api/purchaseDetail'
|
|
|
import { productListPurchase } from '@/api/product'
|
|
|
-import defImg from '@/assets/def_img@2x.png'
|
|
|
-import Print from '@/views/common/print.vue'
|
|
|
-import { hdPrint } from '@/libs/JGPrint'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'PurchaseEdit',
|
|
|
components: { STable, VSelect, ProductType, ProductBrand, ImportGuideModal, outStockModal, Print, chooseAddressModal, outStockListModal },
|
|
|
mixins: [commonMixin],
|
|
|
data () {
|
|
|
return {
|
|
|
- isShowBisiceInfo: false,
|
|
|
- showPage: false,
|
|
|
+ isShowBisiceInfo: false, // 详细信息显示
|
|
|
+ showPage: false, // 是否显示页面
|
|
|
spinning: false,
|
|
|
detail: null, // 详细信息
|
|
|
- subLoading: false,
|
|
|
- defImg,
|
|
|
+ subLoading: false, // 按钮loading
|
|
|
+ defImg, // 默认图片
|
|
|
// 选择产品
|
|
|
- addLoading: false,
|
|
|
- productType: [],
|
|
|
+ addLoading: false, // 按钮loading
|
|
|
+ productType: [], //
|
|
|
queryParam: {
|
|
|
- productBrandSn: undefined,
|
|
|
+ productBrandSn: undefined, // 品牌
|
|
|
code: '', // 产品编码
|
|
|
name: '', // 产品名称
|
|
|
origCode: '', // 原厂编码
|
|
@@ -337,8 +343,8 @@ export default {
|
|
|
// -------已选产品-------------
|
|
|
delLoading: false,
|
|
|
productForm: {
|
|
|
- productName: '',
|
|
|
- productCode: '',
|
|
|
+ productName: '', // 产品名称
|
|
|
+ productCode: '', // 产品编码
|
|
|
orderBy: 'purchase_bill_detail.CREATE_DATE desc'
|
|
|
},
|
|
|
purchaseDisabled: false, // 查询、重置按钮是否可操作
|
|
@@ -359,19 +365,20 @@ export default {
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- localDataSource: [],
|
|
|
- chooseData: [],
|
|
|
+ localDataSource: [], // 原始列表数据
|
|
|
+ chooseData: [], // 已选列表数据
|
|
|
openGuideModal: false, // 导入产品引导
|
|
|
- openOutStockModal: false,
|
|
|
- paramsData: null,
|
|
|
+ openOutStockModal: false, // 上次缺货弹框
|
|
|
openAddrModal: false, // 选择地址弹框是否显示
|
|
|
- openOutStockListModal: false
|
|
|
+ openOutStockListModal: false // 导入缺货弹框
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ // 是否上级
|
|
|
isDealerUp () {
|
|
|
return this.detail && (this.detail.purchaseTargetType == 'DEALER_UP' || this.detail.purchaseTargetType == 'DEALER_SUPPLIER')
|
|
|
},
|
|
|
+ // 列定义
|
|
|
columns () {
|
|
|
const _this = this
|
|
|
const arr = [
|
|
@@ -387,19 +394,22 @@ export default {
|
|
|
{ title: '产品图片', scopedSlots: { customRender: 'imageUrl' }, width: '6%', align: 'center' },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
]
|
|
|
- // 产品来源
|
|
|
+ // 产品来源,如果是上级经销商
|
|
|
if (this.isDealerUp) {
|
|
|
arr.splice(1, 0, { title: '产品编码', scopedSlots: { customRender: 'code' }, width: '15%', align: 'center', sorter: true })
|
|
|
arr.splice(6, 0, { title: '产品来源', dataIndex: 'sysFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
|
|
|
} else {
|
|
|
+ // 不是上级
|
|
|
arr.splice(1, 0, { title: '产品编码', dataIndex: 'code', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true })
|
|
|
}
|
|
|
+ // 成本价权限
|
|
|
if (this.$hasPermissions('M_ShowAllCost')) {
|
|
|
arr.splice(this.isDealerUp ? 7 : 6, 0, { title: '成本价', dataIndex: 'purchasePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
|
|
|
}
|
|
|
|
|
|
return arr
|
|
|
},
|
|
|
+ // 已添加列表列
|
|
|
chooseColumns () {
|
|
|
const _this = this
|
|
|
const arr = [
|
|
@@ -409,9 +419,9 @@ export default {
|
|
|
{ title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, width: '8%', align: 'center' },
|
|
|
{ title: '单位', dataIndex: 'dealerProductEntity.unit', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- // { title: '采购金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
]
|
|
|
+ // 成本价权限
|
|
|
if (this.$hasPermissions('M_ShowAllCost')) {
|
|
|
arr.splice(4, 0, { title: '采购单价', dataIndex: 'discountedPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
|
|
|
arr.splice(7, 0, { title: '采购金额', dataIndex: 'discountedAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
|
|
@@ -465,11 +475,6 @@ export default {
|
|
|
this.handleAdd(record, 1)
|
|
|
}
|
|
|
},
|
|
|
- filterOption (input, option) {
|
|
|
- return (
|
|
|
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
- )
|
|
|
- },
|
|
|
// 产品分类 change
|
|
|
changeProductType (val, opt) {
|
|
|
this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
@@ -490,6 +495,7 @@ export default {
|
|
|
this.productType = []
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
+ // 已选产品列表重置
|
|
|
resetPurchaseForm () {
|
|
|
this.productForm.productName = ''
|
|
|
this.productForm.productCode = ''
|
|
@@ -502,9 +508,11 @@ export default {
|
|
|
this.$message.warning('请输入数量后再添加!')
|
|
|
return
|
|
|
}
|
|
|
- // 添加
|
|
|
+ // 添加操作
|
|
|
if (type == 0) {
|
|
|
+ // 如果是上级
|
|
|
if (this.isDealerUp) {
|
|
|
+ // 如果有价格
|
|
|
if (row.purchasePrice) {
|
|
|
params.productSn = row.productSn
|
|
|
params.purchaseBillSn = this.detail.purchaseBillSn
|
|
@@ -517,6 +525,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
+ // 不是上级,且有成本价、终端会员价、车主零售价
|
|
|
if (row.purchasePrice && row.terminalPrice && row.carOwnersPrice) {
|
|
|
params.productSn = row.productSn
|
|
|
params.purchaseBillSn = this.detail.purchaseBillSn
|
|
@@ -529,7 +538,8 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- } else { // 编辑
|
|
|
+ } else {
|
|
|
+ // 编辑操作
|
|
|
// 清空成本价或数量时,值应保持未清空前的值,因成本价和数量都不可为空
|
|
|
if (!row.qty) {
|
|
|
row.qty = row.qtyBackups
|
|
@@ -539,6 +549,7 @@ export default {
|
|
|
}
|
|
|
this.addLoading = true
|
|
|
this.spinning = true
|
|
|
+ // 保存数据
|
|
|
purchaseDetailSave(params).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.resetPurchaseDetail()
|
|
@@ -550,7 +561,7 @@ export default {
|
|
|
this.addLoading = false
|
|
|
})
|
|
|
},
|
|
|
- // 提交
|
|
|
+ // 提交单据
|
|
|
handleSubmit () {
|
|
|
const _this = this
|
|
|
this.subLoading = true
|
|
@@ -581,6 +592,7 @@ export default {
|
|
|
_this.$refs.outStockList.resetSearchForm()
|
|
|
})
|
|
|
},
|
|
|
+ // 导入缺货成功
|
|
|
hanldeOkOutStockList (con) {
|
|
|
const _this = this
|
|
|
_this.openOutStockModal = true
|
|
@@ -637,6 +649,7 @@ export default {
|
|
|
handleBack () {
|
|
|
this.$router.push({ path: '/purchasingManagement/purchaseOrder/list' })
|
|
|
},
|
|
|
+ // 页面初始化
|
|
|
pageInit () {
|
|
|
this.$nextTick(() => {
|
|
|
this.getOrderDetail()
|
|
@@ -659,9 +672,6 @@ export default {
|
|
|
this.pageInit()
|
|
|
}
|
|
|
},
|
|
|
- deactivated () {
|
|
|
- // this.showPage = false
|
|
|
- },
|
|
|
beforeRouteEnter (to, from, next) {
|
|
|
next(vm => {})
|
|
|
}
|