product.vue 33 KB

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