Commit 5b384f8f authored by zhangjianguo's avatar zhangjianguo

我的足迹模块

parent 448bff0f
......@@ -7,29 +7,27 @@
</view>
</view>
<view class="addcenter">
<u-field
v-model="mobile"
label="收货人"
>
</u-field>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<u-field
v-model="mobile"
label="联系电话"
>
</u-field>
<view class="addcenter_item2">
<Text>收货人</Text>
<input class="uni-input inputM" v-model="msg.name" />
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<view class="addcenter_item2">
<Text>联系电话</Text>
<input class="uni-input inputM" v-model="msg.mobile" />
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<!-- TODO 动态获取地址数据 -->
<view class="addcenter_item">
<Text>所在地区</Text>
<view style="display: flex;flex-direction: row;align-items: center;">
<Text :style="{'color':msg.address!=''? '#303133':'#9D9C9B'}">{{msg.address!=''? msg.address :'请选择'}}</Text>
<view style="display: flex;flex-direction: row;align-items: center;" @click="Pickershwo=true">
<Text :style="{'color':address!=''? '#303133':'#9D9C9B'}">{{address!=''? address :'请选择'}}</Text>
<u-icon name="arrow" color="#B2B2B2" size="30" ></u-icon>
</view>
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<!-- TODO 定位地址 -->
<view class="addcenter_item">
<Text>定位地址</Text>
<view style="display: flex;flex-direction: row;align-items: center;">
......@@ -38,17 +36,16 @@
</view>
</view>
<view style="width: 100%;height: 1px;background: #e4e7ed;"/>
<u-field
v-model="mobile"
label="详细地址"
>
</u-field>
<view class="addcenter_item2">
<Text>详细地址</Text>
<input class="uni-input inputM" v-model="msg.detail" />
</view>
</view>
<view class="btn" @click="preserve">
<view class="btn" @click="preserve" :style="{'background':mainColor}">
<Text>保存地址</Text>
</view>
<u-picker v-model="Pickershwo" mode="region" @confirm = 'confirm'></u-picker>
<u-toast ref="uToast" />
</view>
</template>
......@@ -57,17 +54,88 @@
data(){
return{
contentHeight:0,
mainColor:'',
msg:{
address:''
}
location:'',
latitude:'',
longitude:'',
id:0,
name:'',
mobile:'',
address:'',
province_id:'2',
city_id:'3',
district_id:'4',
detail:'',
},
address:'',
Pickershwo:false
}
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
},
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
if(option.u!=undefined){
let u = JSON.parse(decodeURIComponent(option.u))
this.msg=u;
this.address = u.province+','+u.city+','+u.district;
}
},
methods:{
preserve(){
let pages = getCurrentPages(); // 当前页面
let beforePage = pages[pages.length - 2]; // 前一个页面
uni.showNavigationBarLoading();
let h = this.apiheader();
h['content-type']='application/x-www-form-urlencoded'
this.request(
{
url: "",
method: "POST",
header: h,
data: {
r: "api/user/address-save",
location:this.msg.location,
latitude:this.msg.latitude,
longitude:this.msg.longitude,
id:this.msg.id,
name:this.msg.name,
mobile:this.msg.mobile,
address:this.msg.address,
province_id:this.msg.province_id,
city_id:this.msg.city_id,
district_id:this.msg.district_id,
detail:this.msg.detail,
}
},
res => {
this.$refs.uToast.show({
title: "保存成功"
});
setTimeout(()=>{
uni.navigateBack({
success: function() {
beforePage.onLoad(); // 执行前一个页面的created方法
}
});
},1000)
uni.hideNavigationBarLoading();
},
);
},
confirm(e){
console.log(e)
this.address = e.province.label+','+e.city.label+','+e.area.label;
this.msg.province_id = e.province.value;
this.msg.city_id = e.city.value;
this.msg.district_id = e.area.value;
}
}
}
......@@ -99,11 +167,21 @@
align-items: center;
justify-content: space-between;
}
.AddaddressStyle .addcenter_item2{
width: 100%;
padding: 20rpx 28rpx;
color: #303133;
font-size: 28rpx;
display: flex;
flex-direction: row;
align-items: center;
}
.AddaddressStyle .btn{
width:94% ;
height: 80rpx;
background:#EA554D;
display: flex;
align-items: center;
justify-content: center;
......@@ -112,4 +190,8 @@
margin-top: 46rpx;
border-radius: 40rpx;
}
.AddaddressStyle .inputM{
margin-left: 20rpx;
width: 70%;
}
</style>
......@@ -8,23 +8,23 @@
>
<view v-for="(item, index) in list" :key="index" class="addresbox">
<view class="addresclo">
<Text>收件人:{{item.name}}</Text>
<Text >收件人:{{item.name}}</Text>
<Text>{{item.mobile}}</Text>
</view>
<Text>收货地址:{{item.address}}</Text>
<Text style='width: 100%;'>收货地址:{{item.address}}</Text>
<view style="width: 100%;height: 2rpx;background: #EEEEEE;margin-top: 15rpx;"></view>
<view class="addresclo">
<u-checkbox-group @change="isdefault(item)">
<u-checkbox v-model="item.is_default==1?true:false" shape="circle" active-color="red">
<u-checkbox v-model="item.is_default==1?true:false" shape="circle" :active-color="mainColor">
<Text
:style="{'color':item.is_default==1?'#F43F3B':'#c8c9cc' }"
:style="{'color':item.is_default==1?mainColor:'#c8c9cc' }"
>{{item.is_default==1?'已设为默认':'设为默认'}}</Text>
</u-checkbox>
</u-checkbox-group>
<view style="display: flex;flex-direction: row;align-items: center;">
<view
style="display: flex;flex-direction: row;align-items: center;"
@click="btn_edit()"
@click="btn_edit(item)"
>
<u-icon name="edit" color="#c8c9cc" size="40"></u-icon>
<Text style="color:#c8c9cc;">编辑</Text>
......@@ -40,10 +40,11 @@
</view>
</view>
<view class="bottom_btn">
<view class="bottom_btn_item" style="background: #EA554D;" @click="ManualAdd">
<view class="bottom_btn_item" :style="{'background':mainColor}" @click="ManualAdd">
<u-icon name="add-o" color="#fff" size="30"></u-icon>
<Text style="color:#fff;margin-left: 10rpx;">手动添加</Text>
</view>
<!-- TODO 自动获取 -->
<view class="bottom_btn_item" style="background: #5CBF39;" @click="automatic">
<u-icon name="location" color="#fff" size="30"></u-icon>
<Text style="color:#fff;margin-left: 10rpx">自动获取</Text>
......@@ -72,6 +73,7 @@ export default {
loading: true,
list: [],
showAuth: false,
mainColor: "",
u: {},
contentHeight: 0,
showModal: false,
......@@ -83,6 +85,8 @@ export default {
},
created() {
this.contentHeight = this.$utils.calcContentHeight(-40) + "px";
this.mainColor = this.$uiConfig.mainColor;
},
onLoad() {
console.log(wx.getStorageSync("basedata"));
......@@ -94,22 +98,17 @@ export default {
};
this.showAuth = true;
}
this.init();
},
methods: {
init() {
this.loading = false;
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header: {
"X-Access-Token": "Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ",
"X-App-Platform": "wxapp",
"X-App-Version": "4.2.47",
"X-Form-Id-List": JSON.stringify([]),
"X-Requested-With": "XMLHttpRequest",
"X-User-Id": 21269
},
header: h,
data: {
r: "api/user/address"
}
......@@ -129,26 +128,13 @@ export default {
isdefault(item) {
//默认地址
uni.showNavigationBarLoading();
let h = this.apiheader();
h['content-type']='application/x-www-form-urlencoded'
this.request(
{
url: "",
method: "POST",
header: {
"content-type": "application/x-www-form-urlencoded",
"X-Access-Token": "Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ",
"X-App-Platform": "wxapp",
"X-App-Version": "4.2.47",
"X-Form-Id-List": JSON.stringify([
{
value: "873015dc76a242cc8c7ae1c25cdbdf4c",
type: 0,
remains: 1,
expires_at: "2020-05-25 19:03:25"
}
]),
"X-Requested-With": "XMLHttpRequest",
"X-User-Id": 21269
},
header: h,
data: {
r: "api/user/address-default",
id: item.id,
......@@ -162,33 +148,24 @@ export default {
}
);
},
btn_edit() {},
btn_edit(item) {
uni.navigateTo({
url: "/pages/address/AddAddress?u=" + encodeURIComponent(JSON.stringify(item))
});
},
btn_delete(item) {
this.deleteID = item.id;
this.showModal = true;
},
confirm() {
uni.showNavigationBarLoading();
let h = this.apiheader();
h['content-type']='application/x-www-form-urlencoded'
this.request(
{
url: "",
method: "POST",
header: {
"content-type": "application/x-www-form-urlencoded",
"X-Access-Token": "Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ",
"X-App-Platform": "wxapp",
"X-App-Version": "4.2.47",
"X-Form-Id-List": JSON.stringify([
{
value: "873015dc76a242cc8c7ae1c25cdbdf4c",
type: 0,
remains: 1,
expires_at: "2020-05-25 19:03:25"
}
]),
"X-Requested-With": "XMLHttpRequest",
"X-User-Id": 21269
},
header: h,
data: {
r: "api/user/address-destroy",
id: this.deleteID
......@@ -214,7 +191,7 @@ export default {
}
},
mounted() {
this.init();
}
};
</script>
......
......@@ -144,19 +144,12 @@
},
init() {
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header:{
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List': JSON.stringify([]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269
},
header:h,
data: {
r: "api/cart/list",
},
......@@ -275,21 +268,14 @@
uni.showNavigationBarLoading();
let h = this.apiheader();
h['content-type']='application/x-www-form-urlencoded'
this.request(
{
url: "",
method:"POST",
header:{
'content-type': 'application/x-www-form-urlencoded',
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List':JSON.stringify([{"value":"873015dc76a242cc8c7ae1c25cdbdf4c","type":0,"remains":1,"expires_at":"2020-05-25 19:03:25"}]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269,
},
header:h,
data: {
r: "api/cart/delete",
cart_id_list:JSON.stringify(this.cart_id_list) ,
......
......@@ -107,18 +107,11 @@
init(){
this.loading = false;
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header:{
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List': JSON.stringify([]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269
},
header:h,
data: {
r: "api/user/my-favorite-goods",
},
......@@ -135,18 +128,12 @@
gettopic(){ //专题数据
this.loading = false;
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header:{
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List': JSON.stringify([]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269
},
header:h,
data: {
r: "api/user/my-favorite-topic",
},
......
<template>
<view class="footStyle" :style="{'height':contentHeight}">
<view class="footTop">
<view class="footTop_c">
<view class="footTop_item" style="background: #EA554D;">
<view class="footTop_c" >
<view class="footTop_item" :style="{'background':mainColor}" >
<Text style='color: #fff;'>浏览记录</Text>
</view>
<view class="footTop_item" @click="billsummary">
<Text style='color: #EA554D;'>账单总结</Text>
<Text :style="{'color':mainColor}">账单总结</Text>
</view>
</view>
</view>
<view class="footTop_content">
<view style="width: 94%;margin-left: 3%;">
<u-tabs
:list="timelist"
:is-scroll="false"
:current="current"
bar-height="6"
:active-color=mainColor
@change="change"></u-tabs>
</view>
</view>
<u-empty v-if="g.length==0" text="暂无任何浏览记录~" mode="favor"></u-empty>
<view v-if="g.length==0" style="display: flex;align-items: center;justify-content: center;margin-top: 20rpx;">
<u-button shape="circle" type="error" size="medium" @click='goshoping'>去商城逛逛</u-button>
</view>
<view v-if="g.length > 0"
style="
height: calc(100vh - 110px);
width: calc(100vw);
overflow: hidden;
padding-top: 10px;
">
<scroll-view
:scroll-y="true"
:enable-back-to-top="true"
:enable-flex="true"
@scrolltolower="lower"
:style="{ height: '100%' }">
<view class="contentBox">
<view class="cBox_item" v-for="(cx, ci) in g" :key="ci" @click="clickHandler(cx.goods_id)">
<view class="good-img">
<image :src="cx.goodsWarehouse.cover_pic" style="width: 100%; height: 100%;" />
</view>
<view class="good-info">
<Text class='good-name'>{{cx.goodsWarehouse.name}}</Text>
<view style="display: flex;flex-direction: row;align-items: center;justify-content: space-between;">
<Text :style="{'color':mainColor}">¥{{cx.price}}</Text>
<u-icon name="ellipsis" color="#c8c9cc" size="40" @click='operation(cx)'></u-icon>
</view>
</view>
</view>
</view>
</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">
<u-loading mode="flower" size="48">></u-loading>
......@@ -29,12 +79,24 @@
return {
isloading:true,
loading:false,
loading2:false,
showAuth:false,
contentHeight:0,
list:[
{name: '浏览记录'},
{name: '账单总结'},
]
mainColor: "",
timelist:[
{name: '今日'},
{name: '昨日'},
{name: '近7日'},
{name: '近30日'},
{name: '自定义时间'},
],
start_time:'',
end_time:'',
current:0,
page:1,
g:[],
page_count:1,
isover: false,
}
},
components:{
......@@ -42,10 +104,11 @@
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
console.log(this.contentHeight)
this.mainColor = this.$uiConfig.mainColor;
this.fun_date(0)
},
onLoad(){
console.log(wx.getStorageSync("basedata"))
this.u = wx.getStorageSync("userinfo");
if (!this.u) {
this.u = {
......@@ -56,13 +119,108 @@
}
},
methods: {
init(){
this.loading=true
this.isover = false;
this.loading2 = true;
this.request(
{
url: "",
header:{
'X-Access-Token': 'Tc8G75W5llGY_UPwlHBscYEPs1a32cDJ',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List': JSON.stringify([]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269
},
data: {
r: "api/footprint/footprint",
page: this.page,
start_time: this.start_time,
end_time: this.end_time,
}
},
res => {
if(res.list.length>0){
this.g = this.g.concat(res.list[0].goods);
this.page_count = res.pagination.page_count;
if (this.page_count == 1) {
this.isover = true;
}
}
this.loading = false;
this.loading2 = false;
}
);
},
lower(e) {
if (this.page < this.page_count) {
console.log(this.loading2)
if (!this.loading2) {
this.page++;
this.init();
}
} else {
this.isover = true;
}
},
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.showAuth=false
},
change(index) {
this.current = index;
if(index==0){//今天
this.fun_date(0)
}else if(index==1){//昨天
this.fun_date(1)
}else if(index==2){
this.fun_date(7)
}else if(index==3){
this.fun_date(30)
}
},
billsummary(){
console.log('跳转菜单总结')
},
operation(e){
console.log(e)
},
fun_date(num){
let that= this
let date1 = new Date();
//今天时间
let time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate()+' '+ '23:59:59'
let date2 = new Date(date1);
date2.setDate(date1.getDate() - num);
//num是正数表示之后的时间,num负数表示之前的时间,0表示今天
let time2 = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate()+' '+ '00:00:00';
let time3 = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate()+' '+ '23:59:59';
that.start_time= time2;
if(num== 1){ //只限于昨天的时候使用
that.end_time=time3;
}else{
that.end_time=time1;
}
this.page = 1
this.g =[]
this.init()
},
goshoping(){
uni.redirectTo({ url: "/pages/index/index" });
},
clickHandler(id) {
uni.navigateTo({
url: '/pages/goods/goods?id='+id,
});
},
}
}
</script>
......@@ -111,5 +269,40 @@
}
.footStyle .footTop_content{
width: 100%;
background-color: #fff;
}
.footStyle .contentBox{
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.footStyle .cBox_item{
width: 30%;
border-radius: 10rpx;
margin-top: 5px;
background: #fff;
margin-left: 2.5%;
overflow: hidden;
}
.footStyle .good-img {
width: 100%;
height: 200rpx;
}
.footStyle .good-info{
width: 100%;;
height:150rpx ;
padding: 0 10rpx;
}
.footStyle .good-name {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-bottom: 6rpx;
font-size: 26rpx;
margin: 14rpx 0;
}
</style>
......@@ -10,12 +10,12 @@
<u-avatar :src="user_info.avatar" size='140' ></u-avatar>
<Text style="color: #FFF;margin-left: 20rpx;font-size: 36rpx;" @click='login(user_info)'>{{user_info.nickname?user_info.nickname:'立即登录'}}</Text>
</view>
<view class="ReceiptAdder" @click="goUrl('/pages/address/address')">
<view class="ReceiptAdder" @click="goUrl('/pages/address/address')" :style="{'background':mainColor}">
<u-icon name="location" color="#fff" size="40" ></u-icon>
<Text style='color: #fff;font-size: 32;margin-left: 20rpx;'>收货地址</Text>
</view>
</view>
<view class="footprint" v-if='meueData.user_center.is_foot_bar_status==1'>
<view class="footprint" v-if='meueData.user_center.is_foot_bar_status==1' >
<view class="footprint_item" @click="goUrl('/pages/favorite/favorite')">
<text>{{user_info.favorite}}</text>
<view class="footprint_item_bottom">
......@@ -35,7 +35,7 @@
<view class="account_bar" v-if="meueData.user_center.is_account_status==1">
<view class="account_bar_item">
<Text style="color: #F4BD61;">{{user_info.integral}}</Text>
<Text :style="{'color':secondary}">{{user_info.integral}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.integral.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.integral.text}}</Text>
......@@ -44,7 +44,7 @@
<view style="width: 1rpx;height: 60rpx;background: #EEEEEE;"></view>
<view class="account_bar_item">
<Text style="color: #F4BD61;">{{user_info.coupon}}</Text>
<Text :style="{'color':secondary}">{{user_info.coupon}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.coupon.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.coupon.text}}</Text>
......@@ -53,7 +53,7 @@
<view style="width: 1rpx;height: 60rpx;background: #EEEEEE;"></view>
<view class="account_bar_item">
<Text style="color: #F4BD61;">{{user_info.card}}</Text>
<Text :style="{'color':secondary}">{{user_info.card}}</Text>
<view class="footprint_item_bottom">
<image :src='meueData.user_center.account_bar.card.icon' style="width: 26rpx;height: 26rpx;"></image>
<Text style='margin-left: 10rpx;'>{{meueData.user_center.account_bar.card.text}}</Text>
......@@ -108,6 +108,8 @@
bottommargin:0,
listbottom:0,
showAuth:false,
mainColor: "",
secondary:'',
u: {},
}
},
......@@ -115,6 +117,11 @@
tabbars,
auth
},
created(){
this.mainColor = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
},
onLoad() {
this.navHeight = this.$navHeight - 2;
this.u = wx.getStorageSync("userinfo");
......@@ -161,18 +168,11 @@
},
userinfo() {
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header:{
'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr',
'X-App-Platform': 'wxapp',
'X-App-Version':'4.2.47',
'X-Form-Id-List': JSON.stringify([]),
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 21269
},
header:h,
data: {
r: "api/user/user-info",
},
......@@ -187,19 +187,11 @@
},
getmeue(){
uni.showNavigationBarLoading();
let h = this.apiheader();
this.request(
{
url: "",
header:{
'X-Access-Token': '_4Y_WpUZ4a6SI5uJgsZ4Lb7t9mvqJTyr',
'X-App-Platform': 'wxapp',
'X-App-Version': '4.2.47',
'X-Form-Id-List': [{"value":"7567542b600b46ac9d1945822f697123","type":0,"remains":1,"expires_at":"2020-05-25 11:25:17"}],
'X-Requested-With': 'XMLHttpRequest',
'X-User-Id': 19992,
},
header:h,
data: {
r: "api/user/config",
},
......@@ -372,7 +364,6 @@
top:125rpx;
width: 230rpx;
height:80rpx ;
background: #EA554D;
border-top-left-radius: 40rpx;
border-bottom-left-radius: 40rpx;
display: flex;
......
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