ProductRight.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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.com.au/.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="typeTab == 2">
  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: true,
  392. },
  393. // {
  394. // name: 'Stock',
  395. // isClick: false,
  396. // isShow: true,
  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. async created() {
  440. this.$store.dispatch('getShopInfo').then(res => {
  441. console.log(res.hide_prices)
  442. console.log(typeof res.hide_prices)
  443. this.tabList[1].isShow = [0, '0'].includes(res.hide_prices)
  444. })
  445. },
  446. computed: {
  447. currentPre(){
  448. return this.$store.state.product.smImgUlIdx
  449. },
  450. isLogin() {
  451. return !!this.$store.state.userInfo?.email
  452. },
  453. comInfo() {
  454. return this.pageData?.main
  455. },
  456. productImgArr() {
  457. return this.comInfo.mergeImages
  458. },
  459. userInfo() {
  460. return this.$store.state.userInfo
  461. },
  462. comIncluded_packaging() {
  463. return this.comInfo.included_packaging.split(',')
  464. },
  465. comOptional_packaging() {
  466. return this.comInfo.optional_packaging.split(',')
  467. },
  468. comOptional_attachments() {
  469. return this.comInfo.optional_attachments.split(',')
  470. },
  471. },
  472. watch:{
  473. //登陆立即显示Quick Quote和Changes选项
  474. // isLogin:{
  475. // handler(val){
  476. // if(val){
  477. // this.tabList[1].isShow = true
  478. // this.tabList[4].isShow = true
  479. // }
  480. // },
  481. // immediate: true
  482. // }
  483. },
  484. mounted() {
  485. },
  486. methods: {
  487. ...mapActions(['getUserInfo']),
  488. ...mapMutations({ openDialog: 'openDialog', setSmImgUlIdx: 'product/setSmImgUlIdx', setLoading: 'product/setLoading' }),
  489. // 判断字符串是否符合商品code规律
  490. isProduct(str) {
  491. return /^[A-z]{1,4}\d{1,4}[A-z]?$/.test(str)
  492. },
  493. // 保存一下用户选择的周期、型号、打印服务、addon、packaging, product builder页面要用到
  494. saveUserSelected() {
  495. let result = {
  496. addon: [],
  497. packaging: [],
  498. printService: {},
  499. }
  500. for (let key in this.allSelData) {
  501. if (key === 'addon') {
  502. result.addon = this.allSelData[key].map(item => item.id)
  503. }
  504. if (key === 'packaging') {
  505. result.packaging = this.allSelData[key].map(item => item.id)
  506. }
  507. }
  508. // 周期
  509. if (this.priceList[this.currTab].cycle_id) {
  510. result.cycle = this.priceList[this.currTab].cycle_id
  511. }
  512. // 型号
  513. if (this.priceList[this.currTab].undecoratedSelectId) {
  514. result.model = this.priceList[this.currTab].undecoratedSelectId
  515. }
  516. // 打印服务
  517. const printService = this.priceList[this.currTab][2]
  518. console.log(printService, 'printService')
  519. if (Array.isArray(printService) && printService.length) {
  520. printService.forEach(item => {
  521. if (item.decorationSelectId) {
  522. const temp = item.decorationList.filter(
  523. i => i.id === item.decorationSelectId
  524. )
  525. result.printService[`${item.id}`] = {
  526. id: item.decorationSelectId,
  527. num: temp[0].num,
  528. }
  529. }
  530. })
  531. }
  532. localStorage.setItem(
  533. `product-user-select-${this.$route.params.code}`,
  534. JSON.stringify(result)
  535. )
  536. },
  537. getStock() {
  538. this.$axios.get('/quote/stock_new', { params: {id: this.id} }).then(res => {
  539. this.stockData = res.result
  540. })
  541. },
  542. openProjectdDialog() {
  543. if (!isLogin) {
  544. this.openDialog()
  545. return
  546. }
  547. this.projectdDialogVisible = true
  548. this.projectObj.cycle_id = this.comCurrPriceList.cycle_id
  549. this.projectObj.price_unit_id = this.comCurrPriceList.undecoratedSelectId
  550. //获取Decoration Method
  551. this.projectObj.decoration_methods = this.comDecoration.map(item => {
  552. let temp = {}
  553. temp.decoration_id = item.id
  554. temp.price_unit_id = item.parentId
  555. temp.colours_number = item.num
  556. return temp
  557. })
  558. this.projectObj.addition_ids = this.allSelData.addon
  559. .map(item => {
  560. return item.id
  561. })
  562. .join()
  563. this.projectObj.packaging_addition_ids = this.allSelData.packaging
  564. .map(item => {
  565. return item.id
  566. })
  567. .join()
  568. },
  569. download(url) {
  570. var urlStr = url.match('[^/]+(?!.*/)')[0]
  571. const repaceDomainUrl = this.$utils.repaceDomain(url)
  572. if (url.endsWith(".pdf")) {
  573. this.$utils.handleFileDownload(repaceDomainUrl, urlStr, false)
  574. } else {
  575. this.$utils.downloadBlob(url, urlStr)
  576. }
  577. },
  578. onPreview() {
  579. this.showViewer = true
  580. },
  581. closeViewer() {
  582. this.showViewer = false
  583. },
  584. clickNav(i) {
  585. if (this.typeTab == 1 && !this.tabList[1].isClick) {
  586. if (this.tabList[1].isShow) {
  587. this.$refs.quote.getQuote()
  588. this.$refs.quote.getWeight()
  589. this.tabList[1].isClick = true
  590. }
  591. // this.checkNav(1)
  592. } else if (this.typeTab == 2 && !this.tabList[2].isClick) {
  593. this.checkNav(2)
  594. }
  595. },
  596. checkNav(i) {
  597. if (this.isLogin) {
  598. this.getUserInfo()
  599. if (this.userInfo.audit_status == 1) {
  600. if (i == 1 && this.tabList[1].isShow) {
  601. this.$refs.quote.getQuote()
  602. this.$refs.quote.getWeight()
  603. this.tabList[1].isClick = true
  604. } else if (i == 2) {
  605. this.getStock()
  606. this.tabList[2].isClick = true
  607. }
  608. } else {
  609. this.typeTab = 0
  610. this.$message({
  611. message: 'Your account has not been audited',
  612. type: 'warning',
  613. })
  614. }
  615. } else {
  616. this.openDialog()
  617. this.typeTab = 0
  618. }
  619. },
  620. openLink(url) {
  621. let a = url.indexOf('http') > -1 ? url : 'http://' + url
  622. window.open(a, '_blank')
  623. },
  624. sendTicket() {
  625. this.$axios.post('/ticket/add', { product_code: this.pageData.product_code,ticket_type: this.ticketForm['问题类型'].join(),content: this.ticketForm['反馈详情'] }).then(res => {
  626. this.setLoading(false)
  627. this.$notify({
  628. title: "success",
  629. message: "提交成功",
  630. type: "success",
  631. duration: 3000,
  632. });
  633. }).catch(() => {
  634. this.setLoading(false)
  635. })
  636. }
  637. },
  638. }
  639. </script>
  640. <style lang="scss" scoped>
  641. @import './product.scss';
  642. </style>