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.
yanzong_qianduan/pages/goods/detail.vue

2003 lines
45 KiB

9 months ago
<template>
<view class="detail">
<u-navbar>
<view class="slot-wrap">
9 months ago
<image style="width: 50rpx; height: 50rpx;" @click="goHome()" :src="$picUrl+'/static/detail/home.png'">
</image>
<view class="search">
<input type="text" @click="toSearch()" disabled placeholder="iPhone15" class="searInput" />
9 months ago
</view>
</view>
</u-navbar>
<view class="head">
<view class="share" @click="shareImg()">
<view class="sp"></view>
<image :src="$picUrl+'/static/detail/share.png'" class="shareIcon" @click="shareImg"></image>
<button open-type="share"></button>
</view>
<view class="swiper">
<swiper class="swiper" :circular="true" autoplay @change="changeSwiper">
<swiper-item v-for="(item,index) in goods.goods_images1" :key="index" @click="previewImage(index)">
<image :src="item" class="goodsImg"></image>
</swiper-item>
</swiper>
9 months ago
<view class="dots" v-if="goods.goods_images && goods.goods_images.length> 0">
9 months ago
{{(currenIndex+1)+"/"+goods.goods_images.length}}
</view>
9 months ago
</view>
</view>
<view class="goodsInfo">
<view class="goodsPrice">
<view class="left">
<view class="leftPrice">
<text></text>{{goods.goods_price_min}}
</view>
<view class="sellPrice" v-if="goods.goods_price_min_dealer">
<text
class="sellLeft">分销价</text>{{goods.goods_price_min_dealer?goods.goods_price_min_dealer:0}}
10 months ago
</view>
<view class="sellPrice" v-if="goods.goods_price_min_plus">
<text class="sellLeft">会员价</text>{{goods.goods_price_min_plus?goods.goods_price_min_plus:0}}
9 months ago
</view>
</view>
<view class="right">
<view class="rightPrice">
{{goods.line_price_min}}
</view>
<view class="rightInfo">
<image :src="$picUrl+'/static/detail/jiangjia.png'"></image>
</view>
</view>
</view>
<view class="pro" v-if="isLogin || userInfo.user_type==10">
<view class="proMem">
<text v-if="userInfo.user_type==10">Plus</text>
<text v-if="userInfo.user_type==20">分销</text>
PRO会员
</view>
<view class="proInfo">
开通<text v-if="userInfo.user_type==10">Plus</text>
<text v-if="userInfo.user_type==20">分销</text>会员预计再省<text style="color: #FF1D1D;">30</text>
</view>
<view class="proBtn" @click="goMember()">
立即开通
</view>
</view>
<view class="goodsDetail">
<view class="goodsName">
{{goods.goods_name}}
</view>
<view class="goodsOpera">
<view class="goodsNum" @click="copyNum(goods.skuList[0].goods_sku_id)"
v-if="goods.specList && goods.specList.length>0">
<text>{{goods.skuList[0].goods_sku_id}}</text>
<image :src="$picUrl+'/static/detail/copy.png'"></image>
</view>
<view class="goodsNum" @click="copyNum(goods.goods_id)" v-else>
<text>{{goods.goods_id}}</text>
<image :src="$picUrl+'/static/detail/copy.png'"></image>
9 months ago
</view>
<view class="operaImg">
<image :src="$picUrl+'/static/detail/miaosha.png'" v-if="isSeckill" class="tips"></image>
<image :src="$picUrl+'/static/detail/tip.png'" @click="toJDdetal(goods.goods_id)" class="tips">
</image>
<!-- <image :src="$picUrl+'/static/detail/ys.png'" class="tips"></image> -->
</view>
</view>
<view class="rank" @click="goRanking()" v-if="goods && goods.category">
<text>排行榜 {{goods.category.name}}热搜榜第{{goods.paihang}}</text>
<image :src="$picUrl+'/static/detail/rightIcon.png'"></image>
</view>
</view>
</view>
<view class="orderInfo">
10 months ago
<!-- <template v-if="userInfo.user_type == 40">
<view class="chosed" v-if="goods.spec_type == 20">
<view class="title">已选</view>
<view class="info" style="justify-content: flex-start;" v-if="goods.skuList.length>0">
<text v-for="(a,idx) in goods.skuList[0].goods_props" :key="idx" style="margin-right: 10rpx;">{{a.group.name}}{{a.value.name}}</text>1件
</view>
<u-icon name="arrow-right" color="#7C7C7C"></u-icon>
</view>
<view class="chosed" v-else>
<view class="title">已选</view>
<view class="info">1</view>
<u-icon name="arrow-right" color="#7C7C7C"></u-icon>
</view>
9 months ago
</template> -->
<view class="chosed" v-if="goods.skuList && goods.skuList.length > 0 && goods.skuList[0].stock_num > 0">
<view class="title">送至</view>
<view class="info">
<view class="infoLeft">
现货
<image :src="$picUrl+'/static/detail/rightIcon.png'"></image>
</view>
9 months ago
<view class="box" @click="choseAddress()">
<view class="address">
{{addressInfo.region?addressInfo.region.province +'-'+addressInfo.region.city+'-'+addressInfo.region.region:'全国'}}
</view>
<u-icon name="arrow-right" color="#7C7C7C"></u-icon>
9 months ago
</view>
</view>
</view>
<view class="chosed">
<view class="serve">
<view class="serveInfo">
9 months ago
商家
9 months ago
</view>
</view>
<view class="box" @click="toFuwu()">
<view class="business">
<view class="busSour">
<text>商家来源平台认证商户</text>
</view>
<view class="busSour">
<text>商家名称{{cityInfo.shop_name}}</text>
</view>
</view>
<u-icon name="arrow-right" style="float: right;" color="#7C7C7C"></u-icon>
9 months ago
</view>
</view>
<view class="chosed" v-if="serveList.length>0">
<view class="title">服务</view>
<view class="info">
<image :src="$picUrl+'/static/detail/buy.png'" class="buy"></image>
9 months ago
<text class="li" v-for="(item,index) in serveList" :key="index"
style="margin-right: 5rpx;">{{item.name}}</text>
</view>
</view>
<view class="chosed" v-else>
<view class="title">服务</view>
<view class="info">
<image :src="$picUrl+'/static/detail/buy.png'" class="buy"></image>
<text class="li" style="margin-right: 5rpx;">正品保障</text>
<text class="li" style="margin-right: 5rpx;">全程跟踪</text>
</view>
9 months ago
</view>
</view>
<view class="about">
<view class="aboutHead">
<view class="aboutSuggest">
相关推荐
</view>
<!-- <view class="more">
查看更多
</view> -->
</view>
<view class="goodsList">
<view class="goodsItem" v-for="(item,index) in suggestGoodsList" :key="index"
@click="toDetail(item.goods_id)">
<view class="img">
<image :src="item.goods_image" mode="" class="goodsImg"></image>
</view>
<view class="goodsName ">
{{item.goods_name}}
</view>
<view class="price">
<text>{{item.goods_price_min}}</text>
</view>
</view>
</view>
</view>
<view class="detail-content" v-html="goods.content"></view>
<view class="footer">
<view class="fooLeft">
<view class="footerCus firstBtn" v-if="isLogin == false" @click="addCar()">
<view class="cusIcon">
<image src="/static/detail/customer.png"></image>
</view>
<view class="customer">
客服
</view>
</view>
<view class="footerCus firstBtn" v-else>
<view class="cusIcon">
<image src="/static/detail/customer.png"></image>
</view>
<view class="customer">
客服
</view>
<button open-type="contact"></button>
9 months ago
</view>
9 months ago
<view class="footerCus " style="position: relative;" @click="shoppingCart()">
<view v-if="cartTotal > 0" class="uni-tabbar__badge">
{{ cartTotal > 99 ? '99+' : cartTotal }}
</view>
9 months ago
<view class="cusIcon">
<image src="/static/detail/car.png" mode=""></image>
</view>
<view class="customer car">
购物车
</view>
</view>
</view>
9 months ago
<view class="fooRight" v-if="isLogin && userInfo.user_type == 40">
<template v-if="goods.status == 20">
<view class="btn-bg">
已下架
</view>
</template>
9 months ago
<template v-else>
9 months ago
<view class="btn-bg" v-if="goods.spec_type == 20" style="background-color: #FF1D1D;"
9 months ago
@click="choseSku(3)">
10 months ago
修改价格
9 months ago
</view>
10 months ago
<view class="btn-bg" v-else style="background-color: #FF1D1D;" @click="openPirce(1)">
修改价格
</view>
9 months ago
<view class="btn-bg" style="background-color: #FF1D1D;margin-left:40rpx;" @click="setPirce()">
设置秒杀价
</view>
9 months ago
</template>
</view>
<view class="fooRight" v-else>
9 months ago
<template v-if="goods.status == 20">
<view class="btn-bg">
已下架
</view>
</template>
<template v-else>
<template v-if="goods.skuList && goods.skuList.length > 0 && goods.skuList[0].stock_num == 0">
10 months ago
<view class="btn-bg">
9 months ago
暂无库存
10 months ago
</view>
</template>
<template v-else>
9 months ago
<template v-if="!isPre">
<template v-if="isSeckill">
<template v-if="isBuy">
<template v-if="seckillText=='距离'">
<view class="addCar" @click="choseSku(2)">
加入购物车
</view>
<view class="buyNow" @click="choseSku(3)">
立即购买
</view>
</template>
<template v-else>
<view class="btn-bg">
9 months ago
未到时间
</view>
</template>
</template>
<template v-else>
9 months ago
<view class="btn-bg">
已下架
</view>
</template>
</template>
9 months ago
<template v-else>
<view class="addCar" @click="choseSku(2)">
加入购物车
</view>
9 months ago
<view class="buyNow" @click="choseSku(3)">
立即购买
</view>
</template>
</template>
9 months ago
<template v-if="isPre">
<view class="buyNow" @click="onReservation()" v-if="isBuy > 0">
立即预约
</view>
<view class="btn-bg" v-else>
已失效
</view>
</template>
10 months ago
</template>
9 months ago
</template>
</view>
</view>
<view class="dia" v-if="openDialog">
<view class="preSuc" v-if="shareType=='pre'">
<view class="preImg">
<image src="../../static/order/ld.png" mode="" class="ldImg"></image>
</view>
<view class="preTitle">
预约成功
</view>
<view class="iKnow" @click="onKonw">
查看预约记录
</view>
</view>
<view class="setMs" v-if="shareType=='setPrice'">
<view class="msprice">
设置商品价格
</view>
<view class="msLine">
<u-line class="u-line"></u-line>
</view>
<view class="msp">
10 months ago
<text>原价格:</text>
10 months ago
<input type="text" disabled v-model="selectShop.price" class="inp" />
</view>
<view class="msp">
10 months ago
<text>商品价格:</text>
<input type="text" v-model="max_price" placeholder="商品价格" class="inp" />
</view>
<view class="msp">
10 months ago
<text>划线价格:</text>
<input type="text" v-model="markup_rate" placeholder="划线价格" class="inp" />
</view>
<!-- <view class="qj">
<text class="msQj">秒杀区间:</text>
<view class="date">
<view class="beginTime timeCommn">
开始时间
</view>
-
<view class="timeCommn endTime">
结束时间
</view>
</view>
</view> -->
<!-- <view class="msLimit">
<text>秒杀限购:</text>
<switch @change="switch1Change" />
</view>
<view class="peoLimit">
<text>每人限购</text>
<view class="num">
1
</view>
<text></text>
</view> -->
<view class="operaBtn">
10 months ago
<view class="cancel btnComm" @click="shareCancel(1)">
取消
</view>
<view class="sureBtn btnComm" @click="toUnpdatePrice()">
确定
</view>
</view>
9 months ago
</view>
<!-- <view class="setMs" v-if="shareType=='setPrice'">
<view class="msprice">
设置秒杀价格
</view>
<view class="msLine">
<u-line class="u-line"></u-line>
</view>
<view class="msp">
<text>秒杀价:</text>
<input type="text" placeholder="秒杀价格可低于成本价" class="inp" />
</view>
<view class="qj">
<text class="msQj">秒杀区间:</text>
<view class="date">
<view class="beginTime timeCommn">
开始时间
</view>
-
<view class="timeCommn endTime">
结束时间
</view>
</view>
</view>
<view class="msLimit">
<text>秒杀限购:</text>
<switch @change="switch1Change" />
</view>
<view class="peoLimit">
<text>每人限购</text>
<view class="num">
1
</view>
<text></text>
</view>
<view class="operaBtn">
<view class="cancel btnComm">
取消
</view>
<view class="sureBtn btnComm">
确定
</view>
</view>
</view> -->
9 months ago
<!-- -->
<view class="shareWechat" v-if="shareType=='share'">
<view class="shareGoods">
<image :src="goods.goods_image" mode="" class="shareImg"></image>
</view>
<view class="shareInfo">
<view class="shareGoodsInfo">
{{goods.goods_name}}
</view>
<view class="sharePrice">
{{goods.goods_price_min}}
</view>
</view>
<view class="shareOpera">
<view class="operaItem" @click="toHaibao(2)">
<view class="imgIcon">
<u-icon name="order" class="iconIm"></u-icon>
</view>
<view class="shareText">
复制文案
</view>
</view>
<view class="operaItem">
<view class="imgIcon weChatIcon">
<u-icon name="order" class="iconIm"></u-icon>
</view>
<view class="shareText">微信好友
<button open-type="share" @click="shareWechat"></button>
</view>
</view>
<view class="operaItem" @click="toHaibao(1)">
<view class="imgIcon hb">
<u-icon name="order" class="iconIm"></u-icon>
</view>
<view class="shareText">
生成海报
</view>
</view>
</view>
<view class="shareCancel" @click="shareCancel(1)">
取消
</view>
</view>
</view>
<view class="toTop" v-if="isTop" @click="openScrollTo()">
<image :src="$picUrl+'/static/toTop.png'"></image>
9 months ago
</view>
10 months ago
<view v-if="isTodo">
<SkuPopup v-model="showSkuPopup" :skuMode="skuMode" :goods="goods" @addCart="onAddCart" />
</view>
9 months ago
<setPrice ref="setRange" @getprice="getprice" />
10 months ago
<!-- 海报图弹层 -->
9 months ago
<goods-poster-popup v-model="showGoodsPosterPopup" :apiCall="posterApiCall" :apiParam="{goodsId}" />
</view>
</template>
<script>
import GoodsPosterPopup from '@/components/goods-poster-popup'
import * as GoodsApi from '@/api/goods'
import * as goodsCar from '@/api/cart.js'
import SkuPopup from './components/SkuPopup'
9 months ago
import setPrice from './components/setPrice'
9 months ago
import * as address from '@/api/address.js'
9 months ago
import * as CartApi from '@/api/cart'
9 months ago
export default {
components: {
SkuPopup,
9 months ago
GoodsPosterPopup,
setPrice
9 months ago
},
data() {
return {
10 months ago
isTodo: true,
result: {},
max_price: "",
markup_rate: "",
10 months ago
showGoodsPosterPopup: false,
cityInfo: {},
currenIndex: 0,
9 months ago
isTop: false,
skuMode: 1,
goodShow: false,
showSkuPopup: false,
allPicture: '',
keyword: '',
// 模式 1:都显示 2:只显示购物车 3:只显示立即购买
9 months ago
skuMode: 1,
diaShow: false,
searchValue: '',
isPre: false, //是否预售
pre_id: '', //预售id
9 months ago
isBuy: "", //是否购买
isSeckill: false, //是否秒杀
seckillText: "", //是否秒杀
setPrice: false,
openDialog: false,
goodsId: '',
goods: {
skuList: []
},
suggestGoodsList: [],
userInfo: {},
addressList: [],
addressInfo: {},
serveList: [],
10 months ago
isLogin: false,
10 months ago
selectShop: {},
10 months ago
// 获取商品海报图api方法
9 months ago
posterApiCall: GoodsApi.poster,
9 months ago
// 购物车总数量
cartTotal: 0,
9 months ago
}
},
10 months ago
onLoad(options) {
9 months ago
const that = this;
console.log(options, "oo")
this.isPre = options.isPre ? options.isPre : null
this.goodsId = options.goodsId ? options.goodsId : null
this.pre_id = options.pre_id ? options.pre_id : null;
this.isSeckill = options.isSeckill ? options.isSeckill : null;
this.isBuy = options.isBuy ? decodeURIComponent(options.isBuy) : null;
this.seckillText = options.seckillText ? decodeURIComponent(options.seckillText) : null;
console.log(this.isBuy)
this.getSuggestGoods()
this.getServeList()
this.getGoodsDetail()
10 months ago
this.cityInfo = uni.getStorageSync("cityInfo");
9 months ago
this.getCartTotal()
9 months ago
uni.$on("onenPrice", function(selectShop) {
10 months ago
that.openPirce();
that.isTodo = false;
that.selectShop = selectShop
9 months ago
that.selectShop.price = that.selectShop.price / 100
})
},
onShow() {
if (uni.getStorageSync('AccessToken')) {
this.getAddressList()
9 months ago
this.isLogin = true;
this.userInfo = uni.getStorageSync('userInfo');
} else {
this.isLogin = false;
this.userInfo = {}
}
},
onPageScroll(e) {
9 months ago
if (e.scrollTop <= 200) { // 当滚动到顶部且向下滑动时为true
this.isTop = false
} else {
this.isTop = true
9 months ago
}
},
methods: {
9 months ago
getprice(e) {
console.log(e)
GoodsApi.editGoodsPrice(params).then(res => {
if (res.status == 200) {
that.$toast("设置成功");
this.$refs.setRange.afterSale = false;
setTimeout(() => {
// that.getGoodsDetail(1);
}, 500)
}
})
.catch()
},
setPirce() {
console.log(this.$refs.setRange)
this.$refs.setRange.afterSale = true;
},
// 获取购物车总数量
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.getCartTotal()
},
//修改商品价格
9 months ago
async toUnpdatePrice() {
const that = this;
9 months ago
if (!that.max_price) {
uni.showToast({
icon: "none",
10 months ago
title: "商品价格不能为空!"
})
9 months ago
return;
}
9 months ago
if (!that.markup_rate) {
uni.showToast({
icon: "none",
10 months ago
title: "划线价格不能为空!"
})
9 months ago
return;
}
10 months ago
let sku_id = ""
9 months ago
if (that.goods.spec_type == 20) {
10 months ago
sku_id = that.goods.skuList[0].id
}
9 months ago
let params = {
id: that.goods.goods_id,
10 months ago
goods_price: that.max_price,
line_price: that.markup_rate,
10 months ago
sku_id: sku_id.toString()
}
10 months ago
GoodsApi.editGoodsPrice(params).then(res => {
if (res.status == 200) {
that.$toast("修改成功");
9 months ago
setTimeout(() => {
10 months ago
that.getGoodsDetail(1);
9 months ago
}, 500)
}
})
.catch()
},
//跳转京东小程序详情
toJDdetal(sku) {
wx.navigateToMiniProgram({
9 months ago
appId: 'wx91d27dbf599dff74',
path: '/pages/item/detail/detail?sku=' + sku,
envVersion: 'release',
success(res) {
// 打开成功
9 months ago
console.log(res);
}
9 months ago
})
},
//修改价格
10 months ago
openPirce(type) {
9 months ago
this.openDialog = true;
this.shareType = 'setPrice'
if (type == 1) {
10 months ago
this.selectShop = {}
this.selectShop.price = this.goods.goods_price_max;
}
},
//门店图片预览
9 months ago
previewImage(i) {
uni.previewImage({
current: this.goods.goods_images1[i],
urls: this.goods.goods_images1
})
},
//监听滚动
9 months ago
changeSwiper(e) {
this.currenIndex = e.detail.current
},
9 months ago
openScrollTo() {
uni.pageScrollTo({
scrollTop: 0
9 months ago
})
},
shareImg() {
this.openDialog = true
this.shareType = 'share'
},
//立即预约
preNow() {
const that = this
let params = {
goods_id: that.goods.goods_id,
pre_id: 1
}
GoodsApi.presale(params).then(res => {
if (res.status == 200) {
that.$toast(res.message)
}
})
.catch()
},
getServeList() {
const that = this
let params = {
goodsId: that.goodsId
}
return new Promise((resolve, reject) => {
GoodsApi.serveList(params).then(res => {
if (res.status == 200) {
that.serveList = res.data.list
}
})
.catch()
})
},
// 预约成功去列表
onKonw() {
uni.navigateTo({
url: '/pages/news/park/recordHistory'
})
},
9 months ago
async onReservation() {
let {
status,
message,
data
} = await GoodsApi.presale({
goods_id: this.goodsId,
pre_id: this.pre_id
});
10 months ago
if (status == 200) {
9 months ago
this.shareType = 'pre';
this.openDialog = true
this.diaShow = true
}
},
9 months ago
// 选择商品规格
getAddressList() {
const that = this
return new Promise((resolve, reject) => {
address.list().then(res => {
if (res.status == 200) {
that.addressList = res.data.list
if (res.data.list && res.data.list.length > 0) {
console.log(1111)
that.getDefaultAddress()
} else {
console.log(222)
}
}
})
.catch()
})
},
//获取收货地址
getDefaultAddress() {
console.log('5855555')
const that = this
return new Promise((resolve, reject) => {
address.defaultId().then(res => {
if (res.status == 200) {
for (var i = 0; i < that.addressList.length; i++) {
if (res.data.defaultId == that.addressList[i].address_id) {
that.addressInfo = that.addressList[i];
console.log(that.addressInfo, '获取地址')
}
}
}
})
.catch()
})
},
//选择地址
choseAddress() {
9 months ago
if (!uni.getStorageSync("AccessToken")) {
uni.navigateTo({
url: "/pages/login/index"
})
9 months ago
return;
}
9 months ago
if (this.addressList && this.addressList.length > 0) {
uni.navigateTo({
url: '/pages/address/index'
})
9 months ago
} else {
uni.navigateTo({
url: '/pages/address/create'
})
}
9 months ago
},
toSearch() {
uni.navigateTo({
url: "/pages/search/index"
})
},
// 更新购物车数量
onAddCart(total) {
9 months ago
console.log(total)
},
choseSku(skuMode) {
10 months ago
console.log(this.goods)
9 months ago
if (!uni.getStorageSync("AccessToken")) {
uni.navigateTo({
url: "/pages/login/index"
})
9 months ago
return;
}
9 months ago
this.skuMode = skuMode
this.showSkuPopup = true
},
copyNum(msg) {
uni.setClipboardData({
9 months ago
data: (typeof msg == 'number') ? msg.toString() : msg, // 这里是个坑接受字符串类型 value转化为字符串
9 months ago
success: function() {
9 months ago
//调用方法成功
uni.showToast({
title: '复制成功',
icon: 'none',
duration: 2000
})
}
9 months ago
})
9 months ago
},
// 获取商品信息
getGoodsDetail(type) {
const that = this
return new Promise((resolve, reject) => {
GoodsApi.detail(this.goodsId)
.then(result => {
let info = result.data.detail;
10 months ago
that.goods.skuList = [];
that.godds = {}
info.goods_images1 = []
9 months ago
if (info.goods_images && info.goods_images.length > 0) {
info.goods_images.map(a => {
info.goods_images1.push(a.preview_url)
})
9 months ago
}
info.content = info.content
.replace(/style=""/g, '')
.replace(/<img src=/g, '<img style="width: 100%; display:block" src=')
10 months ago
// that.goods = info;
9 months ago
Object.keys(info).forEach(item => {
this.$set(this.goods, item, info[item])
10 months ago
// that.goods[item] = info[item]
9 months ago
})
10 months ago
that.allPicture = info.goods_images.length;
9 months ago
if (type == 1) {
10 months ago
that.selectShop = {}
that.max_price = ""
that.markup_rate = ""
that.shareCancel();
9 months ago
}
})
.catch()
})
},
getSuggestGoods() {
// 获取推荐商品列表
const that = this
GoodsApi.recommended()
.then(result => {
console.log(result, '获取推荐商品列表')
let arr = result.data.goodsList
9 months ago
if (arr && arr.length > 0) {
arr.map(a => {
a.goods_price_min = Number(a.goods_price_min)
a.goods_price_max = Number(a.goods_price_max)
a.line_price_min = Number(a.line_price_min)
a.line_price_max = Number(a.line_price_max)
})
9 months ago
}
that.suggestGoodsList = arr
})
.catch()
},
goHome() {
uni.switchTab({
url: '/pages/index/index'
})
},
toDetail(goods_id) {
uni.navigateTo({
url: '/pages/goods/detail?goodsId=' + goods_id
})
9 months ago
},
goRanking() {
// 跳转排行榜
uni.navigateTo({
url: '/pages/activity/ranking'
})
},
goMember() {
if (!uni.getStorageSync("AccessToken")) {
uni.navigateTo({
url: "/pages/login/index"
})
return;
}
uni.navigateTo({
url: '/pages/member/index'
})
},
toFuwu() {
uni.navigateTo({
url: "/pages/news/consult/about"
})
9 months ago
},
shoppingCart() {
// 购物车
uni.switchTab({
url: '/pages/cart/index'
})
},
addCar() {
if (!uni.getStorageSync("AccessToken")) {
uni.navigateTo({
url: "/pages/login/index"
})
return;
}
// 加入购物车
const that = this
goodsCar.add(that.goods.goods_id, (that.goods.skuList && that.goods.skuList.length > 0 ? that.goods
.skuList[0].goods_sku_id : ''), that.goods.spec_type == 20 ? 1 : 1)
.then(res => {
if (res.status == 200) {
that.$toast(res.message)
}
})
.catch()
},
buyNow() {
if (!uni.getStorageSync("AccessToken")) {
uni.navigateTo({
url: "/pages/login/index"
})
return;
}
// 立即下单
console.log(this.token, '登录信息')
if (this.goods.stock_total == 0) {
return this.$toast('库存不足,请选择其他商品购买')
}
const item = JSON.stringify(this.goods)
uni.navigateTo({
url: '/pages/sureOrder/index?goodsID=' + encodeURIComponent(item)
})
},
shareCancel() {
10 months ago
this.shareType = "";
10 months ago
this.isTodo = true;
9 months ago
this.openDialog = false;
10 months ago
},
9 months ago
toHaibao(index) {
10 months ago
this.shareCancel();
9 months ago
if (index == 2) {
10 months ago
uni.setClipboardData({
data: this.goods.goods_name,
success() {
uni.getClipboardData({
success() {
uni.showToast({
icon: "none",
title: "复制成功"
})
}
})
}
})
9 months ago
} else {
10 months ago
this.openDialog = false
this.showGoodsPosterPopup = true;
}
9 months ago
},
},
/**
* 分享当前页面
*/
onShareAppMessage() {
9 months ago
const app = this
// 构建页面参数
const params = app.$getShareUrlParams({
goodsId: app.goodsId,
})
return {
title: app.goods.goods_name,
imageUrl: app.goods.goods_image,
path: `/pages/goods/detail?${params}`
}
},
9 months ago
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
9 months ago
const app = this
return {
title: app.goods.goods_name,
imageUrl: app.goods.goods_image,
path: `/pages/goods/detail?goodsId=${app.goodsId}`
}
}
9 months ago
}
</script>
<style lang="scss" scoped>
.detail {
width: 100%;
height: 100%;
9 months ago
padding-bottom: 150rpx;
.toTop {
position: fixed;
bottom: 230rpx;
right: 32rpx;
width: 47px;
height: 47px;
background: #FFFFFF;
border-radius: 50%;
z-index: 19;
display: flex;
align-items: center;
justify-content: center;
9 months ago
image {
width: 25px;
height: 25px;
}
9 months ago
}
&-content {
padding: 30rpx;
font-size: 26rpx;
line-height: 50rpx;
width: 710rpx;
margin: 0 auto;
margin-top: 30rpx;
background-color: #fff;
box-sizing: border-box;
}
}
.slot-wrap {
width: 100%;
display: flex;
align-items: center;
9 months ago
justify-content: space-between;
.search {
width: 400rpx;
height: 58rpx;
border-radius: 60rpx;
background-color: #F3F3F3;
display: flex;
align-items: center;
padding-left: 20rpx;
box-sizing: border-box;
margin: 0 20rpx;
9 months ago
}
}
.search {
display: flex;
align-items: center;
.icon {
width: 34rpx;
height: 38rpx;
margin: 0 22rpx 0 76rpx;
}
.searInput {
width: 428rpx;
height: 58rpx;
background: #F3F3F3;
border-radius: 60rpx 60rpx 60rpx 60rpx;
opacity: 1;
display: flex;
align-items: center;
.seaIcon {
width: 28rpx;
height: 28rpx;
margin: 0 0 0 26rpx;
}
.input {
flex: 1;
padding-left: 20rpx;
}
}
}
.head {
width: 100%;
height: 750rpx;
position: relative;
9 months ago
}
.share {
z-index: 10;
top: 28rpx;
width: 74rpx;
height: 74rpx;
position: absolute;
background-color: rgba(255, 255, 255, 1);
border-radius: 50%;
9 months ago
text-align: center;
right: 28rpx;
.sp {
width: 54rpx;
height: 54rpx;
9 months ago
display: none;
}
9 months ago
.shareIcon {
width: 54rpx;
height: 54rpx;
margin-top: 10rpx;
}
}
.swiper {
width: 100%;
height: 750rpx;
opacity: 1;
left: 0;
right: 0;
margin: auto;
.goodsImg {
width: 100%;
height: 100%;
}
.dots {
width: 82rpx;
line-height: 56rpx;
9 months ago
background: rgba(38, 38, 38, 0.85);
position: absolute;
bottom: 20rpx;
right: 0;
9 months ago
z-index: 10;
font-size: 28rpx;
font-weight: 400;
color: #FFFFFF;
text-align: center;
border-radius: 56rpx 0 0 56rpx;
9 months ago
}
}
.goodsInfo {
width: 720rpx;
background: #FFFFFF;
border-radius: 6rpx;
padding-bottom: 30rpx;
9 months ago
overflow: hidden;
margin: 20rpx auto 16rpx;
.goodsPrice {
background-image: url('https://www.royaum.com.cn/static/detail/priceback.png');
width: 720rpx;
height: 136rpx;
background-size: cover;
display: flex;
align-items: center;
justify-content: space-between;
.left {
margin: 0 0 0 28rpx;
.leftPrice {
height: 64rpx;
font-size: 46rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 64rpx;
text {
height: 64rpx;
font-size: 32rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 64rpx;
margin-right: 8rpx;
}
}
.sellPrice {
height: 34rpx;
font-size: 24rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 34rpx;
.sellLeft {
width: 72rpx;
margin-right: 8rpx;
}
}
}
.right {
margin-right: 50rpx;
.rightPrice {
9 months ago
text-align: center;
height: 48rpx;
font-size: 34rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 48rpx;
text-decoration: line-through;
}
.rightInfo {
width: 125rpx;
height: 26rpx;
9 months ago
image {
width: 100%;
height: 100%;
9 months ago
}
}
}
}
.pro {
background-image: url('https://www.royaum.com.cn/static/detail/pro.png');
background-size: 100% 100%;
width: 690rpx;
height: 82rpx;
display: flex;
align-items: center;
margin: 20rpx 0 0 10rpx;
.proMem {
width: 142rpx;
font-size: 28rpx;
font-weight: 500;
color: #966542;
margin-left: 18rpx;
padding-right: 24rpx;
border-right: 2rpx solid #EFD4B4;
}
.proInfo {
width: 304rpx;
font-size: 24rpx;
font-weight: 500;
color: #966542;
margin: 0 38rpx 0 26rpx;
}
.proBtn {
width: 126rpx;
height: 50rpx;
background: #9F744D;
border-radius: 82rpx;
opacity: 1;
text-align: center;
line-height: 50rpx;
font-size: 24rpx;
font-weight: 500;
color: #FFFFFF;
}
}
.goodsDetail {
.goodsName {
width: 672rpx;
font-size: 28rpx;
font-weight: 400;
color: #000000;
line-height: 50rpx;
margin: 28rpx auto 0;
}
.goodsOpera {
margin-left: 28rpx;
display: flex;
justify-content: space-between;
align-items: center;
.goodsNum {
text {
display: inline-block;
font-size: 24rpx;
font-weight: 400;
color: #8A8A8A;
margin-right: 4rpx;
}
image {
width: 28rpx;
height: 28rpx;
vertical-align: middle;
9 months ago
margin-left: 10rpx;
}
}
.operaImg {
margin-right: 34rpx;
image {
width: 49rpx;
height: 49rpx;
}
9 months ago
.tips {
margin-left: 10rpx;
}
}
}
.rank {
width: 670rpx;
height: 58rpx;
background: #FFF3EE;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 28rpx;
box-sizing: border-box;
margin: 16rpx auto 0;
text {
font-size: 24rpx;
font-weight: 400;
color: #FF1130;
line-height: 58rpx;
}
image {
width: 8rpx;
height: 14rpx;
}
}
}
}
.orderInfo {
width: 720rpx;
background: #FFFFFF;
border-radius: 6rpx;
opacity: 1;
margin: 16rpx auto 20rpx;
padding: 25rpx 25rpx 10rpx;
box-sizing: border-box;
.chosed {
display: flex;
align-items: flex-start;
padding-bottom: 18rpx;
9 months ago
overflow: hidden;
.title {
font-size: 24rpx;
font-weight: 400;
color: #C4C4C4;
margin-right: 38rpx;
}
.info {
9 months ago
flex: 1;
font-size: 24rpx;
font-weight: 400;
color: #3D3D3D;
display: flex;
align-items: center;
9 months ago
.buy {
width: 114rpx;
height: 23rpx;
margin-right: 10rpx;
display: block;
9 months ago
}
.infoLeft {
height: 34rpx;
font-size: 24rpx;
font-weight: 400;
color: #FE3636;
line-height: 34rpx;
image {
width: 8rpx;
height: 14rpx;
margin: 0 10rpx 0 8rpx;
}
}
.address {
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #3D3D3D;
line-height: 34rpx;
}
}
.serve {
.serveInfo {
width: 48rpx;
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #C4C4C4;
line-height: 34rpx;
margin-right: 38rpx;
}
.span {
width: 48rpx;
height: 34rpx;
}
}
.box {
display: flex;
align-items: flex-start;
justify-content: space-between;
flex: 1;
9 months ago
}
.business {
.busSour {
height: 40rpx;
font-size: 24rpx;
font-weight: 400;
color: #3D3D3D;
}
.busName {
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #3D3D3D;
line-height: 34rpx;
}
}
}
}
.about {
width: 720rpx;
// height: 730rpx;
background: #FFFFFF;
border-radius: 6rpx 6rpx 6rpx 6rpx;
opacity: 1;
margin: 14rpx 0 0rpx 20rpx;
padding: 24rpx 0 0 36rpx;
.aboutHead {
display: flex;
justify-content: space-between;
.aboutSuggest {
width: 112rpx;
height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #000000;
line-height: 40rpx;
}
.more {
width: 96rpx;
height: 34rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #909090;
line-height: 34rpx;
margin-right: 20rpx;
}
}
.goodsList {
display: flex;
flex-wrap: wrap;
margin-top: 30rpx;
padding-bottom: 20rpx;
overflow: hidden;
.goodsItem {
margin-right: 18rpx;
.img {
width: 204rpx;
height: 168rpx;
background: #FBFBFB;
border-radius: 6rpx 6rpx 6rpx 6rpx;
opacity: 1;
display: flex;
justify-content: center;
align-items: center;
.goodsImg {
width: 190rpx;
height: 144rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 1;
}
}
.goodsName {
width: 184rpx;
height: 80rpx;
font-size: 28rpx;
font-weight: 400;
color: #000000;
line-height: 40rpx;
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
white-space: normal !important;
word-wrap: break-word;
}
.price {
width: 66rpx;
height: 44rpx;
font-size: 24rpx;
font-weight: 500;
color: #ED2B00;
line-height: 38rpx;
9 months ago
text {
font-size: 32rpx;
9 months ago
}
}
}
}
}
.vacancy {
width: 100%;
height: 150rpx;
}
.footer {
position: fixed;
bottom: 0;
width: 100%;
height: 130rpx;
background: #FFFFFF;
box-shadow: -6rpx 14rpx 48rpx 0rpx rgba(0, 0, 0, 0.25);
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 1;
display: flex;
align-items: center;
text-align: center;
justify-content: space-between;
.fooLeft {
display: flex;
align-items: center;
}
.fooRight {
9 months ago
flex: 1;
display: flex;
align-items: center;
justify-content: flex-end;
margin-right: 20rpx;
}
.fooRight2 {
display: flex;
align-items: center;
9 months ago
justify-content: flex-end;
margin-right: 20rpx;
}
.firstBtn {
margin-left: 60rpx;
}
.footerCus {
margin-right: 44rpx;
text-align: center;
position: relative;
.cusIcon {
width: 38rpx;
height: 38rpx;
margin: 0 auto;
image {
width: 100%;
height: 100%;
}
}
button {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 2;
opacity: 0;
}
.customer {
width: 40rpx;
height: 28rpx;
font-size: 20rpx;
font-weight: 400;
color: #3D3D3D;
line-height: 40rpx;
}
.car {
width: 60rpx;
}
}
.addCar {
width: 196rpx;
height: 78rpx;
background: #FF9E2B;
border-radius: 42rpx 42rpx 42rpx 42rpx;
opacity: 1;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: 600;
color: #FFFFFF;
line-height: 78rpx;
text-align: center;
}
.buyNow {
flex: 1;
height: 78rpx;
background: linear-gradient(102deg, #FE5E06 0%, #F3221A 100%);
border-radius: 42rpx 42rpx 42rpx 42rpx;
opacity: 1;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #FFFFFF;
line-height: 78rpx;
text-align: center;
margin-left: 8rpx;
}
9 months ago
.btn-bg {
flex: 1;
height: 78rpx;
background: #cecece;
border-radius: 42rpx;
opacity: 1;
font-size: 24rpx;
font-weight: 600;
color: #FFFFFF;
line-height: 78rpx;
text-align: center;
9 months ago
}
}
.dia {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(69, 69, 69, 0.44);
display: flex;
justify-content: center;
align-items: center;
text-align: center;
z-index: 22;
.preSuc {
width: 560rpx;
height: 400rpx;
background: linear-gradient(180deg, #FFE4E4 0%, #FFFFFF 100%);
border-radius: 12rpx 12rpx 12rpx 12rpx;
opacity: 1;
display: flex;
flex-direction: column;
align-items: center;
.preImg {
width: 100rpx;
height: 100rpx;
position: relative;
top: -50rpx;
.ldImg {
width: 100%;
height: 100%;
}
}
.preTitle {
height: 44rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #000000;
line-height: 38rpx;
margin-top: 32rpx;
}
.iKnow {
width: 312rpx;
height: 72rpx;
background: #F55349;
border-radius: 8rpx 8rpx 8rpx 8rpx;
opacity: 1;
text-align: center;
line-height: 72rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #FFFFFF;
margin-top: 70rpx;
}
}
.setMs {
width: 656rpx;
height: 590rpx;
background: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
opacity: 1;
.msprice {
width: 100%;
height: 44rpx;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 600;
color: #262626;
line-height: 38rpx;
text-align: center;
margin-top: 24rpx;
margin-bottom: 26rpx;
}
.msLine {
margin-bottom: 30rpx;
}
.msp {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
.inp {
width: 440rpx;
height: 72rpx;
background: #FFFFFF;
border-radius: 4rpx 4rpx 4rpx 4rpx;
opacity: 1;
border: 2rpx solid #EBEBEB;
margin-left: 20rpx;
line-height: 72rpx;
}
}
.qj {
font-size: 28rpx;
font-weight: 400;
color: #262626;
line-height: 33rpx;
margin-bottom: 34rpx;
.msQj {
position: relative;
left: -218rpx;
}
.date {
display: flex;
align-items: center;
justify-content: center;
margin-top: 16rpx;
.timeCommn {
width: 260rpx;
height: 68rpx;
background: #F1F1F1;
border-radius: 62rpx 62rpx 62rpx 62rpx;
opacity: 1;
line-height: 68rpx;
font-size: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #929292;
padding-left: 34rpx;
}
.beginTime {
margin-right: 16rpx;
}
.endTime {
margin-left: 20rpx;
}
}
}
.msLimit {
display: flex;
justify-content: space-between;
padding: 0 38rpx 0 42rpx;
font-size: 28rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #262626;
line-height: 33rpx;
}
.peoLimit {
display: flex;
margin-left: 42rpx;
align-items: center;
.num {
width: 106rpx;
height: 60rpx;
background: #FFFFFF;
border-radius: 4rpx 4rpx 4rpx 4rpx;
opacity: 1;
border: 2rpx solid #EBEBEB;
text-align: center;
line-height: 60rpx;
margin: 0 18rpx 0 16rpx;
}
}
.operaBtn {
display: flex;
justify-content: center;
margin-top: 52rpx;
.btnComm {
width: 216rpx;
height: 70rpx;
background: #EEEEEE;
border-radius: 44rpx 44rpx 44rpx 44rpx;
opacity: 1;
line-height: 70rpx;
text-align: center;
}
.sureBtn {
width: 214rpx;
height: 74rpx;
background: linear-gradient(180deg, #FD5D06 0%, #F3211A 100%);
border-radius: 100rpx 100rpx 100rpx 100rpx;
opacity: 1;
text-align: center;
line-height: 74rpx;
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
margin-left: 24rpx;
}
}
}
.shareWechat {
width: 656rpx;
height: 884rpx;
background: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
opacity: 1;
display: flex;
flex-direction: column;
padding-top: 24rpx;
.shareGoods {
margin-left: 28rpx;
width: 604rpx;
height: 382rpx;
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 1;
image {
width: 100%;
height: 100%;
}
}
.shareInfo {
display: flex;
align-items: center;
margin-top: 12rpx;
10 months ago
padding: 0 30rpx;
9 months ago
justify-content: space-between;
.shareGoodsInfo {
width: 400rpx;
height: 120rpx;
font-size: 28rpx;
font-weight: 400;
color: #000000;
10 months ago
line-height: 40rpx;
text-align: left;
9 months ago
overflow: hidden;
}
.sharePrice {
height: 64rpx;
font-size: 46rpx;
font-weight: 500;
color: #FF645A;
10 months ago
line-height: 54rpx;
9 months ago
text-align: right;
}
}
.shareOpera {
display: flex;
align-items: center;
justify-content: space-around;
margin-top: 36rpx;
margin-bottom: 46rpx;
10 months ago
.operaItem {
9 months ago
position: relative;
.imgIcon {
width: 88rpx;
height: 88rpx;
background: linear-gradient(180deg, #EC6244 0%, #FA938C 100%);
border-radius: 50%;
opacity: 1;
line-height: 88rpx;
text-align: center;
color: #fff;
.iconIm {
font-size: 32rpx;
}
}
.weChatIcon {
background: #28C445;
}
.hb {
background: linear-gradient(180deg, #53A2EE 0%, #6FB2F4 100%);
}
.shareText {
width: 96rpx;
height: 34rpx;
font-size: 24rpx;
font-weight: 400;
color: #000000;
10 months ago
line-height: 60rpx;
9 months ago
button {
10 months ago
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 2;
opacity: 0;
9 months ago
}
}
}
}
.shareCancel {
width: 556rpx;
height: 82rpx;
background: #EEEEEE;
border-radius: 44rpx 44rpx 44rpx 44rpx;
opacity: 1;
font-size: 28rpx;
font-weight: 500;
color: #585858;
line-height: 82rpx;
text-align: center;
left: 0;
right: 0;
margin: auto;
}
}
}
9 months ago
.uni-tabbar__badge {
width: auto;
height: 16px;
line-height: 16px;
border-radius: 16px;
min-width: 16px;
padding: 0 2px;
font-size: 12px;
text-align: center;
white-space: nowrap;
position: absolute;
top: -5px;
right: 1px;
background-color: #f43530;
color: #ffffff;
transform: translate(40%, -20%);
}
10 months ago
</style>