shop.vue 28 KB

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