product.vue 32 KB

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