123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <template>
- <view class="content">
- <view class="top-box">
- <!-- 搜索框 -->
- <view class="search-cont">
- <view class="inner">
- <image class="icon-search" src="/static/images/icon_search.png" mode=""></image>
- <input type="text" v-model="keyword" placeholder="输入关键字搜索" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
- </view>
- </view>
- <view class="tabs">
- <u-tabs
- :scrollable="false"
- :list="tabs"
- lineColor="#C39A58"
- @change="tabChange">
- </u-tabs>
- </view>
- </view>
- <view class="cont-box">
- <view class="left">
- <view class="items">
- <view v-if="tabIndex==1" @click="flavorClick(item)" v-for="item in flavorOptions" :class="item.dictValue==flavor?'item ellipsis active':'item ellipsis'">
- <text class="line" v-if="item.dictValue==flavor"></text>
- {{$parseText(item.dictLabel,4)}}
- </view>
- <view v-if="tabIndex==2" @click="indicationClick(item)" v-for="item in indicationOptions" :class="item.dictLabel==indication?'item ellipsis active':'item ellipsis'">
- <text class="line" v-if="item.dictLabel==indication"></text>
- {{$parseText(item.dictLabel,4)}}
- </view>
-
- </view>
- </view>
- <view class="right" >
- <view class="title">{{title}}</view>
- <scroll-view @scrolltolower="scrolltolower" scroll-y="true" style="height: calc(100vh - 180rpx);">
- <view class="items">
- <view class="r-item" @click="showDetail(item)" v-for="item in dataList">
- <view class="r-left">{{item.medicineName}}</view>
- <view class="r-right">
- <image src="../static/images/fire.png"></image>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {getDictByKey} from '@/api/common.js'
- import {getChineseMedicineList} from '@/api/index.js'
- export default {
- data() {
- return {
- tabIndex:1,
- indication:"",
- flavor:"",
- vessel:"",
- title:"",
- pageNum:1,
- pageSize:20,
- flavorOptions:[],
- indicationOptions:[],
- tabs: [
- {name:"按五味",id:"1"},
- {name:"按疾病",id:"2"},
- ],
- keyword: '',
- dataList: []
- };
- },
- onLoad() {
- this.getDictByKey("sys_chinese_medicine_flavor");
- this.getDictByKey("sys_indication");
- this.getChineseMedicineList()
- },
- methods:{
- scrolltolower(e){
- this.pageNum++;
- this.getChineseMedicineList()
- console.log(e)
- },
- indicationClick(item){
- this.flavor="";
- this.indication=item.dictLabel;
- this.title=item.dictLabel;
- this.pageNum=1;
- this.getChineseMedicineList()
- },
- flavorClick(item){
- console.log(item)
- this.indication=""
- this.flavor=item.dictLabel;
- this.title=item.dictLabel;
- this.pageNum=1;
- this.getChineseMedicineList()
- },
- getDictByKey(key){
- var data={key:key}
- getDictByKey(data).then(
- res => {
- if(res.code==200){
-
- if(key=="sys_indication"){
- this.indicationOptions=res.data;
-
- }
- if(key=="sys_chinese_medicine_flavor"){
- this.flavorOptions=res.data;
-
- }
- }
- },
- err => {
- }
- );
-
- },
- tabChange(item) {
- this.tabIndex = item.id
- this.getChineseMedicineList()
- },
- doSearch(){
- this.pageNum=1;
- this.getChineseMedicineList()
- },
- getChineseMedicineList() {
- //联网加载数据
- var that = this;
- var data = {
- indication:this.indication,
- flavor:this.flavor,
- vessel:this.vessel,
- keyword:this.keyword,
- pageNum: this.pageNum,
- pageSize: this.pageSize
- };
- // uni.showLoading({
- // title:"加载中..."
- // })
- getChineseMedicineList(data).then(res => {
- // uni.hideLoading()
- if(res.code==200){
- //设置列表数据
- if (this.pageNum == 1) {
- that.dataList = res.data.list;
-
- } else {
- that.dataList = that.dataList.concat(res.data.list);
-
- }
-
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- that.dataList = [];
- }
- });
- },
-
- // 查看详情
- showDetail(item) {
- uni.navigateTo({
- url: './chineseMedicineDetails?id=' + item.id
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .content{
- height: 100%;
- overflow: hidden;
- }
- .top-box{
- width: 100%;
- height: 180rpx;
- background-color: #FFFFFF;
- .search-cont{
- padding: 16upx 30upx;
- .inner{
- box-sizing: border-box;
- width: 100%;
- height: 72upx;
- background: #F7F7F7;
- border-radius: 36upx;
- display: flex;
- align-items: center;
- padding: 0 30upx;
- .icon-search{
- width: 28upx;
- height: 28upx;
- margin-right: 20upx;
- }
- input{
- height: 60upx;
- line-height: 60upx;
- flex: 1;
- }
- }
- }
- .tabs{
- }
- }
- .cont-box{
- height: calc(100% - 180rpx);
- display: flex;
- align-items: flex-start;
- justify-content: flex-start;
- .left{
- padding: 30rpx 0rpx;
- width: 240rpx;
- height: 100%;
- overflow-y: auto;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- .items{
- width: 240rpx;
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: flex-start;
- .item{
- width: 240rpx;
- padding: 0rpx 20rpx;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: normal;
- color: #111111;
- font-weight: 500;
- line-height: 80upx;
- .line{
- margin-right: 15rpx;
- border-radius: 5rpx;
- width: 8rpx;
- height:30rpx;
- background-color: #C39A58;
- }
-
- }
- .active{
- background-color: #fff;
- font-weight: bold;
- color: #C39A58;
- }
- }
-
- }
- .right{
- padding: 30rpx 15rpx;
- background-color: #fff;
- height: 100%;
- overflow-y: auto;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- width: calc(100% - 240rpx);
- .title{
- font-size: 40upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #C39A58;
- line-height: 80upx;
- }
- .items{
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- .r-item{
- line-height: 80rpx;
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- .r-left{
- flex: 1;
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #080808;
- }
- .r-right{
- padding: 0rpx 20rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- image{
- width: 22rpx;
- height:30rpx;
- }
- }
-
- }
-
- }
- }
- }
-
- </style>
|