product.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  1. <template>
  2. <view class="product">
  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.actFlag == 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. console.log(this.isShareType)
  281. if(option.page == 2){
  282. this.backPage = option.page
  283. }
  284. if(this.isShareType =='share'){
  285. wxLogin.wxLoginAuthorize()
  286. }
  287. },
  288. computed: {
  289. ...mapState(['hasLogin','userInfo'])
  290. },
  291. methods:{
  292. initData(){// 初始化商品详情查询
  293. queryProductDetils({userId:this.userID,productID:this.productID}).then(response =>{
  294. this.skeletonShow = false
  295. this.productImage=[];
  296. this.shop = response.data.shop
  297. this.product = response.data
  298. this.ladderPriceFlag = this.product.ladderPriceFlag;
  299. this.html = this.product.productDetail == null ? this.html : this.$api.adaptRichTextImg(this.product.productDetail.detailInfo)
  300. this.stock = this.product.stock
  301. this.number = this.product.minBuyNumber
  302. this.minBuyNumber = this.product.minBuyNumber
  303. //处理商品图片列表
  304. this.product.imageList.forEach(item =>{
  305. this.productImage.push(item.image);
  306. })
  307. //购物车数量
  308. this.goodsData.cartCount = this.product.productCount
  309. //处理阶梯价格
  310. if(this.product.ladderPriceList!=null){
  311. this.ladderPriceList = this.product.ladderPriceList;
  312. }
  313. //拆分金额并转千分位格式显示
  314. if(this.product.retailPrice!=null){
  315. this.retailPrice = this.product.retailPrice.toFixed(2);
  316. //处理除阶梯价格以外的购买价格
  317. // if(this.ladderPriceFlag == '0' || this.product.actFlag == 1){
  318. this.buyRetailPrice = this.product.retailPrice;
  319. }
  320. // }
  321. //处理下架商品和售罄商品
  322. if(this.product.validFlag =='3' || this.stock == 0 ){
  323. this.disabled = true
  324. this.isNoneDisabled = true
  325. this.tabCurrentIndex = 2;// 页面显示是默认选中第一
  326. this.isRecommend = true
  327. this.disabledText = '下架'
  328. }else{
  329. this.disabled = false
  330. this.isNoneDisabled = false
  331. this.tabCurrentIndex = 0;// 页面显示是默认选中第三
  332. this.disabledText = ''
  333. }
  334. if(this.product.price1TextFlag == 1){
  335. this.disabled = true
  336. }
  337. this.goodsData.disabled = this.disabled
  338. this.goodsData.isNoneDisabled = this.isNoneDisabled
  339. if(this.product.validFlag =='3'){
  340. this.disabledText = '下架'
  341. }
  342. if(this.stock == 0){
  343. this.disabledText = '售罄'
  344. }
  345. }).catch(response =>{
  346. this.$util.msg(response.msg,2000);
  347. })
  348. },
  349. swiperChange(e) {//顶部商品图片切换
  350. const index = e.detail.current;
  351. this.current = index;
  352. },
  353. previewImg (index) {//顶部商品图片预览
  354. isPreviewImg = true
  355. let previewUrls = this.productImage
  356. uni.previewImage({
  357. current: index, //图片索引
  358. urls: previewUrls, //必须是http图片,本地图片无效
  359. longPressActions:''
  360. })
  361. },
  362. tabClick(index) {//商品详情&&供应商信息tab切换
  363. this.tabCurrentIndex = index;
  364. if(this.tabCurrentIndex == 2){
  365. console.log(this.product.productID)
  366. this.isRecommend = true
  367. }
  368. if(this.tabCurrentIndex == 3){
  369. this.isEvaluate = true
  370. }
  371. },
  372. changeTab(e) {
  373. this.tabCurrentIndex = e.target.current;
  374. },
  375. handleContact(e){//跳转小程序客服
  376. console.log(e.detail.path)
  377. console.log(e.detail.query)
  378. },
  379. buyProductCart(){//底部购物车按钮点击
  380. if(this.hasLogin){
  381. this.$api.switchTabTo('/pages/tabBar/cart/cart')
  382. }else{
  383. this.$api.navigateTo('/pages/login/login-accont?type=1')
  384. }
  385. },
  386. btnGetConfirm(type){//加入购物车&&立即购买点击
  387. if(this.hasLogin){
  388. this.showSpec(type);
  389. }else{
  390. this.$api.navigateTo('/pages/login/login-accont?type=1')
  391. }
  392. },
  393. changeCountAdd(){//popup弹窗数量增加按钮
  394. this.number++
  395. this.processActivityPrice()
  396. },
  397. changeCountSub(){//popup弹窗数量减按钮
  398. if(this.number<=this.minBuyNumber){
  399. this.number= this.minBuyNumber
  400. this.isQuantity =true
  401. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  402. return
  403. }else{
  404. this.number--
  405. this.processActivityPrice()
  406. this.isQuantity =false
  407. }
  408. },
  409. changeNumber(e){
  410. let _value = e.detail.value;
  411. if(!this.$api.isNumber(_value)){
  412. this.number = this.minBuyNumber
  413. }else if(_value < this.minBuyNumber){
  414. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  415. this.number = this.minBuyNumber
  416. }else{
  417. this.number = e.detail.value
  418. this.processActivityPrice()
  419. }
  420. },
  421. processActivityPrice(){//单独处理活动价格和阶梯价格
  422. if(this.ladderPriceFlag == '1' && this.product.actFlag == 1){
  423. this.buyRetailPrice = this.product.retailPrice
  424. }else{
  425. this.ladderPriceList.forEach((item,index)=>{
  426. if(this.number>=item.buyNum){
  427. this.buyRetailPrice = item.buyPrice
  428. }
  429. })
  430. }
  431. },
  432. showSpec(type) {//显示选择数量确认弹窗
  433. this.isBtnType = type
  434. this.specClass = 'show';
  435. },
  436. hideSpec() {//关闭选择数量确认弹窗
  437. this.specClass = 'hide';
  438. setTimeout(() => {
  439. this.specClass = 'none';
  440. }, 200);
  441. },
  442. btnConfirm() {//加入购物车&&立即购买跳转订单页并关闭弹窗
  443. if(this.isBtnType == 'add'){
  444. this.getAddProductCart()
  445. }else{
  446. this.toConfirmation()
  447. }
  448. },
  449. toConfirmation(){//跳转确认订单页面
  450. this.specClass = 'hide';
  451. let productStp ={
  452. allPrice:this.number*this.buyRetailPrice,
  453. allCount:this.number,
  454. productID:this.product.productID,
  455. productCount:this.number
  456. }
  457. this.$api.navigateTo(`/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({data:productStp})}`)
  458. setTimeout(() => {
  459. this.specClass = 'none';
  460. }, 200);
  461. },
  462. getAddProductCart(){//增加购物车成功和toast弹窗提示成功
  463. shoppingAddCart({productID:this.productID,userID:this.userID,productCount:this.number}).then(response => {
  464. this.specClass = 'hide';
  465. this.$util.msg('加入购物车成功',1500,true,'success')
  466. this.isAnimation = true
  467. setTimeout(() => {this.specClass = 'none'}, 200)
  468. setTimeout(() => {this.isAnimation = false},2000)
  469. this.goodsData.cartCount = response.data;
  470. }).catch(response =>{
  471. this.$util.msg(response.msg,2000);
  472. })
  473. },
  474. navToLogin(){
  475. this.$api.navigateTo(`/pages/login/login-accont?type=detilType&id=${this.productID}`)
  476. },
  477. setHeaderBtnPosi(){
  478. // 获得胶囊按钮位置信息
  479. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  480. // console.log(headerBtnPosi)
  481. return headerBtnPosi
  482. },
  483. setSysteminfo(){
  484. let systeminfo;
  485. uni.getSystemInfo({ // 获取设备信息
  486. success: (res) => {
  487. // console.log(res);
  488. // console.log(res.fontSizeSetting);
  489. // console.log(res.system);
  490. systeminfo = res
  491. },
  492. })
  493. return systeminfo
  494. },
  495. getOptionFn(e){
  496. this.isShareType = e.type
  497. },
  498. discard(){
  499. //丢弃
  500. }
  501. },
  502. onPageScroll(e){
  503. // console.log(e.scrollTop);//实时获取到滚动的值
  504. if(e.scrollTop>50){
  505. this.headerColor = true
  506. this.nvabarData={
  507. showCapsule: 1,
  508. title: '商品详情',
  509. }
  510. }else{
  511. this.headerColor = false
  512. this.nvabarData={
  513. showCapsule: 1,
  514. title: '',
  515. }
  516. }
  517. if(e.scrollTop>700){
  518. this.navbarFiexd = 'fixed'
  519. }else{
  520. this.navbarFiexd = 'none'
  521. }
  522. },
  523. onShareAppMessage(res){//分享转发
  524. if (res.from === 'button') {
  525. // 来自页面内转发按钮
  526. console.log(res.target)
  527. }
  528. return {
  529. title: `${this.product.name}`,
  530. path: `pages/goods/product?type=share&id=${this.productID}`,
  531. imageUrl:`${this.productImage[0]}`
  532. }
  533. },
  534. onShow() {
  535. this.$api.getStorage().then((resolve) => {
  536. this.userID = resolve.userID ? resolve.userID : '';
  537. this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 3
  538. console.log(this.userIdentity)
  539. if (isPreviewImg) {
  540. isPreviewImg = false;
  541. return;
  542. } else {
  543. this.initData();
  544. }
  545. })
  546. }
  547. }
  548. </script>
  549. <style lang="scss">
  550. page{
  551. background-color: #F7F7F7;
  552. }
  553. .product{
  554. padding-bottom: 120rpx;
  555. }
  556. .banner-section{
  557. width: 100%;
  558. height: 750rpx;
  559. position: relative;
  560. border-bottom: 1px solid #EBEBEB;
  561. }
  562. .banner{
  563. width: 100%;
  564. height: 750rpx;
  565. image {
  566. width: 100%;
  567. height: 100%;
  568. }
  569. }
  570. .swiper__dots-box{
  571. position: absolute;
  572. bottom: 24px;
  573. right: 24rpx;
  574. /* #ifndef APP-NVUE */
  575. display: flex;
  576. /* #endif */
  577. flex: 1;
  578. flex-direction: row;
  579. justify-content: center;
  580. align-items: center;
  581. height: 12rpx;
  582. padding: 10rpx;
  583. background: rgba(174,174,174,0.6);
  584. border-radius:16rpx;
  585. .swiper__dots-item{
  586. width: 12rpx;
  587. height: 12rpx;
  588. border-radius: 100%;
  589. margin: 6rpx;
  590. background: rgba(62,62,62,1);
  591. }
  592. .none{
  593. background:#FFFFFF;
  594. }
  595. .swiper__dots-long{
  596. background: rgba(62,62,62,1);
  597. transition: all 0.1s;
  598. }
  599. }
  600. .product-wrap{
  601. width: 702rpx;
  602. height: auto;
  603. padding: 24rpx 24rpx 0 24rpx;
  604. background-color: #FFFFFF;
  605. border-bottom: 20rpx solid #F7F7F7;
  606. .wrap-top{
  607. width: 100%;
  608. height: auto;
  609. float: left;
  610. padding-bottom: 24rpx;
  611. border-bottom: 1px solid #F8F8F8;
  612. &.none{
  613. .p-title{
  614. color:#999999
  615. }
  616. }
  617. .p-title{
  618. line-height: 40rpx;
  619. font-size: $font-size-28;
  620. color: $text-color;
  621. font-weight: Bold;
  622. -o-text-overflow: ellipsis;
  623. text-overflow: ellipsis;
  624. display: -webkit-box;
  625. word-break: break-all;
  626. -webkit-box-orient: vertical;
  627. -webkit-line-clamp: 2;
  628. overflow: hidden;
  629. margin-bottom: 16rpx;
  630. }
  631. .wrap-main-pricenone{
  632. line-height: 44rpx;
  633. color: #FF2A2A;
  634. font-size: $font-size-28;
  635. font-weight: 600;
  636. }
  637. .p-price{
  638. height: 44rpx;
  639. line-height: 44rpx;
  640. float: left;
  641. .txt{
  642. color: #FF2A2A;
  643. margin:0 2rpx;
  644. }
  645. .txt.sm{
  646. font-size: $font-size-24;
  647. }
  648. .txt.big{
  649. font-size: $font-size-32;
  650. }
  651. }
  652. .p-minBuy{
  653. height: 44rpx;
  654. line-height: 44rpx;
  655. float: right;
  656. padding: 0 18rpx;
  657. border-radius: 22rpx;
  658. background-color: #EBEBEB;
  659. color: #7F7F7F;
  660. font-size: 24rpx;
  661. text-align: center;
  662. .min-text{
  663. margin: 0 6rpx;
  664. }
  665. }
  666. .p-login{
  667. height: 44rpx;
  668. line-height: 44rpx;
  669. color: $color-system;
  670. font-size: $font-size-24;
  671. &.grade{
  672. margin-bottom: 20rpx;
  673. }
  674. .p-no{
  675. float: left;
  676. margin-right: 5rpx;
  677. font-size: $font-size-28;
  678. }
  679. }
  680. }
  681. .wrap-ladder{
  682. float: left;
  683. width: 100%;
  684. border-bottom: 1px solid #F8F8F8;
  685. .ladder-text{
  686. height: 34rpx;
  687. line-height: 34rpx;
  688. margin-bottom: 24rpx;
  689. font-size: 24rpx;
  690. color: #999999;
  691. .ladder-p{
  692. font-size: 20rpx;
  693. }
  694. }
  695. .ladder-main{
  696. width: 654rpx;
  697. height: 102rpx;
  698. padding: 24rpx;
  699. 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);
  700. background-size: cover;
  701. border-radius: 20rpx;
  702. display: flex;
  703. .ladder-left{
  704. flex: 1.5;
  705. line-height: 51rpx;
  706. font-size: 24rpx;
  707. .ladder-b{
  708. text-align-last: justify;
  709. }
  710. }
  711. .ladder-right{
  712. height: 100%;
  713. display: flex;
  714. align-items: center;
  715. flex: 8.5;
  716. .ladder-li{
  717. height: 100%;
  718. flex: 1;
  719. display:flex;
  720. flex-flow: column;
  721. align-items: center;
  722. .ladder-a{
  723. flex: 1;
  724. height: 51rpx;
  725. line-height: 51rpx;
  726. font-size: 26rpx;
  727. text-align: justify;
  728. color: #FA6400;
  729. font-weight: bold;
  730. }
  731. }
  732. }
  733. }
  734. }
  735. .wrap-label{
  736. float: left;
  737. width: 100%;
  738. padding: 24rpx 0 0 0;
  739. border-bottom: 1px solid #F8F8F8;
  740. .label-a{
  741. padding: 0 18rpx;
  742. line-height: 40rpx;
  743. font-size: $font-size-24;
  744. color: #FFFFFF;
  745. text-align: center;
  746. border-radius: 20rpx;
  747. background:linear-gradient(135deg,rgba(250,100,0,0.7) 0%,rgba(249,80,63,0.7) 100%);
  748. margin: 0 22rpx 22rpx 0;
  749. display: inline-block;
  750. }
  751. }
  752. .wrap-info{
  753. float: left;
  754. width: 100%;
  755. padding: 24rpx 0 0 0;
  756. border-bottom: 1px solid #F8F8F8;
  757. .info-viewT{
  758. width: 100%;
  759. min-height: 40rpx;
  760. font-size: $font-size-28;
  761. color: $text-color;
  762. line-height: 40rpx;
  763. text-align: left;
  764. &.none{
  765. color: #999999;
  766. }
  767. .info-viewL{
  768. min-width: 350rpx;
  769. float: left;
  770. margin-bottom: 24rpx;
  771. }
  772. .info-viewR{
  773. min-width: 352rpx;
  774. float: left;
  775. margin-bottom: 24rpx;
  776. }
  777. }
  778. .info-viewB{
  779. width: 100%;
  780. height: auto;
  781. }
  782. .info-f{
  783. width: 50%;
  784. float: left;
  785. font-size: $font-size-28;
  786. color: $text-color;
  787. line-height: 40rpx;
  788. margin-bottom: 24rpx;
  789. text-align: left;
  790. }
  791. }
  792. .wrap-seve{
  793. float: left;
  794. width: 100%;
  795. height: 72rpx;
  796. line-height: 72rpx;
  797. font-size: $font-size-28;
  798. color: $text-color;
  799. border-bottom: 1px solid #F8F8F8;
  800. &.none{
  801. color: #999999;
  802. .text{
  803. color: #999999;
  804. }
  805. }
  806. .iconfont{
  807. color: $color-system;
  808. margin-left: 20rpx;
  809. font-size: $font-size-24;
  810. }
  811. .text{
  812. font-size: $font-size-24;
  813. color: $text-color;
  814. margin-left: 10rpx;
  815. }
  816. }
  817. }
  818. .product-details {
  819. height: 100%;
  820. background: #FFFFFF;
  821. .navbar {
  822. width: 702rpx;
  823. height: 96rpx;
  824. padding: 0 24rpx;
  825. background: #fff;
  826. z-index: 10;
  827. display: flex;
  828. border-bottom: 1px solid #F8F8F8;
  829. &.fixed{
  830. position: fixed;
  831. left: 0;
  832. }
  833. .nav-item {
  834. display: flex;
  835. flex: 1;
  836. justify-content: center;
  837. align-items: center;
  838. height: 96rpx;
  839. font-size: $font-size-28;
  840. color: $text-color;
  841. position: relative;
  842. float: left;
  843. position: relative;
  844. .line{
  845. width: 60%;
  846. height: 2px;
  847. border-radius: 1px;
  848. background: #FFFFFF;
  849. position: absolute;
  850. bottom: 0;
  851. left: 50%;
  852. margin-left: -30%;
  853. }
  854. &.current{
  855. color:$color-system;
  856. .line{
  857. background: $color-system;
  858. }
  859. }
  860. }
  861. }
  862. .content{
  863. width: 100%;
  864. min-height: 750rpx;
  865. }
  866. }
  867. .isLower{
  868. width: 100%;
  869. height: 116rpx;
  870. line-height: 116rpx;
  871. text-align: center;
  872. color: #000000;
  873. font-size: $font-size-32;
  874. font-weight: bold;
  875. }
  876. .bottom-btn{
  877. width: 100%;
  878. height: 110rpx;
  879. position: fixed;
  880. bottom: 0;
  881. left: 0;
  882. background: #FFFFFF;
  883. z-index: 99;
  884. .bottom-le{
  885. width: 302rpx;
  886. height: 86rpx;
  887. padding:12rpx 24rpx;
  888. float: left;
  889. .item-bt{
  890. width: 86rpx;
  891. height: 100%;
  892. margin-right:22rpx;
  893. display: flex;
  894. float: left;
  895. flex-direction: column;
  896. align-items: center;
  897. font-size: $font-size-24;
  898. color: $text-color;
  899. line-height: 34rpx;
  900. position: relative;
  901. .animation-num{
  902. font-size:$font-size-32 ;
  903. color: #FF2A2A;
  904. position: absolute;
  905. top: -12rpx;
  906. right: 4rpx;
  907. font-weight: bold;
  908. }
  909. .animation{
  910. animation: showAmnation 2.2s ease-in-out both;
  911. }
  912. .restion{
  913. animation: hideAmnation 1s ease-in-out both;
  914. }
  915. .icon-num{
  916. position: absolute;
  917. right:-12rpx;
  918. top: -9rpx;
  919. }
  920. .icon-num.goleft{
  921. right: 4rpx;
  922. }
  923. &:last-child{
  924. margin-right: 0;
  925. }
  926. image {
  927. width: 40rpx;
  928. height: 40rpx;
  929. margin-bottom: 8rpx;
  930. }
  931. button.contact-btn{
  932. width: 100%;
  933. height: 100%;
  934. margin: 0;
  935. padding: 0;
  936. display: flex;
  937. flex-direction: column;
  938. align-items: center;
  939. box-sizing: border-box;
  940. font-size: $font-size-24;
  941. text-align: center;
  942. text-decoration: none;
  943. line-height: 34rpx;
  944. border-radius: 0;
  945. -webkit-tap-highlight-color: transparent;
  946. overflow: hidden;
  947. color: $text-color;
  948. background-color:#FFFFFF;
  949. }
  950. }
  951. }
  952. .bottom-ri{
  953. width: 400rpx;
  954. height: 100%;
  955. float: right;
  956. display: flex;
  957. .btn{
  958. flex: 1;
  959. width: 200rpx;
  960. line-height: 110rpx;
  961. text-align: center;
  962. font-size: $font-size-28;
  963. color: #FFFFFF;
  964. }
  965. .btn-cart{
  966. background-color: #EFAF00;
  967. }
  968. .btn-cart.disabled{
  969. background-color: rgba(239, 175, 0, 0.5);
  970. }
  971. .btn-bay{
  972. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  973. }
  974. .btn-bay.disabled{
  975. background-color: linear-gradient(135deg,rgba(242,143,49,0.5) 0%,rgba(225,86,22,0.5) 100%);;
  976. }
  977. }
  978. }
  979. .uni-badge--small {
  980. -webkit-transform: scale(.8);
  981. -ms-transform: scale(.8);
  982. transform: scale(.8);
  983. -webkit-transform-origin: center center;
  984. -ms-transform-origin: center center;
  985. transform-origin: center center;
  986. }
  987. .uni-badge {
  988. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  989. -webkit-box-sizing: border-box;
  990. box-sizing: border-box;
  991. font-size: 12px;
  992. line-height: 1;
  993. display: inline-block;
  994. padding: 3px 6px;
  995. color: #333;
  996. border-radius: 100px;
  997. background-color: #f1f1f1;
  998. }
  999. .uni-badge-error {
  1000. color: #fff;
  1001. background-color: #dd524d;
  1002. }
  1003. /* 加入购物模态层*/
  1004. @keyframes showPopup {
  1005. 0% {
  1006. opacity: 0;
  1007. }
  1008. 100% {
  1009. opacity: 1;
  1010. }
  1011. }
  1012. @keyframes hidePopup {
  1013. 0% {
  1014. opacity: 1;
  1015. }
  1016. 100% {
  1017. opacity: 0;
  1018. }
  1019. }
  1020. @keyframes showLayer {
  1021. 0% {
  1022. transform: translateY(0);
  1023. }
  1024. 100% {
  1025. transform: translateY(-100%);
  1026. }
  1027. }
  1028. @keyframes hideLayer {
  1029. 0% {
  1030. transform: translateY(-100%);
  1031. }
  1032. 100% {
  1033. transform: translateY(0);
  1034. }
  1035. }
  1036. @keyframes showAmnation {
  1037. 0% {
  1038. top: -12rpx;
  1039. opacity: 0;
  1040. }
  1041. 50% {
  1042. top: -60rpx;
  1043. opacity: 1;
  1044. }
  1045. 100% {
  1046. top: -100rpx;
  1047. opacity: 0;
  1048. }
  1049. }
  1050. @keyframes hideAmnation {
  1051. 0% {
  1052. top: -100rpx;
  1053. opacity: 0;
  1054. }
  1055. 100% {
  1056. top: -12rpx;
  1057. opacity: 0;
  1058. }
  1059. }
  1060. .popup {
  1061. position: fixed;
  1062. top: 0;
  1063. width: 100%;
  1064. height: 100%;
  1065. z-index: 999;
  1066. display: none;
  1067. .mask{
  1068. position: fixed;
  1069. top: 0;
  1070. width: 100%;
  1071. height: 100%;
  1072. z-index: 21;
  1073. background-color: rgba(0, 0, 0, 0.6);
  1074. }
  1075. .layer {
  1076. position: fixed;
  1077. z-index: 22;
  1078. bottom: -294rpx;
  1079. width: 702rpx;
  1080. padding: 24rpx 24rpx 36rpx 24rpx;
  1081. height: 236rpx;
  1082. border-radius: 30rpx 30rpx 0 0;
  1083. background-color: #fff;
  1084. display: flex;
  1085. flex-wrap: wrap;
  1086. align-content: space-between;
  1087. .content {
  1088. width: 100%;
  1089. }
  1090. .btn {
  1091. width: 100%;
  1092. height: 88rpx;
  1093. .button {
  1094. width: 100%;
  1095. height: 88rpx;
  1096. color: #fff;
  1097. display: flex;
  1098. align-items: center;
  1099. justify-content: center;
  1100. background: $btn-confirm;
  1101. font-size: $font-size-28;
  1102. border-radius: 14rpx;
  1103. }
  1104. }
  1105. }
  1106. &.show {
  1107. display: block;
  1108. .mask{
  1109. animation: showPopup 0.2s linear both;
  1110. }
  1111. .layer {
  1112. animation: showLayer 0.2s linear both;
  1113. }
  1114. }
  1115. &.hide {
  1116. display: block;
  1117. .mask{
  1118. animation: hidePopup 0.2s linear both;
  1119. }
  1120. .layer {
  1121. animation: hideLayer 0.2s linear both;
  1122. }
  1123. }
  1124. &.none {
  1125. display: none;
  1126. }
  1127. &.service {
  1128. .row {
  1129. margin: 30upx 0;
  1130. .title {
  1131. font-size: 30upx;
  1132. margin: 10upx 0;
  1133. }
  1134. .description {
  1135. font-size: 28upx;
  1136. color: #999;
  1137. }
  1138. }
  1139. }
  1140. .layer-smimg{
  1141. width: 114rpx;
  1142. height: 114rpx;
  1143. float: left;
  1144. border-radius: 10rpx;
  1145. margin-right: 24rpx;
  1146. image{
  1147. width: 114rpx;
  1148. height: 114rpx;
  1149. border-radius: 10rpx;
  1150. }
  1151. }
  1152. .layer-nunbox{
  1153. justify-content: space-between;
  1154. align-items: center;
  1155. width: 536rpx;
  1156. height: 88rpx;
  1157. padding: 13rpx 0 0 0;
  1158. float: left;
  1159. .layer-nunbox-t{
  1160. width: 100%;
  1161. height:44rpx;
  1162. position:relative;
  1163. display: flex;
  1164. .layer-nunbox-text{
  1165. line-height: 44rpx;
  1166. font-size: $font-size-28;
  1167. }
  1168. .number-box{
  1169. display: flex;
  1170. justify-content: center;
  1171. align-items: center;
  1172. .iconfont{
  1173. font-size: $font-size-32;
  1174. padding:0 20rpx;
  1175. font-size: $text-color;
  1176. }
  1177. .btn-input{
  1178. width: 62rpx;
  1179. height: 48rpx;
  1180. line-height: 48rpx;
  1181. background: #F8F8F8;
  1182. border-radius: 4rpx;
  1183. text-align: center;
  1184. font-size: $font-size-28;
  1185. }
  1186. }
  1187. .product-step{
  1188. position: absolute;
  1189. left: 45rpx;
  1190. bottom: 0;
  1191. height: 44rpx;
  1192. background: #FFFFFF;
  1193. }
  1194. }
  1195. .layer-nunbox-b{
  1196. width: 100%;
  1197. height:44rpx;
  1198. margin-top: 13rpx;
  1199. }
  1200. .text{
  1201. line-height: 44rpx;
  1202. font-size: $font-size-28;
  1203. .p{
  1204. color: #FF2A2A;
  1205. }
  1206. .p:first-child{
  1207. margin-left: 30rpx;
  1208. }
  1209. .p.sm{
  1210. font-size: $font-size-24;
  1211. }
  1212. }
  1213. }
  1214. }
  1215. /*富文本样式*/
  1216. rich-text.p{
  1217. width: 702rpx !important;
  1218. padding: 0 24rpx;
  1219. text-align: justify;
  1220. }
  1221. rich-text.img{
  1222. width: 100%;
  1223. height: auto;
  1224. }
  1225. </style>