8.10提交代码 糖组检测
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
// Pages/yishi/medince_list/index.js
|
||||
import { API } from './../../../utils/network/api'
|
||||
import debounce from "./../../../utils/debounce"
|
||||
let api = new API()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
navbarData: {
|
||||
|
||||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '药品清单', //导航栏 中间的标题
|
||||
},
|
||||
page:1,
|
||||
list:[],
|
||||
isLock:false,
|
||||
per_page:10,
|
||||
keyword:'',
|
||||
},
|
||||
changeInput:debounce(function(event){
|
||||
const { value }= event.detail;
|
||||
this.setData({
|
||||
isLock:false,
|
||||
page:1,
|
||||
list:[],
|
||||
keyword:value
|
||||
})
|
||||
this.handleGetList();
|
||||
},600),
|
||||
goSearch(){
|
||||
this.setData({
|
||||
isLock:false,
|
||||
list:[],
|
||||
page:1
|
||||
})
|
||||
this.handleGetList();
|
||||
},
|
||||
confirmSearch(event){
|
||||
const { value }= event.detail;
|
||||
this.setData({
|
||||
isLock:false,
|
||||
list:[],
|
||||
page:1,
|
||||
keyword:value
|
||||
})
|
||||
this.handleGetList();
|
||||
},
|
||||
lower(){
|
||||
console.log('===触底了!!===');
|
||||
let {page,isLock}=this.data;
|
||||
if(!isLock){
|
||||
page++;
|
||||
this.setData({
|
||||
page:page
|
||||
});
|
||||
this.handleGetList();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
handleGetList(){
|
||||
const {page,per_page,keyword}=this.data;
|
||||
api.getMedinceList({
|
||||
page,
|
||||
per_page,
|
||||
keyword,
|
||||
|
||||
}).then(data=>{
|
||||
let result=data.data.data;
|
||||
if(result.length==0){
|
||||
this.setData({
|
||||
isLock:true
|
||||
});
|
||||
return false;
|
||||
}
|
||||
this.setData({
|
||||
list:this.data.list.concat(result)
|
||||
});
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
onLoad(options) {
|
||||
this.handleGetList();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "/commpents/te_navbar",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"van-divider": "@vant/weapp/divider/index",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<!--Pages/yishi/medince_list/index.wxml-->
|
||||
<te-nav-bar navbar-data='{{navbarData}}'></te-nav-bar>
|
||||
<view class="container">
|
||||
<view class="searchCon">
|
||||
<view class="searchbox">
|
||||
<input type="text" value="" class="searchIpt" placeholder="请输入药品名称" confirm-type="search" bindinput="changeInput" bindconfirm="confirmSearch"/>
|
||||
<image src="../../../static/images/yishi/tabbar_icon/ss.png" mode="" class="searchImg" bindtap="goSearch"/>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-y="true" class="scrollbox" bindscrolltolower="lower" wx:if="{{list.length>0}}" >
|
||||
<view class="cell" wx:for="{{list}}" wx:key="product_id" >
|
||||
<view class="medimgbox">
|
||||
<view class="tips">
|
||||
<view class="desc">处方药品</view>
|
||||
<view class="desc">依据法规不展示包装</view>
|
||||
</view>
|
||||
<image class="medImg" src="../../../static/images/yishi/tabbar_icon/zhiyao.png" mode=""/>
|
||||
</view>
|
||||
|
||||
<view class="rightbox">
|
||||
<view class="info">
|
||||
<view class="name">{{item.product_name}}/{{item.packaging_unit}}</view>
|
||||
<view class="company">{{item.manufacturer}}</view>
|
||||
</view>
|
||||
<view class="bottombox">
|
||||
<view class="price">¥ {{item.product_price}}</view>
|
||||
<view class="num">库存:{{item.stock}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-divider contentPosition="center" wx:if="{{list.length > 0 && isLock}}">到底了~</van-divider>
|
||||
</scroll-view>
|
||||
<van-empty description="暂无数据" wx:if="{{list.length == 0}}" />
|
||||
|
||||
</view>
|
||||
@@ -0,0 +1,117 @@
|
||||
/* Pages/yishi/medince_list/index.wxss */
|
||||
page{
|
||||
height:100vh;
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.container{
|
||||
height:calc(100vh - 135rpx);
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
/* overflow-y: scroll; */
|
||||
/* -webkit-overflow-scrolling: touch; */
|
||||
flex-direction: column;
|
||||
}
|
||||
.searchCon{
|
||||
width:100%;
|
||||
|
||||
background:#fff;
|
||||
}
|
||||
.searchbox{
|
||||
display: flex;
|
||||
margin:32rpx;
|
||||
align-items: center;
|
||||
height: 80rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 40rpx;
|
||||
border: 2rpx solid #3CC7C0;
|
||||
|
||||
}
|
||||
.searchIpt{
|
||||
flex:1;
|
||||
margin-left: 32px;
|
||||
}
|
||||
.searchImg{
|
||||
width: 40rpx;
|
||||
height:40rpx;
|
||||
padding:30rpx;
|
||||
}
|
||||
.tips{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
position: absolute;
|
||||
width: 200rpx;
|
||||
height:200rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 400;
|
||||
color: #666666;
|
||||
}
|
||||
.desc{
|
||||
text-align: center;
|
||||
}
|
||||
.medimgbox{
|
||||
position: relative;
|
||||
width: 200rpx;
|
||||
height:200rpx;
|
||||
margin-left: 30rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius:5rpx;
|
||||
}
|
||||
.medImg{
|
||||
width:120rpx;
|
||||
height:128rpx;
|
||||
|
||||
}
|
||||
.cell{
|
||||
padding:20rpx 0;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 2rpx 16rpx 2rpx rgba(0,0,0,0.02);
|
||||
border-radius: 12rpx;
|
||||
margin:0 32rpx 20rpx;
|
||||
display: flex;
|
||||
}
|
||||
.rightbox{
|
||||
flex:1;
|
||||
margin-left: 24rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.scrollbox{
|
||||
margin-top: 20rpx;
|
||||
flex:1;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.bottombox{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.info .name{
|
||||
word-break: break-all;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: rgba(0,0,0,0.85);
|
||||
}
|
||||
.company{
|
||||
margin-top: 5rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(0,0,0,0.45);
|
||||
}
|
||||
.price{
|
||||
font-size: 28rpx;
|
||||
color: #EF4F20;
|
||||
}
|
||||
.rightbox{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
}
|
||||
.num{
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: rgba(0,0,0,0.65);
|
||||
}
|
||||
Reference in New Issue
Block a user