product.vue 32 KB

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