product.vue 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768
  1. <template>
  2. <view
  3. class="product"
  4. :style="{
  5. paddingBottom: userIdentity == 1 && userIdentity == 3 ? '0rpx' : '188rpx',
  6. paddingTop: CustomBar + 'px'
  7. }"
  8. >
  9. <header-product
  10. v-if="isHeaderPoduct"
  11. :systeminfo="systeminfo"
  12. :navbar-data="nvabarData"
  13. :headerBtnPosi="headerBtnPosi"
  14. :headerColor="headerColor"
  15. :type="isShareType"
  16. :page="backPage"
  17. >
  18. </header-product>
  19. <view class="product-topnav" v-if="isNavbarFiexd" :class="navbarFiexd" :style="{ top: CustomBar + 'px' }">
  20. <view class="navbar">
  21. <view
  22. class="nav-item tui-skeleton-fillet"
  23. :class="{ current: tabCurrentIndex === 0 }"
  24. @click="tabClick(0)"
  25. >
  26. <text>商品</text> <text class="line"></text>
  27. </view>
  28. <view
  29. class="nav-item tui-skeleton-fillet"
  30. :class="{ current: tabCurrentIndex === 1 }"
  31. @click="tabClick(1)"
  32. >
  33. <text>详情</text> <text class="line"></text>
  34. </view>
  35. <view
  36. class="nav-item tui-skeleton-fillet"
  37. :class="{ current: tabCurrentIndex === 2 }"
  38. @click="tabClick(2)"
  39. >
  40. <text>服务项目</text> <text class="line"></text>
  41. </view>
  42. </view>
  43. </view>
  44. <tui-skeleton
  45. v-if="skeletonShow"
  46. backgroundColor="#fafafa"
  47. borderRadius="10rpx"
  48. :isLoading="true"
  49. :loadingType="2"
  50. ></tui-skeleton>
  51. <template v-else>
  52. <view class="container-product tui-skeleton">
  53. <view class="container-product-main product-details product-details0">
  54. <view class="product-top">
  55. <view class="banner-section">
  56. <uni-swiper-dot :info="productImage" :current="current" field="content" :mode="mode">
  57. <swiper
  58. class="banner tui-banner tui-skeleton-rect"
  59. @change="swiperChange"
  60. :duration="800"
  61. :autoplay="false"
  62. :circular="true"
  63. >
  64. <swiper-item v-for="(item, index) in productImage" :key="index" class="banner-item">
  65. <image :src="item" @click="previewImg(index)" class="product-img" />
  66. </swiper-item>
  67. </swiper>
  68. <view class="swiper__dots-box">
  69. <tui-tag
  70. padding="12rpx 24rpx"
  71. type="translucent"
  72. shape="circleLeft"
  73. size="32rpx"
  74. :scaleMultiple="0.82"
  75. originRight
  76. >{{ current + 1 }}/{{ productImage.length }}
  77. </tui-tag>
  78. </view>
  79. </uni-swiper-dot>
  80. </view>
  81. <view class="product-wrap clearfix">
  82. <view class="wrap-top">
  83. <view class="wrap-top-price">
  84. <cm-price
  85. v-if="isRequest"
  86. :product="product"
  87. :userIdentity="userIdentity"
  88. :promotions="product.promotions"
  89. :ladderList="ladderList"
  90. />
  91. </view>
  92. <view class="p-title tui-skeleton-fillet">
  93. <view class="p-title-name" :class="product.beautyActFlag == '1' ? 'indent' : ''">
  94. {{ product.name == undefined ? '' : product.name }}
  95. </view>
  96. <button open-type="share" class="p-title-share tui-share-position" @tap="onShare">
  97. <view class=""><text class="iconfont icon-fenxiang"></text></view>
  98. <view class="">分享</view>
  99. </button>
  100. </view>
  101. <view class="wrap-label" v-if="product.tagsList.length > 0">
  102. <view
  103. class="label-a tui-skeleton-fillet"
  104. v-for="(label, index) in product.tagsList"
  105. :key="index"
  106. >{{ label }}</view
  107. >
  108. </view>
  109. <view class="product-seve">
  110. <text class="iconfont icon-wuyoushouhou tui-skeleton-rect"
  111. ><text class="text">无忧退货</text></text
  112. >
  113. <text class="iconfont icon-wuyoushouhou tui-skeleton-rect"
  114. ><text class="text">快速退款</text></text
  115. >
  116. <text class="iconfont icon-wuyoushouhou tui-skeleton-rect"
  117. ><text class="text">正品保证</text></text
  118. >
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <view class="product-parameter" @click="showPopup">
  124. <text class="title">参数:</text> <text class="name">品牌 分类...</text>
  125. <text class="iconfont icon-chakangengduo"></text>
  126. </view>
  127. </view>
  128. <view class="product-details product-details1">
  129. <!-- 商品详情 -->
  130. <view class="title"> <view class="title-tab">商品详情</view> </view>
  131. <view class="content tui-banner product-rich-text tui-skeleton-rect">
  132. <parser :html="html" :img-mode="widthFix" v-if="product.productDetail.detailInfo"></parser>
  133. <view class="product-rich-text-none" v-else>暂无商品信息</view>
  134. </view>
  135. </view>
  136. <view class="product-details service product-details2">
  137. <!-- 服务项目 -->
  138. <view class="title"> <view class="title-tab">服务项目</view> </view>
  139. <view
  140. class="content service"
  141. v-if="product.productDetail.orderInfo || product.productDetail.serviceInfo"
  142. >
  143. <cm-service :product="product.productDetail" v-if="isRequest"></cm-service>
  144. </view>
  145. <view class="content-none" v-else> <text>暂无服务项目</text> </view>
  146. </view>
  147. <!-- 商品参数 -->
  148. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  149. <view class="tui-popup-box clearfix">
  150. <view class="title">商品参数</view>
  151. <div class="tui-popup-main">
  152. <scroll-view class="tui-popup-scroll" scroll-y="true">
  153. <view class="content-tr">
  154. <view class="content-td">品牌</view>
  155. <view class="content-th">{{
  156. product.brandName == null ? '其他' : product.brandName
  157. }}</view>
  158. </view>
  159. <view class="content-tr">
  160. <view class="content-td">包装规格</view>
  161. <view class="content-th">{{ product.unit }}</view>
  162. </view>
  163. <view class="content-tr">
  164. <view class="content-td">库存</view>
  165. <view class="content-th">{{ product.stock }}</view>
  166. </view>
  167. <view
  168. class="content-tr"
  169. v-if="product.parametersList.length > 0"
  170. v-for="(item, index) in product.parametersList"
  171. :key="index"
  172. >
  173. <view class="content-td">{{ item.paramsName }}</view>
  174. <view class="content-th">{{ item.paramsContent }}</view>
  175. </view>
  176. </scroll-view>
  177. </div>
  178. <view
  179. class="tui-right-flex tui-popup-btn"
  180. :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }"
  181. >
  182. <view class="tui-flex-1"> <view class="tui-button" @click="hidePopup()">收起</view> </view>
  183. </view>
  184. </view>
  185. </tui-bottom-popup>
  186. <!-- 底部按钮 -->
  187. <view class="menu">
  188. <view class="bottom-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
  189. <!-- 已下架商品提示 -->
  190. <view
  191. class="product-invalid"
  192. v-if="isShowButton"
  193. :style="{ bottom: isIphoneX ? '168rpx' : '100rpx' }"
  194. >
  195. <text>商品已经下架啦,非常抱歉!</text>
  196. </view>
  197. <view class="bottom-le">
  198. <view class="item-bt" @click="this.$api.switchTabTo('/pages/tabBar/index/index')">
  199. <text class="iconfont icon-fanhuishouye"></text> <text>首页</text>
  200. </view>
  201. <button class="item-bt" open-type="contact" @bindcontact="handleContact">
  202. <text class="iconfont icon-kefu"></text> <text>客服</text>
  203. </button>
  204. <view class="item-bt" @click="buyProductCart()">
  205. <text class="iconfont icon-gouwuche"></text> <text>购物车</text>
  206. <text
  207. v-if="hasLogin && goodsData.cartCount > 0"
  208. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  209. :class="[goodsData.cartCount < 10 ? 'goleft' : '']"
  210. >
  211. {{ goodsData.cartCount >= 100 ? '99+' : goodsData.cartCount }}
  212. </text>
  213. <view class="animation-num" :class="isAnimation ? 'animation' : 'restion'">+1</view>
  214. </view>
  215. </view>
  216. <view class="bottom-ri">
  217. <button
  218. :disabled="isShowButton"
  219. class="btn btn-cart"
  220. :class="[isShowButton ? 'disabled' : '']"
  221. @tap.stop="btnGetConfirm('add')"
  222. >
  223. 加入购物车
  224. </button>
  225. <button
  226. :disabled="isShowButton"
  227. class="btn btn-bay"
  228. :class="[isShowButton ? 'disabled' : '']"
  229. @tap.stop="btnGetConfirm('buy')"
  230. >
  231. 立即购买
  232. </button>
  233. </view>
  234. </view>
  235. </view>
  236. <!--底部选择模态层弹窗组件 -->
  237. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
  238. <!-- 遮罩层 -->
  239. <view class="mask"></view>
  240. <view
  241. class="layer"
  242. @tap.stop="discard"
  243. :style="{
  244. paddingBottom: isIphoneX ? '68rpx' : '36rpx',
  245. bottom: isIphoneX ? '-352rpx' : '-296rpx'
  246. }"
  247. >
  248. <view class="content">
  249. <view class="layer-smimg"> <image :src="product.mainImage" mode=""></image> </view>
  250. <view class="layer-nunbox">
  251. <view class="layer-nunbox-t">
  252. <view class="layer-nunbox-text">数量:</view>
  253. <view class="number-box">
  254. <view
  255. class="iconfont icon-jianhao"
  256. :class="[isQuantity == true ? 'disabled' : '']"
  257. @click="changeCountSub()"
  258. ></view>
  259. <input
  260. class="btn-input"
  261. type="number"
  262. v-model="number"
  263. maxlength="4"
  264. @blur="changeNumber($event)"
  265. />
  266. <view class="iconfont icon-jiahao" @click="changeCountAdd()"></view>
  267. </view>
  268. </view>
  269. <view class="layer-nunbox-b">
  270. <view class="text"
  271. >单价: <text class="p sm">¥</text>
  272. <text class="p bg">{{ buyRetailPrice | NumFormat }}</text>
  273. </view>
  274. </view>
  275. </view>
  276. </view>
  277. <view class="btn"><view class="button" @click.stop="btnConfirm">确定</view></view>
  278. </view>
  279. </view>
  280. <!-- 侧边 -->
  281. <scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
  282. </view>
  283. </template>
  284. </view>
  285. </template>
  286. <script>
  287. import { mapGetters } from 'vuex'
  288. import HeaderProduct from '@/components/cm-module/headerNavbar/header-poduct' //自定义导航
  289. import cmPrice from '@/components/cm-module/productDetails/cm-price.vue' //价格显示
  290. import cmAttributes from '@/components/cm-module/productDetails/cm-attributes.vue' //规格信息
  291. import parser from '@/components/jyf-Parser/index' //富文本处理
  292. import cmService from '@/components/cm-module/productDetails/cm-service' //服务项目
  293. import authorize from '@/common/authorize.js'
  294. import wxLogin from '@/services/wxLogin.js'
  295. import { debounce } from '@/common/common.js'
  296. var isPreviewImg
  297. export default {
  298. components: {
  299. HeaderProduct,
  300. parser,
  301. cmPrice,
  302. cmAttributes,
  303. cmService
  304. },
  305. data() {
  306. return {
  307. nvabarData: {
  308. //顶部自定义导航
  309. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  310. title: '' // 导航栏 中间的标题
  311. },
  312. clickPath: '/search/pages/search/search',
  313. html: '<div style="text-align: center;color:#333333;">暂无内容</div>',
  314. productNoneImage: 'https://static.caimei365.com/app/img/icon/icon-pnone.png',
  315. mode: 'round',
  316. iconClass: 'icon-aixin',
  317. iconColor: '#ff9100',
  318. specClass: '', //规格弹窗css类,控制开关动画
  319. isBtnType: '',
  320. isRequest: false,
  321. isScrollTop: false,
  322. current: 0,
  323. isShareType: '',
  324. isHeaderPoduct: false,
  325. isNavbarFiexd: false,
  326. navbarFiexd: 'none',
  327. ladderPriceFlag: '',
  328. ladderList: '',
  329. isEvaluate: false,
  330. isAnimation: false,
  331. skeletonShow: true,
  332. isQuantity: false,
  333. disabled: false,
  334. tabCurrentIndex: 0,
  335. userId: '',
  336. productId: 0,
  337. userIdentity: 0, //用户类型
  338. goodsData: {}, //自定义数据
  339. product: {}, //采美
  340. productImage: [],
  341. retailPrice: 0,
  342. buyRetailPrice: 0,
  343. stock: 0,
  344. number: 1,
  345. productsList: [],
  346. goodListData: [],
  347. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  348. systeminfo: this.setSysteminfo(), //获取设备信息
  349. windowHeight: '',
  350. headerColor: false,
  351. backPage: 1,
  352. linkPath: '',
  353. CustomBar: this.CustomBar, // 顶部导航栏高度
  354. popupShow: false, //参数弹窗
  355. tabSelectFlag: false,
  356. sectionPropsArr: [],
  357. scrollTopArray: [],
  358. sectionTopRangeArr: [],
  359. winHeight: '',
  360. isShowButton: false
  361. }
  362. },
  363. onLoad(option) {
  364. this.productId = option.productId //获取商品ID
  365. this.isShareType = option.type
  366. this.linkPath = option.path
  367. this.isHeaderPoduct = true
  368. if (this.isShareType == 'share') {
  369. wxLogin.wxLoginAuthorize()
  370. }
  371. if (option.page == 2) {
  372. this.backPage = option.page
  373. }
  374. this.getWinHeight()
  375. },
  376. computed: {
  377. ...mapGetters(['hasLogin', 'isIphoneX'])
  378. },
  379. filters: {
  380. NumFormat(value) {
  381. //处理金额
  382. // console.log('===' + Number(value).toFixed(2))
  383. return Number(value).toFixed(2)
  384. }
  385. },
  386. methods: {
  387. initData() {
  388. // 初始化商品详情查询
  389. this.ProductService.QueryProductDetils({
  390. productId: this.productId
  391. })
  392. .then(response => {
  393. //购物车数量
  394. this.skeletonShow = false
  395. this.productImage = []
  396. this.product = response.data
  397. //已删除/已冻结
  398. if (this.product.validFlag === 2) {
  399. this.isShowButton = true
  400. }
  401. this.ladderPriceFlag = this.product.ladderPriceFlag
  402. this.html =
  403. this.product.productDetail == null
  404. ? this.html
  405. : this.$api.adaptRichTextImg(this.product.productDetail.detailInfo)
  406. this.stock = this.product.stock
  407. //处理商品图片列表
  408. this.product.imageList.forEach(item => {
  409. this.productImage.push(item)
  410. })
  411. //处理阶梯价格
  412. if (this.product.ladderList && this.product.ladderList.length > 0) {
  413. this.ladderList = this.product.ladderList
  414. }
  415. this.retailPrice = this.product.price.toFixed(2)
  416. this.buyRetailPrice = this.product.price
  417. setTimeout(() => {
  418. this.getSectionProps()
  419. }, 2000)
  420. console.log(this.userId)
  421. if (this.userId > 0) {
  422. this.GetCartNumber()
  423. }
  424. this.isRequest = true
  425. })
  426. .catch(error => {
  427. this.$util.msg(error.msg, 2000)
  428. })
  429. },
  430. GetCartNumber() {
  431. //查询购物车数量
  432. this.ProductService.QueryShoppingQuantity({
  433. userId: this.userId
  434. })
  435. .then(response => {
  436. this.goodsData.cartCount = response.data
  437. this.$store.commit('app/updateAllNum', response.data)
  438. })
  439. .catch(error => {
  440. console.log('查询购物车数量错误信息', error)
  441. })
  442. },
  443. swiperChange(e) {
  444. //顶部商品图片切换
  445. const index = e.detail.current
  446. this.current = index
  447. },
  448. previewImg(index) {
  449. //顶部商品图片预览
  450. isPreviewImg = true
  451. let previewUrls = this.productImage
  452. uni.previewImage({
  453. current: index, //图片索引
  454. urls: previewUrls, //必须是http图片,本地图片无效
  455. longPressActions: ''
  456. })
  457. },
  458. tabClick(index) {
  459. //商品详情&&供应商信息tab切换
  460. this.tabSelectFlag = true
  461. this.tabCurrentIndex = index
  462. let classIndex = '.product-details' + index
  463. uni.createSelectorQuery()
  464. .select('.container-product')
  465. .boundingClientRect(data => {
  466. //最外层盒子节点
  467. uni.createSelectorQuery()
  468. .select(classIndex)
  469. .boundingClientRect(res => {
  470. //最外层盒子节点
  471. uni.pageScrollTo({
  472. duration: 300, //过渡时间必须为0,uniapp bug,否则运行到手机会报错
  473. scrollTop: res.top - data.top - 40 //滚动到实际距离是元素距离顶部的距离减去最外层盒子的滚动距离
  474. })
  475. setTimeout(() => {
  476. this.tabSelectFlag = false
  477. }, 500)
  478. })
  479. .exec()
  480. })
  481. .exec()
  482. },
  483. handleContact(e) {
  484. //跳转小程序客服
  485. },
  486. buyProductCart() {
  487. //底部购物车按钮点击
  488. if (this.hasLogin) {
  489. this.$api.navigateTo('/pages/goods/cart')
  490. } else {
  491. this.$api.navigateTo('/pages/login/login')
  492. }
  493. },
  494. btnGetConfirm(type) {
  495. //加入购物车&&立即购买点击
  496. if (this.hasLogin) {
  497. this.showSpec(type)
  498. } else {
  499. this.$api.navigateTo('/pages/login/login')
  500. }
  501. },
  502. changeCountAdd() {
  503. //popup弹窗数量增加按钮
  504. this.number++
  505. this.processActivityPrice()
  506. },
  507. changeCountSub() {
  508. //popup弹窗数量减按钮
  509. if (this.number == 1) {
  510. this.isQuantity = true
  511. this.$util.msg('购买数量不能低于1', 2000)
  512. return
  513. } else {
  514. this.number--
  515. this.processActivityPrice()
  516. this.isQuantity = false
  517. }
  518. },
  519. changeNumber(e) {
  520. let _value = e.detail.value
  521. if (!this.$api.isNumber(_value)) {
  522. this.number = 1
  523. } else if (_value == 1) {
  524. this.$util.msg('购买数量不能低于1', 2000)
  525. this.number = 1
  526. } else {
  527. this.number = e.detail.value
  528. }
  529. this.processActivityPrice()
  530. },
  531. processActivityPrice() {
  532. //单独处理活动价格和阶梯价格
  533. if ((this.ladderPriceFlag == '0' && this.product.actStatus == 0) || this.product.actStatus == 1) {
  534. this.buyRetailPrice = this.product.retailPrice
  535. } else {
  536. this.ladderList.forEach((item, index) => {
  537. if (this.number >= item.buyNum) {
  538. this.buyRetailPrice = item.buyPrice
  539. }
  540. })
  541. }
  542. },
  543. showSpec(type) {
  544. //显示选择数量确认弹窗
  545. this.isBtnType = type
  546. this.specClass = 'show'
  547. },
  548. hideSpec() {
  549. //关闭选择数量确认弹窗
  550. this.specClass = 'hide'
  551. setTimeout(() => {
  552. this.specClass = 'none'
  553. }, 200)
  554. },
  555. btnConfirm() {
  556. //加入购物车&&立即购买跳转订单页并关闭弹窗
  557. if (this.isBtnType == 'add') {
  558. this.getAddProductCart()
  559. } else {
  560. this.toConfirmation()
  561. }
  562. },
  563. toConfirmation() {
  564. //跳转确认订单页面
  565. this.specClass = 'hide'
  566. let productStp = {
  567. allPrice: this.number * this.buyRetailPrice,
  568. allCount: this.number,
  569. productId: this.product.productId,
  570. productCount: this.number
  571. }
  572. this.$api.navigateTo(
  573. `/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({ data: productStp })}`
  574. )
  575. setTimeout(() => {
  576. this.specClass = 'none'
  577. }, 200)
  578. },
  579. getAddProductCart() {
  580. //增加购物车成功和toast弹窗提示成功
  581. this.ProductService.shoppingAddCart({
  582. productId: this.productId,
  583. userId: this.userId,
  584. productCount: this.number,
  585. heUserId: 0
  586. })
  587. .then(response => {
  588. this.specClass = 'hide'
  589. this.$util.msg('加入购物车成功', 1500, true, 'success')
  590. this.isAnimation = true
  591. setTimeout(() => {
  592. this.specClass = 'none'
  593. }, 200)
  594. setTimeout(() => {
  595. this.isAnimation = false
  596. }, 2000)
  597. this.GetCartNumber()
  598. })
  599. .catch(error => {
  600. this.$util.msg(error.msg, 2000)
  601. })
  602. },
  603. navToLogin() {
  604. authorize
  605. .checkLogin()
  606. .then(res => {
  607. this.$store.commit('app/setLoginType', 8)
  608. this.$store.commit('app/setLoginproductId', this.productId)
  609. this.$api.navigateTo(`/pages/login/login?id=${this.productId}`)
  610. })
  611. .catch(err => {
  612. this.$api.navigateTo('/pages/authorization/authorization?type=1')
  613. })
  614. },
  615. setHeaderBtnPosi() {
  616. // 获得胶囊按钮位置信息
  617. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  618. return headerBtnPosi
  619. },
  620. setSysteminfo() {
  621. let systeminfo
  622. uni.getSystemInfo({
  623. // 获取设备信息
  624. success: res => {
  625. systeminfo = res
  626. }
  627. })
  628. return systeminfo
  629. },
  630. discard() {
  631. //丢弃
  632. },
  633. onShare(res) {
  634. //分享转发
  635. if (res.from === 'button') {
  636. // 来自页面内转发按钮
  637. }
  638. return {
  639. title: `${this.product.name}`,
  640. path: `pages/goods/product?type=share&productId=${this.productId}`,
  641. imageUrl: `${this.productImage[0]}`
  642. }
  643. },
  644. showPopup() {
  645. this.popupShow = true
  646. },
  647. hidePopup() {
  648. this.popupShow = false
  649. },
  650. getSectionProps() {
  651. //获取每个tab对应区域的scrollTop值
  652. let className = '.product-details',
  653. sectionPropsArr = []
  654. uni.createSelectorQuery()
  655. .select('.container-product')
  656. .boundingClientRect(data => {
  657. //最外层盒子节点
  658. uni.createSelectorQuery()
  659. .selectAll(className)
  660. .boundingClientRect(res => {
  661. //最外层盒子节点
  662. res.forEach((item, index) => {
  663. sectionPropsArr.push({
  664. className: `${className}${index}`,
  665. scrollTop: item.top - data.top,
  666. height: item.height
  667. })
  668. })
  669. this.sectionPropsArr = sectionPropsArr
  670. console.log(this.sectionPropsArr)
  671. this.sectionTopRangeArr = this.getSectionRange(sectionPropsArr)
  672. })
  673. .exec()
  674. })
  675. .exec()
  676. },
  677. getSectionRange(arr) {
  678. // 获取每个tab对应区域的区间
  679. let sectionScrollTopList = []
  680. for (let i = 0; i < arr.length; i++) {
  681. sectionScrollTopList.push(`${arr[i].scrollTop}-${arr[i].scrollTop + arr[i].height}`)
  682. }
  683. // for(let i = 0; i < arr.length; i++) {
  684. // let thisScrollTop = arr[i].scrollTop;
  685. // let thisHeight = arr[i].height;
  686. // if(i < arr.length - 1) {
  687. // let nextScrollTop = arr[i+1].scrollTop;
  688. // if(i == 0) {
  689. // sectionScrollTopList.push(`0-${thisScrollTop + thisHeight}`);
  690. // } else if(i == arr.length - 1){
  691. // sectionScrollTopList.push(`${thisScrollTop + thisHeight}-${nextScrollTop - this.winHeight}`);
  692. // } else {
  693. // sectionScrollTopList.push(`${thisScrollTop + thisHeight}-${nextScrollTop}`);
  694. // }
  695. // } else {
  696. // sectionScrollTopList.push(`${thisScrollTop}-${thisScrollTop+500}`);
  697. // }
  698. // }
  699. return sectionScrollTopList
  700. },
  701. activeTab: debounce(
  702. (top, _this) => {
  703. //当滑动时也能同步激活tab
  704. const { sectionTopRangeArr } = _this
  705. if (sectionTopRangeArr.length > 0) {
  706. sectionTopRangeArr.forEach((item, index) => {
  707. let splitItem = item.split('-'),
  708. openInterval = Number(splitItem[0]),
  709. closedInterval = Number(splitItem[1])
  710. if (top >= openInterval && top < closedInterval) {
  711. console.log(top)
  712. _this.tabCurrentIndex = index
  713. }
  714. })
  715. }
  716. },
  717. 100,
  718. true
  719. ),
  720. getWinHeight() {
  721. this.winHeight = wx.getSystemInfoSync().windowHeight
  722. }
  723. },
  724. onPageScroll(e) {
  725. //实时获取到滚动的值
  726. const { scrollTop } = e
  727. if (!this.tabSelectFlag) {
  728. this.activeTab(scrollTop, this)
  729. }
  730. if (e.scrollTop > 60) {
  731. this.headerColor = true
  732. this.navbarFiexd = 'fixed'
  733. this.isNavbarFiexd = true
  734. this.nvabarData = {
  735. showCapsule: 1,
  736. title: '商品详情'
  737. }
  738. } else {
  739. this.headerColor = false
  740. this.isNavbarFiexd = false
  741. this.navbarFiexd = 'none'
  742. this.nvabarData = {
  743. showCapsule: 1,
  744. title: ''
  745. }
  746. }
  747. if (e.scrollTop > 700) {
  748. this.isScrollTop = true
  749. } else {
  750. this.isScrollTop = false
  751. }
  752. },
  753. onShareAppMessage(res) {
  754. //分享转发
  755. if (res.from === 'button') {
  756. // 来自页面内转发按钮
  757. }
  758. return {
  759. title: `${this.product.name}`,
  760. path: `pages/goods/product?type=share&productId=${this.productId}`,
  761. imageUrl: `${this.productImage[0]}`
  762. }
  763. },
  764. onShow() {
  765. this.$api
  766. .getStorage()
  767. .then(resolve => {
  768. this.userId = resolve.userId ? resolve.userId : ''
  769. this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 0
  770. if (isPreviewImg) {
  771. isPreviewImg = false
  772. return
  773. } else {
  774. this.initData()
  775. }
  776. })
  777. .catch(error => {
  778. this.initData()
  779. })
  780. }
  781. }
  782. </script>
  783. <style lang="scss">
  784. page {
  785. background-color: #ffffff;
  786. }
  787. .banner-section {
  788. width: 100%;
  789. height: 750rpx;
  790. position: relative;
  791. }
  792. .banner {
  793. width: 100%;
  794. height: 750rpx;
  795. .product-img {
  796. width: 750rpx;
  797. }
  798. image {
  799. width: 100%;
  800. height: 100%;
  801. }
  802. }
  803. .swiper__dots-box {
  804. position: absolute;
  805. color: #fff;
  806. bottom: 30rpx;
  807. right: 0;
  808. }
  809. .product-wrap {
  810. width: 100%;
  811. height: auto;
  812. padding: 24rpx 0 0 0;
  813. background-color: #ffffff;
  814. border-bottom: 20rpx solid #f7f7f7;
  815. .wrap-top {
  816. width: 702rpx;
  817. padding: 0 24rpx;
  818. height: auto;
  819. float: left;
  820. padding-bottom: 20rpx;
  821. border-bottom: 1px solid #f8f8f8;
  822. .p-title {
  823. width: 100%;
  824. height: auto;
  825. float: left;
  826. position: relative;
  827. .p-title-name {
  828. width: 602rpx;
  829. height: auto;
  830. float: left;
  831. line-height: 48rpx;
  832. font-size: $font-size-28;
  833. color: $text-color;
  834. -o-text-overflow: ellipsis;
  835. text-overflow: ellipsis;
  836. display: -webkit-box;
  837. word-break: break-all;
  838. -webkit-box-orient: vertical;
  839. -webkit-line-clamp: 2;
  840. overflow: hidden;
  841. &.indent {
  842. text-indent: 95rpx;
  843. }
  844. }
  845. .p-title-share {
  846. width: 96rpx;
  847. height: 96rpx;
  848. position: absolute;
  849. right: 0;
  850. text-align: center;
  851. color: #999999;
  852. font-size: $font-size-24;
  853. box-sizing: border-box;
  854. display: block;
  855. background: transparent;
  856. border-radius: 0;
  857. border: 0;
  858. margin: 0;
  859. padding: 8rpx 0;
  860. z-index: 990;
  861. .icon-fenxiang1 {
  862. font-size: $font-size-34;
  863. }
  864. }
  865. .tui-share-btn::after {
  866. border: 0;
  867. }
  868. }
  869. .wrap-main-text {
  870. line-height: 56rpx;
  871. color: #ff2a2a;
  872. font-size: $font-size-26;
  873. display: block;
  874. float: left;
  875. font-weight: normal;
  876. }
  877. .wrap-main-none {
  878. display: block;
  879. width: 256rpx;
  880. height: 44rpx;
  881. padding-left: 20rpx;
  882. border-radius: 11rpx;
  883. background: $btn-confirm;
  884. float: right;
  885. line-height: 44rpx;
  886. color: #ffffff;
  887. text-align: center;
  888. font-size: $font-size-24;
  889. }
  890. .p-price-none {
  891. height: 44rpx;
  892. line-height: 44rpx;
  893. float: left;
  894. font-size: $font-size-24;
  895. color: #666;
  896. text-decoration: line-through;
  897. margin-left: 8rpx;
  898. }
  899. .p-minBuy {
  900. height: 44rpx;
  901. line-height: 44rpx;
  902. float: right;
  903. padding: 0 18rpx;
  904. border-radius: 22rpx;
  905. background-color: #f7f7f7;
  906. color: #7f7f7f;
  907. font-size: 24rpx;
  908. text-align: center;
  909. .min-text {
  910. margin: 0 6rpx;
  911. }
  912. }
  913. .p-login {
  914. height: 56rpx;
  915. line-height: 56rpx;
  916. color: $color-system;
  917. font-size: $font-size-24;
  918. &.grade {
  919. .price-left {
  920. float: left;
  921. .none {
  922. display: block;
  923. font-size: $font-size-20;
  924. line-height: 48rpx;
  925. color: #4a4b54;
  926. float: left;
  927. font-weight: bold;
  928. margin-left: 5rpx;
  929. text {
  930. letter-spacing: 4rpx;
  931. font-size: $font-size-32;
  932. }
  933. }
  934. }
  935. }
  936. .p-no {
  937. float: left;
  938. margin-right: 5rpx;
  939. font-size: $font-size-28;
  940. color: $text-color;
  941. }
  942. .p-login-btn {
  943. display: block;
  944. height: 44rpx;
  945. padding: 0 10rpx 0 20rpx;
  946. border-radius: 11rpx;
  947. background: $btn-confirm;
  948. float: right;
  949. line-height: 44rpx;
  950. color: #ffffff;
  951. text-align: center;
  952. font-size: $font-size-24;
  953. }
  954. }
  955. }
  956. .wrap-label {
  957. float: left;
  958. width: 100%;
  959. box-sizing: border-box;
  960. .label-a {
  961. padding: 0 18rpx;
  962. line-height: 32rpx;
  963. font-size: $font-size-20;
  964. color: $color-system;
  965. text-align: center;
  966. border-radius: 6rpx;
  967. background: #fff3f7;
  968. margin: 0 20rpx 15rpx 0;
  969. display: inline-block;
  970. }
  971. }
  972. .wrap-top-price {
  973. float: left;
  974. width: 100%;
  975. box-sizing: border-box;
  976. .wrap-main-item {
  977. width: 100%;
  978. height: 56rpx;
  979. .p-price {
  980. height: 56rpx;
  981. line-height: 56rpx;
  982. float: left;
  983. color: $color-system;
  984. font-weight: bold;
  985. .txt {
  986. margin: 0 2rpx;
  987. }
  988. .txt.sm {
  989. font-size: $font-size-26;
  990. }
  991. .txt.big {
  992. font-size: $font-size-34;
  993. }
  994. }
  995. }
  996. .floor-item-act {
  997. // width: 80rpx;
  998. height: 34rpx;
  999. margin-top: 15rpx;
  1000. margin-left: 20rpx;
  1001. float: left;
  1002. .tag {
  1003. display: inline-block;
  1004. height: 32rpx;
  1005. font-size: 22rpx;
  1006. line-height: 30rpx;
  1007. text-align: center;
  1008. color: #f83c6c;
  1009. float: left;
  1010. margin-right: 10rpx;
  1011. &.tag-02 {
  1012. width: 80rpx;
  1013. background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png) top center
  1014. no-repeat;
  1015. background-size: contain;
  1016. }
  1017. &.tag-01 {
  1018. width: 56rpx;
  1019. color: #fff;
  1020. background-color: #f83c6c;
  1021. border-radius: 4rpx;
  1022. }
  1023. }
  1024. }
  1025. .floor-item-btn {
  1026. float: left;
  1027. height: 40rpx;
  1028. margin-top: 8rpx;
  1029. margin-left: 10rpx;
  1030. .btn {
  1031. line-height: 40rpx;
  1032. padding: 0 20rpx;
  1033. height: 40rpx;
  1034. background: $btn-confirm;
  1035. color: #ffffff;
  1036. font-size: $font-size-20;
  1037. border-radius: 4rpx;
  1038. }
  1039. }
  1040. }
  1041. .wrap-info {
  1042. float: left;
  1043. width: 702rpx;
  1044. padding: 24rpx 24rpx 0 24rpx;
  1045. border-bottom: 1px solid #f8f8f8;
  1046. .info-viewT {
  1047. width: 100%;
  1048. min-height: 40rpx;
  1049. font-size: $font-size-28;
  1050. color: $text-color;
  1051. line-height: 40rpx;
  1052. text-align: left;
  1053. &.none {
  1054. color: #999999;
  1055. }
  1056. .info-viewL {
  1057. min-width: 350rpx;
  1058. float: left;
  1059. margin-bottom: 24rpx;
  1060. }
  1061. .info-viewR {
  1062. min-width: 352rpx;
  1063. float: left;
  1064. margin-bottom: 24rpx;
  1065. }
  1066. }
  1067. .info-viewB {
  1068. width: 100%;
  1069. height: auto;
  1070. }
  1071. .info-f {
  1072. width: 50%;
  1073. float: left;
  1074. font-size: $font-size-28;
  1075. color: $text-color;
  1076. line-height: 40rpx;
  1077. margin-bottom: 24rpx;
  1078. text-align: left;
  1079. }
  1080. }
  1081. }
  1082. .product-seve {
  1083. width: 100%;
  1084. height: 60rpx;
  1085. background-color: #ffffff;
  1086. position: relative;
  1087. display: flex;
  1088. line-height: 60rpx;
  1089. .label {
  1090. font-size: $font-size-28;
  1091. color: #333333;
  1092. }
  1093. .iconfont {
  1094. color: $color-system;
  1095. margin-right: 20rpx;
  1096. font-size: $font-size-30;
  1097. }
  1098. .text {
  1099. font-size: $font-size-22;
  1100. color: #999999;
  1101. margin-left: 10rpx;
  1102. }
  1103. }
  1104. .product-parameter {
  1105. width: 702rpx;
  1106. height: 90rpx;
  1107. padding: 0 24rpx;
  1108. background-color: #ffffff;
  1109. position: relative;
  1110. display: flex;
  1111. border-bottom: 20rpx solid #f7f7f7;
  1112. .title {
  1113. line-height: 90rpx;
  1114. display: inline-block;
  1115. float: left;
  1116. font-size: $font-size-28;
  1117. color: #666666;
  1118. }
  1119. .name {
  1120. float: right;
  1121. line-height: 90rpx;
  1122. display: inline-block;
  1123. float: left;
  1124. font-size: $font-size-28;
  1125. color: $text-color;
  1126. float: right;
  1127. padding-right: 48rpx;
  1128. overflow: hidden;
  1129. text-overflow: ellipsis;
  1130. white-space: nowrap;
  1131. text-align: right;
  1132. }
  1133. .icon-chakangengduo {
  1134. line-height: 90rpx;
  1135. display: inline-block;
  1136. position: absolute;
  1137. width: 48rpx;
  1138. top: 0;
  1139. right: 0;
  1140. color: #b2b2b2;
  1141. }
  1142. }
  1143. .product-details {
  1144. width: 100%;
  1145. background: #ffffff;
  1146. border-bottom: 20rpx solid #f7f7f7;
  1147. &.service {
  1148. border-bottom: none;
  1149. }
  1150. &.recommend {
  1151. background-color: #f7f7f7;
  1152. border-bottom: none;
  1153. .title {
  1154. .title-tab {
  1155. background-color: #f7f7f7;
  1156. color: $text-color;
  1157. }
  1158. }
  1159. }
  1160. .product-rich-text-none {
  1161. box-sizing: border-box;
  1162. padding: 0 24rpx;
  1163. text-align: left;
  1164. font-size: 24rpx;
  1165. color: #999999;
  1166. line-height: 60rpx;
  1167. }
  1168. .content-none {
  1169. width: 100%;
  1170. height: 80rpx;
  1171. line-height: 80rpx;
  1172. text-align: left;
  1173. font-size: $font-size-26;
  1174. color: #999999;
  1175. box-sizing: border-box;
  1176. padding: 0 24rpx;
  1177. }
  1178. .title {
  1179. width: 100%;
  1180. box-sizing: border-box;
  1181. padding: 0 24rpx;
  1182. .title-tab {
  1183. width: 100%;
  1184. height: 100rpx;
  1185. background: #fff;
  1186. z-index: 10;
  1187. font-size: $font-size-30;
  1188. text-align: left;
  1189. color: $text-color;
  1190. line-height: 100rpx;
  1191. font-weight: 600;
  1192. }
  1193. .title-msg {
  1194. width: 100%;
  1195. height: 236rpx;
  1196. padding: 18rpx;
  1197. background-color: rgba(225, 86, 22, 0.1);
  1198. color: $color-system;
  1199. box-sizing: border-box;
  1200. margin-bottom: 30rpx;
  1201. .tit {
  1202. line-height: 46rpx;
  1203. font-size: $font-size-24;
  1204. text-align: left;
  1205. }
  1206. .txt {
  1207. line-height: 38rpx;
  1208. font-size: $font-size-20;
  1209. text-align: justify;
  1210. }
  1211. }
  1212. }
  1213. .content {
  1214. width: 100%;
  1215. background-color: #ffffff;
  1216. }
  1217. }
  1218. .isLower {
  1219. width: 100%;
  1220. height: 116rpx;
  1221. line-height: 116rpx;
  1222. text-align: center;
  1223. color: #000000;
  1224. font-size: $font-size-32;
  1225. font-weight: bold;
  1226. }
  1227. .product-invalid {
  1228. width: 100%;
  1229. height: 80rpx;
  1230. background-color: #666666;
  1231. text-align: center;
  1232. line-height: 80rpx;
  1233. font-size: $font-size-26;
  1234. color: #ffffff;
  1235. position: fixed;
  1236. bottom: 180rpx;
  1237. left: 0;
  1238. }
  1239. .bottom-btn {
  1240. width: 100%;
  1241. height: 100rpx;
  1242. position: fixed;
  1243. bottom: 0;
  1244. left: 0;
  1245. background: #ffffff;
  1246. z-index: 990;
  1247. .bottom-le {
  1248. width: 300rpx;
  1249. height: 100rpx;
  1250. padding: 10rpx 20rpx 10rpx 0;
  1251. float: left;
  1252. box-sizing: border-box;
  1253. .item-bt {
  1254. width: 80rpx;
  1255. height: 100%;
  1256. margin-right: 15rpx;
  1257. display: flex;
  1258. float: left;
  1259. flex-direction: column;
  1260. align-items: center;
  1261. justify-content: center;
  1262. font-size: $font-size-22;
  1263. color: #666666;
  1264. line-height: 34rpx;
  1265. position: relative;
  1266. .iconfont {
  1267. display: block;
  1268. width: 36rpx;
  1269. height: 36rpx;
  1270. text-align: center;
  1271. font-size: 34rpx;
  1272. }
  1273. .animation-num {
  1274. font-size: $font-size-32;
  1275. color: #ff2a2a;
  1276. position: absolute;
  1277. top: -12rpx;
  1278. right: 4rpx;
  1279. font-weight: bold;
  1280. }
  1281. .animation {
  1282. animation: showAmnation 2.2s ease-in-out both;
  1283. }
  1284. .restion {
  1285. animation: hideAmnation 1s ease-in-out both;
  1286. }
  1287. .icon-num {
  1288. position: absolute;
  1289. right: -12rpx;
  1290. top: -5rpx;
  1291. }
  1292. .icon-num.goleft {
  1293. right: 2rpx;
  1294. }
  1295. &:last-child {
  1296. margin-right: 0;
  1297. }
  1298. image {
  1299. width: 44rpx;
  1300. height: 44rpx;
  1301. }
  1302. button.contact-btn {
  1303. width: 100%;
  1304. height: 100%;
  1305. margin: 0;
  1306. padding: 0;
  1307. display: flex;
  1308. flex-direction: column;
  1309. align-items: center;
  1310. justify-content: center;
  1311. box-sizing: border-box;
  1312. font-size: $font-size-24;
  1313. text-align: center;
  1314. text-decoration: none;
  1315. line-height: 34rpx;
  1316. border-radius: 0;
  1317. -webkit-tap-highlight-color: transparent;
  1318. overflow: hidden;
  1319. color: $text-color;
  1320. background-color: #ffffff;
  1321. }
  1322. }
  1323. }
  1324. .bottom-ri {
  1325. width: 450rpx;
  1326. height: 100%;
  1327. float: right;
  1328. display: flex;
  1329. box-sizing: border-box;
  1330. padding: 13rpx 20rpx 13rpx 0;
  1331. .btn {
  1332. flex: 1;
  1333. width: 200rpx;
  1334. line-height: 80rpx;
  1335. text-align: center;
  1336. font-size: $font-size-24;
  1337. color: #ffffff;
  1338. }
  1339. .btn-cart {
  1340. background-color: #ffeff4;
  1341. color: $color-system;
  1342. border-radius: 42rpx 0 0 42rpx;
  1343. }
  1344. .btn-cart.disabled {
  1345. background-color: #ffeff4;
  1346. color: #ff457b;
  1347. }
  1348. .btn-bay {
  1349. background: $btn-confirm;
  1350. border-radius: 0 42rpx 42rpx 0;
  1351. }
  1352. .btn-bay.disabled {
  1353. background: $btn-confirm;
  1354. color: ffffff;
  1355. opacity: 0.2;
  1356. }
  1357. }
  1358. }
  1359. .uni-badge--small {
  1360. -webkit-transform: scale(0.8);
  1361. -ms-transform: scale(0.8);
  1362. transform: scale(0.8);
  1363. -webkit-transform-origin: center center;
  1364. -ms-transform-origin: center center;
  1365. transform-origin: center center;
  1366. }
  1367. .uni-badge {
  1368. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  1369. -webkit-box-sizing: border-box;
  1370. box-sizing: border-box;
  1371. font-size: 12px;
  1372. line-height: 1;
  1373. display: inline-block;
  1374. padding: 3px 6px;
  1375. color: #333;
  1376. border-radius: 100px;
  1377. background-color: #f1f1f1;
  1378. }
  1379. .uni-badge-error {
  1380. color: #fff;
  1381. background-color: #dd524d;
  1382. }
  1383. .product-topnav {
  1384. width: 100%;
  1385. height: 60rpx;
  1386. box-sizing: border-box;
  1387. background: #ffffff;
  1388. z-index: 1000;
  1389. position: fixed;
  1390. opacity: 1;
  1391. left: 0;
  1392. &.fixed {
  1393. animation: showFixedColor 0.1s ease-in-out both;
  1394. }
  1395. &.none {
  1396. animation: hideFixedColor 0.1s ease-in-out both;
  1397. }
  1398. .navbar {
  1399. width: 100%;
  1400. height: 60rpx;
  1401. box-sizing: border-box;
  1402. padding: 0 24rpx;
  1403. display: flex;
  1404. .nav-item {
  1405. display: flex;
  1406. flex: 1;
  1407. justify-content: center;
  1408. align-items: center;
  1409. height: 60rpx;
  1410. font-size: $font-size-28;
  1411. color: $text-color;
  1412. position: relative;
  1413. float: left;
  1414. position: relative;
  1415. .line {
  1416. width: 60rpx;
  1417. height: 2px;
  1418. border-radius: 1px;
  1419. background: #ffffff;
  1420. position: absolute;
  1421. bottom: 0;
  1422. left: 50%;
  1423. margin-left: -30rpx;
  1424. }
  1425. &.current {
  1426. color: $color-system;
  1427. .line {
  1428. background: $color-system;
  1429. }
  1430. }
  1431. }
  1432. }
  1433. }
  1434. @keyframes showFixedColor {
  1435. 0% {
  1436. background: rgba(255, 255, 255, 0);
  1437. }
  1438. 50% {
  1439. background: rgba(255, 255, 255, 0.5);
  1440. }
  1441. 100% {
  1442. background: rgba(255, 255, 255, 1);
  1443. }
  1444. }
  1445. @keyframes hideFixedColor {
  1446. 0% {
  1447. background: rgba(255, 255, 255, 1);
  1448. }
  1449. 50% {
  1450. background: rgba(255, 255, 255, 0.5);
  1451. }
  1452. 100% {
  1453. background: rgba(255, 255, 255, 0);
  1454. }
  1455. }
  1456. /* 加入购物模态层*/
  1457. @keyframes showPopup {
  1458. 0% {
  1459. opacity: 0;
  1460. }
  1461. 100% {
  1462. opacity: 1;
  1463. }
  1464. }
  1465. @keyframes hidePopup {
  1466. 0% {
  1467. opacity: 1;
  1468. }
  1469. 100% {
  1470. opacity: 0;
  1471. }
  1472. }
  1473. @keyframes showLayer {
  1474. 0% {
  1475. transform: translateY(0);
  1476. }
  1477. 100% {
  1478. transform: translateY(-100%);
  1479. }
  1480. }
  1481. @keyframes hideLayer {
  1482. 0% {
  1483. transform: translateY(-100%);
  1484. }
  1485. 100% {
  1486. transform: translateY(0);
  1487. }
  1488. }
  1489. @keyframes showAmnation {
  1490. 0% {
  1491. top: -12rpx;
  1492. opacity: 0;
  1493. }
  1494. 50% {
  1495. top: -60rpx;
  1496. opacity: 1;
  1497. }
  1498. 100% {
  1499. top: -100rpx;
  1500. opacity: 0;
  1501. }
  1502. }
  1503. @keyframes hideAmnation {
  1504. 0% {
  1505. top: -100rpx;
  1506. opacity: 0;
  1507. }
  1508. 100% {
  1509. top: -12rpx;
  1510. opacity: 0;
  1511. }
  1512. }
  1513. .popup {
  1514. position: fixed;
  1515. top: 0;
  1516. width: 100%;
  1517. height: 100%;
  1518. z-index: 999;
  1519. display: none;
  1520. .mask {
  1521. position: fixed;
  1522. top: 0;
  1523. width: 100%;
  1524. height: 100%;
  1525. z-index: 21;
  1526. background-color: rgba(0, 0, 0, 0.6);
  1527. }
  1528. .layer {
  1529. position: fixed;
  1530. z-index: 22;
  1531. bottom: -294rpx;
  1532. width: 702rpx;
  1533. padding: 24rpx 24rpx 36rpx 24rpx;
  1534. height: 260rpx;
  1535. border-radius: 20rpx 20rpx 0 0;
  1536. background-color: #fff;
  1537. display: flex;
  1538. flex-wrap: wrap;
  1539. align-content: space-between;
  1540. .content {
  1541. width: 100%;
  1542. }
  1543. .btn {
  1544. width: 100%;
  1545. height: 88rpx;
  1546. margin-top: 20rpx;
  1547. .button {
  1548. width: 100%;
  1549. height: 88rpx;
  1550. color: #fff;
  1551. display: flex;
  1552. align-items: center;
  1553. justify-content: center;
  1554. background: $btn-confirm;
  1555. font-size: $font-size-28;
  1556. border-radius: 44rpx;
  1557. }
  1558. }
  1559. }
  1560. &.show {
  1561. display: block;
  1562. .mask {
  1563. animation: showPopup 0.2s linear both;
  1564. }
  1565. .layer {
  1566. animation: showLayer 0.2s linear both;
  1567. }
  1568. }
  1569. &.hide {
  1570. display: block;
  1571. .mask {
  1572. animation: hidePopup 0.2s linear both;
  1573. }
  1574. .layer {
  1575. animation: hideLayer 0.2s linear both;
  1576. }
  1577. }
  1578. &.none {
  1579. display: none;
  1580. }
  1581. &.service {
  1582. .row {
  1583. margin: 30upx 0;
  1584. .title {
  1585. font-size: 30upx;
  1586. margin: 10upx 0;
  1587. }
  1588. .description {
  1589. font-size: 28upx;
  1590. color: #999;
  1591. }
  1592. }
  1593. }
  1594. .layer-smimg {
  1595. width: 114rpx;
  1596. height: 114rpx;
  1597. float: left;
  1598. border-radius: 10rpx;
  1599. margin-right: 24rpx;
  1600. image {
  1601. width: 114rpx;
  1602. height: 114rpx;
  1603. border-radius: 10rpx;
  1604. }
  1605. }
  1606. .layer-nunbox {
  1607. justify-content: space-between;
  1608. align-items: center;
  1609. width: 536rpx;
  1610. height: auto;
  1611. float: left;
  1612. .layer-nunbox-t {
  1613. width: 100%;
  1614. height: 44rpx;
  1615. position: relative;
  1616. display: flex;
  1617. margin-bottom: 10rpx;
  1618. .text {
  1619. font-size: $font-size-24;
  1620. line-height: 48rpx;
  1621. color: #999999;
  1622. }
  1623. .layer-nunbox-text {
  1624. line-height: 44rpx;
  1625. font-size: $font-size-28;
  1626. }
  1627. .number-box {
  1628. display: flex;
  1629. justify-content: center;
  1630. align-items: center;
  1631. border: 2rpx solid #e1e1e1;
  1632. border-radius: 30rpx;
  1633. height: 48rpx;
  1634. margin-left: 20rpx;
  1635. .iconfont {
  1636. font-size: $font-size-24;
  1637. padding: 0 14rpx;
  1638. color: #666666;
  1639. text-align: center;
  1640. line-height: 48rpx;
  1641. font-weight: bold;
  1642. background: #ffffff;
  1643. &.icon-jianhao {
  1644. border-radius: 30rpx 0 0 30rpx;
  1645. }
  1646. &.icon-jiahao {
  1647. border-radius: 0 30rpx 30rpx 0;
  1648. }
  1649. }
  1650. .btn-input {
  1651. width: 56rpx;
  1652. height: 44rpx;
  1653. line-height: 44rpx;
  1654. border-radius: 4rpx;
  1655. text-align: center;
  1656. font-size: $font-size-24;
  1657. color: #333333;
  1658. background-color: #f7f7f7;
  1659. }
  1660. }
  1661. .product-step {
  1662. position: absolute;
  1663. left: 45rpx;
  1664. bottom: 0;
  1665. height: 44rpx;
  1666. background: #ffffff;
  1667. }
  1668. }
  1669. .layer-nunbox-b {
  1670. width: 100%;
  1671. height: 44rpx;
  1672. margin-top: 30rpx;
  1673. }
  1674. .text {
  1675. line-height: 44rpx;
  1676. font-size: $font-size-28;
  1677. .p {
  1678. color: #ff2a2a;
  1679. }
  1680. .p:first-child {
  1681. margin-left: 30rpx;
  1682. }
  1683. .p.sm {
  1684. font-size: $font-size-24;
  1685. }
  1686. }
  1687. }
  1688. }
  1689. .tui-popup-box {
  1690. position: relative;
  1691. box-sizing: border-box;
  1692. min-height: 220rpx;
  1693. padding: 0rpx 24rpx 0 24rpx;
  1694. .title {
  1695. font-size: $font-size-34;
  1696. color: $text-color;
  1697. line-height: 88rpx;
  1698. text-align: center;
  1699. float: left;
  1700. width: 100%;
  1701. height: 88rpx;
  1702. }
  1703. .tui-popup-main {
  1704. width: 100%;
  1705. float: left;
  1706. .tui-popup-scroll {
  1707. width: 100%;
  1708. height: 320rpx;
  1709. .content-tr {
  1710. width: 100%;
  1711. min-height: 58rpx;
  1712. line-height: 58rpx;
  1713. display: flex;
  1714. .content-td {
  1715. display: flex;
  1716. flex: 3;
  1717. font-size: $font-size-26;
  1718. color: #999999;
  1719. line-height: 58rpx;
  1720. text-align: left;
  1721. }
  1722. .content-th {
  1723. display: flex;
  1724. flex: 7;
  1725. font-size: $font-size-26;
  1726. color: #333333;
  1727. line-height: 58rpx;
  1728. text-align: left;
  1729. padding-left: 10rpx;
  1730. }
  1731. }
  1732. }
  1733. }
  1734. }
  1735. .tui-popup-btn {
  1736. width: 100%;
  1737. height: auto;
  1738. float: left;
  1739. margin-top: 24rpx;
  1740. .tui-button {
  1741. width: 100%;
  1742. height: 88rpx;
  1743. background: $btn-confirm;
  1744. line-height: 88rpx;
  1745. text-align: center;
  1746. color: #ffffff;
  1747. font-size: $font-size-28;
  1748. border-radius: 44rpx;
  1749. }
  1750. }
  1751. /*富文本样式*/
  1752. rich-text.p {
  1753. width: 702rpx !important;
  1754. padding: 0 24rpx;
  1755. text-align: justify;
  1756. }
  1757. rich-text.img {
  1758. width: 100%;
  1759. height: auto;
  1760. }
  1761. </style>