detail.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. {extend name="public/container"}
  2. {block name="title"}商品详情{/block}
  3. {block name="head_top"}
  4. <style>
  5. body {
  6. padding-bottom: 1.2rem;
  7. background-color: #f5f5f5;
  8. }
  9. .goods-detail .swiper-container img {
  10. display: block;
  11. width: 100%;
  12. height: 100%;
  13. object-fit: cover;
  14. pointer-events: none;
  15. }
  16. </style>
  17. {/block}
  18. {block name="content"}
  19. <div v-cloak id="app">
  20. <div class="goods-detail">
  21. <div class="header">
  22. <div id="carousel" class="swiper-container" :style="{ height: carouselHeight + 'px' }">
  23. <div class="swiper-wrapper">
  24. <div v-for="(item, index) in storeInfo.slider_image" :key="index" class="swiper-slide">
  25. <img :src="item" />
  26. </div>
  27. </div>
  28. <div class="swiper-pagination"></div>
  29. </div>
  30. <div class="text">
  31. <div class="name">{{ storeInfo.store_name }}</div>
  32. <div class="group">
  33. <div class="money">
  34. <div class="price">¥<span class="num">{{ storeInfo.price }}</span></div>
  35. <div class="vip-price">¥{{ storeInfo.vip_price }}<img class="img" src="/wap/first/zsff/images/vip.png"></div>
  36. </div>
  37. <div class="sale">原价:¥{{ storeInfo.ot_price }}</div>
  38. <div class="sale">销量:{{ storeInfo.ficti ? storeInfo.ficti : storeInfo.sales }}</div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="main">
  43. <div class="name">商品详情</div>
  44. <div class="cont" v-html="storeInfo.description"></div>
  45. </div>
  46. <div class="footer">
  47. <div class="group">
  48. <a class="link" href="{:Url('wap/index/index')}">
  49. <div class="image">
  50. <img class="img" src="/wap/first/zsff/images/special01.png">
  51. </div>
  52. <div class="name">首页</div>
  53. </a>
  54. <a class="link" href="{:Url('service/service_list')}">
  55. <div class="image">
  56. <img class="img" src="{__WAP_PATH}zsff/images/special02.png">
  57. </div>
  58. <div class="name">客服</div>
  59. </a>
  60. </div>
  61. <button class="button" type="button" @click="cardUp">立即购买</button>
  62. </div>
  63. </div>
  64. <enter :appear="appear" @change="changeVal" :url="url" :site_name="site_name"></enter>
  65. </div>
  66. <script>
  67. var storeInfo = {$storeInfo};
  68. var site_name = '{$Auth_site_name}';
  69. var isWechat={$isWechat ? 'true' : 'false'};
  70. var uid={$userInfo['uid'] ? $userInfo['uid']:0};
  71. require(['vue', 'store', 'helper', '{__WAP_PATH}zsff/js/enter.js', '{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, api, $h) {
  72. var app = new Vue({
  73. el: '#app',
  74. data: {
  75. storeInfo: storeInfo ? storeInfo : [],
  76. screenWidth: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
  77. appear: true,
  78. isWechat:isWechat,
  79. url:isWechat ? $h.U({c:'index',a:'login'}):$h.U({c:'login',a:'phone_check'})
  80. },
  81. computed: {
  82. carouselHeight: function () {
  83. return this.screenWidth * 42 / 75;
  84. }
  85. },
  86. mounted: function () {
  87. var that=this;
  88. this.$nextTick(function () {
  89. this.initCarousel();
  90. this.initResize();
  91. mapleWx($jssdk(), function () {
  92. this.onMenuShareAll({
  93. title: that.storeInfo.store_name,
  94. desc: that.storeInfo.store_info,
  95. imgUrl: that.storeInfo.image,
  96. link: location.href.indexOf('?') == -1 ? location.href + '?spread_uid=' + uid : location.href + '&spread_uid=' + uid,
  97. });
  98. });
  99. });
  100. },
  101. destroyed: function () {
  102. window.onresize = null;
  103. this.carousel.destroy();
  104. },
  105. methods: {
  106. initCarousel: function () {
  107. this.carousel = new Swiper('#carousel', {
  108. autoplay: 3000,
  109. pagination: '.swiper-pagination',
  110. paginationClickable: true,
  111. loop: true,
  112. observer: true,
  113. observeParents: true,
  114. onInit: function (swiper) {
  115. if (swiper.slides.length <= 3) {
  116. swiper.lockSwipes();
  117. swiper.params.pagination = null;
  118. }
  119. }
  120. });
  121. },
  122. initResize: function () {
  123. window.onresize = function () {
  124. this.screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  125. }.bind(this);
  126. },
  127. cardUp: function () {
  128. api.baseGet($h.U({c:'index',a:'user_login'}),function (res) {
  129. this.appear=true;
  130. api.goBuy({
  131. productId: this.storeInfo.id,
  132. cartNum: 1,
  133. uniqueId: '',
  134. }, function (cartId) {
  135. location.href = "{:url('wap/special/confirm_order')}?cartId="+cartId;
  136. });
  137. }.bind(this),function (res) {
  138. this.appear=false;
  139. return false;
  140. }.bind(this));
  141. },
  142. enter: function () {
  143. this.appear = false;
  144. },
  145. //关闭登录
  146. loginClose:function(value){
  147. this.appear=value;
  148. },
  149. //登录完成回调事件
  150. logComplete:function(){
  151. this.appear=true;
  152. },
  153. //所有插件回调处理事件
  154. changeVal: function (opt) {
  155. if (typeof opt != 'object') opt = {};
  156. var action = opt.action || '';
  157. var value = opt.value || '';
  158. this[action] && this[action](value);
  159. }
  160. }
  161. });
  162. });
  163. </script>
  164. {/block}