shop.vue 28 KB

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