edit.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <div class="purchaseOrderEdit-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="purchaseOrderEdit-cont">
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="purchaseOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <p class="billno">单号:{{ detail&&detail.purchaseBillNo }}</p>
  9. </template>
  10. <!-- 操作区,位于 title 行的行尾 -->
  11. <template slot="extra" v-if="$hasPermissions('B_purchasePrint')">
  12. <Print :disabled="localDataSource.length==0" @handlePrint="handlePrint"></Print>
  13. </template>
  14. </a-page-header>
  15. <!-- 基础信息 -->
  16. <a-card size="small" :bordered="false" class="purchaseOrderEdit-cont">
  17. <a-collapse :activeKey="['1']">
  18. <a-collapse-panel key="1">
  19. <template slot="header">
  20. 基础信息
  21. </template>
  22. <a-descriptions :column="2">
  23. <a-descriptions-item label="供应商">{{ detail&&detail.purchaseTargetName || '--' }}</a-descriptions-item>
  24. <a-descriptions-item label="支付方式">{{ detail&&detail.settleStyleEntity&&detail.settleStyleEntity.name || '--' }}</a-descriptions-item>
  25. <a-descriptions-item label="收货人">{{ detail&&detail.consigneeName || '--' }}({{ detail&&detail.consigneeTel || '--' }})</a-descriptions-item>
  26. <a-descriptions-item label="收货地址">
  27. <div v-if="detail&&(detail.shippingAddressProvinceName || detail.shippingAddressCityName || detail.shippingAddressCountyName || detail.shippingAddress)">
  28. {{ detail&&detail.shippingAddressProvinceName || '' }}
  29. {{ detail&&detail.shippingAddressCityName || '' }}
  30. {{ detail&&detail.shippingAddressCountyName || '' }}
  31. {{ detail&&detail.shippingAddress || '' }}
  32. <a-button type="link" @click="openAddrModal=true">更换地址 >></a-button>
  33. </div>
  34. <p v-else><a-button type="link" @click="openAddrModal=true">选择地址 >></a-button></p>
  35. </a-descriptions-item>
  36. </a-descriptions>
  37. </a-collapse-panel>
  38. </a-collapse>
  39. </a-card>
  40. <!-- 选择产品 -->
  41. <a-card size="small" :bordered="false" class="purchaseOrderEdit-cont">
  42. <a-collapse :activeKey="['1']">
  43. <a-collapse-panel key="1">
  44. <template slot="header">
  45. 选择产品<span class="sub-title">①输入查询条件--->②查找到需要采购的产品--->③录入采购数量--->④点击“添加”</span>
  46. <p class="tag-txt">注意:仅限采购【箭冠】产品。自建产品的采购入库请使用“散件入库”功能</p>
  47. </template>
  48. <!-- 选择产品 -->
  49. <div>
  50. <!-- 搜索条件 -->
  51. <div class="table-page-search-wrapper">
  52. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  53. <a-row :gutter="15">
  54. <a-col :md="6" :sm="24">
  55. <a-form-item label="关键词">
  56. <a-input id="purchaseOrderEdit-bundleName" v-model.trim="queryParam.queryWord" allowClear placeholder="产品名称/产品编码/原厂编码/适用车型"/>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :md="6" :sm="24">
  60. <a-form-item label="产品品牌">
  61. <ProductBrand id="purchaseOrderEdit-productBrand" v-model="queryParam.productBrandSn"></ProductBrand>
  62. </a-form-item>
  63. </a-col>
  64. <a-col :md="6" :sm="24">
  65. <a-form-item label="产品分类">
  66. <ProductType id="purchaseOrderEdit-productType" @change="changeProductType" v-model="productType"></ProductType>
  67. </a-form-item>
  68. </a-col>
  69. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  70. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseOrderEdit-refresh">查询</a-button>
  71. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="purchaseOrderEdit-reset">重置</a-button>
  72. </a-col>
  73. </a-row>
  74. </a-form>
  75. </div>
  76. <!-- 列表 -->
  77. <s-table
  78. class="sTable"
  79. ref="table"
  80. size="small"
  81. :rowKey="(record) => record.id"
  82. :columns="columns"
  83. :data="loadData"
  84. :defaultLoadData="false"
  85. :scroll="{ y:176 }"
  86. :pageSize="10"
  87. bordered>
  88. <!-- 产品图片 -->
  89. <template slot="imageUrl" slot-scope="text, record">
  90. <img
  91. :src="record.productMainPic && record.productMainPic.imageUrl?(record.productMainPic.imageUrl+'?x-oss-process=image/resize,h_30,m_lfit'):defImg"
  92. width="30"
  93. height="30"
  94. style="cursor: pointer;"
  95. @click="handlePicDetail(record)" />
  96. </template>
  97. <!-- 产品编码 -->
  98. <template slot="code" slot-scope="text, record">
  99. <a-tooltip placement="top" v-if="record.stockState=='NOT_ENOUGH'">
  100. <template slot="title">
  101. 该产品暂时缺货!
  102. </template>
  103. <span class="noStock">{{ record.code || '--' }}</span>
  104. </a-tooltip>
  105. <span v-else>{{ record.code || '--' }}</span>
  106. </template>
  107. <!-- 采购数量 -->
  108. <template slot="storageQuantity" slot-scope="text, record">
  109. <a-input-number
  110. size="small"
  111. v-model="record.qty"
  112. :precision="0"
  113. :min="0"
  114. :max="999999"
  115. style="width: 100%;"
  116. placeholder="请输入数量" />
  117. </template>
  118. <!-- 操作 -->
  119. <template slot="action" slot-scope="text, record">
  120. <a-button
  121. size="small"
  122. type="primary"
  123. class="button-info"
  124. :loading="addLoading"
  125. @click="handleAdd(record,0)"
  126. v-if="record.purchasePrice>0"
  127. id="purchaseOrderEdit-add-btn">添加</a-button>
  128. <span v-else>--</span>
  129. </template>
  130. </s-table>
  131. </div>
  132. </a-collapse-panel>
  133. </a-collapse>
  134. </a-card>
  135. <!-- 已选产品 -->
  136. <a-card size="small" :bordered="false" class="purchaseOrderEdit-cont">
  137. <a-collapse :activeKey="['1']">
  138. <a-collapse-panel key="1">
  139. <template slot="header">已选产品</template>
  140. <div>
  141. <!-- 总计 -->
  142. <a-alert type="info" style="margin-bottom:10px">
  143. <div slot="message">产品款数 <strong>{{ detail && (detail.totalCategory || detail.totalCategory==0) ? detail.totalCategory : '--' }}</strong> ,
  144. 采购数量合计 <strong>{{ detail && (detail.totalQty || detail.totalQty==0) ? detail.totalQty : '--' }}</strong> ,
  145. 采购金额合计 <strong>{{ detail && (detail.discountedAmount || detail.discountedAmount==0) ? '¥'+detail.discountedAmount : '--' }}</strong></div>
  146. </a-alert>
  147. <!-- 搜索条件 -->
  148. <div class="table-page-search-wrapper">
  149. <a-row :gutter="15">
  150. <a-col :span="18">
  151. <a-form-model :model="productForm" layout="inline" @keyup.enter.native="$refs.purchaseTable.refresh(true)" >
  152. <a-row :gutter="15">
  153. <a-col :md="8" :sm="24">
  154. <a-form-model-item label="产品编码">
  155. <a-input v-model="productForm.productCode" allowClear placeholder="输入产品编码" />
  156. </a-form-model-item>
  157. </a-col>
  158. <a-col :md="8" :sm="24">
  159. <a-form-model-item label="产品名称">
  160. <a-input v-model="productForm.productName" allowClear placeholder="输入产品名称" />
  161. </a-form-model-item>
  162. </a-col>
  163. <a-col :md="8" :sm="24">
  164. <a-form-model-item style="margin-bottom: 10px;">
  165. <a-button type="primary" @click="$refs.purchaseTable.refresh(true)" :disabled="purchaseDisabled" id="purchaseOrderEdit-refresh">查询</a-button>
  166. <a-button style="margin-left: 5px" @click="resetPurchaseForm" id="purchaseOrderEdit-reset">重置</a-button>
  167. </a-form-model-item>
  168. </a-col>
  169. </a-row>
  170. </a-form-model>
  171. </a-col>
  172. <a-col :span="6">
  173. <div style="float:right;overflow: hidden;">
  174. <a-button size="small" type="primary" class="button-info" id="purchaseOrderEdit-import-btn" @click="handleOutStock">上次缺货</a-button>
  175. <a-button size="small" id="purchaseOrderEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
  176. </div>
  177. </a-col>
  178. </a-row>
  179. </div>
  180. <!-- 列表 -->
  181. <s-table
  182. class="sTable"
  183. ref="purchaseTable"
  184. size="small"
  185. :rowKey="(record) => record.id"
  186. :columns="chooseColumns"
  187. :data="chooseLoadData"
  188. :defaultLoadData="false"
  189. :showPagination="false"
  190. bordered>
  191. <!-- 采购数量 -->
  192. <template slot="storageQuantity" slot-scope="text, record">
  193. <a-input-number
  194. size="small"
  195. id="purchaseOrderEdit-qty"
  196. v-model="record.qty"
  197. :precision="0"
  198. :min="1"
  199. :max="999999"
  200. @blur="e => qtyBlur(e.target.value, record)"
  201. style="width: 100%;"
  202. placeholder="请输入" />
  203. </template>
  204. <!-- 操作 -->
  205. <template slot="action" slot-scope="text, record">
  206. <a-button
  207. size="small"
  208. type="primary"
  209. class="button-error"
  210. :loading="delLoading"
  211. @click="handleDel(record)"
  212. id="purchaseOrderEdit-del-btn">删除</a-button>
  213. </template>
  214. </s-table>
  215. </div>
  216. </a-collapse-panel>
  217. </a-collapse>
  218. </a-card>
  219. </a-spin>
  220. <div class="affix-cont">
  221. <a-button
  222. type="primary"
  223. id="purchaseOrderEdit-submit-btn"
  224. size="large"
  225. class="button-primary"
  226. :loading="subLoading"
  227. :disabled="spinning"
  228. @click="handleSubmit"
  229. style="padding: 0 60px;">提交</a-button>
  230. </div>
  231. <!-- 导入产品 -->
  232. <importGuideModal :openModal="openGuideModal" :params="{purchaseBillSn: $route.params.sn}" @close="openGuideModal=false" @ok="hanldeOks" />
  233. <!-- 上次缺货 -->
  234. <outStockModal :openModal="openOutStockModal" :paramsData="paramsData" @close="openOutStockModal=false" @ok="hanldeOkOutStock" />
  235. <!-- 选择地址 -->
  236. <choose-address-modal :openModal="openAddrModal" @ok="handleAddrOk" @close="openAddrModal=false" />
  237. </div>
  238. </template>
  239. <script>
  240. import { STable, VSelect } from '@/components'
  241. import ImportGuideModal from './importGuideModal.vue'
  242. import outStockModal from './outStockModal.vue'
  243. import chooseAddressModal from './receivingAddress/chooseAddressModal.vue'
  244. import ProductType from '../../common/productType.js'
  245. import ProductBrand from '../../common/productBrand.js'
  246. import { purchaseDetailBySn, purchaseWriteSubmit, purchaseDetailPrint, purchaseDetailExport, purchaseDetailAddress } from '@/api/purchase'
  247. import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel, purchaseDetailCount, purchaseDetailCancelList } from '@/api/purchaseDetail'
  248. import { productListPurchase } from '@/api/product'
  249. import defImg from '@/assets/def_img@2x.png'
  250. import Print from '@/views/common/print.vue'
  251. import { hdPrint } from '@/libs/JGPrint'
  252. export default {
  253. components: { STable, VSelect, ProductType, ProductBrand, ImportGuideModal, outStockModal, Print, chooseAddressModal },
  254. data () {
  255. return {
  256. spinning: false,
  257. detail: null, // 详细信息
  258. subLoading: false,
  259. defImg,
  260. // 选择产品
  261. addLoading: false,
  262. productType: [],
  263. queryParam: {
  264. productBrandSn: undefined,
  265. queryWord: '',
  266. productTypeSn1: '', // 产品一级分类
  267. productTypeSn2: '', // 产品二级分类
  268. productTypeSn3: '' // 产品三级分类
  269. },
  270. typeData: [], // 下拉数据
  271. advanced: false, // 高级搜索 展开/关闭
  272. disabled: false, // 查询、重置按钮是否可操作
  273. // 表头
  274. columns: [
  275. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  276. { title: '产品编码', scopedSlots: { customRender: 'code' }, width: '15%', align: 'center', sorter: true },
  277. { title: '产品名称', dataIndex: 'name', width: '23%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  278. { title: '原厂编码', dataIndex: 'origCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  279. { title: '箱/单位', dataIndex: 'unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
  280. { title: '采购单价', dataIndex: 'purchasePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  281. { title: '终端会员价', dataIndex: 'terminalPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  282. { title: '车主零售价', dataIndex: 'carOwnersPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
  283. { title: '采购数量', dataIndex: 'qty', scopedSlots: { customRender: 'storageQuantity' }, width: '6%', align: 'center' },
  284. { title: '产品图片', scopedSlots: { customRender: 'imageUrl' }, width: '6%', align: 'center' },
  285. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  286. ],
  287. // 加载数据方法 必须为 Promise 对象
  288. loadData: parameter => {
  289. this.disabled = true
  290. return productListPurchase(Object.assign(parameter, this.queryParam, { purchaseBillSn: this.$route.params.sn })).then(res => {
  291. const data = res.data
  292. const no = (data.pageNo - 1) * data.pageSize
  293. for (var i = 0; i < data.list.length; i++) {
  294. data.list[i].no = no + i + 1
  295. data.list[i].qty = 1
  296. }
  297. this.disabled = false
  298. return data
  299. })
  300. },
  301. // -------已选产品-------------
  302. orderCountData: null,
  303. delLoading: false,
  304. productForm: {
  305. productName: '',
  306. productCode: '',
  307. orderBy: 'purchase_bill_detail.CREATE_DATE desc'
  308. },
  309. purchaseDisabled: false, // 查询、重置按钮是否可操作
  310. // 表头
  311. chooseColumns: [
  312. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  313. { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '20%', align: 'center' },
  314. { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  315. { title: '采购单价', dataIndex: 'discountedPrice', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  316. { title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, width: '10%', align: 'center' },
  317. { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  318. { title: '采购金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  319. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  320. ],
  321. // 加载数据方法 必须为 Promise 对象
  322. chooseLoadData: parameter => {
  323. this.disabled = true
  324. // 查询总计
  325. // const params = Object.assign(parameter, this.productForm, { purchaseBillSn: this.$route.params.sn })
  326. const params = Object.assign({ pageNo: 1, pageSize: 5000 }, this.productForm, { purchaseBillSn: this.$route.params.sn })
  327. // this.getCountQuery(params)
  328. return purchaseDetailList(params).then(res => {
  329. const data = res.data
  330. const no = (data.pageNo - 1) * data.pageSize
  331. for (var i = 0; i < data.list.length; i++) {
  332. data.list[i].no = no + i + 1
  333. data.list[i].qtyBackups = data.list[i].qty
  334. }
  335. this.localDataSource = data.list
  336. this.disabled = false
  337. return data
  338. })
  339. },
  340. localDataSource: [],
  341. openGuideModal: false, // 导入产品引导
  342. openOutStockModal: false,
  343. paramsData: null,
  344. openAddrModal: false // 选择地址弹框是否显示
  345. }
  346. },
  347. methods: {
  348. // 获取采购单明细统计
  349. getCountQuery (params) {
  350. purchaseDetailCount(params).then(res => {
  351. this.orderCountData = res.data || null
  352. })
  353. },
  354. // 获取采购单基本信息
  355. getOrderDetail () {
  356. purchaseDetailBySn({ sn: this.$route.params.sn }).then(res => {
  357. if (res.status == 200) {
  358. this.detail = res.data
  359. }
  360. })
  361. },
  362. // 删除产品
  363. handleDel (row) {
  364. const _this = this
  365. this.$confirm({
  366. title: '提示',
  367. content: '确认要删除吗?',
  368. centered: true,
  369. closable: true,
  370. onOk () {
  371. _this.delLoading = true
  372. _this.spinning = true
  373. purchaseDetailDel({ id: row.id }).then(res => {
  374. if (res.status == 200) {
  375. _this.resetPurchaseDetail(true)
  376. _this.$message.success(res.message)
  377. _this.delLoading = false
  378. _this.spinning = false
  379. } else {
  380. _this.delLoading = false
  381. _this.spinning = false
  382. }
  383. })
  384. }
  385. })
  386. },
  387. // 重新查询已选产品
  388. resetPurchaseDetail (flag) {
  389. this.$refs.purchaseTable.refresh(!!flag)
  390. this.getOrderDetail()
  391. },
  392. // 修改数量后
  393. qtyBlur (val, record) {
  394. // 光标移出,值发生改变再调用编辑接口
  395. if (val != record.qtyBackups) {
  396. this.handleAdd(record, 1)
  397. }
  398. },
  399. filterOption (input, option) {
  400. return (
  401. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  402. )
  403. },
  404. // 产品分类 change
  405. changeProductType (val, opt) {
  406. this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
  407. this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
  408. this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
  409. },
  410. // 重置产品库
  411. resetSearchForm () {
  412. this.queryParam = {
  413. productBrandSn: undefined,
  414. productTypeSn1: '', // 产品一级分类
  415. productTypeSn2: '', // 产品二级分类
  416. productTypeSn3: '', // 产品三级分类
  417. queryWord: ''
  418. }
  419. this.productType = []
  420. this.$refs.table.refresh(true)
  421. },
  422. resetPurchaseForm () {
  423. this.productForm.productName = ''
  424. this.productForm.productCode = ''
  425. this.$refs.purchaseTable.refresh(true)
  426. },
  427. // 添加或修改
  428. handleAdd (row, type) {
  429. let params = {}
  430. if (type == 0 && !row.qty) {
  431. this.$message.warning('请输入数量后再添加!')
  432. return
  433. }
  434. // 添加
  435. if (type == 0) {
  436. params.productSn = row.productSn
  437. params.purchaseBillSn = this.detail.purchaseBillSn
  438. params.purchaseBillNo = this.detail.purchaseBillNo
  439. params.price = row.purchasePrice
  440. params.qty = row.qty
  441. } else { // 编辑
  442. // 清空成本价或数量时,值应保持未清空前的值,因成本价和数量都不可为空
  443. if (!row.qty) {
  444. row.qty = row.qtyBackups
  445. return
  446. }
  447. params = row
  448. }
  449. this.addLoading = true
  450. this.spinning = true
  451. purchaseDetailSave(params).then(res => {
  452. if (res.status == 200) {
  453. this.resetPurchaseDetail()
  454. this.$message.success(res.message)
  455. this.spinning = false
  456. } else {
  457. this.spinning = false
  458. }
  459. this.addLoading = false
  460. })
  461. },
  462. // 提交
  463. handleSubmit () {
  464. const _this = this
  465. this.subLoading = true
  466. this.spinning = true
  467. purchaseWriteSubmit({ id: this.detail.id }).then(res => {
  468. if (res.status == 200) {
  469. this.$message.success(res.message)
  470. setTimeout(() => {
  471. _this.handleBack()
  472. _this.spinning = false
  473. }, 1000)
  474. } else {
  475. _this.spinning = false
  476. }
  477. _this.subLoading = false
  478. })
  479. },
  480. // 导入产品
  481. hanldeOks () {
  482. this.$refs.purchaseTable.refresh(true)
  483. this.getOrderDetail()
  484. },
  485. // 上次缺货
  486. handleOutStock () {
  487. // 校验是否存在历史采购单,且上次采购存在缺货产品
  488. purchaseDetailCancelList({ pageNo: 1, pageSize: 5 }).then(res => {
  489. if (res.status == 200) {
  490. this.paramsData = {
  491. purchaseBillSn: this.$route.params.sn,
  492. purchaseBillNo: this.detail && this.detail.purchaseBillNo ? this.detail.purchaseBillNo : undefined
  493. }
  494. this.openOutStockModal = true
  495. }
  496. })
  497. },
  498. // 地址保存
  499. handleAddrOk (data) {
  500. const params = {
  501. purchaseBillSn: this.$route.params.sn,
  502. shippingAddressProvinceName: data.provinceName,
  503. shippingAddressCityName: data.cityName,
  504. shippingAddressCountyName: data.countyName,
  505. shippingAddress: data.addr,
  506. consigneeName: data.consigneeName,
  507. consigneeTel: data.consigneeTel
  508. }
  509. purchaseDetailAddress(params).then(res => {
  510. if (res.status == 200) {
  511. this.openAddrModal = false
  512. this.getOrderDetail()
  513. }
  514. })
  515. },
  516. // 查看产品
  517. handlePicDetail (row) {
  518. this.$router.push({ name: 'viewProduct', params: { sn: row.productSn } })
  519. },
  520. // 上次缺货 导入成功
  521. hanldeOkOutStock () {
  522. this.$refs.purchaseTable.refresh(true)
  523. this.paramsData = null
  524. this.openOutStockModal = false
  525. },
  526. // 打印预览/快捷打印
  527. handlePrint (type, printerType) {
  528. const _this = this
  529. _this.spinning = true
  530. let url = purchaseDetailPrint
  531. let params = { sn: this.$route.params.sn, type: printerType }
  532. if (type == 'export') { // 导出
  533. url = purchaseDetailExport
  534. params = { sn: this.$route.params.sn }
  535. }
  536. // 打印或导出
  537. hdPrint(printerType, type, url, params, '采购单', function () {
  538. _this.spinning = false
  539. })
  540. },
  541. // 返回列表
  542. handleBack () {
  543. this.$router.push({ path: '/purchasingManagement/purchaseOrder/list', query: { closeLastOldTab: true } })
  544. },
  545. pageInit () {
  546. this.getOrderDetail()
  547. this.resetPurchaseForm()
  548. this.resetSearchForm()
  549. }
  550. },
  551. mounted () {
  552. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  553. this.pageInit()
  554. }
  555. },
  556. activated () {
  557. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  558. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  559. this.pageInit()
  560. }
  561. },
  562. beforeRouteEnter (to, from, next) {
  563. next(vm => {})
  564. }
  565. }
  566. </script>
  567. <style lang="less">
  568. .purchaseOrderEdit-wrap{
  569. position: relative;
  570. height: 100%;
  571. padding-bottom: 51px;
  572. box-sizing: border-box;
  573. >.ant-spin-nested-loading{
  574. overflow-y: scroll;
  575. height: 100%;
  576. }
  577. .noStock{
  578. text-decoration: line-through;
  579. color: red;
  580. }
  581. .billno{
  582. margin: 0 0 0 30px;
  583. font-size: 18px;
  584. font-weight: 600;
  585. display: inline-block;
  586. vertical-align: top;
  587. color: #666;
  588. }
  589. .purchaseOrderEdit-cont{
  590. margin-bottom: 10px;
  591. .sub-title{
  592. font-size: 12px;
  593. color: #808695;
  594. margin-left: 10px;
  595. }
  596. .tag-txt{
  597. font-size: 12px;
  598. color: #ed1c24;
  599. margin: 0;
  600. }
  601. .edit-circle-btn{
  602. margin-left: 15px;
  603. i{
  604. vertical-align: text-bottom;
  605. }
  606. }
  607. .import-btn{
  608. margin-left: 15px;
  609. }
  610. }
  611. }
  612. </style>