product.vue 31 KB

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