zhouzhenyuan 10 months ago
parent db658b20e5
commit 99c3ce94df
  1. 8
      components/search/index.vue
  2. 3
      pages.json
  3. 339
      pages/goods/detail - 副本.vue
  4. 1020
      pages/goods/detail.vue
  5. 180
      pages/goods/list.vue
  6. BIN
      static/detail/buy.png
  7. BIN
      static/detail/car.png
  8. BIN
      static/detail/collect.png
  9. BIN
      static/detail/copy.png
  10. BIN
      static/detail/customer.png
  11. BIN
      static/detail/priceback.png
  12. BIN
      static/detail/pro.png
  13. BIN
      static/detail/rightIcon.png
  14. BIN
      static/detail/share.png
  15. BIN
      static/detail/tip.png
  16. BIN
      static/detail/tv.png
  17. BIN
      static/detail/ys.png

@ -15,7 +15,7 @@
props: {
tips: {
type: String,
default: '搜索商品'
default: 'iPhone15'
}
},
data() {
@ -53,12 +53,16 @@
font-size: 28rpx;
background: #f7f7f7;
display: flex;
justify-content: center;
align-items:center;
height: 64rpx;
background: #F7F8FA;
border-radius: 68rpx 68rpx 68rpx 68rpx;
opacity: 1;
}
.index-cont-search .search-icon {
font-size: 28rpx;
margin-left: 26rpx;
}
.index-cont-search .search-text {

@ -134,7 +134,8 @@
{
"path": "pages/goods/detail",
"style": {
"navigationBarTitleText": "商品详情页"
"navigationStyle": "custom"
// "navigationBarTitleText": "商品详情页"
}
},
{

@ -0,0 +1,339 @@
<template>
<view v-show="!isLoading" class="container" :style="appThemeStyle">
<!-- 商品图片轮播 -->
<SlideImage v-if="!isLoading" :video="goods.video" :videoCover="goods.videoCover" :images="goods.goods_images" />
<!-- 商品信息 -->
<view v-if="!isLoading" class="goods-info m-top20">
<!-- 价格销量 -->
<view class="info-item info-item__top dis-flex flex-x-between flex-y-end">
<view class="block-left dis-flex flex-y-center">
<!-- 商品售价 -->
<text class="floor-price__samll"></text>
<text class="floor-price">{{ goods.goods_price_min }}</text>
<!-- 会员价标签 -->
<view v-if="goods.is_user_grade" class="user-grade">
<text>会员价</text>
</view>
<!-- 划线价 -->
<text v-if="goods.line_price_min > 0" class="original-price">{{ goods.line_price_min }}</text>
</view>
<view class="block-right dis-flex">
<!-- 销量 -->
<view class="goods-sales">
<text>已售{{ goods.goods_sales }}</text>
</view>
</view>
</view>
<!-- 标题分享 -->
<view class="info-item info-item__name dis-flex flex-y-center">
<view class="goods-name flex-box">
<text class="twoline-hide">{{ goods.goods_name }}</text>
</view>
<view class="goods-share__line"></view>
<view class="goods-share">
<button class="share-btn dis-flex flex-dir-column" @click="onShowShareSheet()">
<text class="share__icon iconfont icon-fenxiang"></text>
<text class="f-24">分享</text>
</button>
</view>
</view>
<!-- 商品卖点 -->
<view v-if="goods.selling_point" class="info-item info-item_selling-point">
<text>{{ goods.selling_point }}</text>
</view>
</view>
<!-- 选择商品规格 -->
<view v-if="goods.spec_type == 20" class="goods-choice m-top20 b-f" @click="onShowSkuPopup(1)">
<view class="spec-list">
<view class="flex-box">
<text class="col-8">选择</text>
<text class="spec-name" v-for="(item, index) in goods.specList" :key="index">{{ item.spec_name }}</text>
</view>
<view class="f-26 col-9 t-r">
<text class="iconfont icon-arrow-right"></text>
</view>
</view>
</view>
<!-- 商品服务 -->
<Service v-if="!isLoading" :goods-id="goodsId" />
<!-- 商品SKU弹窗 -->
<SkuPopup v-if="!isLoading" v-model="showSkuPopup" :skuMode="skuMode" :goods="goods" @addCart="onAddCart" />
<!-- 商品评价 -->
<Comment v-if="!isLoading" :goods-id="goodsId" :limit="2" />
<!-- 商品描述 -->
<view v-if="!isLoading" class="goods-content m-top20">
<view class="item-title b-f">
<text>商品描述</text>
</view>
<view v-if="goods.content != ''" class="goods-content__detail b-f">
<mp-html :content="goods.content" />
</view>
</view>
<!-- 商品推荐 -->
<recommended />
<!-- 底部选项卡 -->
<view class="footer-fixed">
<view class="footer-container">
<!-- 导航图标 -->
<view class="foo-item-fast">
<!-- 首页 -->
<view class="fast-item fast-item--home" @click="onTargetHome">
<view class="fast-icon">
<text class="iconfont icon-shouye"></text>
</view>
<view class="fast-text">
<text>首页</text>
</view>
</view>
<!-- 客服 -->
<customer-btn v-if="isShowCustomerBtn">
<view class="fast-item">
<view class="fast-icon">
<text class="iconfont icon-kefu1"></text>
</view>
<view class="fast-text">
<text>客服</text>
</view>
</view>
</customer-btn>
<!-- 购物车 -->
<view class="fast-item fast-item--cart" @click="onTargetCart">
<view v-if="cartTotal > 0" class="fast-badge fast-badge--fixed">{{ cartTotal > 99 ? '99+' : cartTotal }}
</view>
<view class="fast-icon">
<text class="iconfont icon-gouwuche"></text>
</view>
<view class="fast-text">
<text>购物车</text>
</view>
</view>
</view>
<!-- 操作按钮 -->
<view class="foo-item-btn">
<view class="btn-wrapper">
<view v-if="isEnableCart" class="btn-item btn-item-deputy" @click="onShowSkuPopup(2)">
<text>加入购物车</text>
</view>
<view class="btn-item btn-item-main" @click="onShowSkuPopup(3)">
<text>立即购买</text>
</view>
</view>
</view>
</view>
</view>
<!-- 快捷导航 -->
<!-- <shortcut bottom="120rpx" /> -->
<!-- 分享菜单 -->
<share-sheet v-model="showShareSheet" :shareTitle="goods.goods_name" :shareImageUrl="goods.goods_image" :posterApiCall="posterApiCall"
:posterApiParam="{ goodsId }" />
</view>
</template>
<script>
import WxofficialMixin from '@/core/mixins/wxofficial'
import { getSceneData } from '@/core/app'
import * as GoodsApi from '@/api/goods'
import * as CartApi from '@/api/cart'
import SettingModel from '@/common/model/Setting'
import { GoodsTypeEnum } from '@/common/enum/goods'
import Recommended from '@/components/recommended'
import ShareSheet from '@/components/share-sheet'
import CustomerBtn from '@/components/customer-btn'
import SlideImage from './components/SlideImage'
import SkuPopup from './components/SkuPopup'
import Comment from './components/Comment'
import Service from './components/Service'
export default {
components: {
Recommended,
ShareSheet,
CustomerBtn,
SlideImage,
SkuPopup,
Comment,
Service
},
mixins: [WxofficialMixin],
data() {
return {
//
isLoading: true,
// ID
goodsId: null,
//
goods: {},
//
cartTotal: 0,
// /SKU
showSkuPopup: false,
// 1: 2: 3:
skuMode: 1,
// /
showShareSheet: false,
// api
posterApiCall: GoodsApi.poster,
//
isEnableCart: false,
// 线
isShowCustomerBtn: false,
}
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(options) {
// query
this.onRecordQuery(options)
//
this.onRefreshPage()
// 线
this.isShowCustomerBtn = await SettingModel.isShowCustomerBtn()
},
methods: {
// query
onRecordQuery(query) {
const scene = getSceneData(query)
this.goodsId = query.goodsId ? parseInt(query.goodsId) : parseInt(scene.gid)
},
//
onRefreshPage() {
const app = this
app.isLoading = true
Promise.all([app.getGoodsDetail(), app.getCartTotal()])
.then(() => app.setWxofficialShareData())
.finally(() => app.isLoading = false)
},
//
getGoodsDetail() {
const app = this
return new Promise((resolve, reject) => {
GoodsApi.detail(app.goodsId)
.then(result => {
app.goods = result.data.detail
if (app.goods.goods_type == GoodsTypeEnum.PHYSICAL.value) {
app.isEnableCart = true
}
resolve(result)
})
.catch(reject)
})
},
//
getCartTotal() {
const app = this
return new Promise((resolve, reject) => {
CartApi.total()
.then(result => {
app.cartTotal = result.data.cartTotal
resolve(result)
})
.catch(reject)
})
},
//
onAddCart(total) {
this.cartTotal = total
},
/**
* 显示/隐藏SKU弹窗
* @param {skuMode} 模式 1:都显示 2:只显示购物车 3:只显示立即购买
*/
onShowSkuPopup(skuMode = 1) {
const app = this
if (app.isEnableCart) {
app.skuMode = skuMode
} else {
app.skuMode = 3
}
app.showSkuPopup = !app.showSkuPopup
},
//
onShowShareSheet() {
this.showShareSheet = !this.showShareSheet
},
//
onTargetHome(e) {
this.$navTo('pages/index/index')
},
//
onTargetCart() {
this.$navTo('pages/cart/index')
},
//
setWxofficialShareData() {
const { goods } = this
this.updateShareCardData({
title: goods.goods_name,
desc: goods.selling_point,
imgUrl: goods.goods_image
})
},
},
/**
* 分享当前页面
*/
onShareAppMessage() {
const app = this
//
const params = app.$getShareUrlParams({
goodsId: app.goodsId,
})
return {
title: app.goods.goods_name,
path: `/pages/goods/detail?${params}`
}
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
const app = this
//
const params = app.$getShareUrlParams({
goodsId: app.goodsId,
})
return {
title: app.goods.goods_name,
path: `/pages/goods/detail?${params}`
}
}
}
</script>
<style>
page {
background: #fafafa;
}
</style>
<style lang="scss" scoped>
@import "./detail.scss";
</style>

File diff suppressed because it is too large Load Diff

@ -1,7 +1,7 @@
<template>
<view class="container" :style="appThemeStyle">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }" @down="downCallback" :up="upOption"
@up="upCallback">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ native: true }"
@down="downCallback" :up="upOption" @up="upCallback">
<!-- 页面头部 -->
<view class="header">
<view class="search">
@ -9,8 +9,8 @@
</view>
<!-- 切换列表显示方式 -->
<view class="show-view" @click="handleShowView">
<text class="iconfont icon-view-tile" v-if="showView"></text>
<text class="iconfont icon-view-list" v-else></text>
<!-- <text class="iconfont icon-view-tile" v-if="showView"></text>
<text class="iconfont icon-view-list" v-else></text> -->
</view>
</view>
<!-- 排序标签 -->
@ -21,7 +21,8 @@
<view class="sort-item" :class="{ active: sortType === 'sales' }" @click="handleSortType('sales')">
<text>销量</text>
</view>
<view class="sort-item sort-item-price" :class="{ active: sortType === 'price' }" @click="handleSortType('price')">
<view class="sort-item sort-item-price" :class="{ active: sortType === 'price' }"
@click="handleSortType('price')">
<text>价格</text>
<view class="price-arrow">
<view class="icon up" :class="{ active: sortType === 'price' && !sortPrice }">
@ -32,10 +33,27 @@
</view>
</view>
</view>
<view class="sort-item" :class="{ active: sortType === 'city' }" @click="handleSortType('city')">
<text>同城达</text>
</view>
<view class="show-view btnOpera" @click="handleShowView">
<text class="iconfont icon-view-tile" v-if="showView"></text>
<text class="iconfont icon-view-list" v-else></text>
</view>
</view>
<view class="goodsType">
<scroll-view class="typeList" scroll-x="true" @scroll="scroll" scroll-left="120">
<view v-for="(item,index) in goodsType" :key="index" class="typeItem"
:style="{'color':item.isActive?'#F43B21':'#5A5A5A','background':item.isActive?'#FEF6F6':'#F7F8FA','border':item.isActive?'2rpx solid #F22029':'none'}">
{{item.name}}
</view>
</scroll-view>
</view>
<!-- 商品列表 -->
<view class="goods-list clearfix" :class="['column-' + (showView ? '1' : '2')]">
<view class="goods-item" v-for="(item, index) in list.data" :key="index" @click="onTargetDetail(item.goods_id)">
<view class="goods-item" v-for="(item, index) in list.data" :key="index"
@click="onTargetDetail(item.goods_id)">
<!-- 单列显示 -->
<view v-if="showView" class="dis-flex">
<!-- 商品图片 -->
@ -59,7 +77,8 @@
<!-- 商品价格 -->
<view class="desc-footer">
<text class="price-x">¥{{ item.goods_price_min }}</text>
<text class="price-y col-9" v-if="item.line_price_min > 0">¥{{ item.line_price_min }}</text>
<text class="price-y col-9"
v-if="item.line_price_min > 0">¥{{ item.line_price_min }}</text>
</view>
</view>
</view>
@ -75,10 +94,29 @@
<view class="goods-name">
<text class="twoline-hide">{{ item.goods_name }}</text>
</view>
<view class="shipping">
包邮
</view>
<view class="goodsInfo">
<view class="oneTip tip">
85英寸
</view>
<view class="twoTip tip">
量子电视
</view>
<view class="threeTip tip">
4K电视
</view>
</view>
<!-- 商品价格 -->
<view class="detail-price oneline-hide">
<text class="goods-price f-30 col-m">{{ item.goods_price_min }}</text>
<text v-if="item.line_price_min > 0" class="line-price col-9 f-24">{{ item.line_price_min }}</text>
<text class="goods-price f-30 col-m">{{ item.goods_price_min }} <text
class="delPrice">到手价</text></text>
<text v-if="item.line_price_min > 0"
class="line-price col-9 f-24">{{ item.line_price_min }}</text>
</view>
<view class="evaluate">
200+条评论 99%好评率
</view>
</view>
</view>
@ -92,7 +130,10 @@
import WxofficialMixin from '@/core/mixins/wxofficial'
import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins'
import * as GoodsApi from '@/api/goods'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import {
getEmptyPaginateObj,
getMoreListData
} from '@/core/app'
import Search from '@/components/search'
const pageSize = 15
@ -105,6 +146,22 @@
mixins: [MescrollMixin, WxofficialMixin],
data() {
return {
goodsType: [{
name: '80英寸',
isActive: true,
}, {
name: '75英寸',
isActive: false,
}, {
name: '70英寸',
isActive: false,
}, {
name: '65英寸',
isActive: false,
}, {
name: '60英寸',
isActive: false,
}, ],
showView: false, // (truefalse)
sortType: 'all', //
sortPrice: false, // (true false)
@ -116,7 +173,9 @@
//
auto: true,
// ; 10
page: { size: pageSize },
page: {
size: pageSize
},
// 4
noMoreSize: 4,
}
@ -205,7 +264,9 @@
//
onTargetDetail(goodsId) {
this.$navTo('pages/goods/detail', { goodsId })
this.$navTo('pages/goods/detail', {
goodsId
})
},
/**
@ -226,7 +287,9 @@
//
setWxofficialShareData() {
this.updateShareCardData({ title: '商品列表' })
this.updateShareCardData({
title: '商品列表'
})
},
},
@ -295,7 +358,7 @@
z-index: 99;
.sort-item {
flex-basis: 33.3333%;
flex-basis: 22%;
display: flex;
justify-content: center;
align-items: center;
@ -469,4 +532,93 @@
}
}
}
.btnOpera {
width: 33rpx;
height: 33rpx;
position: relative;
top: 6rpx;
}
.shipping {
width: 44rpx;
height: 24rpx;
background: #FFFFFF;
border-radius: 4rpx 4rpx 4rpx 4rpx;
opacity: 1;
border: 1rpx solid #F21A1C;
font-size: 16rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #F21A1C;
line-height: 24rpx;
text-align: center;
margin: 6rpx 0 12rpx 0;
}
.goodsInfo {
display: flex;
align-items: center;
margin-bottom: 10rpx;
.tip {
height: 28rpx;
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #494949;
line-height: 28rpx;
padding: 0 10rpx;
}
.oneTip {
border-right: 1rpx solid #C9C9C9;
}
.twoTip {
border-right: 1rpx solid #C9C9C9;
}
}
.delPrice {
font-size: 20rpx;
font-weight: 500;
color: #F21A1C;
}
.evaluate {
height: 28rpx;
font-size: 20rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #949494;
line-height: 28rpx;
margin-bottom: 20rpx;
}
.goodsType {
background-color: #fff;
width: 100%;
height: 76rpx;
.typeList {
margin: 0rpx 0 12rpx 36rpx;
white-space: nowrap;
.typeItem {
margin-left: 8rpx;
display: inline-block;
width: 124rpx;
height: 54rpx;
border-radius: 82rpx 82rpx 82rpx 82rpx;
opacity: 1;
// border: 2rpx solid #F22029;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
line-height: 54rpx;
text-align: center;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Loading…
Cancel
Save