product.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. <template>
  2. <view class="product" :style="{paddingBottom: userIdentity==1 ? '0rpx' :'120rpx'}">
  3. <header-poduct v-if="isHeaderPoduct"
  4. :systeminfo='systeminfo'
  5. :navbar-data='nvabarData'
  6. :headerBtnPosi ="headerBtnPosi"
  7. :headerColor="headerColor"
  8. :type="isShareType"
  9. :page='backPage'>
  10. </header-poduct>
  11. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  12. <view class="container-product tui-skeleton">
  13. <view class="product-top">
  14. <view class="banner-section">
  15. <uni-swiper-dot :info="productImage" :current="current" field="content" :mode="mode" >
  16. <swiper class="banner tui-banner tui-skeleton-rect" circular @change="swiperChange" :duration='800' :autoplay="false" :circular="false" >
  17. <swiper-item v-for="(item, index) in productImage" :key="index" class="banner-item">
  18. <image :src="item" @click="previewImg(index)" />
  19. </swiper-item>
  20. </swiper>
  21. <view class="swiper__dots-box">
  22. <view v-for="(item,idx) in productImage"
  23. :key="idx"
  24. :class="[idx===current?'swiper__dots-long':'none']"
  25. :data-index="current" class="swiper__dots-item">
  26. </view>
  27. </view>
  28. </uni-swiper-dot>
  29. </view>
  30. <view class="product-wrap clearfix">
  31. <view class="wrap-top" :class="goodsData.isNoneDisabled ? 'none' : ''">
  32. <view class="p-title tui-skeleton-fillet">
  33. {{product.name == undefined ? '' : product.name}}
  34. </view>
  35. <view class="productRemarks" v-if="product.productRemarks!=''&&product.productRemarks!=null">
  36. <view class="">{{product.productRemarks}}</view>
  37. </view>
  38. <view class="wrap-top-price" v-if="!goodsData.isNoneDisabled">
  39. <view v-if="!hasLogin" class="p-login grade tui-skeleton-fillet">
  40. <text class="p-no">价格:</text>
  41. <uni-stars :stars="parseInt(product.price1Grade)" :font-size='36' :width-info="180"></uni-stars>
  42. </view>
  43. <view v-if="!hasLogin" class="p-login tui-skeleton-fillet">
  44. <text @click.stop="navToLogin">登录查看价格<text class="iconfont icon-xiayibu" style="font-size: 22rpx;margin: 0 6rpx;"></text></text>
  45. </view>
  46. <view class="cm-price" v-else>
  47. <cm-price v-if="isRequest"
  48. :product="product"
  49. :userIdentity="userIdentity"
  50. :ladderPriceList="ladderPriceList"
  51. :retailPrice="retailPrice"
  52. :smallMoney="smallMoney"
  53. :minBuyNumber="minBuyNumber"/>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="attributes">
  58. <cm-attributes v-if="isRequest" :product="product" :goodsData="goodsData" />
  59. </view>
  60. </view>
  61. </view>
  62. <view class="product-details">
  63. <!-- 头部 -->
  64. <view v-if="goodsData.isNoneDisabled" class="navbar" :class="navbarFiexd"
  65. :style="{top:headerBtnPosi.bottom + (headerBtnPosi.bottom - headerBtnPosi.height - systeminfo.statusBarHeight) +'px'}">
  66. <view class="nav-item tui-skeleton-fillet" v-for="(item,index) in disabledTabNavList" :key="index" :class="{ current: tabCurrentIndex === index+2 }" @click="tabClick(index+2)">
  67. <text class="line"></text>
  68. <text>{{item.name}}</text>
  69. </view>
  70. </view>
  71. <view v-else class="navbar" :class="navbarFiexd"
  72. :style="{top:headerBtnPosi.bottom + (headerBtnPosi.bottom - headerBtnPosi.height - systeminfo.statusBarHeight) +'px'}">
  73. <view class="nav-item tui-skeleton-fillet" v-for="(item,index) in tabNavList" :key="index" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">
  74. <text class="line"></text>
  75. <text>{{item.name}}</text>
  76. </view>
  77. </view>
  78. <!-- 商品详情,供应商详情展示,相关推荐,评价-->
  79. <view class="content tui-banner tui-skeleton-rect" v-if="tabCurrentIndex === 0">
  80. <parser :html="html" :img-mode="widthFix"></parser>
  81. </view>
  82. <view class="content sup" v-if="tabCurrentIndex === 1">
  83. <supplier-details :shop="shop"></supplier-details>
  84. </view>
  85. <view class="content hot" v-if="tabCurrentIndex === 2">
  86. <recommend :query-productid="product.productID" v-if="isRecommend"></recommend>
  87. </view>
  88. <view class="content hot" v-if="tabCurrentIndex === 3">
  89. <evaluate :query-productid ="product.productID" v-if="isEvaluate"></evaluate>
  90. </view>
  91. </view>
  92. <!-- 底部按钮 -->
  93. <view class="menu" v-if="userIdentity!=1">
  94. <view class="bottom-btn" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  95. <view class="bottom-le">
  96. <view class="item-bt" @click="this.$api.switchTabTo('/pages/tabBar/home/home')">
  97. <image src="../../static/icon-home-active@3x.png"></image>
  98. <text>首页</text>
  99. </view>
  100. <view class="item-bt">
  101. <!-- #ifdef MP-WEIXIN -->
  102. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  103. <image src="../../static/severs@3x.png"></image>
  104. <text>客服</text>
  105. </button>
  106. <!-- #endif -->
  107. </view>
  108. <view class="item-bt" @click="buyProductCart()">
  109. <image src="../../static/icon-cart-active@3x.png"></image>
  110. <text>购物车</text>
  111. <text v-if="hasLogin && goodsData.cartCount>0"
  112. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  113. :class="[goodsData.cartCount < 10 ? 'goleft':'']">
  114. {{ goodsData.cartCount >= 100 ? '99+': goodsData.cartCount}}
  115. </text>
  116. <view class="animation-num" :class="isAnimation ? 'animation' : 'restion'">+1</view>
  117. </view>
  118. </view>
  119. <view class="bottom-ri">
  120. <button
  121. :disabled="goodsData.disabled"
  122. class="btn btn-cart"
  123. :class="[goodsData.disabled ? 'disabled':'']"
  124. @tap.stop="btnGetConfirm('add')">加入购物车</button>
  125. <button
  126. :disabled="goodsData.disabled"
  127. class="btn btn-bay"
  128. :class="[goodsData.disabled ? 'disabled':'']"
  129. @tap.stop="btnGetConfirm('buy')">立即购买</button>
  130. </view>
  131. </view>
  132. </view>
  133. <!--底部选择模态层弹窗组件 -->
  134. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
  135. <!-- 遮罩层 -->
  136. <view class="mask"></view>
  137. <view class="layer" @tap.stop="discard">
  138. <view class="content">
  139. <view class="layer-smimg">
  140. <image :src="product.mainImage" mode=""></image>
  141. </view>
  142. <view class="layer-nunbox">
  143. <view class="layer-nunbox-t">
  144. <view class="layer-nunbox-text">数量:</view>
  145. <view class="number-box">
  146. <view class="iconfont icon-jianhao" :class="[isQuantity==true?'disabled':'']" @click="changeCountSub()"></view>
  147. <input class="btn-input" type="number" v-model="number" maxlength='4' @blur="changeNumber($event)">
  148. <view class="iconfont icon-jiahao" :class="[isStock==true?'disabled':'']" @click="changeCountAdd()"></view>
  149. </view>
  150. </view>
  151. <view class="layer-nunbox-b">
  152. <view class="text">单价:
  153. <text class="p sm">¥</text>
  154. <text class="p bg">{{buyRetailPrice.toFixed(2)}}</text>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <view class="btn"><view class="button" @click.stop="btnConfirm">确定</view></view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. import { mapState,mapMutations } from 'vuex'
  167. import headerPoduct from '@/components/cm-module/headerNavbar/header-poduct' //自定义导航
  168. import cmPrice from "@/components/cm-module/productDetails/cm-price.vue" //价格显示
  169. import cmAttributes from "@/components/cm-module/productDetails/cm-attributes.vue" //规格信息
  170. import authorize from '@/common/config/authorize.js'
  171. import uniStars from '@/components/uni-stars/uni-stars.vue'
  172. import parser from "@/components/jyf-Parser/index" //富文本处理
  173. import tuiSkeleton from "@/components/tui-skeleton/tui-skeleton"
  174. import supplierDetails from "@/components/cm-module/productDetails/supplierDetails" //供应商详情
  175. import recommend from "@/components/cm-module/productDetails/recommend" //供应商详情
  176. import evaluate from "@/components/cm-module/productDetails/evaluate" //供应商详情
  177. import wxLogin from "@/common/config/wxLogin.js"
  178. import { queryProductDetils } from "@/api/product.js"
  179. import { shoppingAddCart } from "@/api/cart.js"
  180. var isPreviewImg;
  181. export default{
  182. components:{
  183. headerPoduct,
  184. parser,
  185. tuiSkeleton,
  186. supplierDetails,
  187. recommend,
  188. evaluate,
  189. cmPrice,
  190. cmAttributes
  191. },
  192. data(){
  193. return{
  194. html:'<div style="text-align: center;color:#333333;">暂无内容</div>',
  195. tabNavList:[{name:'商品详情'},{name:'供应商信息'},{name:'相关推荐'},{name:'评价'}],
  196. disabledTabNavList:[{name:'相关推荐'},{name:'评价'}],
  197. mode:'round',
  198. specClass: '',//规格弹窗css类,控制开关动画
  199. isBtnType:'',
  200. isRequest:false,
  201. current:0,
  202. isShareType:'',
  203. isHeaderPoduct:false,
  204. navbarFiexd:'none',
  205. ladderPriceFlag:'',
  206. ladderPriceList:'',
  207. isRecommend:false,
  208. isEvaluate:false,
  209. isAnimation:false,
  210. skeletonShow:true,
  211. isQuantity:false,
  212. isStock:false,
  213. disabled:false,
  214. isNoneDisabled:false,
  215. tabCurrentIndex:0,
  216. userID:'',
  217. productID:0,
  218. userIdentity:'',//用户类型
  219. goodsData:{},//自定义数据
  220. shop:{},//供应商信息
  221. product:{},//采美
  222. productImage:[],
  223. retailPrice:0,
  224. buyRetailPrice:0,
  225. stock:0,
  226. number:0,
  227. minBuyNumber:0,
  228. productsList:[],
  229. goodListData:[],
  230. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  231. systeminfo: this.setSysteminfo(), //获取设备信息
  232. isIphoneX:this.$store.state.isIphoneX,
  233. windowHeight: '',
  234. headerColor:false,
  235. backPage:1,
  236. nvabarData: { //顶部自定义导航
  237. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  238. title: '' // 导航栏 中间的标题
  239. }
  240. }
  241. },
  242. onLoad(option) {
  243. this.productID = option.id;//获取商品ID
  244. this.isShareType = option.type
  245. this.isHeaderPoduct = true
  246. if(option.page == 2){
  247. this.backPage = option.page
  248. }
  249. if(this.isShareType =='share'){
  250. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  251. console.log(wxResponse)
  252. if(wxResponse == 1){
  253. wxLogin.wxLoginAuthorize()
  254. }else{
  255. console.log(new Date +'用户未授权微信信息')
  256. }
  257. })
  258. }
  259. },
  260. computed: {
  261. ...mapState(['hasLogin','isWxAuthorize'])
  262. },
  263. methods:{
  264. initData(){// 初始化商品详情查询
  265. queryProductDetils({userId:this.userID,productID:this.productID}).then(response =>{
  266. this.skeletonShow = false
  267. this.productImage=[];
  268. this.shop = response.data.shop
  269. this.product = response.data
  270. this.ladderPriceFlag = this.product.ladderPriceFlag;
  271. this.html = this.product.productDetail == null ? this.html : this.$api.adaptRichTextImg(this.product.productDetail.detailInfo)
  272. this.stock = this.product.stock
  273. this.number = this.product.minBuyNumber
  274. this.minBuyNumber = this.product.minBuyNumber
  275. //处理商品图片列表
  276. this.product.imageList.forEach(item =>{
  277. this.productImage.push(item.image);
  278. })
  279. //购物车数量
  280. this.goodsData.cartCount = this.product.productCount
  281. //处理阶梯价格
  282. if(this.product.ladderPriceList!=null){
  283. this.ladderPriceList = this.product.ladderPriceList;
  284. }
  285. //拆分金额并转千分位格式显示
  286. if(this.product.retailPrice!=null){
  287. this.retailPrice = this.product.retailPrice.toFixed(2);
  288. this.buyRetailPrice = this.product.retailPrice;
  289. }
  290. //处理下架商品和售罄商品
  291. if(this.product.validFlag =='3' || this.stock == 0 ){
  292. this.disabled = true
  293. this.isNoneDisabled = true
  294. this.tabCurrentIndex = 2;// 页面显示是默认选中第一
  295. this.isRecommend = true
  296. this.goodsData.disabledText = '下架'
  297. }else{
  298. this.disabled = false
  299. this.isNoneDisabled = false
  300. this.tabCurrentIndex = 0;// 页面显示是默认选中第三
  301. this.goodsData.disabledText = ''
  302. }
  303. if(this.product.price1TextFlag == "1"){
  304. this.disabled = true
  305. }
  306. if(this.product.price1TextFlag == "2"){
  307. if(this.userIdentity == 4){
  308. this.disabled = true
  309. }else{
  310. this.disabled = false
  311. }
  312. }
  313. this.goodsData.disabled = this.disabled
  314. this.goodsData.isNoneDisabled = this.isNoneDisabled
  315. if(this.product.validFlag =='3'){
  316. this.goodsData.disabledText = '下架'
  317. }
  318. if(this.stock == 0){
  319. this.goodsData.disabledText = '售罄'
  320. }
  321. this.isRequest = true
  322. }).catch(error =>{
  323. this.$util.msg(error.msg,2000);
  324. })
  325. },
  326. swiperChange(e) {//顶部商品图片切换
  327. const index = e.detail.current;
  328. this.current = index;
  329. },
  330. previewImg (index) {//顶部商品图片预览
  331. isPreviewImg = true
  332. let previewUrls = this.productImage
  333. uni.previewImage({
  334. current: index, //图片索引
  335. urls: previewUrls, //必须是http图片,本地图片无效
  336. longPressActions:''
  337. })
  338. },
  339. tabClick(index) {//商品详情&&供应商信息tab切换
  340. this.tabCurrentIndex = index;
  341. if(this.tabCurrentIndex == 2){
  342. this.isRecommend = true
  343. }
  344. if(this.tabCurrentIndex == 3){
  345. this.isEvaluate = true
  346. }
  347. },
  348. changeTab(e) {
  349. this.tabCurrentIndex = e.target.current;
  350. },
  351. handleContact(e){//跳转小程序客服
  352. },
  353. buyProductCart(){//底部购物车按钮点击
  354. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  355. if(wxResponse == 1){
  356. if(this.hasLogin){
  357. this.$api.switchTabTo('/pages/tabBar/cart/cart')
  358. }else{
  359. this.$api.navigateTo('/pages/login/login?type=1')
  360. }
  361. }else{
  362. this.$api.navigateTo('/pages/authorization/authorization')
  363. }
  364. })
  365. },
  366. btnGetConfirm(type){//加入购物车&&立即购买点击
  367. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  368. if(wxResponse == 1){
  369. if(this.hasLogin){
  370. this.showSpec(type);
  371. }else{
  372. this.$api.navigateTo('/pages/login/login?type=1')
  373. }
  374. }else{
  375. this.$api.navigateTo('/pages/authorization/authorization')
  376. }
  377. })
  378. },
  379. changeCountAdd(){//popup弹窗数量增加按钮
  380. this.number++
  381. this.processActivityPrice()
  382. },
  383. changeCountSub(){//popup弹窗数量减按钮
  384. if(this.number<=this.minBuyNumber){
  385. this.number= this.minBuyNumber
  386. this.isQuantity =true
  387. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  388. return
  389. }else{
  390. this.number--
  391. this.processActivityPrice()
  392. this.isQuantity =false
  393. }
  394. },
  395. changeNumber(e){
  396. let _value = e.detail.value;
  397. if(!this.$api.isNumber(_value)){
  398. this.number = this.minBuyNumber
  399. }else if(_value < this.minBuyNumber){
  400. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  401. this.number = this.minBuyNumber
  402. }else{
  403. this.number = e.detail.value
  404. this.processActivityPrice()
  405. }
  406. },
  407. processActivityPrice(){//单独处理活动价格和阶梯价格
  408. if(this.ladderPriceFlag == '0' && this.product.actStatus == 0){
  409. this.buyRetailPrice = this.product.retailPrice
  410. }else{
  411. this.ladderPriceList.forEach((item,index)=>{
  412. if(this.number>=item.buyNum){
  413. this.buyRetailPrice = item.buyPrice
  414. }
  415. })
  416. }
  417. },
  418. showSpec(type) {//显示选择数量确认弹窗
  419. this.isBtnType = type
  420. this.specClass = 'show';
  421. },
  422. hideSpec() {//关闭选择数量确认弹窗
  423. this.specClass = 'hide';
  424. setTimeout(() => {
  425. this.specClass = 'none';
  426. }, 200);
  427. },
  428. btnConfirm() {//加入购物车&&立即购买跳转订单页并关闭弹窗
  429. if(this.isBtnType == 'add'){
  430. this.getAddProductCart()
  431. }else{
  432. this.toConfirmation()
  433. }
  434. },
  435. toConfirmation(){//跳转确认订单页面
  436. this.specClass = 'hide';
  437. let productStp ={
  438. allPrice:this.number*this.buyRetailPrice,
  439. allCount:this.number,
  440. productID:this.product.productID,
  441. productCount:this.number
  442. }
  443. this.$api.navigateTo(`/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({data:productStp})}`)
  444. setTimeout(() => {
  445. this.specClass = 'none';
  446. }, 200);
  447. },
  448. getAddProductCart(){//增加购物车成功和toast弹窗提示成功
  449. shoppingAddCart({productID:this.productID,userID:this.userID,productCount:this.number}).then(response => {
  450. this.specClass = 'hide';
  451. this.$util.msg('加入购物车成功',1500,true,'success')
  452. this.isAnimation = true
  453. setTimeout(() => {this.specClass = 'none'}, 200)
  454. setTimeout(() => {this.isAnimation = false},2000)
  455. this.goodsData.cartCount = response.data;
  456. }).catch(error =>{
  457. this.$util.msg(error.msg,2000);
  458. })
  459. },
  460. navToLogin(){
  461. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  462. if(wxResponse == 1){
  463. this.$api.navigateTo(`/pages/login/login?type=detilType&id=${this.productID}`)
  464. }else{
  465. this.$api.navigateTo('/pages/authorization/authorization')
  466. }
  467. })
  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. .productRemarks{
  541. color: #FF2A2A;
  542. font-size: 24rpx;
  543. margin-bottom: 16rp
  544. }
  545. .banner-section{
  546. width: 100%;
  547. height: 750rpx;
  548. position: relative;
  549. border-bottom: 1px solid #EBEBEB;
  550. }
  551. .banner{
  552. width: 100%;
  553. height: 750rpx;
  554. image {
  555. width: 100%;
  556. height: 100%;
  557. }
  558. }
  559. .swiper__dots-box{
  560. position: absolute;
  561. bottom: 24px;
  562. right: 24rpx;
  563. /* #ifndef APP-NVUE */
  564. display: flex;
  565. /* #endif */
  566. flex: 1;
  567. flex-direction: row;
  568. justify-content: center;
  569. align-items: center;
  570. height: 12rpx;
  571. padding: 10rpx;
  572. background: rgba(174,174,174,0.6);
  573. border-radius:16rpx;
  574. .swiper__dots-item{
  575. width: 12rpx;
  576. height: 12rpx;
  577. border-radius: 100%;
  578. margin: 6rpx;
  579. background: rgba(62,62,62,1);
  580. }
  581. .none{
  582. background:#FFFFFF;
  583. }
  584. .swiper__dots-long{
  585. background: rgba(62,62,62,1);
  586. transition: all 0.1s;
  587. }
  588. }
  589. .product-wrap{
  590. width: 100%;
  591. height: auto;
  592. padding: 24rpx 0 0 0;
  593. background-color: #FFFFFF;
  594. border-bottom: 20rpx solid #F7F7F7;
  595. .wrap-top{
  596. width: 702rpx;
  597. padding: 0 24rpx;
  598. height: auto;
  599. float: left;
  600. padding-bottom: 24rpx;
  601. border-bottom: 1px solid #F8F8F8;
  602. &.none{
  603. .p-title{
  604. color:#999999
  605. }
  606. }
  607. .p-title{
  608. line-height: 40rpx;
  609. font-size: $font-size-28;
  610. color: $text-color;
  611. font-weight: Bold;
  612. -o-text-overflow: ellipsis;
  613. text-overflow: ellipsis;
  614. display: -webkit-box;
  615. word-break: break-all;
  616. -webkit-box-orient: vertical;
  617. -webkit-line-clamp: 2;
  618. overflow: hidden;
  619. margin-bottom: 16rpx;
  620. }
  621. .wrap-main-pricenone{
  622. line-height: 44rpx;
  623. color: #FF2A2A;
  624. font-size: $font-size-28;
  625. font-weight: 600;
  626. }
  627. .wrap-main-none{
  628. line-height: 44rpx;
  629. color: #3A82FF;
  630. font-size: $font-size-28;
  631. }
  632. .p-active{
  633. width: 130rpx;
  634. height: 44rpx;
  635. display: flex;
  636. align-items: center;
  637. flex-direction: row;
  638. float: left;
  639. .icon-active{
  640. width: 124rpx;
  641. height: 30rpx;
  642. display: block;
  643. }
  644. }
  645. .p-price{
  646. height: 44rpx;
  647. line-height: 44rpx;
  648. float: left;
  649. .txt{
  650. color: #FF2A2A;
  651. margin:0 2rpx;
  652. }
  653. .txt.sm{
  654. font-size: $font-size-24;
  655. }
  656. .txt.big{
  657. font-size: $font-size-32;
  658. }
  659. }
  660. .p-minBuy{
  661. height: 44rpx;
  662. line-height: 44rpx;
  663. float: right;
  664. padding: 0 18rpx;
  665. border-radius: 22rpx;
  666. background-color: #EBEBEB;
  667. color: #7F7F7F;
  668. font-size: 24rpx;
  669. text-align: center;
  670. .min-text{
  671. margin: 0 6rpx;
  672. }
  673. }
  674. .p-login{
  675. height: 44rpx;
  676. line-height: 44rpx;
  677. color: $color-system;
  678. font-size: $font-size-24;
  679. &.grade{
  680. margin-bottom: 20rpx;
  681. }
  682. .p-no{
  683. float: left;
  684. margin-right: 5rpx;
  685. font-size: $font-size-28;
  686. }
  687. }
  688. }
  689. .wrap-active{
  690. width: 100%;
  691. float: left;
  692. height: 80rpx;
  693. background: linear-gradient(225deg,rgba(255,143,101,1) 0%,rgba(248,79,57,1) 100%);
  694. line-height: 80rpx;
  695. font-size: $font-size-26;
  696. color: #FFFFFF;
  697. text-align: center;
  698. }
  699. .wrap-ladder{
  700. float: left;
  701. width: 702rpx;
  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://img.caimei365.com/group1/M00/03/95/Cmis216Sk_WASybTAAI2gyWbunM918.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>