ProductRight.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <template>
  2. <div class="product-right">
  3. <div class="product-right-top">
  4. <div class="title">
  5. <span
  6. class="title-1"
  7. ref="title"
  8. >{{ pageData.alias_name || pageData.product_name }}</span
  9. >
  10. <span class="title-2">{{ pageData.product_code }}</span>
  11. <img
  12. :src="item.images"
  13. v-for="item of pageData.cycle"
  14. :key="item.images"
  15. class="title-3" />
  16. <img
  17. :src="item.url"
  18. v-for="item of pageData.icon"
  19. :key="item.url"
  20. class="title-4" />
  21. </div>
  22. <ul
  23. class="color"
  24. v-if="pageData.main.image_color?.length">
  25. <li
  26. v-for="(item, i) of pageData.main.image_color"
  27. :key="item.id">
  28. <div
  29. class="color-item"
  30. v-if="item.color?.img">
  31. <div
  32. @click="setSmImgUlIdx(computedIndex(i))"
  33. :class="currentPre == computedIndex(i) ? 'slip' : ''">
  34. <el-tooltip
  35. :content="item.color?.name"
  36. placement="top"
  37. effect="dark">
  38. <img
  39. :src="
  40. item.color?.img && !$mediaRegExp.test(item.color?.img)
  41. ? $OSS_PREFIX + item.color?.img
  42. : item.color?.img
  43. " />
  44. </el-tooltip>
  45. </div>
  46. </div>
  47. </li>
  48. </ul>
  49. <tab-nav
  50. :tabList="tabList"
  51. :currTab.sync="typeTab"
  52. :marginTop="15"
  53. :fontSize="16"
  54. :liWidth="130"
  55. :liHeight="40"
  56. :marginRight="5"
  57. :marginBottom="25"
  58. @handle="clickNav" />
  59. </div>
  60. <div class="product-right-bottom">
  61. <div
  62. class="details"
  63. v-show="typeTab == 0">
  64. <div
  65. class="details-1"
  66. v-if="pageData.feature_data">
  67. <h3>Features</h3>
  68. <ul>
  69. <li
  70. v-for="(i, key) in pageData.feature_data"
  71. :key="key">
  72. {{ i }}
  73. </li>
  74. </ul>
  75. </div>
  76. <div
  77. class="details-1"
  78. v-if="comInfo.description">
  79. <h3>Description</h3>
  80. <p v-html="comInfo.description"></p>
  81. </div>
  82. <div
  83. class="details-1"
  84. v-if="pageData.carbon?.length">
  85. <h3>Carbon Footprint Transparency</h3>
  86. <p>
  87. This product has undergone mid-lifecycle carbon footprint assessment. Click the
  88. <span>Carbon Footprint</span> project to view detailed calculations by transport mode;
  89. </p>
  90. <p>
  91. We offer <span>Gold Standard-ceriied carbon offset proiects</span> for neutralization, ensuring full
  92. transparency and compliance with global sustainability standards. Contact us for detailed reports.
  93. </p>
  94. </div>
  95. <div
  96. class="details-2"
  97. v-if="pageData.pbo">
  98. <h3>Product Branding Information</h3>
  99. <p v-html="pageData.pbo"></p>
  100. </div>
  101. <div class="details-3">
  102. <ul
  103. v-if="
  104. comInfo.product_size ||
  105. comInfo.product_material ||
  106. comInfo.moq ||
  107. comInfo.included_packaging ||
  108. comInfo.optional_packaging ||
  109. comInfo.print_size_area ||
  110. comInfo.product_dimensions ||
  111. comInfo.additional_info
  112. ">
  113. <li>
  114. <div class="title">Product Info</div>
  115. </li>
  116. <li v-if="comInfo.product_size">
  117. <div class="point">Product Size</div>
  118. <div
  119. class="info"
  120. v-html="comInfo.product_size"></div>
  121. </li>
  122. <li v-if="pageData.main?.colors_text">
  123. <div class="point">Colour</div>
  124. <div
  125. class="info"
  126. v-html="pageData.main?.colors_text"></div>
  127. </li>
  128. <li v-if="comInfo.product_material">
  129. <div class="point">Material</div>
  130. <div
  131. class="info"
  132. v-html="comInfo.product_material"></div>
  133. </li>
  134. <li v-if="pageData.moq">
  135. <div class="point">MOQ</div>
  136. <div
  137. class="info"
  138. v-html="pageData.moq"></div>
  139. </li>
  140. <li v-if="comInfo.included_packaging">
  141. <div class="point">Included Packaging</div>
  142. <div
  143. class="info blue"
  144. v-for="(item, i) in comIncluded_packaging"
  145. :key="item">
  146. <nuxt-link
  147. v-if="isProduct(item.trim())"
  148. :to="{ name: 'product-code', params: { code: item.trim() } }"
  149. ><span>{{ item }}<em v-if="i < comIncluded_packaging.length - 1">,</em></span></nuxt-link
  150. >
  151. <span v-else>{{ item }}<em v-if="i < comIncluded_packaging.length - 1">,</em></span>
  152. </div>
  153. </li>
  154. <li v-if="comInfo.optional_packaging">
  155. <div class="point">Optional Packaging</div>
  156. <div
  157. class="info blue"
  158. v-for="(item, i) in comOptional_packaging"
  159. :key="item">
  160. <nuxt-link
  161. v-if="isProduct(item.trim())"
  162. :to="{ name: 'product-code', params: { code: item.trim() } }"
  163. ><span>{{ item }}<em v-if="i < comOptional_packaging.length - 1">,</em></span></nuxt-link
  164. >
  165. <span v-else>{{ item }}<em v-if="i < comOptional_packaging.length - 1">,</em></span>
  166. </div>
  167. </li>
  168. <li v-if="comInfo.optional_attachments">
  169. <div class="point">Optional Attachments</div>
  170. <div class="info">
  171. <nuxt-link
  172. :to="{ name: 'product-code', params: { code: item } }"
  173. v-for="(item, i) in comOptional_attachments"
  174. :key="item"
  175. ><span>{{ item }}<em v-if="i < comOptional_attachments.length - 1">,</em></span></nuxt-link
  176. >
  177. </div>
  178. </li>
  179. <li v-if="comInfo.product_dimensions">
  180. <div class="point">Carton Dimensions</div>
  181. <div
  182. class="info"
  183. v-html="comInfo.product_dimensions"></div>
  184. </li>
  185. <li v-if="comInfo.additional_info">
  186. <div class="point">Additional Info</div>
  187. <div
  188. class="info"
  189. v-html="comInfo.additional_info"></div>
  190. </li>
  191. </ul>
  192. <!-- <el-button @click="ticketFormVisible = true"
  193. v-if="isLogin && /\@promocollection.uk/.test(userInfo.email)">Ticket</el-button> -->
  194. <ul v-if="comInfo.print_position || comInfo.print_size_area || comInfo.print_marketing">
  195. <li>
  196. <div class="title">Print Info</div>
  197. </li>
  198. <li v-if="comInfo.print_position">
  199. <div class="point">Print Position</div>
  200. <div
  201. class="info"
  202. v-html="comInfo.print_position"></div>
  203. </li>
  204. <li v-if="comInfo.print_size_area">
  205. <div class="point">Print Size Area</div>
  206. <div
  207. class="info"
  208. v-html="comInfo.print_size_area"></div>
  209. </li>
  210. <li v-if="comInfo.print_marketing">
  211. <div class="point">Print Marketing</div>
  212. <div
  213. class="info"
  214. v-html="comInfo.print_marketing"></div>
  215. </li>
  216. </ul>
  217. <ul
  218. v-if="
  219. comInfo.data_services ||
  220. comInfo.chip_grade ||
  221. comInfo.certifications ||
  222. comInfo.capacity ||
  223. comInfo.warranty ||
  224. comInfo.battery_type ||
  225. comInfo.additional_description
  226. ">
  227. <li>
  228. <div class="title">Functional Info</div>
  229. </li>
  230. <li v-if="comInfo.data_services">
  231. <div class="point">Data Services</div>
  232. <div
  233. class="info"
  234. v-html="comInfo.data_services"></div>
  235. </li>
  236. <li v-if="comInfo.chip_grade">
  237. <div class="point">Chip Grade</div>
  238. <div
  239. class="info"
  240. v-html="comInfo.chip_grade"></div>
  241. </li>
  242. <li v-if="comInfo.certifications">
  243. <div class="point">Certifications</div>
  244. <div
  245. class="info"
  246. v-html="comInfo.certifications"></div>
  247. </li>
  248. <li v-if="comInfo.capacity">
  249. <div class="point">Capacity</div>
  250. <div
  251. class="info"
  252. v-html="comInfo.capacity"></div>
  253. </li>
  254. <li v-if="comInfo.warranty">
  255. <div class="point">Warranty</div>
  256. <div
  257. class="info"
  258. v-html="comInfo.warranty"></div>
  259. </li>
  260. <li v-if="comInfo.battery_type">
  261. <div class="point">Battery Type</div>
  262. <div
  263. class="info"
  264. v-html="comInfo.battery_type"></div>
  265. </li>
  266. <li v-if="comInfo.additional_description">
  267. <div class="point">Additional Info</div>
  268. <div
  269. class="info"
  270. v-html="comInfo.additional_description"></div>
  271. </li>
  272. </ul>
  273. </div>
  274. <p class="details-1">
  275. Due to differences between production batches, product sizes may vary slightly. The above Colours and
  276. measurements are approximate, and for guidance only.
  277. </p>
  278. <!-- <div v-for="(item,index) in pageData.showcase" :key="index" class="showcase">
  279. <a :href="item.url">
  280. <el-image lazy :src="item.images" fit="cover" style="width: 100%; height: 100%"></el-image>
  281. </a>
  282. </div> -->
  283. </div>
  284. <div
  285. class="quote"
  286. v-show="typeTab == 1">
  287. <quote
  288. ref="quote"
  289. :pageData="pageData"
  290. :id="id" />
  291. </div>
  292. <div
  293. class="stock"
  294. v-show="false">
  295. <div v-if="stockData.length > 0">
  296. <stock-table :data="stockData"></stock-table>
  297. <p class="quote-tips">For quantities over available stock levels, please contact us for pricing and timing</p>
  298. </div>
  299. <div
  300. class="quote-tips"
  301. v-else>
  302. This product is made offshore, and is available for any quantity equal to, or above the listed MOQ
  303. </div>
  304. </div>
  305. <div v-show="typeTab == 3">
  306. <h5>Maketing Resource</h5>
  307. <div class="resources maketing">
  308. <p
  309. @click="download(comInfo.line_artwork)"
  310. v-if="comInfo.line_artwork">
  311. <img src="@/assets/img/lineart.png" />Lineart Download
  312. </p>
  313. <p
  314. @click="openLink(pageData.edm_url)"
  315. v-if="pageData.edm_url">
  316. <img src="@/assets/img/email.png" />Email Digital Marketing
  317. </p>
  318. <p
  319. @click="onPreview"
  320. v-if="productImgArr?.length">
  321. <img src="@/assets/img/product.png" />Product Image
  322. </p>
  323. <p
  324. @click="openLink(pageData.cataloque_url)"
  325. v-if="pageData.cataloque_url">
  326. <img src="@/assets/img/cataloque.png" />Catalogue
  327. </p>
  328. <p
  329. @click="download(comInfo.product_instruction)"
  330. v-if="comInfo.product_instruction">
  331. <img src="@/assets/img/instruction.png" />Product Instruction
  332. </p>
  333. </div>
  334. <h5 v-if="pageData.goodsCompliance?.length">Compliance Resource</h5>
  335. <div class="resources compliance">
  336. <img
  337. :src="item.filter?.img"
  338. v-for="(item, i) in pageData.goodsCompliance"
  339. :key="i"
  340. @click="download(item.pic)" />
  341. </div>
  342. </div>
  343. <!-- <div
  344. class="change"
  345. v-show="typeTab == 4">
  346. <change-table :data="pageData.change"></change-table>
  347. </div> -->
  348. </div>
  349. <no-ssr>
  350. <!-- Ticket浮动框 -->
  351. <!-- <form-dialog
  352. title="网页产品问题反馈"
  353. sendbtnCext="提交"
  354. cancelbtnCext="取消"
  355. :labelWidth="90"
  356. :marginBottom="0"
  357. :emailForm="ticketForm"
  358. :enquiryConfig="ticketConfig"
  359. :visible.sync="ticketFormVisible"
  360. @handleSend="sendTicket"
  361. :rules="rules"></form-dialog> -->
  362. <footprint-report-dialog
  363. :visible.sync="footprintVisible"
  364. :carbon="pageData.carbon"></footprint-report-dialog>
  365. <!-- 右侧project浮动框 -->
  366. <project
  367. :productInfo="pageData"
  368. @handleOpenFootprint="footprintVisible = true"></project>
  369. <!-- 加入project弹框 -->
  370. <!-- <project-dialog
  371. :visible.sync="projectdDialogVisible"
  372. :id="pageData.id"
  373. :projectObj="projectObj"
  374. :isCopy="false"></project-dialog> -->
  375. <ElImageViewer
  376. v-if="showViewer"
  377. :on-close="closeViewer"
  378. :url-list="productImgArr" />
  379. </no-ssr>
  380. </div>
  381. </template>
  382. <script>
  383. /*eslint-disable*/
  384. import Quote from './Quote'
  385. import StockTable from '@/components/table/StockTable'
  386. import ChangeTable from '@/components/table/ChangeTable'
  387. import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
  388. import { mapMutations, mapActions } from 'vuex'
  389. export default {
  390. components: { StockTable, ChangeTable, Quote, ElImageViewer },
  391. props: {
  392. pageData: {},
  393. id: Number,
  394. },
  395. // head(){
  396. // return {
  397. // meta: [{ 'http-equiv': "Content-Security-Policy", content: "upgrade-insecure-requests" }]
  398. // }
  399. // },
  400. data() {
  401. return {
  402. tabList: [
  403. {
  404. name: 'Details',
  405. isClick: false,
  406. isShow: true,
  407. },
  408. {
  409. name: 'Quick Quote',
  410. isClick: false,
  411. isShow: false,
  412. },
  413. {
  414. name: 'Stock',
  415. isClick: false,
  416. isShow: false,
  417. },
  418. {
  419. name: 'Resources',
  420. isClick: false,
  421. isShow: true,
  422. },
  423. {
  424. name: 'Changes',
  425. isClick: false,
  426. isShow: false,
  427. },
  428. ],
  429. typeTab: 0,
  430. stockData: [],
  431. showViewer: false,
  432. projectdDialogVisible: false,
  433. projectObj: {
  434. decoration_id: '',
  435. },
  436. // ticketFormVisible:false,
  437. ticketForm: {
  438. 英文品名: this.pageData.alias_name || this.pageData.product_name,
  439. SKU: this.pageData.product_code,
  440. 问题类型: [],
  441. 反馈详情: '',
  442. },
  443. ticketConfig: [
  444. { prop: '英文品名', type: 'text' },
  445. { prop: 'SKU', type: 'text' },
  446. {
  447. prop: '问题类型',
  448. type: 'checkbox',
  449. selectlist: ['网页信息', '供应商质量', '样品管理', '产品部管理'],
  450. },
  451. { prop: '反馈详情', type: 'textarea' },
  452. ],
  453. rules: {
  454. 问题类型: [{ required: true, message: 'Please select', trigger: 'change' }],
  455. 反馈详情: [{ required: true, message: 'Please enter', trigger: 'blur' }],
  456. },
  457. footprintVisible: false,
  458. }
  459. },
  460. computed: {
  461. currentPre() {
  462. return this.$store.state.product.smImgUlIdx
  463. },
  464. isLogin() {
  465. return !!this.$store.state.userInfo?.email
  466. },
  467. comInfo() {
  468. return this.pageData?.main
  469. },
  470. productImgArr() {
  471. return this.comInfo.mergeImages
  472. },
  473. userInfo() {
  474. return this.$store.state.userInfo
  475. },
  476. comIncluded_packaging() {
  477. return this.comInfo.included_packaging.split(',')
  478. },
  479. comOptional_packaging() {
  480. return this.comInfo.optional_packaging.split(',')
  481. },
  482. comOptional_attachments() {
  483. return this.comInfo.optional_attachments.split(',')
  484. },
  485. },
  486. watch: {
  487. //登陆立即显示Quick Quote和Changes选项
  488. isLogin: {
  489. handler(val) {
  490. if (val) {
  491. this.tabList[1].isShow = true
  492. // this.tabList[4].isShow = true
  493. }
  494. },
  495. immediate: true,
  496. },
  497. },
  498. mounted() {},
  499. methods: {
  500. ...mapActions(['getUserInfo']),
  501. ...mapMutations({
  502. openDialog: 'openDialog',
  503. setSmImgUlIdx: 'product/setSmImgUlIdx',
  504. setLoading: 'product/setLoading',
  505. }),
  506. // 判断字符串是否符合商品code规律
  507. isProduct(str) {
  508. return /^[A-z]{1,4}\d{1,4}[A-z]?$/.test(str)
  509. },
  510. computedIndex(i) {
  511. return this.pageData.main?.image ? 1 + i : i
  512. },
  513. // 保存一下用户选择的周期、型号、打印服务、addon、packaging, product builder页面要用到
  514. saveUserSelected() {
  515. let result = {
  516. addon: [],
  517. packaging: [],
  518. printService: {},
  519. }
  520. for (let key in this.allSelData) {
  521. if (key === 'addon') {
  522. result.addon = this.allSelData[key].map(item => item.id)
  523. }
  524. if (key === 'packaging') {
  525. result.packaging = this.allSelData[key].map(item => item.id)
  526. }
  527. }
  528. // 周期
  529. if (this.priceList[this.currTab].cycle_id) {
  530. result.cycle = this.priceList[this.currTab].cycle_id
  531. }
  532. // 型号
  533. if (this.priceList[this.currTab].undecoratedSelectId) {
  534. result.model = this.priceList[this.currTab].undecoratedSelectId
  535. }
  536. // 打印服务
  537. const printService = this.priceList[this.currTab][2]
  538. console.log(printService, 'printService')
  539. if (Array.isArray(printService) && printService.length) {
  540. printService.forEach(item => {
  541. if (item.decorationSelectId) {
  542. const temp = item.decorationList.filter(i => i.id === item.decorationSelectId)
  543. result.printService[`${item.id}`] = {
  544. id: item.decorationSelectId,
  545. num: temp[0].num,
  546. }
  547. }
  548. })
  549. }
  550. localStorage.setItem(`product-user-select-${this.$route.params.code}`, JSON.stringify(result))
  551. },
  552. // getStock() {
  553. // this.$axios.get('/api/quote/stock_new', { params: {id: this.id} }).then(res => {
  554. // this.stockData = res.result
  555. // })
  556. // },
  557. openProjectdDialog() {
  558. if (!isLogin) {
  559. this.openDialog()
  560. return
  561. }
  562. this.projectdDialogVisible = true
  563. this.projectObj.cycle_id = this.comCurrPriceList.cycle_id
  564. this.projectObj.price_unit_id = this.comCurrPriceList.undecoratedSelectId
  565. //获取Decoration Method
  566. this.projectObj.decoration_methods = this.comDecoration.map(item => {
  567. let temp = {}
  568. temp.decoration_id = item.id
  569. temp.price_unit_id = item.parentId
  570. temp.colours_number = item.num
  571. return temp
  572. })
  573. this.projectObj.addition_ids = this.allSelData.addon
  574. .map(item => {
  575. return item.id
  576. })
  577. .join()
  578. this.projectObj.packaging_addition_ids = this.allSelData.packaging
  579. .map(item => {
  580. return item.id
  581. })
  582. .join()
  583. },
  584. download(url) {
  585. var urlStr = url.match('[^/]+(?!.*/)')[0]
  586. const repaceDomainUrl = this.$utils.repaceDomain(url)
  587. if (url.endsWith('.pdf')) {
  588. this.$utils.handleFileDownload(repaceDomainUrl, urlStr, false)
  589. } else {
  590. this.$utils.downloadBlob(url, urlStr)
  591. }
  592. },
  593. onPreview() {
  594. this.showViewer = true
  595. },
  596. closeViewer() {
  597. this.showViewer = false
  598. },
  599. clickNav(i) {
  600. if (this.typeTab == 1 && !this.tabList[1].isClick) {
  601. this.checkNav(1)
  602. } else if (this.typeTab == 2 && !this.tabList[2].isClick) {
  603. this.checkNav(2)
  604. }
  605. },
  606. checkNav(i) {
  607. if (this.isLogin) {
  608. this.getUserInfo()
  609. if (this.userInfo.audit_status == 1) {
  610. if (i == 1) {
  611. this.$refs.quote.getQuote()
  612. // this.$refs.quote.getWeight()
  613. this.tabList[1].isClick = true
  614. } else if (i == 2) {
  615. // uk 没有这个
  616. // this.getStock()
  617. // this.tabList[2].isClick = true
  618. }
  619. } else {
  620. this.typeTab = 0
  621. this.$message({
  622. message: 'Your account has not been audited',
  623. type: 'warning',
  624. })
  625. }
  626. } else {
  627. this.openDialog()
  628. this.typeTab = 0
  629. }
  630. },
  631. openLink(url) {
  632. let a = url.indexOf('http') > -1 ? url : 'http://' + url
  633. window.open(a, '_blank')
  634. },
  635. // sendTicket() {
  636. // this.$axios.post('/api/ticket/add', { product_code: this.pageData.product_code,ticket_type: this.ticketForm['问题类型'].join(),content: this.ticketForm['反馈详情'] }).then(res => {
  637. // this.setLoading(false)
  638. // this.$notify({
  639. // title: "success",
  640. // message: "提交成功",
  641. // type: "success",
  642. // duration: 3000,
  643. // });
  644. // }).catch(() => {
  645. // this.setLoading(false)
  646. // })
  647. // }
  648. },
  649. }
  650. </script>
  651. <style lang="scss" scoped>
  652. @import './product.scss';
  653. </style>