productDetails.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template name="product">
  2. <!-- 商品详情顶部组件 -->
  3. <view class="product-content">
  4. <view class="banner-section">
  5. <uni-swiper-dot :info="productImage" :current="current" field="content" :mode="mode" >
  6. <swiper class="banner" circular @change="swiperChange" :autoplay="false" :circular="false" >
  7. <swiper-item v-for="(item, index) in productImage" :key="index" class="banner-item">
  8. <image :src="item" @tap="previewImg" />
  9. </swiper-item>
  10. </swiper>
  11. <view class="swiper__dots-box">
  12. <view v-for="(item,idx) in productImage"
  13. :key="idx"
  14. :class="[idx===current?'swiper__dots-long':'none']"
  15. :data-index="current" class="swiper__dots-item" />
  16. </view>
  17. </uni-swiper-dot>
  18. </view>
  19. <view class="product-wrap clearfix">
  20. <view class="wrap-top">
  21. <view class="p-title">
  22. {{_data.name}}
  23. </view>
  24. <view class="p-price">
  25. <text class="txt sm">¥</text>
  26. <text class="txt big">{{_data.retailPrice}}</text>
  27. <text class="txt sm">{{_data.smallMoney== '0'?'.00':_data.smallMoney}}</text>
  28. </view>
  29. </view>
  30. <view class="wrap-label">
  31. <view class="label-a" v-for="(label,index) in _data.tagsList" :key="index">{{label}}</view>
  32. </view>
  33. <view class="wrap-info">
  34. <view class="info-viewL">
  35. <view class="info-f">品牌:<text>{{_data.brandName}}</text></view>
  36. <view class="info-f">库存:<text>{{_data.stock}}</text></view>
  37. </view>
  38. <view class="info-viewR">
  39. <view class="info-f">包装规格:<text>{{_data.unit}}</text></view>
  40. <view class="info-f">起订量:<text>{{_data.minBuyNumber}}</text></view>
  41. </view>
  42. </view>
  43. <view class="wrap-seve">
  44. <text>服务:</text>
  45. <text class="iconfont icon-dui"><text class="text">无忧退货</text></text>
  46. <text class="iconfont icon-dui"><text class="text">快速退款</text></text>
  47. <text class="iconfont icon-dui"><text class="text">正品保证</text></text>
  48. </view>
  49. </view>
  50. <!-- 底部按钮 -->
  51. <!-- <bottom-menu
  52. :cartCount='cartCount'
  53. :disabled="productData.validFlag"
  54. @showSpec='handleShowSpec'>
  55. </bottom-menu> -->
  56. <!--底部选择模态层弹窗组件 -->
  57. <!-- <popup-goods
  58. ref="popupGoods"
  59. :product ="product"
  60. :retailPrice="retailPrice"
  61. :smallMoney="smallMoney"
  62. :number = "minBuyNumber"
  63. @numberChang='handlNumberChang'>
  64. </popup-goods> -->
  65. </view>
  66. </template>
  67. <script>
  68. import popupGoods from '@/components/module/popupGoods/popupGoods.vue' //底部确认选择商品及数量弹窗
  69. import bottomMenu from '@/components/module/bottomMenu/bottomMenu.vue' //底部按钮
  70. export default{
  71. components:{
  72. popupGoods,
  73. bottomMenu
  74. },
  75. name:'product',
  76. props:{
  77. productDetails:Object
  78. // retailPrice:{
  79. // type:String,
  80. // value:'0'
  81. // },
  82. // smallMoney:{
  83. // type:String,
  84. // value:'0'
  85. // },
  86. // minBuyNumber:{
  87. // type:Number,
  88. // value:0
  89. // },
  90. // cartCount:{
  91. // type:Number,
  92. // value:0
  93. // }
  94. },
  95. data() {
  96. return{
  97. mode:'round',
  98. current:0,
  99. productData:'',
  100. productImage:'',
  101. products:this.productDetails,
  102. banner:[
  103. "https://img.caimei365.com/group1/M00/02/6D/Cmis21xFeHGAIyUTAAPeRga1_H464.JPEG",
  104. "https://img.caimei365.com/group1/M00/00/A7/Cmis2Frj6iSABfMEAAUuHrw9zu404.JPEG",
  105. "http://admin2.caimei365.com/uploadFile/product/2019-11-06/9DZYQ9MMMX20191106174856.png",
  106. "https://img.caimei365.com/group1/M00/01/14/Cmis21ujYMWAcnSLAAXdIAYzR9o49.JPEG",
  107. ],
  108. }
  109. },
  110. created() {
  111. this.getOrganizeProducts()
  112. },
  113. methods:{
  114. getOrganizeProducts(){
  115. console.log(this.products)
  116. },
  117. //轮播图切换
  118. swiperChange(e) {
  119. const index = e.detail.current;
  120. this.current = index;
  121. // console.log(this.product.current)
  122. },
  123. //预览图片
  124. previewImg () {
  125. let previewUrls = this.product.banner
  126. // console.log( previewUrls)
  127. uni.previewImage({
  128. current: 0, //图片索引
  129. urls: previewUrls, //必须是http图片,本地图片无效
  130. longPressActions:''
  131. })
  132. },
  133. handleShowSpec(data){
  134. this.$refs.popupGoods.showSpec(data);
  135. }
  136. },
  137. onShow(){
  138. }
  139. }
  140. </script>
  141. <style lang="scss">
  142. .banner-section{
  143. width: 100%;
  144. height: 750rpx;
  145. position: relative;
  146. border-bottom: 1px solid #EBEBEB;
  147. }
  148. .banner{
  149. width: 100%;
  150. height: 750rpx;
  151. image {
  152. width: 100%;
  153. height: 100%;
  154. }
  155. }
  156. .swiper__dots-box{
  157. position: absolute;
  158. bottom: 24px;
  159. right: 24rpx;
  160. /* #ifndef APP-NVUE */
  161. display: flex;
  162. /* #endif */
  163. flex: 1;
  164. flex-direction: row;
  165. justify-content: center;
  166. align-items: center;
  167. height: 12rpx;
  168. padding: 10rpx;
  169. background: rgba(174,174,174,0.6);
  170. border-radius:16rpx;
  171. .swiper__dots-item{
  172. width: 12rpx;
  173. height: 12rpx;
  174. border-radius: 100%;
  175. margin: 6rpx;
  176. background: rgba(62,62,62,1);
  177. }
  178. .none{
  179. background:#FFFFFF;
  180. }
  181. .swiper__dots-long{
  182. background: rgba(62,62,62,1);
  183. transition: all 0.1s;
  184. }
  185. }
  186. .product-wrap{
  187. width: 702rpx;
  188. height: auto;
  189. padding: 24rpx;
  190. margin-bottom: 24rpx;
  191. background-color: #FFFFFF;
  192. .wrap-top{
  193. width: 100%;
  194. height: 146rpx;
  195. float: left;
  196. .p-title{
  197. line-height: 40rpx;
  198. font-size: $font-size-28;
  199. color: $text-color;
  200. -o-text-overflow: ellipsis;
  201. text-overflow: ellipsis;
  202. display: -webkit-box;
  203. word-break: break-all;
  204. -webkit-box-orient: vertical;
  205. -webkit-line-clamp: 2;
  206. overflow: hidden;
  207. margin-bottom: 24rpx;
  208. }
  209. .p-price{
  210. height: 44rpx;
  211. line-height: 44rpx;
  212. .txt{
  213. color: #FF2A2A;
  214. margin:0 2rpx;
  215. }
  216. .txt.sm{
  217. font-size: $font-size-24;
  218. }
  219. .txt.big{
  220. font-size: $font-size-32;
  221. }
  222. }
  223. }
  224. .wrap-label{
  225. float: left;
  226. width: 100%;
  227. padding: 24rpx 0;
  228. .label-a{
  229. padding: 0 18rpx;
  230. line-height: 40rpx;
  231. font-size: $font-size-24;
  232. color: #FFFFFF;
  233. text-align: center;
  234. border-radius: 20rpx;
  235. background:linear-gradient(333deg,rgba(255,171,158,1) 0%,rgba(236,106,93,1) 100%);
  236. margin: 0 22rpx 22rpx 0;
  237. display: inline-block;
  238. }
  239. }
  240. .wrap-info{
  241. width: 100%;
  242. display: flex;
  243. .info-viewL{
  244. flex: 5;
  245. }
  246. .info-viewR{
  247. flex: 5;
  248. }
  249. .info-f{
  250. font-size: $font-size-28;
  251. color: $text-color;
  252. line-height: 40rpx;
  253. margin-bottom: 24rpx;
  254. text-align: left;
  255. -o-text-overflow: ellipsis;
  256. text-overflow: ellipsis;
  257. display: -webkit-box;
  258. word-break: break-all;
  259. -webkit-box-orient: vertical;
  260. -webkit-line-clamp: 1;
  261. overflow: hidden;
  262. }
  263. }
  264. .wrap-seve{
  265. width: 100%;
  266. height: 96rpx;
  267. line-height: 96rpx;
  268. font-size: $font-size-28;
  269. color: $text-color;
  270. .iconfont{
  271. color: $color-system;
  272. margin-left: 16rpx;
  273. }
  274. .text{
  275. font-size: $font-size-24;
  276. color: $text-color;
  277. margin-left: 16rpx;
  278. }
  279. }
  280. }
  281. </style>