edit.vue 26 KB

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