chooseProductModal.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <a-drawer
  3. :zIndex="zIndex"
  4. :title="title"
  5. placement="right"
  6. :visible="visible"
  7. :width="width"
  8. :get-container="false"
  9. :wrap-style="{ position: 'absolute' }"
  10. @close="onClose"
  11. wrapClassName="chooseProduct-drawer jg-drawer-wrap">
  12. <a-spin :spinning="spinning||newLoading" tip="Loading...">
  13. <!-- 搜索条件 -->
  14. <div ref="searchBox" class="table-page-search-wrapper">
  15. <a-form-model
  16. ref="ruleForm"
  17. class="form-model-con"
  18. layout="inline"
  19. :rules="rules"
  20. :model="queryParam"
  21. @keyup.enter.native="$refs.table.refresh(true)" >
  22. <a-row type="flex" :gutter="5">
  23. <a-col flex="1">
  24. <a-form-model-item label="产品编码">
  25. <a-input id="productInfoList-code" ref="searchProductCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col flex="1">
  29. <a-form-model-item label="产品名称">
  30. <a-input id="productInfoList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
  31. </a-form-model-item>
  32. </a-col>
  33. <a-col flex="1">
  34. <a-form-model-item label="原厂编码">
  35. <a-input id="productInfoList-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
  36. </a-form-model-item>
  37. </a-col>
  38. <a-col flex="1">
  39. <a-form-model-item label="产品品牌">
  40. <ProductBrand id="productInfoList-productBrandSn" v-model="queryParam.brandSn"></ProductBrand>
  41. </a-form-model-item>
  42. </a-col>
  43. </a-row>
  44. <a-row type="flex" :gutter="5">
  45. <a-col flex="1.5">
  46. <a-form-model-item label="产品分类">
  47. <ProductType id="productInfoList-productType" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
  48. </a-form-model-item>
  49. </a-col>
  50. <a-col flex="1.5">
  51. <a-form-model-item label="仓库">
  52. <a-select
  53. placeholder="请选择仓库"
  54. id="productInfoList-warehouseSn"
  55. allowClear
  56. v-model="queryParam.warehouseSn"
  57. :showSearch="true"
  58. option-filter-prop="children"
  59. :filter-option="filterOption">
  60. <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
  61. </a-select>
  62. </a-form-model-item>
  63. </a-col>
  64. <a-col flex="2" v-if="$hasPermissions('B_salerVinFindProduct')">
  65. <a-form-model-item label="车架号(VIN)" prop="vinCode">
  66. <a-input id="productInfoList-vinCode" v-model.trim="queryParam.vinCode" allowClear placeholder="请输入车架号(VIN)">
  67. <a-icon @click="uploadFun" :type="vinLoading?'loading':'camera'" slot="addonAfter" :style="{ fontSize: '18px', verticalAlign: 'bottom' }" />
  68. </a-input>
  69. <input type="file" id="filed" accept="image/jpeg,image/png" hidden="" @change="filePreview">
  70. </a-form-model-item>
  71. </a-col>
  72. <a-col flex="200px">
  73. <a-form-item label="是否有库存">
  74. <a-select @change="handleHasQty" allowClear :value="queryParam.existStockFlag" placeholder="请选择是否">
  75. <a-select-option value="1">
  76. </a-select-option>
  77. <a-select-option value="0">
  78. </a-select-option>
  79. </a-select>
  80. </a-form-item>
  81. </a-col>
  82. <a-col flex="auto">
  83. <a-button type="primary" @click="searchForm()" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
  84. <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
  85. </a-col>
  86. </a-row>
  87. </a-form-model>
  88. <div v-if="hasVaild&&showTable" class="vinInfo-box">
  89. <div>
  90. <div class="vinInfo-error" v-if="vinInfoData&&!vinInfoData.vinInfo">
  91. <a-icon type="exclamation-circle" :style="{ color: '#E70012', fontSize: '15px', verticalAlign: 'sub', marginRight: '3px' }" />抱歉!暂未找到匹配VIN码的车型!
  92. </div>
  93. <div v-if="vinInfoData&&vinInfoData.vinInfo" @click="openCarInfoModal=true">
  94. <div style="display: flex;justify-content: space-between;align-items: center;" @click="openCarInfoModal=true">
  95. <div>
  96. <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;" />
  97. <span style="vertical-align: middle;">{{ vinInfoData.vinInfo.text }}</span>
  98. </div>
  99. <div style="color: #f90;cursor: pointer;">
  100. <span>查看更多</span> >
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <div>
  106. <a-dropdown v-model="showCell">
  107. <a class="ant-dropdown-link" @click="e => e.preventDefault()">
  108. <a-icon type="setting" /> 显示
  109. </a>
  110. <a-menu slot="overlay">
  111. <a-menu-item v-if="$hasPermissions('M_ShowAllCost')" >
  112. <a-checkbox v-model="cost" id="salesQuery-cost">成本价</a-checkbox>
  113. </a-menu-item>
  114. <a-menu-item v-if="$hasPermissions('M_ShowAllCityPrice')">
  115. <a-checkbox v-model="cityPrice" id="salesQuery-cityPrice">市级价</a-checkbox>
  116. </a-menu-item>
  117. <a-menu-item v-if="$store.state.user.isShowSpecialPrice==1" >
  118. <a-checkbox v-model="tyuePrice"id="salesQuery-tyuePrice">特约价</a-checkbox>
  119. </a-menu-item>
  120. <a-menu-item>
  121. <a-checkbox v-model="zdPrice" id="salesQuery-zdPrice">终端价</a-checkbox>
  122. </a-menu-item>
  123. </a-menu>
  124. </a-dropdown>
  125. </div>
  126. </div>
  127. </div>
  128. <!-- 列表 -->
  129. <s-table
  130. v-if="hasVaild&&showTable"
  131. class="sTable"
  132. ref="table"
  133. size="small"
  134. :rowKey="(record) => record.no"
  135. rowKeyName="no"
  136. :columns="columns"
  137. :data="loadData"
  138. @dblclick="handleClickRow"
  139. :pageSize="30"
  140. :scroll="{ y: tableHeight, x: tableWidth }"
  141. bordered>
  142. <div slot="costTitle">
  143. <a-tooltip placement="top">
  144. <template slot="title">
  145. 产品所在仓库仓位的最近一次入库成本,不包含盘盈入库和仓库调拨入库。
  146. </template>
  147. <span style="margin-right: 5px;">参考成本价</span> <a-icon type="question-circle" />
  148. </a-tooltip>
  149. </div>
  150. <!-- 售价 -->
  151. <template slot="salePrice" slot-scope="text, record">
  152. <div style="display: flex;align-items: center;" @dblclick.stop>
  153. <a-input-number
  154. size="small"
  155. v-model="record.price"
  156. :precision="2"
  157. :min="0"
  158. :max="999999"
  159. style="width: 100%;"
  160. placeholder="请输入" />
  161. <span style="color: red;margin: 0 2px;font-size: 14px;" v-if="record.origSalePriceFlag == 1">原</span>
  162. <span v-else>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
  163. </div>
  164. </template>
  165. <!-- 销售数量 -->
  166. <template slot="nums" slot-scope="text, record">
  167. <div @dblclick.stop>
  168. <a-input-number
  169. size="small"
  170. v-model="record.salesNums"
  171. :precision="0"
  172. :min="0"
  173. :max="999999"
  174. style="width: 100%;"
  175. placeholder="请输入" />
  176. </div>
  177. </template>
  178. <!-- 操作 -->
  179. <template slot="action" slot-scope="text, record">
  180. <span style="color:#999;" v-if="hasChecked(record)">已添加</span>
  181. <a-button
  182. size="small"
  183. type="link"
  184. class="button-primary"
  185. @click="handleAdd(record)"
  186. v-else
  187. id="productInfoList-edit-btn">添加</a-button>
  188. <a-button
  189. size="small"
  190. type="link"
  191. class="button-primary"
  192. @click="handleDetail(record)"
  193. id="productInfoList-detail-btn"
  194. style="margin-left: 5px;">销售记录</a-button>
  195. </template>
  196. </s-table>
  197. <div style="padding-top: 30px;" v-else>
  198. <a-empty
  199. :image="simpleImage"
  200. :image-style="{
  201. height: '60px',
  202. }"
  203. >
  204. <span style="color:red" slot="description">请输入查询条件</span>
  205. </a-empty>
  206. </div>
  207. <!-- 查看车辆信息 -->
  208. <car-info-modal ref="carInfoModal" :openModal="openCarInfoModal" :infoData="vinInfoData&&vinInfoData.vinInfo" @close="openCarInfoModal=false" />
  209. </a-spin>
  210. </a-drawer>
  211. </template>
  212. <script>
  213. import { Empty } from 'ant-design-vue'
  214. import { commonMixin } from '@/utils/mixin'
  215. import { querySumByProductLocation } from '@/api/stock'
  216. import { warehouseAllList } from '@/api/warehouse'
  217. import carInfoModal from './carInfoModal.vue'
  218. import ProductType from '../../common/productType.js'
  219. import ProductBrand from '../../common/productBrand.js'
  220. import { STable, VSelect, Upload } from '@/components'
  221. import { supperCodeByVin, vinCodeParse } from '@/api/sales'
  222. import defImg from '@/assets/def_img@2x.png'
  223. export default {
  224. mixins: [commonMixin],
  225. components: { STable, VSelect, Upload, carInfoModal, ProductType, ProductBrand },
  226. props: {
  227. showModal: {
  228. type: Boolean,
  229. default: false
  230. },
  231. width: {
  232. type: [String, Number],
  233. default: '80%'
  234. },
  235. zIndex: {
  236. type: Number,
  237. default: 100
  238. },
  239. newLoading: {
  240. type: Boolean
  241. },
  242. checkedList: {
  243. type: Array,
  244. default: () => []
  245. }
  246. },
  247. watch: {
  248. showModal (newValue, oldValue) {
  249. this.visible = newValue
  250. if (newValue) {
  251. this.$refs.searchProductCode.focus()
  252. this.setTableH()
  253. }
  254. },
  255. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  256. this.setTableH()
  257. }
  258. },
  259. data () {
  260. return {
  261. showCell: false,
  262. spinning: false,
  263. showTable: false,
  264. visible: this.showModal,
  265. title: '添加产品',
  266. tableHeight: 0,
  267. tableWidth: 1760,
  268. simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
  269. advanced: false, // 高级搜索 展开/关闭
  270. vinLoading: false,
  271. productType: [],
  272. defImg,
  273. queryParam: { // 查询条件
  274. customerSn: '',
  275. salesBillSn: '',
  276. salePriceType: '',
  277. productCode: '', // 产品编码
  278. productName: '', // 产品名称
  279. productOrigCode: '', // 原厂编码
  280. vinCode: '',
  281. productCodeList: undefined, // 车架号
  282. brandSn: undefined, // 产品品牌
  283. productTypeSn1: '', // 产品一级分类
  284. productTypeSn2: '', // 产品二级分类
  285. productTypeSn3: '', // 产品三级分类
  286. warehouseSn: undefined, // 仓库、
  287. enableFlag: '1',
  288. existStockFlag: undefined
  289. },
  290. priceType: '',
  291. buyerSn: '',
  292. rules: {
  293. vinCode: [ { len: 17, message: '请输入正确的车架号(VIN)', trigger: 'change' } ]
  294. },
  295. disabled: false, // 查询、重置按钮是否可操作
  296. warehouseList: [], // 仓库列表
  297. vinInfoData: null,
  298. // 加载数据方法 必须为 Promise 对象
  299. loadData: parameter => {
  300. const _this = this
  301. _this.queryParam.salePriceType = _this.priceType
  302. _this.queryParam.customerSn = _this.buyerSn
  303. // 排序
  304. if (parameter.sortField == 'productCode') {
  305. parameter.sortField = 'code'
  306. parameter.sortAlias = 'product '
  307. }
  308. if (parameter.sortField == 'brandName') {
  309. parameter.sortField = 'firstChar'
  310. parameter.sortAlias = 'brand'
  311. }
  312. if (parameter.sortField == 'warehouseName') {
  313. parameter.sortField = 'warehouseSn'
  314. parameter.sortAlias = 'sd'
  315. }
  316. const params = Object.assign(parameter, _this.queryParam)
  317. if (_this.queryParam.vinCode && _this.queryParam.vinCode.length == 17 && !this.onlyList) { // 输入vin,查出vin码信息后请求列表数据
  318. _this.disabled = true
  319. return supperCodeByVin({ vin: _this.queryParam.vinCode }).then(res => {
  320. if (res.status == 200) {
  321. _this.vinInfoData = res.data
  322. params.productCodeList = res.data.partCodeList || []
  323. return _this.getList(params)
  324. } else {
  325. _this.vinInfoData = null
  326. _this.$refs.table.localLoading = false
  327. _this.$refs.table.clearTable()
  328. }
  329. })
  330. } else if (_this.queryParam.vinCode && _this.queryParam.vinCode.length < 17 && !this.onlyList) { // 输入vin,但vin码不符合标准,不查vin码信息,不请求列表数据
  331. _this.$refs.table.localLoading = false
  332. _this.$refs.table.clearTable()
  333. } else if (this.onlyList) {
  334. _this.disabled = true
  335. if (_this.queryParam.vinCode && _this.vinInfoData) {
  336. return _this.getList(Object.assign(params, { productCodeList: _this.vinInfoData.partCodeList }))
  337. } else {
  338. return _this.getList(params)
  339. }
  340. } else { // 未输入vin码信息,只查列表数据
  341. _this.disabled = true
  342. return _this.getList(params)
  343. }
  344. },
  345. openModal: false, // 查看客户详情 弹框
  346. cost: false, // 成本价
  347. cityPrice: false, // 城市价
  348. tyuePrice: false, // 特约价
  349. zdPrice: false, // 终端价
  350. openCarInfoModal: false,
  351. onlyList: false
  352. }
  353. },
  354. computed: {
  355. hasVaild () {
  356. return this.queryParam.productCode || this.queryParam.productName || this.queryParam.brandSn || this.queryParam.productTypeSn1 || this.queryParam.warehouseSn || this.queryParam.existStockFlag || this.queryParam.vinCode
  357. },
  358. columns () {
  359. const _this = this
  360. const arr = [
  361. { title: '产品编码', dataIndex: 'productCode', width: '150px', align: 'center', sorter: true, customRender: function (text) { return text || '--' }, fixed: 'left' },
  362. { title: '产品名称', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  363. { title: '原厂编码', dataIndex: 'productOrigCode', width: '150px', align: 'center', customRender: function (text) { return text || '--' } },
  364. { title: '品牌', dataIndex: 'brandName', width: '120px', align: 'center', sorter: true, customRender: function (text) { return text || '--' } }
  365. ]
  366. if (this.cost) {
  367. this.tableWidth += 100
  368. arr.push({ slots: { title: 'costTitle' }, dataIndex: 'putCost', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  369. } else {
  370. this.tableWidth -= 100
  371. }
  372. if (this.cityPrice && this.$hasPermissions('M_ShowAllCityPrice')) {
  373. this.tableWidth += 80
  374. arr.push({ title: '市级价', dataIndex: 'dealerProduct.cityPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  375. } else {
  376. this.tableWidth -= 80
  377. }
  378. if (this.tyuePrice) {
  379. this.tableWidth += 80
  380. arr.push({ title: '特约价', dataIndex: 'dealerProduct.specialPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  381. } else {
  382. this.tableWidth -= 80
  383. }
  384. if (this.zdPrice) {
  385. this.tableWidth += 80
  386. arr.push({ title: '终端价', dataIndex: 'dealerProduct.terminalPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  387. } else {
  388. this.tableWidth -= 80
  389. }
  390. return arr.concat([
  391. { title: '仓库', dataIndex: 'warehouseName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
  392. { title: '仓位', dataIndex: 'warehouseLocationName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
  393. { title: '单位', dataIndex: 'unit', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
  394. { title: '库存数量', dataIndex: 'currentQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, fixed: 'right' },
  395. { title: '售价', dataIndex: 'salePrice', scopedSlots: { customRender: 'salePrice' }, width: '120px', align: 'center', fixed: 'right' },
  396. { title: '销售数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '100px', align: 'center', fixed: 'right' },
  397. { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: '120px', align: 'center', fixed: 'right' }
  398. ])
  399. }
  400. },
  401. created () {
  402. // 仓库
  403. if (this.warehouseList.length == 0) {
  404. this.getWarehouse()
  405. }
  406. },
  407. methods: {
  408. hasChecked (item) {
  409. return this.checkedList.includes(item.productSn)
  410. },
  411. // 查询
  412. searchForm () {
  413. if (this.hasVaild) {
  414. this.showTable = true
  415. if (this.$refs.table) {
  416. this.$refs.table.refresh(true)
  417. }
  418. } else {
  419. this.showTable = false
  420. this.$message.info('请输入查询条件')
  421. }
  422. },
  423. getList (params) {
  424. const _this = this
  425. return querySumByProductLocation(params).then(res => {
  426. let data
  427. this.onlyList = false
  428. if (res.status == 200) {
  429. data = res.data
  430. data.list = data.list.filter(item => item != null)
  431. const no = (data.pageNo - 1) * data.pageSize
  432. for (var i = 0; i < data.list.length; i++) {
  433. data.list[i].no = data.list[i].productSn + '_' + (no + i + 1)
  434. data.list[i].salesNums = 1
  435. data.list[i].currentQty = data.list[i].currentQty || 0
  436. 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
  437. data.list[i].productOrigCode = data.list[i].productOrigCode ? data.list[i].productOrigCode.trim() : ''
  438. }
  439. if (!params.vinCode) {
  440. _this.vinInfoData = null
  441. }
  442. } else {
  443. data = {
  444. list: [],
  445. pageNo: 1,
  446. pageSize: 10
  447. }
  448. }
  449. _this.disabled = false
  450. console.log(data)
  451. return data
  452. })
  453. },
  454. // vin change
  455. vinCodeChange (e) {
  456. if (e.target.value.length == 17) {
  457. supperCodeByVin({ vin: e.target.value }).then(res => {
  458. if (res.status == 200) {
  459. this.queryParam.productCodeList = res.data
  460. } else {
  461. this.queryParam.productCodeList = undefined
  462. }
  463. })
  464. } else {
  465. this.queryParam.productCodeList = undefined
  466. }
  467. },
  468. // 双击列表
  469. handleClickRow (record) {
  470. if (!this.hasChecked(record)) {
  471. this.$emit('add', record)
  472. }
  473. },
  474. // 重置
  475. resetSearchForm (flag) {
  476. this.queryParam.productCode = ''
  477. this.queryParam.productName = ''
  478. this.queryParam.productOrigCode = ''
  479. this.queryParam.brandSn = undefined
  480. this.queryParam.productTypeSn1 = ''
  481. this.queryParam.productTypeSn2 = ''
  482. this.queryParam.productTypeSn3 = ''
  483. this.queryParam.warehouseSn = undefined
  484. this.queryParam.productCodeList = undefined
  485. this.queryParam.existStockFlag = undefined
  486. this.queryParam.vinCode = ''
  487. this.productType = []
  488. this.$refs.ruleForm.resetFields()
  489. this.vinInfoData = null
  490. this.showTable = false
  491. if (!flag) {
  492. this.$refs.table.refresh(true)
  493. }
  494. },
  495. pageInit (buyerSn, priceType, salesBillSn) {
  496. this.priceType = priceType || ''
  497. this.buyerSn = buyerSn || ''
  498. this.queryParam.salesBillSn = salesBillSn || ''
  499. },
  500. // 刷新当前页面
  501. resetCurForm () {
  502. this.$refs.table.refresh()
  503. },
  504. // 清空数据
  505. clearTable () {
  506. this.vinInfoData = null
  507. this.$refs.ruleForm.resetFields()
  508. this.$refs.table.clearTable()
  509. },
  510. filterOption (input, option) {
  511. return (
  512. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  513. )
  514. },
  515. // 选择配件
  516. handleAdd (row) {
  517. const _this = this
  518. console.log(row.price, row.lastSalePrice, row.salePrice, row.lastSalePrice < row.salePrice)
  519. if (row.lastSalePrice && (row.price < row.salePrice)) {
  520. _this.$confirm({
  521. title: '提示',
  522. content: '售价低于定价,是否仍继续添加?',
  523. centered: true,
  524. closable: true,
  525. onOk () {
  526. _this.$emit('add', row)
  527. }
  528. })
  529. } else {
  530. _this.$emit('add', row)
  531. }
  532. },
  533. // 销售记录
  534. handleDetail (row) {
  535. this.$emit('viewRecord', row)
  536. },
  537. uploadFun () {
  538. document.getElementById('filed').click()
  539. },
  540. filePreview (e) {
  541. const _this = this
  542. var files = e.target.files[0]
  543. const formData = new FormData()
  544. formData.append('savePathType', 'local')
  545. formData.append('file', files)
  546. this.vinLoading = true
  547. vinCodeParse(formData).then(res => {
  548. if (res.type == 'application/json') {
  549. var reader = new FileReader()
  550. reader.addEventListener('loadend', function () {
  551. const obj = JSON.parse(reader.result)
  552. if (obj.status == 200) {
  553. _this.queryParam.vinCode = obj.data || ''
  554. // 移除表单项的校验结果
  555. _this.$refs.ruleForm.clearValidate('vinCode')
  556. } else {
  557. _this.$notification.error({
  558. message: '提示',
  559. description: obj.message
  560. })
  561. }
  562. _this.vinLoading = false
  563. document.getElementById('filed').value = ''
  564. })
  565. reader.readAsText(res)
  566. } else {
  567. _this.vinLoading = false
  568. }
  569. })
  570. },
  571. // 仓库
  572. getWarehouse () {
  573. warehouseAllList({ wasteFlag: 0 }).then(res => {
  574. if (res.status == 200) {
  575. this.warehouseList = res.data
  576. } else {
  577. this.warehouseList = []
  578. }
  579. })
  580. },
  581. // 产品分类 change
  582. changeProductType (val, opt) {
  583. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  584. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  585. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  586. },
  587. // 查看是否有库存、
  588. handleHasQty (val) {
  589. this.queryParam.existStockFlag = val
  590. },
  591. onClose () {
  592. this.resetSearchForm(true)
  593. this.$emit('close')
  594. },
  595. setTableH () {
  596. this.$nextTick(() => {
  597. const searchBoxH = this.$refs.searchBox.offsetHeight
  598. this.tableHeight = window.innerHeight - searchBoxH - 245
  599. })
  600. }
  601. }
  602. }
  603. </script>
  604. <style lang="less">
  605. .chooseProduct-drawer {
  606. .ant-drawer-header{
  607. padding: 13px 20px;
  608. }
  609. .ant-drawer-body {
  610. padding: 15px 20px;
  611. height: calc(100% - 50px);
  612. display: flex;
  613. flex-direction: column;
  614. overflow: auto;
  615. > div {
  616. height: 100%;
  617. }
  618. .noStock{
  619. text-decoration: line-through;
  620. color: red;
  621. }
  622. .ant-input-number-sm input{
  623. text-align: center;
  624. }
  625. .vinInfo-box{
  626. display: flex;
  627. justify-content: space-between;
  628. align-items: center;
  629. .vinInfo-error{
  630. color: red;
  631. }
  632. }
  633. }
  634. }
  635. </style>