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.

150 lines
2.9 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 supplierList" :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%)',
supplierList: [],
keyword:'',
}
},
onShow: function(options) {
this.getList()
},
methods: {
async getList() {
const { data:res } = await this.$http('/app/supplierList',{'name':this.keyword})
if(res.code) return
this.supplierList = res.data
for (var i = 0; i < this.supplierList.length; i++) {
if(this.supplierList[i].avatar){
this.supplierList[i].avatar = this.API_URL + this.supplierList[i].avatar;
}else{
this.supplierList[i].avatar="../../static/gys.png"
}
}
},
freeTell(tel) {
wx.makePhoneCall({
phoneNumber: tel, //仅为示例,并非真实的电话号码
success: function() {
console.log("拨打电话成功!")
},
fail: function() {
console.log("拨打电话失败!")
}
})
},
add() {
wx.navigateTo({
url:'addSupplier',
})
}
}
}
</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>