shop.vue 28 KB

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