product.vue 31 KB

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