_batchCode.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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" :class="{'active': component.attach && component.attach != '1'}" @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="params-wrap">
  55. <p>产品参数</p>
  56. <ul v-if="component.properties && component.properties.length">
  57. <li v-for="prop in component.properties" v-if="prop.property">
  58. <span class="inline-block text-ellipse" v-text="prop.property.labelCn"></span>
  59. <span class="inline-block text-ellipse" v-text="prop.value"></span>
  60. </li>
  61. </ul>
  62. <div class="com-none-state" v-else>
  63. <p>卖家上传的产品暂无参数,请 <b @click="showStoreInfo = true">联系卖家</b> 了解具体详情</p>
  64. </div>
  65. </div>
  66. <div class="mobile-modal" v-if="showStoreInfo" @touchmove="preventTouchMove($event)">
  67. <div class="mobile-modal-box mobile-link-en">
  68. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  69. <div class="mobile-modal-content">
  70. <!--
  71. <div v-if="checkInfo(storeInfo.enterprise.enAddress)">商家地址:{{storeInfo.enterprise.enAddress}}</div>
  72. -->
  73. <!--<div class="content-line link-url">在线咨询</div>-->
  74. <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>
  75. <!--
  76. <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>
  77. -->
  78. </div>
  79. </div>
  80. </div>
  81. <remind-box :title="remindText" :timeoutCount="remindCount"></remind-box>
  82. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
  83. </div>
  84. </template>
  85. <script>
  86. import {RemindBox, LoginBox} from '~components/mobile/common'
  87. export default {
  88. layout: 'mobile',
  89. fetch({ store, route }) {
  90. return Promise.all([
  91. store.dispatch('shop/findCommodityOnBatchInfo', route.params)
  92. ])
  93. },
  94. components: {
  95. RemindBox,
  96. LoginBox
  97. },
  98. data () {
  99. return {
  100. isMore: false,
  101. showStoreInfo: false,
  102. remindText: '',
  103. remindCount: 1,
  104. url: '',
  105. showLoginBox: false
  106. }
  107. },
  108. computed: {
  109. commodity () {
  110. return this.$store.state.shop.storeInfo.commodity.data
  111. },
  112. isRMB () {
  113. return this.commodity.currencyName === 'RMB'
  114. },
  115. commodityPrices () {
  116. return this.commodity.prices
  117. },
  118. priceLevel1 () {
  119. return this.commodityPrices.length > 3 ? this.commodityPrices.slice(0, 3) : this.commodityPrices
  120. },
  121. priceLevel2 () {
  122. return this.commodityPrices.length > 3 ? this.commodityPrices.slice(3, this.commodityPrices.length) : []
  123. },
  124. isFocus () {
  125. // console.log(this.$store.state.shop.storeInfo)
  126. return this.$store.state.shop.storeInfo.focusList.data === 'true'
  127. },
  128. storeInfo () {
  129. return this.$store.state.shop.storeInfo.store.data
  130. },
  131. component () {
  132. return this.$store.state.shop.storeInfo.component.data
  133. }
  134. },
  135. methods: {
  136. checkInfo: function (str) {
  137. return str && str.trim() !== ''
  138. },
  139. goAttach: function (url) {
  140. if (this.user.logged) {
  141. if (url && url !== '1') {
  142. window.open(url)
  143. // window.location.href = url
  144. } else {
  145. if (!url) {
  146. this.onRemind('该产品暂无数据手册')
  147. } else {
  148. this.onRemind('数据手册地址错误')
  149. }
  150. }
  151. } else {
  152. this.url = this.$route.fullPath
  153. this.showLoginBox = true
  154. }
  155. },
  156. collectStore: function () {
  157. if (this.user.logged) {
  158. if (!this.isFocus) {
  159. this.$store.dispatch('shop/StoreFocus', {storeName: this.storeInfo.storeName, storeid: this.storeInfo.id})
  160. .then(response => {
  161. this.$store.dispatch('shop/StoreFocusList', {id: this.storeInfo.id})
  162. this.onRemind('关注成功')
  163. })
  164. } else {
  165. this.$http.post('/trade/storeFocus/delete/storeId', [this.storeInfo.id])
  166. .then(response => {
  167. this.$store.dispatch('shop/StoreFocusList', {id: this.storeInfo.id})
  168. this.onRemind('取消成功')
  169. })
  170. }
  171. } else {
  172. this.url = this.$route.fullPath
  173. this.showLoginBox = true
  174. }
  175. },
  176. onRemind: function (str) {
  177. this.remindText = str
  178. this.remindCount++
  179. }
  180. }
  181. }
  182. </script>
  183. <style lang="scss" scoped>
  184. .commodity-detail {
  185. .logo-wrap {
  186. height: 5.18rem;
  187. line-height: 5.18rem;
  188. background: #fff;
  189. text-align: center;
  190. img {
  191. /* border: .01rem solid #ccc;*/
  192. max-width: 4.06rem;
  193. max-height: 3.27rem;
  194. }
  195. }
  196. .content-wrap {
  197. -webkit-box-shadow: 0 0 7px 0 rgba(143, 141, 141, 0.25);
  198. -moz-box-shadow: 0 0 7px 0 rgba(143, 141, 141, 0.25);
  199. box-shadow: 0 0 7px 0 rgba(143, 141, 141, 0.25);
  200. margin-bottom: .1rem;
  201. .content-line {
  202. height: 1.04rem;
  203. border-bottom: .01rem solid #d9d9d9;
  204. &.cl-title {
  205. padding: .14rem 0 .14rem .2rem;
  206. .code {
  207. font-size: .3rem;
  208. font-weight: bold;
  209. width: 6.22rem;
  210. padding-right: .3rem;
  211. border-right: .01rem solid #e1e1e1;
  212. line-height: .76rem;
  213. }
  214. .focus-wrap {
  215. width: .9rem;
  216. text-align: center;
  217. margin-left: .15rem;
  218. i {
  219. font-size: .4rem;
  220. display: block;
  221. color: #dddddd;
  222. }
  223. span {
  224. font-size: .2rem;
  225. }
  226. &.active {
  227. i {
  228. color: #ff7803;
  229. }
  230. }
  231. }
  232. }
  233. .price-level {
  234. text-align: center;
  235. font-size: .24rem;
  236. border-right: .01rem solid #b0b0b0;
  237. &:last-child {
  238. border-right: none;
  239. }
  240. p {
  241. font-size: .44rem;
  242. color: #f42d29;
  243. span {
  244. font-size: .22rem;
  245. }
  246. }
  247. }
  248. &.cl-price1 {
  249. padding: .1rem .18rem 0;
  250. .fl {
  251. font-size: .24rem;
  252. text-align: center;
  253. margin-top: .08rem;
  254. .price-tag {
  255. width: .69rem;
  256. height: .34rem;
  257. line-height: .34rem;
  258. text-align: center;
  259. background: #f42d29;
  260. border-radius: .1rem;
  261. color: #fff;
  262. margin: .02rem 0 .06rem;
  263. }
  264. }
  265. ul {
  266. display: inline-block;
  267. li {
  268. width: 1.96rem;
  269. }
  270. }
  271. i {
  272. font-size: .32rem;
  273. }
  274. }
  275. &.cl-price2 {
  276. padding-top: .1rem;
  277. ul {
  278. text-align: center;
  279. li {
  280. width: 2.83rem;
  281. }
  282. }
  283. }
  284. &.link {
  285. padding-top: .18rem;
  286. ul {
  287. li {
  288. width: 33%;
  289. &.active {
  290. i {
  291. color: #d81e06;
  292. }
  293. }
  294. }
  295. i {
  296. font-size: .39rem;
  297. &.icon-kefu1 {
  298. font-size: .44rem;
  299. position: relative;
  300. top: -.05rem;
  301. color: #ff6000;
  302. & + p {
  303. margin-top: -.07rem;
  304. }
  305. }
  306. &.icon-shouye-copy {
  307. color: #3f84f6;
  308. }
  309. }
  310. p {
  311. font-size: .2rem;
  312. color: #333;
  313. }
  314. }
  315. }
  316. }
  317. }
  318. .params-wrap {
  319. background: #f4f4f4;
  320. padding: .29rem .23rem;
  321. p {
  322. font-size: .26rem;
  323. text-align: center;
  324. margin-bottom: .24rem;
  325. }
  326. ul {
  327. border-left: .01rem solid #d9d9d9;
  328. border-top: .01rem solid #d9d9d9;
  329. background: #fff;
  330. font-size: .24rem;
  331. li {
  332. border-bottom: .01rem solid #d9d9d9;
  333. span {
  334. border-right: .01rem solid #d9d9d9;
  335. height: .67rem;
  336. line-height: .67rem;
  337. text-align: center;
  338. padding: 0 .15rem;
  339. &:first-child {
  340. width: 50%;
  341. }
  342. &:last-child {
  343. width: 50%;
  344. text-align: left;
  345. }
  346. }
  347. }
  348. }
  349. }
  350. }
  351. .com-none-state {
  352. padding: .2rem 0;
  353. background: transparent;
  354. b {
  355. color: #3c7cf5;
  356. font-weight: normal;
  357. }
  358. }
  359. </style>