Browse Source

订单例表页加载,地址加载,宠物宝贝加载, 个人详情页表单

master
chenlong 1 year ago
parent
commit
abe1372841
  1. 15
      api/user.js
  2. 2
      pages/Card/index.vue
  3. 2
      pages/Index/components/ChatPage/index.vue
  4. 3
      pages/Index/components/OrderPage/index.vue
  5. 77
      pages/UserDetail/index.vue

15
api/user.js

@ -23,12 +23,11 @@ export function login(data) {
}
export function userDetail(data) {
export function userDetail() {
return request({
url: `${host}/user/detail`,
method: "post",
data
});
}
export function userExtends(data) {
@ -57,3 +56,15 @@ export function appletLogin(code){
}
})
}
/**
* 更新用户详情
* @param data
*/
export function updateUserDetail(data){
return request({
url:"user/updateInfo",
method:'post',
data:data
})
}

2
pages/Card/index.vue

@ -36,7 +36,7 @@
</view>
<view class="card-btn" @click="navTo('/pages/CardDetail/index?id='+item.id)">
<MzButton
title="开始预约"
title="立即购买"
font-color="#FFFFFF"
button-color="#4DC3B8"
button-width="255rpx"

2
pages/Index/components/ChatPage/index.vue

@ -89,7 +89,7 @@
return false;
}
this.status = 'loading';
chatList(this.page, this.$store.state.userInfo.store_id !== null).then(res => {
chatList(this.page, this.$store.state.userInfo.store_id > 0).then(res => {
this.chatList.push.apply(this.chatList,res.data);
if(res.data.length === 0){
this.status = 'nomore';

3
pages/Index/components/OrderPage/index.vue

@ -39,7 +39,7 @@
<view class="order-list-container">
<view class="order-list-item" v-for="(item,index) of 10">
<view class="order-list-item" v-for="(item,index) in orderList">
<view class="order-card-container row">
<view class="order-card-container-background col-12"></view>
<view class="order-card-container-background-main row">
@ -162,7 +162,6 @@
},
methods: {
selectScreen(item){
this.screenCheck = item.value;
this.page = 1;

77
pages/UserDetail/index.vue

@ -15,26 +15,38 @@
</view>
<view class="detail-content-item">
<view class="detail-item-title">昵称</view>
<view class="detail-item-content">{{user.nickname}}
<view class="detail-item-content">
<u-input v-model="user.name" inputAlign="right" ></u-input>
<u-icon class="arrow-right" name="arrow-right"></u-icon>
</view>
</view>
<view class="detail-content-item">
<view class="detail-content-item" @click="$refs.datetimepicker.open()">
<view class="detail-item-title">生日</view>
<view class="detail-item-content">{{user.birthday}}
<view class="detail-item-content">
<u-text :text="birthday" size="28" color="#636363"></u-text>
<uv-datetime-picker
ref="datetimepicker"
v-model="user.birthday"
mode="date"
minDate="1900-01-01"
@confirm="birthdayConfirm"
></uv-datetime-picker>
<u-icon class="arrow-right" name="arrow-right"></u-icon>
</view>
</view>
<view class="detail-content-item">
<view class="detail-item-title">手机</view>
<view class="detail-item-content">{{user.phone}}
<view class="detail-item-content">
<u-input v-model="user.phone" inputAlign="right" ></u-input>
<u-icon class="arrow-right" name="arrow-right"></u-icon>
</view>
</view>
<view class="detail-content-item">
<view class="detail-content-item" @click="$refs.sexPicker.open()">
<view class="detail-item-title">性别</view>
<view class="detail-item-content">{{user.sex}}
<view class="detail-item-content">
<u-text :text="sexTitle" size="28" color="#636363"></u-text>
<uv-picker ref="sexPicker" @confirm="sexConfirm" :default-index="[sexChecked]" key-name="title" v-model="user.sex" :columns="sexs"></uv-picker>
<u-icon class="arrow-right" name="arrow-right"></u-icon>
</view>
</view>
@ -45,6 +57,9 @@
<view class="detail-item-background"></view>
</view>
</view>
<view @click="submit" class="detail-logout-button">
修改信息
</view>
<view class="detail-logout-button">
退出登录
</view>
@ -63,19 +78,28 @@
} from '@/config/host.js'
import api from '@/utils/functions.js';
import HeaderNav from '@/components/HeaderNav/Index.vue';
import log from "@/utils/log";
import {updateUserDetail, userDetail} from "@/api/user";
import functions from "@/utils/functions.js";
export default {
components:{
HeaderNav
},
data: {
sexChecked:0,
sexTitle:'',
birthday:'',
show:false,
sexShow:false,
sexs:[[{title: '男', value: 1}, {title:'女', value:2}]],
staticImage:{
wallpaperBgImage:imghost+'/static/image/background.png',
},
user:{
avatar:imghost+'/static/image/banner.png',
nickname:'清晨的风',
name:'清晨的风',
background:imghost+'/static/image/banner.png',
sex:'女',
sex:1,
phone:'15012345678',
coupons:221,
id:88685,
@ -83,10 +107,43 @@
},
},
onLoad() {
this.setSexTitle();
this.getUserDetail();
},
methods: {
getUserDetail(){
userDetail().then(({ data }) => {
this.user = data;
this.birthday = this.user.birthday ? this.user.birthday : '2000-01-01'
this.user.birthday = this.birthday
this.user.sex = this.user.sex === 1 ? 1 : 2;
this.setSexTitle(this.user.sex);
})
},
sexConfirm(v){
log(v);
this.user.sex = v.value[0].value;
this.setSexTitle(v.value[0].value);
},
birthdayConfirm(v){
this.birthday = uni.$u.timeFormat(v.value, 'yyyy-mm-dd');
},
submit(){
if(this.user.birthday ){
this.user.birthday = uni.$u.timeFormat(this.user.birthday, 'yyyy-mm-dd')
}
updateUserDetail(this.user).then((data) =>{
uni.setStorageSync('user', data.data);
functions.success("修改成功").then(() =>{
uni.navigateBack();
})
});
},
setSexTitle(v){
log(v);
this.sexTitle = [0, '男', '女'][v ? v : this.user.sex];
log(this.sexTitle);
}
},
onPageScroll(res) {

Loading…
Cancel
Save