product.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  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-active">
  50. <image class="icon-active" src="../../static/temp/icon-active.png" mode="" v-if="product.actStatus == 1"></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"
  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. padding: 0 24rpx;
  702. border-bottom: 1px solid #F8F8F8;
  703. .ladder-text{
  704. height: 34rpx;
  705. line-height: 34rpx;
  706. margin-bottom: 24rpx;
  707. font-size: 24rpx;
  708. color: #999999;
  709. .ladder-p{
  710. font-size: 20rpx;
  711. }
  712. }
  713. .ladder-main{
  714. width: 654rpx;
  715. height: 102rpx;
  716. padding: 24rpx;
  717. 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);
  718. background-size: cover;
  719. border-radius: 20rpx;
  720. display: flex;
  721. .ladder-left{
  722. flex: 1.5;
  723. line-height: 51rpx;
  724. font-size: 24rpx;
  725. .ladder-b{
  726. text-align-last: justify;
  727. }
  728. }
  729. .ladder-right{
  730. height: 100%;
  731. display: flex;
  732. align-items: center;
  733. flex: 8.5;
  734. .ladder-li{
  735. height: 100%;
  736. flex: 1;
  737. display:flex;
  738. flex-flow: column;
  739. align-items: center;
  740. .ladder-a{
  741. flex: 1;
  742. height: 51rpx;
  743. line-height: 51rpx;
  744. font-size: 26rpx;
  745. text-align: justify;
  746. color: #FA6400;
  747. font-weight: bold;
  748. }
  749. }
  750. }
  751. }
  752. }
  753. .wrap-label{
  754. float: left;
  755. width: 702rpx;
  756. padding: 24rpx 24rpx 0 24rpx;
  757. border-bottom: 1px solid #F8F8F8;
  758. .label-a{
  759. padding: 0 18rpx;
  760. line-height: 40rpx;
  761. font-size: $font-size-24;
  762. color: #FFFFFF;
  763. text-align: center;
  764. border-radius: 20rpx;
  765. background:#FFBB77;
  766. margin: 0 22rpx 22rpx 0;
  767. display: inline-block;
  768. }
  769. }
  770. .wrap-info{
  771. float: left;
  772. width: 702rpx;
  773. padding: 24rpx 24rpx 0 24rpx;
  774. border-bottom: 1px solid #F8F8F8;
  775. .info-viewT{
  776. width: 100%;
  777. min-height: 40rpx;
  778. font-size: $font-size-28;
  779. color: $text-color;
  780. line-height: 40rpx;
  781. text-align: left;
  782. &.none{
  783. color: #999999;
  784. }
  785. .info-viewL{
  786. min-width: 350rpx;
  787. float: left;
  788. margin-bottom: 24rpx;
  789. }
  790. .info-viewR{
  791. min-width: 352rpx;
  792. float: left;
  793. margin-bottom: 24rpx;
  794. }
  795. }
  796. .info-viewB{
  797. width: 100%;
  798. height: auto;
  799. }
  800. .info-f{
  801. width: 50%;
  802. float: left;
  803. font-size: $font-size-28;
  804. color: $text-color;
  805. line-height: 40rpx;
  806. margin-bottom: 24rpx;
  807. text-align: left;
  808. }
  809. }
  810. .wrap-seve{
  811. float: left;
  812. width: 702rpx;
  813. padding: 0 24rpx;
  814. height: 72rpx;
  815. line-height: 72rpx;
  816. font-size: $font-size-28;
  817. color: $text-color;
  818. border-bottom: 1px solid #F8F8F8;
  819. &.none{
  820. color: #999999;
  821. .text{
  822. color: #999999;
  823. }
  824. }
  825. .iconfont{
  826. color: $color-system;
  827. margin-left: 20rpx;
  828. font-size: $font-size-24;
  829. }
  830. .text{
  831. font-size: $font-size-24;
  832. color: $text-color;
  833. margin-left: 10rpx;
  834. }
  835. }
  836. }
  837. .product-details {
  838. height: 100%;
  839. background: #FFFFFF;
  840. .navbar {
  841. width: 702rpx;
  842. height: 96rpx;
  843. padding: 0 24rpx;
  844. background: #fff;
  845. z-index: 10;
  846. display: flex;
  847. border-bottom: 1px solid #F8F8F8;
  848. &.fixed{
  849. position: fixed;
  850. left: 0;
  851. }
  852. .nav-item {
  853. display: flex;
  854. flex: 1;
  855. justify-content: center;
  856. align-items: center;
  857. height: 96rpx;
  858. font-size: $font-size-28;
  859. color: $text-color;
  860. position: relative;
  861. float: left;
  862. position: relative;
  863. .line{
  864. width: 60%;
  865. height: 2px;
  866. border-radius: 1px;
  867. background: #FFFFFF;
  868. position: absolute;
  869. bottom: 0;
  870. left: 50%;
  871. margin-left: -30%;
  872. }
  873. &.current{
  874. color:$color-system;
  875. .line{
  876. background: $color-system;
  877. }
  878. }
  879. }
  880. }
  881. .content{
  882. width: 100%;
  883. min-height: 750rpx;
  884. }
  885. }
  886. .isLower{
  887. width: 100%;
  888. height: 116rpx;
  889. line-height: 116rpx;
  890. text-align: center;
  891. color: #000000;
  892. font-size: $font-size-32;
  893. font-weight: bold;
  894. }
  895. .bottom-btn{
  896. width: 100%;
  897. height: 110rpx;
  898. position: fixed;
  899. bottom: 0;
  900. left: 0;
  901. background: #FFFFFF;
  902. z-index: 99;
  903. .bottom-le{
  904. width: 302rpx;
  905. height: 86rpx;
  906. padding:12rpx 24rpx;
  907. float: left;
  908. .item-bt{
  909. width: 86rpx;
  910. height: 100%;
  911. margin-right:22rpx;
  912. display: flex;
  913. float: left;
  914. flex-direction: column;
  915. align-items: center;
  916. font-size: $font-size-24;
  917. color: $text-color;
  918. line-height: 34rpx;
  919. position: relative;
  920. .animation-num{
  921. font-size:$font-size-32 ;
  922. color: #FF2A2A;
  923. position: absolute;
  924. top: -12rpx;
  925. right: 4rpx;
  926. font-weight: bold;
  927. }
  928. .animation{
  929. animation: showAmnation 2.2s ease-in-out both;
  930. }
  931. .restion{
  932. animation: hideAmnation 1s ease-in-out both;
  933. }
  934. .icon-num{
  935. position: absolute;
  936. right:-12rpx;
  937. top: -9rpx;
  938. }
  939. .icon-num.goleft{
  940. right: 4rpx;
  941. }
  942. &:last-child{
  943. margin-right: 0;
  944. }
  945. image {
  946. width: 40rpx;
  947. height: 40rpx;
  948. margin-bottom: 8rpx;
  949. }
  950. button.contact-btn{
  951. width: 100%;
  952. height: 100%;
  953. margin: 0;
  954. padding: 0;
  955. display: flex;
  956. flex-direction: column;
  957. align-items: center;
  958. box-sizing: border-box;
  959. font-size: $font-size-24;
  960. text-align: center;
  961. text-decoration: none;
  962. line-height: 34rpx;
  963. border-radius: 0;
  964. -webkit-tap-highlight-color: transparent;
  965. overflow: hidden;
  966. color: $text-color;
  967. background-color:#FFFFFF;
  968. }
  969. }
  970. }
  971. .bottom-ri{
  972. width: 400rpx;
  973. height: 100%;
  974. float: right;
  975. display: flex;
  976. .btn{
  977. flex: 1;
  978. width: 200rpx;
  979. line-height: 110rpx;
  980. text-align: center;
  981. font-size: $font-size-28;
  982. color: #FFFFFF;
  983. }
  984. .btn-cart{
  985. background-color: #EFAF00;
  986. }
  987. .btn-cart.disabled{
  988. background-color: rgba(239, 175, 0, 0.5);
  989. }
  990. .btn-bay{
  991. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  992. }
  993. .btn-bay.disabled{
  994. background-color: linear-gradient(135deg,rgba(242,143,49,0.5) 0%,rgba(225,86,22,0.5) 100%);;
  995. }
  996. }
  997. }
  998. .uni-badge--small {
  999. -webkit-transform: scale(.8);
  1000. -ms-transform: scale(.8);
  1001. transform: scale(.8);
  1002. -webkit-transform-origin: center center;
  1003. -ms-transform-origin: center center;
  1004. transform-origin: center center;
  1005. }
  1006. .uni-badge {
  1007. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  1008. -webkit-box-sizing: border-box;
  1009. box-sizing: border-box;
  1010. font-size: 12px;
  1011. line-height: 1;
  1012. display: inline-block;
  1013. padding: 3px 6px;
  1014. color: #333;
  1015. border-radius: 100px;
  1016. background-color: #f1f1f1;
  1017. }
  1018. .uni-badge-error {
  1019. color: #fff;
  1020. background-color: #dd524d;
  1021. }
  1022. /* 加入购物模态层*/
  1023. @keyframes showPopup {
  1024. 0% {
  1025. opacity: 0;
  1026. }
  1027. 100% {
  1028. opacity: 1;
  1029. }
  1030. }
  1031. @keyframes hidePopup {
  1032. 0% {
  1033. opacity: 1;
  1034. }
  1035. 100% {
  1036. opacity: 0;
  1037. }
  1038. }
  1039. @keyframes showLayer {
  1040. 0% {
  1041. transform: translateY(0);
  1042. }
  1043. 100% {
  1044. transform: translateY(-100%);
  1045. }
  1046. }
  1047. @keyframes hideLayer {
  1048. 0% {
  1049. transform: translateY(-100%);
  1050. }
  1051. 100% {
  1052. transform: translateY(0);
  1053. }
  1054. }
  1055. @keyframes showAmnation {
  1056. 0% {
  1057. top: -12rpx;
  1058. opacity: 0;
  1059. }
  1060. 50% {
  1061. top: -60rpx;
  1062. opacity: 1;
  1063. }
  1064. 100% {
  1065. top: -100rpx;
  1066. opacity: 0;
  1067. }
  1068. }
  1069. @keyframes hideAmnation {
  1070. 0% {
  1071. top: -100rpx;
  1072. opacity: 0;
  1073. }
  1074. 100% {
  1075. top: -12rpx;
  1076. opacity: 0;
  1077. }
  1078. }
  1079. .popup {
  1080. position: fixed;
  1081. top: 0;
  1082. width: 100%;
  1083. height: 100%;
  1084. z-index: 999;
  1085. display: none;
  1086. .mask{
  1087. position: fixed;
  1088. top: 0;
  1089. width: 100%;
  1090. height: 100%;
  1091. z-index: 21;
  1092. background-color: rgba(0, 0, 0, 0.6);
  1093. }
  1094. .layer {
  1095. position: fixed;
  1096. z-index: 22;
  1097. bottom: -294rpx;
  1098. width: 702rpx;
  1099. padding: 24rpx 24rpx 36rpx 24rpx;
  1100. height: 236rpx;
  1101. border-radius: 30rpx 30rpx 0 0;
  1102. background-color: #fff;
  1103. display: flex;
  1104. flex-wrap: wrap;
  1105. align-content: space-between;
  1106. .content {
  1107. width: 100%;
  1108. }
  1109. .btn {
  1110. width: 100%;
  1111. height: 88rpx;
  1112. .button {
  1113. width: 100%;
  1114. height: 88rpx;
  1115. color: #fff;
  1116. display: flex;
  1117. align-items: center;
  1118. justify-content: center;
  1119. background: $btn-confirm;
  1120. font-size: $font-size-28;
  1121. border-radius: 14rpx;
  1122. }
  1123. }
  1124. }
  1125. &.show {
  1126. display: block;
  1127. .mask{
  1128. animation: showPopup 0.2s linear both;
  1129. }
  1130. .layer {
  1131. animation: showLayer 0.2s linear both;
  1132. }
  1133. }
  1134. &.hide {
  1135. display: block;
  1136. .mask{
  1137. animation: hidePopup 0.2s linear both;
  1138. }
  1139. .layer {
  1140. animation: hideLayer 0.2s linear both;
  1141. }
  1142. }
  1143. &.none {
  1144. display: none;
  1145. }
  1146. &.service {
  1147. .row {
  1148. margin: 30upx 0;
  1149. .title {
  1150. font-size: 30upx;
  1151. margin: 10upx 0;
  1152. }
  1153. .description {
  1154. font-size: 28upx;
  1155. color: #999;
  1156. }
  1157. }
  1158. }
  1159. .layer-smimg{
  1160. width: 114rpx;
  1161. height: 114rpx;
  1162. float: left;
  1163. border-radius: 10rpx;
  1164. margin-right: 24rpx;
  1165. image{
  1166. width: 114rpx;
  1167. height: 114rpx;
  1168. border-radius: 10rpx;
  1169. }
  1170. }
  1171. .layer-nunbox{
  1172. justify-content: space-between;
  1173. align-items: center;
  1174. width: 536rpx;
  1175. height: 88rpx;
  1176. padding: 13rpx 0 0 0;
  1177. float: left;
  1178. .layer-nunbox-t{
  1179. width: 100%;
  1180. height:44rpx;
  1181. position:relative;
  1182. display: flex;
  1183. .layer-nunbox-text{
  1184. line-height: 44rpx;
  1185. font-size: $font-size-28;
  1186. }
  1187. .number-box{
  1188. display: flex;
  1189. justify-content: center;
  1190. align-items: center;
  1191. .iconfont{
  1192. font-size: $font-size-32;
  1193. padding:0 20rpx;
  1194. font-size: $text-color;
  1195. }
  1196. .btn-input{
  1197. width: 62rpx;
  1198. height: 48rpx;
  1199. line-height: 48rpx;
  1200. background: #F8F8F8;
  1201. border-radius: 4rpx;
  1202. text-align: center;
  1203. font-size: $font-size-28;
  1204. }
  1205. }
  1206. .product-step{
  1207. position: absolute;
  1208. left: 45rpx;
  1209. bottom: 0;
  1210. height: 44rpx;
  1211. background: #FFFFFF;
  1212. }
  1213. }
  1214. .layer-nunbox-b{
  1215. width: 100%;
  1216. height:44rpx;
  1217. margin-top: 13rpx;
  1218. }
  1219. .text{
  1220. line-height: 44rpx;
  1221. font-size: $font-size-28;
  1222. .p{
  1223. color: #FF2A2A;
  1224. }
  1225. .p:first-child{
  1226. margin-left: 30rpx;
  1227. }
  1228. .p.sm{
  1229. font-size: $font-size-24;
  1230. }
  1231. }
  1232. }
  1233. }
  1234. /*富文本样式*/
  1235. rich-text.p{
  1236. width: 702rpx !important;
  1237. padding: 0 24rpx;
  1238. text-align: justify;
  1239. }
  1240. rich-text.img{
  1241. width: 100%;
  1242. height: auto;
  1243. }
  1244. </style>