提交
This commit is contained in:
@@ -265,28 +265,43 @@
|
||||
<!-- 精选 -->
|
||||
<view class="">
|
||||
<view v-if="tjProList.length > 0">
|
||||
<view class="flexbox" style="flex-wrap: wrap">
|
||||
<view class="flexbox" style="flex-wrap: wrap;">
|
||||
<view class="goodsItem" v-for="(item, index) in tjProList" :key="index"
|
||||
@click="goDetail(item.product_id)">
|
||||
style="position: relative;" @click="goDetail(item.product_id)">
|
||||
<image :src="item.product_images" mode="" class="goodsImg"></image>
|
||||
<view class="goodsContent">
|
||||
<view class="goodsName">
|
||||
{{ item.product_name }}
|
||||
</view>
|
||||
<view class="goodsPrice">
|
||||
<view style="display: flex; align-items: center"
|
||||
v-if="item.activity_price && item.activity_price > 0">
|
||||
<span class="price">¥{{ item.activity_price }}</span>
|
||||
<span v-if="item.activity_price != item.price" class="Salesnum" style="
|
||||
margin-left: 10rpx;
|
||||
margin-top: 2rpx;
|
||||
text-decoration: line-through;
|
||||
">¥{{ item.price }}</span>
|
||||
</view>
|
||||
<view class="goodsPrice" style="">
|
||||
|
||||
|
||||
<span class="price" v-else>¥{{ item.price }}</span>
|
||||
<span class="Salesnum">已售:{{ item.sum_sales }} 件</span>
|
||||
<text v-if="item.is_vip_price==1&&item.vip_price!=0">
|
||||
<text style="color: #e97512;font-size: 12px;font-weight: bold;">¥{{(item.vip_price).toFixed(2)}}</text>
|
||||
<!-- <text style="color: #fa2d12;font-size: 10px;margin-left: 4px;">VIP到手价</text> -->
|
||||
<text style="color: #8a8a8a;font-size: 10px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">¥{{(item.price).toFixed(2)}}</text>
|
||||
|
||||
|
||||
|
||||
</text>
|
||||
|
||||
<text
|
||||
v-else-if="item.activity_price && item.activity_price > 0">
|
||||
<text style="color: #e97512;font-size: 12px;font-weight: bold;">¥{{(item.activity_price).toFixed(2)}}</text>
|
||||
<!-- <text style="color: #613804;font-size: 10px;margin-left: 4px;">活动价</text> -->
|
||||
<text style="color: #8a8a8a;font-size: 10px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">¥{{(item.price).toFixed(2)}}</text>
|
||||
|
||||
|
||||
|
||||
</text>
|
||||
|
||||
|
||||
<span class="price" style=" color: #e97512;font-size: 12px;" v-else>¥{{ item.price }}</span>
|
||||
<span class="Salesnum" style="font-size: 10px !important;line-height: 24px;">已售:{{ item.sum_sales }} 件</span>
|
||||
</view>
|
||||
<view v-if="item.is_vip_price==1&&item.vip_price!=0&&item.vip_price!=null"
|
||||
style="position: absolute;top: 10rpx;left: 10px;text-align: center;font-size: 22rpx;background-color: #f94f04;color: #fff;font-weight: bold;border-radius:4px;width: 120rpx; padding:4px;box-sizing: border-box;">
|
||||
VIP优惠</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -460,12 +475,12 @@
|
||||
// 隐藏原生的tabbar
|
||||
uni.hideTabBar();
|
||||
// this.requestIapOrder()
|
||||
this.$nextTick(()=>{
|
||||
this.$nextTick(() => {
|
||||
|
||||
this.getAdvertisement()
|
||||
this.getAdvertisement()
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
onHide() {
|
||||
this.page = 1;
|
||||
@@ -546,27 +561,27 @@ this.getAdvertisement()
|
||||
...mapMutations(["setUserInfo"]),
|
||||
|
||||
async getAdvertisement() {
|
||||
await $http
|
||||
.request({
|
||||
url: "common/mainAd/getMainAd",
|
||||
method: "POST",
|
||||
data: {
|
||||
type: 0,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log("res at line 61511111111111111:", res);
|
||||
if (res.code == 0 && res.list && res.list.length > 0) {
|
||||
this.advertisementList = res.list;
|
||||
await $http
|
||||
.request({
|
||||
url: "common/mainAd/getMainAd",
|
||||
method: "POST",
|
||||
data: {
|
||||
type: 0,
|
||||
},
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log("res at line 61511111111111111:", res);
|
||||
if (res.code == 0 && res.list && res.list.length > 0) {
|
||||
this.advertisementList = res.list;
|
||||
|
||||
this.$refs.commonAdvertisement.open();
|
||||
}
|
||||
});
|
||||
},
|
||||
this.$refs.commonAdvertisement.open();
|
||||
}
|
||||
});
|
||||
},
|
||||
requestAll() {
|
||||
this.getUserInfo();
|
||||
this.tjProList = [];
|
||||
@@ -740,6 +755,7 @@ this.getAdvertisement()
|
||||
.then((res) => {
|
||||
if (res.code == 0 && res.result.length > 0) {
|
||||
this.tjProList = res.result;
|
||||
console.log('列表列表this.tjProList at line 745:', this.tjProList)
|
||||
} else {
|
||||
this.tjProList = [];
|
||||
this.status = 3;
|
||||
@@ -1803,7 +1819,7 @@ this.getAdvertisement()
|
||||
display: inline-block;
|
||||
width: 46%;
|
||||
border-radius: 20rpx;
|
||||
padding: 25rpx;
|
||||
padding: 20rpx;
|
||||
padding-bottom: 5rpx;
|
||||
margin: 0 20rpx 20rpx 20rpx;
|
||||
background-color: #fff;
|
||||
@@ -1818,7 +1834,7 @@ this.getAdvertisement()
|
||||
.goodsContent {
|
||||
.goodsName {
|
||||
margin-top: 10rpx;
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
// font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,20 +5,43 @@
|
||||
<scroll-view scroll-y="true">
|
||||
<view class="cartItem" v-for="(item,index) in cartList" :key="index">
|
||||
<view class="select">
|
||||
<checkbox :checked="item.checked" @click="checkboxGroupChange(index,item)"
|
||||
<checkbox style="transform:scale(0.8)" :checked="item.checked" @click="checkboxGroupChange(index,item)"
|
||||
class="round checkedItem" />
|
||||
</view>
|
||||
<view class="cartContent">
|
||||
<view class="cartContent" style="position: relative;">
|
||||
<span v-if="item.isVipPrice==1&&item.vipPrice!=0&&item.vipPrice!=null"
|
||||
style="position: absolute;z-index: 10;top: 4px;left: 0px;margin-right: 10px;text-align: center;font-size: 18rpx;background-color: #f94f04;color: #fff;font-weight: bold;border-radius:4px;width: 80rpx; padding:2px 4px;box-sizing: border-box;">VIP优惠</span>
|
||||
|
||||
<image :src="item.image" mode="" @click="goDetail(item.productId)"></image>
|
||||
<view class="itemCenter">
|
||||
<view class="cartTitle" @click="goDetail(item.productId)">
|
||||
<view class="cartTitle" @click="goDetail(item.productId)" style="display: flex;align-items: center;">
|
||||
<text>{{item.productName}}</text>
|
||||
</view>
|
||||
<view class="itemPrice">
|
||||
<text v-if="item.activityPrice && item.activityPrice > 0">¥{{item.activityPrice*item.productAmount}}</text>
|
||||
<text v-else>¥{{item.price*item.productAmount}}</text>
|
||||
<u-number-box v-model="item.productAmount" @change="valChange($event,item)" :input-width="50"
|
||||
:input-height="20" :min="1" :max="item.productStock" integer @overlimit='overlimit'></u-number-box>
|
||||
<text v-if="item.isVipPrice==1&&item.vipPrice!=0&&item.vipPrice!=null">
|
||||
<text style="color: #e97512;font-size: 16px;font-weight: bold;">¥{{(item.vipPrice).toFixed(2)}}</text>
|
||||
<!-- <text style="color: #fa2d12;font-size: 10px;margin-left: 4px;">VIP到手价</text> -->
|
||||
<text style="color: #8a8a8a;font-size: 14px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">¥{{(item.price).toFixed(2)}}</text>
|
||||
|
||||
|
||||
|
||||
</text>
|
||||
|
||||
<text
|
||||
v-else-if="item.activityPrice && item.activityPrice > 0">
|
||||
<text style="color: #e97512;font-size: 16px;font-weight: bold;">¥{{(item.activityPrice).toFixed(2)}}</text>
|
||||
<!-- <text style="color: #613804;font-size: 10px;margin-left: 4px;">活动价</text> -->
|
||||
<text style="color: #8a8a8a;font-size: 14px;margin-left: 4px;font-weight: bold;text-decoration: line-through;">¥{{(item.price).toFixed(2)}}</text>
|
||||
|
||||
|
||||
|
||||
</text>
|
||||
|
||||
<text v-else style="color: #e97512;font-size: 16px;font-weight: bold;">¥{{item.price}}</text>
|
||||
|
||||
<u-number-box button-size="20" v-model="item.productAmount" @change="valChange($event,item)"
|
||||
:input-width="25" :input-height="10" :min="1" :max="item.productStock" integer
|
||||
@overlimit='overlimit'></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -29,13 +52,20 @@
|
||||
<!-- 底部操作区 -->
|
||||
<view class="shopCarFooter">
|
||||
<view class="selectAll">
|
||||
<checkbox :checked="all" @click="isSelectAll()" class="round checkedItem" />
|
||||
<checkbox :checked="all" style="transform:scale(0.8)" @click="isSelectAll()" class="round checkedItem" />
|
||||
<text class="cartCho">全选</text>
|
||||
<!-- <text class="cartDel" >删除</text> -->
|
||||
<button class="mini-btn" style="border-radius: 40rpx; font-size: 30rpx; height: 56rpx; line-height: 56rpx; margin-left: 6rpx;" v-if="isCartDelShow" @click="delCart()" type="warn" size="mini">删除</button>
|
||||
<button class="mini-btn"
|
||||
style="border-radius: 40rpx; font-size: 30rpx; height: 56rpx; line-height: 56rpx; margin-left: 6rpx;"
|
||||
v-if="isCartDelShow" @click="delCart()" type="warn" size="mini">删除</button>
|
||||
</view>
|
||||
<view class="exhibition">
|
||||
<text class="total">合计: <b>¥{{totalPrice}}</b></text>
|
||||
<view class="total">合计: <b>¥{{totalPrice}}</b>
|
||||
|
||||
<!-- <text style="display: inline-block;width: 80%;color: #8a8a8a;font-size: 10px;">
|
||||
不包含运费
|
||||
</text> -->
|
||||
</view>
|
||||
<view class="settlement" @click="setTment()">
|
||||
结算
|
||||
</view>
|
||||
@@ -59,7 +89,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
playData:{},
|
||||
playData: {},
|
||||
totalPrice: 0, // 总价
|
||||
all: false, // 是否全选
|
||||
isCartDelShow: false, // 是否展示删除按钮
|
||||
@@ -84,8 +114,8 @@
|
||||
computed: {
|
||||
...mapState(['userInfo']),
|
||||
},
|
||||
components:{
|
||||
musicPlay
|
||||
components: {
|
||||
musicPlay
|
||||
},
|
||||
//方法
|
||||
methods: {
|
||||
@@ -135,36 +165,40 @@
|
||||
this.cartList.forEach((item, index) => {
|
||||
let price = 0;
|
||||
if (item.checked) {
|
||||
if(item.activityPrice && item.activityPrice > 0){
|
||||
price = item.productAmount * item.activityPrice;
|
||||
}else{
|
||||
price = item.productAmount * item.price;
|
||||
if (item.isVipPrice == 1 && item.vipPrice != 0) {
|
||||
price = (item.productAmount * item.vipPrice).toFixed(2);
|
||||
} else {
|
||||
if (item.activityPrice && item.activityPrice > 0) {
|
||||
price = (item.productAmount * item.activityPrice).toFixed(2);
|
||||
} else {
|
||||
price = (item.productAmount * item.price).toFixed(2);
|
||||
}
|
||||
}
|
||||
allprice += price
|
||||
}
|
||||
allprice += Number(price)
|
||||
})
|
||||
this.totalPrice = allprice
|
||||
},
|
||||
this.totalPrice = allprice.toFixed(2)
|
||||
},
|
||||
// 超出阈值时
|
||||
overlimit(){
|
||||
overlimit() {
|
||||
uni.showToast({
|
||||
title:'超出商品数量',
|
||||
title: '超出商品数量',
|
||||
icon: 'error',
|
||||
duration: 1000
|
||||
})
|
||||
},
|
||||
valChange(e, item) {
|
||||
console.log(e)
|
||||
let productItem = {}
|
||||
productItem = item
|
||||
let productItem = {}
|
||||
productItem = item
|
||||
productItem.productAmount = e.value
|
||||
this.updateCart(productItem)
|
||||
setTimeout(() => {
|
||||
this.total()
|
||||
}, 300)
|
||||
this.updateCart(productItem)
|
||||
setTimeout(() => {
|
||||
this.total()
|
||||
}, 300)
|
||||
},
|
||||
// 更新购物车
|
||||
updateCart(shagnpin){
|
||||
updateCart(shagnpin) {
|
||||
// 已在购物车中添加
|
||||
$http.request({
|
||||
url: "book/ordercart/update",
|
||||
@@ -211,7 +245,7 @@
|
||||
}).then(res => {
|
||||
this.isCartDelShow = false
|
||||
this.totalPrice = 0
|
||||
this.getCartList()
|
||||
this.getCartList()
|
||||
uni.hideLoading()
|
||||
})
|
||||
} else {
|
||||
@@ -223,27 +257,27 @@
|
||||
|
||||
// 跳转结算页面
|
||||
setTment() {
|
||||
let shangList=[]
|
||||
let shangList = []
|
||||
this.cartList.forEach((item, index) => {
|
||||
if (item.checked) {
|
||||
shangList.push(index)
|
||||
shangList.push({productId:item.productId,num:item.productAmount})
|
||||
}
|
||||
})
|
||||
// 如果没有勾选
|
||||
if(shangList.length == 0){
|
||||
if (shangList.length == 0) {
|
||||
uni.showToast({
|
||||
title: "请先勾选商品",
|
||||
icon: 'error',
|
||||
duration: 1000,
|
||||
})
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: '../bookShop/settlement?type=1&list='+JSON.stringify(shangList)
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '../bookShop/settlement?type=1&list=' + JSON.stringify(shangList)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
// 商品内容跳转
|
||||
goDetail(id) {
|
||||
uni.navigateTo({
|
||||
@@ -264,7 +298,7 @@
|
||||
padding-top: 20rpx;
|
||||
|
||||
.cartItem {
|
||||
padding: 10rpx 10rpx 10rpx 20rpx;
|
||||
padding: 10rpx 10rpx 10rpx 10rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -276,8 +310,8 @@
|
||||
display: flex;
|
||||
|
||||
image {
|
||||
width: 150rpx;
|
||||
height: 180rpx;
|
||||
width: 130rpx;
|
||||
height: 150rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 10rpx;
|
||||
margin-right: 15rpx;
|
||||
@@ -359,4 +393,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user