380 lines
9.5 KiB
Vue
380 lines
9.5 KiB
Vue
<template>
|
||
<view class="">
|
||
<view class="shop-info-wrap">
|
||
<view class="info-wrap flex-between">
|
||
<view></view>
|
||
<text class="shopName">{{ shopInfo.storeInfo.shopName }}</text>
|
||
<view class="close" @click="showShopInfo = false">
|
||
<u-icon name="close" color="#999999" size="28"></u-icon>
|
||
</view>
|
||
</view>
|
||
<view class="info-wrap-title">商家信息</view>
|
||
<view class="row" style="margin-bottom: 20rpx;">
|
||
<view class="col">
|
||
<text class="l">营业时间:</text>
|
||
<text
|
||
class="t">{{ (shopInfo.storeInfo.businessStartDay || '——') +'至'+ (shopInfo.storeInfo.businessEndDay || '——') +' '+ (shopInfo.storeInfo.businessTime || '')}}</text>
|
||
</view>
|
||
<view class="col">
|
||
<text class="l">商家地址:</text>
|
||
<text class="t">{{ shopInfo.storeInfo.address }}</text>
|
||
</view>
|
||
<view class="col" @click="makePhoneCall(shopInfo.storeInfo.phone)">
|
||
<text class="l">商家电话:</text>
|
||
<text class="t">{{ shopInfo.storeInfo.phone }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="info-wrap-title">商家公告</view>
|
||
<view class="row">
|
||
<view class="col">
|
||
<text class="l">公告:</text>
|
||
<text class="t">{{ shopInfo.storeInfo.detail }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
|
||
<view class="shop_bottom ">
|
||
<view class="flex-between">
|
||
<view class="price">
|
||
<text class="i">¥</text>
|
||
<text class="num">{{salePrice}}</text>
|
||
<text class="i">/{{specifications.unitSnap}}</text>
|
||
</view>
|
||
<view class="operation-wrap">
|
||
|
||
<view class="btn">
|
||
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||
<view class="btnClick" @click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')"></view>
|
||
</view>
|
||
<text class="num">{{amountcartNumber}}</text>
|
||
<view class="btn" >
|
||
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon>
|
||
<view class="btnClick" @click="shopAdd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')"></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="shop_skuselect flex-start" v-if="specifications.tagSnap">
|
||
<view class="shop_skuselectname">{{skuidname.toString()}}</view>
|
||
</view>
|
||
<view class="addShopping" :class="(amountcartNumber>0&&isSpec)?'active':''"
|
||
@click="addShopping(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
|
||
{{skuBtnText}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import videoList from '../../../components/videoList/videoList.vue'
|
||
import empty from '@/components/empty.vue'
|
||
export default {
|
||
components: {
|
||
empty,
|
||
videoList
|
||
},
|
||
data() {
|
||
return {
|
||
|
||
}
|
||
},
|
||
onShow() {
|
||
this.enable = true
|
||
this.getCourseList()
|
||
},
|
||
onHide() {
|
||
this.enable = false
|
||
},
|
||
onLoad(option) {
|
||
this.jhjk(1212,5)
|
||
this.ytuyyt(1212.5)
|
||
this.rtyrbb(1212,5)
|
||
this.htyurtu(1212,5)
|
||
this.qwefsdf(1212,5)
|
||
uni.setNavigationBarTitle({
|
||
title: option.title
|
||
})
|
||
this.getBannerList()
|
||
if (option.sort) {
|
||
this.sort = option.sort
|
||
}
|
||
if (option.isPrice) {
|
||
this.isPrice = option.isPrice
|
||
}
|
||
|
||
},
|
||
methods: {
|
||
//乘法函数,用来得到精确的乘法结果
|
||
//说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。
|
||
//调用:mul(arg1,arg2)
|
||
//返回值:arg1乘以arg2的精确结果
|
||
//
|
||
rtyrbb(arg1, arg2) {
|
||
var m = 0,
|
||
s1 = arg1.toString(),
|
||
s2 = arg2.toString();
|
||
try {
|
||
m += s1.split(".")[1].length;
|
||
} catch (e) {
|
||
m = 0;
|
||
}
|
||
try {
|
||
m += s2.split(".")[1].length;
|
||
} catch (e) {
|
||
m = m || 0;
|
||
}
|
||
return (
|
||
(Number(s1.replace(".", "")) * Number(s2.replace(".", ""))) /
|
||
Math.pow(10, m)
|
||
);
|
||
}, //除法函数,用来得到精确的除法结果
|
||
//说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。
|
||
//调用:div(arg1,arg2)
|
||
//返回值:arg1除以arg2的精确结果
|
||
jhjk(arg1, arg2) {
|
||
var r1, r2, m, n;
|
||
try {
|
||
r1 = arg1.toString().split(".")[1].length;
|
||
} catch (e) {
|
||
r1 = 0;
|
||
}
|
||
try {
|
||
r2 = arg2.toString().split(".")[1].length;
|
||
} catch (e) {
|
||
r2 = 0;
|
||
}
|
||
m = Math.pow(10, Math.max(r1, r2));
|
||
//动态控制精度长度
|
||
n = r1 >= r2 ? r1 : r2;
|
||
return ((arg1 * m - arg2 * m) / m).toFixed(n);
|
||
},
|
||
htyurtu(arg1, arg2) {
|
||
var r1, r2, m, n;
|
||
try {
|
||
r1 = arg1.toString().split(".")[1].length;
|
||
} catch (e) {
|
||
r1 = 0;
|
||
}
|
||
try {
|
||
r2 = arg2.toString().split(".")[1].length;
|
||
} catch (e) {
|
||
r2 = 0;
|
||
}
|
||
m = Math.pow(10, Math.max(r1, r2));
|
||
n = r1 >= r2 ? r1 : r2;
|
||
return ((arg1 * m + arg2 * m) / m).toFixed(n);
|
||
},
|
||
qwefsdf(arg1, arg2) {
|
||
var t1 = 0,
|
||
t2 = 0,
|
||
r1,
|
||
r2;
|
||
try {
|
||
t1 = arg1.toString().split(".")[1].length;
|
||
} catch (e) {
|
||
t1 = 0;
|
||
}
|
||
try {
|
||
t2 = arg2.toString().split(".")[1].length;
|
||
} catch (e) {
|
||
t2 = 0;
|
||
}
|
||
r1 = Number(arg1.toString().replace(".", ""));
|
||
r2 = Number(arg2.toString().replace(".", ""));
|
||
return mul(r1 / r2, Math.pow(10, t2 - t1));
|
||
},
|
||
/**
|
||
* 保留小数n位,不进行四舍五入
|
||
* num你传递过来的数字,
|
||
* decimal你保留的几位,默认保留小数后两位
|
||
* isInt 是否保留0。如:12.20 是否保留0
|
||
*/
|
||
ytuyyt(num, decimal = 2, isInt = false) {
|
||
num = num.toFixed(3).toString();
|
||
const index = num.indexOf(".");
|
||
if (index !== -1) {
|
||
num = num.substring(0, decimal + index + 1);
|
||
} else {
|
||
num = num.substring(0);
|
||
}
|
||
//截取后保留两位小数
|
||
if (isInt) {
|
||
return parseFloat(num);
|
||
} else {
|
||
return parseFloat(num).toFixed(decimal);
|
||
}
|
||
},
|
||
|
||
//乘法函数,用来得到精确的乘法结果
|
||
//说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。
|
||
//调用:mul(arg1,arg2)
|
||
//返回值:arg1乘以arg2的精确结果
|
||
goPage(url) {
|
||
uni.navigateTo({
|
||
url: url
|
||
})
|
||
},
|
||
//点击回调
|
||
posterSuccess(item) {
|
||
uni.navigateTo({
|
||
url: '/me/detail/detail?id=' + item.courseId + '&courseDetailsId=' + item.courseDetailsId
|
||
})
|
||
},
|
||
//最新热播
|
||
getCourseList() {
|
||
let data = {
|
||
limit: this.limit,
|
||
page: this.page,
|
||
sort: this.sort ? this.sort : '',
|
||
title: this.keyword,
|
||
}
|
||
// #ifdef MP-WEIXIN
|
||
data.wxShow = 1
|
||
// #endif
|
||
// #ifdef MP-TOUTIAO
|
||
data.dyShow = 1
|
||
// #endif
|
||
if (this.isPrice) {
|
||
data.isPrice = this.isPrice
|
||
}
|
||
this.$u.api.courseList(data).then(res => {
|
||
if (res.code == 0) {
|
||
this.pages = res.data.totalPage
|
||
if (this.page < this.pages) {
|
||
this.status = 'loadmore'
|
||
} else {
|
||
this.status = 'nomore'
|
||
}
|
||
// res.data.list.forEach(ret => {
|
||
// ret.courseLabel = ret.courseLabel ? ret.courseLabel.split(',') : []
|
||
// })
|
||
if (this.page == 1) {
|
||
this.courseList = res.data.list
|
||
} else {
|
||
this.courseList = [...this.courseList, ...res.data.list]
|
||
}
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
duration: 1000,
|
||
icon: 'none'
|
||
});
|
||
}
|
||
uni.stopPullDownRefresh();
|
||
|
||
})
|
||
},
|
||
// 获取轮播图列表
|
||
getBannerList() {
|
||
this.$u.api.bannerList({
|
||
classify: '1'
|
||
}).then(res => {
|
||
if (res.code == 0) {
|
||
res.data.forEach(d => {
|
||
if (d.state == 1) {
|
||
this.swiperList.push(d)
|
||
}
|
||
})
|
||
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
duration: 1000,
|
||
icon: 'none'
|
||
});
|
||
}
|
||
})
|
||
},
|
||
|
||
},
|
||
onReachBottom: function() {
|
||
if (this.page < this.pages) {
|
||
this.page += 1
|
||
this.status = 'loading'
|
||
this.getCourseList()
|
||
|
||
} else {
|
||
this.status = 'nomore'
|
||
}
|
||
|
||
},
|
||
onPullDownRefresh: function() {
|
||
this.page = 1;
|
||
this.getCourseList()
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.search-box {
|
||
width: 100%;
|
||
padding: 15upx 2.5%;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
background-color: #ffffff;
|
||
}
|
||
|
||
.vidoList {
|
||
width: 100%;
|
||
height: auto;
|
||
margin-bottom: 20rpx;
|
||
|
||
.vidoList-item {
|
||
width: calc((100% - 40rpx) / 3);
|
||
height: 356rpx;
|
||
background-color: #FFFFFF;
|
||
border-radius: 24rpx;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.vidoList-item-img {
|
||
width: 100%;
|
||
height: 280rpx;
|
||
border-radius: 24rpx 24rpx 0 0;
|
||
|
||
image {
|
||
width: 100%;
|
||
height: 100%;
|
||
border-radius: 24rpx 24rpx 0 0;
|
||
}
|
||
}
|
||
|
||
.vidoList-item-title {
|
||
width: 100%;
|
||
text-align: center;
|
||
background-color: #FFFFFF;
|
||
border-radius: 0 0 24rpx 24rpx;
|
||
padding: 20rpx;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis; //溢出用省略号显示
|
||
white-space: nowrap; // 默认不换行;
|
||
}
|
||
}
|
||
|
||
.swiper {
|
||
width: 100%;
|
||
height: auto;
|
||
margin-bottom: 10rpx;
|
||
margin-top: 10rpx;
|
||
|
||
.swiper-box {
|
||
width: 686rpx;
|
||
height: 100%;
|
||
}
|
||
}
|
||
|
||
.active {
|
||
color: #5074FF;
|
||
}
|
||
|
||
.btn {
|
||
width: 150upx;
|
||
height: 60upx;
|
||
background: #5074FF;
|
||
border-radius: 30upx;
|
||
color: #FFFFFF;
|
||
text-align: center;
|
||
line-height: 60rpx;
|
||
font-size: 26rpx;
|
||
}
|
||
</style> |