shop.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204
  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.specSelected.length == 0&&this.datalist.spec_list.length != 0) {
  465. this.specClass = 'show';
  466. this.$msg("请选择规格数量");
  467. return;
  468. }else {
  469. this.request({
  470. url:'/v2/order/add_cart',
  471. method:'POST',
  472. data: {
  473. goods_id: this.goods_id,
  474. goods_num: this.shopnumber
  475. },
  476. success: () => {
  477. this.$msg("商品添加成功");
  478. this.specClass = 'none';
  479. this.getshopdetail();
  480. }
  481. })
  482. }
  483. }else {
  484. uni.navigateTo({
  485. url:'/pages/myCenter/logion'
  486. })
  487. }
  488. },
  489. closeCar() {
  490. this.specClass = 'none';
  491. },
  492. //选择规格
  493. selectSpec(index, pid,chose,first,goods_storage){
  494. if(goods_storage == 0) {
  495. this.$msg("商品没库存啦");
  496. return;
  497. }
  498. let obj = {};
  499. obj.spec_id = first.spec_id;
  500. obj.value_name = chose.value_name;
  501. if(this.datalist.spec_list.length == this.chosename.length) {
  502. }else {
  503. this.chosename.push(obj);
  504. }
  505. this.specSelected = [];
  506. let list = this.datalist.spec_list[index].value_list;
  507. this.datalist.spec_list[index].value_list.forEach(item=>{
  508. if(item.value_id === pid){
  509. this.$set(item, 'selected', true);
  510. }else {
  511. this.$set(item, 'selected', false);
  512. }
  513. })
  514. this.chosename.forEach(items => {
  515. if(items.spec_id == first.spec_id) {
  516. items.value_name = chose.value_name
  517. };
  518. })
  519. let array = [];
  520. for(let i = 0; i < this.datalist.spec_list.length; i++) {
  521. for(let j = 0; j<this.datalist.spec_list[i].value_list.length;j++) {
  522. if(this.datalist.spec_list[i].value_list[j].selected) {
  523. array.push(this.datalist.spec_list[i].value_list[j].value_id);
  524. }
  525. }
  526. }
  527. this.arrayId = array;
  528. if(this.arrayId.length == this.datalist.spec_list.length) {
  529. this.scopemapId = array.join("_");
  530. let goodId = this.datalist.spec_map[this.scopemapId]; //
  531. let items = this.datalist.goods_list[goodId]
  532. items.value_name = chose.value_name;
  533. this.nuberImg = items.spec_img;
  534. this.specSelected.push(items)
  535. this.goods_storage = items.goods_storage;
  536. this.goods_id = items.goods_id;
  537. this.firstprice = items.goods_price;
  538. this.totalprice = items.goods_price*this.shopnumber;
  539. }
  540. console.log(this.specSelected);
  541. // if(this.arrayId.length == this.datalist.spec_list.length) {
  542. // }
  543. // let obj = {};
  544. // obj.firstId = index;
  545. // obj.pid = pid;
  546. // this.arrayId.push(obj);
  547. // console.log(this.arrayId)
  548. // let arr = this.arrayId;
  549. // for(var i=0; i<arr.length; i++){
  550. // for(var j=i+1; j<arr.length; j++){
  551. // if(arr[i].firstId==arr[j].firstId){
  552. // arr.splice(j,1);
  553. // j--;
  554. // }
  555. // }
  556. // }
  557. // let newarray = []
  558. // arr.forEach(item => {
  559. // newarray.push(item.pid);
  560. // })
  561. // this.arrayId = arr;
  562. // if(this.arrayId.length == 0) {
  563. // this.scopemapId = newarray.toString(); ;
  564. // }else {
  565. // this.scopemapId = newarray.join("_");
  566. // }
  567. // console.log(this.scopemapId);
  568. //this.datalist.spec_list[index].value_list = list;
  569. },
  570. // 滚动到顶部
  571. upper(e) {
  572. },
  573. // 滚到底部
  574. lower(e) {
  575. console.log("底部")
  576. },
  577. // 滚动时触发
  578. scroll(e) {
  579. this.old.scrollTop = e.detail.scrollTop
  580. if(e.detail.scrollTop > this.windowHeight) {
  581. this.iScrolltop = 2;
  582. }else {
  583. this.iScrolltop = 1;
  584. }
  585. if(e.detail.scrollTop > 400) {
  586. this.isTop = true;
  587. }else{ //当距离小于500时显示回到顶部按钮
  588. this.isTop = false;
  589. }
  590. },
  591. //收藏
  592. toFavorite(){
  593. if(this.hasLogin && this.successlogion) {
  594. this.request({
  595. url: '/v1/favorites/collect',
  596. method: 'post',
  597. data: {
  598. type:'goods',
  599. fav_id: this.goodId
  600. },
  601. success: () => {
  602. this.getshopdetail()
  603. }
  604. })
  605. }else {
  606. uni.navigateTo({
  607. url:'/pages/myCenter/logion'
  608. })
  609. }
  610. //this.favorite = !this.favorite;
  611. },
  612. buy(){
  613. uni.navigateTo({
  614. url: './sureBuy'
  615. })
  616. },
  617. stopPrevent(){}
  618. },
  619. }
  620. </script>
  621. <style lang='scss'>
  622. page{
  623. /* background: $page-color-base; */
  624. /* padding-bottom: 160upx; */
  625. position: relative;
  626. }
  627. .icon-you{
  628. font-size: 28upx + 2upx;
  629. color: #888;
  630. }
  631. .carousel {
  632. height: 722upx;
  633. position:relative;
  634. swiper{
  635. height: 100%;
  636. }
  637. .image-wrapper{
  638. width: 100%;
  639. height: 100%;
  640. }
  641. .swiper-item {
  642. display: flex;
  643. justify-content: center;
  644. align-content: center;
  645. height: 750upx;
  646. overflow: hidden;
  647. image {
  648. width: 100%;
  649. height: 100%;
  650. }
  651. }
  652. }
  653. .titleLayout {
  654. display: flex;
  655. justify-content: space-between;
  656. padding-bottom: 20upx;
  657. }
  658. /* 标题简介 */
  659. .introduce-section{
  660. background: #fff;
  661. padding: 20upx 30upx;
  662. .title{
  663. font-size: 36upx;
  664. color: #303133;
  665. height: 50upx;
  666. line-height: 50upx;
  667. width: 70%;
  668. white-space:nowrap;
  669. overflow:hidden;
  670. text-overflow:ellipsis;
  671. }
  672. .titleRight {
  673. border-left: 1px solid #F5F5F5;
  674. padding-left: 32upx;
  675. }
  676. .price-box{
  677. display:flex;
  678. align-items:baseline;
  679. height: 64upx;
  680. padding: 10upx 0;
  681. font-size: 26upx;
  682. color:#fa436a;
  683. }
  684. .price{
  685. font-size: $font-lg + 2upx;
  686. }
  687. .m-price{
  688. margin:0 12upx;
  689. color: #909399;
  690. text-decoration: line-through;
  691. }
  692. .coupon-tip{
  693. align-items: center;
  694. padding: 4upx 10upx;
  695. background: #fa436a;
  696. font-size: 24upx;
  697. color: #fff;
  698. border-radius: 6upx;
  699. line-height: 1;
  700. transform: translateY(-4upx);
  701. }
  702. .bot-row{
  703. display:flex;
  704. align-items:center;
  705. height: 50upx;
  706. font-size: 24upx;
  707. color: #909399;
  708. text{
  709. flex: 1;
  710. }
  711. }
  712. }
  713. /* 分享 */
  714. .share-section{
  715. display:flex;
  716. align-items:center;
  717. color: #606266;
  718. background: linear-gradient(left, #fdf5f6, #fbebf6);
  719. padding: 12upx 30upx;
  720. .share-icon{
  721. display:flex;
  722. align-items:center;
  723. width: 70upx;
  724. height: 30upx;
  725. line-height: 1;
  726. border: 1px solid #fa436a;
  727. border-radius: 4upx;
  728. position:relative;
  729. overflow: hidden;
  730. font-size: 22upx;
  731. color: #fa436a;
  732. &:after{
  733. content: '';
  734. width: 50upx;
  735. height: 50upx;
  736. border-radius: 50%;
  737. left: -20upx;
  738. top: -12upx;
  739. position:absolute;
  740. background: #fa436a;
  741. }
  742. }
  743. .icon-xingxing{
  744. position:relative;
  745. z-index: 1;
  746. font-size: 24upx;
  747. margin-left: 2upx;
  748. margin-right: 10upx;
  749. color: #fff;
  750. line-height: 1;
  751. }
  752. .tit{
  753. font-size: 28upx;
  754. margin-left:10upx;
  755. }
  756. .icon-bangzhu1{
  757. padding: 10upx;
  758. font-size: 30upx;
  759. line-height: 1;
  760. }
  761. .share-btn{
  762. flex: 1;
  763. text-align:right;
  764. font-size: 24upx;
  765. color: #fa436a;
  766. }
  767. .icon-you{
  768. font-size: 24upx;
  769. margin-left: 4upx;
  770. color: #fa436a;
  771. }
  772. }
  773. .c-list{
  774. font-size: 24upx + 2upx;
  775. color: #606266;
  776. background: #fff;
  777. border-top: 20upx solid #F5F5F5;
  778. border-bottom: 20upx solid #F5F5F5;
  779. .c-row{
  780. display:flex;
  781. align-items:center;
  782. padding: 20upx 30upx;
  783. position:relative;
  784. }
  785. .tit{
  786. width: 140upx;
  787. }
  788. .con{
  789. flex: 1;
  790. color: #303133;
  791. .selected-text{
  792. margin-right: 10upx;
  793. }
  794. }
  795. .bz-list{
  796. height: 40upx;
  797. font-size: 24upx+2upx;
  798. color: #303133;
  799. text{
  800. display: inline-block;
  801. margin-right: 30upx;
  802. }
  803. }
  804. .con-list{
  805. flex: 1;
  806. display:flex;
  807. flex-direction: column;
  808. color: #303133;
  809. line-height: 40upx;
  810. }
  811. .red{
  812. color: #fa436a;
  813. }
  814. }
  815. /* 评价 */
  816. .eva-section{
  817. display: flex;
  818. flex-direction: column;
  819. padding: 20upx 30upx;
  820. background: #fff;
  821. margin-top: 16upx;
  822. .e-header{
  823. display: flex;
  824. align-items: center;
  825. height: 70upx;
  826. font-size: 24upx + 2upx;
  827. color: #909399;
  828. .tit{
  829. font-size: 28upx + 2upx;
  830. color: #303133;
  831. margin-right: 4upx;
  832. }
  833. .tip{
  834. flex: 1;
  835. text-align: right;
  836. }
  837. .icon-you{
  838. margin-left: 10upx;
  839. }
  840. }
  841. }
  842. .eva-box{
  843. display: flex;
  844. padding: 20upx 0;
  845. .portrait{
  846. flex-shrink: 0;
  847. width: 80upx;
  848. height: 80upx;
  849. border-radius: 100px;
  850. }
  851. .right{
  852. flex: 1;
  853. display: flex;
  854. flex-direction: column;
  855. font-size: 28upx;
  856. color: #606266;
  857. padding-left: 26upx;
  858. .con{
  859. font-size: 28upx;
  860. color: #303133;
  861. padding: 20upx 0;
  862. }
  863. .bot{
  864. display: flex;
  865. justify-content: space-between;
  866. font-size: 24upx;
  867. color:#909399;
  868. }
  869. }
  870. }
  871. /* 详情 */
  872. .detail-desc{
  873. background: #fff;
  874. margin-top: 16upx;
  875. margin-bottom: 135rpx;
  876. width: 100%;
  877. .d-header{
  878. display: flex;
  879. justify-content: center;
  880. align-items: center;
  881. height: 80upx;
  882. font-size: 28upx + 2upx;
  883. color: #303133;
  884. position: relative;
  885. text{
  886. padding: 0 20upx;
  887. background: #fff;
  888. position: relative;
  889. z-index: 1;
  890. }
  891. &:after{
  892. position: absolute;
  893. left: 50%;
  894. top: 50%;
  895. transform: translateX(-50%);
  896. width: 300upx;
  897. height: 0;
  898. content: '';
  899. border-bottom: 1px solid #ccc;
  900. }
  901. }
  902. }
  903. /* 规格选择弹窗 */
  904. .attr-content{
  905. padding: 10upx 30upx;
  906. .a-t{
  907. display: flex;
  908. image{
  909. width: 170upx;
  910. height: 170upx;
  911. flex-shrink: 0;
  912. margin-top: -40upx;
  913. border-radius: 8upx;;
  914. }
  915. .right{
  916. display: flex;
  917. flex-direction: column;
  918. padding-left: 24upx;
  919. font-size: 24upx + 2upx;
  920. color: #606266;
  921. line-height: 42upx;
  922. justify-content: space-around;
  923. .price{
  924. font-size: $font-lg;
  925. color: #fa436a;
  926. margin-bottom: 10upx;
  927. }
  928. .selected-text{
  929. margin-right: 10upx;
  930. }
  931. }
  932. }
  933. .attr-list{
  934. display: flex;
  935. flex-direction: column;
  936. font-size: 28upx + 2upx;
  937. color: #606266;
  938. padding-top: 30upx;
  939. padding-left: 10upx;
  940. }
  941. .item-list{
  942. padding: 20upx 0 0;
  943. display: flex;
  944. flex-wrap: wrap;
  945. text{
  946. display: flex;
  947. align-items: center;
  948. justify-content: center;
  949. background: #eee;
  950. margin-right: 20upx;
  951. margin-bottom: 20upx;
  952. border-radius: 100upx;
  953. min-width: 60upx;
  954. height: 60upx;
  955. padding: 0 20upx;
  956. font-size: 28upx;
  957. color: #303133;
  958. }
  959. .selected{
  960. background: #fbebee;
  961. color: #fa436a;
  962. }
  963. .disabled {
  964. color:#999;
  965. background: rgba(245,245,245, 0.5);
  966. }
  967. }
  968. }
  969. /* 弹出层 */
  970. .popup {
  971. position: fixed;
  972. left: 0;
  973. top: 0;
  974. right: 0;
  975. bottom: 100upx;
  976. z-index: 99;
  977. &.show {
  978. display: block;
  979. .mask{
  980. animation: showPopup 0.2s linear both;
  981. }
  982. .layer {
  983. animation: showLayer 0.2s linear both;
  984. }
  985. }
  986. &.hide {
  987. .mask{
  988. animation: hidePopup 0.2s linear both;
  989. }
  990. .layer {
  991. animation: hideLayer 0.2s linear both;
  992. }
  993. }
  994. &.none {
  995. display: none;
  996. }
  997. .mask{
  998. position: fixed;
  999. top: 0;
  1000. width: 100%;
  1001. height: 90%;
  1002. z-index: 1;
  1003. background-color: rgba(0, 0, 0, 0.4);
  1004. }
  1005. .layer {
  1006. position: fixed;
  1007. z-index: 99;
  1008. bottom: 100upx;
  1009. width: 100%;
  1010. min-height: 40vh;
  1011. border-radius: 10upx 10upx 0 0;
  1012. background-color: #fff;
  1013. .btn{
  1014. height: 66upx;
  1015. line-height: 66upx;
  1016. border-radius: 100upx;
  1017. background: #fa436a;
  1018. font-size: 28upx + 2upx;
  1019. color: #fff;
  1020. margin: 30upx auto 20upx;
  1021. }
  1022. }
  1023. @keyframes showPopup {
  1024. 0% {
  1025. opacity: 0;
  1026. }
  1027. 100% {
  1028. opacity: 1;
  1029. }
  1030. }
  1031. @keyframes hidePopup {
  1032. 0% {
  1033. opacity: 1;
  1034. }
  1035. 90% {
  1036. opacity: 0;
  1037. }
  1038. }
  1039. @keyframes showLayer {
  1040. 0% {
  1041. transform: translateY(120%);
  1042. }
  1043. 100% {
  1044. transform: translateY(0%);
  1045. }
  1046. }
  1047. @keyframes hideLayer {
  1048. 0% {
  1049. transform: translateY(0);
  1050. }
  1051. 100% {
  1052. transform: translateY(120%);
  1053. }
  1054. }
  1055. }
  1056. .colored {
  1057. color: red;
  1058. }
  1059. .van-sticky {
  1060. /* z-index: 0!important; */
  1061. }
  1062. /* 详情固定 */
  1063. .activeColor {
  1064. /* background: #fff!important; */
  1065. position: fixed;
  1066. background-color: #fff;
  1067. top: 0upx;
  1068. z-index: 99;
  1069. margin-top: 0;
  1070. }
  1071. .numberchange {
  1072. padding-top: 48px;
  1073. overflow: hidden;
  1074. clear: both;
  1075. padding-right: 59rpx;
  1076. }
  1077. .uni-numbox {
  1078. float: right;
  1079. }
  1080. /* 底部操作菜单 */
  1081. .page-bottom{
  1082. position: fixed;
  1083. left: 0;
  1084. bottom: 0;
  1085. display: flex;
  1086. justify-content: center;
  1087. align-items: center;
  1088. width: 100vw;
  1089. height: 100upx;
  1090. z-index: 99;
  1091. background: rgba(255,255,255,.9);
  1092. .p-b-btn{
  1093. display:flex;
  1094. flex-direction: column;
  1095. align-items: center;
  1096. justify-content: center;
  1097. font-size: 24upx;
  1098. color: #606266;
  1099. width: 96upx;
  1100. height: 80upx;
  1101. .yticon{
  1102. font-size: 40upx;
  1103. line-height: 48upx;
  1104. color: #909399;
  1105. }
  1106. &.active, &.active .yticon{
  1107. color: #fa436a;
  1108. }
  1109. .icon-fenxiang2{
  1110. font-size: 42upx;
  1111. transform: translateY(-2upx);
  1112. }
  1113. .icon-shoucang{
  1114. font-size: 46upx;
  1115. }
  1116. }
  1117. .action-btn-group{
  1118. display: flex;
  1119. height: 76upx;
  1120. border-radius: 100px;
  1121. overflow: hidden;
  1122. box-shadow: 0 20upx 40upx -16upx #fa436a;
  1123. box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  1124. background: linear-gradient(to right, #ffac30,#fa436a,#F56C6C);
  1125. margin-left: 20upx;
  1126. position:relative;
  1127. &:after{
  1128. content: '';
  1129. position:absolute;
  1130. top: 50%;
  1131. right: 50%;
  1132. transform: translateY(-50%);
  1133. height: 28upx;
  1134. width: 0;
  1135. border-right: 1px solid rgba(255,255,255,.5);
  1136. }
  1137. .action-btn{
  1138. display:flex;
  1139. align-items: center;
  1140. justify-content: center;
  1141. width: 180upx;
  1142. height: 100%;
  1143. font-size: 28upx ;
  1144. padding: 0;
  1145. border-radius: 0;
  1146. background: transparent;
  1147. }
  1148. }
  1149. }
  1150. .changeimg {
  1151. width: 100%;
  1152. height: auto!important;
  1153. display: block;
  1154. text-align: center;
  1155. }
  1156. </style>