金诚优选前端代码
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.

1028 lines
27 KiB

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