product.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265
  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. 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. border-radius: 10rpx;
  637. background: $btn-confirm;
  638. float: right;
  639. line-height: 44rpx;
  640. color: #FFFFFF;
  641. text-align: center;
  642. font-size: $font-size-24;
  643. }
  644. .p-active{
  645. width: 130rpx;
  646. height: 44rpx;
  647. display: flex;
  648. align-items: center;
  649. flex-direction: row;
  650. float: left;
  651. .icon-active{
  652. width: 124rpx;
  653. height: 30rpx;
  654. display: block;
  655. }
  656. }
  657. .p-price{
  658. height: 44rpx;
  659. line-height: 44rpx;
  660. float: left;
  661. .txt{
  662. color: #FF2A2A;
  663. margin:0 2rpx;
  664. }
  665. .txt.sm{
  666. font-size: $font-size-24;
  667. }
  668. .txt.big{
  669. font-size: $font-size-32;
  670. }
  671. }
  672. .p-minBuy{
  673. height: 44rpx;
  674. line-height: 44rpx;
  675. float: right;
  676. padding: 0 18rpx;
  677. border-radius: 22rpx;
  678. background-color: #EBEBEB;
  679. color: #7F7F7F;
  680. font-size: 24rpx;
  681. text-align: center;
  682. .min-text{
  683. margin: 0 6rpx;
  684. }
  685. }
  686. .p-login{
  687. height: 44rpx;
  688. line-height: 44rpx;
  689. color: $color-system;
  690. font-size: $font-size-24;
  691. &.grade{
  692. margin-bottom: 20rpx;
  693. }
  694. .p-no{
  695. float: left;
  696. margin-right: 5rpx;
  697. font-size: $font-size-28;
  698. }
  699. }
  700. }
  701. .wrap-active{
  702. width: 100%;
  703. float: left;
  704. height: 80rpx;
  705. background: linear-gradient(225deg,rgba(255,143,101,1) 0%,rgba(248,79,57,1) 100%);
  706. line-height: 80rpx;
  707. font-size: $font-size-26;
  708. color: #FFFFFF;
  709. text-align: center;
  710. }
  711. .wrap-ladder{
  712. float: left;
  713. width: 702rpx;
  714. border-bottom: 1px solid #F8F8F8;
  715. .ladder-text{
  716. height: 34rpx;
  717. line-height: 34rpx;
  718. margin-bottom: 24rpx;
  719. font-size: 24rpx;
  720. color: #999999;
  721. .ladder-p{
  722. font-size: 20rpx;
  723. }
  724. }
  725. .ladder-main{
  726. width: 654rpx;
  727. height: 102rpx;
  728. padding: 24rpx;
  729. background: url(https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_WASybTAAI2gyWbunM918.png);
  730. background-size: cover;
  731. border-radius: 20rpx;
  732. display: flex;
  733. .ladder-left{
  734. flex: 1.5;
  735. line-height: 51rpx;
  736. font-size: 24rpx;
  737. .ladder-b{
  738. text-align-last: justify;
  739. }
  740. }
  741. .ladder-right{
  742. height: 100%;
  743. display: flex;
  744. align-items: center;
  745. flex: 8.5;
  746. .ladder-li{
  747. height: 100%;
  748. flex: 1;
  749. display:flex;
  750. flex-flow: column;
  751. align-items: center;
  752. .ladder-a{
  753. flex: 1;
  754. height: 51rpx;
  755. line-height: 51rpx;
  756. font-size: 26rpx;
  757. text-align: justify;
  758. color: #FA6400;
  759. font-weight: bold;
  760. }
  761. }
  762. }
  763. }
  764. }
  765. .wrap-label{
  766. float: left;
  767. width: 702rpx;
  768. padding: 24rpx 24rpx 0 24rpx;
  769. border-bottom: 1px solid #F8F8F8;
  770. .label-a{
  771. padding: 0 18rpx;
  772. line-height: 40rpx;
  773. font-size: $font-size-24;
  774. color: #FFFFFF;
  775. text-align: center;
  776. border-radius: 20rpx;
  777. background:#A69DFE;
  778. margin: 0 22rpx 22rpx 0;
  779. display: inline-block;
  780. }
  781. }
  782. .wrap-info{
  783. float: left;
  784. width: 702rpx;
  785. padding: 24rpx 24rpx 0 24rpx;
  786. border-bottom: 1px solid #F8F8F8;
  787. .info-viewT{
  788. width: 100%;
  789. min-height: 40rpx;
  790. font-size: $font-size-28;
  791. color: $text-color;
  792. line-height: 40rpx;
  793. text-align: left;
  794. &.none{
  795. color: #999999;
  796. }
  797. .info-viewL{
  798. min-width: 350rpx;
  799. float: left;
  800. margin-bottom: 24rpx;
  801. }
  802. .info-viewR{
  803. min-width: 352rpx;
  804. float: left;
  805. margin-bottom: 24rpx;
  806. }
  807. }
  808. .info-viewB{
  809. width: 100%;
  810. height: auto;
  811. }
  812. .info-f{
  813. width: 50%;
  814. float: left;
  815. font-size: $font-size-28;
  816. color: $text-color;
  817. line-height: 40rpx;
  818. margin-bottom: 24rpx;
  819. text-align: left;
  820. }
  821. }
  822. .wrap-seve{
  823. float: left;
  824. width: 702rpx;
  825. padding: 0 24rpx;
  826. height: 72rpx;
  827. line-height: 72rpx;
  828. font-size: $font-size-28;
  829. color: $text-color;
  830. border-bottom: 1px solid #F8F8F8;
  831. &.none{
  832. color: #999999;
  833. .text{
  834. color: #999999;
  835. }
  836. }
  837. .iconfont{
  838. color: $color-system;
  839. margin-left: 20rpx;
  840. font-size: $font-size-24;
  841. }
  842. .text{
  843. font-size: $font-size-24;
  844. color: $text-color;
  845. margin-left: 10rpx;
  846. }
  847. }
  848. }
  849. .product-details {
  850. height: 100%;
  851. background: #FFFFFF;
  852. .navbar {
  853. width: 702rpx;
  854. height: 96rpx;
  855. padding: 0 24rpx;
  856. background: #fff;
  857. z-index: 10;
  858. display: flex;
  859. border-bottom: 1px solid #F8F8F8;
  860. &.fixed{
  861. position: fixed;
  862. left: 0;
  863. }
  864. .nav-item {
  865. display: flex;
  866. flex: 1;
  867. justify-content: center;
  868. align-items: center;
  869. height: 96rpx;
  870. font-size: $font-size-28;
  871. color: $text-color;
  872. position: relative;
  873. float: left;
  874. position: relative;
  875. .line{
  876. width: 60%;
  877. height: 2px;
  878. border-radius: 1px;
  879. background: #FFFFFF;
  880. position: absolute;
  881. bottom: 0;
  882. left: 50%;
  883. margin-left: -30%;
  884. }
  885. &.current{
  886. color:$color-system;
  887. .line{
  888. background: $color-system;
  889. }
  890. }
  891. }
  892. }
  893. .content{
  894. width: 100%;
  895. min-height: 750rpx;
  896. }
  897. }
  898. .isLower{
  899. width: 100%;
  900. height: 116rpx;
  901. line-height: 116rpx;
  902. text-align: center;
  903. color: #000000;
  904. font-size: $font-size-32;
  905. font-weight: bold;
  906. }
  907. .bottom-btn{
  908. width: 100%;
  909. height: 110rpx;
  910. position: fixed;
  911. bottom: 0;
  912. left: 0;
  913. background: #FFFFFF;
  914. z-index: 99;
  915. .bottom-le{
  916. width: 302rpx;
  917. height: 86rpx;
  918. padding:12rpx 24rpx;
  919. float: left;
  920. .item-bt{
  921. width: 86rpx;
  922. height: 100%;
  923. margin-right:22rpx;
  924. display: flex;
  925. float: left;
  926. flex-direction: column;
  927. align-items: center;
  928. font-size: $font-size-24;
  929. color: $text-color;
  930. line-height: 34rpx;
  931. position: relative;
  932. .animation-num{
  933. font-size:$font-size-32 ;
  934. color: #FF2A2A;
  935. position: absolute;
  936. top: -12rpx;
  937. right: 4rpx;
  938. font-weight: bold;
  939. }
  940. .animation{
  941. animation: showAmnation 2.2s ease-in-out both;
  942. }
  943. .restion{
  944. animation: hideAmnation 1s ease-in-out both;
  945. }
  946. .icon-num{
  947. position: absolute;
  948. right:-12rpx;
  949. top: -9rpx;
  950. }
  951. .icon-num.goleft{
  952. right: 4rpx;
  953. }
  954. &:last-child{
  955. margin-right: 0;
  956. }
  957. image {
  958. width: 40rpx;
  959. height: 40rpx;
  960. margin-bottom: 8rpx;
  961. }
  962. button.contact-btn{
  963. width: 100%;
  964. height: 100%;
  965. margin: 0;
  966. padding: 0;
  967. display: flex;
  968. flex-direction: column;
  969. align-items: center;
  970. box-sizing: border-box;
  971. font-size: $font-size-24;
  972. text-align: center;
  973. text-decoration: none;
  974. line-height: 34rpx;
  975. border-radius: 0;
  976. -webkit-tap-highlight-color: transparent;
  977. overflow: hidden;
  978. color: $text-color;
  979. background-color:#FFFFFF;
  980. }
  981. }
  982. }
  983. .bottom-ri{
  984. width: 400rpx;
  985. height: 100%;
  986. float: right;
  987. display: flex;
  988. .btn{
  989. flex: 1;
  990. width: 200rpx;
  991. line-height: 110rpx;
  992. text-align: center;
  993. font-size: $font-size-28;
  994. color: #FFFFFF;
  995. }
  996. .btn-cart{
  997. background-color: #EFAF00;
  998. }
  999. .btn-cart.disabled{
  1000. background-color: rgba(239, 175, 0, 0.5);
  1001. }
  1002. .btn-bay{
  1003. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  1004. }
  1005. .btn-bay.disabled{
  1006. background-color: linear-gradient(135deg,rgba(242,143,49,0.5) 0%,rgba(225,86,22,0.5) 100%);;
  1007. }
  1008. }
  1009. }
  1010. .uni-badge--small {
  1011. -webkit-transform: scale(.8);
  1012. -ms-transform: scale(.8);
  1013. transform: scale(.8);
  1014. -webkit-transform-origin: center center;
  1015. -ms-transform-origin: center center;
  1016. transform-origin: center center;
  1017. }
  1018. .uni-badge {
  1019. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  1020. -webkit-box-sizing: border-box;
  1021. box-sizing: border-box;
  1022. font-size: 12px;
  1023. line-height: 1;
  1024. display: inline-block;
  1025. padding: 3px 6px;
  1026. color: #333;
  1027. border-radius: 100px;
  1028. background-color: #f1f1f1;
  1029. }
  1030. .uni-badge-error {
  1031. color: #fff;
  1032. background-color: #dd524d;
  1033. }
  1034. /* 加入购物模态层*/
  1035. @keyframes showPopup {
  1036. 0% {
  1037. opacity: 0;
  1038. }
  1039. 100% {
  1040. opacity: 1;
  1041. }
  1042. }
  1043. @keyframes hidePopup {
  1044. 0% {
  1045. opacity: 1;
  1046. }
  1047. 100% {
  1048. opacity: 0;
  1049. }
  1050. }
  1051. @keyframes showLayer {
  1052. 0% {
  1053. transform: translateY(0);
  1054. }
  1055. 100% {
  1056. transform: translateY(-100%);
  1057. }
  1058. }
  1059. @keyframes hideLayer {
  1060. 0% {
  1061. transform: translateY(-100%);
  1062. }
  1063. 100% {
  1064. transform: translateY(0);
  1065. }
  1066. }
  1067. @keyframes showAmnation {
  1068. 0% {
  1069. top: -12rpx;
  1070. opacity: 0;
  1071. }
  1072. 50% {
  1073. top: -60rpx;
  1074. opacity: 1;
  1075. }
  1076. 100% {
  1077. top: -100rpx;
  1078. opacity: 0;
  1079. }
  1080. }
  1081. @keyframes hideAmnation {
  1082. 0% {
  1083. top: -100rpx;
  1084. opacity: 0;
  1085. }
  1086. 100% {
  1087. top: -12rpx;
  1088. opacity: 0;
  1089. }
  1090. }
  1091. .popup {
  1092. position: fixed;
  1093. top: 0;
  1094. width: 100%;
  1095. height: 100%;
  1096. z-index: 999;
  1097. display: none;
  1098. .mask{
  1099. position: fixed;
  1100. top: 0;
  1101. width: 100%;
  1102. height: 100%;
  1103. z-index: 21;
  1104. background-color: rgba(0, 0, 0, 0.6);
  1105. }
  1106. .layer {
  1107. position: fixed;
  1108. z-index: 22;
  1109. bottom: -294rpx;
  1110. width: 702rpx;
  1111. padding: 24rpx 24rpx 36rpx 24rpx;
  1112. height: 236rpx;
  1113. border-radius: 30rpx 30rpx 0 0;
  1114. background-color: #fff;
  1115. display: flex;
  1116. flex-wrap: wrap;
  1117. align-content: space-between;
  1118. .content {
  1119. width: 100%;
  1120. }
  1121. .btn {
  1122. width: 100%;
  1123. height: 88rpx;
  1124. .button {
  1125. width: 100%;
  1126. height: 88rpx;
  1127. color: #fff;
  1128. display: flex;
  1129. align-items: center;
  1130. justify-content: center;
  1131. background: $btn-confirm;
  1132. font-size: $font-size-28;
  1133. border-radius: 14rpx;
  1134. }
  1135. }
  1136. }
  1137. &.show {
  1138. display: block;
  1139. .mask{
  1140. animation: showPopup 0.2s linear both;
  1141. }
  1142. .layer {
  1143. animation: showLayer 0.2s linear both;
  1144. }
  1145. }
  1146. &.hide {
  1147. display: block;
  1148. .mask{
  1149. animation: hidePopup 0.2s linear both;
  1150. }
  1151. .layer {
  1152. animation: hideLayer 0.2s linear both;
  1153. }
  1154. }
  1155. &.none {
  1156. display: none;
  1157. }
  1158. &.service {
  1159. .row {
  1160. margin: 30upx 0;
  1161. .title {
  1162. font-size: 30upx;
  1163. margin: 10upx 0;
  1164. }
  1165. .description {
  1166. font-size: 28upx;
  1167. color: #999;
  1168. }
  1169. }
  1170. }
  1171. .layer-smimg{
  1172. width: 114rpx;
  1173. height: 114rpx;
  1174. float: left;
  1175. border-radius: 10rpx;
  1176. margin-right: 24rpx;
  1177. image{
  1178. width: 114rpx;
  1179. height: 114rpx;
  1180. border-radius: 10rpx;
  1181. }
  1182. }
  1183. .layer-nunbox{
  1184. justify-content: space-between;
  1185. align-items: center;
  1186. width: 536rpx;
  1187. height: 88rpx;
  1188. padding: 13rpx 0 0 0;
  1189. float: left;
  1190. .layer-nunbox-t{
  1191. width: 100%;
  1192. height:44rpx;
  1193. position:relative;
  1194. display: flex;
  1195. .layer-nunbox-text{
  1196. line-height: 44rpx;
  1197. font-size: $font-size-28;
  1198. }
  1199. .number-box{
  1200. display: flex;
  1201. justify-content: center;
  1202. align-items: center;
  1203. .iconfont{
  1204. font-size: $font-size-32;
  1205. padding:0 20rpx;
  1206. font-size: $text-color;
  1207. }
  1208. .btn-input{
  1209. width: 62rpx;
  1210. height: 48rpx;
  1211. line-height: 48rpx;
  1212. background: #F8F8F8;
  1213. border-radius: 4rpx;
  1214. text-align: center;
  1215. font-size: $font-size-28;
  1216. }
  1217. }
  1218. .product-step{
  1219. position: absolute;
  1220. left: 45rpx;
  1221. bottom: 0;
  1222. height: 44rpx;
  1223. background: #FFFFFF;
  1224. }
  1225. }
  1226. .layer-nunbox-b{
  1227. width: 100%;
  1228. height:44rpx;
  1229. margin-top: 13rpx;
  1230. }
  1231. .text{
  1232. line-height: 44rpx;
  1233. font-size: $font-size-28;
  1234. .p{
  1235. color: #FF2A2A;
  1236. }
  1237. .p:first-child{
  1238. margin-left: 30rpx;
  1239. }
  1240. .p.sm{
  1241. font-size: $font-size-24;
  1242. }
  1243. }
  1244. }
  1245. }
  1246. /*富文本样式*/
  1247. rich-text.p{
  1248. width: 702rpx !important;
  1249. padding: 0 24rpx;
  1250. text-align: justify;
  1251. }
  1252. rich-text.img{
  1253. width: 100%;
  1254. height: auto;
  1255. }
  1256. </style>