| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767 |
- <template>
- <view class="">
- <view class="content" v-cloak>
- <view class="shop-banner">
- <view class="shop-banner" @click="showImg()">
- <swiper class="swiper" :indicator-dots="false" :circular="true" :autoplay="true" :interval="3000"
- :duration="1000" indicator-color="rgba(255, 255, 255, 0.6)" indicator-active-color="#ffffff"
- @change="swiperChange">
- <swiper-item class="swiper-item" v-for="(item,index) in banner" :key="index">
- <image :src="item" mode="aspectFill"></image>
- </swiper-item>
- </swiper>
- <!-- 底部遮罩 -->
- <view class="banner-mask"></view>
- <!-- 数量 -->
- <view class="num-box">{{ activeBanner }}/{{ banner.length }}</view>
- </view>
- </view>
- <!-- 详细信息 -->
- <view class="det-info">
- <view class="price-box">
- <view class="price">
- <text class="label">会员价</text>
- <text class="unit">¥</text>
- <text class="num">{{goosDetail.price}}</text>
- <text class="fs24 color-text2">零售价</text>
- <text class="old">¥{{goosDetail.otPrice}}</text>
- </view>
- <text class="fs24 color-text2">月售{{goosDetail.sales}}件</text>
- </view>
- <view class="name-box">
- {{goosDetail.productName}}
- </view>
- </view>
- </view>
- <view class="guige">
- <view class="safe-box">
- <text class="text">服务</text>
- <view class="box">
- <image class="mr20" src="/static/images/safe.png" mode=""></image>
- <view class="mr30" v-for="(item,index) in serviceList" :key="index">
- <text>{{item}}</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 购买人数、库存 -->
- <view class="det-box">
- <view class="title">图文详情</view>
- <view class="inner">
- <view v-html="goosDetail.description" style="font-size:0"></view>
- </view>
- </view>
- <!-- 底部按钮 -->
- <view class="btn-foot">
- <view class="menu-box">
- </view>
- <view class="btn-box">
- <view class="btn buy" @click="addCart('buy')">{{buyText}}</view>
- </view>
- </view>
- <!-- 选择药品规格弹窗 -->
- <popupBottom ref="popup" :visible.sync="specVisible" title=" " radius="32" maxHeight="800">
- <view class="product-spec">
- <view class="pro-info">
- <view class="img-box">
- <image :src="goosDetail.image ||'/static/images/img.png'" mode="aspectFill"></image>
- </view>
- <view class="info-text">
- <view class="info-title">{{goosDetail.productName}}</view>
- <view class="price">
- <view class="label">会员价</view>
- <text class="unit">¥</text>
- <text class="num">{{ goosDetail.price}}</text>
- </view>
- <view class="desc-box">
- <text class="text">月售{{goosDetail.sales}}件</text>
- </view>
- </view>
- </view>
- <view class="price-num">
- <view class="label">数量</view>
- <u-number-box bgColor="#f3f3f3" v-model="goodsNum" @change="goodsNumChange"></u-number-box>
- </view>
- <view class="sub-btn" @click="submit">确定</view>
- </view>
- </popupBottom>
- </view>
- </template>
- <script>
- import {
- liveGoodsDetail
- } from '@/api/living'
- import {
- liveOrderKey, // 生成订单key
- } from "@/api/order.js"
- import popupBottom from '@/components/px-popup-bottom/px-popup-bottom.vue'
- export default {
- components: {
- popupBottom
- },
- data() {
- return {
- banner: [],
- goodsId: null,
- totalNum: 1,
- orderKey: null,
- type: null,
- liveId: null,
- storeId: null,
- serviceList: ['品质保障', '药师服务', '隐私保护'],
- productId: null,
- goosDetail: {}, //商品详情
- loadding: true,
- buyText: "立即购买",
- goodsNum: 0, //商品选择数量
- attrs: [],
- values: [],
- stores: [],
- storeNames: [],
- storeIdx: 0,
- storeName: "",
- product: {
- price: 0,
- otPrice: 0,
- },
- showModal: false,
- // 当前轮播的图片
- activeBanner: 1,
- // 购物车数量
- cartCount: 0,
- // 规格弹窗
- specVisible: false,
- // // 规格数量
- // specNum: 1,
- config: null,
- showServiceFee: false,
- selectVal: "",
- // 链接带的storeId
- urlStoreId: undefined,
- // 所选店铺
- storeSelectInfo: {},
- // 保存选的规格
- choseSpecSubIndex: 0,
- choseSpecIndex: 0,
- };
- },
- onLoad(options) {
- console.log("商品详情options", options)
- if (options.productId) {
- this.productId = options.productId;
- }
- this.liveId = options.liveId
- this.goodsId = options.goodsId
- if (options.storeId) {
- this.storeId = options.storeId || ""
- } else {
- uni.showToast({
- title: "storeId不存在~",
- icon: "none"
- })
- }
- },
- mounted() {
- this.getliveGoods()
- var userInfo = uni.getStorageSync("userInfo")
- },
- methods: {
- // swiper变化事件
- swiperChange(event) {
- this.activeBanner = event.detail.current + 1
- },
- doAddCart(type) {
- if (this.totalNum == 0) {
- uni.showToast({
- icon: 'none',
- title: "库存不足",
- });
- return;
- }
- var isBuy = type == "buy" ? 1 : 0;
- if (type == "buy") {
- this.getKey()
- } else {
- this.getCartCount()
- uni.showToast({
- icon: 'success',
- title: "添加成功",
- });
- }
- },
-
- // 获得key
- getKey() {
- liveOrderKey().then(res => {
- if (res.code == 200) {
- console.log("下订单的key>>>>", res)
- this.orderKey = res.orderKey
- console.log("key>>>>", this.orderKey)
- uni.navigateTo({
- url: '/pages_shopping/live/confirmCreateOrder?&orderKey=' + this.orderKey +
- '&liveId=' + this.liveId + '&goodsId=' + this.goodsId +
- '&productId=' + this.productId + '&totalNum=' + this
- .totalNum
- })
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- },
- rej => {}
- );
- },
- // 选择商品数量
- goodsNumChange(e) {
- console.log('当前选择商品数量为: ' + e.value)
- this.totalNum = e.value
- },
- // 提交
- submit() {
- this.specVisible = false
- this.doAddCart(this.type);
- },
- // 加入购物车
- addCart(type) {
- this.type = type;
- this.specVisible = true
- },
- // 跳转页面
- navgetTo(url) {
- uni.navigateTo({
- url: url
- })
- },
- // openEditMoney() {
- // this.editShow = true;
- // },
- // cancelEditMoney(){
- // this.editShow = false;
- // },
- //商品详情
- getliveGoods() {
- if (!this.productId) return;
- uni.showLoading({
- title: '加载中'
- });
- liveGoodsDetail(this.productId).then(res => {
- uni.hideLoading()
- if (res.code == 200) {
- // console.log("小黄车 商品详情>>>>", res)
- this.goosDetail = res.data
- this.banner = res.data.sliderImage.split(',');
- // console.log("轮播图",this.banner)
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- },
- rej => {}
- );
- },
- }
- }
- </script>
- <style lang="scss">
- [v-cloak] {
- display: none;
- }
- .content {
- font-family: PingFang SC;
- }
- .shop-banner {
- height: 756rpx;
- background-color: #FFFFFF;
- position: relative;
- .swiper-item {
- box-sizing: border-box;
- position: relative;
- }
- .swiper,
- .swiper-item,
- .swiper-item image {
- width: 100%;
- height: 100%;
- }
- .banner-mask {
- width: 100%;
- height: 44rpx;
- position: absolute;
- left: 0;
- bottom: 0;
- z-index: 9;
- background-size: 20rpx 44rpx;
- background-repeat: repeat-x;
- }
- .num-box {
- width: 80rpx;
- height: 40rpx;
- line-height: 40rpx;
- text-align: center;
- font-size: 24rpx;
- color: #FFFFFF;
- background: rgba(0, 0, 0, .7);
- border-radius: 20rpx;
- position: absolute;
- right: 40rpx;
- bottom: 34rpx;
- z-index: 10;
- }
- .cf-box {
- position: absolute;
- z-index: 10;
- left: 0;
- right: 0;
- top: calc(50% - 200rpx);
- bottom: calc(50% - 200rpx);
- background-color: rgba(0, 0, 0, 0.3);
- backdrop-filter: blur(2rpx);
- /* 背景模糊度 */
- display: flex;
- flex-direction: column;
- flex: 1;
- justify-content: center;
- align-items: center;
- color: #EDEEEF;
- .title {
- font-size: 40rpx;
- font-weight: bold;
- }
- .subTitle {
- font-size: 28rpx;
- font-weight: bold;
- margin-top: 10rpx;
- }
- }
- }
- .guige {
- padding: 24rpx;
- border-radius: 16rpx;
- background: #fff;
- width: auto;
- font-size: 24rpx;
- color: #222426;
- margin: 24rpx;
- .guige-gg {
- .gg-text {
- color: #898E91;
- margin-right: 40rpx;
- }
- }
- .safe-box {
- display: flex;
- align-items: center;
- padding-top: 24rpx;
- font-size: 24rpx;
- color: #222426;
- .text {
- color: #999999;
- margin-right: 40rpx;
- }
- .box {
- display: flex;
- align-items: center;
- image {
- width: 28rpx;
- height: 28rpx;
- margin-right: 10rpx;
- }
- view {
- display: flex;
- align-items: center;
- margin-right: 40rpx;
- &:last-child {
- margin-right: 0;
- image {
- margin-right: 0;
- }
- }
- }
- }
- }
- }
- .det-info {
- background: #FFFFFF;
- padding: 24rpx;
- margin: 24rpx;
- border-radius: 16rpx;
- .price-box {
- display: flex;
- align-items: flex-end;
- justify-content: space-between;
- .price {
- display: flex;
- align-items: flex-end;
- .label {
- font-weight: 500;
- font-size: 24rpx;
- color: #FF5030;
- line-height: 1.3;
- margin-right: 10rpx;
- }
- .unit {
- font-size: 26rpx;
- font-weight: bold;
- color: #FF6633;
- line-height: 1.3;
- }
- .num {
- font-size: 48rpx;
- font-weight: bold;
- color: #FF5030;
- margin-right: 20rpx;
- line-height: 1;
- }
- .old {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 400;
- text-decoration: line-through;
- color: #898E91;
- margin-left: 10rpx;
- line-height: 1.3;
- }
- }
-
- .spec {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- line-height: 36rpx;
- }
- }
- .name-box {
- font-size: 32rpx;
- font-weight: bold;
- color: #111111;
- line-height: 44rpx;
- margin-top: 32rpx;
- .tag {
- display: inline-block;
- padding: 2rpx 8rpx;
- height: 32rpx;
- background: #F5A623;
- border-radius: 4rpx;
- margin-right: 10rpx;
- font-weight: 400;
- font-size: 20rpx;
- color: #FFFFFF;
- line-height: 30rpx;
- float: left;
- margin-top: 7rpx;
- }
- }
- .intro {
- font-size: 26rpx;
- font-weight: 500;
- color: #999999;
- line-height: 36rpx;
- padding: 18rpx 0 23rpx;
- }
- .safe-box {
- display: flex;
- align-items: center;
- padding-top: 24rpx;
- image {
- width: 20rpx;
- height: 24rpx;
- margin-right: 20rpx;
- }
- .text {
- font-size: 22rpx;
- font-weight: 500;
- color: #999999;
- line-height: 1;
- }
- .line {
- width: 1px;
- height: 23rpx;
- background: #EDEEEF;
- margin: 0 20rpx;
- }
- }
- }
- .det-box {
- margin-top: 10rpx;
- background-color: #FFFFFF;
- padding: 24rpx;
- margin: 24rpx 24rpx 175rpx 24rpx;
- border-radius: 16rpx;
- .title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- line-height: 60rpx;
- margin-bottom: 30rpx;
- padding-bottom: 24rpx;
- border-bottom: 1px solid #ECECEC;
- }
- .inner {
- margin-bottom: 100rpx;
- }
- }
- .btn-foot {
- box-sizing: border-box;
- width: 100%;
- height: 151rpx;
- background: #FFFFFF;
- padding: 0 24rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- position: fixed;
- left: 0;
- bottom: 0;
- z-index: 99;
- .menu-box {
- display: flex;
- align-items: center;
- .item {
- display: flex;
- align-items: center;
- flex-direction: column;
- margin-right: 48rpx;
- &:last-child {
- margin-right: 0;
- }
- image {
- width: 40rpx;
- height: 40rpx;
- margin-bottom: 10rpx;
- }
- .label {
- font-size: 20rpx;
- font-weight: 500;
- color: #626468;
- text-align: center;
- }
- }
- }
- .btn-box {
- display: flex;
- align-items: center;
- .btn {
- width: 200rpx;
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- border-radius: 44rpx;
- margin-left: 20rpx;
- font-size: 28rpx;
- font-weight: bold;
- color: #FFFFFF;
- &:first-child {
- margin-left: 0;
- }
- &.cart {
- background: #FF5030;
- }
- &.buy {
- background: #2bc7b9;
- }
- }
- }
- }
- .product-spec {
- padding-bottom: 30rpx;
- .pro-info {
- display: flex;
- align-items: center;
- .img-box {
- width: 200rpx;
- height: 200rpx;
- background: #FFFFFF;
- border-radius: 16rpx;
- overflow: hidden;
- margin-right: 30rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .info-text {
- height: 200rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .info-title {
- font-family: PingFang SC;
- font-weight: 600;
- font-size: 28rpx;
- color: #222426;
- text-align: left;
- }
- .price {
- display: flex;
- align-items: flex-end;
- .label {
- font-weight: 500;
- font-size: 24rpx;
- color: #FF5030;
- line-height: 1.3;
- margin-right: 10rpx;
- }
- .unit {
- font-size: 32rpx;
- font-weight: bold;
- color: #FF6633;
- line-height: 1.2;
- margin-right: 10rpx;
- }
- .num {
- font-size: 50rpx;
- font-weight: bold;
- color: #FF6633;
- line-height: 1;
- }
- }
- .desc-box {
- display: flex;
- flex-direction: column;
- padding-bottom: 9rpx;
- .text {
- font-size: 26rpx;
- font-weight: 500;
- color: #999999;
- margin-top: 27rpx;
- line-height: 1;
- &:first-child {
- margin-top: 0;
- }
- }
- }
- }
- }
- .price-num {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-top: 30rpx;
- .label {
- font-size: 36rpx;
- font-weight: bold;
- color: #111111;
- }
- }
- .sub-btn {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- font-size: 32rpx;
- font-weight: bold;
- color: #FFFFFF;
- background: #2BC7B9;
- border-radius: 44rpx;
- margin-top: 30rpx;
- }
- }
- .loadding {
- background-color: #fff;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- z-index: 9999;
- image {
- border-radius: 50%;
- animation: load linear 1s infinite;
- width: 120rpx;
- height: 120rpx;
- }
- .text {
- font-size: 28rpx;
- margin-top: 20rpx;
- }
- }
- </style>
|