ProductRight.vue 20 KB

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