Commit bd8e9696 authored by 黄奎's avatar 黄奎

商城修改

parent 6973d102
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</view> </view>
<view class="btn-box" v-if="g.totalStock>0&& g.status==1 && g.form_id ==1"> <view class="btn-box" v-if="g.totalStock>0&& g.status==1 && g.form_id ==1">
<view style="flex: 1;"> <view style="flex: 1;">
<u-button :ripple="true" :hair-line="false" :custom-style="btn4" @click='signup'>立即报名</u-button> <u-button :ripple="true" :hair-line="false" :custom-style="btn4" @click='signup'>立即报名5</u-button>
</view> </view>
</view> </view>
<view class="btn-box" v-if="g.totalStock==0"> <view class="btn-box" v-if="g.totalStock==0">
......
...@@ -62,16 +62,19 @@ ...@@ -62,16 +62,19 @@
</u-col> </u-col>
</u-row> </u-row>
<good-sku v-if="showSku" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku> <good-sku v-if="showSku&&!u.TenantId==27" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku>
<good-sku2 v-if="showSku&&u.TenantId==27" borderRadius="20" v-model="showSku" :good="sku" :option-type="2"></good-sku2>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view> </view>
</template> </template>
<script> <script>
import goodSku from '../goods/goodsku'; import goodSku from '../goods/goodsku';
import goodSku2 from '../goods/goodsku2';
import auth from '@/components/auth/index.vue'; import auth from '@/components/auth/index.vue';
export default { export default {
components: { components: {
goodSku, goodSku,
goodSku2,
auth auth
}, },
props: ['goodList', 'goodsInfo'], props: ['goodList', 'goodsInfo'],
......
...@@ -30,7 +30,16 @@ ...@@ -30,7 +30,16 @@
{ {
"path": "pages/webbox/webbox2" "path": "pages/webbox/webbox2"
} }
], ,{
"path" : "components/goods/goodsku2",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"subPackages": [{ "subPackages": [{
"root": "pages/favorite", "root": "pages/favorite",
"pages": [{ "pages": [{
......
<template> <template>
<div class="cartStyle" v-if="!isloading" :style="{ height: contentHeight }"> <div class="cartStyle" v-if="!isloading" :style="{ height: contentHeight }">
<view <view style="
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" style="height: calc(100vh - 60px-30px-35px-20px);width: calc(100vw);overflow: hidden;padding-top: 10px;"> <view v-if="list.length > 0"
<scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" :style="{ height: '100%' }"> style="height: calc(100vh - 60px-30px-35px-20px);width: calc(100vw);overflow: hidden;padding-top: 10px;">
<template v-if="list.length > 0 && emptyshow==false"> <scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" :style="{ height: '100%' }">
<view class="cartList" :style="{ 'margin-bottom': listbottom }" v-for="(c, i) in list" :key="i"> <template v-if="list.length > 0 && emptyshow==false">
<view @click.stop="abc()" <view class="cartList" :style="{ 'margin-bottom': listbottom }" v-for="(c, i) in list" :key="i">
style=" padding: 0 12px 12px 12px; border-bottom: 1rpx solid #f5f5f5; width: 100%;"> <view @click.stop="abc()"
<u-checkbox-group @change="mch_SelectAll(c.checked, i)"> style=" padding: 0 12px 12px 12px; border-bottom: 1rpx solid #f5f5f5; width: 100%;">
<u-checkbox v-model="c.checked" shape="circle" :active-color="mc">{{ c.MallName }}</u-checkbox> <u-checkbox-group @change="mch_SelectAll(c.checked, i)">
</u-checkbox-group> <u-checkbox v-model="c.checked" shape="circle" :active-color="mc">{{ c.MallName }}
</view> </u-checkbox>
<view class="cartList_item" 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"> <view class="invalid" :style="{ background: mc }"
<Text style="color: #fff; width: 22px;font-size: 20rpx;">失效</Text> v-if="item.GoodsStatus != 1 && editType == false">
</view> <Text style="color: #fff; width: 22px;font-size: 20rpx;">失效</Text>
<view class="invalid" :style="{ background: mc }" v-if="item.InventoryNum == 0 && editType == false && IsEducation!=1"> </view>
<Text style="color: #fff; width: 22px;font-size: 20rpx;">售馨</Text> <view class="invalid" :style="{ background: mc }"
</view> v-if="item.InventoryNum == 0 && editType == false && IsEducation!=1">
<Text style="color: #fff; width: 22px;font-size: 20rpx;">售馨</Text>
</view>
<image :src="item.CoverImage" v-if='IsEducation!=1' mode="aspectFill"
style="width: 150rpx;height: 150rpx;margin-left: 30rpx;border-radius: 5px;"
@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;"
@click.native.stop="clickHandler2(item.GoodsId)" />
<image <view :class="u.TenantId!=27?'item-r':'item-r2' "
:src="item.CoverImage" :style="{'width':IsEducation!=1?'440rpx':item_r,'height':IsEducation!=1&&u.TenantId!=27?'150rpx':u.TenantId==27?'230rpx':'65px', }">
v-if='IsEducation!=1' <view :class="IsEducation!=1?'item-r-n':'item-r-n2'">
mode="aspectFill" <view
style="width: 150rpx;height: 150rpx;margin-left: 30rpx;border-radius: 5px;" v-if="item.MarketingLogo.iswords && item.MarketingLogo.iswords==1&& item.MarketingLogo.words!=''"
@click.native.stop="clickHandler(item.GoodsId)" class="Logo"
/> :style="{color: item.MarketingLogo.wordsColor,background:item.MarketingLogo.wordsBack ,}">
<image {{item.MarketingLogo.words}}
:src="item.CoverImage" </view>
v-if='IsEducation==1'
mode="aspectFill" <image
style="width: 116px;height: 64px;margin-left: 30rpx;border-radius: 5px;box-shadow:0 4px 10px 1px #D2D2D2;" v-if="item.MarketingLogo.iswords&&item.MarketingLogo.iswords==2&& item.MarketingLogo.ico!=''"
@click.native.stop="clickHandler2(item.GoodsId)" mode="heightFix" :src="item.MarketingLogo.ico"
/> style=" height: 12px;margin-right: 5px" />
{{ item.GoodsName}}
<view class="item-r" :style="{'width':IsEducation!=1?'440rpx':item_r,'height':IsEducation!=1?'150rpx':'65px', }">
<view :class="IsEducation!=1?'item-r-n':'item-r-n2'">
<view v-if="item.MarketingLogo.iswords && item.MarketingLogo.iswords==1&& item.MarketingLogo.words!=''" class="Logo" :style=
"{color: item.MarketingLogo.wordsColor,background:item.MarketingLogo.wordsBack ,}">
{{item.MarketingLogo.words}}
</view> </view>
<image <view
v-if="item.MarketingLogo.iswords&&item.MarketingLogo.iswords==2&& item.MarketingLogo.ico!=''" style="width: 440rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;"
mode="heightFix" v-if="IsEducation!=1">
:src="item.MarketingLogo.ico"
style=" height: 12px;margin-right: 5px"
/>
{{ item.GoodsName}}
</view>
<view style="width: 440rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" v-if="IsEducation!=1">
<Text v-for="(attr, inde2x) in item.SpecificationList" :key="inde2x" <Text v-for="(attr, inde2x) in item.SpecificationList" :key="inde2x"
style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;"> style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
{{ attr}} {{ attr}}
</Text> </Text>
</view>
<view 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)" >
<view style="color: #FF4048;background: #fdf6ec;padding: 0 5px;display: inline-block;">
<Text style="font-size: 20rpx;margin-right: 5rpx;">
{{item.FreeShippingName !=null ?item.FreeShippingName+':':''}}
<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>
</view> </view>
</view> <view
<view @click.stop="abc()" style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;" > style="max-width: 440rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;margin-top: 2px;"
<Text style="font-size: 30rpx;" :style="{ color: pricecolor }"> @click.native.stop="goUrl(item.FreeShippingUrl)"
<Text style="40rpx">{{ item.Price }}</Text> 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;">
{{item.FreeShippingName !=null ?item.FreeShippingName+':':''}}
<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>
</view>
</view>
<!-- 新增上课时间 -->
<Text v-shpw='u.TenantId==27'
style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
上课时间:{{ attr}}
</Text> </Text>
<u-number-box v-if='IsEducation!=1' <!-- 课程数量 -->
v-model="item.Number" <Text v-shpw='u.TenantId==27'
:min="1" style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
:max="item.InventoryNum" 课程数量:{{ attr}}
@change="valChange(i, index, item.Number, item.Price, $event)" </Text>
></u-number-box> <view @click.stop="abc()"
style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
<Text style="font-size: 30rpx;" :style="{ color: pricecolor }">
<Text style="40rpx">{{ item.Price }}</Text>
</Text>
<u-number-box v-if='IsEducation!=1&&u.TenantId!=27' v-model="item.Number" :min="1"
:max="item.InventoryNum"
@change="valChange(i, index, item.Number, item.Price, $event)"></u-number-box>
</view>
<!-- 新增绑定物品 -->
<view>
<Text v-shpw='u.TenantId==27'
style="color: #a0a09d;font-size: 20rpx;margin-right: 5rpx;">
已选物品:{{ attr}}
</Text>
<view style="font-size: 30rpx;" :style="{ color: pricecolor }">
<Text style="40rpx">{{ item.Price }}</Text>
</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>
</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> </view>
</view>
</view> </view>
</template>
</view> </scroll-view>
</template> </view>
</scroll-view> <view class="box_bottom" :style="{'margin-bottom':bottommargin}">
</view> <div style="margin-left: 30rpx;">
<u-checkbox-group @change="SelectAll">
<u-checkbox v-model="allchecked" shape="circle" :active-color="mc">全选</u-checkbox>
<view class="box_bottom" :style="{'margin-bottom':bottommargin}"> </u-checkbox-group>
<div style="margin-left: 30rpx;"> <Text style="font-size: 30rpx;" :style="{ color: pricecolor }"
<u-checkbox-group @change="SelectAll"> v-if="editType == false">¥{{ TotalPrice }}</Text>
<u-checkbox v-model="allchecked" shape="circle" :active-color="mc">全选</u-checkbox> </div>
</u-checkbox-group> <div class="bottom_btn" v-if="!editType">
<Text style="font-size: 30rpx;" :style="{ color: pricecolor }" v-if="editType == false">¥{{ TotalPrice }}</Text> <u-button size="80" :ripple="true" shape="circle" @click="settlement" :custom-style="{
</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: {},
showAuth: false,
IsEducation: 0, //1是0否是网课模式
item_r: 0, //课程模式下的宽度
};
}, },
u:{}, created() {},
showAuth:false, components: {
IsEducation:0,//1是0否是网课模式 tabbars,
item_r:0,//课程模式下的宽度 auth
}; },
}, onLoad() {
created() {}, this.navHeight = this.$navHeight - 2;
components: { this.mc = this.$uiConfig.mainColor;
tabbars, this.secondary = this.$uiConfig.secondary;
auth this.pricecolor = this.$uiConfig.pricecolor;
}, this.cstyle = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').cat_style : [];
onLoad() { this.IsEducation = uni.getStorageSync('basedata') ?
this.navHeight = this.$navHeight - 2; (uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation ? uni.getStorageSync('basedata').mall
this.mc = this.$uiConfig.mainColor; .setting.mallStyle.IsEducation : 0) :
this.secondary = this.$uiConfig.secondary; 0;
this.pricecolor = this.$uiConfig.pricecolor; let windowWidth = this.$utils.SystemInfo().windowWidth;
this.cstyle = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').cat_style : []; this.item_r = (windowWidth - 5 - 40 - 116 - 15 - 10) + 'px'
this.IsEducation = uni.getStorageSync('basedata') if (this.cstyle.cat_style == '4') {}
? (uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation?uni.getStorageSync('basedata').mall.setting.mallStyle.IsEducation:0) },
:0; onShow() {
let windowWidth = this.$utils.SystemInfo().windowWidth; this.u = uni.getStorageSync('mall_UserInfo');
this.item_r = (windowWidth - 5-40-116-15-10)+'px' if (!this.u) {
if (this.cstyle.cat_style == '4') { this.u = {
} nickName: '未登录',
}, avatarUrl: ''
onShow(){ };
this.u = uni.getStorageSync('mall_UserInfo'); this.showAuth = true;
if (!this.u) { } else {
this.u = { this.init();
nickName: '未登录', this.TotalPrice = 0;
avatarUrl: '' this.checkCount = 0;
};
this.showAuth = true; }
}else{ },
this.init(); mounted() {
this.TotalPrice=0; let currentPages = getCurrentPages();
this.checkCount=0; 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';
mounted() { let u = '/' + currentPages[currentPages.length - 1].route;
let currentPages = getCurrentPages(); let pages = wx.getStorageSync('basedata') ? wx.getStorageSync('basedata').bar_title : [];
let c = this.$uiConfig.is_bang ? 80 : 52; pages.forEach(x => {
this.bottommargin = c - 2 + 'px'; if (x.value == u) {
this.listbottom = c + 44 + 'px'; this.pageTitle = x.new_name ? x.new_name : x.name;
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 : []; uni.setNavigationBarTitle({
pages.forEach(x => { title: this.pageTitle
if (x.value == u) { });
this.pageTitle = x.new_name ? x.new_name : x.name;
}
}); },
uni.setNavigationBarTitle({ methods: {
title: this.pageTitle 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;
},
goHome() {
uni.redirectTo({
url: '/pages/index/main'
});
},
init() {
uni.showNavigationBarLoading();
this.isloading=true;
if(this.IsEducation==1){
this.msg.GoodsClassify=2
}
this.request2(
{
url: '/api/AppletOrder/GetGoodsShoppingCartPageList',
data: this.msg
}, },
res => { init() {
this.loading = false; uni.showNavigationBarLoading();
if (res.resultCode == 1) { this.isloading = true;
uni.hideNavigationBarLoading(); if (this.IsEducation == 1) {
this.isloading = false; this.msg.GoodsClassify = 2
if (res.data.pageData.length > 0) { }
let list = res.data.pageData; this.request2({
let empty = true url: '/api/AppletOrder/GetGoodsShoppingCartPageList',
list.forEach(x => { data: this.msg
x.checked = false; },
x.GoodsList.forEach(j => { res => {
this.loading = false;
j.MarketingLogo = JSON.parse(j.MarketingLogo) if (res.resultCode == 1) {
j.checked = false; uni.hideNavigationBarLoading();
j.id=j.Id; this.isloading = false;
}); if (res.data.pageData.length > 0) {
if(x.GoodsList.length>0){ let list = res.data.pageData;
empty=false let empty = true
list.forEach(x => {
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
this.list = list;
} else {
this.list = [];
} }
}); }
this.emptyshow = empty
this.list = list; uni.hideNavigationBarLoading();
} else {
this.list = [];
} }
);
},
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)
} }
},
uni.hideNavigationBarLoading(); clickcheckbox(checked, price, index, i) {
} // (item.checked, item.Price, index, i)
); if (checked == true) {
this.checkCount += 1;
}, this.TotalPrice += parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2));
btnclick(item,index,i){//点击最外层做的事 let goods_list_all = true; //判断该商场是否全选
if((item.GoodsStatus == 1 && item.InventoryNum!=0 && this.IsEducation!=1) || (this.editType == true&& this.IsEducation!=1)){ this.list[i].GoodsList.forEach(x => {
this.list[i].GoodsList[index].checked= !this.list[i].GoodsList[index].checked if (this.editType == true) {
this.clickcheckbox(item.checked, item.Price, index, i) //编辑的时候不判断
}else if((item.GoodsStatus == 1 && this.IsEducation==1) || (this.editType == true && this.IsEducation==1)){ // if (x.checked == false && x.new_status == 0) {
this.list[i].GoodsList[index].checked= !this.list[i].GoodsList[index].checked // goods_list_all = false;
this.clickcheckbox(item.checked, item.Price, index, i) // }
} if (x.checked == false) {
}, goods_list_all = false;
}
clickcheckbox(checked, price, index, i) { } else {
// (item.checked, item.Price, index, i) if (x.checked == false) {
if (checked == true) { goods_list_all = false;
this.checkCount += 1; }
this.TotalPrice += parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2)); }
let goods_list_all = true; //判断该商场是否全选 });
this.list[i].GoodsList.forEach(x => { if (goods_list_all == true) {
if (this.editType == true) { this.list[i].checked = true;
//编辑的时候不判断
// if (x.checked == false && x.new_status == 0) {
// goods_list_all = false;
// }
if (x.checked == false) {
goods_list_all = false;
} }
} else { let list_all = true; //判断所有商场是否全选
if (x.checked == false) { this.list.forEach(x => {
goods_list_all = false; if (x.checked == false) {
list_all = false;
}
});
if (list_all == true) {
this.allchecked = true;
} }
} if (this.editType == true) {
}); let obj = {
if (goods_list_all == true) { mch_id: 0,
this.list[i].checked = true; id: this.list[i].GoodsList[index].id
} };
let list_all = true; //判断所有商场是否全选 this.cart_id_list.push(obj);
this.list.forEach(x => {
if (x.checked == false) {
list_all = false;
}
});
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) {
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 (x.id == this.list[i].GoodsList[index].id) {
this.cart_id_list.splice(j, 1);
} }
}); } else {
} this.TotalPrice -= parseFloat((price * this.list[i].GoodsList[index].Number).toFixed(2));
} this.checkCount -= 1;
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); this.allchecked = false;
}, let goods_list_all = true; //判断该商场是否全选
mch_SelectAll(checked, i) { this.list[i].GoodsList.forEach(x => {
console.log(checked,'checked') if (x.checked == false) {
if (checked == true) { goods_list_all = false;
let add_cartlist = []; }
let new_statusnum = 0; });
if (goods_list_all == false) {
this.list[i].GoodsList.forEach(x => { this.list[i].checked = false;
}
if (x.GoodsStatus == 1 && x.InventoryNum>0) { if (this.editType == true) {
if (x.checked == false) { this.cart_id_list.forEach((x, j) => {
this.TotalPrice += parseFloat((x.Price * x.Number).toFixed(2)); if (x.id == this.list[i].GoodsList[index].id) {
x.checked = true; this.cart_id_list.splice(j, 1);
new_statusnum++; }
});
} }
} }
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) {
this.TotalPrice += parseFloat((x.Price * x.Number).toFixed(2));
x.checked = true;
new_statusnum++;
}
}
//编辑时候的商城全选 //编辑时候的商城全选
if (this.editType == true) { if (this.editType == true) {
if (this.cart_id_list.length > 0) { if (this.cart_id_list.length > 0) {
this.cart_id_list.forEach(z => { this.cart_id_list.forEach(z => {
if (x.id != z.id) { if (x.id != z.id) {
let obj = {
mch_id: 0,
id: x.id
};
add_cartlist.push(obj);
}
});
} else {
let obj = { let obj = {
mch_id: 0, mch_id: 0,
id: x.id id: x.id
}; };
add_cartlist.push(obj); add_cartlist.push(obj);
} }
}); }
} else { });
let obj = { this.cart_id_list = this.cart_id_list.concat(add_cartlist);
mch_id: 0, let list_all = true; //判断所有商场是否全选
id: x.id this.list.forEach(x => {
}; if (x.checked == false) {
add_cartlist.push(obj); list_all = false;
}
});
if (list_all == true) {
this.allchecked = true;
} }
this.checkCount += new_statusnum;
} else {
let new_statusnum = 0;
this.list[i].GoodsList.forEach(x => {
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.checkCount -= new_statusnum;
} }
}); this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
this.cart_id_list = this.cart_id_list.concat(add_cartlist); },
let list_all = true; //判断所有商场是否全选 SelectAll() {
this.list.forEach(x => { let list = this.list;
if (x.checked == false) { if (this.allchecked == true) {
list_all = false; this.checkCount = 0;
} this.TotalPrice = 0;
}); this.cart_id_list = [];
if (list_all == true) { list.forEach(x => {
this.allchecked = true; x.checked = true;
} x.GoodsList.forEach(j => {
this.checkCount += new_statusnum; if (j.GoodsStatus == 1 && j.InventoryNum > 0) {
} else { j.checked = true;
let new_statusnum = 0; this.checkCount++;
this.list[i].GoodsList.forEach(x => { this.TotalPrice += parseFloat((j.Price * j.Number).toFixed(2));
if (x.GoodsStatus == 1) { }
if(x.checked == true){
this.TotalPrice -= parseFloat((x.Price * x.Number).toFixed(2)); //编辑的时候
new_statusnum++; 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.checked = false;
} x.GoodsList.forEach(j => {
j.checked = false;
});
});
} }
//编辑时候的商城全选 this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
this.cart_id_list.forEach((z, m) => { },
if (x.id == z.id) { valChange(i, index, Number, p, e) {
this.cart_id_list.splice(m, 1); // (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.allchecked = false; if (this.list[i].GoodsList[index].checked == true) {
this.checkCount -= new_statusnum; this.TotalPrice += parseFloat((price * (value - Number)).toFixed(2));
}
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));
} }
}
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2));
},
//编辑的时候 edit() {
if (this.editType == true) { this.editType = !this.editType;
this.cart_id_list.push({ this.allchecked = false;
mch_id: 0, this.TotalPrice = 0;
id: j.id this.checkCount = 0;
}); this.cart_id_list = [];
} let list = this.list;
list.forEach(x => {
x.checked = false;
x.GoodsList.forEach(j => {
j.checked = false;
});
}); });
}); },
} else { delete_btn() {
this.checkCount = 0; if (this.cart_id_list.length > 0) {
this.TotalPrice = 0; uni.showNavigationBarLoading();
this.cart_id_list = []; let arr = [];
list.forEach(x => { this.cart_id_list.forEach(item => {
x.checked = false; arr.push(item.id);
x.GoodsList.forEach(j => { })
j.checked = false; this.request2({
}); url: '/api/AppletOrder/DelGoodsShoppingCartInfo',
}); data: {
} ShoppingCartIdList: arr
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); }
}, },
valChange(i, index, Number, p, e) { res => {
// (i, index, item.Number, item.Price, $event) if (res.resultCode == 1) {
let value = parseFloat(e.value); this.init();
let price = parseFloat(p); this.TotalPrice = 0;
if (Number > value) { this.editType = false;
this.list[i].GoodsList[index].Number = value; this.allchecked = false;
if (this.list[i].GoodsList[index].checked == true) { this.checkCount = 0;
this.TotalPrice -= parseFloat((price * (Number - value)).toFixed(2)); }
}
} else if (value > Number) { uni.hideNavigationBarLoading();
this.list[i].GoodsList[index].Number = value; }
if (this.list[i].GoodsList[index].checked == true) { );
this.TotalPrice += parseFloat((price * (value - Number)).toFixed(2));
}
} } else {
this.TotalPrice = parseFloat(this.TotalPrice.toFixed(2)); uni.showToast({
}, title: '请选择需要删除的商品',
position: 'bottom',
edit() { icon: 'none',
this.editType = !this.editType; duration: 2000
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;
}
uni.hideNavigationBarLoading();
} }
); },
settlement() {
let ShoppingCartIdList = [];
} else { if (this.checkCount > 0) {
uni.showToast({ let forms = {};
title: '请选择需要删除的商品', this.list.forEach(y => {
position: 'bottom', let good = {
icon: 'none', // MallId: y.MallId,
duration: 2000 DetailList: [],
}); Use_Integral: 0,
} User_Coupon_Id: 0,
}, DeliveryMethod: 0,
settlement() { AddressId: 0,
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); 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) {
uni.navigateTo({
url: '/pages/goods/goods?id=' + id
}); });
},
forms=good; clickHandler2(id) { //购物车跳到课程详情
console.log("forms",forms)
});
if(this.IsEducation!=1){
uni.navigateTo({ uni.navigateTo({
url: '/pages/order-submit/order-submit?formData=' + encodeURIComponent(JSON.stringify(forms))+'&IsFormShoppingCart=1&ShoppingCartIdList='+JSON.stringify(ShoppingCartIdList) url: "/pages/school/courseInfo?GoodsId=" + id
}); });
}else if(this.IsEducation==1){ },
goUrl(url) {
console.log(url)
uni.navigateTo({ uni.navigateTo({
url: '/pages/school/course-submit?DetailList=' + encodeURIComponent(JSON.stringify(forms.DetailList))+'&IsFormShoppingCart=1&ShoppingCartIdList='+JSON.stringify(ShoppingCartIdList) url: url
}); });
} },
abc() { //阻止change的事件冒泡
} else {
uni.showToast({ },
title: '请选择购买商品',
position: 'bottom',
icon: 'none',
duration: 2000
});
} }
}, };
clickHandler(id) { </script>
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 { <style>
margin-left: 12px; .cartStyle {
} height: 100%;
position: relative;
font-family: 'oswald';
}
.cartStyle .grid-text { .cartStyle .u-checkbox__label {
font-size: 24rpx; margin-left: 12px;
margin-top: 4rpx; }
color: #939393;
}
.cartStyle .grid-text_r { .cartStyle .grid-text {
margin-top: 4rpx; font-size: 24rpx;
margin-right: 10rpx; margin-top: 4rpx;
} color: #939393;
}
.cartStyle .cartList { .cartStyle .grid-text_r {
width: 100%; margin-top: 4rpx;
display: flex; margin-right: 10rpx;
flex-direction: column; }
align-items: center;
overflow-y: hidden; .cartStyle .cartList {
} width: 100%;
display: flex;
flex-direction: column;
align-items: center;
overflow-y: hidden;
}
.cartStyle .cartList .cartList_item { .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%; width: 100%;
padding: 30rpx 30rpx 30rpx 10rpx; padding: 30rpx 30rpx 30rpx 10rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; /* align-items: center; */
border-bottom: 1rpx solid #f5f5f5; 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 .cartList_item .item_input { .cartList .item_input .item_input_l,
width: 200rpx; .item_input_r {
height: 60rpx; width: 50rpx;
background: #f7f7f7; height: 60rpx;
display: flex; font-size: 28rpx;
flex-direction: row; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: center;
} }
.cartList .item_input .item_input_l, .cartStyle .item_input .item_input_c {
.item_input_r { text-align: center;
width: 50rpx; width: 50rpx;
height: 60rpx; height: 60rpx;
font-size: 28rpx; font-size: 20rpx;
display: flex; }
align-items: center;
justify-content: center;
}
.cartStyle .item_input .item_input_c { .cartStyle .box_bottom {
text-align: center; width: 100%;
width: 50rpx; height: 50px;
height: 60rpx; position: fixed;
font-size: 20rpx; 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 .box_bottom { .cartStyle .bottom_btn {
width: 100%; display: flex;
height: 50px; align-items: center;
position: fixed; justify-content: center;
background: #fff; width: 250rpx;
left: 0; height: 50px;
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 { .cartStyle .Deletestyle {
display: flex; margin-right: 40rpx;
align-items: center; }
justify-content: center;
width: 250rpx;
height: 50px;
}
.cartStyle .Deletestyle { .cartStyle .invalid {
margin-right: 40rpx; text-align: center;
} width: 40px;
.cartStyle .invalid { height: 20px;
text-align: center; line-height: 18px;
width: 40px; border-radius: 10px;
height: 20px; }
line-height: 18px;
border-radius: 10px; .cartStyle .Logo {
} padding: 1px 5px;
.cartStyle .Logo{ display: inline-block;
padding: 1px 5px; font-size: 22rpx;
display: inline-block; margin-right: 5rpx;
font-size: 22rpx; border-radius: 4px;
margin-right: 5rpx; }
border-radius: 4px;
} .cartStyle .item-r {
.cartStyle .item-r{ display: flex;
display: flex;flex-direction: column;justify-content: space-between;width: 440rpx;height: 150rpx;margin-left: 20rpx; flex-direction: column;
} justify-content: space-between;
.cartStyle .item-r-n{ width: 440rpx;
font-size: 26rpx;width: 440rpx; height: 150rpx;
overflow: hidden; white-space: nowrap;text-overflow: ellipsis; margin-left: 20rpx;
}
}
.cartStyle .item-r-n2{ .cartStyle .item-r-n {
font-size: 26rpx;width: 100%; font-size: 26rpx;
overflow: hidden; width: 440rpx;
text-overflow: ellipsis; overflow: hidden;
display: -webkit-box; white-space: nowrap;
-webkit-line-clamp: 2; text-overflow: ellipsis;
-webkit-box-orient: vertical;
} }
</style>
.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>
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