product.vue 34 KB

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