金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1025 lines
27 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="商品详情" titleColor="#fff" :spreadOut="false" :showIcon="true" bgColor="transparent"></lf-nav>
  4. <skeleton :loading="skeletonLoading" :row="12" :showAvatar="false" :showTitle="true">
  5. <block>
  6. <!-- 商品图片轮播 -->
  7. <swiper :current="current" :indicator-dots="pictures.length > 1" :circular="true" class="swiper-box" indicator-active-color="#1998FE">
  8. <swiper-item v-for="(item, index) in pictures" :key="index">
  9. <image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image>
  10. <view class="seckill-box" v-if="type == 'seckill'">
  11. <view>距离结束还剩余</view>
  12. <view>
  13. <countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
  14. <template v-slot="{day, hour, minute, second}">
  15. <view class="lf-flex">
  16. <view>{{ day }}</view>
  17. <view></view>
  18. <view>{{ hour >= 10 ? hour : "0" + hour }}</view>
  19. <view></view>
  20. <view>{{ minute >= 10 ? minute : "0" + minute }}</view>
  21. <view></view>
  22. <view>{{ second >= 10 ? second : "0" + second }}</view>
  23. <view></view>
  24. </view>
  25. </template>
  26. </countdown-timer>
  27. </view>
  28. </view>
  29. </swiper-item>
  30. </swiper>
  31. <!-- 商品主要信息 -->
  32. <view class="head-info">
  33. <view class="lf-row-between">
  34. <view v-if="type == 'point'">
  35. <text class="lf-font-48 lf-color-primary lf-font-bold">{{ goods_detail.redeem_point }}</text>
  36. <text class="lf-font-28 lf-color-777 lf-m-l-10">个兑换</text>
  37. </view>
  38. <lf-price :iftext="false" :price="goods_detail.sell_price || 0" v-else></lf-price>
  39. <text class="lf-iconfont icon-fenxiang lf-font-40" @click="shareGraphic()"></text>
  40. </view>
  41. <view class="lf-row-between lf-font-24 lf-m-t-20 lf-p-b-20">
  42. <view class="lf-font-bold lf-font-32 lf-color-222">{{ goods_detail.name }}</view>
  43. </view>
  44. <view class="lf-row-between lf-font-24 lf-p-b-30">
  45. <view class="lf-font-28 lf-color-777 lf-row-between">可自提/可邮寄</view>
  46. </view>
  47. </view>
  48. <!-- 商品优惠 -->
  49. <block v-if="coupons && coupons.length">
  50. <self-line></self-line>
  51. <view class="bg-white" >
  52. <view class="cu-bar padding-lr">
  53. <view class="lf-flex">
  54. <text class="lf-color-777 lf-font-28">优惠</text>
  55. <view style="width: 580rpx;">
  56. <view class="lf-color-222 lf-font-26 lf-m-l-30"
  57. v-for="(item, index) in coupons" :key="index">{{ item.title }}
  58. </view>
  59. </view>
  60. </view>
  61. <view>
  62. <text class="lf-font-24 lf-color-777 lf-iconfont icon-xiangyou"></text>
  63. </view>
  64. </view>
  65. </view>
  66. </block>
  67. <self-line></self-line>
  68. <!-- 服务tags -->
  69. <block v-if="goods_detail.tags.length">
  70. <view class="bg-white">
  71. <view class="cu-bar padding-lr">
  72. <view class="lf-flex">
  73. <text class="lf-color-777 lf-font-28">服务</text>
  74. <view style="width: 600rpx;flex-wrap: wrap;display: flex;margin-top: 32rpx;">
  75. <view class="lf-m-l-30" v-for="(tagItem, tagIndex) in goods_detail.tags" :key="tagIndex">
  76. <text class="lf-iconfont icon-xuanzhong lf-font-30" style="color: #15716E;"></text>
  77. <text class="lf-m-l-10 lf-font-26 lf-color-black">{{ tagItem }}</text>
  78. </view>
  79. </view>
  80. </view>
  81. <view>
  82. <text class="lf-font-24 lf-color-777 lf-iconfont icon-xiangyou"></text>
  83. </view>
  84. </view>
  85. </view>
  86. </block>
  87. <!-- 商品选择规格 -->
  88. <block v-if="$isRight(goods_stock.specs)">
  89. <view class="bg-white">
  90. <view class="cu-bar padding-lr" @click="shoot(2)">
  91. <view class="lf-flex">
  92. <text class="lf-color-777 lf-font-28">选择</text>
  93. <text class="lf-color-222 lf-font-26 lf-m-l-30">{{ showSpec }}</text>
  94. </view>
  95. <view>
  96. <text class="lf-font-24 lf-color-777 lf-iconfont icon-xiangyou"></text>
  97. </view>
  98. </view>
  99. </view>
  100. <self-line></self-line>
  101. </block>
  102. <!-- 店铺信息 -->
  103. <view v-if="type != 'point'">
  104. <view class="user-top">
  105. <view class="lf-row-between lf-w-100">
  106. <view class="lf-flex" @click="$url('/pages/shop/shopdetail?id='+ brand_detail.id)">
  107. <view class="tag-father">
  108. <image :src="brand_detail.logo" mode="aspectFill" class="head-img"></image>
  109. </view>
  110. <view class="lf-flex-column lf-m-l-20">
  111. <text class="lf-font-28 lf-color-black lf-font-bold">{{ brand_detail.name }}</text>
  112. <view class="lf-font-24 lf-color-777">
  113. <text class="lf-iconfont icon-dizhi lf-font-24 lf-color-primary"></text>
  114. <text class="lf-m-l-10">{{ brand_detail.floor }}</text>
  115. </view>
  116. </view>
  117. </view>
  118. <!-- <view>
  119. <button class="head-btn" @click="$url('/pages/user/my/chatonline')">
  120. <text class="lf-iconfont icon-kefuhdpi lf-font-24"></text>
  121. <text class="lf-m-l-10">客服</text>
  122. </button>
  123. </view> -->
  124. </view>
  125. </view>
  126. <scroll-view class="scroll-view" :scroll-x="true">
  127. <view class="scroll-content">
  128. <view class="goods-item"
  129. v-for="(item, index) in brand_detail.goods"
  130. :key="index"
  131. @click="$url('/pages/shop/goodsdetail?id='+ item.id)">
  132. <image class="goods-img" :src="item.img"></image>
  133. <view class="goods-info">
  134. <view class="lf-line-1">{{ item.name }}</view>
  135. <view>{{ item.sell_price }}</view>
  136. </view>
  137. </view>
  138. <view class="goods-item" @click="$url('/pages/shop/shopdetail?id='+ brand_detail.id)">
  139. <view class="more-box">
  140. <text>查看更多</text>
  141. <text class="lf-iconfont icon--2 lf-text-vertical"></text>
  142. </view>
  143. </view>
  144. </view>
  145. </scroll-view>
  146. </view>
  147. <!-- 商品详情 -->
  148. <view class="goods-detail">
  149. <view class="lf-font-32 lf-font-bold lf-m-b-20">商品详情</view>
  150. <rich-text :nodes="formatRichText(goods_detail.content)"></rich-text>
  151. <!-- <image class="goods-img" :src="item" v-for="(item, index) in goods_detail.content" :key="index" v-if="goods_detail.content_type == 'img'"></image> -->
  152. </view>
  153. <!-- 修饰专用 -->
  154. <view class="extra"></view>
  155. <!-- 吸底操作按钮 -->
  156. <view class="lf-row-between fixed-bottom">
  157. <view class="lf-flex lf-p-t-10 lf-p-b-10">
  158. <!-- <view class="lf-flex-column lf-row-center icon-item" open-type="contact">
  159. <text class="lf-iconfont icon-pinglun- icon-img"></text>
  160. <view class="lf-m-t-1">客服</view>
  161. </view> -->
  162. <view class="lf-flex-column lf-row-center icon-item" @click="switchCollect">
  163. <text class="lf-iconfont icon-shoucang2 icon-img lf-color-price" v-if="is_collect"></text>
  164. <text class="lf-iconfont icon-shoucang11 icon-img" v-else></text>
  165. <view class="lf-m-t-1">{{ is_collect ? '已收藏' : '收藏' }}</view>
  166. </view>
  167. <button class="lf-flex-column lf-row-center icon-item" @click="$url('/pages/store/cart/cart')">
  168. <text class="lf-iconfont icon-gouwulan icon-img"></text>
  169. <view class="lf-m-t-1">购物车</view>
  170. </button>
  171. </view>
  172. <view v-if="type == 'seckill'">
  173. <button class="btn" style="width: 349rpx;">立即秒杀</button>
  174. </view>
  175. <view v-else-if="type == 'point'">
  176. <button class="btn" style="width: 349rpx;">立即兑换</button>
  177. </view>
  178. <view class="lf-flex" v-else>
  179. <button class="btn1" @click="shoot(1)">加入购物车</button>
  180. <button class="btn lf-m-l-15" @click="shoot(2)">立即购买</button>
  181. </view>
  182. </view>
  183. <!-- 加入购物车立即购买模态框选规格 -->
  184. <u-popup v-model="show_popup" mode="bottom" :round="true" borderRadius="20">
  185. <view class="popup-content">
  186. <!-- 商品信息及关闭按钮 -->
  187. <view class="popup-head">
  188. <view class="lf-flex">
  189. <image class="goods-img" :src="goods_detail.img"></image>
  190. <view class="goods-info">
  191. <view class="price">{{ showGoodsSpecPrice }}</view>
  192. <view class="goods-name">{{ goods_detail.name }}</view>
  193. </view>
  194. </view>
  195. <view @click="show_popup = false">
  196. <text class="lf-iconfont icon-cuo lf-font-50"></text>
  197. </view>
  198. </view>
  199. <!-- 规格 -->
  200. <view v-for="(value, key) in goods_stock.specs" :key="key">
  201. <view class="spec-title">{{ value.label }}</view>
  202. <view class="lf-flex-wrap">
  203. <view :class="{
  204. 'spec-item': true,
  205. 'spec-active': value.spec_current === index}"
  206. @click="activeSpec(key, index)"
  207. v-for="(item, index) in value.list"
  208. :key="index">{{ item.value }}
  209. </view>
  210. </view>
  211. </view>
  212. <!-- 数量 -->
  213. <view class="lf-row-between lf-m-t-40">
  214. <view class="lf-font-28 lf-color-555">数量</view>
  215. <view class="lf-flex">
  216. <view class="num-btn" @click="changeNum('less')">
  217. <text class="lf-iconfont icon-jian1 lf-font-30"></text>
  218. </view>
  219. <view>
  220. <input class="input" :value="goods_num" :disabled="true" />
  221. </view>
  222. <view class="num-btn lf-text-right" @click="changeNum('add')">
  223. <text class="lf-iconfont icon-jia lf-font-30"></text>
  224. </view>
  225. </view>
  226. </view>
  227. <!-- 操作按钮 -->
  228. <button class="comfirm-btn" @click="specConfirm">{{ click_type == 1 ? '加入购物车' : '立即购买' }}</button>
  229. </view>
  230. </u-popup>
  231. <!-- 回到顶部 -->
  232. <u-back-top :scroll-top="pageScrollTop"></u-back-top>
  233. </block>
  234. </skeleton>
  235. </view>
  236. </template>
  237. <script>
  238. import countdownTimer from '@/components/countdown-timer/countdown-timer';
  239. export default {
  240. components: {
  241. countdownTimer
  242. },
  243. data(){
  244. return {
  245. current: 0, // 轮播下标
  246. goods_id: 0,
  247. goods_detail: {},
  248. is_collect: false, // 1为当前收藏商品了,0为否
  249. skeletonLoading: false,
  250. pictures: [],
  251. show_popup: false, // 是否显示选规格模态框
  252. click_type: null, // 当前点击的是加入购物车[1]还是立即购买[2]
  253. type: 'mail', // 页面显示类型,mail普通可邮寄商品,point积分商品,seckill秒杀商品
  254. time: 0,
  255. goods_stock: {
  256. specs: {},
  257. stores: {}
  258. },
  259. seckill: {}, // 秒杀商品的信息
  260. brand_detail: {},
  261. token: '',
  262. coupons: [], // 优惠
  263. goods_num: 1,
  264. is_date_finish: false
  265. }
  266. },
  267. computed: {
  268. showGoodsSpecPrice(){
  269. let goods_detail = this.goods_detail;
  270. let stores = this.goods_stock.stores;
  271. let specs = this.goods_stock.specs;
  272. if(!this.$isRight(specs[1])){
  273. return `${goods_detail.min_price} - ¥${goods_detail.max_price}`;
  274. }
  275. let spec_current_1 = specs[1].spec_current;
  276. let spec_current_2 = specs[2].spec_current;
  277. if(specs[1].spec_current != null && specs[2].spec_current != null){
  278. let id_1 = specs[1].list[spec_current_1].id;
  279. let id_2 = specs[2].list[spec_current_2].id;
  280. if(id_1 < id_2){
  281. let id_3 = id_2;
  282. id_2 = id_1;
  283. id_1 = id_3;
  284. }
  285. return "¥"+ stores[id_2 +'-'+ id_1].price;
  286. }else{
  287. return `${goods_detail.min_price} - ¥${goods_detail.max_price}`;
  288. }
  289. },
  290. showSpec(){
  291. let specs = this.goods_stock.specs;
  292. let str = '';
  293. for(let i in specs){
  294. if(specs[i].spec_current != null){
  295. str += specs[i].list[specs[i].spec_current].value +';';
  296. }
  297. }
  298. if(str == ''){
  299. str = '请选择规格'
  300. }
  301. return str;
  302. }
  303. },
  304. onLoad(options){
  305. console.log("options", options)
  306. this.token = this.$cookieStorage.get('user_token');
  307. this.goods_id = options.id;
  308. this.getNewdetail();
  309. this.getGoodsStock(); // 获取商品库存、规格信息
  310. },
  311. methods: {
  312. // 切换商品收藏
  313. switchCollect(){
  314. if(!this.token){
  315. this.$url('/pages/login/index');
  316. return;
  317. }
  318. this.addCollcet()
  319. },
  320. //收藏
  321. addCollcet() {
  322. this.$http.post({
  323. api: 'api/collect/create',
  324. data: {
  325. type:'jc_goods',
  326. collect_id: this.goods_detail.id,
  327. },
  328. header: {
  329. Authorization: this.token
  330. }
  331. }).then(res => {
  332. this.$msg(res.data.data);
  333. this.getNewdetail();
  334. }).catch(err => {
  335. console.log("====", err);
  336. })
  337. },
  338. // 加入购物车和立即购买
  339. shoot(type){
  340. this.click_type = type;
  341. if(this.$isRight(this.goods_stock.specs)){
  342. this.show_popup = true;
  343. }else{
  344. this.confirm();
  345. }
  346. },
  347. // 选规格提交
  348. specConfirm(){
  349. let specs = this.goods_stock.specs;
  350. let flag = true;
  351. for(let i in specs){
  352. if(specs[i].spec_current == null){
  353. flag = false;
  354. }
  355. }
  356. if(flag){
  357. this.confirm();
  358. }else{
  359. this.$msg('您未选完整规格')
  360. }
  361. },
  362. // 商品选规格
  363. activeSpec(key, index){
  364. let obj = this.goods_stock.specs;
  365. if(obj[key]['spec_current'] == index){
  366. obj[key]['spec_current'] = null;
  367. }else{
  368. obj[key]['spec_current'] = index;
  369. }
  370. this.$set(this.goods_stock, 'specs', obj);
  371. },
  372. // 商品加减
  373. changeNum(type){
  374. if(type == 'add'){
  375. if(this.goods_num < 10){
  376. this.goods_num++;
  377. }
  378. }else if(type == 'less'){
  379. if(this.goods_num > 1){
  380. this.goods_num--;
  381. }
  382. }
  383. },
  384. // 跳转至下单页TODO
  385. confirm(){
  386. if(this.is_date_finish){
  387. return this.$msg('活动已结束');
  388. }
  389. let goods_detail = this.goods_detail;
  390. let specs = this.goods_stock.specs;
  391. let stores = this.goods_stock.stores;
  392. let par = {};
  393. if(this.$isRight(specs)){
  394. let s_id_1 = 1;
  395. let s_id_2 = 2;
  396. for(let i in specs){
  397. if(specs[i].label_key == 'size'){
  398. s_id_1 = 1;
  399. }
  400. if(specs[i].label_key == 'color'){
  401. s_id_2 = 2;
  402. }
  403. }
  404. let spec_current_1 = specs[s_id_1].spec_current;
  405. let spec_current_2 = specs[s_id_2].spec_current;
  406. let id_1 = specs[s_id_1].list[spec_current_1].id;
  407. let id_2 = specs[s_id_2].list[spec_current_2].id;
  408. if(id_1 > id_2){
  409. let id_3 = id_2;
  410. id_2 = id_1;
  411. id_1 = id_3;
  412. }
  413. par = {
  414. attributes: {
  415. color: specs[s_id_2].list[specs[s_id_2].spec_current].value,
  416. com_id: goods_detail.id,
  417. img: goods_detail.img,
  418. size: specs[s_id_1].list[specs[s_id_1].spec_current].value,
  419. sku: goods_detail.goods_no +'-'+ specs[s_id_1].list[specs[s_id_1].spec_current].value
  420. },
  421. id: stores[id_1 +'-'+ id_2].id,
  422. product_id: stores[id_1 +'-'+ id_2].id,
  423. price: stores[id_1 +'-'+ id_2].price,
  424. store_count: stores[id_1 +'-'+ id_2].store,
  425. market_price: goods_detail.market_price,
  426. name: goods_detail.name,
  427. qty: this.goods_num
  428. }
  429. }else{
  430. par = {
  431. attributes: {
  432. com_id: goods_detail.id,
  433. img: goods_detail.img
  434. },
  435. id: goods_detail.id,
  436. product_id: goods_detail.id,
  437. price: goods_detail.sell_price,
  438. store_count: goods_detail.store_nums,
  439. market_price: goods_detail.market_price,
  440. name: goods_detail.name,
  441. qty: this.goods_num
  442. }
  443. }
  444. uni.showLoading({
  445. title: '正在提交'
  446. })
  447. this.show_popup = false;
  448. if(this.click_type == 1){
  449. // 加入购物车
  450. this.$http.post({
  451. api: 'api/shopping/cart',
  452. data: {"0": par},
  453. header: {
  454. Authorization: this.token
  455. }
  456. }).then(res => {
  457. if(res.data.code == 200){
  458. this.$msg('加入购物车成功', {icon: 'success'})
  459. }else{
  460. this.$msg('加入购物车失败', {icon: 'error'})
  461. }
  462. uni.hideLoading()
  463. }).catch(err => uni.hideLoading())
  464. }else if(this.click_type == 2){
  465. // 直接结算
  466. this.$cookieStorage.set('order_confirm', par);
  467. uni.hideLoading();
  468. this.$url('/pages/order/confirm/confirm');
  469. // this.$http.post({
  470. // api: 'api/shopping/order/checkout',
  471. // data: par,
  472. // header: {
  473. // Authorization: this.token
  474. // }
  475. // }).then(res => {
  476. // if(res.data.code == 200){
  477. // this.$url('/pages/order/confirm/confirm');
  478. // }else{
  479. // this.$msg('提交失败', {icon: 'error'})
  480. // }
  481. // uni.hideLoading()
  482. // }).catch(err => uni.hideLoading())
  483. }
  484. },
  485. // 点击页面分享按钮
  486. shareGraphic(){
  487. this.getCreateShareImg();
  488. },
  489. //请求h5的图片接口
  490. getCreateShareImg(){
  491. wx.showLoading({
  492. title:"生成中",
  493. mask:true
  494. })
  495. let origin = window.location.origin;
  496. let share_url = origin+'/pages/store/detail/detail';
  497. this.$http.get({
  498. api:'api/distribution/createH5ShareImg',
  499. data:{
  500. goods_id:this.id,
  501. share_url:share_url
  502. }
  503. }).then(res=>{
  504. res = res.data;
  505. if(res.status){
  506. this.qr_code_image = res.data.image;
  507. if(this.qr_code_image){
  508. this.share_gaphic =!this.share_gaphic;
  509. this.is_toggle_share = false;
  510. }
  511. } else{
  512. wx.showModal({
  513. content: res.message || '请求失败,请重试',
  514. showCancel: false
  515. });
  516. }
  517. wx.hideLoading()
  518. }).catch(rej=>{
  519. wx.hideLoading()
  520. wx.showModal({
  521. content: rej.message || '内部错误,请重试',
  522. showCancel: false
  523. });
  524. })
  525. },
  526. // 商品详情
  527. getNewdetail(){
  528. this.$http.get({
  529. api: 'api/store/detail/'+ this.goods_id,
  530. header: {
  531. Authorization: this.token
  532. }
  533. }).then(res => {
  534. console.log("===---", res);
  535. let meta = res.data.meta;
  536. let goods_detail = res.data.data;
  537. this.goods_detail = goods_detail;
  538. this.pictures = [res.data.data.img];
  539. this.is_collect = Boolean(res.data.data.is_collect) || false;
  540. let type = 'mail';
  541. if(this.$isRight(goods_detail.is_largess)){
  542. type = 'point';
  543. }
  544. if(this.$isRight(meta.seckill)){
  545. type = 'seckill';
  546. this.seckill = meta.seckill;
  547. let currentDate = this.$shared.recordTime();
  548. this.time = new Date(meta.seckill.ends_at).getTime() - new Date(currentDate).getTime()
  549. }
  550. if(type != 'point'){
  551. this.getBrandDetail(goods_detail.brand_id);
  552. }
  553. if(this.$isRight(meta.discounts)){
  554. this.coupons = meta.discounts.coupons;
  555. }
  556. this.type = type;
  557. }).catch(err => {
  558. console.log("====", err);
  559. })
  560. },
  561. // 获取商家信息
  562. getBrandDetail(brand_id){
  563. this.$http.get({
  564. api: 'api/brand/detail',
  565. data: {
  566. brand_id: brand_id
  567. },
  568. header: {
  569. Authorization: this.token
  570. }
  571. }).then(res => {
  572. this.brand_detail = res.data.data;
  573. })
  574. },
  575. // 获取商品库存信息
  576. getGoodsStock(){
  577. this.$http.get({
  578. api: `api/store/detail/${this.goods_id}/stock`
  579. }).then(res => {
  580. let data = res.data.data;
  581. for(let i in data.specs){
  582. data.specs[i].spec_current = null;
  583. }
  584. this.goods_stock = data;
  585. })
  586. },
  587. // 拨打电话
  588. makePhoneCall(phoneStr){
  589. uni.makePhoneCall({
  590. phoneNumber: String(phoneStr)
  591. })
  592. },
  593. // 打开地图 PS.暂时用不到
  594. openMap(){
  595. let { address, lat, lng } = this.goods_detail?.store || {};
  596. uni.openLocation({
  597. longitude: Number(lat),
  598. latitude: Number(lng),
  599. scale: 20,
  600. name: address
  601. });
  602. },
  603. // 预览图片
  604. lookImg(index){
  605. this.$u.throttle(() => {
  606. let banners = this.pictures;
  607. uni.previewImage({
  608. urls: banners,
  609. current: index
  610. })
  611. }, 200);
  612. },
  613. // 倒计时结束
  614. dateFinish(){
  615. this.is_date_finish = true;
  616. },
  617. // 富文本处理
  618. formatRichText(richText){
  619. if(richText != null){
  620. let newRichText= richText.replace(/<img[^>]*>/gi, function(match, capture){
  621. match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
  622. match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
  623. match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
  624. return match;
  625. });
  626. newRichText = newRichText.replace(/style="[^"]+"/gi,function(match, capture){
  627. match = match.replace(/width:[^;]+;/gi, 'width:100%;').replace(/width:[^;]+;/gi, 'width:100%;');
  628. return match;
  629. });
  630. newRichText = newRichText.replace(/<br[^>]*\/>/gi, '');
  631. newRichText = newRichText.replace(/\<img/gi, '<img style="width:100%;height:auto;display:block;margin:10px 0;"');
  632. return newRichText;
  633. }else{
  634. return null;
  635. }
  636. }
  637. },
  638. onShareAppMessage(){
  639. let goods = this.goods_detail;
  640. let title = goods.name;
  641. let imageUrl = goods.share_cover || goods.cover || goods.img;
  642. let path = '/pages/route/index?route=detail&id='+ goods.id;
  643. return {
  644. title,
  645. path,
  646. imageUrl
  647. }
  648. }
  649. }
  650. </script>
  651. <style>
  652. page{
  653. background-color: #f5f5f5;
  654. overflow-x: hidden;
  655. }
  656. </style>
  657. <style lang="scss" scoped="scoped">
  658. //商品上去scrollview部分
  659. .scroll-view{
  660. height: 310rpx;
  661. width: 100%;
  662. // margin-top: 20rpx;
  663. padding: 0 30rpx 30rpx 30rpx;
  664. background-color: white;
  665. .scroll-content{
  666. display: flex;
  667. width: 100%;
  668. .goods-item{
  669. margin-right: 15rpx;
  670. width: 180rpx;
  671. }
  672. .goods-img{
  673. width: 180rpx;
  674. height: 180rpx;
  675. background-color: #EEEEEE;
  676. }
  677. .goods-info{
  678. text-align: center;
  679. color: #222222;
  680. &>view:nth-child(1n){
  681. font-size: 24rpx;
  682. }
  683. &>view:nth-child(2n){
  684. font-size: 28rpx;
  685. font-weight: bold;
  686. text-align: left;
  687. color: #F63434;
  688. }
  689. }
  690. .more-box{
  691. width: 180rpx;
  692. height: 180rpx;
  693. background-color: #EEEEEE;
  694. text-align: center;
  695. line-height: 180rpx;
  696. font-size: 24rpx;
  697. }
  698. }
  699. }
  700. //scrollview结束
  701. .tag-father {
  702. position: relative;
  703. }
  704. .head-tag {
  705. color: white;
  706. display: flex;
  707. align-items: center;
  708. justify-content: center;
  709. text-align: center;
  710. font-size: 24rpx;
  711. width: 36rpx;
  712. height: 36rpx;
  713. border-radius: 50%;
  714. background-color: #15716E;
  715. border: 1rpx solid #FFFFFF;
  716. position: absolute;
  717. left: 76rpx;
  718. top: 86rpx;
  719. z-index: 99;
  720. }
  721. .qzone-img {
  722. width: 220rpx;
  723. height: 220rpx;
  724. border-radius: 10rpx;
  725. margin-right: 12rpx;
  726. &:nth-child(3n) {
  727. margin-right: 0;
  728. }
  729. &:nth-child(n + 4) {
  730. margin-top: 12rpx;
  731. }
  732. }
  733. .user-top {
  734. background-color: #F3F8F8;
  735. padding: 30rpx;
  736. display: flex;
  737. align-items: center;
  738. background-color: white;
  739. }
  740. .head-img {
  741. width: 80rpx;
  742. height: 80rpx;
  743. border-radius: 50%;
  744. }
  745. .head-btn {
  746. display: flex;
  747. width: max-content;
  748. height: 45rpx;
  749. background: white;
  750. border: 2rpx solid #15716E;
  751. align-items: center;
  752. font-size: 22rpx;
  753. color: #15716E;
  754. justify-content: space-between;
  755. border-radius: 35rpx;
  756. padding: 10rpx!important;
  757. }
  758. .swiper-box{
  759. width: 750rpx;
  760. height: 750rpx;
  761. background-color: #FFFFFF;
  762. position: relative;
  763. .seckill-box{
  764. position: absolute;
  765. bottom: 0;
  766. left: 0;
  767. display: flex;
  768. justify-content: space-between;
  769. align-items: center;
  770. padding: 0 32rpx;
  771. width: 100%;
  772. height: 77rpx;
  773. background-color: #15716E;
  774. color: #FFFFFF;
  775. font-size: 26rpx;
  776. }
  777. }
  778. .head-info{
  779. width: 750rpx;
  780. height: auto;
  781. box-sizing: border-box;
  782. padding: 0 32rpx;
  783. padding-top: 20rpx;
  784. background-color: #FFFFFF;
  785. // .price>view:nth-of-type(1){
  786. // color: #FF0000;
  787. // margin-right: 22rpx;
  788. // font-weight: bold;
  789. // }
  790. .price>view:nth-of-type(1){
  791. text-decoration: line-through;
  792. color: #777777;
  793. margin-right: 22rpx;
  794. }
  795. .price>view:nth-of-type(2){
  796. width: max-content;
  797. padding: 0 18rpx;
  798. height: 46rpx;
  799. background-color: #1998FE;
  800. border-radius: 10rpx;
  801. display: flex;
  802. justify-content: center;
  803. align-items: center;
  804. color: #FFFFFF;
  805. }
  806. .label-box{
  807. min-height: 130rpx;
  808. width: 100%;
  809. border-top: 1rpx solid #E5E5E5;
  810. display: flex;
  811. flex-wrap: wrap;
  812. padding: 30rpx 0 10rpx 0;
  813. .label-item{
  814. width: max-content;
  815. padding: 20rpx;
  816. height: 70rpx;
  817. border-radius: 10rpx;
  818. border: 2rpx solid #1998FE;
  819. display: flex;
  820. justify-content: center;
  821. align-items: center;
  822. font-size: 28rpx;
  823. color: #1998FE;
  824. margin-right: 20rpx;
  825. margin-bottom: 20rpx;
  826. }
  827. }
  828. }
  829. .address-box{
  830. width: 750rpx;
  831. height: auto;
  832. box-sizing: border-box;
  833. background-color: #FFFFFF;
  834. padding: 32rpx;
  835. margin-top: 20rpx;
  836. .shop-img{
  837. width: 60rpx;
  838. height: 60rpx;
  839. border-radius: 50%;
  840. }
  841. }
  842. .goods-detail{
  843. width: 750rpx;
  844. height: auto;
  845. background-color: #FFFFFF;
  846. padding: 32rpx;
  847. box-sizing: border-box;
  848. margin-top: 20rpx;
  849. .goods-img{
  850. width: 100%;
  851. }
  852. }
  853. .extra{
  854. width: 100%;
  855. height: 110rpx;
  856. padding-bottom: constant(safe-area-inset-bottom);
  857. padding-bottom: env(safe-area-inset-bottom);
  858. box-sizing: content-box;
  859. }
  860. .fixed-bottom{
  861. position: fixed;
  862. bottom: 0;
  863. left: 0;
  864. background-color: #FFFFFF;
  865. width: 100%;
  866. height: auto;
  867. padding: 0 32rpx;
  868. border-top: 1rpx solid #e5e5e5;
  869. padding-bottom: constant(safe-area-inset-bottom);
  870. padding-bottom: env(safe-area-inset-bottom);
  871. .icon-item{
  872. text-align: center;
  873. margin-right: 16rpx;
  874. background-color: transparent;
  875. margin: 0;
  876. line-height: initial;
  877. font-size: 28rpx;
  878. font-weight: inherit;
  879. margin-right: 10rpx;
  880. padding: 0;
  881. width: 88rpx;
  882. position: relative;
  883. &:first-child{
  884. padding-left: 0;
  885. }
  886. .icon-img{
  887. height: 50rpx;
  888. width: 50rpx;
  889. font-size: 40rpx;
  890. line-height: 1;
  891. }
  892. }
  893. .btn1{
  894. margin: 0;
  895. width: max-content;
  896. height: 80rpx;
  897. background-color: rgba(21, 113, 110, 0.1);
  898. color: #15716E;
  899. line-height: 80rpx;
  900. font-size: 32rpx;
  901. padding: 0 20rpx;
  902. border-radius: 42rpx;
  903. font-size: 26rpx;
  904. border: 2rpx solid #15716E;
  905. }
  906. .btn{
  907. margin: 0;
  908. padding: 0 20rpx;
  909. width: max-content;
  910. height: 80rpx;
  911. background-color: #15716E;
  912. color: #FFFFFF;
  913. line-height: 80rpx;
  914. font-size: 26rpx;
  915. border-radius: 42rpx;
  916. }
  917. }
  918. .popup-content{
  919. height: max-content;
  920. width: 750rpx;
  921. background: #FFFFFF;
  922. border-radius: 20rpx 20rpx 0rpx 0rpx !important;
  923. padding: 40rpx 32rpx;
  924. max-height: 80vh;
  925. overflow-y: scroll;
  926. .popup-head{
  927. display: flex;
  928. justify-content: space-between;
  929. .goods-img{
  930. width: 150rpx;
  931. height: 150rpx;
  932. border-radius: 2rpx;
  933. margin-right: 20rpx;
  934. }
  935. .goods-info{
  936. width: 400rpx;
  937. height: 150rpx;
  938. display: flex;
  939. flex-direction: column;
  940. justify-content: space-around;
  941. .price{
  942. font-size: 48rpx;
  943. font-weight: bold;
  944. color: #F63434;
  945. line-height: 1;
  946. }
  947. .goods-name{
  948. font-size: 32rpx;
  949. color: #222222;
  950. line-height: 1.4;
  951. }
  952. }
  953. }
  954. .spec-title{
  955. font-size: 28rpx;
  956. color: #555555;
  957. margin-top: 40rpx;
  958. margin-bottom: 20rpx;
  959. }
  960. .spec-item{
  961. width: 142rpx;
  962. height: 64rpx;
  963. border-radius: 33rpx;
  964. border: 2rpx solid #555555;
  965. font-size: 28rpx;
  966. color: #555555;
  967. display: flex;
  968. justify-content: center;
  969. align-items: center;
  970. margin-right: 20rpx;
  971. &:nth-child(4n){
  972. margin-right: 0rpx;
  973. }
  974. &:nth-child(n+5){
  975. margin-top: 20rpx;
  976. }
  977. }
  978. .spec-active{
  979. border: none;
  980. background-color: #15716E;
  981. color: #FFFFFF;
  982. }
  983. .input{
  984. width: 40rpx;
  985. height: 45rpx;
  986. border-radius: 2rpx;
  987. background-color: #F3F8F7;
  988. text-align: center;
  989. }
  990. .num-btn{
  991. width: 36rpx;
  992. }
  993. .comfirm-btn{
  994. width: 550rpx;
  995. height: 100rpx;
  996. background: #15716E;
  997. border-radius: 50rpx;
  998. color: #FFFFFF;
  999. line-height: 100rpx;
  1000. margin-top: 62rpx;
  1001. }
  1002. }
  1003. </style>