index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="`${mainData.sonum}`"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. turnPageId="20221224180302"
  9. idname="sa_orderid"
  10. ownertable="sa_order"
  11. tags=""
  12. :statusCheck="[
  13. { key: 'status', value: '审核' },
  14. { key: 'status', value: '提交' },
  15. { key: 'status', value: '关闭' },
  16. ]"
  17. :tabs="[
  18. '订单明细',
  19. '基本信息',
  20. '订单进度',
  21. '物流单',
  22. '发票记录',
  23. '收支明细',
  24. ]"
  25. @pageChange="pageChange"
  26. @onEditSuccess="queryMainData($route.query.id)"
  27. >
  28. <div slot="customOperation" class="inline-16">
  29. <Edit
  30. class="inline-16"
  31. v-if="
  32. tool.checkAuth($route.name, 'update') && mainData.status == '新建'
  33. "
  34. :data="mainData"
  35. @onSuccess="
  36. queryMainData();
  37. $refs.prod && $refs.prod.listData();
  38. "
  39. />
  40. <el-button
  41. :disabled="mainData.status !== '交期待确认'"
  42. type="primary"
  43. size="mini"
  44. @click="confirmdate"
  45. >{{$t('确认交期')}}</el-button
  46. >
  47. <el-button
  48. class="inline-16"
  49. v-if="tool.checkAuth($route.name, 'submit')"
  50. :disabled="mainData.status !== '新建' || mainData.qty === 0"
  51. type="primary"
  52. size="mini"
  53. @click="onSubmit('提交')"
  54. >{{$t('提 交')}}</el-button
  55. >
  56. <customBtn
  57. btnName="撤回"
  58. message="确认撤回当前订单吗?"
  59. idName="20230301190202"
  60. keyName="sa_orderid"
  61. :id="$route.query.id"
  62. @onSuccess="queryMainData"
  63. class="inline-16"
  64. v-if="
  65. mainData.status == '提交' && tool.checkAuth($route.name, 'reback')
  66. "
  67. />
  68. <el-button
  69. style="margin-left: 0px"
  70. v-else-if="tool.checkAuth($route.name, 'insert')"
  71. type="primary"
  72. size="mini"
  73. @click="onCopy"
  74. >{{$t('复 制')}}</el-button
  75. >
  76. <customBtn
  77. style="margin-left: 10px; display: inline-block !important"
  78. btnName="删 除"
  79. message="确认删除当前订单吗?"
  80. idName="20221108152102"
  81. keyName="sa_orderids"
  82. :id="[$route.query.id]"
  83. @onSuccess="$router.back()"
  84. v-if="
  85. mainData.status == '新建' && tool.checkAuth($route.name, 'delete')
  86. "
  87. />
  88. </div>
  89. <template #headerBottom>
  90. <div style="display: flex" v-if="Object.keys(mainData).length > 0">
  91. <div class="account_info">
  92. <div>
  93. <p class="normal-title" style="margin-bottom: 10px">{{$t('支付信息')}}</p>
  94. </div>
  95. <div class="reveive__panel inline-16">
  96. <p class="flex-align-center">
  97. <small>{{ $t("结算企业") }}:</small>&nbsp;<b>{{
  98. mainData.finance.enterprisename
  99. }}</b>
  100. </p>
  101. <div class="flex-align-center">
  102. <p class="inline-16">
  103. <small>{{ $t("账户名称") }}:&nbsp;</small
  104. >{{
  105. mainData.accountclass.accountname
  106. ? $t(mainData.accountclass.accountname)
  107. : $t("未选择账户")
  108. }}
  109. </p>
  110. <p class="inline-16">
  111. <small>{{ $t("账户余额") }}:&nbsp;</small
  112. ><b
  113. >¥{{
  114. tool.formatAmount(
  115. mainData.accountclass.balance
  116. ? mainData.accountclass.balance
  117. : 0,
  118. 2
  119. )
  120. }}</b
  121. >
  122. </p>
  123. <p>
  124. <small>{{ $t("信用额度") }}:&nbsp;</small
  125. >{{
  126. mainData.accountclass.creditquota
  127. ? tool.formatAmount(mainData.accountclass.creditquota, 2)
  128. : tool.formatAmount(mainData.accountclass.creditquota)
  129. }}
  130. </p>
  131. &nbsp;
  132. <p>
  133. <small>{{ $t("本单金额") }}:&nbsp;</small
  134. >{{
  135. mainData.rebate_used
  136. ? tool.formatAmount(
  137. mainData.defaultamount - rebateamount,
  138. 2
  139. )
  140. : tool.formatAmount(mainData.defaultamount)
  141. }}
  142. </p>
  143. </div>
  144. <div
  145. v-if="
  146. (mainData.type === '标准订单' ||
  147. mainData.type === '特殊订单') &&
  148. isusedrebate === 1
  149. "
  150. >
  151. <div v-if="checked" class="flex-align-center">
  152. <p class="inline-16">
  153. <small>{{ $t("返利金余额") }}:&nbsp;</small
  154. ><b>{{ tool.formatAmount(mainData.rebatebalance, 2) }}</b>
  155. </p>
  156. <p class="inline-16">
  157. <small>{{ $t("已使用返利金金额") }}:&nbsp;</small
  158. ><b>{{ tool.formatAmount(mainData.rebateamount, 2) }}</b>
  159. </p>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="address_info">
  165. <div>
  166. <p class="normal-title" style="margin-bottom: 10px">
  167. {{ $t("收货信息") }}
  168. </p>
  169. </div>
  170. <div class="reveive__panel inline-16">
  171. <div>
  172. <p class="inline-16">
  173. <b>{{ mainData.contactsEnterprise.enterprisename }}</b>
  174. </p>
  175. <p class="inline-16">
  176. <span class="inline-16"
  177. ><b>{{ mainData.contacts.name }}</b></span
  178. ><small>{{ mainData.contacts.phonenumber }}</small>
  179. </p>
  180. </div>
  181. <small
  182. >{{
  183. mainData.contacts.province
  184. ? mainData.contacts.province
  185. : "--"
  186. }}{{ mainData.contacts.city }}{{ mainData.contacts.county
  187. }}{{
  188. mainData.contacts.address ? mainData.contacts.address : ""
  189. }}</small
  190. >
  191. </div>
  192. </div>
  193. </div>
  194. </template>
  195. <!-- 基本信息 -->
  196. <div slot="slot1">
  197. <default-info :mainData="mainData"></default-info>
  198. </div>
  199. <!-- 订单明细 -->
  200. <div slot="slot0">
  201. <product-list
  202. :data="mainData"
  203. ref="prod"
  204. @select="select"
  205. @qtyChange="queryMainData"
  206. @onSuccess="queryMainData"
  207. >
  208. <div slot="operation">
  209. <importFile
  210. v-if="tool.checkAuth($route.name, 'importOrderMx')"
  211. class="inline-16"
  212. :bindData="{
  213. ownertable: 'sa_order',
  214. ownerid: $route.query.id,
  215. usetype: 'default',
  216. }"
  217. :errorUrl="errorUrl"
  218. @clearUrl="errorUrl = null"
  219. @onSuccess="bindImportOrder"
  220. ></importFile>
  221. <el-button class="inline-16" :disabled="mainData.status !== '审核' || selection.length === 0" size="small" type="primary" @click="adddispatch">{{$t(`一键发货`)}}</el-button>
  222. </div>
  223. </product-list>
  224. </div>
  225. <!-- 订单进度 -->
  226. <div slot="slot2">
  227. <orderprogress></orderprogress>
  228. </div>
  229. <!-- 居间费明细 -->
  230. <!-- <div slot="slot3">
  231. <rebat></rebat>
  232. </div>-->
  233. <!-- <div slot="slot4">
  234. <dispatch></dispatch>
  235. </div> -->
  236. <!-- 物流单 -->
  237. <div slot="slot3">
  238. <logistics></logistics>
  239. </div>
  240. <!-- 发票记录 -->
  241. <div slot="slot4">
  242. <invoiceTable></invoiceTable>
  243. </div>
  244. <!-- 收支明细 -->
  245. <div slot="slot5">
  246. <revenue :data="mainData"></revenue>
  247. </div>
  248. </basicDetails>
  249. <el-dialog
  250. append-to-body
  251. :title="$t(`退回原因`)"
  252. :visible.sync="dialogVisible"
  253. width="400px"
  254. >
  255. <el-input
  256. v-model="backreason"
  257. type="textarea"
  258. :placeholder="$t(`请输入退回原因`)"
  259. ></el-input>
  260. <span slot="footer" class="dialog-footer">
  261. <el-button @click="dialogVisible = false" size="small">{{
  262. $t("取 消")
  263. }}</el-button>
  264. <el-button type="primary" @click="onRebanck" size="small">{{
  265. $t("确 定")
  266. }}</el-button>
  267. </span>
  268. </el-dialog>
  269. </div>
  270. </template>
  271. <script>
  272. import Edit from "../modules/edit";
  273. import defaultInfo from "./tabs/defaultInfo.vue";
  274. import productList from "../modules/productlist.vue";
  275. import rebat from "./tabs/rebatesettlement.vue";
  276. import orderprogress from "./tabs/orderpProgress.vue";
  277. import logistics from "./tabs/logistics.vue";
  278. import dispatch from "./tabs/dispatch.vue";
  279. import invoiceTable from "./tabs/invoiceTable.vue";
  280. import revenue from "./tabs/revenueAndExp.vue";
  281. import importFile from "../modules/importFile.vue";
  282. export default {
  283. name: "detail",
  284. data() {
  285. return {
  286. mainData: {},
  287. mainAreaData: {},
  288. backreason: "",
  289. dialogVisible: false,
  290. errorUrl: null,
  291. isusedrebate: "",
  292. checked: 0,
  293. rebateamount: "",
  294. typeNew:'',
  295. selection:[]
  296. };
  297. },
  298. provide() {
  299. return {
  300. thisDetail: () => this,
  301. };
  302. },
  303. components: {
  304. Edit,
  305. defaultInfo,
  306. productList,
  307. rebat,
  308. orderprogress,
  309. dispatch,
  310. logistics,
  311. invoiceTable,
  312. revenue,
  313. importFile,
  314. },
  315. methods: {
  316. async queryMainData(id) {
  317. if (this.typeNew == '提交'){
  318. const res = await this.$api.requested({
  319. id: type === "审核" ? 20221108153502 : 20221108153402,
  320. content: {
  321. sa_orderid: this.mainData.sa_orderid,
  322. sys_enterpriseid: this.mainData.sys_enterpriseid,
  323. sa_accountclassid: this.mainData.accountclass.sa_accountclassid,
  324. },
  325. });
  326. this.tool.showMessage(res, async () => {
  327. this.typeNew = ''
  328. this.queryMainData();
  329. });
  330. }else {
  331. return new Promise(async (re, rj) => {
  332. const res = await this.$api.requested({
  333. id: "20221108151302",
  334. content: {
  335. nocache: true,
  336. sa_orderid: this.$route.query.id,
  337. },
  338. });
  339. this.mainData = res.data;
  340. this.checked = this.mainData.rebate_used;
  341. if (this.mainData.rebateamount > this.mainData.defaultamount) {
  342. this.rebateamount = this.tool.formatAmount(
  343. +this.mainData.defaultamount / 2
  344. );
  345. } else {
  346. this.rebateamount = this.mainData.rebateamount;
  347. }
  348. this.changeDataStructure();
  349. this.queryUsedrebate();
  350. re();
  351. });
  352. }
  353. },
  354. changeDataStructure() {
  355. let that = this;
  356. this.mainAreaData = [
  357. {
  358. label: "订单类型",
  359. value: this.mainData.type,
  360. },
  361. {
  362. label: "订单状态",
  363. value: this.$t(this.mainData.status),
  364. style: function () {
  365. let style = {};
  366. switch (that.mainData.status) {
  367. case "新建":
  368. style = { color: "#3874f6" };
  369. break;
  370. case "提交":
  371. style = { color: "#67c23a" };
  372. break;
  373. case "交期待确认":
  374. style = { color: "#f56c6c" };
  375. break;
  376. case "交期确认":
  377. style = { color: "#67C23A" };
  378. break;
  379. case "审核":
  380. style = { color: "#e6a23c" };
  381. break;
  382. case "关闭":
  383. style = { color: "#ccc" };
  384. break;
  385. default:
  386. break;
  387. }
  388. return style;
  389. },
  390. },
  391. {
  392. label: "单据日期",
  393. value: this.mainData.billdate,
  394. },
  395. {
  396. label: "合计数量",
  397. value: this.mainData.qty,
  398. style: function () {
  399. let style = { color: "#ff0000" };
  400. return style;
  401. },
  402. },
  403. {
  404. // {{tool.formatAmount(scope.row.marketprice,2)}}
  405. label: "合计金额",
  406. value: this.tool.formatAmount(this.mainData.defaultamount, 2),
  407. style: function () {
  408. let style = { color: "#ff0000" };
  409. return style;
  410. },
  411. },
  412. {
  413. label: "折后金额",
  414. value: this.tool.formatAmount(this.mainData.amount, 2),
  415. style: function () {
  416. let style = { color: "#ff0000" };
  417. return style;
  418. },
  419. },
  420. /*{
  421. label:'企业名称',
  422. value:this.mainData.enterprisename
  423. },*/
  424. {
  425. label: "销售分类",
  426. value: this.mainData.saletype,
  427. },
  428. {
  429. label: "备注",
  430. value: this.mainData.remarks,
  431. },
  432. {
  433. label: "核销状态",
  434. value: this.mainData.writeoffstatus,
  435. style:function () {
  436. let style = {}
  437. switch (that.mainData.writeoffstatus) {
  438. case '已核销':
  439. style = {color:"#67c23a"}
  440. break;
  441. case '部分核销':
  442. style = {color:"#e6a23c"}
  443. break;
  444. case '未核销':
  445. style = {color:"#f56c6c"}
  446. break;
  447. default:
  448. break;
  449. }
  450. return style
  451. }
  452. },
  453. {
  454. label: "开票状态",
  455. value: this.mainData.invoicestatus,
  456. style:function () {
  457. let style = {}
  458. switch (that.mainData.invoicestatus) {
  459. case '已开票':
  460. style = {color:"#67c23a"}
  461. break;
  462. case '部分开票':
  463. style = {color:"#e6a23c"}
  464. break;
  465. case '未开票':
  466. style = {color:"#f56c6c"}
  467. break;
  468. default:
  469. break;
  470. }
  471. return style
  472. }
  473. },
  474. {
  475. label: "运费状态",
  476. value: this.$t(this.mainData.freightstatus),
  477. },
  478. {
  479. label: "项目名称",
  480. value: this.mainData.projectname,
  481. },
  482. {
  483. label: "项目备注",
  484. value: this.mainData.projectnote,
  485. },
  486. {
  487. label: "退回原因",
  488. value: this.mainData.backreason,
  489. },
  490. ];
  491. },
  492. // 监听切换数据,上一页,下一页
  493. pageChange(id, rowindex, tabIndex) {
  494. this.$router.replace({
  495. path: "/agent_orderDetails",
  496. query: { id: id, rowindex: rowindex },
  497. });
  498. this.queryMainData(id);
  499. },
  500. // 提交审核订单
  501. onSubmit(type) {
  502. this.$confirm(
  503. this.$t("是否") + `“${this.$t(type)}”` + this.$t("该订单"),
  504. this.$t("提示"),
  505. {
  506. confirmButtonText: this.$t("确定"),
  507. cancelButtonText: this.$t("取消"),
  508. type: "warning",
  509. }
  510. )
  511. .then(async () => {
  512. if (this.$refs.prod.time == null){
  513. const res = await this.$api.requested({
  514. id: type === "审核" ? 20221108153502 : 20221108153402,
  515. content: {
  516. sa_orderid: this.mainData.sa_orderid,
  517. sys_enterpriseid: this.mainData.sys_enterpriseid,
  518. sa_accountclassid: this.mainData.accountclass.sa_accountclassid,
  519. },
  520. });
  521. this.tool.showMessage(res, async () => {
  522. this.queryMainData();
  523. });
  524. }else {
  525. this.typeNew = type
  526. }
  527. })
  528. .catch((err) => {
  529. this.$message({
  530. type: "info",
  531. message: err,
  532. });
  533. });
  534. },
  535. // 查询站点是否使用返利金
  536. async queryUsedrebate() {
  537. const res = await this.$api.requested({
  538. classname: "webmanage.site.site",
  539. method: "querySite_Parameter",
  540. content: {},
  541. });
  542. this.isusedrebate = res.data.order_rebate_used;
  543. console.log(this.isusedrebate);
  544. },
  545. // 反审核订单
  546. onReturnCheck() {
  547. this.$confirm(this.$t(`是否反审核该订单`), this.$t("提示"), {
  548. confirmButtonText: this.$t("确定"),
  549. cancelButtonText: this.$t("取消"),
  550. type: "warning",
  551. })
  552. .then(async () => {
  553. const res = await this.$api.requested({
  554. id: 20230102141502,
  555. content: {
  556. sa_orderid: this.mainData.sa_orderid,
  557. },
  558. });
  559. this.tool.showMessage(res, () => {
  560. this.queryMainData();
  561. });
  562. })
  563. .catch((err) => {
  564. this.$message({
  565. type: "info",
  566. message: err,
  567. });
  568. });
  569. },
  570. async onRebanck() {
  571. const res = await this.$api.requested({
  572. id: 20221108161902,
  573. content: {
  574. sys_enterpriseid: this.mainData.sys_enterpriseid,
  575. sa_accountclassid: this.mainData.accountclass.sa_accountclassid,
  576. sa_orderid: this.mainData.sa_orderid,
  577. backreason: this.backreason, //退回原因,可选
  578. },
  579. });
  580. this.tool.showMessage(res, () => {
  581. this.queryMainData();
  582. this.dialogVisible = false;
  583. });
  584. },
  585. async closeOrder() {
  586. const res = await this.$api.requested({
  587. id: 20221108164502,
  588. content: {
  589. sa_orderids: [this.$route.query.id],
  590. },
  591. });
  592. this.tool.showMessage(res, () => {
  593. this.queryMainData();
  594. this.dialogVisible = false;
  595. });
  596. },
  597. async confirmdate() {
  598. const res = await this.$api.requested({
  599. id: 20221230094802,
  600. content: {
  601. sa_orderid: this.$route.query.id,
  602. },
  603. });
  604. this.tool.showMessage(res, () => {
  605. this.queryMainData();
  606. });
  607. },
  608. async onCopy() {
  609. const res = await this.$api.requested({
  610. id: 20230102144502,
  611. content: {
  612. sa_orderid: this.$route.query.id,
  613. },
  614. });
  615. this.tool.showMessage(res, () => {
  616. let route = this.$route;
  617. if (route.path !== "/taskDetails") {
  618. this.oldRoute = { path: route.path, query: route.query };
  619. this.$store.dispatch("setHistoryRouter", this.oldRoute);
  620. }
  621. this.$router.replace({
  622. path: "/agent_orderDetails",
  623. query: { id: res.data.sa_orderid, rowindex: res.data.rowindex },
  624. });
  625. this.queryMainData(this.$route.query.id);
  626. });
  627. },
  628. reback() {
  629. this.$confirm(this.$t("确定撤回订单吗?"), this.$t("提示"), {
  630. confirmButtonText: this.$t("确定"),
  631. cancelButtonText: this.$t("取消"),
  632. type: "warning",
  633. })
  634. .then(async () => {
  635. const res = await this.$api.requested({
  636. id: 20230301190202,
  637. content: {
  638. sa_orderid: this.$route.query.id,
  639. },
  640. });
  641. this.tool.showMessage(res, () => {
  642. this.mainData();
  643. });
  644. })
  645. .catch(() => {
  646. this.$message({
  647. type: "info",
  648. message: this.$t("已取消"),
  649. });
  650. });
  651. },
  652. async bindImportOrder(id) {
  653. console.log(id);
  654. const res = await this.$api.requested({
  655. id: 20230227194803,
  656. content: {
  657. sa_orderid: this.$route.query.id,
  658. attachmentid: id,
  659. },
  660. });
  661. this.$refs["prod"].listData();
  662. if (res.data !== "成功") {
  663. this.errorUrl = res.data;
  664. }
  665. this.queryMainData();
  666. },
  667. select (data) {
  668. this.selection = data
  669. },
  670. async adddispatch () {
  671. const res = await this.$api.requested({
  672. "id": "20230220100604",
  673. "content": {
  674. "sa_orderid":this.mainData.sa_orderid,
  675. "sa_orderitemsids": this.selection.map(e=>{
  676. return e.sa_orderitemsid
  677. })
  678. }
  679. })
  680. this.tool.showMessage(res,()=>{
  681. let route = this.$route
  682. this.oldRoute = {path:route.path,query:route.query}
  683. this.$store.dispatch('setHistoryRouter',this.oldRoute)
  684. this.$router.replace({path:'/dispatchdetail',query:{id:res.data.sa_dispatchid,rowindex:res.data.rowindex}})
  685. })
  686. },
  687. },
  688. mounted() {
  689. this.queryMainData(this.$route.query.id);
  690. },
  691. created() {},
  692. };
  693. </script>
  694. <style scoped>
  695. .reveive__panel {
  696. font-size: 16px;
  697. line-height: 30px;
  698. padding: 0 10px;
  699. background: #d9ecff;
  700. border: 1px dashed #0676e7;
  701. }
  702. </style>