Commit 6009139c authored by zhangjianguo's avatar zhangjianguo

样式的修改

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