Commit 072db068 authored by 沈良进's avatar 沈良进

个人中心页面适配移动端

parent cb6e7cbe
......@@ -24,6 +24,9 @@
.flex-wrap {
flex-wrap: wrap;
}
.flex-noShark {
flex-shrink: 0;
}
.margin {
margin: 10px;
......@@ -114,6 +117,9 @@
.f36 {
font-size: 36px;
}
.f42 {
font-size: 42px;
}
.text-center {
text-align: center;
}
......
<style lang="scss" scoped>
.avatar {
width: 94px;
height: 94px;
width: 60px;
height: 60px;
background: #ffffff;
border: 2px solid #f0efef;
border-radius: 50%;
......@@ -9,52 +9,129 @@
display: block;
}
.nav-item {
margin: 10px 28px;
margin:0 10px;
padding: 10px;
border-bottom: 1px solid #eee;
}
.nav-item:last-child {
border-bottom: none;
}
.select {
height: 41px;
border-radius: 8px;
color: #ffffff;
height: 41px;
border-radius: 8px;
color: #ffffff;
}
.action-item {
width: 18px;
height: 18px;
display: inline-block;
margin-left: 10px;
}
.edit-info {
width: 12px;
height: 12px;
}
.padding-20 {
padding: 20px;
}
.card {
margin: 25px 15px;
border-radius: 15px;
padding: 10px;
}
.order-item {
width: 25%;
display: inline-block;
}
.order-img {
width: 26px;
height: 26px;
}
.go-play {
width: 36px;
height: 36px;
}
.play-box {
padding: 8px;
background: #FAF9F9;
border-radius: 9px;
margin: 10px 13px 0 13px;
}
</style>
<template>
<div class="user-nav-box">
<div class="flex justify-between">
<span class="f42">个人中心</span>
<div>
<img />
<img /></div>
<div class="padding-20">
<div class="flex justify-between items-center">
<span class="f20">个人中心</span>
<div>
<img class="action-item" src="../../assets/img/userCenter/help.png" />
<img @click="CommonJump('/setInfo')" class="action-item" src="../../assets/img/userCenter/set.png" />
</div>
</div>
<div class="flex items-center q-mt-md">
<div>
<img class="avatar" v-if="LoginUser.photo" :src="LoginUser.photo" />
<img class="avatar" v-else src="../../assets/img/avatar.png" />
</div>
<div class="q-ml-md">
<div class="f18">hello,开起你的旅程吧~</div>
<div @click="CommonJump('/setUserInfo')">
<img class="edit-info" src="../../assets/img/userCenter/edit.png" />
個人信息管理
</div>
</div>
</div>
</div>
<div class="q-mt-lg">
<div class="bg-white q-mt-xl q-pb-lg">
<div class="bg-white card">
<div
class="order-item cursor-pointer"
@click="navigateTo(item.key)"
v-for="item in orderList"
:key="item.key"
:class="{ 'select bg-primary': selectKey === item.key }"
>
<div class="column flex-center">
<img class="order-img" :src="require(`../../assets/img/userCenter/${item.icon}.png`)" />
<div>{{ item.label }}</div>
</div>
<!-- <span class="text-primary">{{ item.label }}</span> -->
</div>
<div class="flex play-box q-mt-md">
<img class="go-play q-mr-md" src="../../assets/img/userCenter/set.png" />
<div class="f12">
<div>即將出行</div>
<div class="text-grey-6">[2023年3月6日]日本富士山尊享一日遊</div>
</div>
</div>
</div>
<div class="bg-white card">
<div
class="nav-item flex justify-between items-center cursor-pointer"
@click="navigateTo(item.key)"
v-for="item in menuList"
:key="item.key"
:class="{'select bg-primary': selectKey === item.key}"
>
<div class="flex items-center">
<i class="iconfont" :class="item.icon"></i>
<span class="q-ml-lg">{{ item.label }}</span>
</div>
<i class="iconfont iconpreviewright"></i>
<!-- <span class="text-primary">{{ item.label }}</span> -->
</div>
</div>
</div>
<div class="bg-white q-mt-lg q-py-lg">
<div class="bg-white card">
<div
class="nav-item flex justify-between items-center cursor-pointer"
@click="navigateTo(item.key)"
v-for="item in menuList2"
:key="item.key"
:class="{'select bg-primary': selectKey === item.key}"
>
<div class="flex items-center">
<i class="iconfont" :class="item.icon"></i>
<span class="q-ml-lg">{{ item.label }}</span>
</div>
<i class="iconfont iconpreviewright"></i>
<!-- <span class="text-primary">{{item.label}}</span> -->
</div>
</div>
......@@ -64,8 +141,34 @@ color: #ffffff;
export default {
data() {
return {
selectKey: '',
selectKey: "",
LoginUser: {},
orderList: [
{
icon: "order-pay",
key: "/order?type=1",
label: "待付款",
number: "",
},
{
icon: "order-use",
key: "/order?type=2",
label: "待出行",
number: "",
},
{
icon: "order-finish",
key: "/order?type=3",
label: "已完成",
number: "",
},
{
icon: "order-all",
key: "/order?type=0",
label: "全部订单",
number: "",
},
],
menuList: [
{
icon: "iconqianbao",
......@@ -73,12 +176,6 @@ export default {
label: "可用優惠券",
number: "",
},
{
icon: "iconorder",
key: "/order",
label: "訂單",
number: "",
},
// {
// icon: "iconmessage",
// key: "",
......@@ -111,24 +208,24 @@ export default {
label: "登录方式管理",
number: "",
},
{
icon: "iconset",
key: "/setInfo",
label: "账户设置",
number: "",
},
// {
// icon: "iconset",
// key: "/setInfo",
// label: "账户设置",
// number: "",
// },
],
};
},
mounted() {
this.selectKey = this.$route.path
this.selectKey = this.$route.path;
if (localStorage.b2bUser) {
this.LoginUser = JSON.parse(window.localStorage.getItem("b2bUser"));
}
},
methods: {
navigateTo(route) {
this.selectKey= route
this.selectKey = route;
this.CommonJump(route, {});
},
},
......
<style lang="scss" scoped>
.form-item {
max-width: 320px;
margin: 10px;
}
.content {
width: 900px;
......@@ -72,8 +71,8 @@
width: 120px;
}
.nav-item {
width: 100px;
margin: 0 10px;
width: 25%;
max-width: 100px;
text-align: center;
}
.border-bottom {
......@@ -89,11 +88,10 @@
}
</style>
<template>
<div class="content q-ma-lg bg-white">
<div class="flex justify-between">
<div>
<div class="bg-white" :class="$q.platform.is.desktop ? 'q-ma-lg content': 'full-width'">
<div class="flex justify-between margin">
<div :class="$q.platform.is.desktop ? 'form-item': 'full-width'">
<q-input
class="form-item"
placeholder="輸入商品名稱/訂單號"
v-model="GoodsName"
clearable
......@@ -112,7 +110,8 @@
<div :class="orderStatus === item.ID ? 'border-bottom' : ''"></div>
</div>
</div>
<div>
<!-- pc -->
<div v-if="$q.platform.is.desktop">
<div class="card" v-for="item in orderList" :key="item.id">
<div class="flex card-title justify-between">
<div class="flex">
......@@ -159,8 +158,52 @@
</div>
</div>
</div>
<noneData v-show="!orderList.length"></noneData>
</div>
<!-- mobile -->
<div v-else>
<div class="card" v-for="item in orderList" :key="item.id">
<div class="flex card-title justify-between">
<div class="flex">
<span><span class="text-grey-6">订单号:</span>{{ item.orderNo }}</span>
</div>
<span class="text-grey-6">{{ item.orderStatusStr }}</span>
</div>
<div class="q-pa-md">
<div class="flex no-wrap full-width">
<img class="product-img mr flex-noShark" :src="item.goodsPic" />
<div>
<div class="ellipsis-2">{{ item.goodsName }}</div>
<div>x1</div>
</div>
</div>
<div>
<!-- <div>
<i class="iconfont iconpeople1"></i>{{ item.surName
}} {{ item.name }}
</div> -->
<div>
<div class="f18 text-right">CNY{{ item.totalPrice }}</div>
<!-- <div>{{ item.payTypeStr }}</div> -->
</div>
<!-- <div>
<div class="primary">{{item.orderStatusStr}}</div>
<div class="q-mt-sm cursor-pointer">订单详情</div>
</div> -->
<div class="flex justify-end q-mt-sm">
<q-btn
color="primary"
@click="cancalOrder(item)"
unelevated
outline
size="sm"
label="取消订单">
</q-btn>
</div>
</div>
</div>
</div>
</div>
<noneData v-show="!orderList.length"></noneData>
</div>
</template>
......@@ -181,6 +224,10 @@ export default {
};
},
mounted() {
this.type = this.$route.query.type
if(this.type) {
this.orderStatus = Number(this.type)
}
this.getOrderEnums();
this.getOrderList();
},
......
......@@ -125,9 +125,27 @@
:rules="[(val) => !!val || '请输入全名']"
></q-input>
</div>
<div class="col">
<div class="title">國家/地區</div>
<q-select
@input="changeCountry"
emit-value
map-options
ref="CountryId"
square
outlined
option-value="ID"
option-label="Name"
class="form-item"
v-model="form.CountryId"
:options="countList"
placeholder="Filled"
:rules="[(val) => Boolean(val) || '请选择國家/地區']"
/>
</div>
</div>
<div :class="$q.platform.is.desktop ? 'row': 'culmuns'">
<div class="col">
<!-- <div class="col">
<div class="title">選擇手機區號</div>
<q-select
ref="AreaCode"
......@@ -143,7 +161,7 @@
placeholder="選擇手機區號"
:rules="[(val) => Boolean(val) || '请選擇手機區號']"
/>
</div>
</div> -->
<div class="col">
<div class="title">手機號碼</div>
<q-input
......@@ -153,27 +171,12 @@
v-model="form.Mobile"
outlined
:rules="[(val) => !!val || '请输入手機號碼']"
></q-input>
</div>
</div>
<div :class="$q.platform.is.desktop ? 'row': 'culmuns'">
<div class="col">
<div class="title">國家/地區</div>
<q-select
emit-value
map-options
ref="CountryId"
square
outlined
option-value="ID"
option-label="Name"
class="form-item"
v-model="form.CountryId"
:options="countList"
placeholder="Filled"
:rules="[(val) => Boolean(val) || '请选择國家/地區']"
/>
>
<template v-slot:prepend>
<div class="text-subtitle2">
{{ form.PhoneCountryStr }}
</div>
</template></q-input>
</div>
<div class="col">
<div class="title">城市</div>
......@@ -253,12 +256,6 @@ export default {
this.getCountryInfo();
},
methods: {
addAddress() {
this.isShowDialog = true
this.form = {
Name: "",
Mobile: "",}
},
getCountryInfo() {
this.apipost(
"GetCountryInfo_post",
......@@ -268,6 +265,17 @@ export default {
const { phoneCountList, countList } = res.data.data;
this.countList = countList;
this.phoneCountList = phoneCountList;
this.form.CountryId = this.countList[0].ID;
this.changeCountry(this.form.CountryId);
this.phoneCountList.forEach((x) => {
let temp = this.countList.find((y) => y.ID == x.ID);
x.EnName = `${temp.EnName}(${x.PhoneCode})`;
});
this.form.CountryId =
this.form.CountryId == 0
? this.countList[0].ID
: this.form.CountryId;
this.changeCountry(this.form.CountryId);
} else {
// this.$notify(res.data.message);
this.$q.notify({
......@@ -281,6 +289,18 @@ export default {
null
);
},
changeCountry(id) {
this.form.AreaCode = this.phoneCountList.find(
(x) => x.ID == id
).PhoneCode;
this.form.PhoneCountryStr = "+" + this.form.AreaCode;
},
addAddress() {
this.isShowDialog = true
this.form = {
Name: "",
Mobile: "",}
},
changeCouponType(item) {
this.selectedKey = item;
},
......@@ -288,7 +308,6 @@ export default {
this.formHasError = false;
const verifyArr = [
"Name",
"AreaCode",
"Mobile",
"CountryId",
"CityName",
......@@ -296,17 +315,13 @@ export default {
"PostalCode",
];
verifyArr.forEach((item) => {
console.log("this.$refs[item]", this, item, this.$refs[item]);
this.$refs[item].validate();
});
verifyArr.forEach((item) => {
console.log("item", item);
if (this.$refs[item].hasError) {
console.log("item", item);
this.formHasError = true;
}
});
console.log("this.formHasError", this.formHasError, this.form);
if (this.formHasError) {
return;
}
......@@ -335,7 +350,6 @@ export default {
);
},
editUser(item) {
console.log("editUser", item);
this.form = {...item};
this.form.AreaCode = Number(this.form.AreaCode)
this.form.IsDefault = this.form.IsDefault === 1
......
This diff is collapsed.
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