product.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  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="wrap-top-price" v-if="!goodsData.isNoneDisabled">
  36. <view v-if="!hasLogin" class="p-login grade tui-skeleton-fillet">
  37. <text class="p-no">价格:</text>
  38. <uni-stars :stars="parseInt(product.price1Grade)" :font-size='36' :width-info="180"></uni-stars>
  39. </view>
  40. <view v-if="!hasLogin" class="p-login tui-skeleton-fillet">
  41. <text @click.stop="navToLogin">登录查看价格<text class="iconfont icon-xiayibu" style="font-size: 22rpx;margin: 0 6rpx;"></text></text>
  42. </view>
  43. <view class="wrap-main" v-else>
  44. <view class="wrap-main-pricenone" v-if="product.price1TextFlag == 1">
  45. <text>未公开价格</text>
  46. </view>
  47. <view class="wrap-main-price" v-else>
  48. <view class="p-main" v-if="ladderPriceFlag == '0' || product.actStatus == 1">
  49. <view class="p-active" v-if="product.actStatus == 1">
  50. <image class="icon-active" src="../../static/temp/icon-active.png" mode="" ></image>
  51. </view>
  52. <view class="p-price tui-skeleton-fillet">
  53. <text class="txt sm">¥</text>
  54. <text class="txt big">{{retailPrice}}</text>
  55. <text class="txt big">{{smallMoney== '0'?'.00':smallMoney}}</text>
  56. </view>
  57. <view class="p-minBuy">
  58. 起订量:
  59. <text class="min-text">{{minBuyNumber}}</text>
  60. </view>
  61. </view>
  62. <view class="wrap-ladder" v-else>
  63. <view class="ladder-text">
  64. <text class="ladder-h1">说明:</text>
  65. <text class="ladder-p">本商品有以下优惠购物方案</text>
  66. </view>
  67. <view class="ladder-main tui-skeleton-fillet">
  68. <view class="ladder-left">
  69. <view class="ladder-b">起订量:</view>
  70. <view class="ladder-b">价格:</view>
  71. </view>
  72. <view class="ladder-right">
  73. <view class="ladder-li" v-for="(ladder,index) in ladderPriceList" :key="index">
  74. <view class="ladder-a">{{ladder.buyNumRangeShow}}</view>
  75. <view class="ladder-a">¥{{ladder.buyPrice.toFixed(2)}}</view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="wrap-active" v-if="product.actStatus == 1">
  85. <text>活动时间:</text>
  86. <text>{{ product.beginTime }} ~ {{ product.endTime }}</text>
  87. </view>
  88. <view class="wrap-label" v-if="product.tagsList.length>0">
  89. <view class="label-a tui-skeleton-fillet" v-for="(label,index) in product.tagsList" :key="index">{{label}}</view>
  90. </view>
  91. <view class="wrap-label" v-if="goodsData.isNoneDisabled">
  92. <view class="isLower">此商品已{{disabledText}},请浏览以下推荐商品~</view>
  93. </view>
  94. <view class="wrap-info">
  95. <view class="info-viewT" :class="goodsData.isNoneDisabled ? 'none' : ''">
  96. <view class="info-viewL tui-skeleton-fillet">品牌:<text>{{product.brandName == null? '其他' : product.brandName}}</text></view>
  97. <view class="info-viewR tui-skeleton-fillet">包装规格:<text>{{product.unit}}</text></view>
  98. </view>
  99. </view>
  100. <view class="wrap-seve" :class="goodsData.isNoneDisabled ? 'none' : ''">
  101. <text class="tui-skeleton-rect">服务:</text>
  102. <text class="iconfont icon-dui tui-skeleton-rect"><text class="text">无忧退货</text></text>
  103. <text class="iconfont icon-dui tui-skeleton-rect"><text class="text">快速退款</text></text>
  104. <text class="iconfont icon-dui tui-skeleton-rect"><text class="text">正品保证</text></text>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="product-details">
  109. <!-- 头部 -->
  110. <view v-if="goodsData.isNoneDisabled" class="navbar" :class="navbarFiexd"
  111. :style="{top:headerBtnPosi.bottom + (headerBtnPosi.bottom - headerBtnPosi.height - systeminfo.statusBarHeight) +'px'}">
  112. <view class="nav-item tui-skeleton-fillet" v-for="(item,index) in disabledTabNavList" :key="index" :class="{ current: tabCurrentIndex === index+2 }" @click="tabClick(index+2)">
  113. <text class="line"></text>
  114. <text>{{item.name}}</text>
  115. </view>
  116. </view>
  117. <view v-else class="navbar" :class="navbarFiexd"
  118. :style="{top:headerBtnPosi.bottom + (headerBtnPosi.bottom - headerBtnPosi.height - systeminfo.statusBarHeight) +'px'}">
  119. <view class="nav-item tui-skeleton-fillet" v-for="(item,index) in tabNavList" :key="index" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">
  120. <text class="line"></text>
  121. <text>{{item.name}}</text>
  122. </view>
  123. </view>
  124. <!-- 商品详情,供应商详情展示,相关推荐,评价-->
  125. <view class="content tui-banner tui-skeleton-rect" v-if="tabCurrentIndex === 0">
  126. <parser :html="html" :img-mode="widthFix"></parser>
  127. </view>
  128. <view class="content sup" v-if="tabCurrentIndex === 1">
  129. <supplier-details :shop="shop"></supplier-details>
  130. </view>
  131. <view class="content hot" v-if="tabCurrentIndex === 2">
  132. <recommend :query-productid="product.productID" v-if="isRecommend"></recommend>
  133. </view>
  134. <view class="content hot" v-if="tabCurrentIndex === 3">
  135. <evaluate :query-productid ="product.productID" v-if="isEvaluate"></evaluate>
  136. </view>
  137. </view>
  138. <!-- 底部按钮 -->
  139. <view class="menu" v-if="userIdentity!=1">
  140. <view class="bottom-btn" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  141. <view class="bottom-le">
  142. <view class="item-bt" @click="this.$api.switchTabTo('/pages/tabBar/home/home')">
  143. <image src="../../static/icon-home-active@3x.png"></image>
  144. <text>首页</text>
  145. </view>
  146. <view class="item-bt">
  147. <!-- #ifdef MP-WEIXIN -->
  148. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  149. <image src="../../static/severs@3x.png"></image>
  150. <text>客服</text>
  151. </button>
  152. <!-- #endif -->
  153. </view>
  154. <view class="item-bt" @click="buyProductCart()">
  155. <image src="../../static/icon-cart-active@3x.png"></image>
  156. <text>购物车</text>
  157. <text v-if="hasLogin && goodsData.cartCount>0"
  158. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  159. :class="[goodsData.cartCount < 10 ? 'goleft':'']">
  160. {{ goodsData.cartCount >= 100 ? '99+': goodsData.cartCount}}
  161. </text>
  162. <view class="animation-num" :class="isAnimation ? 'animation' : 'restion'">+1</view>
  163. </view>
  164. </view>
  165. <view class="bottom-ri">
  166. <button
  167. :disabled="goodsData.disabled"
  168. class="btn btn-cart"
  169. :class="[goodsData.disabled ? 'disabled':'']"
  170. @tap.stop="btnGetConfirm('add')">加入购物车</button>
  171. <button
  172. :disabled="goodsData.disabled"
  173. class="btn btn-bay"
  174. :class="[goodsData.disabled ? 'disabled':'']"
  175. @tap.stop="btnGetConfirm('buy')">立即购买</button>
  176. </view>
  177. </view>
  178. </view>
  179. <!--底部选择模态层弹窗组件 -->
  180. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @tap="hideSpec">
  181. <!-- 遮罩层 -->
  182. <view class="mask"></view>
  183. <view class="layer" @tap.stop="discard">
  184. <view class="content">
  185. <view class="layer-smimg">
  186. <image :src="product.mainImage" mode=""></image>
  187. </view>
  188. <view class="layer-nunbox">
  189. <view class="layer-nunbox-t">
  190. <view class="layer-nunbox-text">数量:</view>
  191. <view class="number-box">
  192. <view class="iconfont icon-jianhao" :class="[isQuantity==true?'disabled':'']" @click="changeCountSub()"></view>
  193. <input class="btn-input" type="number" v-model="number" maxlength='4' @blur="changeNumber($event)">
  194. <view class="iconfont icon-jiahao" :class="[isStock==true?'disabled':'']" @click="changeCountAdd()"></view>
  195. </view>
  196. </view>
  197. <view class="layer-nunbox-b">
  198. <view class="text">单价:
  199. <text class="p sm">¥</text>
  200. <text class="p bg">{{buyRetailPrice.toFixed(2)}}</text>
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. <view class="btn"><view class="button" @click.stop="btnConfirm">确定</view></view>
  206. </view>
  207. </view>
  208. </view>
  209. </view>
  210. </template>
  211. <script>
  212. import { mapState,mapMutations } from 'vuex'
  213. import headerPoduct from '@/components/cm-module/headerNavbar/header-poduct' //自定义导航
  214. import authorize from '@/common/config/authorize.js'
  215. import uniStars from '@/components/uni-stars/uni-stars.vue'
  216. import parser from "@/components/jyf-Parser/index" //富文本处理
  217. import tuiSkeleton from "@/components/tui-skeleton/tui-skeleton"
  218. import supplierDetails from "@/components/cm-module/productDetails/supplierDetails" //供应商详情
  219. import recommend from "@/components/cm-module/productDetails/recommend" //供应商详情
  220. import evaluate from "@/components/cm-module/productDetails/evaluate" //供应商详情
  221. import wxLogin from "@/common/config/wxLogin.js"
  222. import { queryProductDetils } from "@/api/product.js"
  223. import { shoppingAddCart } from "@/api/cart.js"
  224. var isPreviewImg;
  225. export default{
  226. components:{
  227. headerPoduct,
  228. parser,
  229. tuiSkeleton,
  230. supplierDetails,
  231. recommend,
  232. evaluate
  233. },
  234. data(){
  235. return{
  236. html:'<div style="text-align: center;color:#333333;">暂无内容</div>',
  237. tabNavList:[{name:'商品详情'},{name:'供应商细信息'},{name:'相关推荐'},{name:'评价'}],
  238. disabledTabNavList:[{name:'相关推荐'},{name:'评价'}],
  239. mode:'round',
  240. specClass: '',//规格弹窗css类,控制开关动画
  241. isBtnType:'',
  242. current:0,
  243. isShareType:'',
  244. isHeaderPoduct:false,
  245. navbarFiexd:'none',
  246. ladderPriceFlag:'',
  247. ladderPriceList:'',
  248. isRecommend:false,
  249. isEvaluate:false,
  250. isAnimation:false,
  251. skeletonShow:true,
  252. isQuantity:false,
  253. isStock:false,
  254. disabled:false,
  255. isNoneDisabled:false,
  256. disabledText:'',
  257. tabCurrentIndex:0,
  258. userID:'',
  259. productID:0,
  260. userIdentity:'',//用户类型
  261. goodsData:{},//自定义数据
  262. shop:{},//供应商信息
  263. product:{},//采美
  264. productImage:[],
  265. retailPrice:0,
  266. buyRetailPrice:0,
  267. stock:0,
  268. number:0,
  269. minBuyNumber:0,
  270. productsList:[],
  271. goodListData:[],
  272. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  273. systeminfo: this.setSysteminfo(), //获取设备信息
  274. isIphoneX:this.$store.state.isIphoneX,
  275. windowHeight: '',
  276. headerColor:false,
  277. backPage:1,
  278. nvabarData: { //顶部自定义导航
  279. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  280. title: '' // 导航栏 中间的标题
  281. }
  282. }
  283. },
  284. onLoad(option) {
  285. this.productID = option.id;//获取商品ID
  286. this.isShareType = option.type
  287. this.isHeaderPoduct = true
  288. if(option.page == 2){
  289. this.backPage = option.page
  290. }
  291. if(this.isShareType =='share'){
  292. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  293. console.log(wxResponse)
  294. if(wxResponse == 1){
  295. wxLogin.wxLoginAuthorize()
  296. }else{
  297. console.log(new Date +'用户未授权微信信息')
  298. }
  299. })
  300. }
  301. },
  302. computed: {
  303. ...mapState(['hasLogin','isWxAuthorize'])
  304. },
  305. methods:{
  306. initData(){// 初始化商品详情查询
  307. queryProductDetils({userId:this.userID,productID:this.productID}).then(response =>{
  308. this.skeletonShow = false
  309. this.productImage=[];
  310. this.shop = response.data.shop
  311. this.product = response.data
  312. this.ladderPriceFlag = this.product.ladderPriceFlag;
  313. this.html = this.product.productDetail == null ? this.html : this.$api.adaptRichTextImg(this.product.productDetail.detailInfo)
  314. this.stock = this.product.stock
  315. this.number = this.product.minBuyNumber
  316. this.minBuyNumber = this.product.minBuyNumber
  317. //处理商品图片列表
  318. this.product.imageList.forEach(item =>{
  319. this.productImage.push(item.image);
  320. })
  321. //购物车数量
  322. this.goodsData.cartCount = this.product.productCount
  323. //处理阶梯价格
  324. if(this.product.ladderPriceList!=null){
  325. this.ladderPriceList = this.product.ladderPriceList;
  326. }
  327. //拆分金额并转千分位格式显示
  328. if(this.product.retailPrice!=null){
  329. this.retailPrice = this.product.retailPrice.toFixed(2);
  330. this.buyRetailPrice = this.product.retailPrice;
  331. }
  332. // }
  333. //处理下架商品和售罄商品
  334. if(this.product.validFlag =='3' || this.stock == 0 ){
  335. this.disabled = true
  336. this.isNoneDisabled = true
  337. this.tabCurrentIndex = 2;// 页面显示是默认选中第一
  338. this.isRecommend = true
  339. this.disabledText = '下架'
  340. }else{
  341. this.disabled = false
  342. this.isNoneDisabled = false
  343. this.tabCurrentIndex = 0;// 页面显示是默认选中第三
  344. this.disabledText = ''
  345. }
  346. if(this.product.price1TextFlag == 1){
  347. this.disabled = true
  348. }
  349. this.goodsData.disabled = this.disabled
  350. this.goodsData.isNoneDisabled = this.isNoneDisabled
  351. if(this.product.validFlag =='3'){
  352. this.disabledText = '下架'
  353. }
  354. if(this.stock == 0){
  355. this.disabledText = '售罄'
  356. }
  357. }).catch(error =>{
  358. this.$util.msg(error.msg,2000);
  359. })
  360. },
  361. swiperChange(e) {//顶部商品图片切换
  362. const index = e.detail.current;
  363. this.current = index;
  364. },
  365. previewImg (index) {//顶部商品图片预览
  366. isPreviewImg = true
  367. let previewUrls = this.productImage
  368. uni.previewImage({
  369. current: index, //图片索引
  370. urls: previewUrls, //必须是http图片,本地图片无效
  371. longPressActions:''
  372. })
  373. },
  374. tabClick(index) {//商品详情&&供应商信息tab切换
  375. this.tabCurrentIndex = index;
  376. if(this.tabCurrentIndex == 2){
  377. this.isRecommend = true
  378. }
  379. if(this.tabCurrentIndex == 3){
  380. this.isEvaluate = true
  381. }
  382. },
  383. changeTab(e) {
  384. this.tabCurrentIndex = e.target.current;
  385. },
  386. handleContact(e){//跳转小程序客服
  387. },
  388. buyProductCart(){//底部购物车按钮点击
  389. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  390. if(wxResponse == 1){
  391. if(this.hasLogin){
  392. this.$api.switchTabTo('/pages/tabBar/cart/cart')
  393. }else{
  394. this.$api.navigateTo('/pages/login/login-accont?type=1')
  395. }
  396. }else{
  397. this.$api.navigateTo('/pages/authorization/authorization')
  398. }
  399. })
  400. },
  401. btnGetConfirm(type){//加入购物车&&立即购买点击
  402. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  403. if(wxResponse == 1){
  404. if(this.hasLogin){
  405. this.showSpec(type);
  406. }else{
  407. this.$api.navigateTo('/pages/login/login-accont?type=1')
  408. }
  409. }else{
  410. this.$api.navigateTo('/pages/authorization/authorization')
  411. }
  412. })
  413. },
  414. changeCountAdd(){//popup弹窗数量增加按钮
  415. this.number++
  416. this.processActivityPrice()
  417. },
  418. changeCountSub(){//popup弹窗数量减按钮
  419. if(this.number<=this.minBuyNumber){
  420. this.number= this.minBuyNumber
  421. this.isQuantity =true
  422. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  423. return
  424. }else{
  425. this.number--
  426. this.processActivityPrice()
  427. this.isQuantity =false
  428. }
  429. },
  430. changeNumber(e){
  431. let _value = e.detail.value;
  432. if(!this.$api.isNumber(_value)){
  433. this.number = this.minBuyNumber
  434. }else if(_value < this.minBuyNumber){
  435. this.$util.msg(`该商品最小起订量为${this.minBuyNumber}`,2000);
  436. this.number = this.minBuyNumber
  437. }else{
  438. this.number = e.detail.value
  439. this.processActivityPrice()
  440. }
  441. },
  442. processActivityPrice(){//单独处理活动价格和阶梯价格
  443. if(this.ladderPriceFlag == '0' && this.product.actStatus == 0){
  444. this.buyRetailPrice = this.product.retailPrice
  445. }else{
  446. this.ladderPriceList.forEach((item,index)=>{
  447. if(this.number>=item.buyNum){
  448. this.buyRetailPrice = item.buyPrice
  449. }
  450. })
  451. }
  452. },
  453. showSpec(type) {//显示选择数量确认弹窗
  454. this.isBtnType = type
  455. this.specClass = 'show';
  456. },
  457. hideSpec() {//关闭选择数量确认弹窗
  458. this.specClass = 'hide';
  459. setTimeout(() => {
  460. this.specClass = 'none';
  461. }, 200);
  462. },
  463. btnConfirm() {//加入购物车&&立即购买跳转订单页并关闭弹窗
  464. if(this.isBtnType == 'add'){
  465. this.getAddProductCart()
  466. }else{
  467. this.toConfirmation()
  468. }
  469. },
  470. toConfirmation(){//跳转确认订单页面
  471. this.specClass = 'hide';
  472. let productStp ={
  473. allPrice:this.number*this.buyRetailPrice,
  474. allCount:this.number,
  475. productID:this.product.productID,
  476. productCount:this.number
  477. }
  478. this.$api.navigateTo(`/pages/user/order/create-order?type=prodcut&data=${JSON.stringify({data:productStp})}`)
  479. setTimeout(() => {
  480. this.specClass = 'none';
  481. }, 200);
  482. },
  483. getAddProductCart(){//增加购物车成功和toast弹窗提示成功
  484. shoppingAddCart({productID:this.productID,userID:this.userID,productCount:this.number}).then(response => {
  485. this.specClass = 'hide';
  486. this.$util.msg('加入购物车成功',1500,true,'success')
  487. this.isAnimation = true
  488. setTimeout(() => {this.specClass = 'none'}, 200)
  489. setTimeout(() => {this.isAnimation = false},2000)
  490. this.goodsData.cartCount = response.data;
  491. }).catch(error =>{
  492. this.$util.msg(error.msg,2000);
  493. })
  494. },
  495. navToLogin(){
  496. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  497. if(wxResponse == 1){
  498. this.$api.navigateTo(`/pages/login/login-accont?type=detilType&id=${this.productID}`)
  499. }else{
  500. this.$api.navigateTo('/pages/authorization/authorization')
  501. }
  502. })
  503. },
  504. setHeaderBtnPosi(){
  505. // 获得胶囊按钮位置信息
  506. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  507. return headerBtnPosi
  508. },
  509. setSysteminfo(){
  510. let systeminfo;
  511. uni.getSystemInfo({ // 获取设备信息
  512. success: (res) => {
  513. systeminfo = res
  514. },
  515. })
  516. return systeminfo
  517. },
  518. getOptionFn(e){
  519. this.isShareType = e.type
  520. },
  521. discard(){
  522. //丢弃
  523. }
  524. },
  525. onPageScroll(e){//实时获取到滚动的值
  526. if(e.scrollTop>50){
  527. this.headerColor = true
  528. this.nvabarData={
  529. showCapsule: 1,
  530. title: '商品详情',
  531. }
  532. }else{
  533. this.headerColor = false
  534. this.nvabarData={
  535. showCapsule: 1,
  536. title: '',
  537. }
  538. }
  539. if(e.scrollTop>700){
  540. this.navbarFiexd = 'fixed'
  541. }else{
  542. this.navbarFiexd = 'none'
  543. }
  544. },
  545. onShareAppMessage(res){//分享转发
  546. if (res.from === 'button') {
  547. // 来自页面内转发按钮
  548. }
  549. return {
  550. title: `${this.product.name}`,
  551. path: `pages/goods/product?type=share&id=${this.productID}`,
  552. imageUrl:`${this.productImage[0]}`
  553. }
  554. },
  555. onShow() {
  556. this.$api.getStorage().then((resolve) => {
  557. this.userID = resolve.userID ? resolve.userID : '';
  558. this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 3
  559. if (isPreviewImg) {
  560. isPreviewImg = false;
  561. return;
  562. } else {
  563. this.initData();
  564. }
  565. }).catch(error =>{
  566. this.initData();
  567. })
  568. }
  569. }
  570. </script>
  571. <style lang="scss">
  572. page{
  573. background-color: #F7F7F7;
  574. }
  575. .banner-section{
  576. width: 100%;
  577. height: 750rpx;
  578. position: relative;
  579. border-bottom: 1px solid #EBEBEB;
  580. }
  581. .banner{
  582. width: 100%;
  583. height: 750rpx;
  584. image {
  585. width: 100%;
  586. height: 100%;
  587. }
  588. }
  589. .swiper__dots-box{
  590. position: absolute;
  591. bottom: 24px;
  592. right: 24rpx;
  593. /* #ifndef APP-NVUE */
  594. display: flex;
  595. /* #endif */
  596. flex: 1;
  597. flex-direction: row;
  598. justify-content: center;
  599. align-items: center;
  600. height: 12rpx;
  601. padding: 10rpx;
  602. background: rgba(174,174,174,0.6);
  603. border-radius:16rpx;
  604. .swiper__dots-item{
  605. width: 12rpx;
  606. height: 12rpx;
  607. border-radius: 100%;
  608. margin: 6rpx;
  609. background: rgba(62,62,62,1);
  610. }
  611. .none{
  612. background:#FFFFFF;
  613. }
  614. .swiper__dots-long{
  615. background: rgba(62,62,62,1);
  616. transition: all 0.1s;
  617. }
  618. }
  619. .product-wrap{
  620. width: 100%;
  621. height: auto;
  622. padding: 24rpx 0 0 0;
  623. background-color: #FFFFFF;
  624. border-bottom: 20rpx solid #F7F7F7;
  625. .wrap-top{
  626. width: 702rpx;
  627. padding: 0 24rpx;
  628. height: auto;
  629. float: left;
  630. padding-bottom: 24rpx;
  631. border-bottom: 1px solid #F8F8F8;
  632. &.none{
  633. .p-title{
  634. color:#999999
  635. }
  636. }
  637. .p-title{
  638. line-height: 40rpx;
  639. font-size: $font-size-28;
  640. color: $text-color;
  641. font-weight: Bold;
  642. -o-text-overflow: ellipsis;
  643. text-overflow: ellipsis;
  644. display: -webkit-box;
  645. word-break: break-all;
  646. -webkit-box-orient: vertical;
  647. -webkit-line-clamp: 2;
  648. overflow: hidden;
  649. margin-bottom: 16rpx;
  650. }
  651. .wrap-main-pricenone{
  652. line-height: 44rpx;
  653. color: #FF2A2A;
  654. font-size: $font-size-28;
  655. font-weight: 600;
  656. }
  657. .p-active{
  658. width: 130rpx;
  659. height: 44rpx;
  660. display: flex;
  661. align-items: center;
  662. flex-direction: row;
  663. float: left;
  664. .icon-active{
  665. width: 124rpx;
  666. height: 30rpx;
  667. display: block;
  668. }
  669. }
  670. .p-price{
  671. height: 44rpx;
  672. line-height: 44rpx;
  673. float: left;
  674. .txt{
  675. color: #FF2A2A;
  676. margin:0 2rpx;
  677. }
  678. .txt.sm{
  679. font-size: $font-size-24;
  680. }
  681. .txt.big{
  682. font-size: $font-size-32;
  683. }
  684. }
  685. .p-minBuy{
  686. height: 44rpx;
  687. line-height: 44rpx;
  688. float: right;
  689. padding: 0 18rpx;
  690. border-radius: 22rpx;
  691. background-color: #EBEBEB;
  692. color: #7F7F7F;
  693. font-size: 24rpx;
  694. text-align: center;
  695. .min-text{
  696. margin: 0 6rpx;
  697. }
  698. }
  699. .p-login{
  700. height: 44rpx;
  701. line-height: 44rpx;
  702. color: $color-system;
  703. font-size: $font-size-24;
  704. &.grade{
  705. margin-bottom: 20rpx;
  706. }
  707. .p-no{
  708. float: left;
  709. margin-right: 5rpx;
  710. font-size: $font-size-28;
  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:#FFBB77;
  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>