_batchCode.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. <template>
  2. <div class="mobile-content commodity-detail">
  3. <!-- <div class="logo-wrap">
  4. <div class="wrap-title"><span class="line"></span>图片信息</div>
  5. <img :src="commodity.img || '/images/store/common/default.png'" alt="" v-if="commodity.img">
  6. <div class="commodity-infom" v-else>暂无图片,请<span @click="showStoreInfo = true">联系卖家</span>了解具体详情</div>
  7. </div>-->
  8. <div class="product-info">
  9. <div class="wrap-title"><span class="line"></span>产品信息</div>
  10. <div class="focus-wrap inline-block" :class="{'active': isFocus}">
  11. <i class="iconfont icon-shoucang" @click="collectStore" style="font-size: 0.43rem;"></i>
  12. <div>店铺</div>
  13. <div>关注</div>
  14. </div>
  15. <div class="middle">
  16. <div class="list">
  17. <div class="fl">
  18. <div class="name">品牌:</div>
  19. <div class="text">{{commodity.brandNameEn}}</div>
  20. </div>
  21. </div>
  22. <div class="list">
  23. <div class="fl">
  24. <div class="name">物料名称(类目):</div>
  25. <div class="text">{{commodity.kindNameCn || '-'}}</div>
  26. </div>
  27. </div>
  28. <div class="list">
  29. <div class="name">规格:</div>
  30. <div class="text">{{commodity.spec || '-'}}</div>
  31. </div>
  32. <div class="list">
  33. <div class="name">包装方式:</div>
  34. <div class="text">{{commodity.packaging || '无包装信息'}}</div>
  35. </div>
  36. <div class="list">
  37. <div class="name">最小包装数:</div>
  38. <div class="text">{{commodity.minPackQty}}</div>
  39. </div>
  40. <div class="list">
  41. <div class="com-info">
  42. <span class="name">库存</span>:<span v-text="commodity.reserve || 0"></span><em style="margin-left: 3px;">PCS</em>
  43. (<span v-text="commodity.minBuyQty || 1"></span>个起订)
  44. <span class="can-div-sell" v-if="commodity.breakUp">可拆卖</span>
  45. </div>
  46. </div>
  47. <div class="list">
  48. <div class="name">交期(天):</div>
  49. <div class="text" v-if="commodity.b2cMaxDelivery && (commodity.b2cMaxDelivery != commodity.b2cMinDelivery)" v-text="commodity.b2cMinDelivery + '-'+ commodity.b2cMaxDelivery"></div>
  50. <div class="text" v-if="commodity.b2cMaxDelivery && (commodity.b2cMaxDelivery == commodity.b2cMinDelivery)" v-text="commodity.b2cMinDelivery"></div>
  51. </div>
  52. <!--<div class="list">-->
  53. <!--<div class="name">最小起订量:</div>-->
  54. <!--<div class="text" style="color: #f31919">{{commodity.minBuyQty}}</div>-->
  55. <!--</div>-->
  56. <!--<div class="list">-->
  57. <!--<div class="name">生产日期:</div>-->
  58. <!--<div class="text" :title="item.produceDate">{{commodity.produceDate || '-'}}</div>-->
  59. <!--</div>-->
  60. <div class="list">
  61. <div class="name left">价格梯度:<br/>(PCS)</div>
  62. <div class="table left">
  63. <ul>
  64. <li class="title">
  65. <div>分段数量/PCS</div>
  66. <div>分段单价</div>
  67. </li>
  68. <li v-for="price in commodity.prices">
  69. <div>{{price.start}}+</div>
  70. <div v-if="commodity.currencyName == 'RMB'">¥{{price.rMBPrice}}</div>
  71. <div v-else>${{price.uSDPrice}}</div>
  72. </li>
  73. </ul>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- <div class="content-line link cl-price2">
  78. <ul class="clearfix">
  79. <nuxt-link :to="`/mobile/shop/${storeInfo.uuid}`" tag="li" class="text-ellipse inline-block price-level">
  80. <i class="iconfont icon-dianpu"></i>
  81. <p>查看店铺</p>
  82. </nuxt-link>
  83. <li class="text-ellipse inline-block price-level" @click="showStoreInfo = true">
  84. <i class="iconfont icon-kefu1"></i>
  85. <p>联系卖家</p>
  86. </li>
  87. <li class="text-ellipse inline-block price-level" @click="goAttach(component.attach)">
  88. <i class="iconfont icon-pdf" :class="{'active': component.attach && component.attach !== '' && component.attach !== '1'}" ></i>
  89. <p class="lastOne" :class="{'active': component.attach && component.attach !== '' && component.attach !== '1'}">数据手册</p>
  90. </li>
  91. </ul>
  92. </div>-->
  93. </div>
  94. <div class="params-wrap">
  95. <div class="wrap-title"><span class="line"></span>产品参数</div>
  96. <ul v-if="component.properties && component.properties.length">
  97. <li v-for="prop in component.properties" v-if="prop.property">
  98. <span class="inline-block text-ellipse"> {{prop.property.labelCn}}:</span>
  99. <span class="inline-block text-ellipse" v-text="prop.value || '—'"></span>
  100. </li>
  101. </ul>
  102. <div class="com-none-state" v-else>
  103. <p>卖家上传的产品暂无参数,请 <b @click="showStoreInfo = true">联系卖家</b> 了解具体详情</p>
  104. </div>
  105. </div>
  106. <div class="operate-bottom">
  107. <div class="inline-block ob-ope">
  108. <nuxt-link :to="`/mobile/shop/${storeInfo.uuid}`" class="item inline-block">
  109. <i class="iconfont icon-dianpu"></i>
  110. <p>查看店铺</p>
  111. </nuxt-link>
  112. <a class="item inline-block" @click="showStoreInfo = true">
  113. <i class="iconfont icon-duihua"></i>
  114. <p>联系卖家</p>
  115. </a>
  116. <a class="item inline-block" @click="goAttach(component.attach)" :class="{'active': component.attach && component.attach !== '' && component.attach !== '1'}">
  117. <i class="iconfont icon-pdf"></i>
  118. <p>数据手册</p>
  119. </a>
  120. </div>
  121. <div class="inline-block ob-buy">
  122. <button @click="buy(false)">加入购物车</button>
  123. <button @click="buy(true)">立即购买</button>
  124. </div>
  125. </div>
  126. <div class="mobile-modal" v-if="showStoreInfo" @touchmove="preventTouchMove($event)">
  127. <div class="mobile-modal-box mobile-link-en">
  128. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  129. <div class="mobile-modal-content">
  130. <!--
  131. <div v-if="checkInfo(storeInfo.enterprise.enAddress)">商家地址:{{storeInfo.enterprise.enAddress}}</div>
  132. -->
  133. <!--<div class="content-line link-url">在线咨询</div>-->
  134. <div v-if="checkInfo(storeInfo.enterprise.enTel)" class="clearfix"><span class="pull-left">电话:</span><a :href="'tel:' + storeInfo.enterprise.enTel" target="_blank" class="content-line link-url pull-left">{{storeInfo.enterprise.enTel}}</a></div>
  135. <div v-if="checkInfo(storeInfo.enterprise.enPhone)" class="clearfix"><span class="pull-left">手机:</span><a :href="'tel:' + storeInfo.enterprise.enPhone" target="_blank" class="content-line link-url pull-left">{{storeInfo.enterprise.enPhone}}</a></div>
  136. <div v-if="checkInfo(storeInfo.enterprise.enWeixin)" class="clearfix"><span class="pull-left">微信:</span><span class="content-line pull-left">{{storeInfo.enterprise.enWeixin}}</span></div>
  137. <div v-if="checkInfo(storeInfo.enterprise.enQQ)" class="clearfix"><span class="pull-left">Q&nbsp;Q:</span><span class="content-line pull-left">{{storeInfo.enterprise.enQQ}}</span></div>
  138. <div v-if="!empty">暂无联系方式</div>
  139. <!--
  140. <div v-if="checkInfo(storeInfo.enterprise.enEmail)">邮件:<a :href="'mailto:' + storeInfo.enterprise.enEmail" target="_blank" class="content-line link-url">{{storeInfo.enterprise.enEmail}}</a></div>
  141. -->
  142. </div>
  143. </div>
  144. </div>
  145. <remind-box :title="remindText" :timeoutCount="remindCount"></remind-box>
  146. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
  147. </div>
  148. </template>
  149. <script>
  150. import {RemindBox, LoginBox} from '~components/mobile/common'
  151. export default {
  152. layout: 'mobile',
  153. fetch({ store, route }) {
  154. return Promise.all([
  155. store.dispatch('shop/findCommodityOnBatchInfo', route.params)
  156. ])
  157. },
  158. components: {
  159. RemindBox,
  160. LoginBox
  161. },
  162. data () {
  163. return {
  164. isMore: false,
  165. showStoreInfo: false,
  166. remindText: '',
  167. remindCount: 1,
  168. url: '',
  169. showLoginBox: false
  170. }
  171. },
  172. computed: {
  173. commodity () {
  174. // console.log(this.$store.state.shop.storeInfo.commodity.data)
  175. return this.$store.state.shop.storeInfo.commodity.data
  176. },
  177. isRMB () {
  178. return this.commodity.currencyName === 'RMB'
  179. },
  180. commodityPrices () {
  181. return this.commodity.prices
  182. },
  183. priceLevel1 () {
  184. return this.commodityPrices.length > 3 ? this.commodityPrices.slice(0, 3) : this.commodityPrices
  185. },
  186. priceLevel2 () {
  187. return this.commodityPrices.length > 3 ? this.commodityPrices.slice(3, this.commodityPrices.length) : []
  188. },
  189. isFocus () {
  190. // console.log(this.$store.state.shop.storeInfo)
  191. return this.$store.state.shop.storeInfo.focusList.data === 'true'
  192. },
  193. storeInfo () {
  194. return this.$store.state.shop.storeInfo.store.data
  195. },
  196. component () {
  197. return this.$store.state.shop.storeInfo.component.data
  198. },
  199. empty () {
  200. return this.checkInfo(this.storeInfo.enterprise.enTel) || this.checkInfo(this.storeInfo.enterprise.enPhone) || this.checkInfo(this.storeInfo.enterprise.enWeixin) || this.checkInfo(this.storeInfo.enterprise.enQQ)
  201. }
  202. },
  203. methods: {
  204. checkInfo: function (str) {
  205. return str && str.trim() !== ''
  206. },
  207. goAttach: function (url) {
  208. if (this.user.logged) {
  209. console.log(this.component)
  210. if (url && url !== '1') {
  211. // console.log(url)
  212. window.open(url)
  213. // window.location.href = url
  214. } else {
  215. if (!url) {
  216. this.setRemindText('该产品暂无数据手册')
  217. } else {
  218. this.setRemindText('数据手册地址错误')
  219. }
  220. }
  221. } else {
  222. this.url = this.$route.fullPath
  223. this.showLoginBox = true
  224. }
  225. },
  226. collectStore: function () {
  227. if (this.user.logged) {
  228. if (!this.isFocus) {
  229. this.$store.dispatch('shop/StoreFocus', {storeName: this.storeInfo.storeName, storeid: this.storeInfo.id})
  230. .then(response => {
  231. this.$store.dispatch('shop/StoreFocusList', {id: this.storeInfo.id})
  232. this.setRemindText('关注成功')
  233. })
  234. } else {
  235. this.$http.post('/trade/storeFocus/delete/storeId', [this.storeInfo.id])
  236. .then(response => {
  237. this.$store.dispatch('shop/StoreFocusList', {id: this.storeInfo.id})
  238. this.setRemindText('取消成功')
  239. })
  240. }
  241. } else {
  242. this.url = this.$route.fullPath
  243. this.showLoginBox = true
  244. }
  245. },
  246. setRemindText: function (str) {
  247. this.remindText = str
  248. this.remindCount++
  249. },
  250. buy: function (flag) {
  251. this.baseUtils.buyOrCar(flag, null, this, this.commodity, '/mobile/center/user/pay/')
  252. }
  253. }
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .commodity-detail {
  258. background: #f1f3f6;
  259. padding-bottom: 1rem;
  260. margin-bottom: 1.2rem;
  261. .wrap-title {
  262. color: #333;
  263. font-size: 0.28rem;
  264. border-bottom: 1px solid #d3d3d3;
  265. height: 0.5rem;
  266. text-align: left;
  267. padding: 0 0 0.1rem 0.05rem;
  268. margin: 0.17rem 0.25rem 0.13rem 0.25rem;
  269. line-height: 0.5rem;
  270. .line{
  271. width: 0.05rem;
  272. background: #3f84f6;
  273. display: inline-block;
  274. vertical-align: top;
  275. margin-right: 0.08rem;
  276. height: 0.28rem;
  277. margin-top: 0.09rem;
  278. }
  279. }
  280. .product-info {
  281. position: relative;
  282. background: #fff;
  283. margin: 0.2rem;
  284. border: 1px solid #e3e5e8;
  285. padding-bottom: 0.2rem;
  286. .focus-wrap {
  287. text-indent: 0.28rem;
  288. position: absolute;
  289. background-image: url('/images/mobile/product/productdetail_label.png');
  290. width: 0.93rem;
  291. height: 1.27rem;
  292. background-size: 100% 100%;
  293. font-size: 0.24rem;
  294. color: #666;
  295. right: 0px;
  296. top: 0px;
  297. i {
  298. color: #cacaca;
  299. }
  300. &.active {
  301. i {color: rgb(255, 120, 0);}
  302. }
  303. }
  304. .middle {
  305. border-radius: 5px;
  306. padding: 0.24rem 0.24rem 0px;
  307. background: #fff;
  308. .pms {
  309. color: #f57710;
  310. border: 1px solid #f57710;
  311. border-radius: 0.4rem;
  312. background: #fff;
  313. font-size: 0.24rem;
  314. height: 0.4rem;
  315. line-height: 0.4rem;
  316. width: 0.8rem;
  317. text-align: center;
  318. }
  319. .list {
  320. overflow: hidden;
  321. text-overflow: ellipsis;
  322. white-space: nowrap;
  323. .left {
  324. float: left;
  325. overflow: hidden;
  326. text-overflow: ellipsis;
  327. white-space: nowrap;
  328. }
  329. .textinfo {
  330. color: #0067e7;
  331. font-size: 0.28rem;
  332. }
  333. .button {
  334. font-size: 0.28rem;
  335. color: #1a58dd;
  336. width: 0.92rem;
  337. text-align: center;
  338. border-radius: 5px;
  339. border:1px solid #1a58dd;
  340. display: inline-block;
  341. margin-right: 0.2rem;
  342. }
  343. margin-bottom: 0.18rem;
  344. &::after{
  345. clear: both;
  346. display: block;
  347. content: ' ';
  348. visibility: hidden;
  349. zoom: 1;
  350. }
  351. .fl {
  352. width: 3.8rem;
  353. float: left;
  354. overflow: hidden;
  355. text-overflow: ellipsis;
  356. white-space: nowrap;
  357. }
  358. .fr {
  359. text-align: left;
  360. width: 2rem;
  361. overflow: hidden;
  362. text-overflow: ellipsis;
  363. white-space: nowrap;
  364. }
  365. &.list-long {
  366. .fl {
  367. width: 100% !important;
  368. }
  369. }
  370. .name {
  371. color: #666;
  372. font-size: 0.28rem;
  373. display: inline-block;
  374. }
  375. .text {
  376. display: inline-block;
  377. color: #333;
  378. font-size: 0.28rem;
  379. &.red {
  380. color: #e6353d;
  381. }
  382. }
  383. .table {
  384. width: 4.93rem;
  385. margin-bottom: 0;
  386. margin-top: 0;
  387. li {
  388. height: 0.43rem;
  389. line-height: 0.43rem;
  390. border-left: .01rem solid #c5c5c5;
  391. font-size: .28rem;
  392. &::after {
  393. clear: both;
  394. display: block;
  395. content: ' ';
  396. visibility: hidden;
  397. zoom: 1;
  398. }
  399. div {
  400. text-align: center;
  401. width: 50%;
  402. float: left;
  403. border-right: .01rem solid #c5c5c5;
  404. border-bottom: .01rem solid #c5c5c5;
  405. }
  406. &:nth-child(odd) {
  407. background: #ddd;
  408. color: #666;
  409. font-size: 0.28rem;
  410. }
  411. &:nth-child(even) {
  412. background: #fcfcfc;
  413. color: #666;
  414. font-size: 0.28rem;
  415. }
  416. &:nth-last-of-type(1){
  417. color: #f31919;
  418. }
  419. &.title {
  420. font-size: 0.28rem;
  421. color: #333;
  422. }
  423. }
  424. }
  425. }
  426. }
  427. .com-info {
  428. line-height: .5rem;
  429. overflow: hidden;
  430. text-overflow: ellipsis;
  431. white-space: nowrap;
  432. font-size:0.28rem;
  433. .name {
  434. color: #666;
  435. }
  436. .can-div-sell {
  437. font-size: 0.18rem;
  438. margin-left: 0.1rem;
  439. display: inline-block;
  440. height: .3rem;
  441. line-height: .3rem;
  442. width: .7rem;
  443. text-align: center;
  444. background: #3f84f6;
  445. color: #fff;
  446. font-weight: bold;
  447. border-radius: 3px;
  448. }
  449. }
  450. .content-line {
  451. border-radius: 5px;
  452. ul {
  453. li {
  454. width: 2rem;
  455. height:0.54rem;
  456. line-height: 0.54rem;
  457. float: left;
  458. margin-right: 0.25rem;
  459. color: #fff;
  460. border-radius: 0.08rem;
  461. font-size: 0;
  462. i {
  463. display: inline-block;
  464. margin-right: 0.04rem;
  465. margin-left: 0.24rem;
  466. &.icon-pdf {
  467. color: #929292;
  468. }
  469. &.active {
  470. color: #eb062b;
  471. }
  472. }
  473. &:nth-last-of-type(1) {
  474. margin-right: 0;
  475. background: #fff;
  476. color: #3f84f6;
  477. border: 1px solid #3f84f6;
  478. }
  479. &:nth-child(1) {
  480. background: #3f84f6;
  481. border: 1px solid #3f84f6;
  482. margin-left: 0.2rem;
  483. }
  484. &:nth-child(2) {
  485. background: #ff6000;
  486. border: 1px solid #ff6000;
  487. }
  488. p {
  489. font-size: 0.28rem;
  490. display: inline-block;
  491. text-align: center;
  492. vertical-align: top;
  493. &.lastOne {
  494. color: #929292;
  495. }
  496. &.active {
  497. color: #3f84f6;
  498. }
  499. }
  500. }
  501. }
  502. }
  503. }
  504. .logo-wrap {
  505. max-height: 5.18rem;
  506. background: #fff;
  507. text-align: center;
  508. margin: 0.2rem;
  509. border: 1px solid #e3e5e8;
  510. img {
  511. /* border: .01rem solid #ccc;*/
  512. max-width: 4.06rem;
  513. max-height: 3.27rem;
  514. margin-top: 0.4rem;
  515. margin-bottom: 0.4rem;
  516. }
  517. div.commodity-infom {
  518. font-size: 0.28rem;
  519. color: #666;
  520. line-height: 1.09rem;
  521. span {
  522. color: #3f84f6;
  523. }
  524. }
  525. }
  526. .params-wrap {
  527. border: 1px solid #e3e5e8;
  528. border-radius: 5px;
  529. margin: 0.2rem;
  530. background: #fff;
  531. padding: 0 0 .29rem;
  532. p {
  533. font-size: .26rem;
  534. text-align: center;
  535. margin-bottom: .24rem;
  536. }
  537. ul {
  538. background: #fff;
  539. font-size: .28rem;
  540. padding: 0 0.24rem;
  541. li {
  542. /*border-bottom: .01rem solid #d9d9d9;*/
  543. span {
  544. /*border-right: .01rem solid #d9d9d9;*/
  545. height: .67rem;
  546. line-height: .67rem;
  547. text-align: center;
  548. /*padding: 0 .15rem;*/
  549. &:first-child {
  550. /*width: 50%;*/
  551. color: #666;
  552. }
  553. &:last-child {
  554. color: #333;
  555. /*width: 50%;*/
  556. /*text-align: left;*/
  557. }
  558. }
  559. }
  560. }
  561. }
  562. .mobile-modal-content {
  563. .clearfix {
  564. padding-left: 1rem;
  565. }
  566. }
  567. .operate-bottom {
  568. height: 1rem;
  569. position: fixed;
  570. background: #fff;
  571. bottom: .98rem;
  572. width: 100%;
  573. border-top: 1px solid #ccc;
  574. > div {
  575. height: 100%;
  576. }
  577. .ob-ope {
  578. /*width: 3.72rem;*/
  579. width: 49.5%;
  580. .item {
  581. width: 33.3%;
  582. text-align: center;
  583. p {
  584. font-size: .24rem;
  585. color: #666;
  586. }
  587. i {
  588. color: #2e2d2c;
  589. font-size: .4rem;
  590. margin: .1rem 0 .04rem;
  591. display: inline-block;
  592. }
  593. &.active {
  594. .icon-pdf {
  595. color: #eb062b;
  596. }
  597. }
  598. }
  599. }
  600. .ob-buy {
  601. width: 50.5%;
  602. button {
  603. width: 50%;
  604. height: 100%;
  605. background: #fff;
  606. border: none;
  607. color: #3f84f6;
  608. &:first-child {
  609. border: 1px solid #3f84f6;
  610. }
  611. &:last-child {
  612. background: #3f84f6;
  613. color: #fff;
  614. }
  615. }
  616. }
  617. }
  618. }
  619. .com-none-state {
  620. padding: .2rem 0;
  621. background: transparent;
  622. b {
  623. color: #3c7cf5;
  624. font-weight: normal;
  625. }
  626. }
  627. </style>