productDetails.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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. },
  116. //轮播图切换
  117. swiperChange(e) {
  118. const index = e.detail.current;
  119. this.current = index;
  120. },
  121. //预览图片
  122. previewImg () {
  123. let previewUrls = this.product.banner
  124. // console.log( previewUrls)
  125. uni.previewImage({
  126. current: 0, //图片索引
  127. urls: previewUrls, //必须是http图片,本地图片无效
  128. longPressActions:''
  129. })
  130. },
  131. handleShowSpec(data){
  132. this.$refs.popupGoods.showSpec(data);
  133. }
  134. },
  135. onShow(){
  136. }
  137. }
  138. </script>
  139. <style lang="scss">
  140. .banner-section{
  141. width: 100%;
  142. height: 750rpx;
  143. position: relative;
  144. border-bottom: 1px solid #EBEBEB;
  145. }
  146. .banner{
  147. width: 100%;
  148. height: 750rpx;
  149. image {
  150. width: 100%;
  151. height: 100%;
  152. }
  153. }
  154. .swiper__dots-box{
  155. position: absolute;
  156. bottom: 24px;
  157. right: 24rpx;
  158. /* #ifndef APP-NVUE */
  159. display: flex;
  160. /* #endif */
  161. flex: 1;
  162. flex-direction: row;
  163. justify-content: center;
  164. align-items: center;
  165. height: 12rpx;
  166. padding: 10rpx;
  167. background: rgba(174,174,174,0.6);
  168. border-radius:16rpx;
  169. .swiper__dots-item{
  170. width: 12rpx;
  171. height: 12rpx;
  172. border-radius: 100%;
  173. margin: 6rpx;
  174. background: rgba(62,62,62,1);
  175. }
  176. .none{
  177. background:#FFFFFF;
  178. }
  179. .swiper__dots-long{
  180. background: rgba(62,62,62,1);
  181. transition: all 0.1s;
  182. }
  183. }
  184. .product-wrap{
  185. width: 702rpx;
  186. height: auto;
  187. padding: 24rpx;
  188. margin-bottom: 24rpx;
  189. background-color: #FFFFFF;
  190. .wrap-top{
  191. width: 100%;
  192. height: 146rpx;
  193. float: left;
  194. .p-title{
  195. line-height: 40rpx;
  196. font-size: $font-size-28;
  197. color: $text-color;
  198. -o-text-overflow: ellipsis;
  199. text-overflow: ellipsis;
  200. display: -webkit-box;
  201. word-break: break-all;
  202. -webkit-box-orient: vertical;
  203. -webkit-line-clamp: 2;
  204. overflow: hidden;
  205. margin-bottom: 24rpx;
  206. }
  207. .p-price{
  208. height: 44rpx;
  209. line-height: 44rpx;
  210. .txt{
  211. color: #FF2A2A;
  212. margin:0 2rpx;
  213. }
  214. .txt.sm{
  215. font-size: $font-size-24;
  216. }
  217. .txt.big{
  218. font-size: $font-size-32;
  219. }
  220. }
  221. }
  222. .wrap-label{
  223. float: left;
  224. width: 100%;
  225. padding: 24rpx 0;
  226. .label-a{
  227. padding: 0 18rpx;
  228. line-height: 40rpx;
  229. font-size: $font-size-24;
  230. color: #FFFFFF;
  231. text-align: center;
  232. border-radius: 20rpx;
  233. background:linear-gradient(333deg,rgba(255,171,158,1) 0%,rgba(236,106,93,1) 100%);
  234. margin: 0 22rpx 22rpx 0;
  235. display: inline-block;
  236. }
  237. }
  238. .wrap-info{
  239. width: 100%;
  240. display: flex;
  241. .info-viewL{
  242. flex: 5;
  243. }
  244. .info-viewR{
  245. flex: 5;
  246. }
  247. .info-f{
  248. font-size: $font-size-28;
  249. color: $text-color;
  250. line-height: 40rpx;
  251. margin-bottom: 24rpx;
  252. text-align: left;
  253. -o-text-overflow: ellipsis;
  254. text-overflow: ellipsis;
  255. display: -webkit-box;
  256. word-break: break-all;
  257. -webkit-box-orient: vertical;
  258. -webkit-line-clamp: 1;
  259. overflow: hidden;
  260. }
  261. }
  262. .wrap-seve{
  263. width: 100%;
  264. height: 96rpx;
  265. line-height: 96rpx;
  266. font-size: $font-size-28;
  267. color: $text-color;
  268. .iconfont{
  269. color: $color-system;
  270. margin-left: 16rpx;
  271. }
  272. .text{
  273. font-size: $font-size-24;
  274. color: $text-color;
  275. margin-left: 16rpx;
  276. }
  277. }
  278. }
  279. </style>