You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
3.3 KiB
168 lines
3.3 KiB
9 months ago
|
<template>
|
||
|
<!-- 客户信息 -->
|
||
|
<view class="member">
|
||
|
<u-sticky zIndex="3">
|
||
|
<view class="head">
|
||
|
<u-search placeholder="请输入姓名或手机号" v-model="keyword" @search="getList" @custom="getList"></u-search>
|
||
|
<u-icon name="plus" @click="add"></u-icon>
|
||
|
</view>
|
||
|
</u-sticky>
|
||
|
<view class="main" v-for="(item, index) in customerList" :key="index" >
|
||
|
<view class="u-img">
|
||
|
<img :src="item.avatar" ></img>
|
||
|
</view>
|
||
|
<view class="content">
|
||
|
<view class="c-name">
|
||
|
<u-text :text="item.user"></u-text>
|
||
|
</view>
|
||
|
<view class="c-addtime">
|
||
|
<u-text :text="item.name"></u-text>
|
||
|
</view>
|
||
|
<view class="c-status">
|
||
|
<u-text :text="item.phone"></u-text>
|
||
|
</view>
|
||
|
</view>
|
||
|
<u-icon name="phone" size="30" @click="freeTell(item.phone)"></u-icon>
|
||
|
</view>
|
||
|
<u-divider text="没有更多数据了"></u-divider>
|
||
|
</view>
|
||
|
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
// 搜索内容
|
||
|
search: '',
|
||
|
type: true,
|
||
|
color: 'hsl(200, 88%, 55%)',
|
||
|
customerList: [],
|
||
|
keyword:'',
|
||
|
userinfo: null,
|
||
|
}
|
||
|
},
|
||
|
|
||
|
onShow: function(options) {
|
||
|
this.index()
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
index() {
|
||
|
this.userinfo = uni.getStorageSync('userinfo');
|
||
|
this.getList();
|
||
|
},
|
||
|
async getList() {
|
||
|
this.customerList = []
|
||
|
// if (!this.userinfo) {
|
||
|
// return uni.showToast({
|
||
|
// title: '请登录账号',
|
||
|
// icon: 'error'
|
||
|
// })
|
||
|
// }
|
||
|
const { data:res } = await this.$http('/app/customerList',{'name':this.keyword})
|
||
|
if(res.code) return
|
||
|
this.customerList = res.data
|
||
|
for (var i = 0; i < this.customerList.length; i++) {
|
||
|
if(this.customerList[i].avatar){
|
||
|
this.customerList[i].avatar = this.API_URL + this.customerList[i].avatar;
|
||
|
}else{
|
||
|
this.customerList[i].avatar="../../static/avatar.png"
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
|
||
|
freeTell(tel) {
|
||
|
wx.makePhoneCall({
|
||
|
phoneNumber: tel, //仅为示例,并非真实的电话号码
|
||
|
success: function() {
|
||
|
console.log("拨打电话成功!")
|
||
|
},
|
||
|
fail: function() {
|
||
|
console.log("拨打电话失败!")
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
add() {
|
||
|
// if (!this.userinfo) {
|
||
|
// return uni.showToast({
|
||
|
// title: '请登录账号',
|
||
|
// icon: 'error'
|
||
|
// })
|
||
|
// }
|
||
|
wx.navigateTo({
|
||
|
url:'addCustomer',
|
||
|
})
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
.member {
|
||
|
background: #f6f6f6;
|
||
|
// padding: 2.667vw 0;
|
||
|
height: 100vh;
|
||
|
|
||
|
.btn{
|
||
|
padding: 2.667vw;
|
||
|
.u-button{
|
||
|
margin-bottom: 1vh;
|
||
|
}
|
||
|
.u-form{
|
||
|
margin-bottom: 1vh;
|
||
|
}
|
||
|
}
|
||
|
.head {
|
||
|
background: #fff;
|
||
|
padding: 2.667vw;
|
||
|
|
||
|
display: flex;
|
||
|
justify-content: space-evenly;
|
||
|
align-items: center;
|
||
|
input {
|
||
|
padding: 1vw;
|
||
|
border-radius: 1vw;
|
||
|
}
|
||
|
}
|
||
|
// 展示信息
|
||
|
.main {
|
||
|
background: #ffffff;
|
||
|
margin: 2.667vw 0;
|
||
|
display: flex;
|
||
|
justify-content: space-around;
|
||
|
padding: 2vh 0;
|
||
|
.u-image{
|
||
|
float: left;
|
||
|
}
|
||
|
.content{
|
||
|
flex-direction: column;
|
||
|
align-items: flex-start;
|
||
|
justify-content: space-around;
|
||
|
display: flex;
|
||
|
width: 55vw;
|
||
|
.c-status{
|
||
|
display: flex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.u-img{
|
||
|
height: 80px;
|
||
|
width: 80px;
|
||
|
position: relative;
|
||
|
img{
|
||
|
height: 60px;
|
||
|
width: 60px;
|
||
|
position: absolute;
|
||
|
top: 0;
|
||
|
bottom: 0;
|
||
|
left: 0;
|
||
|
right: 0;
|
||
|
margin: auto;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|