Files
xk-doctor-wx/pages/pharmacist/index.vue
2024-09-19 12:57:55 +08:00

332 lines
8.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="safe-area-inset-bottom">
<u-navbar title="审方" :is-back="false" title-size="34" title-color="#fff" :background="{
background:'linear-gradient(90deg, #00BFA6 0%, #6ACDBB 93%)'}">
</u-navbar>
<!-- 头部 tabs -->
<view class="head">
<u-tabs :list="lists" :is-scroll="false" :current="currents" @change="change" active-color="#6ACDBB"
:height="99">
</u-tabs>
</view>
<!-- 空页 -->
<view class="empty" v-if="listInfo.length==0 ||status!=2">
<image src="/static/image/none.png" mode="aspectFit"></image>
<text v-if="status!=2">您还没有通过审核请稍后再试~</text>
</view>
<!-- 列表 -->
<block v-if="status==2">
<!-- 西药 -->
<!-- <view class="lists" v-for="(item,index) in listWest" :key="item.id"
@click="toDetail(item.id,item.prescription_no)">
<view class="info">
<view class="bh">
<image src="/static/image/tubiao1.png" mode=""></image>
{{item.prescription_no}}
</view>
<view class="name">
{{item.patients.name}} {{(item.patients.sex)%2==0?'女':'男'}} {{item.patients.age}}
</view>
<view class="time">
{{item.created_at | dateFormat}}
</view>
</view>
<view class="states" :class="item.status==1?'tg':'wtg'">
<view class="tag_states">
<u-tag text="西药" type="primary" />
</view>
{{item.status==0&&'待审核' || item.status==1&&'已通过' || item.status==2&&'未通过'}}
</view>
</view> -->
<!-- 中药 -->
<!-- <view class="lists" v-for="(item,index) in listChinese" :key="item.id"
@click="toDetail(item.id,item.prescription_no)">
<view class="info">
<view class="bh">
<image src="/static/image/tubiao1.png" mode=""></image>
{{item.prescription_no}}
</view>
<view class="name">
{{item.patients.name}} &nbsp; {{(item.patients.sex)%2==0?'女':'男'}} &nbsp; {{item.patients.age}}
</view>
<view class="time">
{{item.created_at | dateFormat}}
</view>
</view>
<view class="states" :class="item.status==1?'tg':'wtg'">
<view class="tag_states">
<u-tag text="中药" type="success" />
</view>
{{item.status==0&&'待审核' || item.status==1&&'已通过' || item.status==2&&'未通过'}}
</view>
</view> -->
<!-- 颗粒 -->
<view class="lists" v-for="(item,index) in listInfo" :key="item.id"
@click="toDetail(item.id,item.prescription_no)">
<view class="info">
<view class="bh">
<image src="/static/image/tubiao1.png" mode=""></image>
{{item.prescription_no}}
</view>
<view class="name">
{{item.patients.name}} &nbsp; {{(item.patients.sex)%2==0?'女':'男'}} &nbsp; {{item.patients.age}}
</view>
<view class="time">
{{item.created_at | dateFormat}}
</view>
</view>
<view class="states" :class="item.status==1?'tg':'wtg'">
<view class="tag_states">
<u-tag text="颗粒" type="warning" v-if="item.prescription_type==3" />
<u-tag text="中药" type="success" v-if="item.prescription_type==1" />
<u-tag text="西药" type="primary" v-if="item.prescription_type==2" />
</view>
{{item.status==0&&'待审核' || item.status==1&&'已通过' || item.status==2&&'未通过'}}
</view>
</view>
</block>
<d-loading-page :loading="loading"></d-loading-page>
<u-tabbar v-model="current" :list="listed" active-color="#6ACDBB" @change="changed"></u-tabbar>
</view>
</template>
<script>
import {
getUserInfo,
prescripRecord
} from "@/api/all.js";
export default {
data() {
return {
status: uni.getStorageSync('login_status'),
keyword: "",
show: false,
identity: uni.getStorageSync("identity") || 2,
index: 0,
loading: true,
userInfo: uni.getStorageSync("userInfo") || {},
listInfo: [], // 中药
// listWest: [], // 西药
// listGranular: [], // 颗粒
waitList: [],
// is_req: false,
listed: '',
current: 0,
lists: [{
name: '待审核'
},
{
name: '已通过',
},
{
name: '未通过',
}
],
currents: 0, // 审核状态
};
},
computed: {
},
onLoad() {
this.listed = [{
iconPath: require("../../static/image/w-sf.png"),
selectedIconPath: require("../../static/image/sf.png"),
text: '审方',
// pagePath: '/pages/pharmacist/index',
current: 0
},
{
iconPath: require("../../static/image/w-wd.png"),
selectedIconPath: require("../../static/image/wd.png"),
text: '我的',
// pagePath: '/pages/pharmacist/pharmacist-my',
}
]
},
onHide() {
// this.is_req = true;
},
onShow() {
this.current = 0
this.getList()
if (this.status != 2) {
this.getKnow()
}
},
methods: {
change(index) {
this.currents = index;
this.getList()
},
changed(index) {
this.current = index;
if (this.current == 1) {
this.$go('/pages/pharmacist/pharmacist-my')
}
},
async getList() {
let res = {};
res = await prescripRecord({
store_id: uni.getStorageSync('store_id') || '11001',
status: this.currents
})
// this.listChinese = [], this.listWest = [], this.listGranular = [];
if (res.errcode == 0) {
// console.log(res, 'lb');
this.listInfo = res.data.prescription
// this.listWest = (res.data.west).reverse();
// this.listGranular = (res.data.granular).reverse()
this.$nextTick(() => {
this.loading = false;
});
} else {
this.$toast(res.msg);
this.loading = false;
this.listInfo = []
}
},
// 详情
toDetail(id, no) {
uni.navigateTo({
url: '../../subPackages/sub_pharmacist/myrecord-detail?id=' + id + '&prescription_no=' + no
})
},
getKnow() {
const data = {
store_id: uni.getStorageSync('store_id') || '11001',
}
getUserInfo(data).then(res => {
if (res.errcode != -1) {
uni.setStorageSync('loginInfo', res.data)
uni.setStorageSync('role', res.data.role)
uni.setStorageSync('login_id', res.data['id'])
uni.setStorageSync('login_status', res.data['status'])
}
})
},
},
mounted() {
if (this.status != 2) {
this.$go('/pages/workbench/examine')
}
},
filters: {
//过滤器 用于格式化时间
dateFormat: function(value) {
var date = new Date(value * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var sdate = ("0" + date.getDate()).slice(-2);
var hour = ("0" + date.getHours()).slice(-2);
var minute = ("0" + date.getMinutes()).slice(-2);
var second = ("0" + date.getSeconds()).slice(-2);
// 拼接
var result = year + '-' + month + '-' + sdate + ' ' + hour + ":" + minute //+ ":" + second;
// 返回
return result;
},
},
}
</script>
<style>
page {
background-color: #f9fafb;
}
</style>
<style lang="scss" scoped>
.u-tabbar {
z-index: 999;
}
.head {
background-color: #fff;
width: 750rpx;
height: 99rpx;
position: sticky;
top: 180rpx;
z-index: 9999;
}
.empty {
width: 440rpx;
height: 393rpx;
margin: 200rpx auto;
image {
width: 100%;
height: 100%;
z-index: 10;
}
}
.lists {
width: 750rpx;
padding: 24rpx 36rpx;
background: #FFFFFF;
margin: 30rpx auto 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-family: PingFang SC-Regular, PingFang SC;
.info {
.bh {
font-weight: 400;
color: #666666;
image {
width: 38rpx;
height: 38rpx;
vertical-align: middle;
margin-right: 18rpx;
}
}
.name {
font-weight: bold;
color: #333333;
margin: 18rpx 0;
}
.time {
width: 100%;
font-weight: 400;
color: #999999;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.states {
font-weight: 400;
color: #6A6DCD;
display: flex;
flex-direction: column;
.tag_states {
margin-bottom: 44rpx;
}
}
.wtg {
color: #FF477E;
}
.tg {
color: #6ACDBB;
}
}
</style>