Commit 865dc199 authored by 黄奎's avatar 黄奎

页面修改

parent 47ce8df3
...@@ -8,140 +8,108 @@ ...@@ -8,140 +8,108 @@
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> </u-checkbox-group>
</view> </view>
<view :class=" u.TenantId!=27?'cartList_item':'cartList_item2'" <view :class=" u.TenantId!=27?'cartList_item':'cartList_item2'" v-for="(item, index) in c.GoodsList" :key="index"
v-for="(item, index) in c.GoodsList" :key="index" @click="btnclick(item,index,i)"> @click="btnclick(item,index,i)">
<view @click.stop="abc()" style="width: 40px;text-align: center;" <view @click.stop="abc()" style="width: 40px;text-align: center;" v-if="(item.GoodsStatus == 1 && item.InventoryNum!=0 && IsEducation!=1) || (editType == true&& IsEducation!=1)">
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-group @change="clickcheckbox(item.checked, item.Price, index, i)">
<u-checkbox v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox> <u-checkbox v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
</view> </view>
<view @click.stop="abc()" style="width: 40px;text-align: center;" <view @click.stop="abc()" style="width: 40px;text-align: center;" v-if="(item.GoodsStatus == 1 && IsEducation==1) || (editType == true && IsEducation==1)">
v-if="(item.GoodsStatus == 1 && IsEducation==1) || (editType == true && IsEducation==1)">
<u-checkbox-group @change="clickcheckbox(item.checked, item.Price, index, i)"> <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 v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
</view> </view>
<view class="invalid" :style="{ background: mc }" <view class="invalid" :style="{ background: mc }" v-if="item.GoodsStatus != 1 && editType == false">
v-if="item.GoodsStatus != 1 && editType == false">
<Text style="color: #fff; width: 22px;font-size: 20rpx;">失效</Text> <Text style="color: #fff; width: 22px;font-size: 20rpx;">失效</Text>
</view> </view>
<view class="invalid" :style="{ background: mc }" <view class="invalid" :style="{ background: mc }" v-if="item.InventoryNum == 0 && editType == false && IsEducation!=1">
v-if="item.InventoryNum == 0 && editType == false && IsEducation!=1">
<Text style="color: #fff; width: 22px;font-size: 20rpx;">售馨</Text> <Text style="color: #fff; width: 22px;font-size: 20rpx;">售馨</Text>
</view> </view>
<!-- 布局修改 --> <!-- 布局修改 -->
<view class="cent-box"> <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" style="width: 116px;height: 64px;margin-left: 30rpx;border-radius: 5px;box-shadow:0 4px 10px 1px #D2D2D2;"
<image :src="item.CoverImage" v-if='IsEducation==1' mode="aspectFill" @click.native.stop="clickHandler2(item.GoodsId)" />
style="width: 116px;height: 64px;margin-left: 30rpx;border-radius: 5px;box-shadow:0 4px 10px 1px #D2D2D2;" <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?'auto':'65px', }">
@click.native.stop="clickHandler2(item.GoodsId)" />
<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?'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!=''" class="Logo"
v-if="item.MarketingLogo.iswords && item.MarketingLogo.iswords==1&& item.MarketingLogo.words!=''" :style="{color: item.MarketingLogo.wordsColor,background:item.MarketingLogo.wordsBack ,}">
class="Logo"
:style="{color: item.MarketingLogo.wordsColor,background:item.MarketingLogo.wordsBack ,}">
{{item.MarketingLogo.words}} {{item.MarketingLogo.words}}
</view> </view>
<image <image v-if="item.MarketingLogo.iswords&&item.MarketingLogo.iswords==2&& item.MarketingLogo.ico!=''" mode="heightFix"
v-if="item.MarketingLogo.iswords&&item.MarketingLogo.iswords==2&& item.MarketingLogo.ico!=''" :src="item.MarketingLogo.ico" style=" height: 12px;margin-right: 5px" />
mode="heightFix" :src="item.MarketingLogo.ico"
style=" height: 12px;margin-right: 5px" />
{{ item.GoodsName}} {{ item.GoodsName}}
</view> </view>
<view <view style="width: 440rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" v-if="IsEducation!=1">
style="width: 440rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" <Text v-for="(attr, inde2x) in item.SpecificationList" :key="inde2x" style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
v-if="IsEducation!=1">
<Text v-for="(attr, inde2x) in item.SpecificationList" :key="inde2x"
style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
{{ attr}} {{ attr}}
</Text> </Text>
</view> </view>
<view <view style="max-width: 440rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;margin-top: 2px;"
style="max-width: 440rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;margin-top: 2px;" @click.native.stop="goUrl(item.FreeShippingUrl)" v-if="item.FreeShippingName !=null&&IsEducation!=1 && (item.FreeShippingFullMoneyPinkage>0 || item.FreeShippingFullNumPinkage>0)">
@click.native.stop="goUrl(item.FreeShippingUrl)" <view style="color: #FF4048;background: #fdf6ec;padding: 0 5px;display: inline-block;">
v-if="item.FreeShippingName !=null&&IsEducation!=1 && (item.FreeShippingFullMoneyPinkage>0 || item.FreeShippingFullNumPinkage>0)">
<view
style="color: #FF4048;background: #fdf6ec;padding: 0 5px;display: inline-block;">
<Text style="font-size: 20rpx;margin-right: 5rpx;"> <Text style="font-size: 20rpx;margin-right: 5rpx;">
{{item.FreeShippingName !=null ?item.FreeShippingName+':':''}} {{item.FreeShippingName !=null ?item.FreeShippingName+':':''}}
<text <text v-if="item.FreeShippingFullMoneyPinkage==0 && item.FreeShippingFullNumPinkage>0">{{item.FreeShippingFullNumPinkage}}件包邮</text>
v-if="item.FreeShippingFullMoneyPinkage==0 && item.FreeShippingFullNumPinkage>0">{{item.FreeShippingFullNumPinkage}}件包邮</text> <text v-if="item.FreeShippingFullMoneyPinkage>0 && item.FreeShippingFullNumPinkage==0">{{item.FreeShippingFullMoneyPinkage}}元包邮</text>
<text
v-if="item.FreeShippingFullMoneyPinkage>0 && item.FreeShippingFullNumPinkage==0">{{item.FreeShippingFullMoneyPinkage}}元包邮</text>
</Text> </Text>
</view> </view>
</view> </view>
<!-- 新增上课时间 --> <!-- 新增上课时间 -->
<Text v-if='u.TenantId==27&&item.EduData.ClassTime' <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;">
上课时间:{{item.EduData.ClassTime}} 上课时间:{{item.EduData.ClassTime}}
</Text> </Text>
<!-- 课程数量 --> <!-- 课程数量 -->
<Text v-if='u.TenantId==27&&item.EduData.ClassNum' <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;">
课程数量:{{item.EduData.ClassNum}} 课程数量:{{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" <u-number-box v-if='IsEducation!=1&&u.TenantId!=27' v-model="item.Number" :min="1" :max="item.InventoryNum"
:min="1" :max="item.InventoryNum" @change="valChange(i, index, item.Number, item.Price, $event)">
@change="valChange(i, index, item.Number, item.Price, $event)">
</u-number-box> </u-number-box>
</view> </view>
<!-- 新增绑定物品 --> <!-- 新增绑定物品 -->
<view v-if='u.TenantId==27' v-for="(attr2, inde4x) in item.GoodsRelevanceList" :key="inde4x" > <view v-if='u.TenantId==27' v-for="(attr2, inde4x) in item.GoodsRelevanceList" :key="inde4x">
<Text v-if='attr2.RelevanceName' style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;"> <Text v-if='attr2.RelevanceName' style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
已选物品:{{attr2.RelevanceName}} 已选物品:{{attr2.RelevanceName}}
</Text> </Text>
<view v-if='attr2.RelevancePrice' style="font-size: 30rpx;" :style="{ color: pricecolor }"> <view v-if='attr2.RelevancePrice' style="font-size: 30rpx;" :style="{ color: pricecolor }">
<Text style="40rpx">{{attr2.RelevancePrice}}</Text> <Text style="40rpx">{{attr2.RelevancePrice}}</Text>
</view>
</view> </view>
<!-- 新增绑定物品 --> </view>
<Text v-if="item.GoodsStatus != 1 && editType == false&&IsEducation!=1" <!-- 新增绑定物品 -->
style="font-size: 20rpx;color:#a0a09d ;">失效原因:商品下架或者库存不足</Text> <Text v-if="item.GoodsStatus != 1 && editType == false&&IsEducation!=1" 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>
</view> </view>
</template> </template>
...@@ -152,8 +120,7 @@ ...@@ -152,8 +120,7 @@
<u-checkbox-group @change="SelectAll"> <u-checkbox-group @change="SelectAll">
<u-checkbox v-model="allchecked" shape="circle" :active-color="mc">全选</u-checkbox> <u-checkbox v-model="allchecked" shape="circle" :active-color="mc">全选</u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<Text style="font-size: 30rpx;" :style="{ color: pricecolor }" <Text style="font-size: 30rpx;" :style="{ color: pricecolor }" v-if="editType == false">¥{{ TotalPrice }}</Text>
v-if="editType == false">¥{{ TotalPrice }}</Text>
</div> </div>
<div class="bottom_btn" v-if="!editType"> <div class="bottom_btn" v-if="!editType">
<u-button size="80" :ripple="true" shape="circle" @click="settlement" :custom-style="{ <u-button size="80" :ripple="true" shape="circle" @click="settlement" :custom-style="{
...@@ -177,13 +144,11 @@ ...@@ -177,13 +144,11 @@
</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 {
...@@ -199,7 +164,6 @@ ...@@ -199,7 +164,6 @@
listbottom: 0, listbottom: 0,
editType: false, editType: false,
list: [], list: [],
cart_id_list: [], cart_id_list: [],
mc: '', mc: '',
pricecolor: '', pricecolor: '',
...@@ -247,7 +211,6 @@ ...@@ -247,7 +211,6 @@
this.init(); this.init();
this.TotalPrice = 0; this.TotalPrice = 0;
this.checkCount = 0; this.checkCount = 0;
} }
}, },
mounted() { mounted() {
...@@ -266,8 +229,6 @@ ...@@ -266,8 +229,6 @@
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.pageTitle title: this.pageTitle
}); });
}, },
methods: { methods: {
reloadUserinfo() { reloadUserinfo() {
...@@ -305,7 +266,6 @@ ...@@ -305,7 +266,6 @@
list.forEach(x => { list.forEach(x => {
x.checked = false; x.checked = false;
x.GoodsList.forEach(j => { x.GoodsList.forEach(j => {
j.MarketingLogo = JSON.parse(j.MarketingLogo) j.MarketingLogo = JSON.parse(j.MarketingLogo)
j.checked = false; j.checked = false;
j.id = j.Id; j.id = j.Id;
...@@ -321,11 +281,9 @@ ...@@ -321,11 +281,9 @@
this.list = []; this.list = [];
} }
} }
uni.hideNavigationBarLoading(); uni.hideNavigationBarLoading();
} }
); );
}, },
btnclick(item, index, i) { //点击最外层做的事 btnclick(item, index, i) { //点击最外层做的事
if ((item.GoodsStatus == 1 && item.InventoryNum != 0 && this.IsEducation != 1) || (this.editType == if ((item.GoodsStatus == 1 && item.InventoryNum != 0 && this.IsEducation != 1) || (this.editType ==
...@@ -338,19 +296,13 @@ ...@@ -338,19 +296,13 @@
this.clickcheckbox(item.checked, item.Price, index, i) this.clickcheckbox(item.checked, item.Price, index, i)
} }
}, },
//单项点击
clickcheckbox(checked, price, index, i) { clickcheckbox(checked, price, index, i) {
// (item.checked, item.Price, index, i)
if (checked == true) { if (checked == true) {
this.checkCount += 1; this.checkCount += 1;
this.TotalPrice += parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2));
let goods_list_all = true; //判断该商场是否全选 let goods_list_all = true; //判断该商场是否全选
this.list[i].GoodsList.forEach(x => { this.list[i].GoodsList.forEach(x => {
if (this.editType == true) { if (this.editType == true) {
//编辑的时候不判断
// if (x.checked == false && x.new_status == 0) {
// goods_list_all = false;
// }
if (x.checked == false) { if (x.checked == false) {
goods_list_all = false; goods_list_all = false;
} }
...@@ -380,7 +332,6 @@ ...@@ -380,7 +332,6 @@
this.cart_id_list.push(obj); this.cart_id_list.push(obj);
} }
} else { } else {
this.TotalPrice -= parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2));
this.checkCount -= 1; this.checkCount -= 1;
this.allchecked = false; this.allchecked = false;
let goods_list_all = true; //判断该商场是否全选 let goods_list_all = true; //判断该商场是否全选
...@@ -400,24 +351,19 @@ ...@@ -400,24 +351,19 @@
}); });
} }
} }
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); this.calcSumPrice();
}, },
mch_SelectAll(checked, i) { mch_SelectAll(checked, i) {
console.log(checked, 'checked')
if (checked == true) { if (checked == true) {
let add_cartlist = []; let add_cartlist = [];
let new_statusnum = 0; let new_statusnum = 0;
this.list[i].GoodsList.forEach(x => { this.list[i].GoodsList.forEach(x => {
if (x.GoodsStatus == 1 && x.InventoryNum > 0) { if (x.GoodsStatus == 1 && x.InventoryNum > 0) {
if (x.checked == false) { if (x.checked == false) {
this.TotalPrice += parseFloat((x.Price * x.Number).toFixed(2));
x.checked = true; x.checked = true;
new_statusnum++; new_statusnum++;
} }
} }
//编辑时候的商城全选 //编辑时候的商城全选
if (this.editType == true) { if (this.editType == true) {
if (this.cart_id_list.length > 0) { if (this.cart_id_list.length > 0) {
...@@ -455,7 +401,6 @@ ...@@ -455,7 +401,6 @@
this.list[i].GoodsList.forEach(x => { this.list[i].GoodsList.forEach(x => {
if (x.GoodsStatus == 1) { if (x.GoodsStatus == 1) {
if (x.checked == true) { if (x.checked == true) {
this.TotalPrice -= parseFloat((x.Price * x.Number).toFixed(2));
new_statusnum++; new_statusnum++;
x.checked = false; x.checked = false;
} }
...@@ -470,23 +415,20 @@ ...@@ -470,23 +415,20 @@
this.allchecked = false; this.allchecked = false;
this.checkCount -= new_statusnum; this.checkCount -= new_statusnum;
} }
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); this.calcSumPrice();
}, },
SelectAll() { SelectAll() {
let list = this.list;
if (this.allchecked == true) { if (this.allchecked == true) {
this.checkCount = 0; this.checkCount = 0;
this.TotalPrice = 0; this.TotalPrice = 0;
this.cart_id_list = []; this.cart_id_list = [];
list.forEach(x => { this.list.forEach(x => {
x.checked = true; x.checked = true;
x.GoodsList.forEach(j => { x.GoodsList.forEach(j => {
if (j.GoodsStatus == 1 && j.InventoryNum > 0) { if (j.GoodsStatus == 1 && j.InventoryNum > 0) {
j.checked = true; j.checked = true;
this.checkCount++; this.checkCount++;
this.TotalPrice += parseFloat((j.Price * j.Number).toFixed(2));
} }
//编辑的时候 //编辑的时候
if (this.editType == true) { if (this.editType == true) {
this.cart_id_list.push({ this.cart_id_list.push({
...@@ -500,33 +442,47 @@ ...@@ -500,33 +442,47 @@
this.checkCount = 0; this.checkCount = 0;
this.TotalPrice = 0; this.TotalPrice = 0;
this.cart_id_list = []; this.cart_id_list = [];
list.forEach(x => { this.list.forEach(x => {
x.checked = false; x.checked = false;
x.GoodsList.forEach(j => { x.GoodsList.forEach(j => {
j.checked = false; j.checked = false;
}); });
}); });
} }
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); this.calcSumPrice();
}, },
valChange(i, index, Number, p, e) { valChange(i, index, Number, p, e) {
// (i, index, item.Number, item.Price, $event)
let value = parseFloat(e.value); let value = parseFloat(e.value);
let price = parseFloat(p); let price = parseFloat(p);
if (Number > value) { if (Number > value) {
this.list[i].GoodsList[index].Number = value; this.list[i].GoodsList[index].Number = value;
if (this.list[i].GoodsList[index].checked == true) { if (this.list[i].GoodsList[index].checked == true) {}
this.TotalPrice -= parseFloat((price * (Number - value)).toFixed(2));
}
} else if (value > Number) { } else if (value > Number) {
this.list[i].GoodsList[index].Number = value; this.list[i].GoodsList[index].Number = value;
if (this.list[i].GoodsList[index].checked == true) { if (this.list[i].GoodsList[index].checked == true) {}
this.TotalPrice += parseFloat((price * (value - Number)).toFixed(2));
}
} }
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); this.calcSumPrice();
},
//计算总价格
calcSumPrice() {
let tempPrice = 0;
this.TotalPrice = 0;
console.log("this.list", this.list)
this.list.forEach(x => {
x.GoodsList.forEach(j => {
if (j.checked) {
tempPrice += parseFloat(j.Price * j.Number);
//是否有捆绑商品
if (j.GoodsRelevanceList && j.GoodsRelevanceList.length > 0) {
j.GoodsRelevanceList.forEach(qitem => {
tempPrice += parseFloat(qitem.RelevancePrice);
})
}
}
});
});
this.TotalPrice = parseFloat(tempPrice.toFixed(2));
}, },
edit() { edit() {
this.editType = !this.editType; this.editType = !this.editType;
this.allchecked = false; this.allchecked = false;
...@@ -562,12 +518,9 @@ ...@@ -562,12 +518,9 @@
this.allchecked = false; this.allchecked = false;
this.checkCount = 0; this.checkCount = 0;
} }
uni.hideNavigationBarLoading(); uni.hideNavigationBarLoading();
} }
); );
} else { } else {
uni.showToast({ uni.showToast({
title: '请选择需要删除的商品', title: '请选择需要删除的商品',
...@@ -583,7 +536,6 @@ ...@@ -583,7 +536,6 @@
let forms = {}; let forms = {};
this.list.forEach(y => { this.list.forEach(y => {
let good = { let good = {
// MallId: y.MallId,
DetailList: [], DetailList: [],
Use_Integral: 0, Use_Integral: 0,
User_Coupon_Id: 0, User_Coupon_Id: 0,
...@@ -598,12 +550,10 @@ ...@@ -598,12 +550,10 @@
GoodsId: x.GoodsId, GoodsId: x.GoodsId,
Number: x.Number, Number: x.Number,
SpecificationSort: x.SpecificationSort, SpecificationSort: x.SpecificationSort,
}; };
good.DetailList.push(g); good.DetailList.push(g);
} }
}); });
forms = good; forms = good;
console.log("forms", forms) console.log("forms", forms)
}); });
...@@ -620,7 +570,6 @@ ...@@ -620,7 +570,6 @@
.stringify(ShoppingCartIdList) .stringify(ShoppingCartIdList)
}); });
} }
} else { } else {
uni.showToast({ uni.showToast({
title: '请选择购买商品', title: '请选择购买商品',
...@@ -649,7 +598,6 @@ ...@@ -649,7 +598,6 @@
abc() { //阻止change的事件冒泡 abc() { //阻止change的事件冒泡
}, },
} }
}; };
</script> </script>
......
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