Commit d4934b74 authored by 黄奎's avatar 黄奎

商城修改

parent 694fce9f
<template> <template>
<view class="catstyle3" style="height: 100%;"> <view class="catstyle3" style="height: 100%;">
<view class="tabsbox"> <view class="tabsbox">
<u-tabs :is-scroll="true" name="Name" :list="d" :active-color="mainColor" :current="active" @change="changeHandler" <u-tabs :is-scroll="true" name="Name" :list="d" :active-color="mainColor" :current="active"
:type-style="2" :show-bar="false" :bold="false" height="50" duration="0"></u-tabs> @change="changeHandler" :type-style="2" :show-bar="false" :bold="false" height="50" duration="0">
</u-tabs>
</view> </view>
<view style="height: calc(100% - 45px);background: #f5f5f5;"> <view style="height: calc(100% - 45px);background: #f5f5f5;">
<scroll-view :scroll-y="true" @scrolltolower="lower" :enable-back-to-top="true" :enable-flex="true" style=" <scroll-view :scroll-y="true" @scrolltolower="lower" :enable-back-to-top="true" :enable-flex="true" style="
...@@ -15,31 +16,63 @@ ...@@ -15,31 +16,63 @@
<view class="good" @click="clickHandler(cx)"> <view class="good" @click="clickHandler(cx)">
<view class="good-img" style="position: relative;"> <view class="good-img" style="position: relative;">
<image mode="aspectFit" :src="cx.cover_pic" style="width: 100%; height: 100%"> <image mode="aspectFit" :src="cx.cover_pic" style="width: 100%; height: 100%">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/plugins-out.png" v-if="cx.totalStock==0" <image
style="width: 100%; height: 100%;position: absolute;left:0;top:0;background: #000;opacity: 0.6;" /> src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/plugins-out.png"
v-if="cx.totalStock==0"
style="width: 100%; height: 100%;position: absolute;left:0;top:0;background: #000;opacity: 0.6;" />
</image> </image>
</view> </view>
<view class="good-name"> <view class="good-name">
<view v-if="cx.marketingLogo.iswords && cx.marketingLogo.iswords==1&& cx.marketingLogo.words!=''" class="Logo" <view
:style="{color: cx.marketingLogo.wordsColor,background:cx.marketingLogo.wordsBack ,}">{{cx.marketingLogo.words}}</view> v-if="cx.marketingLogo.iswords && cx.marketingLogo.iswords==1&& cx.marketingLogo.words!=''"
<image v-if="cx.marketingLogo.iswords&&cx.marketingLogo.iswords==2&& cx.marketingLogo.ico!=''" mode="heightFix" class="Logo"
:src="cx.marketingLogo.ico" style=" height: 12px;margin-right: 5px" /> :style="{color: cx.marketingLogo.wordsColor,background:cx.marketingLogo.wordsBack ,}">
{{cx.marketingLogo.words}}</view>
<view style="color: #FF4048;background: #fdf6ec;padding: 0 5px;display: inline-block;height: 32rpx;font-size: 20rpx;margin-right: 5rpx;" <image
v-if="cx.freeShippingFullMoneyPinkage>0 || cx.freeShippingFullNumPinkage>0"> v-if="cx.marketingLogo.iswords&&cx.marketingLogo.iswords==2&& cx.marketingLogo.ico!=''"
mode="heightFix" :src="cx.marketingLogo.ico"
style=" height: 12px;margin-right: 5px" />
<view
style="color: #FF4048;background: #fdf6ec;padding: 0 5px;display: inline-block;height: 32rpx;font-size: 20rpx;margin-right: 5rpx;"
v-if="cx.freeShippingFullMoneyPinkage>0 || cx.freeShippingFullNumPinkage>0">
{{cx.freeShippingFullMoneyPinkage>0 && cx.freeShippingFullNumPinkage==0?cx.freeShippingFullMoneyPinkage+'元包邮':''}} {{cx.freeShippingFullMoneyPinkage>0 && cx.freeShippingFullNumPinkage==0?cx.freeShippingFullMoneyPinkage+'元包邮':''}}
{{cx.freeShippingFullMoneyPinkage==0 && cx.freeShippingFullNumPinkage>0?cx.freeShippingFullNumPinkage+'件包邮':''}} {{cx.freeShippingFullMoneyPinkage==0 && cx.freeShippingFullNumPinkage>0?cx.freeShippingFullNumPinkage+'件包邮':''}}
</view> </view>
{{ cx.name }} {{ cx.name }}
</view> </view>
<view class="good-info"> <!-- 新增上课日期 -->
<view v-if="u.TenantId==27">
<view v-if="u.TenantId==27&&cx.edudata.ClassTime" class="have">
{{cx.edudata.ClassTime}}</view>
<!-- 新增次数 -->
<div v-if="cx.edudata.ClassNum&&u.TenantId==27" class="have">{{cx.edudata.ClassNum}}
</div>
<!-- 新增老师相片资料 -->
<view class="price-box">
<view class="portrait-box">
<image v-if="cx.edudata.TeacherIcon" class="portrait" mode="aspectFit"
:src="cx.edudata.TeacherIcon" />
<view v-if="cx.edudata.TeacherName" class="sell2">{{cx.edudata.TeacherName}}
</view>
</view>
<view class="good-info2" >
<view class="price" :style="{ color: mainColor }">{{cx.price_content}}</view>
</view>
</view>
</view>
<!-- 新增上课日期结束 -->
<view class="good-info" v-if="u.TenantId!=27">
<view class="price" :style="{ color: mainColor }">{{cx.price_content}}</view> <view class="price" :style="{ color: mainColor }">{{cx.price_content}}</view>
<view class="sell">{{ cx.sales }}</view> <view class="sell">{{ cx.sales }}</view>
</view> </view>
</view> </view>
</u-col> </u-col>
</u-row> </u-row>
<u-divider v-if="isover" bg-color="#F5f5f5" :margin-top="20" :margin-bottom="20">没有更多商品了</u-divider>&nbsp; <u-divider v-if="isover" bg-color="#F5f5f5" :margin-top="20" :margin-bottom="20">没有更多商品了</u-divider>
&nbsp;
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
...@@ -50,6 +83,7 @@ ...@@ -50,6 +83,7 @@
props: ["d", "h"], props: ["d", "h"],
data() { data() {
return { return {
u: {},
mainColor: "", mainColor: "",
msg: { msg: {
pageIndex: 1, pageIndex: 1,
...@@ -59,7 +93,7 @@ ...@@ -59,7 +93,7 @@
CategoryIds: '', CategoryIds: '',
OrderBy: 1, OrderBy: 1,
UserId: 0, UserId: 0,
StoreId:0, StoreId: 0,
}, },
page_count: 1, page_count: 1,
mh: 0, mh: 0,
...@@ -72,9 +106,11 @@ ...@@ -72,9 +106,11 @@
}; };
}, },
created() { created() {
this.u = uni.getStorageSync('mall_UserInfo');
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
this.IsEducation = uni.getStorageSync('basedata') ? this.IsEducation = uni.getStorageSync('basedata') ?
(uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation ? uni.getStorageSync('basedata').mall.setting.mallStyle (uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation ? uni.getStorageSync('basedata').mall
.setting.mallStyle
.IsEducation : 0) : .IsEducation : 0) :
0; 0;
}, },
...@@ -97,9 +133,13 @@ ...@@ -97,9 +133,13 @@
}); });
} else { } else {
if (item.goodsclassify == 3) { if (item.goodsclassify == 3) {
uni.navigateTo({ url: "/pages/reserve/goodsDetails?GoodsId=" + item.id}); uni.navigateTo({
url: "/pages/reserve/goodsDetails?GoodsId=" + item.id
});
} else { } else {
uni.navigateTo({ url: "/pages/goods/goods?GoodsId=" + item.id }); uni.navigateTo({
url: "/pages/goods/goods?GoodsId=" + item.id
});
} }
} }
...@@ -107,10 +147,11 @@ ...@@ -107,10 +147,11 @@
init() { init() {
this.isover = false; this.isover = false;
this.loading = true; this.loading = true;
this.msg.StoreId = uni.getStorageSync("storeId")?uni.getStorageSync("storeId").storeId:0; this.msg.StoreId = uni.getStorageSync("storeId") ? uni.getStorageSync("storeId").storeId : 0;
let IsOpenReserve = uni.getStorageSync("GetAppConfig")?uni.getStorageSync("GetAppConfig").IsOpenReserve:0 let IsOpenReserve = uni.getStorageSync("GetAppConfig") ? uni.getStorageSync("GetAppConfig").IsOpenReserve :
if(IsOpenReserve==0){//如果没开启 门店id赋值为0 0
this.msg.StoreId=0 if (IsOpenReserve == 0) { //如果没开启 门店id赋值为0
this.msg.StoreId = 0
} }
let url let url
if (this.IsEducation == 1) { if (this.IsEducation == 1) {
...@@ -181,6 +222,56 @@ ...@@ -181,6 +222,56 @@
</script> </script>
<style> <style>
.good-info2 {
display: flex;
margin: 0px 10px;
margin-top: 0;
align-items: center;
}
.price-box{
display: flex;
justify-content: space-between;
align-items: center;
}
.portrait-box {
display: flex;
align-items: center;
margin-top: 10rpx;
margin-bottom: 10rpx;
margin-left: 7px;
}
.portrait {
width: 50rpx;
height: 50rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.cent-box {
/* background: yellow; */
width: 100%;
display: flex;
}
.have {
font-size: 20rpx;
color: gray;
margin-left: 7px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-bottom: 3px;
}
.sell2 {
font-size: 20rpx;
color: gray;
}
.catstyle3 .tabsbox { .catstyle3 .tabsbox {
padding: 10px; padding: 10px;
} }
......
...@@ -9,46 +9,74 @@ ...@@ -9,46 +9,74 @@
<image mode="aspectFit" :src="d[tid].advert_url" style="width: 100%; height: 100%;" /> <image mode="aspectFit" :src="d[tid].advert_url" style="width: 100%; height: 100%;" />
</div> </div>
<div class="good" v-for="(cx, ci) in g" :key="ci" @click="clickHandler(cx)"> <div class="good" v-for="(cx, ci) in g" :key="ci" @click="clickHandler(cx)">
<div class="good-img" style="position: relative;"> <!-- 新加div -->
<image mode="aspectFit" :src="cx.cover_pic" style="width: 100%; height: 100%;"> <view class="cent-box">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/plugins-out.png" v-if="cx.totalStock==0" <div class="good-img" style="position: relative;">
style="width: 100%; height: 100%;position: absolute;left:0;top:0;background: #000;opacity: 0.6;" /> <image mode="aspectFit" :src="cx.cover_pic" style="width: 100%; height: 100%;">
</image> <image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/plugins-out.png" v-if="cx.totalStock==0"
</div> style="width: 100%; height: 100%;position: absolute;left:0;top:0;background: #000;opacity: 0.6;" />
<div class="good-info"> </image>
<div class="good-name">
<view v-if="cx.marketingLogo.iswords && cx.marketingLogo.iswords==1&& cx.marketingLogo.words!=''" class="Logo"
:style="{color: cx.marketingLogo.wordsColor,
background:cx.marketingLogo.wordsBack ,}">{{cx.marketingLogo.words}}</view>
<image v-if="cx.marketingLogo.iswords&&cx.marketingLogo.iswords==2&& cx.marketingLogo.ico!=''" mode="heightFix"
:src="cx.marketingLogo.ico" style=" height: 12px;margin-right: 5px" />
<view style="color: #FF4048;background: #fdf6ec;padding: 0 5px;display: inline-block;height: 32rpx;font-size: 20rpx;margin-right: 5rpx;"
v-if="cx.freeShippingFullMoneyPinkage>0 || cx.freeShippingFullNumPinkage>0">
{{cx.freeShippingFullMoneyPinkage>0 && cx.freeShippingFullNumPinkage==0?cx.freeShippingFullMoneyPinkage+'元包邮':''}}
{{cx.freeShippingFullMoneyPinkage==0 && cx.freeShippingFullNumPinkage>0?cx.freeShippingFullNumPinkage+'件包邮':''}}
</view>
{{ cx.name }}
</div> </div>
<div class="goodprice"> <div class="good-info">
<div class="left"> <div class="good-name">
<div v-if="cx.is_level==1"> <view v-if="cx.marketingLogo.iswords && cx.marketingLogo.iswords==1&& cx.marketingLogo.words!=''" class="Logo"
<!-- todo VIP价格显示--> :style="{color: cx.marketingLogo.wordsColor,
<u-tag size="mini" shape="circle" text="会员价" type="warning" /> background:cx.marketingLogo.wordsBack ,}">{{cx.marketingLogo.words}}</view>
<!-- <u-tag color="#f39800" type="warning">会员价</u-tag> --> <image v-if="cx.marketingLogo.iswords&&cx.marketingLogo.iswords==2&& cx.marketingLogo.ico!=''" mode="heightFix"
<span class="vip">{{cx.level_price}}</span> :src="cx.marketingLogo.ico" style=" height: 12px;margin-right: 5px" />
<view style="color: #FF4048;background: #fdf6ec;padding: 0 5px;display: inline-block;height: 32rpx;font-size: 20rpx;margin-right: 5rpx;"
v-if="cx.freeShippingFullMoneyPinkage>0 || cx.freeShippingFullNumPinkage>0">
{{cx.freeShippingFullMoneyPinkage>0 && cx.freeShippingFullNumPinkage==0?cx.freeShippingFullMoneyPinkage+'元包邮':''}}
{{cx.freeShippingFullMoneyPinkage==0 && cx.freeShippingFullNumPinkage>0?cx.freeShippingFullNumPinkage+'件包邮':''}}
</view>
{{ cx.name }}
</div>
<div class="goodprice">
<div class="left">
<!-- 新增上课日期 -->
<div v-if="cx.edudata.ClassTime&&u.TenantId==27" class="sell">{{cx.edudata.ClassTime}}</div>
<!-- 上课次数 -->
<div v-if="cx.edudata.ClassNum&&u.TenantId==27" class="sell">{{cx.edudata.ClassNum}}</div>
<div v-if="cx.is_level==1&&u.TenantId!=27">
<!-- todo VIP价格显示-->
<u-tag size="mini" shape="circle" text="会员价" type="warning" />
<!-- <u-tag color="#f39800" type="warning">会员价</u-tag> -->
<span class="vip" v-if="u.TenantId!=27">{{cx.level_price}}</span>
</div>
<div v-if="u.TenantId!=27" class="price" :style="{ color: mainColor }">
{{ cx.price_content }}
</div>
<div v-if="u.TenantId!=27" class="sell">{{ cx.sales }}</div>
</div> </div>
<div class="price" :style="{ color: mainColor }">
{{ cx.price_content }} <div v-if="u.TenantId!=27" @click.stop="showSkuHandler(cx)" class="right">
<!-- todo 点击加入购物车-->
<u-icon name="cart-circle-o" size="44" :color="mainColor" />
</div> </div>
<div class="sell">{{ cx.sales }}</div>
</div> </div>
</div>
</view>
<!-- 新加div -->
<view v-if="u.TenantId==27" class="Teachers">
<view class="portrait-box">
<image v-if="cx.edudata.TeacherIcon" class="portrait" mode="aspectFit" :src="cx.edudata.TeacherIcon" />
<view v-if="cx.edudata.TeacherName" class="sell2">{{cx.edudata.TeacherName}}</view>
</view>
<!-- 价格 -->
<view class="cart-box">
<view class="vip2" :style="{ color: mainColor }">
{{ cx.price_content }}
</view>
<div @click.stop="showSkuHandler(cx)" class="right"> <div @click.stop="showSkuHandler(cx)" class="right">
<!-- todo 点击加入购物车--> <!-- todo 点击加入购物车-->
<u-icon name="cart-circle-o" size="44" :color="mainColor" /> <u-icon name="cart-circle-o" size="44" :color="mainColor" />
</div> </div>
</div> </view>
</div> </view>
</div> </div>
<u-divider v-if="isover" :margin-top="20" :margin-bottom="20">没有更多商品了</u-divider> <u-divider v-if="isover" :margin-top="20" :margin-bottom="20">没有更多商品了</u-divider>
</scroll-view> </scroll-view>
...@@ -66,6 +94,7 @@ ...@@ -66,6 +94,7 @@
props: ["d", "h"], props: ["d", "h"],
data() { data() {
return { return {
mainColor: "", mainColor: "",
activeStyle: "", activeStyle: "",
page: 1, page: 1,
...@@ -108,6 +137,7 @@ ...@@ -108,6 +137,7 @@
}, },
mounted() { mounted() {
this.init(); this.init();
this.u = uni.getStorageSync('mall_UserInfo');
}, },
methods: { methods: {
// 购物车 // 购物车
...@@ -209,6 +239,33 @@ ...@@ -209,6 +239,33 @@
</script> </script>
<style> <style>
.vip2{
font-size: 16px;
margin-right: 10rpx;
}
.Teachers{
display: flex;
justify-content: space-between;
}
.cart-box{
display: flex;
align-items: center;
}
.portrait-box{
display: flex;
align-items: center;
}
.portrait{
width: 50rpx;
height: 50rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.cent-box{
/* background: yellow; */
width: 100%;
display: flex;
}
.catstyle4 { .catstyle4 {
display: flex; display: flex;
} }
...@@ -248,7 +305,7 @@ ...@@ -248,7 +305,7 @@
.catstyle4 .good { .catstyle4 .good {
border-bottom: 1rpx solid #f1f1f1; border-bottom: 1rpx solid #f1f1f1;
display: flex; /* display: flex; */
padding: 10px 0; padding: 10px 0;
} }
...@@ -265,7 +322,7 @@ ...@@ -265,7 +322,7 @@
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
margin-bottom: 3px; margin-bottom: 3px;
font-size: 14px; font-size: 14px;
height: 36px; /* height: 36px; */
margin-bottom: 5px; margin-bottom: 5px;
} }
...@@ -308,7 +365,10 @@ ...@@ -308,7 +365,10 @@
font-size: 12px; font-size: 12px;
color: gray; color: gray;
} }
.sell2{
font-size: 12px;
color: gray;
}
.catstyle4 .right-slider .adbox { .catstyle4 .right-slider .adbox {
width: 100%; width: 100%;
height: calc(100vw - 105px / 3.37); height: calc(100vw - 105px / 3.37);
......
<template> <template>
<div class="cartStyle" v-if="!isloading" :style="{ height: contentHeight }"> <div class="cartStyle" v-if="!isloading" :style="{ height: contentHeight }">
<view style=" <view style="
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 0 15rpx; padding: 0 15rpx;
"> ">
<Text class="grid-text" v-if='IsEducation!=1'>商品库存有限,请尽快下单哦</Text> <Text class="grid-text" v-if='IsEducation!=1'>商品库存有限,请尽快下单哦</Text>
<Text class="grid-text" <Text class="grid-text"
v-if='IsEducation==1'>{{list[0].GoodsList.length?list[0].GoodsList.length:'0'}}个课程</Text> v-if='IsEducation==1'>{{list[0].GoodsList.length?list[0].GoodsList.length:'0'}}个课程</Text>
<Text @click="edit" v-if="editType == false && list[0].GoodsList.length>0" class="grid-text_r">编辑</Text> <Text @click="edit" v-if="editType == false && list[0].GoodsList.length>0" class="grid-text_r">编辑</Text>
<Text @click="edit" v-if="editType == true" class="grid-text_r">完成</Text> <Text @click="edit" v-if="editType == true" class="grid-text_r">完成</Text>
</view> </view>
<view style="width: 100%; height: 30rpx; background: #f7f7f7; margin: 20rpx 0;"></view> <view style="width: 100%; height: 30rpx; background: #f7f7f7; margin: 20rpx 0;"></view>
<u-empty v-if="emptyshow == true" text="购物车还是空的哦" mode="car"></u-empty> <u-empty v-if="emptyshow == true" text="购物车还是空的哦" mode="car"></u-empty>
<view v-if="list.length > 0" <view v-if="list.length > 0"
style="height: calc(100vh - 60px-30px-35px-20px);width: calc(100vw);overflow: hidden;padding-top: 10px;"> style="height: calc(100vh - 60px-30px-35px-20px);width: calc(100vw);overflow: hidden;padding-top: 10px;">
<scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" :style="{ height: '100%' }"> <scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" :style="{ height: '100%' }">
<template v-if="list.length > 0 && emptyshow==false"> <template v-if="list.length > 0 && emptyshow==false">
<view class="cartList" :style="{ 'margin-bottom': listbottom }" v-for="(c, i) in list" :key="i"> <view class="cartList" :style="{ 'margin-bottom': listbottom }" v-for="(c, i) in list" :key="i">
<view @click.stop="abc()" <view @click.stop="abc()"
style=" padding: 0 12px 12px 12px; border-bottom: 1rpx solid #f5f5f5; width: 100%;"> style=" padding: 0 12px 12px 12px; border-bottom: 1rpx solid #f5f5f5; width: 100%;">
<u-checkbox-group @change="mch_SelectAll(c.checked, i)"> <u-checkbox-group @change="mch_SelectAll(c.checked, i)">
<u-checkbox v-model="c.checked" shape="circle" :active-color="mc">{{ c.MallName }} <u-checkbox v-model="c.checked" shape="circle" :active-color="mc">{{ c.MallName }}
</u-checkbox> </u-checkbox>
</u-checkbox-group>
</view>
<view :class=" u.TenantId!=27?'cartList_item':'cartList_item2'"
v-for="(item, index) in c.GoodsList" :key="index" @click="btnclick(item,index,i)">
<view @click.stop="abc()" style="width: 40px;text-align: center;"
v-if="(item.GoodsStatus == 1 && item.InventoryNum!=0 && IsEducation!=1) || (editType == true&& IsEducation!=1)">
<u-checkbox-group @change="clickcheckbox(item.checked, item.Price, index, i)">
<u-checkbox v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox>
</u-checkbox-group>
</view>
<view @click.stop="abc()" style="width: 40px;text-align: center;"
v-if="(item.GoodsStatus == 1 && IsEducation==1) || (editType == true && IsEducation==1)">
<u-checkbox-group @change="clickcheckbox(item.checked, item.Price, index, i)">
<u-checkbox v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
</view> </view>
<view :class=" u.TenantId!=27?'cartList_item':'cartList_item2'" v-for="(item, index) in c.GoodsList" :key="index"
@click="btnclick(item,index,i)">
<view @click.stop="abc()" style="width: 40px;text-align: center;"
v-if="(item.GoodsStatus == 1 && item.InventoryNum!=0 && IsEducation!=1) || (editType == true&& IsEducation!=1)">
<u-checkbox-group @change="clickcheckbox(item.checked, item.Price, index, i)">
<u-checkbox v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox>
</u-checkbox-group>
</view>
<view @click.stop="abc()" style="width: 40px;text-align: center;"
v-if="(item.GoodsStatus == 1 && IsEducation==1) || (editType == true && IsEducation==1)">
<u-checkbox-group @change="clickcheckbox(item.checked, item.Price, index, i)">
<u-checkbox v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox>
</u-checkbox-group>
</view>
<view class="invalid" :style="{ background: mc }"
v-if="item.GoodsStatus != 1 && editType == false">
<Text style="color: #fff; width: 22px;font-size: 20rpx;">失效</Text>
</view>
<view class="invalid" :style="{ background: mc }"
v-if="item.InventoryNum == 0 && editType == false && IsEducation!=1">
<Text style="color: #fff; width: 22px;font-size: 20rpx;">售馨</Text>
</view>
<view class="invalid" :style="{ background: mc }"
v-if="item.GoodsStatus != 1 && editType == false">
<Text style="color: #fff; width: 22px;font-size: 20rpx;">失效</Text>
</view>
<view class="invalid" :style="{ background: mc }"
v-if="item.InventoryNum == 0 && editType == false && IsEducation!=1">
<Text style="color: #fff; width: 22px;font-size: 20rpx;">售馨</Text>
</view>
<!-- 布局修改 -->
<view class="cent-box">
<image :src="item.CoverImage" v-if='IsEducation!=1' mode="aspectFill" <image :src="item.CoverImage" v-if='IsEducation!=1' mode="aspectFill"
style="width: 150rpx;height: 150rpx;margin-left: 30rpx;border-radius: 5px;" style="width: 150rpx;height: 150rpx;margin-left: 30rpx;border-radius: 5px;"
@click.native.stop="clickHandler(item.GoodsId)" /> @click.native.stop="clickHandler(item.GoodsId)" />
<image :src="item.CoverImage" v-if='IsEducation==1' mode="aspectFill" <image :src="item.CoverImage" v-if='IsEducation==1' mode="aspectFill"
style="width: 116px;height: 64px;margin-left: 30rpx;border-radius: 5px;box-shadow:0 4px 10px 1px #D2D2D2;" style="width: 116px;height: 64px;margin-left: 30rpx;border-radius: 5px;box-shadow:0 4px 10px 1px #D2D2D2;"
@click.native.stop="clickHandler2(item.GoodsId)" /> @click.native.stop="clickHandler2(item.GoodsId)" />
<view :class="u.TenantId!=27?'item-r':'item-r2' " <view :class="u.TenantId!=27?'item-r':'item-r2' "
:style="{'width':IsEducation!=1?'440rpx':item_r,'height':IsEducation!=1&&u.TenantId!=27?'150rpx':u.TenantId==27?'230rpx':'65px', }"> :style="{'width':IsEducation!=1?'440rpx':item_r,'height':IsEducation!=1&&u.TenantId!=27?'150rpx':u.TenantId==27?'auto':'65px', }">
<view :class="IsEducation!=1?'item-r-n':'item-r-n2'"> <view :class="IsEducation!=1?'item-r-n':'item-r-n2'">
<view <view
v-if="item.MarketingLogo.iswords && item.MarketingLogo.iswords==1&& item.MarketingLogo.words!=''" v-if="item.MarketingLogo.iswords && item.MarketingLogo.iswords==1&& item.MarketingLogo.words!=''"
...@@ -99,704 +99,724 @@ ...@@ -99,704 +99,724 @@
</view> </view>
</view> </view>
<!-- 新增上课时间 --> <!-- 新增上课时间 -->
<Text v-shpw='u.TenantId==27' <Text v-if='u.TenantId==27&&item.EduData.ClassTime'
style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;"> style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
上课时间:{{ attr}} 上课时间:{{item.EduData.ClassTime}}
</Text> </Text>
<!-- 课程数量 --> <!-- 课程数量 -->
<Text v-shpw='u.TenantId==27' <Text v-if='u.TenantId==27&&item.EduData.ClassNum'
style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;"> style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
课程数量:{{ attr}} 课程数量:{{item.EduData.ClassNum}}
</Text> </Text>
<view @click.stop="abc()" <view @click.stop="abc()"
style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;"> style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
<Text style="font-size: 30rpx;" :style="{ color: pricecolor }"> <Text style="font-size: 30rpx;" :style="{ color: pricecolor }">
<Text style="40rpx">{{ item.Price }}</Text> <Text style="40rpx">{{ item.Price }}</Text>
</Text> </Text>
<u-number-box v-if='IsEducation!=1&&u.TenantId!=27' v-model="item.Number" :min="1" <u-number-box v-if='IsEducation!=1&&u.TenantId!=27' v-model="item.Number"
:max="item.InventoryNum" :min="1" :max="item.InventoryNum"
@change="valChange(i, index, item.Number, item.Price, $event)"></u-number-box> @change="valChange(i, index, item.Number, item.Price, $event)">
</u-number-box>
</view> </view>
<!-- 新增绑定物品 --> <!-- 新增绑定物品 -->
<view> <view v-shpw='u.TenantId==27'>
<Text v-shpw='u.TenantId==27' <Text style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;"> 已选物品:{{ attr}}
已选物品:{{ attr}} </Text>
</Text> <view style="font-size: 30rpx;" :style="{ color: pricecolor }">
<view style="font-size: 30rpx;" :style="{ color: pricecolor }"> <Text style="40rpx">{{ item.Price }}</Text>
<Text style="40rpx">{{ item.Price }}</Text> </view>
</view>
</view> </view>
<!-- 新增绑定物品 --> <!-- 新增绑定物品 -->
<Text v-if="item.GoodsStatus != 1 && editType == false&&IsEducation!=1" <Text v-if="item.GoodsStatus != 1 && editType == false&&IsEducation!=1"
style="font-size: 20rpx;color:#a0a09d ;">失效原因:商品下架或者库存不足</Text> style="font-size: 20rpx;color:#a0a09d ;">失效原因:商品下架或者库存不足</Text>
<Text v-if="item.GoodsStatus != 1 && editType == false&&IsEducation==1" <Text v-if="item.GoodsStatus != 1 && editType == false&&IsEducation==1"
style="font-size: 20rpx;color:#a0a09d ;">失效原因:课程下架</Text> style="font-size: 20rpx;color:#a0a09d ;">失效原因:课程下架</Text>
</view> </view>
</view> </view>
<!-- 布局修改 -->
</view> </view>
</template>
</scroll-view>
</view> </view>
<view class="box_bottom" :style="{'margin-bottom':bottommargin}">
<div style="margin-left: 30rpx;"> </template>
<u-checkbox-group @change="SelectAll"> </scroll-view>
<u-checkbox v-model="allchecked" shape="circle" :active-color="mc">全选</u-checkbox> </view>
</u-checkbox-group> <view class="box_bottom" :style="{'margin-bottom':bottommargin}">
<Text style="font-size: 30rpx;" :style="{ color: pricecolor }" <div style="margin-left: 30rpx;">
v-if="editType == false">¥{{ TotalPrice }}</Text> <u-checkbox-group @change="SelectAll">
</div> <u-checkbox v-model="allchecked" shape="circle" :active-color="mc">全选</u-checkbox>
<div class="bottom_btn" v-if="!editType"> </u-checkbox-group>
<u-button size="80" :ripple="true" shape="circle" @click="settlement" :custom-style="{ <Text style="font-size: 30rpx;" :style="{ color: pricecolor }"
v-if="editType == false">¥{{ TotalPrice }}</Text>
</div>
<div class="bottom_btn" v-if="!editType">
<u-button size="80" :ripple="true" shape="circle" @click="settlement" :custom-style="{
backgroundColor: mc, backgroundColor: mc,
height: '80rpx', height: '80rpx',
color: '#FFF', color: '#FFF',
fontSize: '14px' fontSize: '14px'
}"> }">
去结算({{ checkCount }}) 去结算({{ checkCount }})
</u-button> </u-button>
</div> </div>
<u-button v-if="editType" size="80" :ripple="true" shape="circle" @click="delete_btn" :custom-style="{ <u-button v-if="editType" size="80" :ripple="true" shape="circle" @click="delete_btn" :custom-style="{
backgroundColor: mc, backgroundColor: mc,
height: '80rpx', height: '80rpx',
color: '#FFF', color: '#FFF',
fontSize: '14px', fontSize: '14px',
marginRight: '12px' marginRight: '12px'
}"> }">
删除 删除
</u-button> </u-button>
</view> </view>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
<tabbars></tabbars> <tabbars></tabbars>
</div> </div>
</template> </template>
<script> <script>
import tabbars from '@/components/tabbar/index'; import tabbars from '@/components/tabbar/index';
import auth from "@/components/auth/index.vue"; import auth from "@/components/auth/index.vue";
export default { export default {
data() { data() {
return { return {
isloading: false, isloading: false,
pageTitle: '购物车', pageTitle: '购物车',
navHeight: 0, navHeight: 0,
contentHeight: 0, contentHeight: 0,
cstyle: {}, cstyle: {},
emptyshow: false, emptyshow: false,
allchecked: false, allchecked: false,
TotalPrice: 0, //总价格 TotalPrice: 0, //总价格
bottommargin: 0, bottommargin: 0,
listbottom: 0, listbottom: 0,
editType: false, editType: false,
list: [], list: [],
cart_id_list: [], cart_id_list: [],
mc: '', mc: '',
pricecolor: '', pricecolor: '',
secondary: '', secondary: '',
checkCount: 0, checkCount: 0,
msg: { msg: {
pageIndex: 1, pageIndex: 1,
pageSize: 50, pageSize: 50,
Name: '' Name: ''
}, },
u: {}, u: {},
showAuth: false, showAuth: false,
IsEducation: 0, //1是0否是网课模式 IsEducation: 0, //1是0否是网课模式
item_r: 0, //课程模式下的宽度 item_r: 0, //课程模式下的宽度
};
},
created() {},
components: {
tabbars,
auth
},
onLoad() {
this.navHeight = this.$navHeight - 2;
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.pricecolor = this.$uiConfig.pricecolor;
this.cstyle = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').cat_style : [];
this.IsEducation = uni.getStorageSync('basedata') ?
(uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation ? uni.getStorageSync('basedata').mall
.setting.mallStyle.IsEducation : 0) :
0;
let windowWidth = this.$utils.SystemInfo().windowWidth;
this.item_r = (windowWidth - 5 - 40 - 116 - 15 - 10) + 'px'
if (this.cstyle.cat_style == '4') {}
},
onShow() {
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
}; };
}, this.showAuth = true;
created() {}, } else {
components: { this.init();
tabbars, this.TotalPrice = 0;
auth this.checkCount = 0;
},
onLoad() {
this.navHeight = this.$navHeight - 2;
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.pricecolor = this.$uiConfig.pricecolor;
this.cstyle = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').cat_style : [];
this.IsEducation = uni.getStorageSync('basedata') ?
(uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation ? uni.getStorageSync('basedata').mall
.setting.mallStyle.IsEducation : 0) :
0;
let windowWidth = this.$utils.SystemInfo().windowWidth;
this.item_r = (windowWidth - 5 - 40 - 116 - 15 - 10) + 'px'
if (this.cstyle.cat_style == '4') {}
},
onShow() {
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.init();
this.TotalPrice = 0;
this.checkCount = 0;
}
},
mounted() {
let currentPages = getCurrentPages();
let c = this.$uiConfig.is_bang ? 80 : 52;
this.bottommargin = c - 2 + 'px';
this.listbottom = c + 44 + 'px';
this.contentHeight = this.$utils.calcContentHeight(c - 42) + 'px';
let u = '/' + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync('basedata') ? wx.getStorageSync('basedata').bar_title : [];
pages.forEach(x => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
} }
}, });
mounted() { uni.setNavigationBarTitle({
let currentPages = getCurrentPages(); title: this.pageTitle
let c = this.$uiConfig.is_bang ? 80 : 52; });
this.bottommargin = c - 2 + 'px';
this.listbottom = c + 44 + 'px';
this.contentHeight = this.$utils.calcContentHeight(c - 42) + 'px';
let u = '/' + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync('basedata') ? wx.getStorageSync('basedata').bar_title : [];
pages.forEach(x => {
if (x.value == u) {
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle
});
},
methods: {
reloadUserinfo() {
this.u = uni.getStorageSync('mall_UserInfo');
this.showAuth = false;
this.init()
}, },
methods: { //关闭登录窗口
reloadUserinfo() { gbAuth() {
this.u = uni.getStorageSync('mall_UserInfo'); this.showAuth = false;
this.showAuth = false; },
this.init() goHome() {
}, uni.redirectTo({
//关闭登录窗口 url: '/pages/index/main'
gbAuth() { });
this.showAuth = false; },
}, init() {
goHome() { uni.showNavigationBarLoading();
uni.redirectTo({ this.isloading = true;
url: '/pages/index/main' if (this.IsEducation == 1) {
}); this.msg.GoodsClassify = 2
}, }
init() { this.request2({
uni.showNavigationBarLoading(); url: '/api/AppletOrder/GetGoodsShoppingCartPageList',
this.isloading = true; data: this.msg
if (this.IsEducation == 1) { },
this.msg.GoodsClassify = 2 res => {
} this.loading = false;
this.request2({ if (res.resultCode == 1) {
url: '/api/AppletOrder/GetGoodsShoppingCartPageList', uni.hideNavigationBarLoading();
data: this.msg this.isloading = false;
}, if (res.data.pageData.length > 0) {
res => { let list = res.data.pageData;
this.loading = false; let empty = true
if (res.resultCode == 1) { list.forEach(x => {
uni.hideNavigationBarLoading(); x.checked = false;
this.isloading = false; x.GoodsList.forEach(j => {
if (res.data.pageData.length > 0) {
let list = res.data.pageData; j.MarketingLogo = JSON.parse(j.MarketingLogo)
let empty = true j.checked = false;
list.forEach(x => { j.id = j.Id;
x.checked = false;
x.GoodsList.forEach(j => {
j.MarketingLogo = JSON.parse(j.MarketingLogo)
j.checked = false;
j.id = j.Id;
});
if (x.GoodsList.length > 0) {
empty = false
}
}); });
this.emptyshow = empty if (x.GoodsList.length > 0) {
this.list = list; empty = false
}
});
this.emptyshow = empty
this.list = list;
} else { } else {
this.list = []; this.list = [];
}
} }
uni.hideNavigationBarLoading();
} }
);
}, uni.hideNavigationBarLoading();
btnclick(item, index, i) { //点击最外层做的事
if ((item.GoodsStatus == 1 && item.InventoryNum != 0 && this.IsEducation != 1) || (this.editType ==
true && this.IsEducation != 1)) {
this.list[i].GoodsList[index].checked = !this.list[i].GoodsList[index].checked
this.clickcheckbox(item.checked, item.Price, index, i)
} else if ((item.GoodsStatus == 1 && this.IsEducation == 1) || (this.editType == true && this
.IsEducation == 1)) {
this.list[i].GoodsList[index].checked = !this.list[i].GoodsList[index].checked
this.clickcheckbox(item.checked, item.Price, index, i)
} }
}, );
clickcheckbox(checked, price, index, i) { },
// (item.checked, item.Price, index, i) btnclick(item, index, i) { //点击最外层做的事
if (checked == true) { if ((item.GoodsStatus == 1 && item.InventoryNum != 0 && this.IsEducation != 1) || (this.editType ==
this.checkCount += 1; true && this.IsEducation != 1)) {
this.TotalPrice += parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2)); this.list[i].GoodsList[index].checked = !this.list[i].GoodsList[index].checked
let goods_list_all = true; //判断该商场是否全选 this.clickcheckbox(item.checked, item.Price, index, i)
this.list[i].GoodsList.forEach(x => { } else if ((item.GoodsStatus == 1 && this.IsEducation == 1) || (this.editType == true && this
if (this.editType == true) { .IsEducation == 1)) {
//编辑的时候不判断 this.list[i].GoodsList[index].checked = !this.list[i].GoodsList[index].checked
// if (x.checked == false && x.new_status == 0) { this.clickcheckbox(item.checked, item.Price, index, i)
// goods_list_all = false; }
// } },
if (x.checked == false) {
goods_list_all = false; clickcheckbox(checked, price, index, i) {
} // (item.checked, item.Price, index, i)
} else { if (checked == true) {
if (x.checked == false) { this.checkCount += 1;
goods_list_all = false; this.TotalPrice += parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2));
} let goods_list_all = true; //判断该商场是否全选
} this.list[i].GoodsList.forEach(x => {
}); if (this.editType == true) {
if (goods_list_all == true) { //编辑的时候不判断
this.list[i].checked = true; // if (x.checked == false && x.new_status == 0) {
} // goods_list_all = false;
let list_all = true; //判断所有商场是否全选 // }
this.list.forEach(x => {
if (x.checked == false) { if (x.checked == false) {
list_all = false; goods_list_all = false;
} }
}); } else {
if (list_all == true) {
this.allchecked = true;
}
if (this.editType == true) {
let obj = {
mch_id: 0,
id: this.list[i].GoodsList[index].id
};
this.cart_id_list.push(obj);
}
} else {
this.TotalPrice -= parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2));
this.checkCount -= 1;
this.allchecked = false;
let goods_list_all = true; //判断该商场是否全选
this.list[i].GoodsList.forEach(x => {
if (x.checked == false) { if (x.checked == false) {
goods_list_all = false; goods_list_all = false;
} }
});
if (goods_list_all == false) {
this.list[i].checked = false;
} }
if (this.editType == true) { });
this.cart_id_list.forEach((x, j) => { if (goods_list_all == true) {
if (x.id == this.list[i].GoodsList[index].id) { this.list[i].checked = true;
this.cart_id_list.splice(j, 1); }
} let list_all = true; //判断所有商场是否全选
}); this.list.forEach(x => {
if (x.checked == false) {
list_all = false;
} }
});
if (list_all == true) {
this.allchecked = true;
} }
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); if (this.editType == true) {
}, let obj = {
mch_SelectAll(checked, i) { mch_id: 0,
console.log(checked, 'checked') id: this.list[i].GoodsList[index].id
if (checked == true) { };
let add_cartlist = []; this.cart_id_list.push(obj);
let new_statusnum = 0; }
} else {
this.list[i].GoodsList.forEach(x => { this.TotalPrice -= parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2));
this.checkCount -= 1;
if (x.GoodsStatus == 1 && x.InventoryNum > 0) { this.allchecked = false;
if (x.checked == false) { let goods_list_all = true; //判断该商场是否全选
this.TotalPrice += parseFloat((x.Price * x.Number).toFixed(2)); this.list[i].GoodsList.forEach(x => {
x.checked = true; if (x.checked == false) {
new_statusnum++; goods_list_all = false;
} }
} });
if (goods_list_all == false) {
//编辑时候的商城全选 this.list[i].checked = false;
if (this.editType == true) { }
if (this.cart_id_list.length > 0) { if (this.editType == true) {
this.cart_id_list.forEach(z => { this.cart_id_list.forEach((x, j) => {
if (x.id != z.id) { if (x.id == this.list[i].GoodsList[index].id) {
let obj = { this.cart_id_list.splice(j, 1);
mch_id: 0,
id: x.id
};
add_cartlist.push(obj);
}
});
} else {
let obj = {
mch_id: 0,
id: x.id
};
add_cartlist.push(obj);
}
} }
}); });
this.cart_id_list = this.cart_id_list.concat(add_cartlist); }
let list_all = true; //判断所有商场是否全选 }
this.list.forEach(x => { this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
},
mch_SelectAll(checked, i) {
console.log(checked, 'checked')
if (checked == true) {
let add_cartlist = [];
let new_statusnum = 0;
this.list[i].GoodsList.forEach(x => {
if (x.GoodsStatus == 1 && x.InventoryNum > 0) {
if (x.checked == false) { if (x.checked == false) {
list_all = false; this.TotalPrice += parseFloat((x.Price * x.Number).toFixed(2));
x.checked = true;
new_statusnum++;
} }
});
if (list_all == true) {
this.allchecked = true;
} }
this.checkCount += new_statusnum;
} else { //编辑时候的商城全选
let new_statusnum = 0; if (this.editType == true) {
this.list[i].GoodsList.forEach(x => { if (this.cart_id_list.length > 0) {
if (x.GoodsStatus == 1) { this.cart_id_list.forEach(z => {
if (x.checked == true) { if (x.id != z.id) {
this.TotalPrice -= parseFloat((x.Price * x.Number).toFixed(2)); let obj = {
new_statusnum++; mch_id: 0,
x.checked = false; id: x.id
} };
add_cartlist.push(obj);
}
});
} else {
let obj = {
mch_id: 0,
id: x.id
};
add_cartlist.push(obj);
} }
//编辑时候的商城全选
this.cart_id_list.forEach((z, m) => {
if (x.id == z.id) {
this.cart_id_list.splice(m, 1);
}
});
});
this.allchecked = false;
this.checkCount -= new_statusnum;
}
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
},
SelectAll() {
let list = this.list;
if (this.allchecked == true) {
this.checkCount = 0;
this.TotalPrice = 0;
this.cart_id_list = [];
list.forEach(x => {
x.checked = true;
x.GoodsList.forEach(j => {
if (j.GoodsStatus == 1 && j.InventoryNum > 0) {
j.checked = true;
this.checkCount++;
this.TotalPrice += parseFloat((j.Price * j.Number).toFixed(2));
}
//编辑的时候
if (this.editType == true) {
this.cart_id_list.push({
mch_id: 0,
id: j.id
});
}
});
});
} else {
this.checkCount = 0;
this.TotalPrice = 0;
this.cart_id_list = [];
list.forEach(x => {
x.checked = false;
x.GoodsList.forEach(j => {
j.checked = false;
});
});
}
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
},
valChange(i, index, Number, p, e) {
// (i, index, item.Number, item.Price, $event)
let value = parseFloat(e.value);
let price = parseFloat(p);
if (Number > value) {
this.list[i].GoodsList[index].Number = value;
if (this.list[i].GoodsList[index].checked == true) {
this.TotalPrice -= parseFloat((price * (Number - value)).toFixed(2));
} }
} else if (value > Number) { });
this.list[i].GoodsList[index].Number = value; this.cart_id_list = this.cart_id_list.concat(add_cartlist);
if (this.list[i].GoodsList[index].checked == true) { let list_all = true; //判断所有商场是否全选
this.TotalPrice += parseFloat((price * (value - Number)).toFixed(2)); this.list.forEach(x => {
if (x.checked == false) {
list_all = false;
} }
});
if (list_all == true) {
this.allchecked = true;
} }
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); this.checkCount += new_statusnum;
}, } else {
let new_statusnum = 0;
edit() { this.list[i].GoodsList.forEach(x => {
this.editType = !this.editType; if (x.GoodsStatus == 1) {
if (x.checked == true) {
this.TotalPrice -= parseFloat((x.Price * x.Number).toFixed(2));
new_statusnum++;
x.checked = false;
}
}
//编辑时候的商城全选
this.cart_id_list.forEach((z, m) => {
if (x.id == z.id) {
this.cart_id_list.splice(m, 1);
}
});
});
this.allchecked = false; this.allchecked = false;
this.checkCount -= new_statusnum;
}
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
},
SelectAll() {
let list = this.list;
if (this.allchecked == true) {
this.checkCount = 0;
this.TotalPrice = 0; this.TotalPrice = 0;
this.cart_id_list = [];
list.forEach(x => {
x.checked = true;
x.GoodsList.forEach(j => {
if (j.GoodsStatus == 1 && j.InventoryNum > 0) {
j.checked = true;
this.checkCount++;
this.TotalPrice += parseFloat((j.Price * j.Number).toFixed(2));
}
//编辑的时候
if (this.editType == true) {
this.cart_id_list.push({
mch_id: 0,
id: j.id
});
}
});
});
} else {
this.checkCount = 0; this.checkCount = 0;
this.TotalPrice = 0;
this.cart_id_list = []; this.cart_id_list = [];
let list = this.list;
list.forEach(x => { list.forEach(x => {
x.checked = false; x.checked = false;
x.GoodsList.forEach(j => { x.GoodsList.forEach(j => {
j.checked = false; j.checked = false;
}); });
}); });
}, }
delete_btn() { this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
if (this.cart_id_list.length > 0) { },
uni.showNavigationBarLoading(); valChange(i, index, Number, p, e) {
let arr = []; // (i, index, item.Number, item.Price, $event)
this.cart_id_list.forEach(item => { let value = parseFloat(e.value);
arr.push(item.id); let price = parseFloat(p);
}) if (Number > value) {
this.request2({ this.list[i].GoodsList[index].Number = value;
url: '/api/AppletOrder/DelGoodsShoppingCartInfo', if (this.list[i].GoodsList[index].checked == true) {
data: { this.TotalPrice -= parseFloat((price * (Number - value)).toFixed(2));
ShoppingCartIdList: arr
}
},
res => {
if (res.resultCode == 1) {
this.init();
this.TotalPrice = 0;
this.editType = false;
this.allchecked = false;
this.checkCount = 0;
}
uni.hideNavigationBarLoading();
}
);
} else {
uni.showToast({
title: '请选择需要删除的商品',
position: 'bottom',
icon: 'none',
duration: 2000
});
} }
}, } else if (value > Number) {
settlement() { this.list[i].GoodsList[index].Number = value;
let ShoppingCartIdList = []; if (this.list[i].GoodsList[index].checked == true) {
if (this.checkCount > 0) { this.TotalPrice += parseFloat((price * (value - Number)).toFixed(2));
let forms = {};
this.list.forEach(y => {
let good = {
// MallId: y.MallId,
DetailList: [],
Use_Integral: 0,
User_Coupon_Id: 0,
DeliveryMethod: 0,
AddressId: 0,
};
y.GoodsList.forEach(x => {
if (x.checked) {
console.log("x", x)
ShoppingCartIdList.push(x.Id)
let g = {
GoodsId: x.GoodsId,
Number: x.Number,
SpecificationSort: x.SpecificationSort,
};
good.DetailList.push(g);
}
});
forms = good;
console.log("forms", forms)
});
if (this.IsEducation != 1) {
uni.navigateTo({
url: '/pages/order-submit/order-submit?formData=' + encodeURIComponent(JSON.stringify(
forms)) + '&IsFormShoppingCart=1&ShoppingCartIdList=' + JSON.stringify(
ShoppingCartIdList)
});
} else if (this.IsEducation == 1) {
uni.navigateTo({
url: '/pages/school/course-submit?DetailList=' + encodeURIComponent(JSON.stringify(
forms.DetailList)) + '&IsFormShoppingCart=1&ShoppingCartIdList=' + JSON
.stringify(ShoppingCartIdList)
});
}
} else {
uni.showToast({
title: '请选择购买商品',
position: 'bottom',
icon: 'none',
duration: 2000
});
} }
}, }
clickHandler(id) { this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
uni.navigateTo({ },
url: '/pages/goods/goods?id=' + id
});
},
clickHandler2(id) { //购物车跳到课程详情
uni.navigateTo({
url: "/pages/school/courseInfo?GoodsId=" + id
});
},
goUrl(url) {
console.log(url)
uni.navigateTo({
url: url
});
},
abc() { //阻止change的事件冒泡
},
}
};
</script>
<style>
.cartStyle {
height: 100%;
position: relative;
font-family: 'oswald';
}
.cartStyle .u-checkbox__label {
margin-left: 12px;
}
.cartStyle .grid-text {
font-size: 24rpx;
margin-top: 4rpx;
color: #939393;
}
.cartStyle .grid-text_r {
margin-top: 4rpx;
margin-right: 10rpx;
}
.cartStyle .cartList {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: hidden;
}
.cartStyle .cartList .cartList_item {
width: 100%;
padding: 30rpx 30rpx 30rpx 10rpx;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1rpx solid #f5f5f5;
}
.cartList_item2{
width: 100%;
padding: 30rpx 30rpx 30rpx 10rpx;
display: flex;
flex-direction: row;
/* align-items: center; */
border-bottom: 1rpx solid #f5f5f5;
}
.cartList .cartList_item .item_input {
width: 200rpx;
height: 60rpx;
background: #f7f7f7;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.cartList .item_input .item_input_l,
.item_input_r {
width: 50rpx;
height: 60rpx;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
}
.cartStyle .item_input .item_input_c {
text-align: center;
width: 50rpx;
height: 60rpx;
font-size: 20rpx;
}
.cartStyle .box_bottom {
width: 100%;
height: 50px;
position: fixed;
background: #fff;
left: 0;
bottom: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-top: 1rpx solid #f5f5f5;
z-index: 999;
}
.cartStyle .bottom_btn {
display: flex;
align-items: center;
justify-content: center;
width: 250rpx;
height: 50px;
}
.cartStyle .Deletestyle { edit() {
margin-right: 40rpx; this.editType = !this.editType;
} this.allchecked = false;
this.TotalPrice = 0;
this.checkCount = 0;
this.cart_id_list = [];
let list = this.list;
list.forEach(x => {
x.checked = false;
x.GoodsList.forEach(j => {
j.checked = false;
});
});
},
delete_btn() {
if (this.cart_id_list.length > 0) {
uni.showNavigationBarLoading();
let arr = [];
this.cart_id_list.forEach(item => {
arr.push(item.id);
})
this.request2({
url: '/api/AppletOrder/DelGoodsShoppingCartInfo',
data: {
ShoppingCartIdList: arr
}
},
res => {
if (res.resultCode == 1) {
this.init();
this.TotalPrice = 0;
this.editType = false;
this.allchecked = false;
this.checkCount = 0;
}
.cartStyle .invalid { uni.hideNavigationBarLoading();
text-align: center; }
width: 40px; );
height: 20px;
line-height: 18px;
border-radius: 10px;
}
.cartStyle .Logo {
padding: 1px 5px;
display: inline-block;
font-size: 22rpx;
margin-right: 5rpx;
border-radius: 4px;
}
.cartStyle .item-r { } else {
display: flex; uni.showToast({
flex-direction: column; title: '请选择需要删除的商品',
justify-content: space-between; position: 'bottom',
width: 440rpx; icon: 'none',
height: 150rpx; duration: 2000
margin-left: 20rpx; });
} }
},
settlement() {
let ShoppingCartIdList = [];
if (this.checkCount > 0) {
let forms = {};
this.list.forEach(y => {
let good = {
// MallId: y.MallId,
DetailList: [],
Use_Integral: 0,
User_Coupon_Id: 0,
DeliveryMethod: 0,
AddressId: 0,
};
y.GoodsList.forEach(x => {
if (x.checked) {
console.log("x", x)
ShoppingCartIdList.push(x.Id)
let g = {
GoodsId: x.GoodsId,
Number: x.Number,
SpecificationSort: x.SpecificationSort,
};
good.DetailList.push(g);
}
});
.cartStyle .item-r-n { forms = good;
font-size: 26rpx; console.log("forms", forms)
width: 440rpx; });
overflow: hidden; if (this.IsEducation != 1) {
white-space: nowrap; uni.navigateTo({
text-overflow: ellipsis; url: '/pages/order-submit/order-submit?formData=' + encodeURIComponent(JSON.stringify(
forms)) + '&IsFormShoppingCart=1&ShoppingCartIdList=' + JSON.stringify(
ShoppingCartIdList)
});
} else if (this.IsEducation == 1) {
uni.navigateTo({
url: '/pages/school/course-submit?DetailList=' + encodeURIComponent(JSON.stringify(
forms.DetailList)) + '&IsFormShoppingCart=1&ShoppingCartIdList=' + JSON
.stringify(ShoppingCartIdList)
});
}
} } else {
uni.showToast({
title: '请选择购买商品',
position: 'bottom',
icon: 'none',
duration: 2000
});
}
},
clickHandler(id) {
uni.navigateTo({
url: '/pages/goods/goods?id=' + id
});
},
clickHandler2(id) { //购物车跳到课程详情
uni.navigateTo({
url: "/pages/school/courseInfo?GoodsId=" + id
});
},
goUrl(url) {
console.log(url)
uni.navigateTo({
url: url
});
},
abc() { //阻止change的事件冒泡
.item-r2 { },
display: flex;
flex-direction: column;
justify-content: flex-end;
width: 440rpx;
height: 150rpx;
margin-left: 20rpx;
}
.cartStyle .item-r-n2 {
font-size: 26rpx;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
} }
</style> };
</script>
<style>
.the-binding {
width: 100%;
margin-left: 210rpx;
}
.cent-box {
display: flex;
justify-content: space-between;
width: 100%;
}
.cartStyle {
height: 100%;
position: relative;
font-family: 'oswald';
}
.cartStyle .u-checkbox__label {
margin-left: 12px;
}
.cartStyle .grid-text {
font-size: 24rpx;
margin-top: 4rpx;
color: #939393;
}
.cartStyle .grid-text_r {
margin-top: 4rpx;
margin-right: 10rpx;
}
.cartStyle .cartList {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: hidden;
}
.cartStyle .cartList .cartList_item {
width: 100%;
padding: 30rpx 30rpx 30rpx 10rpx;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1rpx solid #f5f5f5;
}
.cartList_item2 {
width: 100%;
padding: 30rpx 30rpx 30rpx 10rpx;
display: flex;
flex-direction: row;
align-items: center;
border-bottom: 1rpx solid #f5f5f5;
}
.cartList .cartList_item .item_input {
width: 200rpx;
height: 60rpx;
background: #f7f7f7;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.cartList .item_input .item_input_l,
.item_input_r {
width: 50rpx;
height: 60rpx;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
}
.cartStyle .item_input .item_input_c {
text-align: center;
width: 50rpx;
height: 60rpx;
font-size: 20rpx;
}
.cartStyle .box_bottom {
width: 100%;
height: 50px;
position: fixed;
background: #fff;
left: 0;
bottom: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-top: 1rpx solid #f5f5f5;
z-index: 999;
}
.cartStyle .bottom_btn {
display: flex;
align-items: center;
justify-content: center;
width: 250rpx;
height: 50px;
}
.cartStyle .Deletestyle {
margin-right: 40rpx;
}
.cartStyle .invalid {
text-align: center;
width: 40px;
height: 20px;
line-height: 18px;
border-radius: 10px;
}
.cartStyle .Logo {
padding: 1px 5px;
display: inline-block;
font-size: 22rpx;
margin-right: 5rpx;
border-radius: 4px;
}
.cartStyle .item-r {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 440rpx;
height: 150rpx;
margin-left: 20rpx;
}
.cartStyle .item-r-n {
font-size: 26rpx;
width: 440rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.item-r2 {
display: flex;
flex-direction: column;
justify-content: flex-end;
width: 440rpx;
height: 150rpx;
margin-left: 20rpx;
}
.cartStyle .item-r-n2 {
font-size: 26rpx;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
...@@ -79,6 +79,7 @@ import style8 from "@/components/cats/style8"; ...@@ -79,6 +79,7 @@ import style8 from "@/components/cats/style8";
import style9 from "@/components/cats/style9"; import style9 from "@/components/cats/style9";
import style10 from "@/components/cats/style10"; import style10 from "@/components/cats/style10";
import style11 from "@/components/cats/style11"; import style11 from "@/components/cats/style11";
// 新增商品绑定
export default { export default {
data() { data() {
return { return {
...@@ -162,7 +163,7 @@ export default { ...@@ -162,7 +163,7 @@ export default {
uni.redirectTo({ url: "/pages/index/main" }); uni.redirectTo({ url: "/pages/index/main" });
}, },
getStyle(){ getStyle(){
var UserPageType = uni.getStorageSync("mall_UserInfo")?uni.getStorageSync("mall_UserInfo").UserPageType:0; var UserPageType = uni.getStorageSync("mall_UserInfo")?uni.getStorageSync("mall_UserInfo").UserPageType:0;
this.request2( this.request2(
{ {
url: '/api/AppletGoods/GetProductCategoryTreeList', url: '/api/AppletGoods/GetProductCategoryTreeList',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment