retail_detail.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. <template>
  2. <div class="detail-container">
  3. <div v-show="!isShowCheckOrder">
  4. <el-page-header content="详情" @back="goBack" />
  5. <div class="main-title">
  6. <div class="title">提货进度</div>
  7. </div>
  8. <div class="progress-container">
  9. <el-progress
  10. :text-inside="true"
  11. :stroke-width="26"
  12. :percentage="
  13. detailData.thjd ? ((detailData.thjd * 1000) / 10).toFixed(2) : 0
  14. "
  15. />
  16. </div>
  17. <div class="main-title">
  18. <div class="title">订单信息</div>
  19. </div>
  20. <div class="diy-table-1">
  21. <el-row>
  22. <el-col :span="8" class="item">
  23. <div class="label">订单号</div>
  24. <div class="value">{{ detailData.id }}</div>
  25. </el-col>
  26. <el-col :span="8" class="item">
  27. <div class="label">订单日期</div>
  28. <div class="value">{{ detailData.theTime }}</div>
  29. </el-col>
  30. <el-col :span="8" class="item">
  31. <div class="label">单据状态</div>
  32. <div class="value">{{ detailData.examineStatus | statusFilter }}</div>
  33. </el-col>
  34. <el-col :span="16" class="item">
  35. <div class="label">备注</div>
  36. <div class="value">{{ detailData.remark }}</div>
  37. </el-col>
  38. <el-col :span="8" class="item">
  39. <div class="label">业务员</div>
  40. <div class="value">{{ detailData.serviceName }}</div>
  41. </el-col>
  42. <el-col :span="8" class="item">
  43. <div class="label">制单人</div>
  44. <div class="value">{{ detailData.createName }}</div>
  45. </el-col>
  46. <el-col :span="8" class="item">
  47. <div class="label">制单日期</div>
  48. <div class="value">{{ detailData.createTime }}</div>
  49. </el-col>
  50. <el-col :span="8" class="item">
  51. <div class="label">审核人</div>
  52. <div class="value">{{ detailData.examineName }}</div>
  53. </el-col>
  54. <el-col :span="8" class="item">
  55. <div class="label">审核日期</div>
  56. <div class="value">{{ detailData.examineTime }}</div>
  57. </el-col>
  58. <el-col :span="8" class="item">
  59. <div class="label">关闭人</div>
  60. <div class="value">{{ detailData.closeName }}</div>
  61. </el-col>
  62. <el-col :span="8" class="item">
  63. <div class="label">关闭日期</div>
  64. <div class="value">{{ detailData.closeTime }}</div>
  65. </el-col>
  66. </el-row>
  67. </div>
  68. <div class="main-title">
  69. <div class="title">货品信息</div>
  70. </div>
  71. <div class="table" style="margin-top: 20px">
  72. <el-table
  73. :data="detailData.retailOrderItemList"
  74. element-loading-text="Loading"
  75. border
  76. fit
  77. highlight-current-row
  78. stripe
  79. max-height="400"
  80. show-summary
  81. :summary-method="$getSummaries"
  82. >
  83. <el-table-column align="center" label="序号" type="index" width="50" />
  84. <el-table-column
  85. align="center"
  86. label="销售类型"
  87. prop="saleTypeName"
  88. min-width="100"
  89. show-overflow-tooltip
  90. />
  91. <el-table-column
  92. align="center"
  93. label="产品编码"
  94. prop="materialCode"
  95. min-width="160"
  96. show-overflow-tooltip
  97. />
  98. <el-table-column
  99. align="center"
  100. label="产品名称"
  101. prop="materialName"
  102. min-width="160"
  103. show-overflow-tooltip
  104. />
  105. <el-table-column
  106. align="center"
  107. label="规格型号"
  108. prop="specification"
  109. min-width="160"
  110. show-overflow-tooltip
  111. />
  112. <el-table-column
  113. align="center"
  114. label="单位"
  115. prop="unit"
  116. min-width="100"
  117. show-overflow-tooltip
  118. />
  119. <el-table-column
  120. align="center"
  121. label="单价"
  122. prop="price"
  123. min-width="100"
  124. show-overflow-tooltip
  125. >
  126. <template slot-scope="scope">
  127. {{ scope.row.price | numToFixed }}
  128. </template>
  129. </el-table-column>
  130. <el-table-column
  131. align="center"
  132. label="数量"
  133. prop="qty"
  134. min-width="100"
  135. show-overflow-tooltip
  136. />
  137. <el-table-column
  138. align="center"
  139. label="订单金额"
  140. prop="totalAmount"
  141. min-width="100"
  142. show-overflow-tooltip
  143. >
  144. <template slot-scope="scope">
  145. {{ scope.row.totalAmount | numToFixed }}
  146. </template>
  147. </el-table-column>
  148. <el-table-column
  149. align="center"
  150. label="返利类型"
  151. prop="customerWalletName2"
  152. min-width="100"
  153. show-overflow-tooltip
  154. >
  155. <template slot-scope="scope">
  156. <!-- v-for="item in scope.row.rebateWallets" -->
  157. <el-tag
  158. v-if="scope.row.customerWalletName2"
  159. type="success"
  160. size="small"
  161. >
  162. {{ scope.row.customerWalletName2 }}
  163. </el-tag>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. align="center"
  168. label="返利金额"
  169. prop="payRebateAmount"
  170. min-width="100"
  171. show-overflow-tooltip
  172. >
  173. <template slot-scope="scope">
  174. {{ scope.row.payRebateAmount | numToFixed }}
  175. </template>
  176. </el-table-column>
  177. <el-table-column
  178. align="center"
  179. label="格力折扣"
  180. prop="totalDiscAmount"
  181. min-width="100"
  182. show-overflow-tooltip
  183. >
  184. <template slot-scope="scope">
  185. {{ scope.row.totalDiscAmount | numToFixed }}
  186. </template>
  187. </el-table-column>
  188. <el-table-column
  189. align="center"
  190. label="现金钱包"
  191. prop="customerWalletName"
  192. min-width="100"
  193. show-overflow-tooltip
  194. >
  195. <template slot-scope="scope">
  196. <!-- v-for="item in scope.row.wallets" -->
  197. <el-tag type="success" size="small">
  198. {{ scope.row.customerWalletName }}
  199. </el-tag>
  200. </template>
  201. </el-table-column>
  202. <el-table-column
  203. align="center"
  204. label="实付金额"
  205. prop="payAmount"
  206. min-width="100"
  207. show-overflow-tooltip
  208. >
  209. <template slot-scope="scope">
  210. {{ scope.row.payAmount | numToFixed }}
  211. </template>
  212. </el-table-column>
  213. <el-table-column
  214. align="center"
  215. label="是否直调"
  216. prop="isDirectTransfer"
  217. min-width="100"
  218. show-overflow-tooltip
  219. >
  220. <template slot-scope="scope">
  221. {{ scope.row.isDirectTransfer ? "是" : "否" }}
  222. </template>
  223. </el-table-column>
  224. <el-table-column
  225. align="center"
  226. label="直调数量"
  227. prop="directTransferQty"
  228. min-width="100"
  229. show-overflow-tooltip
  230. />
  231. <!-- <el-table-column
  232. align="center"
  233. label="已退数量"
  234. prop="retiredQty"
  235. min-width="100"
  236. show-overflow-tooltip
  237. ></el-table-column> -->
  238. <el-table-column
  239. align="center"
  240. label="原订单数量"
  241. prop="oldQty"
  242. min-width="100"
  243. show-overflow-tooltip
  244. />
  245. <el-table-column
  246. align="center"
  247. label="备注"
  248. prop="remark"
  249. min-width="160"
  250. show-overflow-tooltip
  251. />
  252. <el-table-column
  253. align="center"
  254. label="税率"
  255. prop="tax"
  256. min-width="100"
  257. show-overflow-tooltip
  258. />
  259. </el-table>
  260. </div>
  261. <div>
  262. <div class="main-title">
  263. <div class="title">审批记录</div>
  264. </div>
  265. <div class="diy-table-1">
  266. <el-row :gutter="0">
  267. <el-col :span="12" class="item">
  268. <div class="label">审批人</div>
  269. <div class="value">{{ detailData.examineName }}</div>
  270. </el-col>
  271. <el-col :span="12" class="item">
  272. <div class="label">审批结果</div>
  273. <div class="value">
  274. {{ detailData.examineStatus | statusFilter }}
  275. </div>
  276. </el-col>
  277. <el-col :span="24" class="item">
  278. <div class="label">审批说明</div>
  279. <div class="value">{{ detailData.examineRemark }}</div>
  280. </el-col>
  281. </el-row>
  282. </div>
  283. </div>
  284. </div>
  285. <div class="page-footer">
  286. <div class="footer" :class="classObj">
  287. <el-button type="success" @click="toCheckOrder">联查单据</el-button>
  288. <el-button
  289. :type="status ? 'info' : 'primary'"
  290. :disabled="detailData.examineStatus !== 'OK' || status"
  291. @click="openDeliverDialog"
  292. >直调发货</el-button>
  293. <el-button
  294. v-if="isCustomer"
  295. :type="status ? 'info' : 'primary'"
  296. :disabled="detailData.examineStatus !== 'OK' || status"
  297. @click="handleFinish"
  298. >直调完成</el-button>
  299. <!-- <el-button @click="goBack">关 闭</el-button> -->
  300. </div>
  301. </div>
  302. <el-dialog title="直调发货" :visible.sync="isShowDeliverDialog" width="80%">
  303. <el-form
  304. ref="deliverForm"
  305. :model="deliverForm"
  306. :rules="deliverFormRules"
  307. label-width="80px"
  308. size="small"
  309. label-position="left"
  310. >
  311. <el-row :gutter="20">
  312. <el-col :xs="8" :sm="8" :lg="8" style="height: 51px">
  313. <el-form-item label="发货日期" prop="date">
  314. <el-date-picker
  315. v-model="deliverForm.date"
  316. type="date"
  317. value-format="yyyy-MM-dd"
  318. style="width: 100%"
  319. placeholder="选择日期"
  320. />
  321. </el-form-item>
  322. </el-col>
  323. <!-- <el-col :xs="8" :sm="8" :lg="8">-->
  324. <!-- <el-form-item label="发货仓库" prop="warehouse">-->
  325. <!-- <el-select-->
  326. <!-- v-model="deliverForm.warehouse"-->
  327. <!-- placeholder="请选择发货仓库"-->
  328. <!-- style="width: 100%"-->
  329. <!-- filterable-->
  330. <!-- @change="changeWarehouse"-->
  331. <!-- >-->
  332. <!-- <el-option-->
  333. <!-- v-for="item in warehouseList"-->
  334. <!-- :key="item.id"-->
  335. <!-- :label="item.name"-->
  336. <!-- :value="item.id"-->
  337. <!-- />-->
  338. <!-- </el-select>-->
  339. <!-- </el-form-item>-->
  340. <!-- </el-col>-->
  341. <el-col :xs="8" :sm="8" :lg="8">
  342. <el-form-item label="选择仓位" prop="position">
  343. <el-select
  344. v-model="deliverForm.position"
  345. placeholder="请选择仓位"
  346. style="width: 100%"
  347. filterable
  348. >
  349. <el-option
  350. v-for="item in positionList"
  351. :key="item.id"
  352. :label="item.name"
  353. :value="item.id"
  354. />
  355. </el-select>
  356. </el-form-item>
  357. </el-col>
  358. </el-row>
  359. </el-form>
  360. <div class="table" style="margin-top: 20px">
  361. <el-table
  362. :data="goodsList"
  363. element-loading-text="Loading"
  364. border
  365. fit
  366. highlight-current-row
  367. stripe
  368. max-height="400"
  369. show-summary
  370. :summary-method="$getSummaries"
  371. >
  372. <el-table-column
  373. align="center"
  374. label="序号"
  375. type="index"
  376. width="50"
  377. />
  378. <el-table-column
  379. align="center"
  380. label="销售类型"
  381. prop="saleTypeName"
  382. min-width="100"
  383. show-overflow-tooltip
  384. />
  385. <el-table-column
  386. align="center"
  387. label="产品编码"
  388. prop="materialCode"
  389. min-width="160"
  390. show-overflow-tooltip
  391. />
  392. <el-table-column
  393. align="center"
  394. label="产品名称"
  395. prop="materialName"
  396. min-width="160"
  397. show-overflow-tooltip
  398. />
  399. <el-table-column
  400. align="center"
  401. label="规格型号"
  402. prop="specification"
  403. min-width="160"
  404. show-overflow-tooltip
  405. />
  406. <el-table-column
  407. align="center"
  408. label="单位"
  409. prop="unit"
  410. min-width="100"
  411. show-overflow-tooltip
  412. />
  413. <el-table-column
  414. align="center"
  415. label="订单数量"
  416. prop="refundableQty"
  417. min-width="100"
  418. show-overflow-tooltip
  419. />
  420. <el-table-column
  421. align="center"
  422. label="发货数量"
  423. prop="hasSendQty"
  424. min-width="100"
  425. show-overflow-tooltip
  426. />
  427. <el-table-column
  428. align="center"
  429. label="直调数量"
  430. prop="adjustNum"
  431. min-width="100"
  432. show-overflow-tooltip
  433. >
  434. <template slot-scope="scope">
  435. <el-input
  436. v-model="scope.row.adjustNum"
  437. size="small"
  438. type="number"
  439. :disabled="!scope.row.isDirectTransfer"
  440. />
  441. </template>
  442. </el-table-column>
  443. <el-table-column
  444. align="center"
  445. label="单价"
  446. prop="price"
  447. min-width="100"
  448. show-overflow-tooltip
  449. >
  450. <template slot-scope="scope">
  451. {{ scope.row.price | numToFixed }}
  452. </template>
  453. </el-table-column>
  454. <el-table-column
  455. align="center"
  456. label="金额"
  457. prop="totalAmount"
  458. min-width="100"
  459. show-overflow-tooltip
  460. >
  461. <template slot-scope="scope">
  462. {{ scope.row.totalAmount | numToFixed }}
  463. </template>
  464. </el-table-column>
  465. <el-table-column
  466. align="center"
  467. label="返利"
  468. prop="payRebateAmount"
  469. min-width="100"
  470. show-overflow-tooltip
  471. >
  472. <template slot-scope="scope">
  473. {{ scope.row.payRebateAmount | numToFixed }}
  474. </template>
  475. </el-table-column>
  476. <el-table-column
  477. align="center"
  478. label="备注"
  479. prop="remark"
  480. min-width="160"
  481. show-overflow-tooltip
  482. />
  483. </el-table>
  484. </div>
  485. <span slot="footer" class="dialog-footer">
  486. <el-button @click="closeDeliverDialog">取 消</el-button>
  487. <el-button type="primary" @click="submitDeliverForm">确 定</el-button>
  488. </span>
  489. </el-dialog>
  490. <CheckOrder :checkOrderId="checkOrderId" v-if="isShowCheckOrder" @backDetail="backDetail" />
  491. </div>
  492. </template>
  493. <script>
  494. import { getDetail } from '@/api/supply/policy'
  495. import { adjustDeliver, finishData, getPositionList, getWarehouseList } from '@/api/supply/retail'
  496. import { mapState } from 'vuex'
  497. import CheckOrder from '@/components/Common/check-order'
  498. export default {
  499. name: 'RetailDetail',
  500. componentName: 'RetailDetail',
  501. components: {
  502. CheckOrder,
  503. },
  504. filters: {
  505. statusFilter(val) {
  506. const statusList = [
  507. { label: '已保存', value: 'SAVE' },
  508. { label: '待审核', value: 'WAIT' },
  509. { label: '审核通过', value: 'OK' },
  510. { label: '审核驳回', value: 'FAIL' }
  511. ]
  512. const obj = statusList.find((o) => o.value == val)
  513. return obj ? obj.label : ''
  514. }
  515. },
  516. props: ['listItem'],
  517. data() {
  518. return {
  519. detailData: {},
  520. isShowDeliverDialog: false,
  521. deliverForm: {
  522. date: '',
  523. warehouse: '',
  524. position: ''
  525. },
  526. deliverFormRules: {
  527. date: [
  528. { required: true, message: '请选择发货日期', trigger: 'change' }
  529. ],
  530. position: [
  531. { required: true, message: '请选择虚拟仓位', trigger: 'change' }
  532. ],
  533. },
  534. warehouseList: [],
  535. positionList: [],
  536. goodsList: [],
  537. status: false,
  538. checkOrderId: {},
  539. isShowCheckOrder: false,
  540. }
  541. },
  542. computed: {
  543. sidebar() {
  544. return this.$store.state.app.sidebar
  545. },
  546. classObj() {
  547. return {
  548. hideSidebar: !this.sidebar.opened,
  549. openSidebar: this.sidebar.opened
  550. }
  551. },
  552. isExamine() {
  553. return (
  554. this.detailData.examineStatus === 'OK' ||
  555. this.detailData.examineStatus === 'FAIL'
  556. )
  557. },
  558. isDealer() {
  559. return JSON.parse(localStorage.getItem("supply_user")).isCustomer
  560. },
  561. progress() {
  562. if (this.detailData.totalQty == 0) return 0
  563. return (this.detailData.takeQty * 100) / (this.detailData.totalQty * 100)
  564. },
  565. ...mapState({
  566. isCustomer: ({ user }) => {
  567. return !(user.customerName || user.customerNumber)
  568. }
  569. })
  570. },
  571. created() {
  572. this.getDetail()
  573. },
  574. methods: {
  575. // 返回列表
  576. goBack() {
  577. this.$emit('backListFormDetail')
  578. },
  579. // 是否直调完成
  580. directTransferStatus(val) {
  581. this.status = val.retailOrderItemList.some((k) => {
  582. return k.directTransferStatus == true
  583. })
  584. console.log(this.status, '4554545')
  585. },
  586. // 获取详情
  587. getDetail() {
  588. getDetail({ id: this.listItem.id }).then((res) => {
  589. if (res.data.retailOrderItemList) {
  590. res.data.retailOrderItemList.forEach((item) => {
  591. item.sums1 = [
  592. 'directTransferQty',
  593. 'qty',
  594. 'refundableQty',
  595. 'oldQty'
  596. ]
  597. item.sums2 = [
  598. 'totalAmount',
  599. 'payAmount',
  600. 'price',
  601. 'payRebateAmount',
  602. 'discAmount',
  603. 'totalDiscAmount'
  604. ]
  605. })
  606. }
  607. this.detailData = res.data
  608. this.directTransferStatus(res.data)
  609. })
  610. },
  611. // 直调完成
  612. handleFinish() {
  613. this.$confirm('此操作将直调完成, 是否继续?', '提示', {
  614. confirmButtonText: '确定',
  615. cancelButtonText: '取消',
  616. type: 'warning'
  617. })
  618. .then(() => {
  619. finishData({
  620. id: this.listItem.id
  621. }).then((res) => {
  622. this.$successMsg()
  623. this.getDetail()
  624. })
  625. })
  626. .catch(() => {})
  627. },
  628. // 获取仓库列表
  629. getWarehouseList() {
  630. getWarehouseList({
  631. pageNum: 1,
  632. pageSize: -1
  633. }).then((res) => {
  634. this.warehouseList = res.data.records
  635. })
  636. },
  637. // 更改仓库
  638. changeWarehouse() {
  639. this.deliverForm.position = ''
  640. const obj = this.warehouseList.find(
  641. (o) => o.id == this.deliverForm.warehouse
  642. )
  643. this.positionList = obj.kingDeeStocks
  644. },
  645. // 打开 直调发货
  646. openDeliverDialog() {
  647. this.isShowDeliverDialog = true
  648. this.goodsList = this.detailData.retailOrderItemList
  649. this.getPositionList()
  650. },
  651. // 获取虚拟仓位列表
  652. getPositionList() {
  653. getPositionList({
  654. pageNum: 1,
  655. pageSize: -1,
  656. stockType: 1
  657. }).then(res => {
  658. this.positionList = res.data.records;
  659. })
  660. },
  661. // 关闭 直调发货
  662. closeDeliverDialog() {
  663. this.isShowDeliverDialog = false
  664. },
  665. // 联查单据
  666. toCheckOrder() {
  667. this.checkOrderId = this.detailData.id;
  668. this.isShowCheckOrder = true;
  669. },
  670. backDetail() {
  671. this.isShowCheckOrder = false;
  672. },
  673. // 提交 直调发货
  674. submitDeliverForm() {
  675. this.$refs.deliverForm.validate((valid) => {
  676. if (valid) {
  677. for (let i = 0; i < this.goodsList.length; i++) {
  678. if (
  679. !this.goodsList[i].adjustNum &&
  680. this.goodsList[i].isDirectTransfer
  681. ) {
  682. this.$errorMsg('请输入直调数量')
  683. return
  684. }
  685. }
  686. const goodsList = this.goodsList.map((item) => {
  687. return {
  688. itemId: item.id,
  689. qty: item.adjustNum || 0
  690. }
  691. })
  692. const params = {
  693. orderNo: this.listItem.id,
  694. orderDate: this.deliverForm.date + ' 00:00:00',
  695. correspondId: this.deliverForm.warehouse,
  696. stockId: this.deliverForm.position,
  697. directItems: goodsList
  698. }
  699. adjustDeliver(params).then((res) => {
  700. this.$successMsg()
  701. this.isShowDeliverDialog = false
  702. this.getDetail()
  703. })
  704. }
  705. })
  706. }
  707. }
  708. }
  709. </script>
  710. <style scoped lang="scss">
  711. .detail-container {
  712. width: 100%;
  713. height: 100%;
  714. margin-bottom: 50px;
  715. }
  716. .main-title {
  717. display: flex;
  718. justify-content: space-between;
  719. align-items: center;
  720. margin-top: 20px;
  721. height: 60px;
  722. border-bottom: 1px solid #dcdfe6;
  723. margin-bottom: 20px;
  724. .title {
  725. font-size: 16px;
  726. font-weight: 600;
  727. padding-left: 10px;
  728. }
  729. }
  730. .progress-container {
  731. display: flex;
  732. .el-progress {
  733. width: 500px;
  734. }
  735. }
  736. .page-footer{
  737. height: 0;
  738. }
  739. </style>