shop.vue 27 KB

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