product.vue 31 KB

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