edit.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <template>
  2. <div class="allocateBillEdit-wrap">
  3. <!-- <a-spin :spinning="spinning" tip="Loading..."> -->
  4. <div class="ant-spin-nested-loading">
  5. <a-page-header :ghost="false" :backIcon="false" class="allocateBillEdit-back" >
  6. <!-- 自定义的二级文字标题 -->
  7. <template slot="subTitle">
  8. <a id="allocateBillEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  9. <a-button type="link" class="button-default" @click="showDetail=!showDetail">
  10. <a-icon :type="showDetail ? 'eye-invisible' : 'eye'"/> {{ showDetail?'隐藏':'查看' }}信息
  11. </a-button>
  12. </template>
  13. <!-- 操作区,位于 title 行的行尾 -->
  14. <template slot="extra">
  15. <print :params="{allocateReturnSn: $route.params.sn || outBizSn}" :basicInfoData="basicInfoData" :disabled="localDataSource.length==0" @loading="spinning=true" @unloading="spinning=false"></print>
  16. </template>
  17. </a-page-header>
  18. <a-card size="small" :bordered="false" v-if="basicInfoData" class="allocateBillEdit-cont" v-show="showDetail">
  19. <a-descriptions :column="3">
  20. <a-descriptions-item label="调拨退货单号">{{ (basicInfoData&&basicInfoData.allocateReturnNo) || '--' }}</a-descriptions-item>
  21. <a-descriptions-item label="调拨退货对象">{{ (basicInfoData&&basicInfoData.targetTypeDictValue) || '--' }}</a-descriptions-item>
  22. <a-descriptions-item label="调拨退货对象名称">{{ (basicInfoData&&basicInfoData.targetName) || '--' }}</a-descriptions-item>
  23. <a-descriptions-item label="调入仓库">
  24. <!-- <warehouse
  25. style="width:200px;"
  26. :allowClear="false"
  27. v-model="basicInfoData.warehouseSn"
  28. @change="updateWarehouse"
  29. id="basicInfo-warehouseSn"
  30. placeholder="请选择调入仓库"
  31. /> -->
  32. {{ (basicInfoData&&basicInfoData.warehouseName) || '--' }}
  33. </a-descriptions-item>
  34. <a-descriptions-item label="费用/调拨退货类型">
  35. <AllocateType
  36. id="allocateEdit-allocateReturnTypeSn"
  37. style="width: 220px;"
  38. v-model="allocateTypeVal"
  39. :allowClear="false"
  40. placeholder="请选择费用/调拨退货类型"
  41. @change="changeAllocateType"></AllocateType>
  42. </a-descriptions-item>
  43. <a-descriptions-item label="是否抓单">{{ (basicInfoData&&basicInfoData.grabFlagDictValue) || '--' }}</a-descriptions-item>
  44. <a-descriptions-item label="业务状态">{{ (basicInfoData&&basicInfoData.stateDictValue) || '--' }}</a-descriptions-item>
  45. <a-descriptions-item label="备注">
  46. {{ (basicInfoData&&basicInfoData.remarks) }}
  47. <a-icon type="form" title="编辑备注" @click="editRemark = true" style="color: dodgerblue;font-size: 14px;" />
  48. </a-descriptions-item>
  49. </a-descriptions>
  50. </a-card>
  51. <!-- 选择产品 -->
  52. <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
  53. <a-collapse :activeKey="['1']">
  54. <a-collapse-panel key="1" :forceRender="true" header="选择产品">
  55. <!-- 筛选条件 -->
  56. <div class="table-page-search-wrapper">
  57. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  58. <a-row :gutter="15">
  59. <a-col :md="6" :sm="24">
  60. <a-form-item label="产品编码" prop="productCode">
  61. <a-input id="allocateBillEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
  62. </a-form-item>
  63. </a-col>
  64. <a-col :md="6" :sm="24">
  65. <a-form-item label="产品名称" prop="productName">
  66. <a-input id="allocateBillEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
  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="storeTransferOutList-refresh">查询</a-button>
  71. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="storeTransferOutList-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. index="0"
  82. tableId="table1"
  83. :rowKey="(record) => record.stockSn"
  84. :columns="columns"
  85. :customRow="handleClickRow"
  86. :data="loadData"
  87. :scroll="{ y: 300 }"
  88. :defaultLoadData="false"
  89. bordered>
  90. <!-- 退货单价 -->
  91. <template slot="returnPrice" slot-scope="text, record">
  92. <div @dblclick.stop>
  93. <a-input-number
  94. size="small"
  95. v-model="record.productPrice"
  96. :precision="2"
  97. :min="0"
  98. :max="999999"
  99. placeholder="请输入"
  100. style="width: 100%;" />
  101. </div>
  102. </template>
  103. <!-- 退货数量 -->
  104. <template slot="returnQty" slot-scope="text, record">
  105. <div @dblclick.stop>
  106. <a-input-number
  107. size="small"
  108. v-model="record.qty"
  109. :precision="0"
  110. :min="1"
  111. :max="999999"
  112. placeholder="请输入"
  113. style="width: 100%;" />
  114. </div>
  115. </template>
  116. <!-- 操作 -->
  117. <template slot="action" slot-scope="text, record">
  118. <a-button
  119. size="small"
  120. type="link"
  121. v-if="record.lastStockCost"
  122. class="button-primary"
  123. @click="handleAdd(record)"
  124. id="allocateBillEdit-add-btn">添加</a-button>
  125. <span v-else>--</span>
  126. </template>
  127. </s-table>
  128. </a-collapse-panel>
  129. </a-collapse>
  130. </a-card>
  131. <!-- 已选产品 -->
  132. <a-card size="small" :bordered="false" class="allocateBillEdit-cont">
  133. <a-collapse :activeKey="['2']">
  134. <a-collapse-panel key="2" :forceRender="true" header="已选产品">
  135. <!-- 总计 -->
  136. <a-alert type="info" style="margin-bottom:10px">
  137. <div slot="message">
  138. 退货总数量:<strong>{{ (basicInfoData&&(basicInfoData.totalQty || basicInfoData.totalQty==0)) ? basicInfoData.totalQty : '--' }}</strong>
  139. <span>退货总金额:<strong>{{ (basicInfoData&&(basicInfoData.totalPrice || basicInfoData.totalPrice==0)) ? toThousands(basicInfoData.totalPrice) : '--' }}</strong></span>
  140. </div>
  141. </a-alert>
  142. <!-- 筛选条件 -->
  143. <a-row :gutter="15">
  144. <a-col :span="17">
  145. <div class="table-page-search-wrapper">
  146. <a-form layout="inline" @keyup.enter.native="$refs.chooseTable.refresh(true)">
  147. <a-row :gutter="15">
  148. <a-col :md="9" :sm="24">
  149. <a-form-item label="产品编码" prop="productCode">
  150. <a-input id="editGrap-productCode" v-model.trim="chooseQueryParam.productCode" placeholder="请输入产品编码" allowClear />
  151. </a-form-item>
  152. </a-col>
  153. <a-col :md="9" :sm="24">
  154. <a-form-item label="产品名称" prop="productName">
  155. <a-input id="editGrap-productName" v-model.trim="chooseQueryParam.productName" placeholder="请输入产品名称" allowClear />
  156. </a-form-item>
  157. </a-col>
  158. <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
  159. <a-button type="primary" @click="$refs.chooseTable.refresh(true)" :disabled="chooseDisabled" id="storeTransferOutList-refresh">查询</a-button>
  160. <a-button style="margin-left: 8px" @click="chooseResetSearchForm" :disabled="chooseDisabled" id="storeTransferOutList-reset">重置</a-button>
  161. </a-col>
  162. </a-row>
  163. </a-form>
  164. </div>
  165. </a-col>
  166. <a-col :span="7" style="text-align: right;">
  167. <!-- <a-button size="small" id="editGrap-import-btn" @click="openGuideModal=true">导入产品</a-button> -->
  168. <!-- <a-button size="small" type="danger" style="margin-left: 5px" @click.stop="handleDel('', 'all')" id="chainTransferOutEdit-del-all-btn">整单删除</a-button> -->
  169. </a-col>
  170. </a-row>
  171. <!-- 列表 -->
  172. <s-table
  173. class="sTable"
  174. ref="chooseTable"
  175. size="small"
  176. index="1"
  177. tableId="table2"
  178. :rowKey="(record) => record.id"
  179. :columns="chooseColumns"
  180. :data="chooseLoadData"
  181. :scroll="{ y: 300 }"
  182. :defaultLoadData="false"
  183. bordered>
  184. <!-- 退货单价 -->
  185. <template slot="returnPrice" slot-scope="text, record">
  186. <a-input-number
  187. size="small"
  188. v-model="record.price"
  189. :precision="2"
  190. :min="0"
  191. :max="999999"
  192. @blur="e => priceChange(e.target.value, record)"
  193. placeholder="请输入"
  194. style="width: 100%;" />
  195. </template>
  196. <!-- 退货数量 -->
  197. <template slot="returnQty" slot-scope="text, record">
  198. <a-input-number
  199. size="small"
  200. v-model="record.returnQty"
  201. :precision="0"
  202. :min="1"
  203. :max="999999"
  204. @blur="e => qtyBlur(e.target.value, record)"
  205. placeholder="请输入"
  206. style="width: 100%;" />
  207. </template>
  208. <!-- 操作 -->
  209. <template slot="action" slot-scope="text, record">
  210. <a-button size="small" type="link" class="button-error" @click="handleDel(record)" id="allocateBillEdit-del-btn">删除</a-button>
  211. </template>
  212. </s-table>
  213. </a-collapse-panel>
  214. </a-collapse>
  215. </a-card>
  216. <!-- </a-spin> -->
  217. </div>
  218. <div class="affix-cont">
  219. <a-button
  220. type="primary"
  221. id="allocateBillEdit-submit"
  222. size="large"
  223. :disabled="spinning"
  224. class="button-primary"
  225. @click="handleSubmit"
  226. style="padding: 0 60px;">提交</a-button>
  227. </div>
  228. <!-- 导入产品 -->
  229. <!-- <importGuideModal :openModal="openGuideModal" :params="{allocateReturnSn: $route.params.sn}" @close="openGuideModal=false" @ok="handleGuideOk" /> -->
  230. <!-- 修改基础信息 -->
  231. <a-modal
  232. centered
  233. wrapClassName="allocateBill-editRemark-modal"
  234. v-if="basicInfoData"
  235. :footer="null"
  236. :maskClosable="false"
  237. title="修改备注"
  238. v-model="editRemark"
  239. @cancel="editRemark = false"
  240. :width="600">
  241. <a-textarea
  242. v-model="basicInfoData.remarks"
  243. placeholder="请输入备注(最多120个字符)"
  244. :maxLength="120"
  245. :auto-size="{ minRows: 3, maxRows: 5 }"
  246. />
  247. <div class="btn-cont">
  248. <a-button type="primary" id="allocateBill-basicInfo-modal-save" @click="handleEditRemark">保存</a-button>
  249. <a-button id="allocateBill-basicInfo-modal-back" @click="editRemark = false" style="margin-left: 15px;">取消</a-button>
  250. </div>
  251. </a-modal>
  252. </div>
  253. </template>
  254. <script>
  255. import { commonMixin } from '@/utils/mixin'
  256. import { STable, VSelect } from '@/components'
  257. // import ImportGuideModal from './importGuideModal.vue'
  258. import print from './print.vue'
  259. import warehouse from '@/views/common/chooseWarehouse.js'
  260. import { queryStockProductPage } from '@/api/stock'
  261. import AllocateType from '@/views/common/allocateType.js'
  262. import {
  263. allocateReturnSave,
  264. allocReturnDetailQueryPage,
  265. allocateReturnQueryBySn,
  266. allocReturnDetailInsert,
  267. allocReturnDetailUpdate,
  268. allocateReturnSubmit,
  269. allocReturnDetailDelete
  270. // allocateBillBatchInsert
  271. } from '@/api/allocateReturn'
  272. export default {
  273. name: 'TransferReturnEdit',
  274. mixins: [commonMixin],
  275. components: { STable, VSelect, print, AllocateType, warehouse },
  276. data () {
  277. const _this = this
  278. return {
  279. spinning: false,
  280. queryParam: {
  281. productCode: '',
  282. productName: '',
  283. productOrigCode: ''
  284. },
  285. chooseQueryParam: {
  286. productCode: '',
  287. productName: ''
  288. },
  289. editRemark: false,
  290. disabled: false, // 查询、重置按钮是否可操作
  291. loading: false,
  292. chooseDisabled: false, // 查询、重置按钮是否可操作
  293. advanced: false, // 高级搜索 展开/关闭
  294. // 加载数据方法 必须为 Promise 对象
  295. loadData: parameter => {
  296. this.disabled = true
  297. const dealerLevel = this.$route.params.dealerLevel == 'OTHER' ? undefined : this.$route.params.dealerLevel
  298. const warehouseSn = this.basicInfoData.warehouseSn
  299. return queryStockProductPage(Object.assign(parameter, this.queryParam, { dealerLevel: dealerLevel == 0 ? '' : dealerLevel, warehouseSn: warehouseSn })).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.loadDataSource = data.list || []
  307. this.disabled = false
  308. return data
  309. })
  310. },
  311. loadDataSource: [],
  312. localDataSource: [],
  313. // 加载数据方法 必须为 Promise 对象
  314. chooseLoadData: parameter => {
  315. this.chooseDisabled = true
  316. const params = Object.assign(parameter, { product: { name: this.chooseQueryParam.productName, code: this.chooseQueryParam.productCode }, allocateReturnSn: this.$route.params.sn })
  317. return allocReturnDetailQueryPage(params).then(res => {
  318. const data = res.data
  319. const no = (data.pageNo - 1) * data.pageSize
  320. for (var i = 0; i < data.list.length; i++) {
  321. data.list[i].no = no + i + 1
  322. data.list[i].qtyBackups = data.list[i].returnQty
  323. data.list[i].oldPrice = data.list[i].price
  324. }
  325. this.localDataSource = data.list || []
  326. this.chooseDisabled = false
  327. return data
  328. })
  329. },
  330. basicInfoData: null, // 基本信息
  331. openGuideModal: false, // 导入产品引导
  332. openModal: false,
  333. nowType: null,
  334. allocateTypeVal: [],
  335. showDetail: true
  336. }
  337. },
  338. computed: {
  339. columns () {
  340. const arr = [
  341. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  342. { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
  343. { title: '产品名称', dataIndex: 'productName', align: 'left', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
  344. { title: '单位', dataIndex: 'productUnit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  345. { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'right' },
  346. { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '10%', align: 'center' },
  347. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  348. ]
  349. return arr
  350. },
  351. chooseColumns () {
  352. const _this = this
  353. const arr = [
  354. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  355. { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'left', customRender: function (text) { return text || '--' } },
  356. { title: '产品名称', dataIndex: 'product.name', align: 'left', width: '29%', customRender: function (text) { return text || '--' }, ellipsis: true },
  357. { title: '单位', dataIndex: 'product.unit', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  358. { title: '退货单价', scopedSlots: { customRender: 'returnPrice' }, width: '10%', align: 'right' },
  359. { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: '10%', align: 'center' },
  360. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  361. ]
  362. arr.splice(6, 0, { title: '退货金额', dataIndex: 'totalReturnPrice', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
  363. return arr
  364. }
  365. },
  366. methods: {
  367. // 修改备注
  368. handleEditRemark (flag) {
  369. const _this = this
  370. const params = _this.basicInfoData
  371. allocateReturnSave(params).then(res => {
  372. if (res.status == 200) {
  373. _this.$message.success(res.message)
  374. _this.getDetail(flag)
  375. } else {
  376. _this.spinning = false
  377. }
  378. })
  379. _this.editRemark = false
  380. },
  381. // 修改仓库
  382. updateWarehouse (warehouseSn) {
  383. this.basicInfoData.warehouseSn = warehouseSn
  384. this.handleEditRemark(true)
  385. },
  386. // 修改调拨类型
  387. changeAllocateType (val, opt) {
  388. console.log(val, opt, '------------')
  389. const _this = this
  390. this.allocateTypeVal = val
  391. this.basicInfoData.costTypeSn = val[0] ? val[0] : ''
  392. this.basicInfoData.allocateSortSn = val[1] ? val[1] : ''
  393. this.basicInfoData.allocateReturnTypeSn = val[2] ? val[2] : ''
  394. // 名称
  395. this.basicInfoData.costTypeName = opt[0] ? opt[0].name : ''
  396. this.basicInfoData.allocateSortName = opt[1] ? opt[1].name : ''
  397. this.basicInfoData.allocateReturnTypeName = opt[2] ? opt[2].name : ''
  398. this.$confirm({
  399. title: '提示',
  400. content: '确定要更改调拨退货类型吗?',
  401. centered: true,
  402. onOk () {
  403. _this.handleEditRemark()
  404. },
  405. onCancel () {
  406. _this.getDetail(false)
  407. }
  408. })
  409. },
  410. // 重置
  411. resetSearchForm () {
  412. this.queryParam.productCode = ''
  413. this.queryParam.productName = ''
  414. this.queryParam.productOrigCode = ''
  415. this.$refs.table.refresh(true)
  416. },
  417. // 双击快速添加
  418. handleClickRow (record) {
  419. return {
  420. on: {
  421. dblclick: (event) => {
  422. this.handleAdd(record)
  423. }
  424. }
  425. }
  426. },
  427. // 导入产品
  428. // handleGuideOk (obj) {
  429. // allocateBillBatchInsert(obj).then(res => {
  430. // if (res.status == 200) {
  431. // this.$refs.chooseTable.refresh(true)
  432. // }
  433. // })
  434. // },
  435. // 已选产品 重置
  436. chooseResetSearchForm () {
  437. this.chooseQueryParam.productCode = ''
  438. this.chooseQueryParam.productName = ''
  439. this.$refs.chooseTable.refresh(true)
  440. },
  441. // 添加/编辑
  442. handleAdd (row, isEdit, isRefresh) {
  443. const params = {
  444. allocateReturnSn: this.$route.params.sn,
  445. productSn: row.productSn,
  446. price: isEdit ? row.price : row.productPrice,
  447. returnQty: isEdit ? row.returnQty : row.qty,
  448. cost: isEdit ? row.cost : row.lastStockCost
  449. }
  450. const fun = isEdit ? allocReturnDetailUpdate : allocReturnDetailInsert
  451. if (isEdit) { // 编辑
  452. // 清空数量时,值应保持未清空前的值,因数量不可为空
  453. if (!row.returnQty) {
  454. row.returnQty = row.qtyBackups
  455. return
  456. }
  457. if (!row.price) {
  458. row.price = row.oldPrice
  459. return
  460. }
  461. params.oldPrice = row.oldPrice
  462. params.allocateReturnDetailSn = row.allocateReturnDetailSn
  463. }
  464. this.spinning = true
  465. fun(params).then(res => {
  466. if (res.status == 200) {
  467. this.getDetail(false)
  468. this.$message.success(res.message)
  469. if (isRefresh != 'noRefresh') {
  470. this.$refs.table.refresh()
  471. }
  472. this.$refs.chooseTable.refresh()
  473. this.spinning = false
  474. } else {
  475. this.spinning = false
  476. }
  477. })
  478. },
  479. // 删除
  480. handleDel (row, isAll) {
  481. const _this = this
  482. const content = isAll ? '删除后不可恢复,确定要进行整单删除吗?' : '删除后不可恢复,确定要进行删除吗?'
  483. this.$confirm({
  484. title: '提示',
  485. content: content,
  486. centered: true,
  487. onOk () {
  488. if (isAll) { // 整单删除
  489. // allocateBillDetailDelAll({ sn: _this.$route.params.sn }).then(res => {
  490. // if (res.status == 200) {
  491. // _this.$message.success(res.message)
  492. // _this.refashPage()
  493. // }
  494. // })
  495. } else { // 单个删除
  496. allocReturnDetailDelete({
  497. allocateReturnSn: _this.$route.params.sn,
  498. allocateDetailSn: row.allocateDetailSn,
  499. price: row.price,
  500. productSn: row.productSn
  501. }).then(res => {
  502. if (res.status == 200) {
  503. _this.$message.success(res.message)
  504. _this.refashPage()
  505. }
  506. })
  507. }
  508. }
  509. })
  510. },
  511. // 提交
  512. handleSubmit () {
  513. const _this = this
  514. if (this.localDataSource.length == 0) {
  515. _this.$message.error('请先选择产品!')
  516. return
  517. }
  518. _this.spinning = true
  519. allocateReturnSubmit({ allocateReturnSn: this.$route.params.sn }).then(res => {
  520. if (res.status == 200) {
  521. this.$message.success(res.message)
  522. setTimeout(() => {
  523. _this.handleBack()
  524. _this.spinning = false
  525. }, 1000)
  526. } else {
  527. _this.spinning = false
  528. }
  529. })
  530. },
  531. // 基本信息
  532. getDetail (flag) {
  533. this.spinning = true
  534. allocateReturnQueryBySn({ allocateReturnSn: this.$route.params.sn }).then(res => {
  535. if (res.status == 200) {
  536. this.basicInfoData = res.data
  537. if (this.basicInfoData.costTypeSn) {
  538. this.allocateTypeVal = [this.basicInfoData.costTypeSn, this.basicInfoData.allocateSortSn, this.basicInfoData.allocateReturnTypeSn]
  539. }
  540. if (flag) {
  541. this.$refs.table.refresh()
  542. }
  543. } else {
  544. this.basicInfoData = null
  545. }
  546. this.spinning = false
  547. })
  548. },
  549. // 返回列表
  550. handleBack () {
  551. this.$router.push({ name: 'transferReturnList', query: { closeLastOldTab: true } })
  552. },
  553. // 已选产品 退货数量 blur
  554. qtyBlur (val, record) {
  555. // 光标移出,值发生改变再调用编辑接口
  556. if (val != record.qtyBackups) {
  557. this.handleAdd(record, 'edit')
  558. }
  559. },
  560. // 已选产品 退货单价 change
  561. priceChange (val, record) {
  562. // 光标移出,值发生改变再调用编辑接口
  563. if (val != record.oldPrice) {
  564. this.handleAdd(record, 'edit', 'noRefresh')
  565. }
  566. },
  567. // 刷新当前页面
  568. refashPage () {
  569. this.getDetail(true)
  570. this.$refs.chooseTable.refresh()
  571. },
  572. pageInit () {
  573. this.refashPage()
  574. }
  575. },
  576. mounted () {
  577. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  578. this.pageInit()
  579. }
  580. },
  581. activated () {
  582. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  583. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  584. this.pageInit()
  585. }
  586. },
  587. beforeRouteEnter (to, from, next) {
  588. next(vm => {})
  589. }
  590. }
  591. </script>
  592. <style lang="less">
  593. .allocateBillEdit-wrap{
  594. position: relative;
  595. height: 100%;
  596. box-sizing: border-box;
  597. >.ant-spin-nested-loading{
  598. overflow-y: scroll;
  599. height: 100%;
  600. padding-bottom: 51px;
  601. }
  602. .allocateBillEdit-back{
  603. margin-bottom: 10px;
  604. }
  605. .allocateBillEdit-cont{
  606. margin-bottom: 10px;
  607. .sub-title{
  608. font-size: 12px;
  609. color: #808695;
  610. margin-left: 10px;
  611. }
  612. .tag-txt{
  613. font-size: 12px;
  614. color: #ed1c24;
  615. }
  616. .edit-circle-btn{
  617. margin-left: 15px;
  618. i{
  619. vertical-align: text-bottom;
  620. }
  621. }
  622. .import-btn{
  623. margin-left: 15px;
  624. }
  625. }
  626. }
  627. .allocateBill-editRemark-modal{
  628. .btn-cont{
  629. text-align: center;
  630. padding-top: 20px;
  631. }
  632. }
  633. </style>