_batchCode.vue 9.8 KB

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