|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="productInfoList-wrap">
|
|
|
+ <div class="partQuery-wrap">
|
|
|
<!-- 搜索条件 -->
|
|
|
<div class="table-page-search-wrapper">
|
|
|
<a-form-model
|
|
@@ -12,35 +12,35 @@
|
|
|
<a-row type="flex" :gutter="5">
|
|
|
<a-col :lg="4" :md="6" :sm="12">
|
|
|
<a-form-model-item label="产品编码">
|
|
|
- <a-input id="productInfoList-code" ref="searchProductCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
|
|
|
+ <a-input id="partQuery-code" ref="searchProductCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :lg="4" :md="6" :sm="12">
|
|
|
<a-form-model-item label="产品名称">
|
|
|
- <a-input id="productInfoList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
|
|
|
+ <a-input id="partQuery-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :lg="4" :md="6" :sm="12">
|
|
|
<a-form-model-item label="原厂编码">
|
|
|
- <a-input id="productInfoList-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
|
|
|
+ <a-input id="partQuery-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :lg="4" :md="6" :sm="12">
|
|
|
<a-form-model-item label="产品分类">
|
|
|
- <ProductType id="productInfoList-productType" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
+ <ProductType id="partQuery-productType" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<template v-if="advanced">
|
|
|
<a-col :lg="4" :md="6" :sm="12">
|
|
|
<a-form-model-item label="产品品牌">
|
|
|
- <ProductBrand id="productInfoList-productBrandSn" v-model="queryParam.brandSn"></ProductBrand>
|
|
|
+ <ProductBrand id="partQuery-productBrandSn" v-model="queryParam.brandSn"></ProductBrand>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :lg="4" :md="6" :sm="12">
|
|
|
<a-form-model-item label="仓库">
|
|
|
<a-select
|
|
|
placeholder="请选择仓库"
|
|
|
- id="productInfoList-warehouseSn"
|
|
|
+ id="partQuery-warehouseSn"
|
|
|
allowClear
|
|
|
v-model="queryParam.warehouseSn"
|
|
|
:showSearch="true"
|
|
@@ -52,15 +52,15 @@
|
|
|
</a-col>
|
|
|
<a-col :lg="6" :md="8" :sm="12" v-if="$hasPermissions('B_salerVinFindProduct')">
|
|
|
<a-form-model-item label="车架号(VIN)" prop="vinCode">
|
|
|
- <a-input id="productInfoList-vinCode" v-model.trim="queryParam.vinCode" allowClear placeholder="请输入车架号(VIN)">
|
|
|
+ <a-input id="partQuery-vinCode" v-model.trim="queryParam.vinCode" allowClear placeholder="请输入车架号(VIN)">
|
|
|
<a-icon @click="uploadFun" :type="vinLoading?'loading':'camera'" slot="addonAfter" :style="{ fontSize: '18px', verticalAlign: 'bottom' }" />
|
|
|
</a-input>
|
|
|
- <input type="file" id="filed" accept="image/jpeg,image/png" hidden="" @change="filePreview">
|
|
|
+ <input type="file" id="partQuery-filed" accept="image/jpeg,image/png" hidden="" @change="filePreview">
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="是否有库存">
|
|
|
- <a-select @change="handleHasQty" allowClear :value="queryParam.existStockFlag" placeholder="请选择查看是否有库存">
|
|
|
+ <a-select @change="handleHasQty" id="partQuery-existStockFlag" allowClear :value="queryParam.existStockFlag" placeholder="请选择查看是否有库存">
|
|
|
<a-select-option value="1">
|
|
|
是
|
|
|
</a-select-option>
|
|
@@ -72,9 +72,9 @@
|
|
|
</a-col>
|
|
|
</template>
|
|
|
<a-col flex="200px" style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
|
|
|
- <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
|
|
|
- <a @click="advanced=!advanced" style="margin:0 0 0 10px">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="partQuery-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" id="partQuery-reset">重置</a-button>
|
|
|
+ <a @click="advanced=!advanced" style="margin:0 0 0 10px" id="partQuery-advanced">
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
</a>
|
|
@@ -91,9 +91,9 @@
|
|
|
<a-alert type="error" style="margin-bottom: 10px;" v-if="vinInfoData&&!vinInfoData.vinInfo">
|
|
|
<template slot="message"><a-icon type="exclamation-circle" :style="{ color: '#E70012', fontSize: '15px', verticalAlign: 'sub', marginRight: '3px' }" />抱歉!暂未找到匹配VIN码的车型!</template>
|
|
|
</a-alert>
|
|
|
- <a-alert type="warning" style="margin-bottom: 10px;cursor: pointer;" v-if="vinInfoData&&vinInfoData.vinInfo" @click="openCarInfoModal=true">
|
|
|
+ <a-alert type="warning" style="margin-bottom: 10px;cursor: pointer;" id="partQuery-alert" v-if="vinInfoData&&vinInfoData.vinInfo" @click="openCarInfoModal=true">
|
|
|
<template slot="message">
|
|
|
- <div style="display: flex;justify-content: space-between;align-items: center;" @click="openCarInfoModal=true">
|
|
|
+ <div id="partQuery-openCarInfoModal" style="display: flex;justify-content: space-between;align-items: center;" @click="openCarInfoModal=true">
|
|
|
<div>
|
|
|
<img :src="vinInfoData.vinInfo && vinInfoData.vinInfo.icon?(vinInfoData.vinInfo.icon+'?x-oss-process=image/resize,h_30,m_lfit'):defImg" width="30" height="30" class="imageUrl" style="border-radius: 50%;vertical-align: middle;margin-right: 3px;" />
|
|
|
<span style="vertical-align: middle;">{{ vinInfoData.vinInfo.text }}</span>
|
|
@@ -132,6 +132,7 @@
|
|
|
<a-input-number
|
|
|
size="small"
|
|
|
v-model="record.price"
|
|
|
+ :id="'partQuery-price-'+record.productSn"
|
|
|
:precision="2"
|
|
|
:min="0"
|
|
|
:max="999999"
|
|
@@ -146,6 +147,7 @@
|
|
|
<div @dblclick.stop>
|
|
|
<a-input-number
|
|
|
size="small"
|
|
|
+ :id="'partQuery-salesNums-'+record.productSn"
|
|
|
v-model="record.salesNums"
|
|
|
:precision="0"
|
|
|
:min="0"
|
|
@@ -161,13 +163,13 @@
|
|
|
type="link"
|
|
|
class="button-primary"
|
|
|
@click="handleAdd(record)"
|
|
|
- id="productInfoList-edit-btn">添加</a-button>
|
|
|
+ id="partQuery-edit-btn">添加</a-button>
|
|
|
<a-button
|
|
|
size="small"
|
|
|
type="link"
|
|
|
class="button-primary"
|
|
|
@click="handleDetail(record)"
|
|
|
- id="productInfoList-detail-btn"
|
|
|
+ id="partQuery-detail-btn"
|
|
|
style="margin-left: 5px;">销售记录</a-button>
|
|
|
</template>
|
|
|
</s-table>
|
|
@@ -180,15 +182,17 @@
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
-import { querySumByProductLocation } from '@/api/stock'
|
|
|
-import { warehouseAllList } from '@/api/warehouse'
|
|
|
-import productSalesRecordModal from './productSalesRecordModal.vue'
|
|
|
-import carInfoModal from './carInfoModal.vue'
|
|
|
-import ProductType from '../../common/productType.js'
|
|
|
-import ProductBrand from '../../common/productBrand.js'
|
|
|
+import defImg from '@/assets/def_img@2x.png'
|
|
|
+// 组件
|
|
|
import { STable, VSelect, Upload } from '@/components'
|
|
|
+import productSalesRecordModal from './productSalesRecordModal.vue' // 产品销售记录弹框
|
|
|
+import carInfoModal from './carInfoModal.vue' // 车型信息弹框
|
|
|
+import ProductType from '../../common/productType.js' // 产品分类下拉
|
|
|
+import ProductBrand from '../../common/productBrand.js' // 产品品牌下拉
|
|
|
+// 接口
|
|
|
import { supperCodeByVin, vinCodeParse } from '@/api/sales'
|
|
|
-import defImg from '@/assets/def_img@2x.png'
|
|
|
+import { querySumByProductLocation } from '@/api/stock'
|
|
|
+import { warehouseAllList } from '@/api/warehouse'
|
|
|
export default {
|
|
|
name: 'QueryPart',
|
|
|
components: { STable, VSelect, Upload, productSalesRecordModal, carInfoModal, ProductType, ProductBrand },
|
|
@@ -199,54 +203,59 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
advanced: false, // 高级搜索 展开/关闭
|
|
|
- vinLoading: false,
|
|
|
- productType: [],
|
|
|
- defImg,
|
|
|
+ vinLoading: false, // vin 按钮loading
|
|
|
+ productType: [], // 产品分类
|
|
|
+ defImg, // 默认图片
|
|
|
queryParam: { // 查询条件
|
|
|
- customerSn: '',
|
|
|
- salesBillSn: '',
|
|
|
- salePriceType: '',
|
|
|
+ customerSn: '', // 客户sn
|
|
|
+ salesBillSn: '', // 销售单sn
|
|
|
+ salePriceType: '', // 销售价格类型
|
|
|
productCode: '', // 产品编码
|
|
|
productName: '', // 产品名称
|
|
|
productOrigCode: '', // 原厂编码
|
|
|
- vinCode: '',
|
|
|
+ vinCode: '', // vin码
|
|
|
productCodeList: undefined, // 车架号
|
|
|
brandSn: undefined, // 产品品牌
|
|
|
productTypeSn1: '', // 产品一级分类
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
|
productTypeSn3: '', // 产品三级分类
|
|
|
warehouseSn: undefined, // 仓库、
|
|
|
- enableFlag: '1',
|
|
|
- existStockFlag: undefined
|
|
|
+ enableFlag: '1', // 启用禁用
|
|
|
+ existStockFlag: undefined // 是否存在库存
|
|
|
},
|
|
|
- priceType: '',
|
|
|
- buyerSn: '',
|
|
|
- rules: {
|
|
|
+ priceType: '', // 价格类型
|
|
|
+ buyerSn: '', // 客户sn
|
|
|
+ rules: { // 校验
|
|
|
vinCode: [ { len: 17, message: '请输入正确的车架号(VIN)', trigger: 'change' } ]
|
|
|
},
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
warehouseList: [], // 仓库列表
|
|
|
- vinInfoData: null,
|
|
|
+ vinInfoData: null, // 车辆信息
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
const _this = this
|
|
|
+ // 价格类型
|
|
|
_this.queryParam.salePriceType = _this.priceType
|
|
|
+ // 客户sn
|
|
|
_this.queryParam.customerSn = _this.buyerSn
|
|
|
- // 排序
|
|
|
+ // 产品编码排序
|
|
|
if (parameter.sortField == 'productCode') {
|
|
|
parameter.sortField = 'code'
|
|
|
parameter.sortAlias = 'product '
|
|
|
}
|
|
|
+ // 产品品牌名称排序
|
|
|
if (parameter.sortField == 'brandName') {
|
|
|
parameter.sortField = 'firstChar'
|
|
|
parameter.sortAlias = 'brand'
|
|
|
}
|
|
|
+ // 仓库排序
|
|
|
if (parameter.sortField == 'warehouseName') {
|
|
|
parameter.sortField = 'warehouseSn'
|
|
|
parameter.sortAlias = 'sd'
|
|
|
}
|
|
|
const params = Object.assign(parameter, _this.queryParam)
|
|
|
- if (_this.queryParam.vinCode && _this.queryParam.vinCode.length == 17 && !this.onlyList) { // 输入vin,查出vin码信息后请求列表数据
|
|
|
+ // 输入vin,查出vin码信息后请求列表数据
|
|
|
+ if (_this.queryParam.vinCode && _this.queryParam.vinCode.length == 17 && !this.onlyList) {
|
|
|
_this.disabled = true
|
|
|
return supperCodeByVin({ vin: _this.queryParam.vinCode }).then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -259,11 +268,14 @@ export default {
|
|
|
_this.$refs.table.clearTable()
|
|
|
}
|
|
|
})
|
|
|
- } else if (_this.queryParam.vinCode && _this.queryParam.vinCode.length < 17 && !this.onlyList) { // 输入vin,但vin码不符合标准,不查vin码信息,不请求列表数据
|
|
|
+ // 输入vin,但vin码不符合标准,不查vin码信息,不请求列表数据
|
|
|
+ } else if (_this.queryParam.vinCode && _this.queryParam.vinCode.length < 17 && !this.onlyList) {
|
|
|
_this.$refs.table.localLoading = false
|
|
|
_this.$refs.table.clearTable()
|
|
|
+ // 清空查询条件
|
|
|
} else if (this.onlyList) {
|
|
|
_this.disabled = true
|
|
|
+ // ,按车型查询
|
|
|
if (_this.queryParam.vinCode && _this.vinInfoData) {
|
|
|
return _this.getList(Object.assign(params, { productCodeList: _this.vinInfoData.partCodeList }))
|
|
|
} else {
|
|
@@ -279,8 +291,8 @@ export default {
|
|
|
cityPrice: false, // 城市价
|
|
|
tyuePrice: false, // 特约价
|
|
|
zdPrice: false, // 终端价
|
|
|
- openCarInfoModal: false,
|
|
|
- onlyList: false
|
|
|
+ openCarInfoModal: false, // 车型弹框
|
|
|
+ onlyList: false // 是否情况查询条件
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -295,6 +307,7 @@ export default {
|
|
|
{ title: '仓库', dataIndex: 'warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '仓位', dataIndex: 'warehouseLocationName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } }
|
|
|
]
|
|
|
+ // 成本价权限
|
|
|
if (this.cost) {
|
|
|
arr.push({ slots: { title: 'costTitle' }, dataIndex: 'putCost', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
|
|
|
}
|
|
@@ -324,6 +337,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 查询产品列表
|
|
|
getList (params) {
|
|
|
const _this = this
|
|
|
return querySumByProductLocation(params).then(res => {
|
|
@@ -336,8 +350,10 @@ export default {
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
data.list[i].salesNums = 1
|
|
|
- data.list[i].currentQty = data.list[i].currentQty || 0
|
|
|
+ data.list[i].currentQty = data.list[i].currentQty || 0 // 库存数量
|
|
|
+ // 价格
|
|
|
data.list[i].price = data.list[i].origSalePriceFlag == 0 ? data.list[i].lastSalePrice : data.list[i].origSalePriceFlag == 1 ? data.list[i].salePrice : data.list[i].selfSaleprice
|
|
|
+ // 原厂编码
|
|
|
data.list[i].productOrigCode = data.list[i].productOrigCode ? data.list[i].productOrigCode.trim() : ''
|
|
|
}
|
|
|
if (!params.vinCode) {
|
|
@@ -351,11 +367,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
_this.disabled = false
|
|
|
- console.log(data)
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- // vin change
|
|
|
+ // 车型vin码变更时
|
|
|
vinCodeChange (e) {
|
|
|
if (e.target.value.length == 17) {
|
|
|
supperCodeByVin({ vin: e.target.value }).then(res => {
|
|
@@ -373,7 +388,7 @@ export default {
|
|
|
handleClickRow (record) {
|
|
|
this.$emit('add', record)
|
|
|
},
|
|
|
- // 重置
|
|
|
+ // 重置列表
|
|
|
resetSearchForm () {
|
|
|
this.queryParam.productCode = ''
|
|
|
this.queryParam.productName = ''
|
|
@@ -391,6 +406,7 @@ export default {
|
|
|
this.$refs.table.refresh(true)
|
|
|
this.vinInfoData = null
|
|
|
},
|
|
|
+ // 初始页面
|
|
|
pageInit (buyerSn, priceType, salesBillSn) {
|
|
|
this.priceType = priceType || ''
|
|
|
this.buyerSn = buyerSn || ''
|
|
@@ -412,6 +428,7 @@ export default {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
this.$refs.table.clearTable()
|
|
|
},
|
|
|
+ // 仓库按名称筛选
|
|
|
filterOption (input, option) {
|
|
|
return (
|
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
@@ -420,7 +437,8 @@ export default {
|
|
|
// 选择配件
|
|
|
handleAdd (row) {
|
|
|
const _this = this
|
|
|
- console.log(row.price, row.lastSalePrice, row.salePrice, row.lastSalePrice < row.salePrice)
|
|
|
+ // console.log(row.price, row.lastSalePrice, row.salePrice, row.lastSalePrice < row.salePrice)
|
|
|
+ // 售价低于定价
|
|
|
if (row.lastSalePrice && (row.price < row.salePrice)) {
|
|
|
_this.$confirm({
|
|
|
title: '提示',
|
|
@@ -440,13 +458,15 @@ export default {
|
|
|
this.openModal = true
|
|
|
this.$refs.salseRecord.getDetail(this.buyerSn, row.productSn, row)
|
|
|
},
|
|
|
- // 关闭弹框
|
|
|
+ // 关闭销售记录弹框
|
|
|
closeModal () {
|
|
|
this.openModal = false
|
|
|
},
|
|
|
+ // 上传图片
|
|
|
uploadFun () {
|
|
|
- document.getElementById('filed').click()
|
|
|
+ document.getElementById('partQuery-filed').click()
|
|
|
},
|
|
|
+ // 文件上传后
|
|
|
filePreview (e) {
|
|
|
const _this = this
|
|
|
var files = e.target.files[0]
|
|
@@ -454,6 +474,7 @@ export default {
|
|
|
formData.append('savePathType', 'local')
|
|
|
formData.append('file', files)
|
|
|
this.vinLoading = true
|
|
|
+ // 识别图片中的vin
|
|
|
vinCodeParse(formData).then(res => {
|
|
|
if (res.type == 'application/json') {
|
|
|
var reader = new FileReader()
|
|
@@ -478,7 +499,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 仓库
|
|
|
+ // 仓库变更
|
|
|
getWarehouse () {
|
|
|
warehouseAllList({ wasteFlag: 0 }).then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -488,7 +509,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 产品分类 change
|
|
|
+ // 产品分类变更
|
|
|
changeProductType (val, opt) {
|
|
|
this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
@@ -500,6 +521,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
+ // 成本显示变化
|
|
|
cost (newValue, oldValue) {
|
|
|
this.$emit('isCost', newValue)
|
|
|
}
|