shop.vue 28 KB

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