orderDetailPart.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. <template>
  2. <div class="order-detail-part">
  3. <div
  4. v-if="isLoading == 1"
  5. v-loading="true"
  6. class="com-loading"></div>
  7. <template v-else-if="isLoading == 2">
  8. <!-- <div class="eco-tip" v-if="orderDetail.Emission_Total_Kg && orderDetail.Emission_Total_Kg != '0'">
  9. <div class="eco-tip-title">
  10. <img
  11. src="@/assets/img/esg/leaf.png"
  12. alt="eco"
  13. class="eco-tip-icon" />
  14. <span> Protecting Nature Starts with Your Choice</span>
  15. </div>
  16. <div class="eco-tip-desc">
  17. Your Eco-Friendly Purchase Generated
  18. <span class="eco-tip-co2"
  19. >{{ orderDetail.Emission_Total_Kg || 0 }} KG</span
  20. >
  21. Of Carbon Emissions. Together, We<br />
  22. Embrace Enyironmental Responsibility For A More Sustainable Future.
  23. </div>
  24. </div> -->
  25. <section class="main-header">
  26. <div class="main-header-mid flex between">
  27. <h1>Job Name:{{ orderDetail.Sales_Order_Title_Job_Name }}</h1>
  28. <img
  29. :src="orderDetail.user_logo"
  30. class="user_logo"
  31. v-if="orderDetail.user_logo" />
  32. </div>
  33. <div class="main-header-mid">
  34. <ul class="left">
  35. <li
  36. class="left-i link-div"
  37. v-if="isShow">
  38. <div @click="shareDialogVisible = true">
  39. <i class="el-icon-share"></i>
  40. <span>Client Tracking Share</span>
  41. </div>
  42. <!-- <div v-for="(item) in orderDetail.crm_esg_res?.flat()"
  43. @click="downloadEsg(item)"
  44. :key="item.id">
  45. <img src="@/assets/img/order/cer.png" />
  46. <span> DownLoad {{ item.name }}</span>
  47. </div> -->
  48. </li>
  49. <li
  50. class="left-i"
  51. v-if="orderDetail.crm_pr_res?.length">
  52. <image-list :data="orderDetail.crm_pr_res" />
  53. </li>
  54. </ul>
  55. <ul class="right">
  56. <li v-if="orderDetail.Job_Group && isShow">
  57. Order Type: {{ orderDetail.Job_Group }}
  58. </li>
  59. <li>Order No: {{ orderDetail.Reference }}</li>
  60. <li>
  61. Order Date: {{ formatStepDesc(orderDetail.Sales_Order_Created) }}
  62. </li>
  63. <li v-if="orderDetail.Expected_Delivery_Date">
  64. ETA: {{ formatStepDesc(orderDetail.Expected_Delivery_Date) }}
  65. </li>
  66. <li v-if="isShow">
  67. Payment Status: {{ orderDetail.Payment_Status1 }}
  68. </li>
  69. </ul>
  70. </div>
  71. <div class="steps margin-b-30">
  72. <p class="steps-title margin-b-50">Bulk Production</p>
  73. <el-steps
  74. :active="comOrderState"
  75. align-center
  76. :direction="computedStepDirection"
  77. finish-status="success"
  78. process-status="wait">
  79. <el-step
  80. title="Confirmed"
  81. :description="formatStepDesc(orderDetail.Order_Confirm)">
  82. </el-step>
  83. <el-step
  84. title="In Production"
  85. :description="
  86. formatStepDesc(orderDetail.Sampling_Factory_Confirm)
  87. "></el-step>
  88. <el-step
  89. title="QC Inspection"
  90. :description="formatStepDesc(orderDetail.GZ_WH)"></el-step>
  91. <el-step
  92. title="International Shipment"
  93. :description="
  94. formatStepDesc(orderDetail.International_transshipment)
  95. "></el-step>
  96. <el-step
  97. title="AU Warehouse"
  98. :description="formatStepDesc(orderDetail.AU_WH)"></el-step>
  99. <el-step
  100. :title="
  101. orderDetail.Order_Stage === 'Bulk Production Shipping'
  102. ? 'Domestic Delivery'
  103. : 'Shipped'
  104. "
  105. :description="formatStepDesc(orderDetail.AU_WH_Client)"></el-step>
  106. <el-step
  107. title="Delivered"
  108. :description="formatStepDesc(orderDetail.Delivered)"></el-step>
  109. </el-steps>
  110. </div>
  111. <div
  112. class="steps"
  113. :class="{ 'margin-b-30': stepShow }"
  114. v-if="orderDetail.Sample_Stage">
  115. <p
  116. class="steps-title pointer"
  117. :class="{ 'margin-b-50': stepShow }"
  118. @click="toggleStep">
  119. Sample Dispatch
  120. <i
  121. :class="
  122. stepShow ? 'el-icon-arrow-down' : 'el-icon-arrow-right'
  123. "></i>
  124. </p>
  125. <el-steps
  126. :active="comSampleState"
  127. align-center
  128. :space="180"
  129. v-if="stepShow"
  130. :direction="computedStepDirection"
  131. finish-status="success"
  132. process-status="wait">
  133. <el-step
  134. title="Factory Process"
  135. :description="
  136. formatStepDesc(orderDetail.Sample_Factory_Confirmed)
  137. ">
  138. </el-step>
  139. <el-step
  140. title="Sample Dispatching"
  141. :description="
  142. formatStepDesc(orderDetail.Sample_Dispatching)
  143. "></el-step>
  144. <el-step
  145. title="Sample Delivered"
  146. :description="
  147. formatStepDesc(orderDetail.Sample_Delivered)
  148. "></el-step>
  149. </el-steps>
  150. </div>
  151. </section>
  152. <section class="main-custom">
  153. <p class="sharing-title">Customer information</p>
  154. <div>
  155. <p class="sharing-subtitle">
  156. {{ isShow ? 'Billing' : 'Supplier' }} Address
  157. </p>
  158. <div class="sharing-address">
  159. <p>{{ orderDetail.Account_Name_name }}</p>
  160. <p>{{ orderDetail.Billing_Unit_Building_Name }}</p>
  161. <p>{{ orderDetail.Billing_Street }}</p>
  162. <p>{{ orderDetail.Billing_City }}</p>
  163. <p>{{ orderDetail.Billing_State }}</p>
  164. <p>{{ orderDetail.Billing_Code }}</p>
  165. <p>{{ orderDetail.Billing_Country }}</p>
  166. </div>
  167. </div>
  168. <div>
  169. <p class="sharing-subtitle">Shipping Address</p>
  170. <div class="sharing-address">
  171. <p>{{ orderDetail.Shipping_Unit_Building_Name }}</p>
  172. <p>{{ orderDetail.Shipping_Street }}</p>
  173. <p>{{ orderDetail.Shipping_City }}</p>
  174. <p>{{ orderDetail.Shipping_State }}</p>
  175. <p>{{ orderDetail.Shipping_Code }}</p>
  176. <p>{{ orderDetail.Shipping_Country }}</p>
  177. </div>
  178. </div>
  179. </section>
  180. <section>
  181. <p class="sharing-title">Shipping information</p>
  182. <el-table
  183. :data="orderDetail.shipping_tracking"
  184. style="width: 100%"
  185. :header-cell-style="{
  186. background: '#F7F8FC',
  187. color: '#101010',
  188. fontWeight: 'normal',
  189. }">
  190. <el-table-column
  191. type="expand"
  192. style="padding: 0">
  193. <template slot-scope="props">
  194. <el-table
  195. :data="props.row.test_pkg_details"
  196. style="margin-left: 50px; width: calc(100% - 50px)"
  197. :header-cell-style="{
  198. background: '#F7F8FC',
  199. color: '#101010',
  200. fontWeight: 'normal',
  201. }">
  202. <el-table-column
  203. prop="Product_name"
  204. label="Item & Description"></el-table-column>
  205. <el-table-column
  206. prop="Quantity_to_pack"
  207. label="QTY"
  208. width="450"></el-table-column>
  209. </el-table>
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. prop="Title"
  214. label="Job Name"
  215. width="190"></el-table-column>
  216. <el-table-column
  217. prop="Courier"
  218. label="Carrier"
  219. width="190"></el-table-column>
  220. <el-table-column
  221. prop="Tracking_No"
  222. label="Tracking#"
  223. width="190"></el-table-column>
  224. <el-table-column
  225. prop="Package_Status"
  226. label="Shipment Status"
  227. width="190"></el-table-column>
  228. <el-table-column
  229. label="Delivery Address"
  230. width="250">
  231. <template slot-scope="scope">
  232. <span>
  233. {{ scope.row.Shipping_Unit_Building_Name }}<br />
  234. {{ scope.row.Shipping_Street }}<br />
  235. {{ scope.row.Shipping_City }}<br />
  236. {{ scope.row.Shipping_State }}
  237. </span>
  238. </template>
  239. </el-table-column>
  240. <el-table-column
  241. prop="Tracking_URL"
  242. label=""
  243. width="200">
  244. <template
  245. slot-scope="scope"
  246. v-if="scope.row.Tracking_URL">
  247. <el-button
  248. size="mini"
  249. @click.native="openTracking_URL(scope.row.Tracking_URL)"
  250. style="background-color: rgb(0, 33, 59); color: #fff"
  251. plain
  252. >TRACK SHIPMENT</el-button
  253. ></template
  254. >
  255. </el-table-column>
  256. </el-table>
  257. </section>
  258. <section class="orderTable">
  259. <p class="sharing-title">Products Information</p>
  260. <el-table
  261. :data="orderDetail.sales_orders_details"
  262. style="width: 100%"
  263. :header-cell-style="{
  264. background: '#fff',
  265. color: '#101010',
  266. fontWeight: 'normal',
  267. }">
  268. <el-table-column
  269. type="index"
  270. label="S.NO"
  271. width="70"
  272. fixed>
  273. </el-table-column>
  274. <el-table-column
  275. label="Product Name"
  276. min-width="300">
  277. <template slot-scope="scope">
  278. <p class="colorBlue">{{ scope.row.product_name }}</p>
  279. <!-- <p class="table-list-co2" v-if="scope.row.Emision_Details_value && scope.row.Emision_Details_value != '0'">
  280. <img src="@/assets/img/esg/co2_green.png" alt="CO2" class="co2-icon" />
  281. <span>{{ scope.row.Emision_Details_value }} kg CO₂e</span>
  282. </p> -->
  283. <p v-html="scope.row.product_description"></p>
  284. <!-- <p :class="scope.row.showMore?'ellipsis':''" v-html="scope.row.product_description"></p>
  285. <p class="colorBlue cursor" @click="toggleShow(scope.row)" v-if="scope.row.product_description">{{scope.row.showMore?'Show More':'Conceal'}}<i :class="scope.row.showMore?'el-icon-caret-bottom':'el-icon-caret-top'"></i></p> -->
  286. </template>
  287. </el-table-column>
  288. <el-table-column
  289. prop="quantity"
  290. label="Quantity"
  291. align="left"
  292. :width="isShow ? 125 : 200">
  293. </el-table-column>
  294. <template v-if="isShow">
  295. <el-table-column
  296. prop="list_price"
  297. :label="`List Price(${comCurrency})`"
  298. width="125">
  299. <template slot-scope="scope">
  300. {{ transformNumber(scope.row.list_price) }}
  301. </template>
  302. </el-table-column>
  303. <el-table-column
  304. prop="amount"
  305. :label="`Amount(${comCurrency})`"
  306. width="125">
  307. <template slot-scope="scope">
  308. {{ transformNumber(scope.row.amount) }}
  309. </template>
  310. </el-table-column>
  311. <el-table-column
  312. prop="Tax"
  313. :label="`Tax(${comCurrency})`"
  314. width="125">
  315. <template slot-scope="scope">
  316. {{ transformNumber(scope.row.Tax) }}
  317. </template>
  318. </el-table-column>
  319. <el-table-column
  320. prop="Discount"
  321. :label="`Discount(${comCurrency})`"
  322. width="125">
  323. <template slot-scope="scope">
  324. {{ transformNumber(scope.row.Discount) }}
  325. </template>
  326. </el-table-column>
  327. <el-table-column
  328. prop="net_total"
  329. :label="`Total(${comCurrency})`"
  330. width="125">
  331. <template slot-scope="scope">
  332. {{ transformNumber(scope.row.net_total) }}
  333. </template>
  334. </el-table-column>
  335. </template>
  336. </el-table>
  337. <div
  338. class="table-wrap"
  339. v-if="isShow">
  340. <table class="total">
  341. <tr>
  342. <td>Sub Total</td>
  343. <td>
  344. {{ comCurrency }} {{ transformNumber(orderDetail.Sub_Total) }}
  345. </td>
  346. </tr>
  347. <tr>
  348. <td>Total Taxes</td>
  349. <td>
  350. {{ comCurrency }} {{ transformNumber(orderDetail.Tax_Total) }}
  351. </td>
  352. </tr>
  353. <tr>
  354. <td>Total Discount</td>
  355. <td>
  356. {{ comCurrency }}
  357. {{ transformNumber(orderDetail.Total_Including_Discount) }}
  358. </td>
  359. </tr>
  360. <tr>
  361. <td>Adjustment</td>
  362. <td>
  363. {{ comCurrency }}
  364. {{ transformNumber(orderDetail.Total_Adjustment) }}
  365. </td>
  366. </tr>
  367. <tr>
  368. <td>Grand Total</td>
  369. <td>
  370. {{ comCurrency }} {{ transformNumber(orderDetail.Grand_Total) }}
  371. </td>
  372. </tr>
  373. </table>
  374. </div>
  375. </section>
  376. <!-- <section
  377. v-if="orderDetail.Order_Stage === 'Sales Order Created'" style="text-align: right;border: none;">
  378. <el-button
  379. v-if="orderDetail.Order_Stage === 'Sales Order Created'"
  380. @click="openApproved(orderDetail)"
  381. size="small"
  382. style="background-color: rgb(0, 33, 59); color: #fff;"
  383. plain
  384. >Approved</el-button>
  385. </section> -->
  386. </template>
  387. <div v-else>
  388. <el-empty description="No Data"></el-empty>
  389. </div>
  390. <el-dialog
  391. :lock-scroll="false"
  392. :visible.sync="urlDialogShow"
  393. center
  394. width="850px"
  395. top="20vh">
  396. <iframe
  397. :src="Tracking_URL"
  398. style="width: 100%; height: 500px"
  399. frameborder="0"></iframe>
  400. </el-dialog>
  401. <export-dialog
  402. :emailForm="shareForm"
  403. :visible.sync="shareDialogVisible"
  404. :title="'Client Tracking Share (no pricing displayed)'"
  405. :labelShow="false"></export-dialog>
  406. </div>
  407. </template>
  408. <script>
  409. import throttle from 'lodash.throttle'
  410. import { mapMutations } from 'vuex'
  411. import { round } from '@/utils/price.js'
  412. export default {
  413. name: 'OrderDetailPart',
  414. props: {
  415. isShow: {
  416. // 订单分享页面隐藏元素
  417. type: Boolean,
  418. default: true,
  419. },
  420. hasUid: {
  421. type: Boolean,
  422. default: true,
  423. },
  424. },
  425. data() {
  426. return {
  427. orderDetail: {},
  428. isLoading: 1,
  429. packageTable: [],
  430. stepShow: false,
  431. urlDialogShow: false,
  432. shareDialogVisible: false,
  433. loginCount: 0,
  434. shareForm: {
  435. Link: '',
  436. },
  437. Tracking_URL: '',
  438. stepConfig: {
  439. 'Order Confirmed': 1,
  440. 'Factory Confirmed': 2,
  441. 'GZ WH': 3,
  442. Transshipment: 4,
  443. 'AU WH': 5,
  444. 'AUWH - Client': 6,
  445. 'Bulk Production Shipping': 6,
  446. 'Bulk Production Delivered': 7,
  447. 'Completed Sales Order': 7,
  448. 'Factory Process': 1,
  449. 'Sample Dispatching': 2,
  450. 'Sample Delivered': 3,
  451. },
  452. computedStepDirection: 'horizontal',
  453. }
  454. },
  455. computed: {
  456. loginSuccess() {
  457. return this.$store.state.loginSuccess
  458. },
  459. comCurrency() {
  460. return this.orderDetail.Currency
  461. },
  462. comOrderState() {
  463. if (this.orderDetail.Order_Stage === 'Cancelled') {
  464. return 0
  465. }
  466. return this.stepConfig[this.orderDetail.Order_Stage]
  467. },
  468. comSampleState() {
  469. return this.stepConfig[this.orderDetail.Sample_Stage]
  470. },
  471. },
  472. watch: {
  473. loginSuccess(newVal) {
  474. if (newVal) {
  475. this.getOrderDetail() // 当登录成功后调用获取订单详情
  476. this.$store.commit('setLoginSuccess', false)
  477. }
  478. },
  479. },
  480. beforeMount() {
  481. window.addEventListener('resize', this.judgeStepDirection, false)
  482. this.judgeStepDirection()
  483. },
  484. created() {
  485. this.getOrderDetail()
  486. },
  487. beforeDestroy() {
  488. window.removeEventListener('resize', this.judgeStepDirection, false)
  489. },
  490. methods: {
  491. ...mapMutations({ openDialog: 'openDialog' }),
  492. judgeStepDirection: throttle(function () {
  493. this.computedStepDirection =
  494. window.document.body.clientWidth >= 1000 ? 'horizontal' : 'vertical'
  495. }, 300),
  496. toggleStep() {
  497. this.stepShow = !this.stepShow
  498. },
  499. getOrderDetail() {
  500. let path = ''
  501. let data = {}
  502. if (this.isShow) {
  503. const { id } = this.$store.state.userInfo
  504. const { crm, id: queryId } = this.$route.query
  505. path = '/uk-api/crmdata/orders_detail'
  506. this.shareForm.Link = `https://www.trackship.com.au/orderShare/${id}/${crm}/${queryId}`
  507. data = { accounts_id: crm, id: queryId }
  508. } else {
  509. path = '/uk-api/crmdata/showOrdersDetail'
  510. if (this.hasUid) {
  511. const { uid, aid, id } = this.$route.params
  512. data = { user_id: uid, accounts_id: aid, id }
  513. } else {
  514. const { aid, id } = this.$route.params
  515. data = { accounts_id: aid, id }
  516. }
  517. }
  518. this.$axios
  519. .post(path, data)
  520. .then(res => {
  521. if (res.result === null) {
  522. this.handleBranchLogic()
  523. }
  524. this.orderDetail = res.result
  525. if (this.orderDetail.shipping_tracking?.length) {
  526. const isDelivered = true
  527. for (const items of this.orderDetail.shipping_tracking) {
  528. if (items.test_pkg_details?.length) {
  529. items.test_pkg_details.forEach(item => {
  530. item.Courier = items.Courier
  531. item.Tracking_No = items.Tracking_No
  532. item.Package_Status = items.Package_Status
  533. item.Tracking_URL = items.Tracking_URL
  534. })
  535. }
  536. }
  537. }
  538. if (this.orderDetail.sales_orders_details?.length) {
  539. if (this.isShow) {
  540. this.orderDetail.sales_orders_details.forEach(items => {
  541. this.$set(items, 'showMore', true)
  542. })
  543. } else {
  544. this.orderDetail.sales_orders_details =
  545. this.orderDetail.sales_orders_details
  546. .filter(item => {
  547. return (
  548. item.product_Product_Code !== 'PC Setup Service' &&
  549. item.product_Product_Code !== 'PC Freight'
  550. )
  551. })
  552. .map(item => {
  553. this.$set(item, 'showMore', true)
  554. return item
  555. })
  556. }
  557. }
  558. this.isLoading = 2
  559. })
  560. .catch(() => {
  561. this.handleBranchLogic()
  562. })
  563. },
  564. handleBranchLogic() {
  565. this.isLoading = 3
  566. if (this.loginCount) {
  567. this.$router.push('/')
  568. return
  569. }
  570. this.isShow &&
  571. setTimeout(() => {
  572. this.openDialog()
  573. this.loginCount = 1
  574. }, 1000)
  575. },
  576. transformNumber(value) {
  577. return round(Number(value)).toFixed(2)
  578. },
  579. formatStepDesc(date, isUnix = false) {
  580. return this.$utils.formatTime(date, 'DD/MM/YYYY', isUnix)
  581. },
  582. toggleShow(row) {
  583. row.showMore = !row.showMore
  584. },
  585. openTracking_URL(url) {
  586. this.Tracking_URL = url
  587. this.urlDialogShow = true
  588. },
  589. download(url) {
  590. var urlStr = url.match('[^/]+(?!.*/)')[0]
  591. this.$utils.downloadBlob(url, urlStr)
  592. },
  593. downloadEsg(item) {
  594. if (!item.id) {
  595. this.$message.error('No report available for download')
  596. return
  597. }
  598. this.$axios
  599. .post('Crmdata/downloadreport', { id: item.id, name: item.name })
  600. .then(res => {
  601. if (res.result) {
  602. this.$utils.downloadBlob(
  603. res.result?.data,
  604. decodeURIComponent(res.result?.url_name)
  605. )
  606. } else {
  607. this.$message.error('Download failed, please try again later')
  608. }
  609. })
  610. .catch(() => {
  611. this.$message.error('Download failed, please try again later')
  612. })
  613. },
  614. openApproved(row) {
  615. this.$confirm(
  616. `
  617. <div style="text-align:center;">
  618. <h3 style="margin:0 0 10px;color:#333;">Ready to order?</h3>
  619. <p style="margin:0;font-size:16px;color:#333;">Your total is <b>${this.transformNumber(
  620. row.Grand_Total
  621. )}</b>. Confirm to place your order.</p>
  622. </div>
  623. `,
  624. '',
  625. {
  626. dangerouslyUseHTMLString: true,
  627. confirmButtonText: 'Confirm',
  628. cancelButtonText: 'Cancel',
  629. confirmButtonClass: 'el-button',
  630. cancelButtonClass: 'el-button--info',
  631. center: true,
  632. showClose: false,
  633. confirmButtonClass: 'com-btnblack',
  634. }
  635. ).then(() => {
  636. this.$router.push({
  637. path: '/so-confirm',
  638. query: { id: row.sales_orders_id, pc_psw: row.HASH },
  639. })
  640. })
  641. },
  642. },
  643. }
  644. </script>
  645. <style lang="scss" scoped>
  646. @import '../detail.scss';
  647. </style>