shop.vue 28 KB

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