_batchCode.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <div class="mobile-content commodity-detail">
  3. <div class="logo-wrap">
  4. <img :src="commodity.img || '/images/store/common/default.png'" alt="">
  5. </div>
  6. <div class="content-wrap">
  7. <div class="content-line cl-title">
  8. <span class="code text-ellipse inline-block">{{commodity.code}}</span>
  9. <div class="focus-wrap inline-block" :class="{'active': isFocus}">
  10. <i class="iconfont icon-shoucang" @click="collectStore"></i>
  11. <span>店铺关注</span>
  12. </div>
  13. </div>
  14. <div class="content-line cl-price1">
  15. <div class="fl">
  16. <p class="price-tag">价格:</p>
  17. <span>数量:</span>
  18. </div>
  19. <ul>
  20. <li class="text-ellipse inline-block price-level" v-for="price in priceLevel1">
  21. <p><span>{{isRMB ? '¥' : '$'}}</span>
  22. {{isRMB ? price.rMBPrice : price.uSDPrice}}
  23. </p>
  24. <span>{{price.start}}+</span>
  25. </li>
  26. </ul>
  27. <i :class="`iconfont icon-arrow-${isMore ? 'up' : 'down'}`" @click="isMore = !isMore" v-if="priceLevel2.length"></i>
  28. </div>
  29. <div class="content-line cl-price2" v-if="priceLevel2.length && isMore">
  30. <ul>
  31. <li class="text-ellipse inline-block price-level" v-for="price in priceLevel2">
  32. <p><span>$</span>159.00</p>
  33. <span>1+</span>
  34. </li>
  35. </ul>
  36. </div>
  37. <div class="content-line link cl-price2">
  38. <ul>
  39. <nuxt-link :to="`/mobile/shop/${storeInfo.uuid}`" tag="li" class="text-ellipse inline-block price-level">
  40. <i class="iconfont icon-shouye-copy"></i>
  41. <p>店铺</p>
  42. </nuxt-link>
  43. <li class="text-ellipse inline-block price-level" @click="showStoreInfo = true">
  44. <i class="iconfont icon-kefu1"></i>
  45. <p>联系卖家</p>
  46. </li>
  47. <li class="text-ellipse inline-block price-level active" @click="goAttach(component.attach)">
  48. <i class="iconfont icon-pdf"></i>
  49. <p>数据手册</p>
  50. </li>
  51. </ul>
  52. </div>
  53. </div>
  54. <div class="item-wrap">
  55. <p>产品信息</p>
  56. <div class="com-info">
  57. <span class="name">品牌</span>:<span v-text="commodity.brandNameEn"></span>
  58. </div>
  59. <div class="com-info">
  60. <span class="name no-letter">类目(产品名称)</span>:<span v-text="commodity.kindNameCn || '无类目信息'"></span>
  61. </div>
  62. <div class="com-info">
  63. <span class="name">规格</span>:<span v-text="commodity.spec || '无规格信息'"></span>
  64. </div>
  65. <div class="com-info">
  66. <span class="name">包装</span>:<span v-text="commodity.packaging || '无包装信息'"></span>
  67. </div>
  68. <div class="com-info">
  69. <span class="name">最小包装数</span>:<span v-text="commodity.minPackQty || '无最小包装数信息'"></span>
  70. </div>
  71. <div class="com-info">
  72. <span class="name">库存</span>:<span v-text="commodity.reserve || 0"></span><em style="margin-left: 3px;">PCS</em>
  73. (<span v-text="commodity.minBuyQty || 1"></span>个起订)
  74. <span class="can-div-sell" v-if="commodity.breakUp">可拆卖</span>
  75. </div>
  76. <div class="com-info">
  77. <span class="name">交期</span>:
  78. <div class="delivery inline-block">
  79. <span v-text="commodity.b2cMinDelivery || 0"></span>
  80. <span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">-</span>
  81. <span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery" v-text="commodity.b2cMaxDelivery || 0"></span>
  82. <span>(天)</span>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="params-wrap">
  87. <p>产品参数</p>
  88. <ul v-if="component.properties && component.properties.length">
  89. <li v-for="prop in component.properties" v-if="prop.property">
  90. <span class="inline-block text-ellipse" v-text="prop.property.labelCn"></span>
  91. <span class="inline-block text-ellipse" v-text="prop.value || '—'"></span>
  92. </li>
  93. </ul>
  94. <div class="com-none-state" v-else>
  95. <p>卖家上传的产品暂无参数,请 <b @click="showStoreInfo = true">联系卖家</b> 了解具体详情</p>
  96. </div>
  97. </div>
  98. <div class="mobile-modal" v-if="showStoreInfo" @touchmove="preventTouchMove($event)">
  99. <div class="mobile-modal-box mobile-link-en">
  100. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  101. <div class="mobile-modal-content">
  102. <!--
  103. <div v-if="checkInfo(storeInfo.enterprise.enAddress)">商家地址:{{storeInfo.enterprise.enAddress}}</div>
  104. -->
  105. <!--<div class="content-line link-url">在线咨询</div>-->
  106. <div v-if="checkInfo(storeInfo.enterprise.enTel)">致电:<a :href="'tel:' + storeInfo.enterprise.enTel" target="_blank" class="content-line link-url">{{storeInfo.enterprise.enTel}}</a></div>
  107. <!--
  108. <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>
  109. -->
  110. </div>
  111. </div>
  112. </div>
  113. <remind-box :title="remindText" :timeoutCount="remindCount"></remind-box>
  114. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
  115. </div>
  116. </template>
  117. <script>
  118. import {RemindBox, LoginBox} from '~components/mobile/common'
  119. export default {
  120. layout: 'mobile',
  121. fetch({ store, route }) {
  122. return Promise.all([
  123. store.dispatch('shop/findCommodityOnBatchInfo', route.params)
  124. ])
  125. },
  126. components: {
  127. RemindBox,
  128. LoginBox
  129. },
  130. data () {
  131. return {
  132. isMore: false,
  133. showStoreInfo: false,
  134. remindText: '',
  135. remindCount: 1,
  136. url: '',
  137. showLoginBox: false
  138. }
  139. },
  140. computed: {
  141. commodity () {
  142. return this.$store.state.shop.storeInfo.commodity.data
  143. },
  144. isRMB () {
  145. return this.commodity.currencyName === 'RMB'
  146. },
  147. commodityPrices () {
  148. return this.commodity.prices
  149. },
  150. priceLevel1 () {
  151. return this.commodityPrices.length > 3 ? this.commodityPrices.slice(0, 3) : this.commodityPrices
  152. },
  153. priceLevel2 () {
  154. return this.commodityPrices.length > 3 ? this.commodityPrices.slice(3, this.commodityPrices.length) : []
  155. },
  156. isFocus () {
  157. // console.log(this.$store.state.shop.storeInfo)
  158. return this.$store.state.shop.storeInfo.focusList.data === 'true'
  159. },
  160. storeInfo () {
  161. return this.$store.state.shop.storeInfo.store.data
  162. },
  163. component () {
  164. return this.$store.state.shop.storeInfo.component.data
  165. }
  166. },
  167. methods: {
  168. checkInfo: function (str) {
  169. return str && str.trim() !== ''
  170. },
  171. goAttach: function (url) {
  172. if (this.user.logged) {
  173. if (url && url !== '1') {
  174. window.open(url)
  175. // window.location.href = url
  176. } else {
  177. if (!url) {
  178. this.onRemind('该产品暂无数据手册')
  179. } else {
  180. this.onRemind('数据手册地址错误')
  181. }
  182. }
  183. } else {
  184. this.url = this.$route.fullPath
  185. this.showLoginBox = true
  186. }
  187. },
  188. collectStore: function () {
  189. if (this.user.logged) {
  190. if (!this.isFocus) {
  191. this.$store.dispatch('shop/StoreFocus', {storeName: this.storeInfo.storeName, storeid: this.storeInfo.id})
  192. .then(response => {
  193. this.$store.dispatch('shop/StoreFocusList', {id: this.storeInfo.id})
  194. this.onRemind('关注成功')
  195. })
  196. } else {
  197. this.$http.post('/trade/storeFocus/delete/storeId', [this.storeInfo.id])
  198. .then(response => {
  199. this.$store.dispatch('shop/StoreFocusList', {id: this.storeInfo.id})
  200. this.onRemind('取消成功')
  201. })
  202. }
  203. } else {
  204. this.url = this.$route.fullPath
  205. this.showLoginBox = true
  206. }
  207. },
  208. onRemind: function (str) {
  209. this.remindText = str
  210. this.remindCount++
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. .commodity-detail {
  217. .logo-wrap {
  218. height: 5.18rem;
  219. line-height: 5.18rem;
  220. background: #fff;
  221. text-align: center;
  222. img {
  223. /* border: .01rem solid #ccc;*/
  224. max-width: 4.06rem;
  225. max-height: 3.27rem;
  226. }
  227. }
  228. .content-wrap {
  229. -webkit-box-shadow: 0 -2px 7px 0 rgba(143, 141, 141, 0.25);
  230. -moz-box-shadow: 0 -2px 7px 0 rgba(143, 141, 141, 0.25);
  231. box-shadow: 0 -2px 7px 0 rgba(143, 141, 141, 0.25);
  232. border-bottom: .1rem solid #f4f4f4;
  233. .content-line {
  234. height: 1.04rem;
  235. border-bottom: .01rem solid #d9d9d9;
  236. &.cl-title {
  237. padding: .14rem 0 .14rem .2rem;
  238. .code {
  239. font-size: .3rem;
  240. font-weight: bold;
  241. width: 6.22rem;
  242. padding-right: .3rem;
  243. border-right: .01rem solid #e1e1e1;
  244. line-height: .76rem;
  245. }
  246. .focus-wrap {
  247. width: .8rem;
  248. text-align: center;
  249. margin-left: .15rem;
  250. i {
  251. font-size: .4rem;
  252. display: block;
  253. color: #dddddd;
  254. }
  255. span {
  256. font-size: .2rem;
  257. }
  258. &.active {
  259. i {
  260. color: #ff7803;
  261. }
  262. }
  263. }
  264. }
  265. .price-level {
  266. text-align: center;
  267. font-size: .24rem;
  268. border-right: .01rem solid #b0b0b0;
  269. &:last-child {
  270. border-right: none;
  271. }
  272. p {
  273. font-size: .38rem;
  274. color: #f42d29;
  275. overflow: hidden;
  276. text-overflow: ellipsis;
  277. white-space: nowrap;
  278. max-width: 1.88rem;
  279. margin: 0 auto;
  280. span {
  281. font-size: .22rem;
  282. }
  283. }
  284. }
  285. &.cl-price1 {
  286. padding: .1rem .18rem 0;
  287. .fl {
  288. font-size: .24rem;
  289. text-align: center;
  290. margin-top: .08rem;
  291. .price-tag {
  292. width: .69rem;
  293. height: .34rem;
  294. line-height: .34rem;
  295. text-align: center;
  296. background: #f42d29;
  297. border-radius: .1rem;
  298. color: #fff;
  299. margin: .02rem 0 .06rem;
  300. }
  301. }
  302. ul {
  303. display: inline-block;
  304. li {
  305. width: 1.96rem;
  306. }
  307. }
  308. i {
  309. font-size: .32rem;
  310. }
  311. }
  312. &.cl-price2 {
  313. padding-top: .1rem;
  314. ul {
  315. text-align: center;
  316. li {
  317. width: 2.83rem;
  318. }
  319. }
  320. }
  321. &.link {
  322. padding-top: .18rem;
  323. ul {
  324. li {
  325. width: 33%;
  326. &.active {
  327. i {
  328. color: #d81e06;
  329. }
  330. }
  331. }
  332. i {
  333. font-size: .39rem;
  334. &.icon-kefu1 {
  335. font-size: .44rem;
  336. position: relative;
  337. top: -.05rem;
  338. color: #ff6000;
  339. & + p {
  340. margin-top: -.07rem;
  341. }
  342. }
  343. &.icon-shouye-copy {
  344. color: #3f84f6;
  345. }
  346. }
  347. p {
  348. font-size: .2rem;
  349. color: #333;
  350. }
  351. }
  352. }
  353. }
  354. }
  355. .params-wrap {
  356. background: #fff;
  357. padding: .29rem .23rem;
  358. p {
  359. font-size: .26rem;
  360. text-align: center;
  361. margin-bottom: .24rem;
  362. }
  363. ul {
  364. border-left: .01rem solid #d9d9d9;
  365. border-top: .01rem solid #d9d9d9;
  366. background: #fff;
  367. font-size: .24rem;
  368. li {
  369. border-bottom: .01rem solid #d9d9d9;
  370. span {
  371. border-right: .01rem solid #d9d9d9;
  372. height: .67rem;
  373. line-height: .67rem;
  374. text-align: center;
  375. padding: 0 .15rem;
  376. &:first-child {
  377. width: 50%;
  378. }
  379. &:last-child {
  380. width: 50%;
  381. text-align: left;
  382. }
  383. }
  384. }
  385. }
  386. }
  387. .item-wrap {
  388. padding: .3rem 0;
  389. border-bottom: .1rem solid #f4f4f4;
  390. p {
  391. font-size: .26rem;
  392. text-align: center;
  393. margin-bottom: .24rem;
  394. font-weight: bold;
  395. }
  396. .com-info {
  397. padding-left: .5rem;
  398. padding-right: .2rem;
  399. line-height: .5rem;
  400. overflow: hidden;
  401. text-overflow: ellipsis;
  402. white-space: nowrap;
  403. .name {
  404. color: #666;
  405. }
  406. .can-div-sell {
  407. font-size: 0.18rem;
  408. margin-left: 0.1rem;
  409. display: inline-block;
  410. height: .3rem;
  411. line-height: .3rem;
  412. width: .7rem;
  413. text-align: center;
  414. background: #3f84f6;
  415. color: #fff;
  416. font-weight: bold;
  417. border-radius: 3px;
  418. }
  419. }
  420. }
  421. }
  422. .com-none-state {
  423. padding: .2rem 0;
  424. background: transparent;
  425. b {
  426. color: #3c7cf5;
  427. font-weight: normal;
  428. }
  429. }
  430. </style>