product.vue 34 KB

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