product.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219
  1. <template>
  2. <view class="product" :style="{paddingBottom: userIdentity==1 ? '0rpx' :'120rpx'}">
  3. <header-poduct v-if="isHeaderPoduct"
  4. :systeminfo='systeminfo'
  5. :navbar-data='nvabarData'
  6. :headerBtnPosi ="headerBtnPosi"
  7. :headerColor="headerColor"
  8. :type="isShareType"
  9. :page='backPage'>
  10. </header-poduct>
  11. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="9"></tui-skeleton>
  12. <view class="container-product tui-skeleton">
  13. <view class="product-top">
  14. <view class="banner-section">
  15. <uni-swiper-dot :info="productImage" :current="current" field="content" :mode="mode" >
  16. <swiper class="banner tui-banner tui-skeleton-rect" circular @change="swiperChange" :duration='800' :autoplay="false" :circular="false" >
  17. <swiper-item v-for="(item, index) in productImage" :key="index" class="banner-item">
  18. <image :src="item" @click="previewImg(index)" />
  19. </swiper-item>
  20. </swiper>
  21. <view class="swiper__dots-box">
  22. <view v-for="(item,idx) in productImage"
  23. :key="idx"
  24. :class="[idx===current?'swiper__dots-long':'none']"
  25. :data-index="current" class="swiper__dots-item">
  26. </view>
  27. </view>
  28. </uni-swiper-dot>
  29. </view>
  30. <view class="product-wrap clearfix">
  31. <view class="wrap-top" :class="goodsData.isNoneDisabled ? 'none' : ''">
  32. <view class="p-title tui-skeleton-fillet">
  33. {{product.name == undefined ? '' : product.name}}
  34. </view>
  35. <view class="wrap-top-price" v-if="!goodsData.isNoneDisabled">
  36. <view v-if="!hasLogin" class="p-login grade tui-skeleton-fillet">
  37. <text class="p-no">价格:</text>
  38. <uni-stars :stars="parseInt(product.price1Grade)" :font-size='36' :width-info="180"></uni-stars>
  39. </view>
  40. <view v-if="!hasLogin" class="p-login tui-skeleton-fillet">
  41. <text @click.stop="navToLogin">登录查看价格<text class="iconfont icon-xiayibu" style="font-size: 22rpx;margin: 0 6rpx;"></text></text>
  42. </view>
  43. <view class="wrap-main" v-else>
  44. <view class="wrap-main-pricenone" v-if="product.price1TextFlag == 1">
  45. <text>该商品尚未公开价格,请联系客服购买</text>
  46. </view>
  47. <view class="wrap-main-price" v-else>
  48. <view class="p-main" v-if="ladderPriceFlag == '0' || product.actStatus == 1">
  49. <view class="p-price tui-skeleton-fillet">
  50. <text class="txt sm">¥</text>
  51. <text class="txt big">{{retailPrice}}</text>
  52. <text class="txt big">{{smallMoney== '0'?'.00':smallMoney}}</text>
  53. </view>
  54. <view class="p-minBuy">
  55. 起订量:
  56. <text class="min-text">{{minBuyNumber}}</text>
  57. </view>
  58. </view>
  59. <view class="wrap-ladder" v-else>
  60. <view class="ladder-text">
  61. <text class="ladder-h1">说明:</text>
  62. <text class="ladder-p">本商品有以下优惠购物方案</text>
  63. </view>
  64. <view class="ladder-main tui-skeleton-fillet">
  65. <view class="ladder-left">
  66. <view class="ladder-b">起订量:</view>
  67. <view class="ladder-b">价格:</view>
  68. </view>
  69. <view class="ladder-right">
  70. <view class="ladder-li" v-for="(ladder,index) in ladderPriceList" :key="index">
  71. <view class="ladder-a">{{ladder.buyNumRangeShow}}</view>
  72. <view class="ladder-a">¥{{ladder.buyPrice.toFixed(2)}}</view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="wrap-label" v-if="product.tagsList.length>0">
  82. <view class="label-a tui-skeleton-fillet" v-for="(label,index) in product.tagsList" :key="index">{{label}}</view>
  83. </view>
  84. <view class="wrap-label" v-if="goodsData.isNoneDisabled">
  85. <view class="isLower">此商品已{{disabledText}},请浏览以下推荐商品~</view>
  86. </view>
  87. <view class="wrap-info">
  88. <view class="info-viewT" :class="goodsData.isNoneDisabled ? 'none' : ''">
  89. <view class="info-viewL tui-skeleton-fillet">品牌:<text>{{product.brandName == null? '其他' : product.brandName}}</text></view>
  90. <view class="info-viewR tui-skeleton-fillet">包装规格:<text>{{product.unit}}</text></view>
  91. </view>
  92. </view>
  93. <view class="wrap-seve" :class="goodsData.isNoneDisabled ? 'none' : ''">
  94. <text class="tui-skeleton-rect">服务:</text>
  95. <text class="iconfont icon-dui tui-skeleton-rect"><text class="text">无忧退货</text></text>
  96. <text class="iconfont icon-dui tui-skeleton-rect"><text class="text">快速退款</text></text>
  97. <text class="iconfont icon-dui tui-skeleton-rect"><text class="text">正品保证</text></text>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="product-details">
  102. <!-- 头部 -->
  103. <view v-if="goodsData.isNoneDisabled" class="navbar" :class="navbarFiexd"
  104. :style="{top:headerBtnPosi.bottom + (headerBtnPosi.bottom - headerBtnPosi.height - systeminfo.statusBarHeight) +'px'}">
  105. <view class="nav-item tui-skeleton-fillet" v-for="(item,index) in disabledTabNavList" :key="index" :class="{ current: tabCurrentIndex === index+2 }" @click="tabClick(index+2)">
  106. <text class="line"></text>
  107. <text>{{item.name}}</text>
  108. </view>
  109. </view>
  110. <view v-else class="navbar" :class="navbarFiexd"
  111. :style="{top:headerBtnPosi.bottom + (headerBtnPosi.bottom - headerBtnPosi.height - systeminfo.statusBarHeight) +'px'}">
  112. <view class="nav-item tui-skeleton-fillet" v-for="(item,index) in tabNavList" :key="index" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">
  113. <text class="line"></text>
  114. <text>{{item.name}}</text>
  115. </view>
  116. </view>
  117. <!-- 商品详情,供应商详情展示,相关推荐,评价-->
  118. <view class="content tui-banner tui-skeleton-rect" v-if="tabCurrentIndex === 0">
  119. <parser :html="html" :img-mode="widthFix"></parser>
  120. </view>
  121. <view class="content sup" v-if="tabCurrentIndex === 1">
  122. <supplier-details :shop="shop"></supplier-details>
  123. </view>
  124. <view class="content hot" v-if="tabCurrentIndex === 2">
  125. <recommend :query-productid="product.productID" v-if="isRecommend"></recommend>
  126. </view>
  127. <view class="content hot" v-if="tabCurrentIndex === 3">
  128. <evaluate :query-productid ="product.productID" v-if="isEvaluate"></evaluate>
  129. </view>
  130. </view>
  131. <!-- 底部按钮 -->
  132. <view class="menu" v-if="userIdentity!=1">
  133. <view class="bottom-btn" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  134. <view class="bottom-le">
  135. <view class="item-bt" @click="this.$api.switchTabTo('/pages/tabBar/home/home')">
  136. <image src="../../static/icon-home-active@3x.png"></image>
  137. <text>首页</text>
  138. </view>
  139. <view class="item-bt">
  140. <!-- #ifdef MP-WEIXIN -->
  141. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  142. <image src="../../static/severs@3x.png"></image>
  143. <text>客服</text>
  144. </button>
  145. <!-- #endif -->
  146. </view>
  147. <view class="item-bt" @click="buyProductCart()">
  148. <image src="../../static/icon-cart-active@3x.png"></image>
  149. <text>购物车</text>
  150. <text v-if="hasLogin"
  151. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  152. :class="[goodsData.cartCount < 10 ? 'goleft':'']">
  153. {{ goodsData.cartCount >= 100 ? '99+': goodsData.cartCount}}
  154. </text>
  155. <view class="animation-num" :class="isAnimation ? 'animation' : 'restion'">+1</view>
  156. </view>
  157. </view>
  158. <view class="bottom-ri">
  159. <button
  160. :disabled="goodsData.disabled"
  161. class="btn btn-cart"
  162. :class="[goodsData.disabled ? 'disabled':'']"
  163. @tap.stop="btnGetConfirm('add')">加入购物车</button>
  164. <button
  165. :disabled="goodsData.disabled"
  166. class="btn btn-bay"
  167. :class="[goodsData.disabled ? 'disabled':'']"
  168. @tap.stop="btnGetConfirm('buy')">立即购买</button>
  169. </view>
  170. </view>
  171. </view>
  172. <!--底部选择模态层弹窗组件 -->
  173. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
  174. <!-- 遮罩层 -->
  175. <view class="mask"></view>
  176. <view class="layer" @tap.stop="discard">
  177. <view class="content">
  178. <view class="layer-smimg">
  179. <image :src="product.mainImage" mode=""></image>
  180. </view>
  181. <view class="layer-nunbox">
  182. <view class="layer-nunbox-t">
  183. <view class="layer-nunbox-text">数量:</view>
  184. <view class="number-box">
  185. <view class="iconfont icon-jianhao" :class="[isQuantity==true?'disabled':'']" @click="changeCountSub()"></view>
  186. <input class="btn-input" type="number" v-model="number" maxlength='4' @blur="changeNumber($event)">
  187. <view class="iconfont icon-jiahao" :class="[isStock==true?'disabled':'']" @click="changeCountAdd()"></view>
  188. </view>
  189. </view>
  190. <view class="layer-nunbox-b">
  191. <view class="text">单价:
  192. <text class="p sm">¥</text>
  193. <text class="p bg">{{buyRetailPrice.toFixed(2)}}</text>
  194. </view>
  195. </view>
  196. </view>
  197. </view>
  198. <view class="btn"><view class="button" @click.stop="btnConfirm">确定</view></view>
  199. </view>
  200. </view>
  201. </view>
  202. </view>
  203. </template>
  204. <script>
  205. import { mapState,mapMutations } from 'vuex'
  206. import headerPoduct from '@/components/module/headerNavbar/header-poduct' //自定义导航
  207. import uniStars from '@/components/uni-stars/uni-stars.vue'
  208. import parser from "@/components/jyf-Parser/index" //富文本处理
  209. import tuiSkeleton from "@/components/tui-skeleton/tui-skeleton"
  210. import supplierDetails from "@/components/module/productDetails/supplierDetails" //供应商详情
  211. import recommend from "@/components/module/productDetails/recommend" //供应商详情
  212. import evaluate from "@/components/module/productDetails/evaluate" //供应商详情
  213. import wxLogin from "@/common/config/wxLogin.js"
  214. import { queryProductDetils } from "@/api/product.js"
  215. import { shoppingAddCart } from "@/api/cart.js"
  216. var isPreviewImg;
  217. export default{
  218. components:{
  219. headerPoduct,
  220. parser,
  221. tuiSkeleton,
  222. supplierDetails,
  223. recommend,
  224. evaluate
  225. },
  226. data(){
  227. return{
  228. html:'<div style="text-align: center;color:#333333;">暂无内容</div>',
  229. tabNavList:[{name:'商品详情'},{name:'供应商细信息'},{name:'相关推荐'},{name:'评价'}],
  230. disabledTabNavList:[{name:'相关推荐'},{name:'评价'}],
  231. mode:'round',
  232. specClass: '',//规格弹窗css类,控制开关动画
  233. isBtnType:'',
  234. current:0,
  235. isShareType:'',
  236. isHeaderPoduct:false,
  237. navbarFiexd:'none',
  238. ladderPriceFlag:'',
  239. ladderPriceList:'',
  240. isRecommend:false,
  241. isEvaluate:false,
  242. isAnimation:false,
  243. skeletonShow:true,
  244. isQuantity:false,
  245. isStock:false,
  246. disabled:false,
  247. isNoneDisabled:false,
  248. disabledText:'',
  249. tabCurrentIndex:0,
  250. userID:'',
  251. productID:0,
  252. userIdentity:'',//用户类型
  253. goodsData:{},//自定义数据
  254. shop:{},//供应商信息
  255. product:{},//采美
  256. productImage:[],
  257. retailPrice:0,
  258. buyRetailPrice:0,
  259. stock:0,
  260. number:0,
  261. minBuyNumber:0,
  262. productsList:[],
  263. goodListData:[],
  264. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  265. systeminfo: this.setSysteminfo(), //获取设备信息
  266. isIphoneX:this.$store.state.isIphoneX,
  267. windowHeight: '',
  268. headerColor:false,
  269. backPage:1,
  270. nvabarData: { //顶部自定义导航
  271. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  272. title: '' // 导航栏 中间的标题
  273. }
  274. }
  275. },
  276. onLoad(option) {
  277. this.productID = option.id;//获取商品ID
  278. this.isShareType = option.type
  279. this.isHeaderPoduct = true
  280. if(option.page == 2){
  281. this.backPage = option.page
  282. }
  283. if(this.isShareType =='share'){
  284. wxLogin.wxLoginAuthorize()
  285. }
  286. },
  287. computed: {
  288. ...mapState(['hasLogin','userInfo'])
  289. },
  290. methods:{
  291. initData(){// 初始化商品详情查询
  292. queryProductDetils({userId:this.userID,productID:this.productID}).then(response =>{
  293. this.skeletonShow = false
  294. this.productImage=[];
  295. this.shop = response.data.shop
  296. this.product = response.data
  297. this.ladderPriceFlag = this.product.ladderPriceFlag;
  298. this.html = this.product.productDetail == null ? this.html : this.$api.adaptRichTextImg(this.product.productDetail.detailInfo)
  299. this.stock = this.product.stock
  300. this.number = this.product.minBuyNumber
  301. this.minBuyNumber = this.product.minBuyNumber
  302. //处理商品图片列表
  303. this.product.imageList.forEach(item =>{
  304. this.productImage.push(item.image);
  305. })
  306. //购物车数量
  307. this.goodsData.cartCount = this.product.productCount
  308. //处理阶梯价格
  309. if(this.product.ladderPriceList!=null){
  310. this.ladderPriceList = this.product.ladderPriceList;
  311. }
  312. //拆分金额并转千分位格式显示
  313. if(this.product.retailPrice!=null){
  314. this.retailPrice = this.product.retailPrice.toFixed(2);
  315. //处理除阶梯价格以外的购买价格
  316. // if(this.ladderPriceFlag == '0' || this.product.actFlag == 1){
  317. this.buyRetailPrice = this.product.retailPrice;
  318. }
  319. // }
  320. //处理下架商品和售罄商品
  321. if(this.product.validFlag =='3' || this.stock == 0 ){
  322. this.disabled = true
  323. this.isNoneDisabled = true
  324. this.tabCurrentIndex = 2;// 页面显示是默认选中第一
  325. this.isRecommend = true
  326. this.disabledText = '下架'
  327. }else{
  328. this.disabled = false
  329. this.isNoneDisabled = false
  330. this.tabCurrentIndex = 0;// 页面显示是默认选中第三
  331. this.disabledText = ''
  332. }
  333. if(this.product.price1TextFlag == 1){
  334. this.disabled = true
  335. }
  336. this.goodsData.disabled = this.disabled
  337. this.goodsData.isNoneDisabled = this.isNoneDisabled
  338. if(this.product.validFlag =='3'){
  339. this.disabledText = '下架'
  340. }
  341. if(this.stock == 0){
  342. this.disabledText = '售罄'
  343. }
  344. }).catch(response =>{
  345. this.$util.msg(response.msg,2000);
  346. })
  347. },
  348. swiperChange(e) {//顶部商品图片切换
  349. const index = e.detail.current;
  350. this.current = index;
  351. },
  352. previewImg (index) {//顶部商品图片预览
  353. isPreviewImg = true
  354. let previewUrls = this.productImage
  355. uni.previewImage({
  356. current: index, //图片索引
  357. urls: previewUrls, //必须是http图片,本地图片无效
  358. longPressActions:''
  359. })
  360. },
  361. tabClick(index) {//商品详情&&供应商信息tab切换
  362. this.tabCurrentIndex = index;
  363. if(this.tabCurrentIndex == 2){
  364. this.isRecommend = true
  365. }
  366. if(this.tabCurrentIndex == 3){
  367. this.isEvaluate = true
  368. }
  369. },
  370. changeTab(e) {
  371. this.tabCurrentIndex = e.target.current;
  372. },
  373. handleContact(e){//跳转小程序客服
  374. },
  375. buyProductCart(){//底部购物车按钮点击
  376. if(this.hasLogin){
  377. this.$api.switchTabTo('/pages/tabBar/cart/cart')
  378. }else{
  379. this.$api.navigateTo('/pages/login/login-accont?type=1')
  380. }
  381. },
  382. btnGetConfirm(type){//加入购物车&&立即购买点击
  383. if(this.hasLogin){
  384. this.showSpec(type);
  385. }else{
  386. this.$api.navigateTo('/pages/login/login-accont?type=1')
  387. }
  388. },
  389. changeCountAdd(){//popup弹窗数量增加按钮
  390. this.number++
  391. this.processActivityPrice()
  392. },
  393. changeCountSub(){//popup弹窗数量减按钮
  394. if(this.number<=this.minBuyNumber){
  395. this.number= this.minBuyNumber
  396. this.isQuantity =true
  397. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  398. return
  399. }else{
  400. this.number--
  401. this.processActivityPrice()
  402. this.isQuantity =false
  403. }
  404. },
  405. changeNumber(e){
  406. let _value = e.detail.value;
  407. if(!this.$api.isNumber(_value)){
  408. this.number = this.minBuyNumber
  409. }else if(_value < this.minBuyNumber){
  410. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  411. this.number = this.minBuyNumber
  412. }else{
  413. this.number = e.detail.value
  414. this.processActivityPrice()
  415. }
  416. },
  417. processActivityPrice(){//单独处理活动价格和阶梯价格
  418. if(this.ladderPriceFlag == '0' && this.product.actStatus == 0){
  419. this.buyRetailPrice = this.product.retailPrice
  420. }else{
  421. this.ladderPriceList.forEach((item,index)=>{
  422. if(this.number>=item.buyNum){
  423. this.buyRetailPrice = item.buyPrice
  424. }
  425. })
  426. }
  427. },
  428. showSpec(type) {//显示选择数量确认弹窗
  429. this.isBtnType = type
  430. this.specClass = 'show';
  431. },
  432. hideSpec() {//关闭选择数量确认弹窗
  433. this.specClass = 'hide';
  434. setTimeout(() => {
  435. this.specClass = 'none';
  436. }, 200);
  437. },
  438. btnConfirm() {//加入购物车&&立即购买跳转订单页并关闭弹窗
  439. if(this.isBtnType == 'add'){
  440. this.getAddProductCart()
  441. }else{
  442. this.toConfirmation()
  443. }
  444. },
  445. toConfirmation(){//跳转确认订单页面
  446. this.specClass = 'hide';
  447. let productStp ={
  448. allPrice:this.number*this.buyRetailPrice,
  449. allCount:this.number,
  450. productID:this.product.productID,
  451. productCount:this.number
  452. }
  453. this.$api.navigateTo(`/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({data:productStp})}`)
  454. setTimeout(() => {
  455. this.specClass = 'none';
  456. }, 200);
  457. },
  458. getAddProductCart(){//增加购物车成功和toast弹窗提示成功
  459. shoppingAddCart({productID:this.productID,userID:this.userID,productCount:this.number}).then(response => {
  460. this.specClass = 'hide';
  461. this.$util.msg('加入购物车成功',1500,true,'success')
  462. this.isAnimation = true
  463. setTimeout(() => {this.specClass = 'none'}, 200)
  464. setTimeout(() => {this.isAnimation = false},2000)
  465. this.goodsData.cartCount = response.data;
  466. }).catch(response =>{
  467. this.$util.msg(response.msg,2000);
  468. })
  469. },
  470. navToLogin(){
  471. this.$api.navigateTo(`/pages/login/login-accont?type=detilType&id=${this.productID}`)
  472. },
  473. setHeaderBtnPosi(){
  474. // 获得胶囊按钮位置信息
  475. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  476. return headerBtnPosi
  477. },
  478. setSysteminfo(){
  479. let systeminfo;
  480. uni.getSystemInfo({ // 获取设备信息
  481. success: (res) => {
  482. systeminfo = res
  483. },
  484. })
  485. return systeminfo
  486. },
  487. getOptionFn(e){
  488. this.isShareType = e.type
  489. },
  490. discard(){
  491. //丢弃
  492. }
  493. },
  494. onPageScroll(e){//实时获取到滚动的值
  495. if(e.scrollTop>50){
  496. this.headerColor = true
  497. this.nvabarData={
  498. showCapsule: 1,
  499. title: '商品详情',
  500. }
  501. }else{
  502. this.headerColor = false
  503. this.nvabarData={
  504. showCapsule: 1,
  505. title: '',
  506. }
  507. }
  508. if(e.scrollTop>700){
  509. this.navbarFiexd = 'fixed'
  510. }else{
  511. this.navbarFiexd = 'none'
  512. }
  513. },
  514. onShareAppMessage(res){//分享转发
  515. if (res.from === 'button') {
  516. // 来自页面内转发按钮
  517. }
  518. return {
  519. title: `${this.product.name}`,
  520. path: `pages/goods/product?type=share&id=${this.productID}`,
  521. imageUrl:`${this.productImage[0]}`
  522. }
  523. },
  524. onShow() {
  525. this.$api.getStorage().then((resolve) => {
  526. this.userID = resolve.userID ? resolve.userID : '';
  527. this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 3
  528. if (isPreviewImg) {
  529. isPreviewImg = false;
  530. return;
  531. } else {
  532. this.initData();
  533. }
  534. })
  535. }
  536. }
  537. </script>
  538. <style lang="scss">
  539. page{
  540. background-color: #F7F7F7;
  541. }
  542. .banner-section{
  543. width: 100%;
  544. height: 750rpx;
  545. position: relative;
  546. border-bottom: 1px solid #EBEBEB;
  547. }
  548. .banner{
  549. width: 100%;
  550. height: 750rpx;
  551. image {
  552. width: 100%;
  553. height: 100%;
  554. }
  555. }
  556. .swiper__dots-box{
  557. position: absolute;
  558. bottom: 24px;
  559. right: 24rpx;
  560. /* #ifndef APP-NVUE */
  561. display: flex;
  562. /* #endif */
  563. flex: 1;
  564. flex-direction: row;
  565. justify-content: center;
  566. align-items: center;
  567. height: 12rpx;
  568. padding: 10rpx;
  569. background: rgba(174,174,174,0.6);
  570. border-radius:16rpx;
  571. .swiper__dots-item{
  572. width: 12rpx;
  573. height: 12rpx;
  574. border-radius: 100%;
  575. margin: 6rpx;
  576. background: rgba(62,62,62,1);
  577. }
  578. .none{
  579. background:#FFFFFF;
  580. }
  581. .swiper__dots-long{
  582. background: rgba(62,62,62,1);
  583. transition: all 0.1s;
  584. }
  585. }
  586. .product-wrap{
  587. width: 702rpx;
  588. height: auto;
  589. padding: 24rpx 24rpx 0 24rpx;
  590. background-color: #FFFFFF;
  591. border-bottom: 20rpx solid #F7F7F7;
  592. .wrap-top{
  593. width: 100%;
  594. height: auto;
  595. float: left;
  596. padding-bottom: 24rpx;
  597. border-bottom: 1px solid #F8F8F8;
  598. &.none{
  599. .p-title{
  600. color:#999999
  601. }
  602. }
  603. .p-title{
  604. line-height: 40rpx;
  605. font-size: $font-size-28;
  606. color: $text-color;
  607. font-weight: Bold;
  608. -o-text-overflow: ellipsis;
  609. text-overflow: ellipsis;
  610. display: -webkit-box;
  611. word-break: break-all;
  612. -webkit-box-orient: vertical;
  613. -webkit-line-clamp: 2;
  614. overflow: hidden;
  615. margin-bottom: 16rpx;
  616. }
  617. .wrap-main-pricenone{
  618. line-height: 44rpx;
  619. color: #FF2A2A;
  620. font-size: $font-size-28;
  621. font-weight: 600;
  622. }
  623. .p-price{
  624. height: 44rpx;
  625. line-height: 44rpx;
  626. float: left;
  627. .txt{
  628. color: #FF2A2A;
  629. margin:0 2rpx;
  630. }
  631. .txt.sm{
  632. font-size: $font-size-24;
  633. }
  634. .txt.big{
  635. font-size: $font-size-32;
  636. }
  637. }
  638. .p-minBuy{
  639. height: 44rpx;
  640. line-height: 44rpx;
  641. float: right;
  642. padding: 0 18rpx;
  643. border-radius: 22rpx;
  644. background-color: #EBEBEB;
  645. color: #7F7F7F;
  646. font-size: 24rpx;
  647. text-align: center;
  648. .min-text{
  649. margin: 0 6rpx;
  650. }
  651. }
  652. .p-login{
  653. height: 44rpx;
  654. line-height: 44rpx;
  655. color: $color-system;
  656. font-size: $font-size-24;
  657. &.grade{
  658. margin-bottom: 20rpx;
  659. }
  660. .p-no{
  661. float: left;
  662. margin-right: 5rpx;
  663. font-size: $font-size-28;
  664. }
  665. }
  666. }
  667. .wrap-ladder{
  668. float: left;
  669. width: 100%;
  670. border-bottom: 1px solid #F8F8F8;
  671. .ladder-text{
  672. height: 34rpx;
  673. line-height: 34rpx;
  674. margin-bottom: 24rpx;
  675. font-size: 24rpx;
  676. color: #999999;
  677. .ladder-p{
  678. font-size: 20rpx;
  679. }
  680. }
  681. .ladder-main{
  682. width: 654rpx;
  683. height: 102rpx;
  684. padding: 24rpx;
  685. background: url(https://admin-b.caimei365.com/userfiles/1/images/photo/2020/02/%E9%98%B6%E6%A2%AF%E4%BB%B7%E6%A0%BC%E8%83%8C%E6%99%AF%403x.png);
  686. background-size: cover;
  687. border-radius: 20rpx;
  688. display: flex;
  689. .ladder-left{
  690. flex: 1.5;
  691. line-height: 51rpx;
  692. font-size: 24rpx;
  693. .ladder-b{
  694. text-align-last: justify;
  695. }
  696. }
  697. .ladder-right{
  698. height: 100%;
  699. display: flex;
  700. align-items: center;
  701. flex: 8.5;
  702. .ladder-li{
  703. height: 100%;
  704. flex: 1;
  705. display:flex;
  706. flex-flow: column;
  707. align-items: center;
  708. .ladder-a{
  709. flex: 1;
  710. height: 51rpx;
  711. line-height: 51rpx;
  712. font-size: 26rpx;
  713. text-align: justify;
  714. color: #FA6400;
  715. font-weight: bold;
  716. }
  717. }
  718. }
  719. }
  720. }
  721. .wrap-label{
  722. float: left;
  723. width: 100%;
  724. padding: 24rpx 0 0 0;
  725. border-bottom: 1px solid #F8F8F8;
  726. .label-a{
  727. padding: 0 18rpx;
  728. line-height: 40rpx;
  729. font-size: $font-size-24;
  730. color: #FFFFFF;
  731. text-align: center;
  732. border-radius: 20rpx;
  733. background:#FFBB77;
  734. margin: 0 22rpx 22rpx 0;
  735. display: inline-block;
  736. }
  737. }
  738. .wrap-info{
  739. float: left;
  740. width: 100%;
  741. padding: 24rpx 0 0 0;
  742. border-bottom: 1px solid #F8F8F8;
  743. .info-viewT{
  744. width: 100%;
  745. min-height: 40rpx;
  746. font-size: $font-size-28;
  747. color: $text-color;
  748. line-height: 40rpx;
  749. text-align: left;
  750. &.none{
  751. color: #999999;
  752. }
  753. .info-viewL{
  754. min-width: 350rpx;
  755. float: left;
  756. margin-bottom: 24rpx;
  757. }
  758. .info-viewR{
  759. min-width: 352rpx;
  760. float: left;
  761. margin-bottom: 24rpx;
  762. }
  763. }
  764. .info-viewB{
  765. width: 100%;
  766. height: auto;
  767. }
  768. .info-f{
  769. width: 50%;
  770. float: left;
  771. font-size: $font-size-28;
  772. color: $text-color;
  773. line-height: 40rpx;
  774. margin-bottom: 24rpx;
  775. text-align: left;
  776. }
  777. }
  778. .wrap-seve{
  779. float: left;
  780. width: 100%;
  781. height: 72rpx;
  782. line-height: 72rpx;
  783. font-size: $font-size-28;
  784. color: $text-color;
  785. border-bottom: 1px solid #F8F8F8;
  786. &.none{
  787. color: #999999;
  788. .text{
  789. color: #999999;
  790. }
  791. }
  792. .iconfont{
  793. color: $color-system;
  794. margin-left: 20rpx;
  795. font-size: $font-size-24;
  796. }
  797. .text{
  798. font-size: $font-size-24;
  799. color: $text-color;
  800. margin-left: 10rpx;
  801. }
  802. }
  803. }
  804. .product-details {
  805. height: 100%;
  806. background: #FFFFFF;
  807. .navbar {
  808. width: 702rpx;
  809. height: 96rpx;
  810. padding: 0 24rpx;
  811. background: #fff;
  812. z-index: 10;
  813. display: flex;
  814. border-bottom: 1px solid #F8F8F8;
  815. &.fixed{
  816. position: fixed;
  817. left: 0;
  818. }
  819. .nav-item {
  820. display: flex;
  821. flex: 1;
  822. justify-content: center;
  823. align-items: center;
  824. height: 96rpx;
  825. font-size: $font-size-28;
  826. color: $text-color;
  827. position: relative;
  828. float: left;
  829. position: relative;
  830. .line{
  831. width: 60%;
  832. height: 2px;
  833. border-radius: 1px;
  834. background: #FFFFFF;
  835. position: absolute;
  836. bottom: 0;
  837. left: 50%;
  838. margin-left: -30%;
  839. }
  840. &.current{
  841. color:$color-system;
  842. .line{
  843. background: $color-system;
  844. }
  845. }
  846. }
  847. }
  848. .content{
  849. width: 100%;
  850. min-height: 750rpx;
  851. }
  852. }
  853. .isLower{
  854. width: 100%;
  855. height: 116rpx;
  856. line-height: 116rpx;
  857. text-align: center;
  858. color: #000000;
  859. font-size: $font-size-32;
  860. font-weight: bold;
  861. }
  862. .bottom-btn{
  863. width: 100%;
  864. height: 110rpx;
  865. position: fixed;
  866. bottom: 0;
  867. left: 0;
  868. background: #FFFFFF;
  869. z-index: 99;
  870. .bottom-le{
  871. width: 302rpx;
  872. height: 86rpx;
  873. padding:12rpx 24rpx;
  874. float: left;
  875. .item-bt{
  876. width: 86rpx;
  877. height: 100%;
  878. margin-right:22rpx;
  879. display: flex;
  880. float: left;
  881. flex-direction: column;
  882. align-items: center;
  883. font-size: $font-size-24;
  884. color: $text-color;
  885. line-height: 34rpx;
  886. position: relative;
  887. .animation-num{
  888. font-size:$font-size-32 ;
  889. color: #FF2A2A;
  890. position: absolute;
  891. top: -12rpx;
  892. right: 4rpx;
  893. font-weight: bold;
  894. }
  895. .animation{
  896. animation: showAmnation 2.2s ease-in-out both;
  897. }
  898. .restion{
  899. animation: hideAmnation 1s ease-in-out both;
  900. }
  901. .icon-num{
  902. position: absolute;
  903. right:-12rpx;
  904. top: -9rpx;
  905. }
  906. .icon-num.goleft{
  907. right: 4rpx;
  908. }
  909. &:last-child{
  910. margin-right: 0;
  911. }
  912. image {
  913. width: 40rpx;
  914. height: 40rpx;
  915. margin-bottom: 8rpx;
  916. }
  917. button.contact-btn{
  918. width: 100%;
  919. height: 100%;
  920. margin: 0;
  921. padding: 0;
  922. display: flex;
  923. flex-direction: column;
  924. align-items: center;
  925. box-sizing: border-box;
  926. font-size: $font-size-24;
  927. text-align: center;
  928. text-decoration: none;
  929. line-height: 34rpx;
  930. border-radius: 0;
  931. -webkit-tap-highlight-color: transparent;
  932. overflow: hidden;
  933. color: $text-color;
  934. background-color:#FFFFFF;
  935. }
  936. }
  937. }
  938. .bottom-ri{
  939. width: 400rpx;
  940. height: 100%;
  941. float: right;
  942. display: flex;
  943. .btn{
  944. flex: 1;
  945. width: 200rpx;
  946. line-height: 110rpx;
  947. text-align: center;
  948. font-size: $font-size-28;
  949. color: #FFFFFF;
  950. }
  951. .btn-cart{
  952. background-color: #EFAF00;
  953. }
  954. .btn-cart.disabled{
  955. background-color: rgba(239, 175, 0, 0.5);
  956. }
  957. .btn-bay{
  958. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  959. }
  960. .btn-bay.disabled{
  961. background-color: linear-gradient(135deg,rgba(242,143,49,0.5) 0%,rgba(225,86,22,0.5) 100%);;
  962. }
  963. }
  964. }
  965. .uni-badge--small {
  966. -webkit-transform: scale(.8);
  967. -ms-transform: scale(.8);
  968. transform: scale(.8);
  969. -webkit-transform-origin: center center;
  970. -ms-transform-origin: center center;
  971. transform-origin: center center;
  972. }
  973. .uni-badge {
  974. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  975. -webkit-box-sizing: border-box;
  976. box-sizing: border-box;
  977. font-size: 12px;
  978. line-height: 1;
  979. display: inline-block;
  980. padding: 3px 6px;
  981. color: #333;
  982. border-radius: 100px;
  983. background-color: #f1f1f1;
  984. }
  985. .uni-badge-error {
  986. color: #fff;
  987. background-color: #dd524d;
  988. }
  989. /* 加入购物模态层*/
  990. @keyframes showPopup {
  991. 0% {
  992. opacity: 0;
  993. }
  994. 100% {
  995. opacity: 1;
  996. }
  997. }
  998. @keyframes hidePopup {
  999. 0% {
  1000. opacity: 1;
  1001. }
  1002. 100% {
  1003. opacity: 0;
  1004. }
  1005. }
  1006. @keyframes showLayer {
  1007. 0% {
  1008. transform: translateY(0);
  1009. }
  1010. 100% {
  1011. transform: translateY(-100%);
  1012. }
  1013. }
  1014. @keyframes hideLayer {
  1015. 0% {
  1016. transform: translateY(-100%);
  1017. }
  1018. 100% {
  1019. transform: translateY(0);
  1020. }
  1021. }
  1022. @keyframes showAmnation {
  1023. 0% {
  1024. top: -12rpx;
  1025. opacity: 0;
  1026. }
  1027. 50% {
  1028. top: -60rpx;
  1029. opacity: 1;
  1030. }
  1031. 100% {
  1032. top: -100rpx;
  1033. opacity: 0;
  1034. }
  1035. }
  1036. @keyframes hideAmnation {
  1037. 0% {
  1038. top: -100rpx;
  1039. opacity: 0;
  1040. }
  1041. 100% {
  1042. top: -12rpx;
  1043. opacity: 0;
  1044. }
  1045. }
  1046. .popup {
  1047. position: fixed;
  1048. top: 0;
  1049. width: 100%;
  1050. height: 100%;
  1051. z-index: 999;
  1052. display: none;
  1053. .mask{
  1054. position: fixed;
  1055. top: 0;
  1056. width: 100%;
  1057. height: 100%;
  1058. z-index: 21;
  1059. background-color: rgba(0, 0, 0, 0.6);
  1060. }
  1061. .layer {
  1062. position: fixed;
  1063. z-index: 22;
  1064. bottom: -294rpx;
  1065. width: 702rpx;
  1066. padding: 24rpx 24rpx 36rpx 24rpx;
  1067. height: 236rpx;
  1068. border-radius: 30rpx 30rpx 0 0;
  1069. background-color: #fff;
  1070. display: flex;
  1071. flex-wrap: wrap;
  1072. align-content: space-between;
  1073. .content {
  1074. width: 100%;
  1075. }
  1076. .btn {
  1077. width: 100%;
  1078. height: 88rpx;
  1079. .button {
  1080. width: 100%;
  1081. height: 88rpx;
  1082. color: #fff;
  1083. display: flex;
  1084. align-items: center;
  1085. justify-content: center;
  1086. background: $btn-confirm;
  1087. font-size: $font-size-28;
  1088. border-radius: 14rpx;
  1089. }
  1090. }
  1091. }
  1092. &.show {
  1093. display: block;
  1094. .mask{
  1095. animation: showPopup 0.2s linear both;
  1096. }
  1097. .layer {
  1098. animation: showLayer 0.2s linear both;
  1099. }
  1100. }
  1101. &.hide {
  1102. display: block;
  1103. .mask{
  1104. animation: hidePopup 0.2s linear both;
  1105. }
  1106. .layer {
  1107. animation: hideLayer 0.2s linear both;
  1108. }
  1109. }
  1110. &.none {
  1111. display: none;
  1112. }
  1113. &.service {
  1114. .row {
  1115. margin: 30upx 0;
  1116. .title {
  1117. font-size: 30upx;
  1118. margin: 10upx 0;
  1119. }
  1120. .description {
  1121. font-size: 28upx;
  1122. color: #999;
  1123. }
  1124. }
  1125. }
  1126. .layer-smimg{
  1127. width: 114rpx;
  1128. height: 114rpx;
  1129. float: left;
  1130. border-radius: 10rpx;
  1131. margin-right: 24rpx;
  1132. image{
  1133. width: 114rpx;
  1134. height: 114rpx;
  1135. border-radius: 10rpx;
  1136. }
  1137. }
  1138. .layer-nunbox{
  1139. justify-content: space-between;
  1140. align-items: center;
  1141. width: 536rpx;
  1142. height: 88rpx;
  1143. padding: 13rpx 0 0 0;
  1144. float: left;
  1145. .layer-nunbox-t{
  1146. width: 100%;
  1147. height:44rpx;
  1148. position:relative;
  1149. display: flex;
  1150. .layer-nunbox-text{
  1151. line-height: 44rpx;
  1152. font-size: $font-size-28;
  1153. }
  1154. .number-box{
  1155. display: flex;
  1156. justify-content: center;
  1157. align-items: center;
  1158. .iconfont{
  1159. font-size: $font-size-32;
  1160. padding:0 20rpx;
  1161. font-size: $text-color;
  1162. }
  1163. .btn-input{
  1164. width: 62rpx;
  1165. height: 48rpx;
  1166. line-height: 48rpx;
  1167. background: #F8F8F8;
  1168. border-radius: 4rpx;
  1169. text-align: center;
  1170. font-size: $font-size-28;
  1171. }
  1172. }
  1173. .product-step{
  1174. position: absolute;
  1175. left: 45rpx;
  1176. bottom: 0;
  1177. height: 44rpx;
  1178. background: #FFFFFF;
  1179. }
  1180. }
  1181. .layer-nunbox-b{
  1182. width: 100%;
  1183. height:44rpx;
  1184. margin-top: 13rpx;
  1185. }
  1186. .text{
  1187. line-height: 44rpx;
  1188. font-size: $font-size-28;
  1189. .p{
  1190. color: #FF2A2A;
  1191. }
  1192. .p:first-child{
  1193. margin-left: 30rpx;
  1194. }
  1195. .p.sm{
  1196. font-size: $font-size-24;
  1197. }
  1198. }
  1199. }
  1200. }
  1201. /*富文本样式*/
  1202. rich-text.p{
  1203. width: 702rpx !important;
  1204. padding: 0 24rpx;
  1205. text-align: justify;
  1206. }
  1207. rich-text.img{
  1208. width: 100%;
  1209. height: auto;
  1210. }
  1211. </style>