product.vue 58 KB

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