Commit cdb945d7 authored by qipeng's avatar qipeng

Merge branch 'album' of http://192.168.0.204/panyongping/uni-pdtravel into album

parents 2a2fd209 6a43bfba
......@@ -175,17 +175,66 @@
{{item}}
</text>
</view>
<view style="flex: 1;overflow-y: scroll;">
<view style="flex:1;overflow-y: scroll;">
<!-- 现场取件 -->
<view v-if="active==0">
<view class="live-top">
<view class="live-top-list">
<text>
选择城市
</text>
<view>
重庆市渝中区
<u-icon name="arrow-right" color="#666666"></u-icon>
</view>
</view>
<view class="live-top-list">
<text>
经营主体
</text>
<view>
重庆索道北广场
<u-icon name="arrow-right" color="#666666"></u-icon>
</view>
</view>
<view class="live-top-list">
<text>
详细地址
</text>
<view>
重庆市渝中区
</view>
</view>
</view>
<view class="live-bottom">
<text>确认</text>
</view>
</view>
<!-- 邮寄到家 -->
<view v-else>
<view class="mail-top">
<view>
原地址
</view>
<view>
重庆市渝北区恒大御都会A组团2栋5-6
</view>
<view>
<text>潘永坪</text>
<text>15808046328</text>
</view>
</view>
<view class="mail-middle">
</view>
<view class="mail-bottom">
</view>
</view>
</view>
</view>
</u-popup>
</view>
</template>
......@@ -382,5 +431,46 @@ export default {
text:last-child{
margin-left: 80rpx;
}
text.on{
color: $red;
}
}
.live-top{
background: #ffffff;
}
.live-top-list{
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 40rpx;
border-bottom: 1px solid #eeeeee;
>view{
display: flex;
}
text{
color: #666666;
}
}
.live-bottom{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 128rpx;
display: flex;
align-items: center;
background: #ffffff;
z-index: 1;
text{
display: inline-block;
width: 100%;
text-align: center;
height: 88rpx;
line-height: 88rpx;
background: $red;
border-radius: 44rpx;
color: #ffffff;
font-size: 32rpx;
}
}
</style>
\ No newline at end of file
......@@ -7,23 +7,23 @@
</view>
<view class="middle">
<view v-if="active==0" class="contact-list" v-for="(item,index) in 8" :key="index">
<view v-if="active==0" class="contact-list" v-for="(item,index) in contactList" :key="index">
<view class="contact-name">
<text>姓名:潘永坪</text>
<text>15808046328</text>
<text>姓名:{{item.name}}</text>
<text>{{item.phone?item.phone.substr(0,3)+"****"+item.phone.substr(7,4):""}}</text>
</view>
<view class="contact-id">
证件号:500109198808199110
证件号:{{item.credentialNumber?item.credentialNumber.substr(0,3)+"****"+item.credentialNumber.substr(item.credentialNumber.length-4,4):"无"}}
</view>
<view class="contact-edit">
<view>
<u-icon name='file-text' color='#666666' size='56'></u-icon>
<u-icon name='file-text' color='#666666' size='48'></u-icon>
编辑
</view>
<view>
<u-icon name='trash' color='#666666' size='56'></u-icon>
<view @click="clickDele(item)">
<u-icon name='trash' color='#666666' size='48'></u-icon>
删除
</view>
</view>
......@@ -47,11 +47,11 @@
</label>
</view>
<view>
<u-icon name='file-text' color='#666666' size='56'></u-icon>
<u-icon name='file-text' color='#666666' size='48'></u-icon>
编辑
</view>
<view>
<u-icon name='trash' color='#666666' size='56'></u-icon>
<u-icon name='trash' color='#666666' size='48'></u-icon>
删除
</view>
</view>
......@@ -62,25 +62,84 @@
<text v-if="active==0">新增联系人</text>
<text v-else>新增地址</text>
</view>
<u-modal :show="showModal" @confirm="confirmDele" @cancel="showModal=false" showCancelButton title="确认删除该联系人" ></u-modal>
<editContacts ref="editContacts" :editContactData="editContactData" :credential='productIfo.credential'></editContacts>
</view>
</template>
<script>
import editContacts from './components/editContacts' //编辑联系人弹窗
export default {
data() {
return {
active:0,//导航下标
tabList:['联系人','收货地址']//导航标题
tabList:['联系人','收货地址'],//导航标题
contactList:[],//联系人列表
showModal: false, //确认弹窗显示隐藏
contactName:'',//删除联系人的Id
contactopenid:'',//删除联系人的openid
}
},
onLoad(option) {
this.getContactList()
},
methods: {
//---导航点击
tabClick(index){
this.active=index
},
//---初始化联系人列表
getContactList() {
let data = {
openid:uni.getStorageSync('openid')||''
}
this.$request('wechatUser/contact/findContactList', data).then(res => {
if (res.code == '00') {
this.contactList = res.data||[]
//由于数据结构变化,重新组装数据
this.contactList.forEach(item=>{
if(item.contactVos.length>0){
item.credentialNumber=item.contactVos[0].credentialNumber
item.credentialType=item.contactVos[0].credentialType
}
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
//---点击删除
clickDele(item) {
this.showModal = true
this.contactName=item.name
this.contactopenid=item.openid
},
//---确认删除
confirmDele(){
let data={
name:this.contactName,//联系人姓名
openid:this.contactopenid//联系人openid
}
this.$request('wechatUser/contact/deleteContact', data).then((res) => {
if (res.code == '00') {
uni.showToast({
title:'删除成功',
icon:'none'
})
this.showModal = false
this.getContactList()
} else {
uni.showToast({
title:res.message,
icon:'none'
})
}
}).catch(() => {
this.showModal = false
})
}
}
}
......
<template>
<view class="edit-bg" v-show="showPop">
<view class="edit-wrap">
<view class="return" @click="showPop = false">
<view>
新增/编辑联系人
</view>
<view class="return-icon">
<u-icon name="close" bold></u-icon>
</view>
</view>
<view class="editTop">
</view>
<view class="editBottom">
<view class="bottomContent">
<view>
<text class="bottom-title">
姓名
</text>
<input v-model.trim="name" placeholder="请输入姓名,必填" placeholder-class="placeholderStyle" />
</view>
<view @click="showIdType=true" v-if="credentialList.length>1">
<text class="bottom-title">
证件类型
</text>
<!-- 0和空用全等防止出现bug -->
<text style="flex: 1;" v-if="credentialType===''">请选择证件类型</text>
<text style="flex: 1;" v-if="credentialType===0">身份证</text>
<text style="flex: 1;" v-if="credentialType==1">护照</text>
<text style="flex: 1;" v-if="credentialType==2">港澳通行证</text>
<text style="flex: 1;" v-if="credentialType==3">台胞通行证</text>
<text style="flex: 1;" v-if="credentialType==4">台胞证</text>
<text style="flex: 1;" v-if="credentialType==5">回乡证</text>
<text style="flex: 1;" v-if="credentialType==6">外国人永久居留证</text>
<text style="flex: 1;" v-if="credentialType==7">学生证</text>
<text style="flex: 1;" v-if="credentialType==8">军官证</text>
<text style="flex: 1;" v-if="credentialType==9">残疾军人证</text>
<u-icon name="arrow-right" size='26' color='#B4B4B4'></u-icon>
</view>
<view>
<text class="bottom-title">
证件号
</text>
<input v-model.trim="credentialNumber" :placeholder="placeholderText" />
</view>
<view>
<text class="bottom-title">
联系电话
</text>
<input type="number" v-model.trim="phone" maxlength="11" placeholder="用于接收行程信息" />
</view>
<view>
<text class="complete" @click="keepSave()">完成</text>
</view>
</view>
</view>
</view>
<!-- 证件类型弹窗 -->
<u-popup :show="showIdType" :round="20" @close="showIdType = false" closeable>
<view style="padding: 24rpx;">
<view style="text-align: center;padding-bottom:20rpx;">
证件类型
</view>
<view v-for="(item,index) in credentialList" :key='index' class="idList" @click="chooseCredential(item)">
<text v-if="item==0">身份证</text>
<text v-if="item==1">护照</text>
<text v-if="item==2">港澳通行证</text>
<text v-if="item==3">台胞通行证</text>
<text v-if="item==4">台胞证</text>
<text v-if="item==5">回乡证</text>
<text v-if="item==6">外国人永久居留证</text>
<text v-if="item==7">学生证</text>
<text v-if="item==8">军官证</text>
<text v-if="item==9">残疾军人证</text>
<!--用全等防止为空时出现bug -->
<u-icon name='checkmark' size='48' color='#3688FF' v-if="credentialType===item"></u-icon>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
props: ['editContactData','credential'],
data() {
return {
showPop: false, //控制组件显示隐藏
name: '', //姓名
credentialNumber: '', //身份证号
phone:'',//手机号码
reviseContactId: '', //被修改人id
showIdType:false,//证件类型弹窗显示隐藏
credentialList:[],//证件类型列表
credentialType:'',//选中的证件类型
placeholderText:'',//提示输入什么证件
}
},
watch: {
editContactData: { //编辑联系人数据
handler(newValue, oldValue) {
this.name = newValue.name||''
this.credentialNumber = newValue.credentialNumber||''
this.reviseContactId = newValue.id||''
this.phone=newValue.phone||''
if(typeof newValue.credentialType === 'undefined'){
//补充证件信息时,没有证件类型,直接置为空
this.credentialType=''
}else{
this.credentialType=newValue.credentialType
}
},
deep: true,
immediate: false
},
credential: {//该产品对应联系人可以添加的证件类型
handler(newValue, oldValue) {
this.credentialList=newValue.split(',')||[]
this.credentialList.forEach((item,index)=>{
//转化成数字类型,防止上面证件类型,编辑选择身份证时出现bug
this.credentialList[index]=parseFloat(item)
})
if(this.credentialList.length==1){
let type=this.credentialList[0]
if(type=='0'){this.placeholderText='请输入身份证,必填'}
if(type=='1'){this.placeholderText='请输入护照,必填'}
if(type=='2'){this.placeholderText='请输入港澳通行证,必填'}
if(type=='3'){this.placeholderText='请输入台胞通行证,必填'}
if(type=='4'){this.placeholderText='请输入台胞证,必填'}
if(type=='5'){this.placeholderText='请输入回乡证,必填'}
if(type=='6'){this.placeholderText='请输入外国人永久居留证,必填'}
if(type=='7'){this.placeholderText='请输入学生证,必填'}
if(type=='8'){this.placeholderText='请输入军官证,必填'}
if(type=='9'){this.placeholderText='请输入残疾军人证,必填'}
}
if(this.credentialList.length>1){
this.placeholderText='请输入证件号码,必填'
}
},
deep: true,
immediate: false
}
},
methods: {
//---选择证件类型
chooseCredential(item){
this.credentialType=item
this.showIdType=false
},
//---保存
keepSave() {
if(!this.name){
uni.showToast({
title:'请输入姓名',
icon:'none'
})
return
}
let credentialType=''
//当只有一个证件类型时取第一个
if(this.credentialList.length==1){
credentialType=this.credentialList[0]
}
//当有多个证件类型时取选中的那一个
if(this.credentialList.length>1){
credentialType=this.credentialType
}
if(credentialType===''){
uni.showToast({
title:'请选择证件类型',
icon:'none'
})
return
}
if(!this.credentialNumber){
uni.showToast({
title:'请输入证件号码',
icon:'none'
})
return
}
if (this.phone&&!this.$commonjs.phoneReg().test(this.phone)) {
uni.showToast({
title:'请输入正确电话号码',
icon:'none'
})
return
}
let data = {
name: this.name, //保存姓名
phone:this.phone, //电话号码
credentialNumber: this.credentialNumber, //身份证号
openid: uni.getStorageSync('openid'), //用户Id
merchantType: 1, //商户类型,1.景区,2.酒店,3.餐饮
id: this.reviseContactId, //被修改人id
category: '', //成人或者儿童
credentialType, //证件类型
}
let queryUrl=''
if(this.reviseContactId){
queryUrl='wechatUser/contact/updateContact'
}else{
queryUrl='wechatUser/contact/saveContact'
}
this.$request(queryUrl, data).then((res) => {
if (res.code == '00') {
uni.showToast({
title:'保存成功',
icon:'none'
})
if(!this.reviseContactId){
this.$parent.addChoose()
//显示联系人列表弹窗
this.$parent.$refs.contactList.showPop = true
//成功之后清空数据,防止下次新增的时候出现之前的数据
this.name = ''
this.credentialNumber = ''
this.phone=''
}else{
this.$parent.getContactList()
}
//关闭当前弹窗
this.showPop = false
} else {
uni.showToast({
title:res.message,
icon:'none'
})
}
})
}
}
}
</script>
<style scoped="scoped" lang="scss">
.edit-bg{
background:rgba(0,0,0,0.4);
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
padding-top: 100rpx;
}
.edit-wrap{
height: 100%;
display: flex;
flex-direction: column;
background: #ffffff;
border-radius: 20rpx;
}
.return {
height: 100rpx;
display: flex;
align-items: center;
background: #FFF1E8;
color: #FC771D;
justify-content: center;
font-weight: bold;
font-size: 32rpx;
position: relative;
border-radius: 20rpx 20rpx 0 0;
}
.return-icon{
position: absolute;
right: 24rpx;
}
.editTop {
height:200rpx;
background: linear-gradient(to bottom, #2984ef, #d8eaf6);
}
.editBottom {
position: relative;
top: -80rpx;
padding: 0 20rpx;
}
.bottomContent {
border-radius: 20rpx;
background: #FFFFFF;
padding: 20rpx 20rpx 60rpx 20rpx;
}
.bottomContent view {
height: 100rpx;
align-items: center;
display: flex;
border-bottom: 1px solid #f0f0f0;
}
.bottom-title{
display: inline-block;
width: 140rpx;
text-align-last: justify;
margin-right: 20rpx;
}
.bottomContent view input {
flex: 1;
}
.bottomContent view:last-child {
margin-top: 60rpx;
border: none;
}
.complete{
width:100%;
height:70rpx;
border-radius:16rpx;
color: #FFFFFF;
text-align: center;
line-height:70rpx;
background:$theme;
display: inline-block;
}
.idList{
display: flex;
justify-content: space-between;
height: 100rpx;
align-items: center;
border-bottom: 1px solid #f3f3f3;
}
.placeholderStyle{
color: $theme !important;
}
input::-webkit-input-placeholder {
color: $theme;
}
input::-moz-placeholder { /* Firefox 18- */
color: $theme;
opacity: 1; /* 修复Firefox的不透明度问题 */
}
input:-moz-placeholder { /* Firefox 19+ */
color: $theme;
opacity: 1; /* 修复Firefox的不透明度问题 */
}
input:-ms-input-placeholder {
color:$theme;
}
</style>
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