shop.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207
  1. <template>
  2. <view class="container">
  3. <scroll-view style="height: 100vh;" class="floor-list"
  4. :scroll-top="scrollTop" scroll-y="true" @scroll="scroll" @scrolltoupper="upper" @scrolltolower="lower"
  5. :refresher-enabled="false">
  6. <view class="carousel">
  7. <swiper indicator-dots circular=true duration="400">
  8. <swiper-item class="swiper-item" v-for="(item,index) in datalist.images" :key="index">
  9. <view class="image-wrapper">
  10. <image
  11. :src="pictureUrl+'/uploads/home/store/goods/'+item.goodsimage_url.substr(0, item.goodsimage_url.indexOf('\_')) + '/' + item.goodsimage_url"
  12. class="loaded"
  13. mode="aspectFill"
  14. ></image>
  15. </view>
  16. </swiper-item>
  17. </swiper>
  18. </view>
  19. <view class="introduce-section">
  20. <view class="titleLayout" >
  21. <view class="title">{{datalist.goods_name}}</view>
  22. <view @tap="shopDetail" style="display: flex;flex-direction: row;">
  23. <view class="titleRight">
  24. <view style="font-size: 36upx;color: #D9332E;text-align: right;">{{datalist.praise}}%</view>
  25. <view style="color: #606266;font-size: 28upx;">好评率</view>
  26. </view>
  27. <view style="display: flex;align-items: center;">
  28. <uni-icon size="18" type="arrowright"></uni-icon>
  29. </view>
  30. </view>
  31. </view>
  32. <view style="color: #909399;padding: 10upx 0 15upx 0;" v-if="datalist.points>0">购买得{{datalist.points}}圈币</view>
  33. <view class="titleLayout price-box">
  34. <view>
  35. <text class="price-tip">¥</text>
  36. <text class="price">{{datalist.goods_price}}</text>
  37. <text class="m-price">¥{{datalist.goods_marketprice}}</text>
  38. <text class="price-tip" v-if="datalist.goods_storage == 0">已下架</text>
  39. </view>
  40. <view>
  41. <text style="color: #909399">月销售{{datalist.sale_number}}</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="c-list">
  46. <view style="display: flex;justify-content: space-between;" class="c-row b-b" @click="toggleSpec">
  47. <view style="font-size: 32upx;color: #909399;">规则数量选择</view>
  48. <view>
  49. <uni-icon size="20" type="arrowright"></uni-icon>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 评价 -->
  54. <view @tap="shopDetail" style="border-bottom: 20rpx solid #F5F5F5;" class="eva-section">
  55. <view style="display: flex;justify-content: space-between;" class="c-row b-b">
  56. <view style="font-size: 32upx;color: #909399;">评价</view>
  57. <view>
  58. <uni-icon size="20" type="arrowright"></uni-icon>
  59. </view>
  60. </view>
  61. <assess />
  62. </view>
  63. <!-- :class="iScrolltop == 2?'activeColor' : ''" -->
  64. <view class="detail-desc" >
  65. <van-tabs v-model="active" @click="onChange">
  66. <van-tab :name="0" title="详情">
  67. <view style="padding: 0 32upx;">
  68. <rich-text :nodes="datalist.goods_body"></rich-text>
  69. </view>
  70. </van-tab>
  71. <van-tab :name="1" title="常见问题">
  72. <view style="padding: 0 32upx;">
  73. <rich-text :nodes="datalist.issue"></rich-text>
  74. </view>
  75. </van-tab>
  76. </van-tabs>
  77. </view>
  78. </scroll-view>
  79. <!-- 底部操作菜单 -->
  80. <!-- <view class="page-bottom">
  81. <navigator url="/pages/index/index" open-type="switchTab" class="p-b-btn">
  82. <text class="yticon icon-xiatubiao--copy"></text>
  83. <text>首页</text>
  84. </navigator>
  85. <navigator url="/pages/index/cart" open-type="navigate" class="p-b-btn">
  86. <text class="yticon icon-gouwuche"></text>
  87. <text>购物车</text>
  88. </navigator>
  89. <view class="p-b-btn" :class="{active: favorite}" @click="toFavorite">
  90. <text class="yticon icon-shoucang"></text>
  91. <text>收藏</text>
  92. </view>
  93. <view class="action-btn-group">
  94. <button type="primary" @click="openCar" class=" action-btn no-border add-cart-btn">加入购物车</button>
  95. <button type="primary" class=" action-btn no-border buy-now-btn" @click="buy">立即购买</button>
  96. </view>
  97. </view> -->
  98. <!-- 规格-模态层弹窗 -->
  99. <view
  100. class="popup spec"
  101. :class="specClass"
  102. @touchmove.stop.prevent="stopPrevent"
  103. @click="toggleSpec"
  104. >
  105. <!-- 遮罩层 -->
  106. <view class="mask"></view>
  107. <view class="layer attr-content" @click.stop="stopPrevent">
  108. <view class="a-t">
  109. <image :src="nuberImg==''?firstImg:nuberImg"></image>
  110. <view class="right">
  111. <text class="price" style="font-size: 36upx;color: #303133">¥{{totalprice==0?datalist.goods_price:totalprice}}</text>
  112. <view v-if="datalist.spec_list.length > 0 ">
  113. <view class="selected" v-if="chosename.length > 0 ">
  114. <text class="selected-text" v-for="(sItem, sIndex) in chosename" :key="sIndex">
  115. {{sItem.value_name}}
  116. </text>
  117. X {{shopnumber}}
  118. </view>
  119. <view class="selected" v-else>
  120. <text class="selected-text">
  121. 请选择规格数量
  122. </text>
  123. </view>
  124. </view>
  125. <view v-else>
  126. X {{shopnumber}}
  127. </view>
  128. </view>
  129. <view @click="closeCar" style="position: absolute;right: 10%;">
  130. <uni-icon size="20" type="close"></uni-icon>
  131. </view>
  132. </view>
  133. <view v-for="(item,index) in datalist.spec_list" :key="index" class="attr-list">
  134. <text>{{item.spec_name}}</text>
  135. <view class="item-list">
  136. <!-- v-if="childItem.pid === item.id" , disabled: childItem.goods_storage==0-->
  137. <text
  138. v-for="(childItem, childIndex) in item.value_list"
  139. :key="childIndex" class="tit"
  140. :class="{selected: childItem.selected, disabled: childItem.goods_storage==0}"
  141. @click="selectSpec(index, childItem.value_id, childItem, item,childItem.goods_storage)"
  142. >
  143. {{childItem.value_name}}
  144. </text>
  145. </view>
  146. </view>
  147. <!-- :max="goods_storage" -->
  148. <view class="numberchange">
  149. <span>数量</span>
  150. <uninumberbox :max="goods_storage" :min="1" @change="changestorage"/>
  151. </view>
  152. </view>
  153. </view>
  154. <!-- 分享 -->
  155. <!-- <share
  156. ref="share"
  157. :contentHeight="580"
  158. :shareList="shareList"
  159. ></share> -->
  160. <View class="page-bottom">
  161. <van-goods-action>
  162. <!-- <van-goods-action-icon @click="goIndex" icon="bag-o" /> -->
  163. <van-goods-action-icon @click="goIndex">
  164. <template slot="icon" style="width: 40upx;height: 40upx;">
  165. <image style="width: 100%;height: 100%;" src='/static/bottombtn0101.png'>
  166. </image>
  167. </template>
  168. </van-goods-action-icon>
  169. <van-goods-action-icon icon="cart-o" @click="openCar" :info="cartnumber" />
  170. <van-goods-action-icon icon="star-o" v-if="has_collected == 0" @click="toFavorite"/>
  171. <van-goods-action-icon icon="star" v-if="has_collected == 1" icon-class="colored" @click="toFavorite"/>
  172. <van-goods-action-button @click="addCar" text="加入购物车" type="warning" />
  173. <van-goods-action-button text="立即购买" @click="buynow" />
  174. </van-goods-action>
  175. </View>
  176. <Gobacktop @getop="getop" :bottomtop="2" v-if="isTop" />
  177. </view>
  178. </template>
  179. <script>
  180. import {
  181. mapMutations,mapState
  182. } from 'vuex'
  183. // import logionDialog from '@/component/loginDialog.vue'
  184. import Gobacktop from '@/component/Gobacktop.vue'
  185. import uninumberbox from '@/component/uinNumber.vue'
  186. import assess from '@/component/assess.vue' // 评价列表
  187. import uniIcon from '@/component/uni-icon/uni-icon.vue'
  188. export default{
  189. components: {
  190. uniIcon,
  191. assess,
  192. uninumberbox,
  193. Gobacktop
  194. },
  195. data() {
  196. return {
  197. isTop: false,
  198. chosename: [],
  199. arrayId:[],
  200. bottomtop: '55upx',
  201. scopemapId: 0,
  202. showdialog: false,
  203. has_collected: false, // 是否收藏
  204. cartnumber: 0, // 购物车数量
  205. changnumber: 100,
  206. ismax: false, // 输入狂禁止数量
  207. goods_storage: '', // 规格商品参数
  208. nuberImg:'',
  209. firstImg:'',
  210. shopnumber: 1,
  211. pictureUrl: this.pictureUrl,
  212. datalist: {},
  213. store_id: 0, // 酒店id
  214. goodId: 0, // 商品公共id
  215. goods_id: 0, // 商品规格id
  216. windowHeight: 0, // 窗口高度
  217. iScrolltop: 1,
  218. active: 0,
  219. scrollTop: 0,
  220. old: {
  221. scrollTop: 0
  222. },
  223. specClass: 'none',
  224. specSelected:[],
  225. totalprice:0,
  226. firstprice: 0,
  227. favorite: true,
  228. shareList: [],
  229. imgList: [
  230. ],
  231. desc: `
  232. `,
  233. specList: [
  234. ]
  235. };
  236. },
  237. onLaunch: function(){
  238. this.active = 1;
  239. },
  240. computed:{
  241. ...mapState([
  242. 'hasLogin',
  243. 'userInfo',
  244. 'successlogion'
  245. ]),
  246. },
  247. onShow: function() {
  248. let _this = this;
  249. uni.getSystemInfo({
  250. success: function (res) {
  251. _this.windowHeight = res.screenHeight;
  252. // console.log("屏幕宽度:"+res.screenWidth);
  253. // console.log("屏幕高度:"+res.screenHeight);
  254. // console.log("可使用窗口宽度:"+res.windowWidth);
  255. // console.log("可使用窗口高度:"+res.windowHeight);
  256. }
  257. });
  258. },
  259. async onLoad(options){
  260. this.goodId = options.id; // 商品Id
  261. this.store_id = options.store_id;
  262. this.getshopdetail(); // 获取商品详情
  263. //规格 默认选中第一条
  264. // this.datalist.spec_list[0].value_list.forEach(item=>{
  265. // for(let cItem of this.specChildList){
  266. // if(cItem.pid === item.id){
  267. // this.$set(cItem, 'selected', true);
  268. // this.specSelected.push(cItem);
  269. // break; //forEach不能使用break
  270. // }
  271. // }
  272. // })
  273. //this.shareList = await this.$api.json('shareList');
  274. },
  275. onShareAppMessage(res) {
  276. uni.showShareMenu({
  277. withShareTicket: true
  278. });
  279. let that = this;
  280. let id = this.goodId; // 商品Id
  281. let store_id = this.store_id;
  282. if (res.from === 'button') {
  283. // 来自页面内分享按钮
  284. }
  285. return {
  286. title: that.datalist.goods_name,
  287. path: `/pages/index/shop?id=${id}&store_id=${store_id}`,
  288. imageUrl:that.nuberImg
  289. }
  290. },
  291. onReady: function() {
  292. },
  293. methods:{
  294. getop() {
  295. this.scrollTop = this.old.scrollTop
  296. this.$nextTick(function(){
  297. this.scrollTop=0;
  298. });
  299. this.isTop = false;
  300. },
  301. // 跳转到首页
  302. goIndex() {
  303. let id = this.store_id;
  304. uni.redirectTo({
  305. url: `/pages/index/hotel?id=${id}`
  306. })
  307. // uni.switchTab({
  308. // url:'./index'
  309. // })
  310. // uni.navigateBack();
  311. },
  312. // 更改商品数量
  313. changestorage(e) {
  314. console.log(e)
  315. console.log(this.goods_storage);
  316. if(e == this.goods_storage) {
  317. this.$msg("您选择的数量已超过最大库存数");
  318. return;
  319. }
  320. this.shopnumber = e;
  321. let firstprice = this.firstprice;
  322. this.totalprice = firstprice*this.shopnumber;
  323. },
  324. // 获取商品详情
  325. getshopdetail() {
  326. let params = {};
  327. params.goods_commonid =this.goodId;
  328. params.store_id = this.store_id;
  329. this.request({
  330. url:'/v2/goods/detail',
  331. method:'POST',
  332. data: params,
  333. success: (res)=> {
  334. let { data } = res.data;
  335. this.cartnumber = data.cart;
  336. this.has_collected = data.has_collected;
  337. let array = data;
  338. array.images.forEach(item => {
  339. this.firstImg = this.pictureUrl+'/uploads/home/store/goods/'+item.goodsimage_url.substr(0, item.goodsimage_url.indexOf('\_')) + '/' + item.goodsimage_url
  340. })
  341. if(array.spec_list.length == 0) {
  342. this.datalist = data;
  343. this.goods_id = data.goods_list[0].goods_id;
  344. this.goods_storage = data.goods_storage;
  345. //this.specSelected = data.goods_list;
  346. }else {
  347. array.spec_list[0].value_list.forEach( (item,idx) => {
  348. item.goods_storage = data.goods_list[idx].goods_storage;
  349. })
  350. this.datalist = array;
  351. }
  352. const regex1 = new RegExp('stlye="" ', 'gi');
  353. this.datalist.goods_body = this.datalist.goods_body.replace(/\(<img\)/ig, '');
  354. const regex = new RegExp('<img', 'gi');
  355. this.datalist.goods_body = this.datalist.goods_body.replace(regex,
  356. `<img class="changeimg"`);
  357. }
  358. })
  359. },
  360. shopDetail() {
  361. // url: `/pages/index/shop?id=${id}&store_id=${store_id}`
  362. let goodId = this.goodId; // 商品Id
  363. let store_id = this.store_id;
  364. uni.navigateTo({
  365. url: `/pages/index/commemt?goodId=${goodId}&store_id=${store_id}`
  366. });
  367. },
  368. onChange(event) {
  369. this.active = event.detail.name;
  370. console.log(this.active)
  371. },
  372. //规格弹窗开关
  373. toggleSpec() {
  374. this.specClass = 'show';
  375. //this.specSelected = [];
  376. // if(this.specClass === 'show'){
  377. // this.specClass = 'hide';
  378. // setTimeout(() => {
  379. // this.specClass = 'none';
  380. // }, 250);
  381. // }else if(this.specClass === 'none'){
  382. // this.specClass = 'show';
  383. // }
  384. },
  385. // 关闭弹窗
  386. // cancelDiaolog() {
  387. // this.showdialog = false;
  388. // },
  389. // // 确定
  390. // confirmDiaolog() {
  391. // this.showdialog = false;
  392. // uni.navigateTo({
  393. // url: '../myCenter/information' // 我的收藏
  394. // })
  395. // },
  396. openCar() {
  397. if(this.hasLogin && this.successlogion) {
  398. let store_id = this.store_id;
  399. uni.navigateTo({
  400. url:`/pages/index/cart?store_id=${store_id}`
  401. })
  402. }else {
  403. //this.showdialog = true;
  404. uni.navigateTo({
  405. url:'/pages/myCenter/logion'
  406. })
  407. }
  408. },
  409. // 立即购买
  410. buynow() {
  411. if(this.hasLogin && this.successlogion) {
  412. if(this.datalist.store_id == 1 || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
  413. this.$msg("商品已下架");
  414. return;
  415. }
  416. if(this.specSelected.length == 0&&this.datalist.spec_list.length != 0 ) {
  417. this.$msg("请选择规格数量");
  418. this.specClass = 'show';
  419. return;
  420. }
  421. if(this.specSelected.length == 0&&this.datalist.spec_list.length == 0) {
  422. this.specClass = 'show';
  423. this.specSelected = this.datalist.goods_list;
  424. return;
  425. }
  426. let goods = [];
  427. goods.push({});
  428. goods[0].goods_id = this.goods_id;
  429. goods[0].buy_num = this.shopnumber;
  430. this.request({
  431. url:'/v1/order/save_og',
  432. method: 'post',
  433. data: {
  434. store_id: this.store_id,
  435. goods: JSON.stringify(goods)
  436. },
  437. success:(res) => {
  438. let store = this.store_id;
  439. let order_id = res.data.data.order_id;
  440. this.specClass = 'none';
  441. uni.navigateTo({
  442. url: `/pages/index/sureBuy?store=${store}&order_id=${order_id}`
  443. });
  444. }
  445. })
  446. }else {
  447. uni.navigateTo({
  448. url:'/pages/myCenter/logion'
  449. })
  450. }
  451. },
  452. // 加入购物车
  453. addCar() {
  454. if(this.hasLogin && this.successlogion) {
  455. if(this.datalist.store_id == 1 || this.datalist.goods_state != 1 || this.datalist.goods_storage < 1) {
  456. this.$msg("商品已下架");
  457. return;
  458. }
  459. if(this.specSelected.length == 0&&this.datalist.spec_list.length == 0) {
  460. this.specClass = 'show';
  461. this.specSelected = this.datalist.goods_list;
  462. return;
  463. }
  464. if(this.chosename.length == 0) {
  465. this.specClass = 'show';
  466. return;
  467. }
  468. if(this.specSelected.length == 0&&this.datalist.spec_list.length != 0 ) {
  469. this.specClass = 'show';
  470. this.$msg("请选择规格数量");
  471. return;
  472. }else {
  473. this.request({
  474. url:'/v2/order/add_cart',
  475. method:'POST',
  476. data: {
  477. goods_id: this.goods_id,
  478. goods_num: this.shopnumber
  479. },
  480. success: () => {
  481. this.$msg("商品添加成功");
  482. this.specClass = 'none';
  483. this.getshopdetail();
  484. }
  485. })
  486. }
  487. }else {
  488. uni.navigateTo({
  489. url:'/pages/myCenter/logion'
  490. })
  491. }
  492. },
  493. closeCar() {
  494. this.specClass = 'none';
  495. },
  496. //选择规格
  497. selectSpec(index, pid,chose,first,goods_storage){
  498. if(goods_storage == 0) {
  499. this.$msg("商品没库存啦");
  500. return;
  501. }
  502. let obj = {};
  503. obj.spec_id = first.spec_id;
  504. obj.value_name = chose.value_name;
  505. if(this.datalist.spec_list.length == this.chosename.length) {
  506. }else {
  507. this.chosename.push(obj);
  508. }
  509. this.specSelected = [];
  510. let list = this.datalist.spec_list[index].value_list;
  511. this.datalist.spec_list[index].value_list.forEach(item=>{
  512. if(item.value_id === pid){
  513. this.$set(item, 'selected', true);
  514. }else {
  515. this.$set(item, 'selected', false);
  516. }
  517. })
  518. this.chosename.forEach(items => {
  519. if(items.spec_id == first.spec_id) {
  520. items.value_name = chose.value_name
  521. };
  522. })
  523. let array = [];
  524. for(let i = 0; i < this.datalist.spec_list.length; i++) {
  525. for(let j = 0; j<this.datalist.spec_list[i].value_list.length;j++) {
  526. if(this.datalist.spec_list[i].value_list[j].selected) {
  527. array.push(this.datalist.spec_list[i].value_list[j].value_id);
  528. }
  529. }
  530. }
  531. this.arrayId = array;
  532. if(this.arrayId.length == this.datalist.spec_list.length) {
  533. this.scopemapId = array.join("_");
  534. let goodId = this.datalist.spec_map[this.scopemapId]; //
  535. let items = this.datalist.goods_list[goodId]
  536. items.value_name = chose.value_name;
  537. this.nuberImg = items.spec_img;
  538. this.specSelected.push(items)
  539. this.goods_storage = items.goods_storage;
  540. this.goods_id = items.goods_id;
  541. this.firstprice = items.goods_price;
  542. this.totalprice = items.goods_price*this.shopnumber;
  543. }
  544. // if(this.arrayId.length == this.datalist.spec_list.length) {
  545. // }
  546. // let obj = {};
  547. // obj.firstId = index;
  548. // obj.pid = pid;
  549. // this.arrayId.push(obj);
  550. // console.log(this.arrayId)
  551. // let arr = this.arrayId;
  552. // for(var i=0; i<arr.length; i++){
  553. // for(var j=i+1; j<arr.length; j++){
  554. // if(arr[i].firstId==arr[j].firstId){
  555. // arr.splice(j,1);
  556. // j--;
  557. // }
  558. // }
  559. // }
  560. // let newarray = []
  561. // arr.forEach(item => {
  562. // newarray.push(item.pid);
  563. // })
  564. // this.arrayId = arr;
  565. // if(this.arrayId.length == 0) {
  566. // this.scopemapId = newarray.toString(); ;
  567. // }else {
  568. // this.scopemapId = newarray.join("_");
  569. // }
  570. // console.log(this.scopemapId);
  571. //this.datalist.spec_list[index].value_list = list;
  572. },
  573. // 滚动到顶部
  574. upper(e) {
  575. },
  576. // 滚到底部
  577. lower(e) {
  578. console.log("底部")
  579. },
  580. // 滚动时触发
  581. scroll(e) {
  582. this.old.scrollTop = e.detail.scrollTop
  583. if(e.detail.scrollTop > this.windowHeight) {
  584. this.iScrolltop = 2;
  585. }else {
  586. this.iScrolltop = 1;
  587. }
  588. if(e.detail.scrollTop > 400) {
  589. this.isTop = true;
  590. }else{ //当距离小于500时显示回到顶部按钮
  591. this.isTop = false;
  592. }
  593. },
  594. //收藏
  595. toFavorite(){
  596. if(this.hasLogin && this.successlogion) {
  597. this.request({
  598. url: '/v1/favorites/collect',
  599. method: 'post',
  600. data: {
  601. type:'goods',
  602. fav_id: this.goodId
  603. },
  604. success: () => {
  605. this.getshopdetail()
  606. }
  607. })
  608. }else {
  609. uni.navigateTo({
  610. url:'/pages/myCenter/logion'
  611. })
  612. }
  613. //this.favorite = !this.favorite;
  614. },
  615. buy(){
  616. uni.navigateTo({
  617. url: './sureBuy'
  618. })
  619. },
  620. stopPrevent(){}
  621. },
  622. }
  623. </script>
  624. <style lang='scss'>
  625. page{
  626. /* background: $page-color-base; */
  627. /* padding-bottom: 160upx; */
  628. position: relative;
  629. }
  630. .icon-you{
  631. font-size: 28upx + 2upx;
  632. color: #888;
  633. }
  634. .carousel {
  635. height: 722upx;
  636. position:relative;
  637. swiper{
  638. height: 100%;
  639. }
  640. .image-wrapper{
  641. width: 100%;
  642. height: 100%;
  643. }
  644. .swiper-item {
  645. display: flex;
  646. justify-content: center;
  647. align-content: center;
  648. height: 750upx;
  649. overflow: hidden;
  650. image {
  651. width: 100%;
  652. height: 100%;
  653. }
  654. }
  655. }
  656. .titleLayout {
  657. display: flex;
  658. justify-content: space-between;
  659. padding-bottom: 20upx;
  660. }
  661. /* 标题简介 */
  662. .introduce-section{
  663. background: #fff;
  664. padding: 20upx 30upx;
  665. .title{
  666. font-size: 36upx;
  667. color: #303133;
  668. height: 50upx;
  669. line-height: 50upx;
  670. width: 70%;
  671. white-space:nowrap;
  672. overflow:hidden;
  673. text-overflow:ellipsis;
  674. }
  675. .titleRight {
  676. border-left: 1px solid #F5F5F5;
  677. padding-left: 32upx;
  678. }
  679. .price-box{
  680. display:flex;
  681. align-items:baseline;
  682. height: 64upx;
  683. padding: 10upx 0;
  684. font-size: 26upx;
  685. color:#fa436a;
  686. }
  687. .price{
  688. font-size: $font-lg + 2upx;
  689. }
  690. .m-price{
  691. margin:0 12upx;
  692. color: #909399;
  693. text-decoration: line-through;
  694. }
  695. .coupon-tip{
  696. align-items: center;
  697. padding: 4upx 10upx;
  698. background: #fa436a;
  699. font-size: 24upx;
  700. color: #fff;
  701. border-radius: 6upx;
  702. line-height: 1;
  703. transform: translateY(-4upx);
  704. }
  705. .bot-row{
  706. display:flex;
  707. align-items:center;
  708. height: 50upx;
  709. font-size: 24upx;
  710. color: #909399;
  711. text{
  712. flex: 1;
  713. }
  714. }
  715. }
  716. /* 分享 */
  717. .share-section{
  718. display:flex;
  719. align-items:center;
  720. color: #606266;
  721. background: linear-gradient(left, #fdf5f6, #fbebf6);
  722. padding: 12upx 30upx;
  723. .share-icon{
  724. display:flex;
  725. align-items:center;
  726. width: 70upx;
  727. height: 30upx;
  728. line-height: 1;
  729. border: 1px solid #fa436a;
  730. border-radius: 4upx;
  731. position:relative;
  732. overflow: hidden;
  733. font-size: 22upx;
  734. color: #fa436a;
  735. &:after{
  736. content: '';
  737. width: 50upx;
  738. height: 50upx;
  739. border-radius: 50%;
  740. left: -20upx;
  741. top: -12upx;
  742. position:absolute;
  743. background: #fa436a;
  744. }
  745. }
  746. .icon-xingxing{
  747. position:relative;
  748. z-index: 1;
  749. font-size: 24upx;
  750. margin-left: 2upx;
  751. margin-right: 10upx;
  752. color: #fff;
  753. line-height: 1;
  754. }
  755. .tit{
  756. font-size: 28upx;
  757. margin-left:10upx;
  758. }
  759. .icon-bangzhu1{
  760. padding: 10upx;
  761. font-size: 30upx;
  762. line-height: 1;
  763. }
  764. .share-btn{
  765. flex: 1;
  766. text-align:right;
  767. font-size: 24upx;
  768. color: #fa436a;
  769. }
  770. .icon-you{
  771. font-size: 24upx;
  772. margin-left: 4upx;
  773. color: #fa436a;
  774. }
  775. }
  776. .c-list{
  777. font-size: 24upx + 2upx;
  778. color: #606266;
  779. background: #fff;
  780. border-top: 20upx solid #F5F5F5;
  781. border-bottom: 20upx solid #F5F5F5;
  782. .c-row{
  783. display:flex;
  784. align-items:center;
  785. padding: 20upx 30upx;
  786. position:relative;
  787. }
  788. .tit{
  789. width: 140upx;
  790. }
  791. .con{
  792. flex: 1;
  793. color: #303133;
  794. .selected-text{
  795. margin-right: 10upx;
  796. }
  797. }
  798. .bz-list{
  799. height: 40upx;
  800. font-size: 24upx+2upx;
  801. color: #303133;
  802. text{
  803. display: inline-block;
  804. margin-right: 30upx;
  805. }
  806. }
  807. .con-list{
  808. flex: 1;
  809. display:flex;
  810. flex-direction: column;
  811. color: #303133;
  812. line-height: 40upx;
  813. }
  814. .red{
  815. color: #fa436a;
  816. }
  817. }
  818. /* 评价 */
  819. .eva-section{
  820. display: flex;
  821. flex-direction: column;
  822. padding: 20upx 30upx;
  823. background: #fff;
  824. margin-top: 16upx;
  825. .e-header{
  826. display: flex;
  827. align-items: center;
  828. height: 70upx;
  829. font-size: 24upx + 2upx;
  830. color: #909399;
  831. .tit{
  832. font-size: 28upx + 2upx;
  833. color: #303133;
  834. margin-right: 4upx;
  835. }
  836. .tip{
  837. flex: 1;
  838. text-align: right;
  839. }
  840. .icon-you{
  841. margin-left: 10upx;
  842. }
  843. }
  844. }
  845. .eva-box{
  846. display: flex;
  847. padding: 20upx 0;
  848. .portrait{
  849. flex-shrink: 0;
  850. width: 80upx;
  851. height: 80upx;
  852. border-radius: 100px;
  853. }
  854. .right{
  855. flex: 1;
  856. display: flex;
  857. flex-direction: column;
  858. font-size: 28upx;
  859. color: #606266;
  860. padding-left: 26upx;
  861. .con{
  862. font-size: 28upx;
  863. color: #303133;
  864. padding: 20upx 0;
  865. }
  866. .bot{
  867. display: flex;
  868. justify-content: space-between;
  869. font-size: 24upx;
  870. color:#909399;
  871. }
  872. }
  873. }
  874. /* 详情 */
  875. .detail-desc{
  876. background: #fff;
  877. margin-top: 16upx;
  878. margin-bottom: 135rpx;
  879. width: 100%;
  880. .d-header{
  881. display: flex;
  882. justify-content: center;
  883. align-items: center;
  884. height: 80upx;
  885. font-size: 28upx + 2upx;
  886. color: #303133;
  887. position: relative;
  888. text{
  889. padding: 0 20upx;
  890. background: #fff;
  891. position: relative;
  892. z-index: 1;
  893. }
  894. &:after{
  895. position: absolute;
  896. left: 50%;
  897. top: 50%;
  898. transform: translateX(-50%);
  899. width: 300upx;
  900. height: 0;
  901. content: '';
  902. border-bottom: 1px solid #ccc;
  903. }
  904. }
  905. }
  906. /* 规格选择弹窗 */
  907. .attr-content{
  908. padding: 10upx 30upx;
  909. .a-t{
  910. display: flex;
  911. image{
  912. width: 170upx;
  913. height: 170upx;
  914. flex-shrink: 0;
  915. margin-top: -40upx;
  916. border-radius: 8upx;;
  917. }
  918. .right{
  919. display: flex;
  920. flex-direction: column;
  921. padding-left: 24upx;
  922. font-size: 24upx + 2upx;
  923. color: #606266;
  924. line-height: 42upx;
  925. justify-content: space-around;
  926. .price{
  927. font-size: $font-lg;
  928. color: #fa436a;
  929. margin-bottom: 10upx;
  930. }
  931. .selected-text{
  932. margin-right: 10upx;
  933. }
  934. }
  935. }
  936. .attr-list{
  937. display: flex;
  938. flex-direction: column;
  939. font-size: 28upx + 2upx;
  940. color: #606266;
  941. padding-top: 30upx;
  942. padding-left: 10upx;
  943. }
  944. .item-list{
  945. padding: 20upx 0 0;
  946. display: flex;
  947. flex-wrap: wrap;
  948. text{
  949. display: flex;
  950. align-items: center;
  951. justify-content: center;
  952. background: #eee;
  953. margin-right: 20upx;
  954. margin-bottom: 20upx;
  955. border-radius: 100upx;
  956. min-width: 60upx;
  957. height: 60upx;
  958. padding: 0 20upx;
  959. font-size: 28upx;
  960. color: #303133;
  961. }
  962. .selected{
  963. background: #fbebee;
  964. color: #fa436a;
  965. }
  966. .disabled {
  967. color:#999;
  968. background: rgba(245,245,245, 0.5);
  969. }
  970. }
  971. }
  972. /* 弹出层 */
  973. .popup {
  974. position: fixed;
  975. left: 0;
  976. top: 0;
  977. right: 0;
  978. bottom: 100upx;
  979. z-index: 99;
  980. &.show {
  981. display: block;
  982. .mask{
  983. animation: showPopup 0.2s linear both;
  984. }
  985. .layer {
  986. animation: showLayer 0.2s linear both;
  987. }
  988. }
  989. &.hide {
  990. .mask{
  991. animation: hidePopup 0.2s linear both;
  992. }
  993. .layer {
  994. animation: hideLayer 0.2s linear both;
  995. }
  996. }
  997. &.none {
  998. display: none;
  999. }
  1000. .mask{
  1001. position: fixed;
  1002. top: 0;
  1003. width: 100%;
  1004. height: 90%;
  1005. z-index: 1;
  1006. background-color: rgba(0, 0, 0, 0.4);
  1007. }
  1008. .layer {
  1009. position: fixed;
  1010. z-index: 99;
  1011. bottom: 100upx;
  1012. width: 100%;
  1013. min-height: 40vh;
  1014. border-radius: 10upx 10upx 0 0;
  1015. background-color: #fff;
  1016. .btn{
  1017. height: 66upx;
  1018. line-height: 66upx;
  1019. border-radius: 100upx;
  1020. background: #fa436a;
  1021. font-size: 28upx + 2upx;
  1022. color: #fff;
  1023. margin: 30upx auto 20upx;
  1024. }
  1025. }
  1026. @keyframes showPopup {
  1027. 0% {
  1028. opacity: 0;
  1029. }
  1030. 100% {
  1031. opacity: 1;
  1032. }
  1033. }
  1034. @keyframes hidePopup {
  1035. 0% {
  1036. opacity: 1;
  1037. }
  1038. 90% {
  1039. opacity: 0;
  1040. }
  1041. }
  1042. @keyframes showLayer {
  1043. 0% {
  1044. transform: translateY(120%);
  1045. }
  1046. 100% {
  1047. transform: translateY(0%);
  1048. }
  1049. }
  1050. @keyframes hideLayer {
  1051. 0% {
  1052. transform: translateY(0);
  1053. }
  1054. 100% {
  1055. transform: translateY(120%);
  1056. }
  1057. }
  1058. }
  1059. .colored {
  1060. color: red;
  1061. }
  1062. .van-sticky {
  1063. /* z-index: 0!important; */
  1064. }
  1065. /* 详情固定 */
  1066. .activeColor {
  1067. /* background: #fff!important; */
  1068. position: fixed;
  1069. background-color: #fff;
  1070. top: 0upx;
  1071. z-index: 99;
  1072. margin-top: 0;
  1073. }
  1074. .numberchange {
  1075. padding-top: 48px;
  1076. overflow: hidden;
  1077. clear: both;
  1078. padding-right: 59rpx;
  1079. }
  1080. .uni-numbox {
  1081. float: right;
  1082. }
  1083. /* 底部操作菜单 */
  1084. .page-bottom{
  1085. position: fixed;
  1086. left: 0;
  1087. bottom: 0;
  1088. display: flex;
  1089. justify-content: center;
  1090. align-items: center;
  1091. width: 100vw;
  1092. height: 100upx;
  1093. z-index: 99;
  1094. background: rgba(255,255,255,.9);
  1095. .p-b-btn{
  1096. display:flex;
  1097. flex-direction: column;
  1098. align-items: center;
  1099. justify-content: center;
  1100. font-size: 24upx;
  1101. color: #606266;
  1102. width: 96upx;
  1103. height: 80upx;
  1104. .yticon{
  1105. font-size: 40upx;
  1106. line-height: 48upx;
  1107. color: #909399;
  1108. }
  1109. &.active, &.active .yticon{
  1110. color: #fa436a;
  1111. }
  1112. .icon-fenxiang2{
  1113. font-size: 42upx;
  1114. transform: translateY(-2upx);
  1115. }
  1116. .icon-shoucang{
  1117. font-size: 46upx;
  1118. }
  1119. }
  1120. .action-btn-group{
  1121. display: flex;
  1122. height: 76upx;
  1123. border-radius: 100px;
  1124. overflow: hidden;
  1125. box-shadow: 0 20upx 40upx -16upx #fa436a;
  1126. box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  1127. background: linear-gradient(to right, #ffac30,#fa436a,#F56C6C);
  1128. margin-left: 20upx;
  1129. position:relative;
  1130. &:after{
  1131. content: '';
  1132. position:absolute;
  1133. top: 50%;
  1134. right: 50%;
  1135. transform: translateY(-50%);
  1136. height: 28upx;
  1137. width: 0;
  1138. border-right: 1px solid rgba(255,255,255,.5);
  1139. }
  1140. .action-btn{
  1141. display:flex;
  1142. align-items: center;
  1143. justify-content: center;
  1144. width: 180upx;
  1145. height: 100%;
  1146. font-size: 28upx ;
  1147. padding: 0;
  1148. border-radius: 0;
  1149. background: transparent;
  1150. }
  1151. }
  1152. }
  1153. .changeimg {
  1154. width: 100%;
  1155. height: auto!important;
  1156. display: block;
  1157. text-align: center;
  1158. }
  1159. </style>