Commit 6009139c authored by zhangjianguo's avatar zhangjianguo

样式的修改

parent fadcb43a
......@@ -53,6 +53,7 @@
export default {
data(){
return{
pageTitle:'收货地址',
contentHeight:0,
mainColor:'',
msg:{
......@@ -75,7 +76,9 @@
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
if(option.u!=undefined){
......
......@@ -70,6 +70,7 @@ import auth from "../../components/auth/index.vue";
export default {
data() {
return {
pageTitle:'收货地址',
loading: true,
list: [],
showAuth: false,
......@@ -88,8 +89,22 @@ export default {
this.mainColor = this.$uiConfig.mainColor;
},
mounted() {
let currentPages = getCurrentPages();
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,
});
},
onLoad() {
console.log(wx.getStorageSync("basedata"));
this.u = wx.getStorageSync("userinfo");
if (!this.u) {
this.u = {
......@@ -190,9 +205,7 @@ export default {
});
}
},
mounted() {
}
};
</script>
......
<template>
<div class="cartStyle" v-if="!isloading">
<view
style="
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 15rpx;
"
>
<Text class="grid-text">商品库存有限,请尽快下单哦</Text>
<Text @click="edit" v-if="editType == false" class="grid-text_r"
>编辑</Text
>
<Text @click="edit" v-if="editType == true" class="grid-text_r"
>完成</Text
>
</view>
<view
style="width: 100%; height: 30rpx; background: #f7f7f7; margin: 20rpx 0;"
></view>
<u-empty
v-if="list.length == 0"
text="购物车还是空的哦"
mode="car"
></u-empty>
<view
class="cartList"
:style="{ 'margin-bottom': listbottom }"
v-if="list.length > 0"
v-for="(c, i) in list"
:key="i"
>
<view
style="padding: 0 12px 12px 12px; border-bottom: 1rpx solid #f5f5f5;width: 100%;"
>
<u-checkbox-group @change="mch_SelectAll(c.checked,i)">
<u-checkbox v-model="c.checked" shape="circle" :active-color="mc"
>{{c.name}}</u-checkbox
>
</u-checkbox-group>
</view>
<view
class="cartList_item"
v-for="(item, index) in c.goods_list"
:key="index"
:name="item.name"
>
<u-checkbox-group
v-if='item.new_status==0 || editType==true'
@change="clickcheckbox(item.checked, item.attrs.price, index,i)"
>
<u-checkbox
v-model="item.checked"
shape="circle"
:active-color="mc"
></u-checkbox>
</u-checkbox-group>
<Text v-if='item.new_status!=0 && editType==false' style='color: #a0a09d;width: 22px;'>失效</Text>
<image
:src="item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic"
mode="aspectFill"
style="
width: 150rpx;
height: 150rpx;
margin-left: 30rpx;
border-radius: 5px;
"
/>
<view
style="
display: flex;
flex-direction: column;
justify-content: space-between;
width: 460rpx;
height: 150rpx;
margin-left: 20rpx;
"
>
<Text
style="
font-size: 28rpx;
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
"
>{{ item.goods.name }}</Text
>
<view
style="
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
"
>
<view v-for="(attr, inde2x) in item.attrs.attr" :key="inde2x">
<Text
style="color: #a0a09d; font-size: 24rpx; margin-right: 5rpx;"
>{{ attr.attr_group_name }}:{{ attr.attr_name }}</Text
>
</view>
</view>
<view
style="
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
"
>
<Text style="font-size: 30rpx;" :style="{ color: mc }"
>¥<Text style="40rpx">{{ item.attrs.price }}</Text></Text
>
<!-- <u-number-box :value="item.num" :min="1" :max='100' :input-width="100" @change="valChange(i,index, item.num,item.attrs.price,$event)"></u-number-box> -->
<view class="item_input">
<view
class="item_input_l"
:style="{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}"
@click="reduce(i,index, item.attrs.price)"
>-</view
>
<input type="number" class="item_input_c"
:value="item.num"
@blur='inputblur(i,index, item.num,item.attrs.price,$event)'
@input='onKeyInput(i,index, item.num,item.attrs.price,$event)'/>
<view
class="item_input_r"
style="color: #9b9b9b;"
@click="plus(i,index, item.attrs.price)"
>+</view
>
</view>
</view>
</view>
</view>
</view>
<view class="box_bottom" :style="{ 'margin-bottom': bottommargin }">
<div style="margin-left: 30rpx;">
<u-checkbox-group @change="SelectAll">
<u-checkbox v-model="allchecked" shape="circle" active-color="red"
>全选</u-checkbox
>
</u-checkbox-group>
<Text
style="font-size: 30rpx;"
:style="{ color: mc }"
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,
height: '80rpx',
color: '#FFF',
fontSize: '14px',
}"
>去结算({{ checkCount }})
</u-button>
</div>
<u-button
v-if="editType"
size="80"
:ripple="true"
shape="circle"
@click="delete_btn"
:custom-style="{
backgroundColor: secondary,
height: '80rpx',
color: '#FFF',
fontSize: '14px',
marginRight: '12px',
}"
>删除
</u-button>
</view>
<tabbars></tabbars>
</div>
</template>
<script>
import tabbars from "@/components/tabbar/index";
export default {
data() {
return {
isloading: true,
pageTitle: "购物车",
navHeight: 0,
contentHeight: 0,
cstyle: {},
allchecked: false,
TotalPrice: 0, //总价格
bottommargin: 0,
listbottom: 0,
editType: false,
list: [],
cart_id_list: [],
mc: "",
secondary: "",
checkCount: 0,
};
},
created() {},
components: {
tabbars,
},
onLoad() {
this.navHeight = this.$navHeight - 2;
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.cstyle = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").cat_style
: [];
if (this.cstyle.cat_style == "4") {
// this.searchStyle.p = {
// position: "fixed",
// top: this.navHeight,
// width: "100%",
// left: "0",
// };
}
},
mounted() {
let currentPages = getCurrentPages();
let c = this.$uiConfig.is_bang ? 80 : 52;
this.bottommargin = c - 2 + "px";
this.listbottom = c - 2 + 50 + "px";
this.contentHeight = this.$utils.calcContentHeight(c);
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;
}
});
this.init();
},
methods: {
goHome() {
uni.redirectTo({ url: "/pages/index/main" });
},
init() {
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header: h,
data: {
r: "api/cart/list",
},
},
(res) => {
uni.hideNavigationBarLoading();
this.isloading = false;
if (res.data.list.length > 0) {
let list = res.data.list;
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j)=>{
j.checked = false;
})
});
this.list = list;
} else {
this.list = [];
}
}
);
},
clickcheckbox(checked, price, index,i) {
if (checked == true) {
this.checkCount += 1;
this.TotalPrice += price * this.list[i].goods_list[index].num;
let goods_list_all = true; //判断该商场是否全选
this.list[i].goods_list.forEach((x) => {
if(this.editType == false){//编辑的时候不判断
if (x.checked == false&& x.new_status==0) {
goods_list_all = false;
}
}else{
if (x.checked == false) {
goods_list_all = false;
}
}
});
if (goods_list_all == true) {
this.list[i].checked = true;
}
let list_all = true; //判断所有商场是否全选
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].goods_list[index].id,
};
this.cart_id_list.push(obj);
}
} else {
this.TotalPrice -= price * this.list[i].goods_list[index].num;
this.checkCount -= 1;
this.allchecked = false;
let goods_list_all = true; //判断该商场是否全选
this.list[i].goods_list.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].goods_list[index].id) {
this.cart_id_list.splice(j, 1);
}
});
}
}
},
mch_SelectAll(checked,i){
if(checked == true){
let add_cartlist=[];
let new_statusnum=0
this.list[i].goods_list.forEach((x)=>{
if(x.new_status==0){
this.TotalPrice +=x.attrs.price*x.num;
x.checked = true;
new_statusnum++
}
//编辑时候的商城全选
if(this.editType ==true){
if(this.cart_id_list.length>0){
this.cart_id_list.forEach((z) => {
if (x.id != z.id) {
let obj = {
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)=>{
if(x.checked == false){
list_all=false
}
})
if (list_all == true) {
this.allchecked = true;
}
this.checkCount+=new_statusnum;
}else{
let new_statusnum=0
this.list[i].goods_list.forEach((x)=>{
if(x.new_status==0){
x.checked = false;
this.TotalPrice -=x.attrs.price*x.num;
new_statusnum++
}
//编辑时候的商城全选
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;
}
},
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.goods_list.forEach((j)=>{
if(j.new_status==0){
j.checked = true;
this.checkCount++;
this.TotalPrice+=j.attrs.price*j.num
}
//编辑的时候
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.goods_list.forEach((j)=>{
j.checked = false;
})
});
}
},
inputblur(i,index,num,price,e){
let value= Number(e.target.value)
if(value==0){
this.list[i].goods_list[index].num=1;
this.TotalPrice += price * 1;
}
},
onKeyInput(i,index,num,price,e){//输入的数量
let value= Number(e.target.value)
this.list[i].goods_list[index].num = value;
if(this.list[i].goods_list[index].checked == true){
if(value>num){
this.TotalPrice += price * (value -num);
}else if(value<num){
this.TotalPrice -= price * (num - value);
}
}
},
reduce(i,index, price) {
//减
if (this.list[i].goods_list[index].num > 1) {
this.list[i].goods_list[index].num -= 1;
if (this.list[i].goods_list[index].checked == true) {
this.TotalPrice -= price * 1;
}
}
},
plus(i,index, price) {
//加
this.list[i].goods_list[index].num +=1;
if (this.list[i].goods_list[index].checked == true) {
this.TotalPrice += price * 1;
}
},
edit() {
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.goods_list.forEach((j)=>{
j.checked = false
})
});
},
delete_btn() {
if (this.cart_id_list.length > 0) {
uni.showNavigationBarLoading();
let h = this.apiheader();
h["content-type"] = "application/x-www-form-urlencoded";
this.request(
{
url: "",
method: "POST",
header: h,
data: {
r: "api/cart/delete",
cart_id_list: JSON.stringify(this.cart_id_list),
},
},
(res) => {
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,
});
}
},
settlement() {
if (this.checkCount > 0) {
let goods = [];
this.list.forEach((x) => {
if (x.checked) {
let g = {
id: x.goods_id,
num: x.num,
cart_id: x.id,
goods_attr_id: x.attr_id,
attr: [],
};
x.attrs.attr.forEach((x) => {
g.attr.push({
attr_id: x.attr_id,
attr_group_id: x.attr_group_id,
});
});
goods.push(g);
}
});
uni.navigateTo({
url:
"/pages/order-submit/order-submit?goods=" +
encodeURIComponent(JSON.stringify(goods))
});
} else {
uni.showToast({
title: "请选择购买商品",
position: "bottom",
icon: "none",
duration: 2000,
});
}
},
},
};
</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: 40rpx 30rpx;
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;
}
<template>
<div class="cartStyle" v-if="!isloading" :style="{'height':contentHeight}">
<view style="
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 15rpx;
">
<Text class="grid-text">商品库存有限,请尽快下单哦</Text>
<Text @click="edit" v-if="editType == false" class="grid-text_r">编辑</Text>
<Text @click="edit" v-if="editType == true" class="grid-text_r">完成</Text>
</view>
<view style="width: 100%; height: 30rpx; background: #f7f7f7; margin: 20rpx 0;"></view>
<u-empty v-if="list.length == 0" text="购物车还是空的哦" mode="car"></u-empty>
<view v-if="list.length > 0" style="
height: calc(100vh - 60px);
width: calc(100vw);
overflow: hidden;
padding-top: 10px;
">
<scroll-view :scroll-y="true" :enable-back-to-top="true" :enable-flex="true" :style="{ height: '100%' }">
<view class="cartList" :style="{ 'margin-bottom': listbottom }" v-if="list.length > 0" v-for="(c, i) in list" :key="i">
<view style="padding: 0 12px 12px 12px; border-bottom: 1rpx solid #f5f5f5;width: 100%;">
<u-checkbox-group @change="mch_SelectAll(c.checked,i)">
<u-checkbox v-model="c.checked" shape="circle" :active-color="mc">{{c.name}}</u-checkbox>
</u-checkbox-group>
</view>
<view class="cartList_item" v-for="(item, index) in c.goods_list" :key="index" :name="item.name">
<u-checkbox-group v-if='item.new_status==0 || editType==true' @change="clickcheckbox(item.checked, item.attrs.price, index,i)">
<u-checkbox v-model="item.checked" shape="circle" :active-color="mc"></u-checkbox>
</u-checkbox-group>
<Text v-if='item.new_status!=0 && editType==false' style='color: #a0a09d;width: 22px;'>失效</Text>
<image :src="item.attrs.pic_url ? item.attrs.pic_url : item.goods.cover_pic" mode="aspectFill" style="
width: 150rpx;
height: 150rpx;
margin-left: 30rpx;
border-radius: 5px;
" />
<view style="
display: flex;
flex-direction: column;
justify-content: space-between;
width: 460rpx;
height: 150rpx;
margin-left: 20rpx;
">
<Text style="
font-size: 28rpx;
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
">{{ item.goods.name }}</Text>
<view style="
width: 460rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
">
<view v-for="(attr, inde2x) in item.attrs.attr" :key="inde2x">
<Text style="color: #a0a09d; font-size: 24rpx; margin-right: 5rpx;">{{ attr.attr_group_name }}:{{ attr.attr_name }}</Text>
</view>
</view>
<view style="
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
">
<Text style="font-size: 30rpx;" :style="{ color: mc }">¥<Text style="40rpx">{{ item.attrs.price }}</Text></Text>
<!-- <u-number-box :value="item.num" :min="1" :max='100' :input-width="100" @change="valChange(i,index, item.num,item.attrs.price,$event)"></u-number-box> -->
<view class="item_input">
<view class="item_input_l" :style="{
color: item.num == 1 ? '#E2E2E2' : '#9B9B9B',
}"
@click="reduce(i,index, item.attrs.price)">-</view>
<input type="number" class="item_input_c" :value="item.num" @blur='inputblur(i,index, item.num,item.attrs.price,$event)'
@input='onKeyInput(i,index, item.num,item.attrs.price,$event)' />
<view class="item_input_r" style="color: #9b9b9b;" @click="plus(i,index, item.attrs.price)">+</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
<view class="box_bottom" >
<div style="margin-left: 30rpx;">
<u-checkbox-group @change="SelectAll">
<u-checkbox v-model="allchecked" shape="circle" :active-color="mc">全选</u-checkbox>
</u-checkbox-group>
<Text style="font-size: 30rpx;" :style="{ color: mc }" 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,
height: '80rpx',
color: '#FFF',
fontSize: '14px',
}">去结算({{ checkCount }})
</u-button>
</div>
<u-button v-if="editType" size="80" :ripple="true" shape="circle" @click="delete_btn" :custom-style="{
backgroundColor: secondary,
height: '80rpx',
color: '#FFF',
fontSize: '14px',
marginRight: '12px',
}">删除
</u-button>
</view>
<tabbars></tabbars>
</div>
</template>
<script>
import tabbars from "@/components/tabbar/index";
export default {
data() {
return {
isloading: true,
pageTitle: "购物车",
navHeight: 0,
contentHeight: 0,
cstyle: {},
allchecked: false,
TotalPrice: 0, //总价格
bottommargin: 0,
listbottom: 0,
editType: false,
list: [],
cart_id_list: [],
mc: "",
secondary: "",
checkCount: 0,
};
},
created() {},
components: {
tabbars,
},
onLoad() {
this.navHeight = this.$navHeight - 2;
this.mc = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
this.cstyle = uni.getStorageSync("basedata") ?
uni.getStorageSync("basedata").cat_style : [];
if (this.cstyle.cat_style == "4") {
}
},
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;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.init();
},
methods: {
goHome() {
uni.redirectTo({
url: "/pages/index/main"
});
},
init() {
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request({
url: "",
header: h,
data: {
r: "api/cart/list",
},
},
(res) => {
uni.hideNavigationBarLoading();
this.isloading = false;
if (res.data.list.length > 0) {
let list = res.data.list;
list.forEach((x) => {
x.checked = false;
x.goods_list.forEach((j) => {
j.checked = false;
})
});
this.list = list;
} else {
this.list = [];
}
}
);
},
clickcheckbox(checked, price, index, i) {
if (checked == true) {
this.checkCount += 1;
this.TotalPrice += price * this.list[i].goods_list[index].num;
let goods_list_all = true; //判断该商场是否全选
this.list[i].goods_list.forEach((x) => {
if (this.editType == false) { //编辑的时候不判断
if (x.checked == false && x.new_status == 0) {
goods_list_all = false;
}
} else {
if (x.checked == false) {
goods_list_all = false;
}
}
});
if (goods_list_all == true) {
this.list[i].checked = true;
}
let list_all = true; //判断所有商场是否全选
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].goods_list[index].id,
};
this.cart_id_list.push(obj);
}
} else {
this.TotalPrice -= price * this.list[i].goods_list[index].num;
this.checkCount -= 1;
this.allchecked = false;
let goods_list_all = true; //判断该商场是否全选
this.list[i].goods_list.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].goods_list[index].id) {
this.cart_id_list.splice(j, 1);
}
});
}
}
},
mch_SelectAll(checked, i) {
if (checked == true) {
let add_cartlist = [];
let new_statusnum = 0
this.list[i].goods_list.forEach((x) => {
if (x.new_status == 0) {
this.TotalPrice += x.attrs.price * x.num;
x.checked = true;
new_statusnum++
}
//编辑时候的商城全选
if (this.editType == true) {
if (this.cart_id_list.length > 0) {
this.cart_id_list.forEach((z) => {
if (x.id != z.id) {
let obj = {
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) => {
if (x.checked == false) {
list_all = false
}
})
if (list_all == true) {
this.allchecked = true;
}
this.checkCount += new_statusnum;
} else {
let new_statusnum = 0
this.list[i].goods_list.forEach((x) => {
if (x.new_status == 0) {
x.checked = false;
this.TotalPrice -= x.attrs.price * x.num;
new_statusnum++
}
//编辑时候的商城全选
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;
}
},
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.goods_list.forEach((j) => {
if (j.new_status == 0) {
j.checked = true;
this.checkCount++;
this.TotalPrice += j.attrs.price * j.num
}
//编辑的时候
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.goods_list.forEach((j) => {
j.checked = false;
})
});
}
},
inputblur(i, index, num, price, e) {
let value = Number(e.target.value)
if (value == 0) {
this.list[i].goods_list[index].num = 1;
this.TotalPrice += price * 1;
}
},
onKeyInput(i, index, num, price, e) { //输入的数量
let value = Number(e.target.value)
this.list[i].goods_list[index].num = value;
if (this.list[i].goods_list[index].checked == true) {
if (value > num) {
this.TotalPrice += price * (value - num);
} else if (value < num) {
this.TotalPrice -= price * (num - value);
}
}
},
reduce(i, index, price) {
//减
if (this.list[i].goods_list[index].num > 1) {
this.list[i].goods_list[index].num -= 1;
if (this.list[i].goods_list[index].checked == true) {
this.TotalPrice -= price * 1;
}
}
},
plus(i, index, price) {
//加
this.list[i].goods_list[index].num += 1;
if (this.list[i].goods_list[index].checked == true) {
this.TotalPrice += price * 1;
}
},
edit() {
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.goods_list.forEach((j) => {
j.checked = false
})
});
},
delete_btn() {
if (this.cart_id_list.length > 0) {
uni.showNavigationBarLoading();
let h = this.apiheader();
h["content-type"] = "application/x-www-form-urlencoded";
this.request({
url: "",
method: "POST",
header: h,
data: {
r: "api/cart/delete",
cart_id_list: JSON.stringify(this.cart_id_list),
},
},
(res) => {
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,
});
}
},
settlement() {
if (this.checkCount > 0) {
let goods = [];
this.list.forEach((x) => {
if (x.checked) {
let g = {
id: x.goods_id,
num: x.num,
cart_id: x.id,
goods_attr_id: x.attr_id,
attr: [],
};
x.attrs.attr.forEach((x) => {
g.attr.push({
attr_id: x.attr_id,
attr_group_id: x.attr_group_id,
});
});
goods.push(g);
}
});
uni.navigateTo({
url: "/pages/order-submit/order-submit?goods=" +
encodeURIComponent(JSON.stringify(goods))
});
} else {
uni.showToast({
title: "请选择购买商品",
position: "bottom",
icon: "none",
duration: 2000,
});
}
},
},
};
</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: 40rpx 30rpx;
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: absolute;
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;
}
</style>
......@@ -64,6 +64,7 @@
export default {
data() {
return {
pageTitle:'我的收藏',
loading: true,
contentHeight:0,
showAuth:false,
......@@ -84,6 +85,21 @@
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.init()
},
mounted() {
let currentPages = getCurrentPages();
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,
});
},
onLoad(){
this.u = wx.getStorageSync("userinfo");
if (!this.u) {
......@@ -185,6 +201,7 @@
margin-bottom: 3px;
font-size: 13px;
margin: 7px 10px;
height: 36px;
}
.favoriteStyle .u-good-list .good .good-info {
display: flex;
......
......@@ -29,7 +29,7 @@
</view>
<view v-if="g.length > 0"
style="
height: calc(100vh - 40px);
height: calc(100vh - 50px);
width: calc(100vw);
overflow: hidden;
padding-top: 10px;
......@@ -60,14 +60,15 @@
</view>
</view>
<u-divider
contentPosition="center"
v-if="isover"
:margin-top="20"
:margin-bottom="20"
bg-color='#f3f4f6'
>没有更多足迹了</u-divider>
</scroll-view>
<u-divider
contentPosition="center"
v-if="isover"
:margin-top="20"
:margin-bottom="20"
>没有更多商品了</u-divider>
</view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<view class="loading" v-show="loading">
......@@ -128,6 +129,7 @@
export default {
data() {
return {
pageTitle:"我的足迹",
isloading:true,
loading:false,
loading2:false,
......@@ -165,6 +167,21 @@
this.fun_date(0)
},
mounted() {
let currentPages = getCurrentPages();
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,
});
},
onLoad(){
this.u = wx.getStorageSync("userinfo");
if (!this.u) {
......
......@@ -63,7 +63,9 @@
</view>
</view>
</template>
<Text style='font-size: 32rpx;text-align: right;width: 100%;'>¥{{item.total_price}}</Text>
<Text style='font-size: 32rpx;text-align: right;width: 100%;'>合计:¥{{item.total_price}}
<Text v-if='item.express_price!=0' style='font-size: 20rpx;color: #A0A09D;'>(含运费 ¥{{item.express_price}})</Text>
</Text>
<!-- TODO 样式结构修改-->
<view class="handle">
......@@ -77,7 +79,13 @@
</view>
</view>
</view>
<u-divider
contentPosition="center"
v-if="isover"
:margin-top="20"
:margin-bottom="20"
bg-color='#f3f4f6'
>没有更多订单了</u-divider>
</scroll-view>
......@@ -110,12 +118,13 @@
},
data() {
return {
pageTitle:'我的订单',
current: 0,
list: [{name: '全部'}, {name: '待付款'},{name: '待发货'},{name: '待收货'},{name: '待评价'},],
mainColor: "",
contentHeight:0,
page:1,
page_count:0,
page_count:1,
g:[],
loading:false,
showModal:false,
......@@ -123,6 +132,7 @@
index:0,
goodData:[],
showGoodList:false,
isover:false
};
},
created(){
......@@ -130,6 +140,21 @@
this.mainColor = this.$uiConfig.mainColor;
},
mounted() {
let currentPages = getCurrentPages();
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,
});
},
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
this.current = option.status;
this.loading = true;
......@@ -144,9 +169,8 @@
this.init()
},
init(){
this.isover = false;
let h=this.apiheader()
this.request(
{
url: "",
......@@ -160,11 +184,25 @@
},
res => {
this.loading = false;
this.g = res.data.list;
this.g = this.g.concat(res.data.list);
this.page_count = res.data.pagination.page_count;
if (this.page_count == 1) {
this.isover = true;
}
}
);
},
lower(e) {
if (this.page < this.page_count) {
this.page++;
this.init();
} else {
this.isover = true;
}
},
cancel(e,index){
this.showModal=true;
this.index=index;
......
......@@ -77,6 +77,7 @@
:name="item.name" @click="goUrl(item.link_url)">
<image :src='item.icon_url' style="width: 66rpx;height: 60rpx;"></image>
<Text style='margin-top: 10rpx;'>{{item.name}}</Text>
<!-- <view class='badge'>{{item.}}</view> -->
</view>
</view>
</view>
......@@ -157,7 +158,6 @@
this.contentHeight = this.$utils.calcContentHeight(c);
let u = "/" + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync("basedata")
? wx.getStorageSync("basedata").bar_title
: [];
......@@ -167,6 +167,9 @@
this.pageTitle = x.new_name ? x.new_name : x.name;
}
});
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.userinfo()
this.getmeue()
......@@ -324,6 +327,12 @@
flex-direction: column;
align-items: center;
margin-top: 20rpx;
position: relative
}
.userStyle .badge{
position: absolute;
right: -10rpx;
top: -10rpx;
}
.userStyle .menus{
width: 94%;
......
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