12 changed files with 1920 additions and 12 deletions
@ -0,0 +1,89 @@ |
|||||
|
<template> |
||||
|
<view class="bg"> |
||||
|
<view class="nickname-box"> |
||||
|
<input v-model="nickname" type="text" placeholder="请输入内容" /> |
||||
|
</view> |
||||
|
<view class="btn" @click="save">保存</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: "changeNickname", |
||||
|
data: function() { |
||||
|
return { |
||||
|
nickname: "" |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
save: function() { |
||||
|
if (!this.nickname) { |
||||
|
uni.showToast({ |
||||
|
title: '请输入昵称', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return; |
||||
|
} |
||||
|
this.Post({ |
||||
|
nickname: this.nickname |
||||
|
}, '/api/user/profile').then(res => { |
||||
|
console.log(res) |
||||
|
if (res.code == 1 || res.code == 200) { |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: '保存成功!', |
||||
|
success: res => { |
||||
|
if (res.confirm) { |
||||
|
this.goBack() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.bg { |
||||
|
min-height: 100vh; |
||||
|
padding-top: 50rpx; |
||||
|
} |
||||
|
|
||||
|
.nickname-box { |
||||
|
display: flex; |
||||
|
padding: 10rpx 0 30rpx; |
||||
|
margin: 0 30rpx; |
||||
|
align-items: center; |
||||
|
background: white; |
||||
|
margin-bottom: 100rpx; |
||||
|
font-size: 30rpx; |
||||
|
height: 70rpx; |
||||
|
border-bottom: 1rpx solid #D8D8D8; |
||||
|
} |
||||
|
|
||||
|
.nickname-box span { |
||||
|
flex-shrink: 0; |
||||
|
} |
||||
|
|
||||
|
.nickname-box input { |
||||
|
flex: 1; |
||||
|
font-size: 30rpx; |
||||
|
display: block; |
||||
|
} |
||||
|
|
||||
|
.btn { |
||||
|
color: black; |
||||
|
margin: 0 auto; |
||||
|
line-height: 80rpx; |
||||
|
position: relative; |
||||
|
font-size: 34rpx; |
||||
|
text-align: center; |
||||
|
width: 333rpx; |
||||
|
height: 80rpx; |
||||
|
background: #C3282E; |
||||
|
border-radius: 40rpx; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,556 @@ |
|||||
|
<template> |
||||
|
<view class="bg"> |
||||
|
<view class="guanli" v-if="list && list.length>0" @click="guanli">{{operate}}</view> |
||||
|
<view v-for="(item,index) in list" :key="index"> |
||||
|
<view class="goodBox" v-if="item.data && item.data.length > 0 "> |
||||
|
<view class="title" v-if="item.data.some(v => v.flag == 1)">{{item.merchant_name}} ></view> |
||||
|
<view class="goodItem" v-for="(goodItem,goodIndex) in item.data" :key="goodIndex" |
||||
|
v-if="goodItem.flag != 0"> |
||||
|
<view class="noSelect" v-if="!goodItem.is_select" @click="changeSelect(goodItem)"></view> |
||||
|
<view class="selectBox flex-around" v-else @click="changeSelect(goodItem)"> |
||||
|
<img src="https://static.ticket.sz-trip.com/cgc/images/order/dui.png"> |
||||
|
</view> |
||||
|
<image :src="showImg(goodItem.specifications_image)" mode="aspectFill" |
||||
|
@click="goDetails(goodItem.good_id)"></image> |
||||
|
<view class="contentBox"> |
||||
|
<view class="title text-overflow">{{goodItem.good_name}}</view> |
||||
|
<view class="subTitle text-overflow">{{goodItem.Specifications_name}}</view> |
||||
|
<view class="priceBox flex-between"> |
||||
|
<view class="price">{{goodItem.Specifications_money / 100}}</view> |
||||
|
<view class="flex-between" style="width: 165rpx;font-size: 29rpx;"> |
||||
|
<view :class="['jian', goodItem.num == 1 ? 'zhihui' : '']" @click="delNum(goodItem)">- |
||||
|
</view> |
||||
|
<view>{{goodItem.num}}</view> |
||||
|
<view class="jia" @click="addNum(goodItem)">+</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="loseGood" v-if="loseList && loseList.length>0"> |
||||
|
<view class="title flex-between">失效商品<span @click="delLoseGood('',1)">清空失效商品</span></view> |
||||
|
<view class="goodItem" v-for="(goodItem,goodIndex) in loseList" :key="goodIndex"> |
||||
|
<view class="noSelect"></view> |
||||
|
<image :src="showImg(goodItem.specifications_image)" mode="aspectFill"></image> |
||||
|
<view class="contentBox"> |
||||
|
<view class="title text-overflow">{{goodItem.good_name}}</view> |
||||
|
<view class="subTitle text-overflow">{{goodItem.Specifications_name}}</view> |
||||
|
<view class="priceBox flex-between"> |
||||
|
<view class="price">{{goodItem.Specifications_money / 100}}</view> |
||||
|
<view class="btn" @click="delLoseGood(goodItem.id,0)">删除</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<!-- 预定按钮 --> |
||||
|
<view class="orderBox flex-between"> |
||||
|
<view class="priceBox"> |
||||
|
<!-- <view class="selectBox flex-around" v-if="allSelect" @click="changeAllSelect"> |
||||
|
<img src="https://static.ticket.sz-trip.com/cgc/images/order/dui.png" alt=""> |
||||
|
</view> |
||||
|
<view class="noSelect" v-else @click="changeAllSelect"></view>全选 --> |
||||
|
<span v-if="operate == '管理'">在线付:</span> |
||||
|
<p v-if="operate == '管理'">¥{{getAllPrice()}}</p> |
||||
|
</view> |
||||
|
<view class="btn" @click="order" v-if="operate == '管理'">提交订单</view> |
||||
|
<view class="btn" @click="delGood" v-else>删除</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="noProduct" v-if="list.length == 0 && loseList.length == 0"> |
||||
|
暂无商品 |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
operate: '管理', |
||||
|
list: [], |
||||
|
loseList: [], |
||||
|
allSelect: false, |
||||
|
} |
||||
|
}, |
||||
|
onShow() { |
||||
|
this.getShoppingList() |
||||
|
this.allSelect = false |
||||
|
}, |
||||
|
methods: { |
||||
|
getShoppingList() { |
||||
|
this.Post({ |
||||
|
is_post: 1, |
||||
|
// lon: this.$store.state.user.location.lon || '120.63132', |
||||
|
// lat: this.$store.state.user.location.lat || '31.30227' |
||||
|
}, '/api/shopping/getShoppingList').then(res => { |
||||
|
this.list = res.data.merchant |
||||
|
this.loseList = [] |
||||
|
this.list.forEach(item => { |
||||
|
item.data.forEach(items => { |
||||
|
if (items.flag === 0) { |
||||
|
this.loseList.push(items) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}) |
||||
|
console.log('打印', this.loseList); |
||||
|
}) |
||||
|
}, |
||||
|
// 管理 |
||||
|
guanli() { |
||||
|
if (this.operate == '管理') { |
||||
|
this.operate = '退出管理' |
||||
|
} else { |
||||
|
this.operate = '管理' |
||||
|
} |
||||
|
console.log(this.operate) |
||||
|
}, |
||||
|
delNum(item) { |
||||
|
if (item.num <= 1) { |
||||
|
item.num = 1 |
||||
|
uni.showToast({ |
||||
|
title: '已经最少了,不能再减了', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
} else { |
||||
|
item.num -= 1 |
||||
|
this.updateCart(item) |
||||
|
} |
||||
|
}, |
||||
|
addNum(item) { |
||||
|
item.num += 1 |
||||
|
this.updateCart(item) |
||||
|
}, |
||||
|
updateCart(item) { |
||||
|
let that = this |
||||
|
that.Post({ |
||||
|
s_id: item.id, |
||||
|
num: item.num |
||||
|
}, '/api/shopping/updateShopping').then(function(res) { |
||||
|
if (res) { |
||||
|
// that.$toast.clear() |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 更改选中状态 |
||||
|
changeSelect(item) { |
||||
|
item.is_select = !item.is_select |
||||
|
this.list.forEach(item => { |
||||
|
let checkAll = item.data.findIndex(items => { |
||||
|
return !items.is_select |
||||
|
}) |
||||
|
if (checkAll == -1) { |
||||
|
this.allSelect = true |
||||
|
} else { |
||||
|
this.allSelect = false |
||||
|
} |
||||
|
}) |
||||
|
this.$forceUpdate() |
||||
|
}, |
||||
|
// 去商品详情 |
||||
|
goDetails(id) { |
||||
|
uni.navigateTo({ |
||||
|
url: '/subPackages/techan/detail?id=' + id |
||||
|
}); |
||||
|
}, |
||||
|
// 改变所有选中 |
||||
|
changeAllSelect() { |
||||
|
this.allSelect = !this.allSelect |
||||
|
this.list.forEach(item => { |
||||
|
item.data.forEach(items => { |
||||
|
if (this.allSelect) items.is_select = true |
||||
|
else items.is_select = false |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
// 删除失效商品 |
||||
|
delLoseGood(id, index) { |
||||
|
if (index == 0) { |
||||
|
this.Post({ |
||||
|
s_id: id |
||||
|
}, '/api/shopping/delShopping').then(res => { |
||||
|
this.getShoppingList() |
||||
|
this.$forceUpdate() |
||||
|
}) |
||||
|
} else { |
||||
|
let ids = [] |
||||
|
this.loseList.forEach(item => { |
||||
|
ids.push(item.id) |
||||
|
}) |
||||
|
this.Post({ |
||||
|
s_id: ids.toString() |
||||
|
}, '/api/shopping/delShopping').then(res => { |
||||
|
this.getShoppingList() |
||||
|
this.$forceUpdate() |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
// 删除商品 |
||||
|
delGood() { |
||||
|
let ids = [] |
||||
|
this.list.forEach(item => { |
||||
|
item.data.forEach(items => { |
||||
|
if (items.is_select == true) { |
||||
|
ids.push(items.id) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
this.Post({ |
||||
|
s_id: ids.toString() |
||||
|
}, '/api/shopping/delShopping').then(res => { |
||||
|
this.getShoppingList() |
||||
|
this.$forceUpdate() |
||||
|
}) |
||||
|
}, |
||||
|
// 获取总价 |
||||
|
getAllPrice() { |
||||
|
let allPrice = 0 |
||||
|
this.list.forEach(item => { |
||||
|
item.data.forEach(items => { |
||||
|
if (items.is_select == true) { |
||||
|
allPrice += items.Specifications_money * items.num |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
return (allPrice / 100).toFixed(2) |
||||
|
}, |
||||
|
// 结算 |
||||
|
order() { |
||||
|
let list = [] |
||||
|
let ids = [] |
||||
|
this.list.forEach(item => { |
||||
|
item.data.forEach((items, index) => { |
||||
|
if (items.is_select == true) { |
||||
|
ids.push(items.merchant_id) |
||||
|
list.push(items) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
// if (Array.from(new Set(ids)).length > 1) { |
||||
|
// uni.showToast({ |
||||
|
// title: '请选择同一商户下的商品', |
||||
|
// icon: 'none' |
||||
|
// }) |
||||
|
// return; |
||||
|
// } |
||||
|
if (list.length == 0) { |
||||
|
uni.showToast({ |
||||
|
title: '请选择商品', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return; |
||||
|
} |
||||
|
console.log('list参数', list); |
||||
|
this.$store.commit("changeOrderSCart", list) |
||||
|
// this.gotoPath('/subPackages/order/eCartOrder') |
||||
|
this.gotoPath('/subPackages/order/gwcOrder') |
||||
|
// this.gotoPath('/subPackages/goods/goodsOrder') |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
.bg { |
||||
|
width: 100%; |
||||
|
min-height: 100vh; |
||||
|
padding: 0 27rpx 200rpx; |
||||
|
box-sizing: border-box; |
||||
|
background-color: #F8F8F8; |
||||
|
} |
||||
|
|
||||
|
.guanli { |
||||
|
height: 76rpx; |
||||
|
text-align: right; |
||||
|
font-size: 32rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 400; |
||||
|
color: #000000; |
||||
|
line-height: 76rpx; |
||||
|
} |
||||
|
|
||||
|
.goodBox { |
||||
|
width: 697rpx; |
||||
|
height: auto; |
||||
|
background: #FFFFFF; |
||||
|
border-radius: 20rpx; |
||||
|
margin: 0 auto 27rpx; |
||||
|
padding: 25rpx 20rpx; |
||||
|
box-sizing: border-box; |
||||
|
|
||||
|
.title { |
||||
|
font-size: 35rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #000000; |
||||
|
} |
||||
|
|
||||
|
.goodItem { |
||||
|
width: 100%; |
||||
|
height: 173rpx; |
||||
|
margin-top: 46rpx; |
||||
|
display: flex; |
||||
|
|
||||
|
.noSelect { |
||||
|
width: 37rpx; |
||||
|
height: 37rpx; |
||||
|
border-radius: 50%; |
||||
|
border: 2rpx solid #666666; |
||||
|
box-sizing: border-box; |
||||
|
margin-right: 25rpx; |
||||
|
margin-top: 68rpx; |
||||
|
} |
||||
|
|
||||
|
.selectBox { |
||||
|
width: 37rpx; |
||||
|
height: 37rpx; |
||||
|
// background: linear-gradient(90deg, #FA2B66, #FF9834); |
||||
|
// border-radius: 50%; |
||||
|
margin-right: 25rpx; |
||||
|
margin-top: 68rpx; |
||||
|
|
||||
|
img { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
image { |
||||
|
width: 173rpx; |
||||
|
height: 173rpx; |
||||
|
border-radius: 13rpx; |
||||
|
} |
||||
|
|
||||
|
.contentBox { |
||||
|
width: 400rpx; |
||||
|
height: 173rpx; |
||||
|
margin-left: 23rpx; |
||||
|
|
||||
|
.title { |
||||
|
font-size: 31rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #000000; |
||||
|
} |
||||
|
|
||||
|
.subTitle { |
||||
|
font-size: 27rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 400; |
||||
|
color: #7C7C7C; |
||||
|
margin-top: 13rpx; |
||||
|
} |
||||
|
|
||||
|
.priceBox { |
||||
|
margin-top: 35rpx; |
||||
|
|
||||
|
.price { |
||||
|
font-size: 40rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #FF2D3B; |
||||
|
} |
||||
|
|
||||
|
.price:before { |
||||
|
content: "¥"; |
||||
|
font-size: 27rpx; |
||||
|
} |
||||
|
|
||||
|
.jian, |
||||
|
.jia { |
||||
|
width: 47rpx; |
||||
|
height: 47rpx; |
||||
|
background: #6CA5AA; |
||||
|
border-radius: 50%; |
||||
|
text-align: center; |
||||
|
color: #FFFFFF; |
||||
|
line-height: 47rpx; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.loseGood { |
||||
|
width: 697rpx; |
||||
|
height: auto; |
||||
|
background: #FFFFFF; |
||||
|
border-radius: 20rpx; |
||||
|
margin: 0 auto 27rpx; |
||||
|
padding: 25rpx 20rpx; |
||||
|
box-sizing: border-box; |
||||
|
|
||||
|
.title { |
||||
|
font-size: 35rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #666666; |
||||
|
|
||||
|
span { |
||||
|
font-size: 32rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 400; |
||||
|
color: #2791F7; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.goodItem { |
||||
|
width: 100%; |
||||
|
height: 173rpx; |
||||
|
margin-top: 46rpx; |
||||
|
display: flex; |
||||
|
color: #999999; |
||||
|
|
||||
|
.noSelect { |
||||
|
width: 37rpx; |
||||
|
height: 37rpx; |
||||
|
border-radius: 50%; |
||||
|
border: 2rpx solid #CCCCCC; |
||||
|
background: #F1F1F1; |
||||
|
box-sizing: border-box; |
||||
|
margin-right: 25rpx; |
||||
|
margin-top: 68rpx; |
||||
|
} |
||||
|
|
||||
|
image { |
||||
|
width: 173rpx; |
||||
|
height: 173rpx; |
||||
|
border-radius: 13rpx; |
||||
|
margin-right: 23rpx; |
||||
|
} |
||||
|
|
||||
|
.contentBox { |
||||
|
width: 421rpx; |
||||
|
height: 173rpx; |
||||
|
|
||||
|
.title { |
||||
|
font-size: 31rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
|
||||
|
.subTitle { |
||||
|
font-size: 27rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 400; |
||||
|
} |
||||
|
|
||||
|
.priceBox { |
||||
|
margin-top: 35rpx; |
||||
|
|
||||
|
.price { |
||||
|
font-size: 40rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
|
||||
|
.price:before { |
||||
|
content: "¥"; |
||||
|
font-size: 27rpx; |
||||
|
} |
||||
|
|
||||
|
.btn { |
||||
|
width: 125rpx; |
||||
|
height: 53rpx; |
||||
|
background: #999999; |
||||
|
border-radius: 13rpx; |
||||
|
text-align: center; |
||||
|
line-height: 53rpx; |
||||
|
font-size: 29rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.noProduct { |
||||
|
width: 100%; |
||||
|
height: 300rpx; |
||||
|
text-align: center; |
||||
|
line-height: 300rpx; |
||||
|
color: #999999; |
||||
|
font-size: 32rpx; |
||||
|
} |
||||
|
|
||||
|
.orderBox { |
||||
|
width: 750rpx; |
||||
|
height: 151rpx; |
||||
|
background: #FFFFFF; |
||||
|
box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1); |
||||
|
padding: 0 27rpx; |
||||
|
box-sizing: border-box; |
||||
|
position: fixed; |
||||
|
left: 0; |
||||
|
bottom: 0; |
||||
|
|
||||
|
.priceBox { |
||||
|
display: flex; |
||||
|
font-size: 27rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 400; |
||||
|
color: #666666; |
||||
|
|
||||
|
span { |
||||
|
font-size: 27rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 400; |
||||
|
color: #333333; |
||||
|
margin-left: 20rpx; |
||||
|
} |
||||
|
|
||||
|
p { |
||||
|
font-size: 36rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #FF2D3B; |
||||
|
margin-top: -5rpx; |
||||
|
} |
||||
|
|
||||
|
.noSelect { |
||||
|
width: 41rpx; |
||||
|
height: 41rpx; |
||||
|
border-radius: 50%; |
||||
|
border: 2rpx solid #666666; |
||||
|
box-sizing: border-box; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.selectBox { |
||||
|
width: 41rpx; |
||||
|
height: 41rpx; |
||||
|
// background: linear-gradient(90deg, #FA2B66, #FF9834); |
||||
|
border-radius: 50%; |
||||
|
margin-right: 10rpx; |
||||
|
|
||||
|
img { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.btn { |
||||
|
width: 219rpx; |
||||
|
height: 77rpx; |
||||
|
background: #6CA5AA; |
||||
|
border-radius: 39rpx; |
||||
|
text-align: center; |
||||
|
line-height: 77rpx; |
||||
|
font-size: 33rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #FFFFFF; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.zhihui { |
||||
|
background: #E8E8E8 !important; |
||||
|
color: #999999 !important; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,387 @@ |
|||||
|
<template> |
||||
|
<view class="bg"> |
||||
|
<view class="list-forms"> |
||||
|
<view class="list-item"> |
||||
|
<view class="list-item-title">姓名:</view> |
||||
|
<view class="list-item-input"><input type="text" v-model="username" placeholder="请输入姓名" /></view> |
||||
|
</view> |
||||
|
<view class="list-item"> |
||||
|
<view class="list-item-title">手机号:</view> |
||||
|
<view class="list-item-input"><input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" |
||||
|
/></view> |
||||
|
</view> |
||||
|
<view class="list-item" style="position: relative;"> |
||||
|
<view class="list-item-title">选择地区:</view> |
||||
|
<view class="list-item-input" style="flex: 1;"> |
||||
|
<picker mode="multiSelector" :range="newProvinceDataList" range-key="name" @change="changeArea" @columnchange="pickerColumnchange" |
||||
|
style="position: relative;z-index: 2;"> |
||||
|
<input type="text" readonly style="text-align: right;font-size: 33rpx;position: relative;z-index: -1;" |
||||
|
v-model="citySeld" disabled="true" placeholder="请选择地区"/> |
||||
|
</picker> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="list-item"> |
||||
|
<view class="list-item-title">详细地址:</view> |
||||
|
<view class="list-item-input"><input type="text" v-model="detailAddr" placeholder="请输入详细地址" /></view> |
||||
|
</view> |
||||
|
<view class="list-item"> |
||||
|
<view class="list-item-title">设为默认:</view> |
||||
|
<view class="list-item-switch"> |
||||
|
<switch :checked="idDefault" @change="switchChange" color="#6CA5AA"/> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="list-item-btn"> |
||||
|
<view class="list-item-post" @click="postSave()">保存</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import District from 'ydui-district/dist/jd_province_city_area_id'; |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
username: '', |
||||
|
mobile: '', |
||||
|
citySeld: '', |
||||
|
detailAddr: '', |
||||
|
idDefault: false, |
||||
|
title: '新增收货地址', |
||||
|
show: false, |
||||
|
district: District, //数据 |
||||
|
ready: false, |
||||
|
province: null, |
||||
|
city: null, |
||||
|
area: '', |
||||
|
provinceId: null, |
||||
|
cityId: null, |
||||
|
areaId: null, |
||||
|
columns: [], |
||||
|
id: '', |
||||
|
newProvinceDataList:[ |
||||
|
[],[],[] |
||||
|
], |
||||
|
multiIndex: [0, 0, 0], |
||||
|
} |
||||
|
}, |
||||
|
onLoad(option){ |
||||
|
this.id = option.id |
||||
|
if (option.id > 0) { |
||||
|
this.title = '编辑收货地址' |
||||
|
this.getDetail() |
||||
|
} |
||||
|
else { |
||||
|
this.getSeldCityList() |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
switchChange(e){ |
||||
|
this.idDefault = e.detail.value |
||||
|
}, |
||||
|
changeArea(e){ |
||||
|
// 数组内的下标 |
||||
|
this.multiIndex = e.detail.value; |
||||
|
this.citySeld = this.newProvinceDataList[0][this.multiIndex[0]].name + this.newProvinceDataList[1][this.multiIndex[1]].name + this.newProvinceDataList[2][this.multiIndex[2]].name |
||||
|
this.provinceId = this.newProvinceDataList[0][this.multiIndex[0]].id |
||||
|
this.cityId = this.newProvinceDataList[1][this.multiIndex[1]].id |
||||
|
this.areaId = this.newProvinceDataList[2][this.multiIndex[2]].id |
||||
|
}, |
||||
|
getSeldCityList() { |
||||
|
let that = this |
||||
|
that.Post({}, '/api/areas/getAll').then(res => { |
||||
|
if (res) { |
||||
|
var data = res.data; |
||||
|
var result = {}; |
||||
|
for (var i = 0; i < data.length; i++) { |
||||
|
var item = data[i]; |
||||
|
if (item.parent_id == 0) { |
||||
|
continue; |
||||
|
} |
||||
|
//获取省 |
||||
|
if (item.parent_id == "1") { |
||||
|
result[item.id.toString()] = {}; |
||||
|
result[item.id.toString()].children = [] |
||||
|
result[item.id.toString()].name = item.name; |
||||
|
result[item.id.toString()].id = item.id; |
||||
|
} else if (result[item.parent_id.toString()]) { |
||||
|
//填充市 |
||||
|
var t = { |
||||
|
id: item.id, |
||||
|
name: item.name, |
||||
|
children: [] |
||||
|
} |
||||
|
result[item.parent_id.toString()].children.push(t) |
||||
|
} else { |
||||
|
//填充区 |
||||
|
var k = { |
||||
|
id: item.id, |
||||
|
name: item.name |
||||
|
} |
||||
|
for (var j = 0; j < result[item.parent_id.toString().substr(0, 2) + "0000"].children |
||||
|
.length; j++) { |
||||
|
if (result[item.parent_id.toString().substr(0, 2) + "0000"].children[j].id == item |
||||
|
.parent_id) { |
||||
|
result[item.parent_id.toString().substr(0, 2) + "0000"].children[j].children.push(k) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
var r = []; |
||||
|
//将Object转为Array |
||||
|
for (var i in result) { |
||||
|
r.push(result[i]); |
||||
|
} |
||||
|
//将数据赋值给省市区联动选择器 |
||||
|
that.district = r; |
||||
|
let arr = [] |
||||
|
let arr1 = [] |
||||
|
let arr2 = [] |
||||
|
that.district.forEach(item => { |
||||
|
arr.push(item) |
||||
|
}) |
||||
|
that.district[0].children.forEach(item => { |
||||
|
arr1.push(item) |
||||
|
}) |
||||
|
that.district[0].children[0].children.forEach(item => { |
||||
|
arr2.push(item) |
||||
|
}) |
||||
|
that.columns = arr |
||||
|
//控制异步数据 |
||||
|
that.ready = true; |
||||
|
console.log(this.columns) |
||||
|
for(let i=0; i<this.columns.length; i++){ |
||||
|
this.newProvinceDataList[0].push({name:this.columns[i].name,id:this.columns[i].id}); |
||||
|
} |
||||
|
console.log(this.columns[0].children) |
||||
|
for(let i=0; i<this.columns[0].children.length; i++){ |
||||
|
this.newProvinceDataList[1].push({name:this.columns[0].children[i].name,id:this.columns[0].children[i].id}); |
||||
|
} |
||||
|
for(let i=0; i<this.columns[0].children[0].children.length; i++){ |
||||
|
this.newProvinceDataList[2].push({name:this.columns[0].children[0].children[i].name,id:this.columns[0].children[0].children[i].id}); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 滑动 |
||||
|
pickerColumnchange(e){ |
||||
|
// 第几列滑动 |
||||
|
// console.log(e.detail.column); |
||||
|
// 第几列滑动的下标 |
||||
|
// console.log(e.detail.value) |
||||
|
// 第一列滑动 |
||||
|
if(e.detail.column === 0){ |
||||
|
this.multiIndex[0] = e.detail.value |
||||
|
// console.log('第一列滑动'); |
||||
|
// this.newProvinceDataList[1] = []; |
||||
|
this.newProvinceDataList[1] = this.columns[this.multiIndex[0]].children.map((item,index)=>{ |
||||
|
// console.log(item) |
||||
|
return item |
||||
|
}) |
||||
|
// console.log(this.multiIndex) |
||||
|
if(this.columns[this.multiIndex[0]].children.length === 1){ |
||||
|
this.newProvinceDataList[2] = this.columns[this.multiIndex[0]].children[0].children.map((item,index)=>{ |
||||
|
// console.log(item) |
||||
|
return item |
||||
|
}) |
||||
|
}else{ |
||||
|
this.newProvinceDataList[2] = this.columns[this.multiIndex[0]].children[this.multiIndex[1]].children.map((item,index)=>{ |
||||
|
// console.log(item) |
||||
|
return item |
||||
|
}) |
||||
|
} |
||||
|
// 第一列滑动 第二列 和第三列 都变为第一个 |
||||
|
this.multiIndex.splice(1, 1, 0) |
||||
|
this.multiIndex.splice(2, 1, 0) |
||||
|
} |
||||
|
// 第二列滑动 |
||||
|
if(e.detail.column === 1){ |
||||
|
this.multiIndex[1] = e.detail.value |
||||
|
// console.log('第二列滑动'); |
||||
|
// console.log(this.multiIndex) |
||||
|
this.newProvinceDataList[2] = this.columns[this.multiIndex[0]].children[this.multiIndex[1]].children.map((item,index)=>{ |
||||
|
// console.log(item) |
||||
|
return item |
||||
|
}) |
||||
|
// 第二列 滑动 第三列 变成第一个 |
||||
|
this.multiIndex.splice(2, 1, 0) |
||||
|
} |
||||
|
// 第三列滑动 |
||||
|
if(e.detail.column === 2){ |
||||
|
this.multiIndex[2] = e.detail.value |
||||
|
// console.log('第三列滑动') |
||||
|
// console.log(this.multiIndex) |
||||
|
} |
||||
|
}, |
||||
|
getDetail() { |
||||
|
this.Post({ |
||||
|
id: this.id |
||||
|
}, "/api/user/contactDetail").then(res => { |
||||
|
res = res.data; |
||||
|
if (res && res.id > 0) { |
||||
|
this.username = res.name |
||||
|
this.mobile = res.tel |
||||
|
this.idDefault = res.is_default == 1 ? true : false |
||||
|
this.provinceId = res.province_id |
||||
|
this.cityId = res.city_id |
||||
|
this.areaId = res.district_id |
||||
|
this.citySeld = res.province_text + '' + res.city_text + '' + res.district_text |
||||
|
this.detailAddr = res.detail_addr; |
||||
|
this.getSeldCityList(); |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
postSave() { |
||||
|
this.username = this.username.trim() |
||||
|
this.mobile = this.mobile.trim() |
||||
|
this.detailAddr = this.detailAddr.trim() |
||||
|
if (this.username.length < 1) { |
||||
|
uni.showToast({ |
||||
|
title: '请输入姓名', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
if (this.username.length > 6) { |
||||
|
uni.showToast({ |
||||
|
title: '姓名最多6个字', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
if (!this.IsTel(this.mobile)) { |
||||
|
uni.showToast({ |
||||
|
title: '请输入正确的手机号', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
if (this.citySeld.length < 1) { |
||||
|
uni.showToast({ |
||||
|
title: '请选择地区', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
if (this.detailAddr.length < 2) { |
||||
|
uni.showToast({ |
||||
|
title: '请输入具体地址', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
this.Post({ |
||||
|
name: this.username, |
||||
|
tel: this.mobile, |
||||
|
is_default: this.idDefault ? '1' : '0', |
||||
|
province_id: this.provinceId, |
||||
|
city_id: this.cityId, |
||||
|
district_id: this.areaId, |
||||
|
detail_addr: this.detailAddr, |
||||
|
id: this.id || null |
||||
|
},'/api/user/' + (this.id > 0 ? 'edit' : 'add') + 'Consignee').then(res => { |
||||
|
if(res){ |
||||
|
uni.setStorageSync('addressNow',JSON.stringify(res.data)) |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: this.id>0?'编辑成功':'添加成功', |
||||
|
showCancel: false, |
||||
|
success: res => { |
||||
|
if(res.confirm){ |
||||
|
uni.navigateBack({}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}else{ |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: res.msg, |
||||
|
showCancel: false, |
||||
|
success: res => { |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.bg { |
||||
|
min-height: 100vh; |
||||
|
background-color: white; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
} |
||||
|
|
||||
|
.list-forms { |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
border-top: 1rpx solid #D8D8D8; |
||||
|
padding: 20rpx 40rpx; |
||||
|
box-sizing: content-box |
||||
|
} |
||||
|
|
||||
|
.list-item { |
||||
|
display: flex; |
||||
|
border-bottom: 1rpx solid #D8D8D8; |
||||
|
padding: 30rpx 0; |
||||
|
height: 60rpx; |
||||
|
align-items: center; |
||||
|
box-sizing: content-box |
||||
|
} |
||||
|
|
||||
|
.list-item-title { |
||||
|
width: 150rpx; |
||||
|
font-size: 31rpx; |
||||
|
margin-right: 20rpx; |
||||
|
} |
||||
|
|
||||
|
.list-item-input { |
||||
|
flex: 1; |
||||
|
} |
||||
|
|
||||
|
.list-item-input input { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
padding: 0; |
||||
|
margin: 0; |
||||
|
border: 0; |
||||
|
background-color: transparent; |
||||
|
line-height: 34rpx; |
||||
|
font-size: 31rpx; |
||||
|
text-align: right; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
|
||||
|
.list-item-input input::placeholder { |
||||
|
font-size: 26rpx; |
||||
|
} |
||||
|
|
||||
|
.list-item-switch { |
||||
|
display: flex; |
||||
|
flex: 1; |
||||
|
justify-content: flex-end; |
||||
|
} |
||||
|
|
||||
|
.list-item-btn { |
||||
|
display: flex; |
||||
|
justify-content: center; |
||||
|
margin-top: 20rpx; |
||||
|
} |
||||
|
|
||||
|
.list-item-post { |
||||
|
display: flex; |
||||
|
color: #FFFFFF; |
||||
|
font-size: 36rpx; |
||||
|
width: 697rpx; |
||||
|
height: 73rpx; |
||||
|
background: #6CA5AA; |
||||
|
border-radius: 37rpx; |
||||
|
justify-content: center; |
||||
|
align-items: center; |
||||
|
margin-top: 650rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,58 @@ |
|||||
|
<template> |
||||
|
<view class="bg"> |
||||
|
<view class="list"> |
||||
|
<view class="item" v-for="(item,index) in list" :key="item.id" @click="goInfo(item)"> |
||||
|
{{item.name}} |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
<script> |
||||
|
export default{ |
||||
|
data(){ |
||||
|
return { |
||||
|
list:[{name:'用户协议',id:'10001'},{name:'隐私协议',id:'9999'},{name:'个人信息收集清单',id:'10202 '}], |
||||
|
} |
||||
|
}, |
||||
|
onShow() { |
||||
|
// this.Post({ |
||||
|
// id: 9999 |
||||
|
// },'/api/article/getArticleById').then(res => { |
||||
|
// this.content = res.data.content |
||||
|
// }) |
||||
|
}, |
||||
|
|
||||
|
methods:{ |
||||
|
goInfo(item){ |
||||
|
uni.navigateTo({ |
||||
|
url:'/subPackages/user/privacyInfo?id='+item.id |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
view{ |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
.list{ |
||||
|
width: 698rpx; |
||||
|
background: #FFFFFF; |
||||
|
box-shadow: 0px 4rpx 12rpx 0px rgba(150,149,149,0.3); |
||||
|
border-radius: 18rpx; |
||||
|
margin: 0 auto; |
||||
|
margin-top: 20rpx; |
||||
|
padding:0 20rpx ; |
||||
|
} |
||||
|
.item{ |
||||
|
width: 100%; |
||||
|
height: 93rpx; |
||||
|
border-bottom: 1rpx solid #EEEFF7; |
||||
|
font-size: 28rpx; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 500; |
||||
|
color: #333333; |
||||
|
line-height: 93rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,30 @@ |
|||||
|
<template> |
||||
|
<view class="bg"> |
||||
|
<view class="text" v-html="formateRichText(content)"> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
content:'' |
||||
|
}; |
||||
|
}, |
||||
|
onLoad(option){ |
||||
|
this.Post({ |
||||
|
id:option.id |
||||
|
},'/api/article/getArticleById').then(res => { |
||||
|
this.content = res.data.content |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
.text{ |
||||
|
padding: 20rpx; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,407 @@ |
|||||
|
<template> |
||||
|
<view v-if="info"> |
||||
|
<view class="user-other-info"> |
||||
|
<div class="info-avatar-top"> |
||||
|
<span>头像</span> |
||||
|
<view @click="uploadImg()"> |
||||
|
<image :src="showImg(info.avatar)" mode="aspectFill" |
||||
|
style="width: 80rpx;height: 80rpx;border-radius: 50%;"></image> |
||||
|
</view> |
||||
|
</div> |
||||
|
<navigator url="/subPackages/user/changeNickname" tag="view" class="userinfo-item"> |
||||
|
<span>昵称</span> |
||||
|
<view>{{nickname}}</view> |
||||
|
</navigator> |
||||
|
<!-- <view class="userinfo-item" @click="showSexSelect = true"> |
||||
|
<span>性别</span> |
||||
|
<view @click="$refs.popup.open()">{{gender == 1 ? '男' : (gender == 2 ? '女' : '保密')}}</view> |
||||
|
</view> --> |
||||
|
<view class="userinfo-item"> |
||||
|
<span>手机号</span> |
||||
|
<view>{{info.mobile}}</view> |
||||
|
</view> |
||||
|
<!-- <view class="userinfo-item"> |
||||
|
<span>生日</span> |
||||
|
<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange"> |
||||
|
<view class="uni-input">{{birthday}}</view> |
||||
|
</picker> |
||||
|
</view> |
||||
|
<navigator url="/subPackages/user/logout" tag="view" class="userinfo-item"> |
||||
|
<span>注销账号</span> |
||||
|
<i>注销后账号无法恢复,请谨慎操作</i> |
||||
|
</navigator> --> |
||||
|
<!-- <view class="btn-tao" @click="submit">保存</view> --> |
||||
|
</view> |
||||
|
|
||||
|
<!-- 性别弹框 --> |
||||
|
<uni-popup ref="popup" type="bottom"> |
||||
|
<view class="popup-box"> |
||||
|
<view class="popup-item flex-center" v-for="(item,index) in sexes" :key="index" @click="changesex(index)">{{item.text}}</view> |
||||
|
<view class="popup-items flex-center" @click="$refs.popup.close()">取消</view> |
||||
|
</view> |
||||
|
</uni-popup> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import {pathToBase64} from "@/static/js/mmmm-image-tools/index.js" |
||||
|
export default { |
||||
|
name: "Profile", |
||||
|
data() { |
||||
|
const currentDate = this.getDate({ |
||||
|
format: true |
||||
|
}) |
||||
|
return { |
||||
|
date: currentDate, |
||||
|
info: null, |
||||
|
showSexSelect: false, |
||||
|
sexes: [{ |
||||
|
value: '1', |
||||
|
text: '男' |
||||
|
}, |
||||
|
{ |
||||
|
value: '2', |
||||
|
text: '女' |
||||
|
}, |
||||
|
{ |
||||
|
value: '0', |
||||
|
text: '保密' |
||||
|
} |
||||
|
], |
||||
|
today: null, |
||||
|
showCropper: false, |
||||
|
nickname: '', |
||||
|
gender: '', |
||||
|
birthday: '', |
||||
|
email: '', |
||||
|
fileList1: [], |
||||
|
startDate: '1900-1-1', |
||||
|
endDate: '2050-1-1' |
||||
|
} |
||||
|
}, |
||||
|
onShow() { |
||||
|
console.log(this.$store.state.user.userInfo,uni.getStorageSync('userInfo')) |
||||
|
this.getList() |
||||
|
}, |
||||
|
computed: { |
||||
|
// startDate() { |
||||
|
// return this.getDate('start'); |
||||
|
// }, |
||||
|
// endDate() { |
||||
|
// return this.getDate('end'); |
||||
|
// } |
||||
|
}, |
||||
|
methods: { |
||||
|
getFile(e) { |
||||
|
console.log(e) |
||||
|
}, |
||||
|
getList() { |
||||
|
let today = new Date(); |
||||
|
today = today.getFullYear() + "/" + (today.getMonth() + 1) + "/" + today.getDate(); |
||||
|
this.today = today; |
||||
|
this.Post({}, "/api/user/userInfo").then(res => { |
||||
|
if (!res.data.birthday) { |
||||
|
let date = new Date(); |
||||
|
res.data.birthday = date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date |
||||
|
.getDate(); |
||||
|
} |
||||
|
this.info = res.data; |
||||
|
this.nickname = this.info.nickname |
||||
|
this.email = this.info.email |
||||
|
this.birthday = this.info.birthday |
||||
|
this.gender = this.info.gender |
||||
|
this.info.token = JSON.parse(uni.getStorageSync('userInfo')).token || this.$store.state.user.userInfo.token |
||||
|
console.log(this.info) |
||||
|
this.$store.commit('changeUserInfo', this.info) |
||||
|
}) |
||||
|
}, |
||||
|
uploadImg() { |
||||
|
uni.chooseImage({ |
||||
|
success: (chooseImageRes) => { |
||||
|
const tempFilePaths = chooseImageRes.tempFilePaths; |
||||
|
// // #ifdef MP-WEIXIN |
||||
|
// uni.getFileSystemManager().readFile({ |
||||
|
// filePath: tempFilePaths[0], |
||||
|
// encoding: 'base64', |
||||
|
// success: res => { |
||||
|
// this.Post({ |
||||
|
// method: 'POST', |
||||
|
// base64: 'data:image/png;base64,' + res.data |
||||
|
// }, '/api/common/base64').then(res => { |
||||
|
// if (res.data) { |
||||
|
// this.Post({ |
||||
|
// avatar: res.data |
||||
|
// }, '/api/user/profile').then(res => { |
||||
|
// uni.showModal({ |
||||
|
// title: '提示', |
||||
|
// content: res.msg, |
||||
|
// showCancel: false, |
||||
|
// success: res => { |
||||
|
// if (res.confirm) { |
||||
|
// this.getList() |
||||
|
// } |
||||
|
// } |
||||
|
// }) |
||||
|
// }) |
||||
|
// } |
||||
|
// }) |
||||
|
// } |
||||
|
// }) |
||||
|
// // #endif |
||||
|
|
||||
|
pathToBase64(tempFilePaths[0]).then(base64 => { |
||||
|
this.Post({ |
||||
|
method: 'POST', |
||||
|
base64: base64 |
||||
|
}, '/api/common/base64').then(res => { |
||||
|
if (res.data) { |
||||
|
this.Post({ |
||||
|
avatar: res.data |
||||
|
}, '/api/user/profile').then(res => { |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: res.msg, |
||||
|
showCancel: false, |
||||
|
success: res => { |
||||
|
if (res.confirm) { |
||||
|
this.getList() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
//生日 |
||||
|
bindDateChange: function(e) { |
||||
|
this.birthday = e.detail.value |
||||
|
}, |
||||
|
getDate(type) { |
||||
|
const date = new Date(); |
||||
|
let year = date.getFullYear(); |
||||
|
let month = date.getMonth() + 1; |
||||
|
let day = date.getDate(); |
||||
|
|
||||
|
if (type === 'start') { |
||||
|
year = year - 60; |
||||
|
} else if (type === 'end') { |
||||
|
year = year + 2; |
||||
|
} |
||||
|
month = month > 9 ? month : '0' + month; |
||||
|
day = day > 9 ? day : '0' + day; |
||||
|
return `${year}/${month}/${day}`; |
||||
|
}, |
||||
|
changesex(index) { |
||||
|
this.gender = this.sexes[index].value |
||||
|
this.$refs.popup.close() |
||||
|
}, |
||||
|
submit() { |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: '确认修改您的信息?', |
||||
|
success: res => { |
||||
|
if (res.confirm) { |
||||
|
this.Post({ |
||||
|
nickname: this.nickname, |
||||
|
gender: this.gender, |
||||
|
birthday: this.birthday |
||||
|
}, '/api/user/profile').then(res => { |
||||
|
console.log(res) |
||||
|
if (res.code == 1) { |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: res.msg, |
||||
|
showCancel: false, |
||||
|
success: res => { |
||||
|
if (res.confirm) { |
||||
|
this.getList() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
view { |
||||
|
box-sizing: content-box; |
||||
|
} |
||||
|
.info-avatar-top { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
font-size: 30rpx; |
||||
|
border-bottom: 1rpx solid #D8D8D8; |
||||
|
padding: 40rpx 0; |
||||
|
height: 48rpx; |
||||
|
color: #333; |
||||
|
align-items: center; |
||||
|
} |
||||
|
.info-avatar-top view{ |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
} |
||||
|
.info-avatar-top view:after{ |
||||
|
content: ""; |
||||
|
width: 20rpx; |
||||
|
height: 20rpx; |
||||
|
margin-left: 6rpx; |
||||
|
background-image: url('https://static.ticket.sz-trip.com/tongli/images/user/rightIcon-gray.png'); |
||||
|
background-size: 100% 100%; |
||||
|
} |
||||
|
.info-avatar-top img { |
||||
|
width: 80rpx; |
||||
|
height: 80rpx; |
||||
|
border-radius: 50%; |
||||
|
margin-right: 10rpx; |
||||
|
} |
||||
|
|
||||
|
.change-avatar-btn { |
||||
|
color: #FFF; |
||||
|
width: 220rpx; |
||||
|
margin: 0 auto; |
||||
|
line-height: 70rpx; |
||||
|
border-radius: 20rpx; |
||||
|
background: #4C93FF; |
||||
|
position: relative; |
||||
|
font-size: 34rpx; |
||||
|
} |
||||
|
|
||||
|
.change-avatar-btn input { |
||||
|
position: absolute; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
opacity: 0; |
||||
|
} |
||||
|
|
||||
|
.user-other-info { |
||||
|
margin: 30rpx; |
||||
|
} |
||||
|
|
||||
|
.userinfo-item { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
font-size: 30rpx; |
||||
|
border-bottom: 1rpx solid #D8D8D8; |
||||
|
padding: 40rpx 30rpx 40rpx 0; |
||||
|
height: 48rpx; |
||||
|
color: #333; |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
.info-avatar-top span { |
||||
|
font-weight: 500; |
||||
|
font-size: 31rpx; |
||||
|
flex-shrink: 0; |
||||
|
} |
||||
|
|
||||
|
.userinfo-item span { |
||||
|
font-weight: 500; |
||||
|
font-size: 31rpx; |
||||
|
flex-shrink: 0; |
||||
|
color: #000; |
||||
|
} |
||||
|
|
||||
|
.userinfo-item i { |
||||
|
font-weight: 500; |
||||
|
font-size: 24rpx; |
||||
|
color: #999999; |
||||
|
} |
||||
|
|
||||
|
.userinfo-item { |
||||
|
& view::after { |
||||
|
content: ""; |
||||
|
width: 20rpx; |
||||
|
height: 20rpx; |
||||
|
margin-left: 6rpx; |
||||
|
background-image: url('https://static.ticket.sz-trip.com/tongli/images/user/rightIcon-gray.png'); |
||||
|
background-size: 100% 100%; |
||||
|
position: absolute; |
||||
|
right: 0; |
||||
|
margin: auto; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.birthday-box { |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
|
.cropper { |
||||
|
width: auto; |
||||
|
height: 100%; |
||||
|
} |
||||
|
|
||||
|
.cropper-content { |
||||
|
position: fixed; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
z-index: 1000; |
||||
|
} |
||||
|
|
||||
|
.dialog-footer .change-avatar-btn { |
||||
|
position: fixed; |
||||
|
text-align: center; |
||||
|
bottom: 80rpx; |
||||
|
left: 50%; |
||||
|
margin-left: -110rpx; |
||||
|
} |
||||
|
|
||||
|
.btn-tao { |
||||
|
text-align: center; |
||||
|
font-size: 30rpx; |
||||
|
width: 697rpx; |
||||
|
height: 80rpx; |
||||
|
background: #C3282E; |
||||
|
border-radius: 40rpx; |
||||
|
line-height: 80rpx; |
||||
|
color: #FFFFFF; |
||||
|
position: fixed; |
||||
|
left: 26rpx; |
||||
|
bottom: 100rpx; |
||||
|
} |
||||
|
|
||||
|
.popup-box { |
||||
|
border-radius: 20rpx 20rpx 0rpx 0rpx; |
||||
|
background: #fff; |
||||
|
overflow: hidden; |
||||
|
|
||||
|
.popup-item { |
||||
|
width: 697rpx; |
||||
|
height: 99rpx; |
||||
|
font-weight: 500; |
||||
|
font-size: 31rpx; |
||||
|
color: #12293C; |
||||
|
margin: auto; |
||||
|
} |
||||
|
.popup-item:nth-child(2) { |
||||
|
border: none; |
||||
|
border-bottom: 1rpx solid #D8D8D8; |
||||
|
border-top: 1rpx solid #D8D8D8; |
||||
|
} |
||||
|
|
||||
|
.popup-items { |
||||
|
width: 100%; |
||||
|
height: 99rpx; |
||||
|
font-weight: 500; |
||||
|
font-size: 31rpx; |
||||
|
color: #12293C; |
||||
|
border-top: 13rpx solid #F2F2F2; |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,339 @@ |
|||||
|
<template> |
||||
|
<view class="bg"> |
||||
|
<!-- <view class="cancat-nav flex-around"> |
||||
|
<view :class="['concat-nav-item',showType===0?'active':'']" @click="showType=0"> |
||||
|
<view>出行人信息</view> |
||||
|
<view v-if="showType===0" class="active-bar"></view> |
||||
|
</view> |
||||
|
<view :class="['concat-nav-item',showType===1?'active':'']" @click="showType=1"> |
||||
|
<view>收货地址</view> |
||||
|
<view v-if="showType===1" class="active-bar"></view> |
||||
|
</view> |
||||
|
</view> --> |
||||
|
|
||||
|
<!-- 出行人信息 --> |
||||
|
<view v-if="showType===0"> |
||||
|
<view class="item" v-for="(item,index) in travelList" :key="index"> |
||||
|
<view class="name"> |
||||
|
<view class=""> |
||||
|
{{item.name}} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
{{item.tel}} |
||||
|
<span v-if="item.is_default==1">默认</span> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="idcard"> |
||||
|
<view class=""> |
||||
|
{{item.document_type_text}}: |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
{{item.id_number}} |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="item-btn"> |
||||
|
<view class="choice"> |
||||
|
<!-- <image src="https://static.ticket.sz-trip.com/yandu/images/user/dui.png" mode="aspectFill" |
||||
|
v-if="item.is_default==1"> |
||||
|
</image> |
||||
|
<view class="yuan" v-else @click.stop="defaultC(item)"> |
||||
|
|
||||
|
</view> |
||||
|
<view class=""> |
||||
|
默认出行人 |
||||
|
</view> --> |
||||
|
</view> |
||||
|
<view class="btn-list"> |
||||
|
<view class="btn-item" @click.stop="edit(item.id)"> |
||||
|
修改 |
||||
|
</view> |
||||
|
<view class="btn-item" @click.stop="delet(item)"> |
||||
|
删除 |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<!-- 收货地址 --> |
||||
|
<view v-else> |
||||
|
<view class="item" v-for="(item,index) in addressList" :key="index"> |
||||
|
<view class="name"> |
||||
|
<view> |
||||
|
{{item.name}} |
||||
|
</view> |
||||
|
<view class=""> |
||||
|
{{item.tel}} |
||||
|
<span v-if="item.is_default==1">默认</span> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="idcard"> |
||||
|
<view class=""> |
||||
|
收货地址: |
||||
|
</view> |
||||
|
<view class="text-overflow"> |
||||
|
{{item.address}} |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="item-btn" style="justify-content: flex-end;"> |
||||
|
<view class="btn-list"> |
||||
|
<view class="btn-item" @click.stop="edit(item.id)"> |
||||
|
修改 |
||||
|
</view> |
||||
|
<view class="btn-item" @click.stop="delet(item)"> |
||||
|
删除 |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<view class="btn-box"> |
||||
|
<navigator :url="showType ? '/subPackages/user/myAddressAdd' : '/subPackages/user/myContactsAdd'" class="btn"> |
||||
|
{{showType ? '新增收货地址' : '添加联系人'}} |
||||
|
</navigator> |
||||
|
</view> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: "travelerList", |
||||
|
data() { |
||||
|
return { |
||||
|
showType: 1, |
||||
|
travelList: [], |
||||
|
addressList: [] |
||||
|
}; |
||||
|
}, |
||||
|
onShow() { |
||||
|
this.init() |
||||
|
}, |
||||
|
methods: { |
||||
|
init () { |
||||
|
// 出行人信息 |
||||
|
// this.Post({}, "/api/user/contactList").then(res => { |
||||
|
// if (res) this.travelList = res.data |
||||
|
// }) |
||||
|
|
||||
|
// 收货地址 |
||||
|
this.Post({}, '/api/user/consigneeList').then(res => { |
||||
|
if(res) this.addressList = res.data |
||||
|
}) |
||||
|
}, |
||||
|
delet(item) { |
||||
|
let that = this |
||||
|
uni.showModal({ |
||||
|
title: '提示', |
||||
|
content: '确定要删除该出行人吗?', |
||||
|
success: function(res) { |
||||
|
if (res.confirm) { |
||||
|
that.Post({ |
||||
|
id: item.id |
||||
|
}, "/api/user/delDetail").then(res => { |
||||
|
if (res) { |
||||
|
uni.showToast({ |
||||
|
icon: "none", |
||||
|
title: res.msg |
||||
|
}) |
||||
|
} |
||||
|
that.init() |
||||
|
}) |
||||
|
} else if (res.cancel) { |
||||
|
console.log('用户点击取消'); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
defaultC(item) { |
||||
|
this.Post({ |
||||
|
id: item.id, |
||||
|
is_default: 1 |
||||
|
}, "/api/user/editContact").then(res => { |
||||
|
if (res.code == 1) { |
||||
|
this.travelList.forEach(i => i.is_default = 0) |
||||
|
item.is_default = !item.is_default |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 修改出行人信息 |
||||
|
edit(id){ |
||||
|
let url = '' |
||||
|
if(this.showType) { |
||||
|
url = '/subPackages/user/myAddressAdd?id='+id |
||||
|
}else { |
||||
|
url = "/subPackages/user/myContactsAdd?type=edit&id="+id |
||||
|
} |
||||
|
uni.navigateTo({ |
||||
|
url: url |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.bg { |
||||
|
position: relative; |
||||
|
background: #F7F7F7; |
||||
|
height: 100vh; |
||||
|
overflow-x: hidden; |
||||
|
padding-bottom: 200rpx; |
||||
|
} |
||||
|
|
||||
|
.cancat-nav{ |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
height: 112rpx; |
||||
|
flex-shrink: 0; |
||||
|
background-color: #fff; |
||||
|
.concat-nav-item{ |
||||
|
ffont-weight: 500; |
||||
|
font-size: 35rpx; |
||||
|
color: #000000; |
||||
|
height: 100%; |
||||
|
text-align: center; |
||||
|
position: relative; |
||||
|
padding-top: 35rpx; |
||||
|
} |
||||
|
.concat-nav-item.active{ |
||||
|
color: #000000; |
||||
|
} |
||||
|
.active-bar{ |
||||
|
width: 73rpx; |
||||
|
height: 7rpx; |
||||
|
background: #515150; |
||||
|
border-radius: 3rpx; |
||||
|
margin: auto; |
||||
|
position: absolute; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.item { |
||||
|
width: 697rpx; |
||||
|
background: #FFFFFF; |
||||
|
border-radius: 13rpx; |
||||
|
margin: 28rpx auto 0; |
||||
|
padding: 26rpx; |
||||
|
|
||||
|
.name, |
||||
|
.idcard { |
||||
|
display: flex; |
||||
|
font-size: 31rpx; |
||||
|
font-weight: bold; |
||||
|
color: #333333; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.name { |
||||
|
view:last-child{ |
||||
|
margin-left: 40rpx; |
||||
|
} |
||||
|
|
||||
|
span { |
||||
|
padding: 3rpx 9rpx; |
||||
|
background: #515150; |
||||
|
border-radius: 7rpx; |
||||
|
font-weight: bold; |
||||
|
font-size: 24rpx; |
||||
|
color: #FFFFFF; |
||||
|
margin-left: 15rpx; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.idcard { |
||||
|
margin-top: 26rpx; |
||||
|
|
||||
|
view:last-child { |
||||
|
margin-left: 14rpx; |
||||
|
font-weight: 400; |
||||
|
max-width: 492rpx; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.item-btn { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
margin-top: 40rpx; |
||||
|
|
||||
|
.choice { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
|
||||
|
view:last-child { |
||||
|
margin-left: 20rpx; |
||||
|
|
||||
|
font-size: 27rpx; |
||||
|
|
||||
|
font-weight: 500; |
||||
|
color: #333333; |
||||
|
} |
||||
|
|
||||
|
image { |
||||
|
width: 40rpx; |
||||
|
height: 40rpx; |
||||
|
} |
||||
|
|
||||
|
.yuan { |
||||
|
width: 40rpx; |
||||
|
height: 40rpx; |
||||
|
background: rgba(255, 200, 37, 0); |
||||
|
border: 1rpx solid #999999; |
||||
|
border-radius: 20rpx; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.btn-list { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
|
||||
|
view { |
||||
|
width: 134rpx; |
||||
|
height: 54rpx; |
||||
|
background: #FFFFFF; |
||||
|
border: 1px solid #999999; |
||||
|
border-radius: 27rpx; |
||||
|
|
||||
|
|
||||
|
font-size: 27rpx; |
||||
|
font-weight: 500; |
||||
|
color: #333333; |
||||
|
line-height: 52rpx; |
||||
|
text-align: center; |
||||
|
} |
||||
|
|
||||
|
view:last-child { |
||||
|
margin-left: 14rpx; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.btn-box { |
||||
|
position: fixed; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
width: 100%; |
||||
|
height: 200rpx; |
||||
|
background-color: #fff; |
||||
|
|
||||
|
.btn { |
||||
|
width: 697rpx; |
||||
|
line-height: 80rpx; |
||||
|
background: #6CA5AA; |
||||
|
border-radius: 37rpx; |
||||
|
font-weight: 500; |
||||
|
font-size: 36rpx; |
||||
|
color: #fff; |
||||
|
text-align: center; |
||||
|
position: fixed; |
||||
|
bottom: 53rpx; |
||||
|
left: 26.67rpx; |
||||
|
} |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue