chooseProductModal.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  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')&&$store.state.user.dealerLevel != 'SPECIAL'">
  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. <a-button
  181. size="small"
  182. type="link"
  183. class="button-primary"
  184. @click="handleAdd(record)"
  185. id="productInfoList-edit-btn">添加</a-button>
  186. <a-button
  187. size="small"
  188. type="link"
  189. class="button-primary"
  190. @click="handleDetail(record)"
  191. id="productInfoList-detail-btn"
  192. style="margin-left: 5px;">销售记录</a-button>
  193. </template>
  194. </s-table>
  195. <div style="padding-top: 30px;" v-else>
  196. <a-empty
  197. :image="simpleImage"
  198. :image-style="{
  199. height: '60px',
  200. }"
  201. >
  202. <span style="color:red" slot="description">请输入查询条件</span>
  203. </a-empty>
  204. </div>
  205. <!-- 查看车辆信息 -->
  206. <car-info-modal ref="carInfoModal" :openModal="openCarInfoModal" :infoData="vinInfoData&&vinInfoData.vinInfo" @close="openCarInfoModal=false" />
  207. </a-spin>
  208. </a-drawer>
  209. </template>
  210. <script>
  211. import { Empty } from 'ant-design-vue'
  212. import { commonMixin } from '@/utils/mixin'
  213. import { querySumByProductLocation } from '@/api/stock'
  214. import { warehouseAllList } from '@/api/warehouse'
  215. import carInfoModal from './carInfoModal.vue'
  216. import ProductType from '../../common/productType.js'
  217. import ProductBrand from '../../common/productBrand.js'
  218. import { STable, VSelect, Upload } from '@/components'
  219. import { supperCodeByVin, vinCodeParse } from '@/api/sales'
  220. import defImg from '@/assets/def_img@2x.png'
  221. export default {
  222. mixins: [commonMixin],
  223. components: { STable, VSelect, Upload, carInfoModal, ProductType, ProductBrand },
  224. props: {
  225. showModal: {
  226. type: Boolean,
  227. default: false
  228. },
  229. width: {
  230. type: [String, Number],
  231. default: '80%'
  232. },
  233. zIndex: {
  234. type: Number,
  235. default: 100
  236. },
  237. newLoading: {
  238. type: Boolean
  239. },
  240. checkedList: {
  241. type: Array,
  242. default: () => []
  243. }
  244. },
  245. watch: {
  246. showModal (newValue, oldValue) {
  247. this.visible = newValue
  248. if (newValue) {
  249. this.$refs.searchProductCode.focus()
  250. this.setTableH()
  251. }
  252. },
  253. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  254. this.setTableH()
  255. }
  256. },
  257. data () {
  258. return {
  259. showCell: false,
  260. spinning: false,
  261. showTable: false,
  262. visible: this.showModal,
  263. title: '添加产品',
  264. tableHeight: 0,
  265. tableWidth: 1760,
  266. simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
  267. advanced: false, // 高级搜索 展开/关闭
  268. vinLoading: false,
  269. productType: [],
  270. defImg,
  271. queryParam: { // 查询条件
  272. customerSn: '',
  273. salesBillSn: '',
  274. salePriceType: '',
  275. productCode: '', // 产品编码
  276. productName: '', // 产品名称
  277. productOrigCode: '', // 原厂编码
  278. vinCode: '',
  279. productCodeList: undefined, // 车架号
  280. brandSn: undefined, // 产品品牌
  281. productTypeSn1: '', // 产品一级分类
  282. productTypeSn2: '', // 产品二级分类
  283. productTypeSn3: '', // 产品三级分类
  284. warehouseSn: undefined, // 仓库、
  285. enableFlag: '1',
  286. existStockFlag: undefined
  287. },
  288. priceType: '',
  289. buyerSn: '',
  290. rules: {
  291. vinCode: [ { len: 17, message: '请输入正确的车架号(VIN)', trigger: 'change' } ]
  292. },
  293. disabled: false, // 查询、重置按钮是否可操作
  294. warehouseList: [], // 仓库列表
  295. vinInfoData: null,
  296. // 加载数据方法 必须为 Promise 对象
  297. loadData: parameter => {
  298. const _this = this
  299. _this.queryParam.salePriceType = _this.priceType
  300. _this.queryParam.customerSn = _this.buyerSn
  301. // 排序
  302. if (parameter.sortField == 'productCode') {
  303. parameter.sortField = 'code'
  304. parameter.sortAlias = 'product '
  305. }
  306. if (parameter.sortField == 'brandName') {
  307. parameter.sortField = 'firstChar'
  308. parameter.sortAlias = 'brand'
  309. }
  310. if (parameter.sortField == 'warehouseName') {
  311. parameter.sortField = 'warehouseSn'
  312. parameter.sortAlias = 'sd'
  313. }
  314. const params = Object.assign(parameter, _this.queryParam)
  315. if (_this.queryParam.vinCode && _this.queryParam.vinCode.length == 17 && !this.onlyList) { // 输入vin,查出vin码信息后请求列表数据
  316. _this.disabled = true
  317. return supperCodeByVin({ vin: _this.queryParam.vinCode }).then(res => {
  318. if (res.status == 200) {
  319. _this.vinInfoData = res.data
  320. params.productCodeList = res.data.partCodeList || []
  321. return _this.getList(params)
  322. } else {
  323. _this.vinInfoData = null
  324. _this.$refs.table.localLoading = false
  325. _this.$refs.table.clearTable()
  326. }
  327. })
  328. } else if (_this.queryParam.vinCode && _this.queryParam.vinCode.length < 17 && !this.onlyList) { // 输入vin,但vin码不符合标准,不查vin码信息,不请求列表数据
  329. _this.$refs.table.localLoading = false
  330. _this.$refs.table.clearTable()
  331. } else if (this.onlyList) {
  332. _this.disabled = true
  333. if (_this.queryParam.vinCode && _this.vinInfoData) {
  334. return _this.getList(Object.assign(params, { productCodeList: _this.vinInfoData.partCodeList }))
  335. } else {
  336. return _this.getList(params)
  337. }
  338. } else { // 未输入vin码信息,只查列表数据
  339. _this.disabled = true
  340. return _this.getList(params)
  341. }
  342. },
  343. openModal: false, // 查看客户详情 弹框
  344. cost: false, // 成本价
  345. cityPrice: false, // 城市价
  346. tyuePrice: false, // 特约价
  347. zdPrice: false, // 终端价
  348. openCarInfoModal: false,
  349. onlyList: false
  350. }
  351. },
  352. computed: {
  353. hasVaild () {
  354. return this.queryParam.productCode || this.queryParam.productName || this.queryParam.brandSn || this.queryParam.productTypeSn1 || this.queryParam.warehouseSn || this.queryParam.existStockFlag || this.queryParam.vinCode
  355. },
  356. columns () {
  357. const _this = this
  358. const arr = [
  359. { title: '产品编码', dataIndex: 'productCode', width: '150px', align: 'center', sorter: true, customRender: function (text) { return text || '--' }, fixed: 'left' },
  360. { title: '产品名称', dataIndex: 'productName', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  361. { title: '原厂编码', dataIndex: 'productOrigCode', width: '150px', align: 'center', customRender: function (text) { return text || '--' } },
  362. { title: '品牌', dataIndex: 'brandName', width: '120px', align: 'center', sorter: true, customRender: function (text) { return text || '--' } }
  363. ]
  364. if (this.cost) {
  365. this.tableWidth += 100
  366. arr.push({ slots: { title: 'costTitle' }, dataIndex: 'putCost', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  367. } else {
  368. this.tableWidth -= 100
  369. }
  370. if (this.cityPrice && this.$hasPermissions('M_ShowAllCityPrice')) {
  371. this.tableWidth += 80
  372. arr.push({ title: '市级价', dataIndex: 'dealerProduct.cityPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  373. } else {
  374. this.tableWidth -= 80
  375. }
  376. if (this.tyuePrice) {
  377. this.tableWidth += 80
  378. arr.push({ title: '特约价', dataIndex: 'dealerProduct.specialPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  379. } else {
  380. this.tableWidth -= 80
  381. }
  382. if (this.zdPrice) {
  383. this.tableWidth += 80
  384. arr.push({ title: '终端价', dataIndex: 'dealerProduct.terminalPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  385. } else {
  386. this.tableWidth -= 80
  387. }
  388. return arr.concat([
  389. { title: '仓库', dataIndex: 'warehouseName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
  390. { title: '仓位', dataIndex: 'warehouseLocationName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
  391. { title: '单位', dataIndex: 'unit', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
  392. { title: '库存数量', dataIndex: 'currentQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') }, fixed: 'right' },
  393. { title: '售价', dataIndex: 'salePrice', scopedSlots: { customRender: 'salePrice' }, width: '120px', align: 'center', fixed: 'right' },
  394. { title: '销售数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '100px', align: 'center', fixed: 'right' },
  395. { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: '120px', align: 'center', fixed: 'right' }
  396. ])
  397. }
  398. },
  399. created () {
  400. // 仓库
  401. if (this.warehouseList.length == 0) {
  402. this.getWarehouse()
  403. }
  404. },
  405. methods: {
  406. // 查询
  407. searchForm () {
  408. if (this.hasVaild) {
  409. this.showTable = true
  410. if (this.$refs.table) {
  411. this.$refs.table.refresh(true)
  412. }
  413. } else {
  414. this.showTable = false
  415. this.$message.info('请输入查询条件')
  416. }
  417. },
  418. getList (params) {
  419. const _this = this
  420. return querySumByProductLocation(params).then(res => {
  421. let data
  422. this.onlyList = false
  423. if (res.status == 200) {
  424. data = res.data
  425. data.list = data.list.filter(item => item != null)
  426. const no = (data.pageNo - 1) * data.pageSize
  427. for (var i = 0; i < data.list.length; i++) {
  428. data.list[i].no = data.list[i].productSn + '_' + (no + i + 1)
  429. data.list[i].salesNums = 1
  430. data.list[i].currentQty = data.list[i].currentQty || 0
  431. 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
  432. data.list[i].productOrigCode = data.list[i].productOrigCode ? data.list[i].productOrigCode.trim() : ''
  433. }
  434. if (!params.vinCode) {
  435. _this.vinInfoData = null
  436. }
  437. } else {
  438. data = {
  439. list: [],
  440. pageNo: 1,
  441. pageSize: 10
  442. }
  443. }
  444. _this.disabled = false
  445. console.log(data)
  446. return data
  447. })
  448. },
  449. // vin change
  450. vinCodeChange (e) {
  451. if (e.target.value.length == 17) {
  452. supperCodeByVin({ vin: e.target.value }).then(res => {
  453. if (res.status == 200) {
  454. this.queryParam.productCodeList = res.data
  455. } else {
  456. this.queryParam.productCodeList = undefined
  457. }
  458. })
  459. } else {
  460. this.queryParam.productCodeList = undefined
  461. }
  462. },
  463. // 双击列表
  464. handleClickRow (record) {
  465. this.$emit('add', record)
  466. },
  467. // 重置
  468. resetSearchForm (flag) {
  469. this.queryParam.productCode = ''
  470. this.queryParam.productName = ''
  471. this.queryParam.productOrigCode = ''
  472. this.queryParam.brandSn = undefined
  473. this.queryParam.productTypeSn1 = ''
  474. this.queryParam.productTypeSn2 = ''
  475. this.queryParam.productTypeSn3 = ''
  476. this.queryParam.warehouseSn = undefined
  477. this.queryParam.productCodeList = undefined
  478. this.queryParam.existStockFlag = undefined
  479. this.queryParam.vinCode = ''
  480. this.productType = []
  481. this.$refs.ruleForm.resetFields()
  482. this.vinInfoData = null
  483. this.showTable = false
  484. if (!flag) {
  485. this.$refs.table.refresh(true)
  486. }
  487. },
  488. pageInit (buyerSn, priceType, salesBillSn) {
  489. this.priceType = priceType || ''
  490. this.buyerSn = buyerSn || ''
  491. this.queryParam.salesBillSn = salesBillSn || ''
  492. },
  493. // 刷新当前页面
  494. resetCurForm () {
  495. this.$refs.table.refresh()
  496. },
  497. // 清空数据
  498. clearTable () {
  499. this.vinInfoData = null
  500. this.$refs.ruleForm.resetFields()
  501. this.$refs.table.clearTable()
  502. },
  503. filterOption (input, option) {
  504. return (
  505. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  506. )
  507. },
  508. // 选择配件
  509. handleAdd (row) {
  510. const _this = this
  511. console.log(row.price, row.lastSalePrice, row.salePrice, row.lastSalePrice < row.salePrice)
  512. if (row.lastSalePrice && (row.price < row.salePrice)) {
  513. _this.$confirm({
  514. title: '提示',
  515. content: '售价低于定价,是否仍继续添加?',
  516. centered: true,
  517. closable: true,
  518. onOk () {
  519. _this.$emit('add', row)
  520. }
  521. })
  522. } else {
  523. _this.$emit('add', row)
  524. }
  525. },
  526. // 销售记录
  527. handleDetail (row) {
  528. this.$emit('viewRecord', row)
  529. },
  530. uploadFun () {
  531. document.getElementById('filed').click()
  532. },
  533. filePreview (e) {
  534. const _this = this
  535. var files = e.target.files[0]
  536. const formData = new FormData()
  537. formData.append('savePathType', 'local')
  538. formData.append('file', files)
  539. this.vinLoading = true
  540. vinCodeParse(formData).then(res => {
  541. if (res.type == 'application/json') {
  542. var reader = new FileReader()
  543. reader.addEventListener('loadend', function () {
  544. const obj = JSON.parse(reader.result)
  545. if (obj.status == 200) {
  546. _this.queryParam.vinCode = obj.data || ''
  547. // 移除表单项的校验结果
  548. _this.$refs.ruleForm.clearValidate('vinCode')
  549. } else {
  550. _this.$notification.error({
  551. message: '提示',
  552. description: obj.message
  553. })
  554. }
  555. _this.vinLoading = false
  556. document.getElementById('filed').value = ''
  557. })
  558. reader.readAsText(res)
  559. } else {
  560. _this.vinLoading = false
  561. }
  562. })
  563. },
  564. // 仓库
  565. getWarehouse () {
  566. warehouseAllList({ wasteFlag: 0 }).then(res => {
  567. if (res.status == 200) {
  568. this.warehouseList = res.data
  569. } else {
  570. this.warehouseList = []
  571. }
  572. })
  573. },
  574. // 产品分类 change
  575. changeProductType (val, opt) {
  576. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  577. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  578. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  579. },
  580. // 查看是否有库存、
  581. handleHasQty (val) {
  582. this.queryParam.existStockFlag = val
  583. },
  584. onClose () {
  585. this.resetSearchForm(true)
  586. this.$emit('close')
  587. },
  588. setTableH () {
  589. this.$nextTick(() => {
  590. const searchBoxH = this.$refs.searchBox.offsetHeight
  591. this.tableHeight = window.innerHeight - searchBoxH - 245
  592. })
  593. }
  594. }
  595. }
  596. </script>
  597. <style lang="less">
  598. .chooseProduct-drawer {
  599. .ant-drawer-header{
  600. padding: 13px 20px;
  601. }
  602. .ant-drawer-body {
  603. padding: 15px 20px;
  604. height: calc(100% - 50px);
  605. display: flex;
  606. flex-direction: column;
  607. overflow: auto;
  608. > div {
  609. height: 100%;
  610. }
  611. .noStock{
  612. text-decoration: line-through;
  613. color: red;
  614. }
  615. .ant-input-number-sm input{
  616. text-align: center;
  617. }
  618. .vinInfo-box{
  619. display: flex;
  620. justify-content: space-between;
  621. align-items: center;
  622. .vinInfo-error{
  623. color: red;
  624. }
  625. }
  626. }
  627. }
  628. </style>