product.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  1. <template>
  2. <view class="product" :style="{paddingBottom: userIdentity==1 ? '0rpx' :'188rpx'}">
  3. <custom-p v-if="isHeaderPoduct"
  4. :systeminfo='systeminfo'
  5. :navbar-data='nvabarData'
  6. :headerBtnPosi ="headerBtnPosi"
  7. :headerColor="headerColor"
  8. :type="isShareType"
  9. :page='backPage'>
  10. </custom-p>
  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 class="p-login-btn" @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 customP 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. customP,
  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. this.$api.navigateTo('/pages/goods/cart')
  358. }else{
  359. this.$api.navigateTo('/pages/login/login?type=1')
  360. }
  361. }else{
  362. this.$api.navigateTo('/pages/authorization/authorization')
  363. }
  364. })
  365. },
  366. btnGetConfirm(type){//加入购物车&&立即购买点击
  367. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  368. if(wxResponse == 1){
  369. if(this.hasLogin){
  370. this.showSpec(type);
  371. }else{
  372. this.$api.navigateTo('/pages/login/login?type=1')
  373. }
  374. }else{
  375. this.$api.navigateTo('/pages/authorization/authorization')
  376. }
  377. })
  378. },
  379. changeCountAdd(){//popup弹窗数量增加按钮
  380. this.number++
  381. this.processActivityPrice()
  382. },
  383. changeCountSub(){//popup弹窗数量减按钮
  384. if(this.number<=this.minBuyNumber){
  385. this.number= this.minBuyNumber
  386. this.isQuantity =true
  387. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  388. return
  389. }else{
  390. this.number--
  391. this.processActivityPrice()
  392. this.isQuantity =false
  393. }
  394. },
  395. changeNumber(e){
  396. let _value = e.detail.value;
  397. if(!this.$api.isNumber(_value)){
  398. this.number = this.minBuyNumber
  399. }else if(_value < this.minBuyNumber){
  400. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  401. this.number = this.minBuyNumber
  402. }else{
  403. this.number = e.detail.value
  404. this.processActivityPrice()
  405. }
  406. },
  407. processActivityPrice(){//单独处理活动价格和阶梯价格
  408. if(this.ladderPriceFlag == '0' && this.product.actStatus == 0){
  409. this.buyRetailPrice = this.product.retailPrice
  410. }else{
  411. this.ladderPriceList.forEach((item,index)=>{
  412. if(this.number>=item.buyNum){
  413. this.buyRetailPrice = item.buyPrice
  414. }
  415. })
  416. }
  417. },
  418. showSpec(type) {//显示选择数量确认弹窗
  419. this.isBtnType = type
  420. this.specClass = 'show';
  421. },
  422. hideSpec() {//关闭选择数量确认弹窗
  423. this.specClass = 'hide';
  424. setTimeout(() => {
  425. this.specClass = 'none';
  426. }, 200);
  427. },
  428. btnConfirm() {//加入购物车&&立即购买跳转订单页并关闭弹窗
  429. if(this.isBtnType == 'add'){
  430. this.getAddProductCart()
  431. }else{
  432. this.toConfirmation()
  433. }
  434. },
  435. toConfirmation(){//跳转确认订单页面
  436. this.specClass = 'hide';
  437. let productStp ={
  438. allPrice:this.number*this.buyRetailPrice,
  439. allCount:this.number,
  440. productID:this.product.productID,
  441. productCount:this.number
  442. }
  443. this.$api.navigateTo(`/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({data:productStp})}`)
  444. setTimeout(() => {
  445. this.specClass = 'none';
  446. }, 200);
  447. },
  448. getAddProductCart(){//增加购物车成功和toast弹窗提示成功
  449. shoppingAddCart({productID:this.productID,userID:this.userID,productCount:this.number}).then(response => {
  450. this.specClass = 'hide';
  451. this.$util.msg('加入购物车成功',1500,true,'success')
  452. this.isAnimation = true
  453. setTimeout(() => {this.specClass = 'none'}, 200)
  454. setTimeout(() => {this.isAnimation = false},2000)
  455. this.goodsData.cartCount = response.data;
  456. }).catch(error =>{
  457. this.$util.msg(error.msg,2000);
  458. })
  459. },
  460. navToLogin(){
  461. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  462. if(wxResponse == 1){
  463. this.$api.navigateTo(`/pages/login/login?type=detilType&id=${this.productID}`)
  464. }else{
  465. this.$api.navigateTo('/pages/authorization/authorization')
  466. }
  467. })
  468. },
  469. setHeaderBtnPosi(){
  470. // 获得胶囊按钮位置信息
  471. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  472. return headerBtnPosi
  473. },
  474. setSysteminfo(){
  475. let systeminfo;
  476. uni.getSystemInfo({ // 获取设备信息
  477. success: (res) => {
  478. systeminfo = res
  479. },
  480. })
  481. return systeminfo
  482. },
  483. getOptionFn(e){
  484. this.isShareType = e.type
  485. },
  486. discard(){
  487. //丢弃
  488. }
  489. },
  490. onPageScroll(e){//实时获取到滚动的值
  491. if(e.scrollTop>50){
  492. this.headerColor = true
  493. this.nvabarData={
  494. showCapsule: 1,
  495. title: '商品详情',
  496. }
  497. }else{
  498. this.headerColor = false
  499. this.nvabarData={
  500. showCapsule: 1,
  501. title: '',
  502. }
  503. }
  504. if(e.scrollTop>700){
  505. this.navbarFiexd = 'fixed'
  506. }else{
  507. this.navbarFiexd = 'none'
  508. }
  509. },
  510. onShareAppMessage(res){//分享转发
  511. if (res.from === 'button') {
  512. // 来自页面内转发按钮
  513. }
  514. return {
  515. title: `${this.product.name}`,
  516. path: `pages/goods/product?type=share&id=${this.productID}`,
  517. imageUrl:`${this.productImage[0]}`
  518. }
  519. },
  520. onShow() {
  521. this.$api.getStorage().then((resolve) => {
  522. this.userID = resolve.userID ? resolve.userID : '';
  523. this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 3
  524. if (isPreviewImg) {
  525. isPreviewImg = false;
  526. return;
  527. } else {
  528. this.initData();
  529. }
  530. }).catch(error =>{
  531. this.initData();
  532. })
  533. }
  534. }
  535. </script>
  536. <style lang="scss">
  537. page{
  538. background-color: #F7F7F7;
  539. }
  540. .productRemarks{
  541. color: #FF2A2A;
  542. font-size: 24rpx;
  543. margin-bottom: 16rp
  544. }
  545. .banner-section{
  546. width: 100%;
  547. height: 750rpx;
  548. position: relative;
  549. border-bottom: 1px solid #EBEBEB;
  550. }
  551. .banner{
  552. width: 100%;
  553. height: 750rpx;
  554. image {
  555. width: 100%;
  556. height: 100%;
  557. }
  558. }
  559. .swiper__dots-box{
  560. position: absolute;
  561. bottom: 24px;
  562. right: 24rpx;
  563. /* #ifndef APP-NVUE */
  564. display: flex;
  565. /* #endif */
  566. flex: 1;
  567. flex-direction: row;
  568. justify-content: center;
  569. align-items: center;
  570. height: 12rpx;
  571. padding: 10rpx;
  572. background: rgba(174,174,174,0.6);
  573. border-radius:16rpx;
  574. .swiper__dots-item{
  575. width: 12rpx;
  576. height: 12rpx;
  577. border-radius: 100%;
  578. margin: 6rpx;
  579. background: rgba(62,62,62,1);
  580. }
  581. .none{
  582. background:#FFFFFF;
  583. }
  584. .swiper__dots-long{
  585. background: rgba(62,62,62,1);
  586. transition: all 0.1s;
  587. }
  588. }
  589. .product-wrap{
  590. width: 100%;
  591. height: auto;
  592. padding: 24rpx 0 0 0;
  593. background-color: #FFFFFF;
  594. border-bottom: 20rpx solid #F7F7F7;
  595. .wrap-top{
  596. width: 702rpx;
  597. padding: 0 24rpx;
  598. height: auto;
  599. float: left;
  600. padding-bottom: 24rpx;
  601. border-bottom: 1px solid #F8F8F8;
  602. &.none{
  603. .p-title{
  604. color:#999999
  605. }
  606. }
  607. .p-title{
  608. line-height: 40rpx;
  609. font-size: $font-size-28;
  610. color: $text-color;
  611. font-weight: Bold;
  612. -o-text-overflow: ellipsis;
  613. text-overflow: ellipsis;
  614. display: -webkit-box;
  615. word-break: break-all;
  616. -webkit-box-orient: vertical;
  617. -webkit-line-clamp: 2;
  618. overflow: hidden;
  619. margin-bottom: 16rpx;
  620. }
  621. .wrap-main-pricenone{
  622. line-height: 44rpx;
  623. color: #FF2A2A;
  624. font-size: $font-size-28;
  625. font-weight: 600;
  626. }
  627. .wrap-main-text{
  628. display: block;
  629. float: left;
  630. font-weight: normal;
  631. }
  632. .wrap-main-none{
  633. display: block;
  634. width: 256rpx;
  635. height: 44rpx;
  636. padding-left: 20rpx;
  637. border-radius: 11rpx;
  638. background: $btn-confirm;
  639. float: right;
  640. line-height: 44rpx;
  641. color: #FFFFFF;
  642. text-align: center;
  643. font-size: $font-size-24;
  644. }
  645. .p-active{
  646. width: 130rpx;
  647. height: 44rpx;
  648. display: flex;
  649. align-items: center;
  650. flex-direction: row;
  651. float: left;
  652. .icon-active{
  653. width: 124rpx;
  654. height: 30rpx;
  655. display: block;
  656. }
  657. }
  658. .p-price{
  659. height: 44rpx;
  660. line-height: 44rpx;
  661. float: left;
  662. .txt{
  663. color: #FF2A2A;
  664. margin:0 2rpx;
  665. }
  666. .txt.sm{
  667. font-size: $font-size-24;
  668. }
  669. .txt.big{
  670. font-size: $font-size-32;
  671. }
  672. }
  673. .p-minBuy{
  674. height: 44rpx;
  675. line-height: 44rpx;
  676. float: right;
  677. padding: 0 18rpx;
  678. border-radius: 22rpx;
  679. background-color: #EBEBEB;
  680. color: #7F7F7F;
  681. font-size: 24rpx;
  682. text-align: center;
  683. .min-text{
  684. margin: 0 6rpx;
  685. }
  686. }
  687. .p-login{
  688. height: 44rpx;
  689. line-height: 44rpx;
  690. color: $color-system;
  691. font-size: $font-size-24;
  692. &.grade{
  693. margin-bottom: 20rpx;
  694. }
  695. .p-no{
  696. float: left;
  697. margin-right: 5rpx;
  698. font-size: $font-size-28;
  699. }
  700. .p-login-btn{
  701. display: block;
  702. height: 44rpx;
  703. padding: 0 10rpx 0 20rpx;
  704. border-radius: 11rpx;
  705. background: $btn-confirm;
  706. float: right;
  707. line-height: 44rpx;
  708. color: #FFFFFF;
  709. text-align: center;
  710. font-size: $font-size-24;
  711. }
  712. }
  713. }
  714. .wrap-active{
  715. width: 100%;
  716. float: left;
  717. height: 80rpx;
  718. background: linear-gradient(225deg,rgba(255,143,101,1) 0%,rgba(248,79,57,1) 100%);
  719. line-height: 80rpx;
  720. font-size: $font-size-26;
  721. color: #FFFFFF;
  722. text-align: center;
  723. }
  724. .wrap-ladder{
  725. float: left;
  726. width: 702rpx;
  727. border-bottom: 1px solid #F8F8F8;
  728. .ladder-text{
  729. height: 34rpx;
  730. line-height: 34rpx;
  731. margin-bottom: 24rpx;
  732. font-size: 24rpx;
  733. color: #999999;
  734. .ladder-p{
  735. font-size: 20rpx;
  736. }
  737. }
  738. .ladder-main{
  739. width: 654rpx;
  740. height: 102rpx;
  741. padding: 24rpx;
  742. background: url(https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_WASybTAAI2gyWbunM918.png);
  743. background-size: cover;
  744. border-radius: 20rpx;
  745. display: flex;
  746. .ladder-left{
  747. flex: 1.5;
  748. line-height: 51rpx;
  749. font-size: 24rpx;
  750. .ladder-b{
  751. text-align-last: justify;
  752. }
  753. }
  754. .ladder-right{
  755. height: 100%;
  756. display: flex;
  757. align-items: center;
  758. flex: 8.5;
  759. .ladder-li{
  760. height: 100%;
  761. flex: 1;
  762. display:flex;
  763. flex-flow: column;
  764. align-items: center;
  765. .ladder-a{
  766. flex: 1;
  767. height: 51rpx;
  768. line-height: 51rpx;
  769. font-size: 26rpx;
  770. text-align: justify;
  771. color: #FA6400;
  772. font-weight: bold;
  773. }
  774. }
  775. }
  776. }
  777. }
  778. .wrap-label{
  779. float: left;
  780. width: 702rpx;
  781. padding: 24rpx 24rpx 0 24rpx;
  782. border-bottom: 1px solid #F8F8F8;
  783. .label-a{
  784. padding: 0 18rpx;
  785. line-height: 40rpx;
  786. font-size: $font-size-24;
  787. color: #FFFFFF;
  788. text-align: center;
  789. border-radius: 20rpx;
  790. background:#A69DFE;
  791. margin: 0 22rpx 22rpx 0;
  792. display: inline-block;
  793. }
  794. }
  795. .wrap-info{
  796. float: left;
  797. width: 702rpx;
  798. padding: 24rpx 24rpx 0 24rpx;
  799. border-bottom: 1px solid #F8F8F8;
  800. .info-viewT{
  801. width: 100%;
  802. min-height: 40rpx;
  803. font-size: $font-size-28;
  804. color: $text-color;
  805. line-height: 40rpx;
  806. text-align: left;
  807. &.none{
  808. color: #999999;
  809. }
  810. .info-viewL{
  811. min-width: 350rpx;
  812. float: left;
  813. margin-bottom: 24rpx;
  814. }
  815. .info-viewR{
  816. min-width: 352rpx;
  817. float: left;
  818. margin-bottom: 24rpx;
  819. }
  820. }
  821. .info-viewB{
  822. width: 100%;
  823. height: auto;
  824. }
  825. .info-f{
  826. width: 50%;
  827. float: left;
  828. font-size: $font-size-28;
  829. color: $text-color;
  830. line-height: 40rpx;
  831. margin-bottom: 24rpx;
  832. text-align: left;
  833. }
  834. }
  835. .wrap-seve{
  836. float: left;
  837. width: 702rpx;
  838. padding: 0 24rpx;
  839. height: 72rpx;
  840. line-height: 72rpx;
  841. font-size: $font-size-28;
  842. color: $text-color;
  843. border-bottom: 1px solid #F8F8F8;
  844. &.none{
  845. color: #999999;
  846. .text{
  847. color: #999999;
  848. }
  849. }
  850. .iconfont{
  851. color: $color-system;
  852. margin-left: 20rpx;
  853. font-size: $font-size-24;
  854. }
  855. .text{
  856. font-size: $font-size-24;
  857. color: $text-color;
  858. margin-left: 10rpx;
  859. }
  860. }
  861. }
  862. .product-details {
  863. height: 100%;
  864. background: #FFFFFF;
  865. .navbar {
  866. width: 702rpx;
  867. height: 96rpx;
  868. padding: 0 24rpx;
  869. background: #fff;
  870. z-index: 10;
  871. display: flex;
  872. border-bottom: 1px solid #F8F8F8;
  873. &.fixed{
  874. position: fixed;
  875. left: 0;
  876. }
  877. .nav-item {
  878. display: flex;
  879. flex: 1;
  880. justify-content: center;
  881. align-items: center;
  882. height: 96rpx;
  883. font-size: $font-size-28;
  884. color: $text-color;
  885. position: relative;
  886. float: left;
  887. position: relative;
  888. .line{
  889. width: 60%;
  890. height: 2px;
  891. border-radius: 1px;
  892. background: #FFFFFF;
  893. position: absolute;
  894. bottom: 0;
  895. left: 50%;
  896. margin-left: -30%;
  897. }
  898. &.current{
  899. color:$color-system;
  900. .line{
  901. background: $color-system;
  902. }
  903. }
  904. }
  905. }
  906. .content{
  907. width: 100%;
  908. min-height: 750rpx;
  909. }
  910. }
  911. .isLower{
  912. width: 100%;
  913. height: 116rpx;
  914. line-height: 116rpx;
  915. text-align: center;
  916. color: #000000;
  917. font-size: $font-size-32;
  918. font-weight: bold;
  919. }
  920. .bottom-btn{
  921. width: 100%;
  922. height: 110rpx;
  923. position: fixed;
  924. bottom: 0;
  925. left: 0;
  926. background: #FFFFFF;
  927. z-index: 99;
  928. .bottom-le{
  929. width: 302rpx;
  930. height: 86rpx;
  931. padding:12rpx 24rpx;
  932. float: left;
  933. .item-bt{
  934. width: 86rpx;
  935. height: 100%;
  936. margin-right:22rpx;
  937. display: flex;
  938. float: left;
  939. flex-direction: column;
  940. align-items: center;
  941. font-size: $font-size-24;
  942. color: $text-color;
  943. line-height: 34rpx;
  944. position: relative;
  945. .animation-num{
  946. font-size:$font-size-32 ;
  947. color: #FF2A2A;
  948. position: absolute;
  949. top: -12rpx;
  950. right: 4rpx;
  951. font-weight: bold;
  952. }
  953. .animation{
  954. animation: showAmnation 2.2s ease-in-out both;
  955. }
  956. .restion{
  957. animation: hideAmnation 1s ease-in-out both;
  958. }
  959. .icon-num{
  960. position: absolute;
  961. right:-12rpx;
  962. top: -9rpx;
  963. }
  964. .icon-num.goleft{
  965. right: 4rpx;
  966. }
  967. &:last-child{
  968. margin-right: 0;
  969. }
  970. image {
  971. width: 40rpx;
  972. height: 40rpx;
  973. margin-bottom: 8rpx;
  974. }
  975. button.contact-btn{
  976. width: 100%;
  977. height: 100%;
  978. margin: 0;
  979. padding: 0;
  980. display: flex;
  981. flex-direction: column;
  982. align-items: center;
  983. box-sizing: border-box;
  984. font-size: $font-size-24;
  985. text-align: center;
  986. text-decoration: none;
  987. line-height: 34rpx;
  988. border-radius: 0;
  989. -webkit-tap-highlight-color: transparent;
  990. overflow: hidden;
  991. color: $text-color;
  992. background-color:#FFFFFF;
  993. }
  994. }
  995. }
  996. .bottom-ri{
  997. width: 400rpx;
  998. height: 100%;
  999. float: right;
  1000. display: flex;
  1001. .btn{
  1002. flex: 1;
  1003. width: 200rpx;
  1004. line-height: 110rpx;
  1005. text-align: center;
  1006. font-size: $font-size-28;
  1007. color: #FFFFFF;
  1008. }
  1009. .btn-cart{
  1010. background-color: #EFAF00;
  1011. }
  1012. .btn-cart.disabled{
  1013. background-color: rgba(239, 175, 0, 0.5);
  1014. }
  1015. .btn-bay{
  1016. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  1017. }
  1018. .btn-bay.disabled{
  1019. background-color: linear-gradient(135deg,rgba(242,143,49,0.5) 0%,rgba(225,86,22,0.5) 100%);;
  1020. }
  1021. }
  1022. }
  1023. .uni-badge--small {
  1024. -webkit-transform: scale(.8);
  1025. -ms-transform: scale(.8);
  1026. transform: scale(.8);
  1027. -webkit-transform-origin: center center;
  1028. -ms-transform-origin: center center;
  1029. transform-origin: center center;
  1030. }
  1031. .uni-badge {
  1032. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  1033. -webkit-box-sizing: border-box;
  1034. box-sizing: border-box;
  1035. font-size: 12px;
  1036. line-height: 1;
  1037. display: inline-block;
  1038. padding: 3px 6px;
  1039. color: #333;
  1040. border-radius: 100px;
  1041. background-color: #f1f1f1;
  1042. }
  1043. .uni-badge-error {
  1044. color: #fff;
  1045. background-color: #dd524d;
  1046. }
  1047. /* 加入购物模态层*/
  1048. @keyframes showPopup {
  1049. 0% {
  1050. opacity: 0;
  1051. }
  1052. 100% {
  1053. opacity: 1;
  1054. }
  1055. }
  1056. @keyframes hidePopup {
  1057. 0% {
  1058. opacity: 1;
  1059. }
  1060. 100% {
  1061. opacity: 0;
  1062. }
  1063. }
  1064. @keyframes showLayer {
  1065. 0% {
  1066. transform: translateY(0);
  1067. }
  1068. 100% {
  1069. transform: translateY(-100%);
  1070. }
  1071. }
  1072. @keyframes hideLayer {
  1073. 0% {
  1074. transform: translateY(-100%);
  1075. }
  1076. 100% {
  1077. transform: translateY(0);
  1078. }
  1079. }
  1080. @keyframes showAmnation {
  1081. 0% {
  1082. top: -12rpx;
  1083. opacity: 0;
  1084. }
  1085. 50% {
  1086. top: -60rpx;
  1087. opacity: 1;
  1088. }
  1089. 100% {
  1090. top: -100rpx;
  1091. opacity: 0;
  1092. }
  1093. }
  1094. @keyframes hideAmnation {
  1095. 0% {
  1096. top: -100rpx;
  1097. opacity: 0;
  1098. }
  1099. 100% {
  1100. top: -12rpx;
  1101. opacity: 0;
  1102. }
  1103. }
  1104. .popup {
  1105. position: fixed;
  1106. top: 0;
  1107. width: 100%;
  1108. height: 100%;
  1109. z-index: 999;
  1110. display: none;
  1111. .mask{
  1112. position: fixed;
  1113. top: 0;
  1114. width: 100%;
  1115. height: 100%;
  1116. z-index: 21;
  1117. background-color: rgba(0, 0, 0, 0.6);
  1118. }
  1119. .layer {
  1120. position: fixed;
  1121. z-index: 22;
  1122. bottom: -294rpx;
  1123. width: 702rpx;
  1124. padding: 24rpx 24rpx 36rpx 24rpx;
  1125. height: 236rpx;
  1126. border-radius: 30rpx 30rpx 0 0;
  1127. background-color: #fff;
  1128. display: flex;
  1129. flex-wrap: wrap;
  1130. align-content: space-between;
  1131. .content {
  1132. width: 100%;
  1133. }
  1134. .btn {
  1135. width: 100%;
  1136. height: 88rpx;
  1137. .button {
  1138. width: 100%;
  1139. height: 88rpx;
  1140. color: #fff;
  1141. display: flex;
  1142. align-items: center;
  1143. justify-content: center;
  1144. background: $btn-confirm;
  1145. font-size: $font-size-28;
  1146. border-radius: 14rpx;
  1147. }
  1148. }
  1149. }
  1150. &.show {
  1151. display: block;
  1152. .mask{
  1153. animation: showPopup 0.2s linear both;
  1154. }
  1155. .layer {
  1156. animation: showLayer 0.2s linear both;
  1157. }
  1158. }
  1159. &.hide {
  1160. display: block;
  1161. .mask{
  1162. animation: hidePopup 0.2s linear both;
  1163. }
  1164. .layer {
  1165. animation: hideLayer 0.2s linear both;
  1166. }
  1167. }
  1168. &.none {
  1169. display: none;
  1170. }
  1171. &.service {
  1172. .row {
  1173. margin: 30upx 0;
  1174. .title {
  1175. font-size: 30upx;
  1176. margin: 10upx 0;
  1177. }
  1178. .description {
  1179. font-size: 28upx;
  1180. color: #999;
  1181. }
  1182. }
  1183. }
  1184. .layer-smimg{
  1185. width: 114rpx;
  1186. height: 114rpx;
  1187. float: left;
  1188. border-radius: 10rpx;
  1189. margin-right: 24rpx;
  1190. image{
  1191. width: 114rpx;
  1192. height: 114rpx;
  1193. border-radius: 10rpx;
  1194. }
  1195. }
  1196. .layer-nunbox{
  1197. justify-content: space-between;
  1198. align-items: center;
  1199. width: 536rpx;
  1200. height: 88rpx;
  1201. padding: 13rpx 0 0 0;
  1202. float: left;
  1203. .layer-nunbox-t{
  1204. width: 100%;
  1205. height:44rpx;
  1206. position:relative;
  1207. display: flex;
  1208. .layer-nunbox-text{
  1209. line-height: 44rpx;
  1210. font-size: $font-size-28;
  1211. }
  1212. .number-box{
  1213. display: flex;
  1214. justify-content: center;
  1215. align-items: center;
  1216. .iconfont{
  1217. font-size: $font-size-32;
  1218. padding:0 20rpx;
  1219. font-size: $text-color;
  1220. }
  1221. .btn-input{
  1222. width: 62rpx;
  1223. height: 48rpx;
  1224. line-height: 48rpx;
  1225. background: #F8F8F8;
  1226. border-radius: 4rpx;
  1227. text-align: center;
  1228. font-size: $font-size-28;
  1229. }
  1230. }
  1231. .product-step{
  1232. position: absolute;
  1233. left: 45rpx;
  1234. bottom: 0;
  1235. height: 44rpx;
  1236. background: #FFFFFF;
  1237. }
  1238. }
  1239. .layer-nunbox-b{
  1240. width: 100%;
  1241. height:44rpx;
  1242. margin-top: 13rpx;
  1243. }
  1244. .text{
  1245. line-height: 44rpx;
  1246. font-size: $font-size-28;
  1247. .p{
  1248. color: #FF2A2A;
  1249. }
  1250. .p:first-child{
  1251. margin-left: 30rpx;
  1252. }
  1253. .p.sm{
  1254. font-size: $font-size-24;
  1255. }
  1256. }
  1257. }
  1258. }
  1259. /*富文本样式*/
  1260. rich-text.p{
  1261. width: 702rpx !important;
  1262. padding: 0 24rpx;
  1263. text-align: justify;
  1264. }
  1265. rich-text.img{
  1266. width: 100%;
  1267. height: auto;
  1268. }
  1269. </style>