|
@@ -44,7 +44,7 @@
|
|
|
<a-row type="flex" :gutter="5">
|
|
|
<a-col flex="1.5">
|
|
|
<a-form-model-item label="产品分类">
|
|
|
- <ProductType id="productInfoList-productType" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
+ <ProductType id="productInfoList-productType" :disabled="vinInfoData&&vinInfoData.productTypeList&&vinInfoData.productTypeList.length>0" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col flex="1.5">
|
|
@@ -63,8 +63,8 @@
|
|
|
</a-col>
|
|
|
<a-col flex="2" v-if="$hasPermissions('B_salerVinFindProduct')&&sourceType !== 'TRANSFER_ORDER'">
|
|
|
<a-form-model-item label="车架号(VIN)" prop="vinCode" class="vininputs">
|
|
|
- <a-input id="productInfoList-vinCode" v-model.trim="queryParam.vinCode" allowClear placeholder="请输入车架号(VIN)">
|
|
|
- <a-icon slot="addonAfter" @click="showUploadImg=true" :type="vinLoading?'loading':'camera'" :style="{ fontSize: '18px', verticalAlign: 'bottom',cursor:'pointer',padding:'0 10px' }" title="点击拖动图片识别VIN" />
|
|
|
+ <a-input id="productInfoList-vinCode" v-model.trim="queryParam.vinCode" @change="vinCodeChange" allowClear placeholder="请输入车架号(VIN)">
|
|
|
+ <a-icon slot="addonAfter" @click="openUploadVin" :type="vinLoading?'loading':'camera'" :style="{ fontSize: '18px', verticalAlign: 'bottom',cursor:'pointer',padding:'0 10px' }" title="点击拖动图片识别VIN" />
|
|
|
</a-input>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -89,6 +89,7 @@
|
|
|
<!-- 查看更多 -->
|
|
|
<div v-if="hasVaild&&showTable" class="vinInfo-box">
|
|
|
<div>
|
|
|
+ <span style="margin-right: 5px;" v-if="vinInfoData&&!vinInfoData.carInfo">VIN车型:</span>
|
|
|
<div class="vinInfo-error" v-if="vinInfoData&&!vinInfoData.carInfo">
|
|
|
<a-icon type="exclamation-circle" :style="{ color: '#E70012', fontSize: '15px', verticalAlign: 'sub', marginRight: '3px' }" />抱歉!暂未找到匹配VIN码的车型!
|
|
|
</div>
|
|
@@ -99,7 +100,26 @@
|
|
|
<span style="vertical-align: middle;">{{ vinInfoData.carInfo.brandName }} {{ vinInfoData.carInfo.modelName }} {{ vinInfoData.carInfo.displacement }} {{ vinInfoData.carInfo.modelYear+'年' }}</span>
|
|
|
</div>
|
|
|
<div style="color: #f90;cursor: pointer;margin-left: 5px;">
|
|
|
- <span>查看详情</span> >
|
|
|
+ <span>查看详情</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- 产品分类 -->
|
|
|
+ <div class="vinInfo-productType" v-if="vinInfoData&&vinInfoData.productTypeList">
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <span style="margin-right: 5px;">VIN产品分类:</span>
|
|
|
+ <div style="flex-grow: 1;">
|
|
|
+ <a-select
|
|
|
+ size="small"
|
|
|
+ allowClear
|
|
|
+ v-model="vinProductTypeSn"
|
|
|
+ @change="vinChangeProductType"
|
|
|
+ mode="multiple"
|
|
|
+ style="min-width:300px"
|
|
|
+ :maxTagCount="5"
|
|
|
+ placeholder="请选择产品分类筛选">
|
|
|
+ <a-select-option v-for="item in vinInfoData.productTypeList" :key="item.id" :value="item.productTypeSn">{{ item.productTypeName }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -139,7 +159,7 @@
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
@dblclick="handleClickRow"
|
|
|
- :pageSize="30"
|
|
|
+ :pageSize="20"
|
|
|
:scroll="{ y: tableHeight, x: tableWidth }"
|
|
|
bordered>
|
|
|
<div slot="costTitle">
|
|
@@ -312,6 +332,7 @@ export default {
|
|
|
productType: [], // 产品类型
|
|
|
defImg, // 默认图片
|
|
|
showUploadImg: false, // 上传图片弹框
|
|
|
+ pageSize: 20,
|
|
|
queryParam: { // 查询条件
|
|
|
customerSn: '', // 客户sn
|
|
|
salesBillSn: '', // 销售单sn
|
|
@@ -337,6 +358,7 @@ export default {
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
warehouseList: [], // 仓库列表
|
|
|
vinInfoData: null, // vin匹配的车辆信息
|
|
|
+ dataSorce: [], // 表格当前页数据
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
const _this = this
|
|
@@ -367,9 +389,11 @@ export default {
|
|
|
if (res.status == 200) {
|
|
|
_this.vinInfoData = res.data
|
|
|
params.productCodeList = res.data.partCodeList || []
|
|
|
+ _this.onlyList = true
|
|
|
return _this.getList(params)
|
|
|
} else {
|
|
|
_this.vinInfoData = null
|
|
|
+ _this.isVinSearch = false
|
|
|
_this.$refs.table.localLoading = false
|
|
|
_this.$refs.table.clearTable()
|
|
|
}
|
|
@@ -377,6 +401,8 @@ export default {
|
|
|
} else if (_this.queryParam.vinCode && _this.queryParam.vinCode.length < 17 && !this.onlyList) { // 输入vin,但vin码不符合标准,不查vin码信息,不请求列表数据
|
|
|
_this.$refs.table.localLoading = false
|
|
|
_this.$refs.table.clearTable()
|
|
|
+ _this.isVinSearch = false
|
|
|
+ _this.pageSize = 20
|
|
|
} else if (this.onlyList) {
|
|
|
_this.disabled = true
|
|
|
if (_this.queryParam.vinCode && _this.vinInfoData) {
|
|
@@ -395,12 +421,14 @@ export default {
|
|
|
tyuePrice: false, // 特约价
|
|
|
zdPrice: false, // 终端价
|
|
|
openCarInfoModal: false, // 打开车辆信息弹框
|
|
|
- onlyList: false // 是否重置条件查询
|
|
|
+ onlyList: false, // 是否重置条件查询
|
|
|
+ vinProductTypeSn: undefined,
|
|
|
+ isVinSearch: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
hasVaild () {
|
|
|
- return this.queryParam.productCode || this.queryParam.productName || this.queryParam.brandSn || this.queryParam.productTypeSn1 || this.queryParam.warehouseSn || this.queryParam.existStockFlag || this.queryParam.vinCode
|
|
|
+ return !!(this.queryParam.productCode || this.queryParam.productOrigCode || this.queryParam.productName || this.queryParam.brandSn || this.queryParam.productTypeSn1 || this.queryParam.warehouseSn || this.queryParam.existStockFlag || this.queryParam.vinCode)
|
|
|
},
|
|
|
columns () {
|
|
|
const _this = this
|
|
@@ -457,6 +485,10 @@ export default {
|
|
|
methods: {
|
|
|
// 查询
|
|
|
searchForm () {
|
|
|
+ if (this.queryParam.vinCode.length != 0 && this.queryParam.vinCode.length != 17) {
|
|
|
+ this.$message.info('请输入正确的VIN码')
|
|
|
+ return
|
|
|
+ }
|
|
|
if (this.hasVaild) {
|
|
|
this.showTable = true
|
|
|
if (this.$refs.table) {
|
|
@@ -467,48 +499,102 @@ export default {
|
|
|
this.$message.info('请输入查询条件')
|
|
|
}
|
|
|
},
|
|
|
+ openUploadVin () {
|
|
|
+ this.resetSearchForm()
|
|
|
+ this.showUploadImg = true
|
|
|
+ },
|
|
|
getList (params) {
|
|
|
const _this = this
|
|
|
- return querySumByProductLocation(params).then(res => {
|
|
|
- let data
|
|
|
- this.onlyList = false
|
|
|
- if (res.status == 200) {
|
|
|
- data = res.data
|
|
|
- data.list = data.list.filter(item => item != null)
|
|
|
- const no = (data.pageNo - 1) * data.pageSize
|
|
|
- for (var i = 0; i < data.list.length; i++) {
|
|
|
- data.list[i].no = data.list[i].productSn + '_' + (no + i + 1)
|
|
|
- data.list[i].salesNums = 1
|
|
|
- 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) {
|
|
|
- _this.vinInfoData = null
|
|
|
- }
|
|
|
- } else {
|
|
|
- data = {
|
|
|
- list: [],
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 10
|
|
|
+ const vinSearch = params.productCodeList && params.productCodeList.length
|
|
|
+ if (vinSearch) {
|
|
|
+ params.pageSize = 200
|
|
|
+ this.pageSize = 200
|
|
|
+ params.productTypeSn1 = undefined
|
|
|
+ params.productTypeSn2 = undefined
|
|
|
+ params.productTypeSn3 = undefined
|
|
|
+ } else {
|
|
|
+ params.pageSize = 20
|
|
|
+ this.pageSize = 20
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(_this.vinProductTypeSn, '000')
|
|
|
+ // 如果有vin识别的分类
|
|
|
+ if (_this.vinProductTypeSn || this.isVinSearch) {
|
|
|
+ const typeSn = _this.vinProductTypeSn
|
|
|
+ const asyncTask = new Promise((resolve, reject) => {
|
|
|
+ _this.disabled = false
|
|
|
+ const list = typeSn && typeSn.length ? _this.dataSorce.filter(item => item && typeSn.includes(item.productTypeSn2)) : _this.dataSorce
|
|
|
+ resolve(list)
|
|
|
+ })
|
|
|
+ return asyncTask
|
|
|
+ .then(result => {
|
|
|
+ const ret = result.filter((a) => {
|
|
|
+ return (
|
|
|
+ (params.productCode === undefined || a.productCode.includes(params.productCode)) &&
|
|
|
+ (params.productOrigCode === undefined || a.productOrigCode.includes(params.productOrigCode)) &&
|
|
|
+ (params.productName === undefined || a.productName.includes(params.productName)) &&
|
|
|
+ (params.brandSn === undefined || a.brandSn === params.brandSn) &&
|
|
|
+ (params.productTypeSn2 === undefined || a.productTypeSn2 === params.productTypeSn2) &&
|
|
|
+ (params.warehouseSn === undefined || a.warehouseSn === params.warehouseSn) &&
|
|
|
+ (params.existStockFlag === undefined || a.existStockFlag === params.existStockFlag)
|
|
|
+ )
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ list: ret,
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: _this.pageSize
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return querySumByProductLocation(params).then(res => {
|
|
|
+ let data
|
|
|
+ if (res.status == 200) {
|
|
|
+ data = res.data
|
|
|
+ data.list = data.list.filter(item => item != null)
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = data.list[i].productSn + '_' + (no + i + 1)
|
|
|
+ data.list[i].salesNums = 1
|
|
|
+ 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) {
|
|
|
+ _this.vinInfoData = null
|
|
|
+ _this.vinProductTypeSn = undefined
|
|
|
+ _this.isVinSearch = false
|
|
|
+ } else {
|
|
|
+ _this.isVinSearch = true
|
|
|
+ }
|
|
|
+ _this.dataSorce = data.list
|
|
|
+ } else {
|
|
|
+ data = {
|
|
|
+ list: [],
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: _this.pageSize
|
|
|
+ }
|
|
|
+ _this.dataSorce = []
|
|
|
}
|
|
|
- }
|
|
|
- _this.disabled = false
|
|
|
- console.log(data)
|
|
|
- return data
|
|
|
- })
|
|
|
+ _this.disabled = false
|
|
|
+ return data
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// vin change
|
|
|
vinCodeChange (e) {
|
|
|
if (e.target.value.length == 17) {
|
|
|
- supperCodeByVin({ vin: e.target.value }).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.queryParam.productCodeList = res.data
|
|
|
- } else {
|
|
|
- this.queryParam.productCodeList = undefined
|
|
|
- }
|
|
|
- })
|
|
|
+ this.resetSearchForm()
|
|
|
+ this.queryParam.vinCode = e.target.value
|
|
|
+ setTimeout(() => {
|
|
|
+ this.searchForm()
|
|
|
+ }, 200)
|
|
|
} else {
|
|
|
+ // this.$message.info('请输入正确的VIN码')
|
|
|
+ if (this.hasVaild) {
|
|
|
+ setTimeout(() => {
|
|
|
+ this.searchForm()
|
|
|
+ }, 200)
|
|
|
+ }
|
|
|
this.queryParam.productCodeList = undefined
|
|
|
}
|
|
|
},
|
|
@@ -518,6 +604,7 @@ export default {
|
|
|
},
|
|
|
// 重置
|
|
|
resetSearchForm (flag) {
|
|
|
+ this.vinProductTypeSn = undefined
|
|
|
this.queryParam.productCode = ''
|
|
|
this.queryParam.productName = ''
|
|
|
this.queryParam.productOrigCode = ''
|
|
@@ -533,9 +620,10 @@ export default {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
this.vinInfoData = null
|
|
|
this.showTable = false
|
|
|
-
|
|
|
+ this.onlyList = false
|
|
|
+ this.isVinSearch = false
|
|
|
if (!flag) {
|
|
|
- this.$refs.table.refresh(true)
|
|
|
+ this.$refs.table && this.$refs.table.refresh(true)
|
|
|
}
|
|
|
},
|
|
|
pageInit (buyerSn, priceType, salesBillSn) {
|
|
@@ -551,7 +639,9 @@ export default {
|
|
|
clearTable () {
|
|
|
this.vinInfoData = null
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
- this.$refs.table.clearTable()
|
|
|
+ if (this.$refs.table) {
|
|
|
+ this.$refs.table.clearTable()
|
|
|
+ }
|
|
|
},
|
|
|
filterOption (input, option) {
|
|
|
return (
|
|
@@ -633,6 +723,11 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // vin 识别的产品分类
|
|
|
+ vinChangeProductType (val) {
|
|
|
+ this.vinProductTypeSn = val
|
|
|
+ this.searchForm()
|
|
|
+ },
|
|
|
// 产品分类 change
|
|
|
changeProductType (val, opt) {
|
|
|
this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
@@ -704,6 +799,18 @@ export default {
|
|
|
.vinInfo-error{
|
|
|
color: red;
|
|
|
}
|
|
|
+ > div{
|
|
|
+ &:first-child{
|
|
|
+ flex-grow: 1;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .vinInfo-productType{
|
|
|
+ padding-left: 10px;
|
|
|
+ margin-left: 10px;
|
|
|
+ border-left: 1px solid #eee;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.vininputs{
|