1
0
Fork 0

datetimepicker

master
panliang 2023-09-25 11:26:46 +08:00
parent aa60103568
commit c13f4a653a
8 changed files with 43 additions and 65 deletions

View File

@ -1,3 +1,19 @@
# 宝芝堂-uniapp # 宝芝堂-uniapp
- `pnpm install` - `pnpm install`
## 修改 uview-ui
### node_modules\uview-ui\components\u-datetime-picker\u-datetime-picker.vue
```vue
<script>
export default {
watch: {
value(newValue) {
this.updateColumnValue(newValue)
},
}
}
</script>
```

View File

@ -1,21 +1,16 @@
<template> <template>
<view class="page"> <view class="page">
<view class="btns"> <view class="btns">
<u-empty v-if="list.length == 0" mode="list" text="请先在后台添加分类" />
<view class="btn" v-for="item in list" :key="item.id"> <view class="btn" v-for="item in list" :key="item.id">
<u-button <u-button
:icon="`../../static/${item.key}.png`" :icon="item.image"
:text="item.name" :text="item.name"
size="large" size="large"
@click="itemClick(item.id)" @click="itemClick(item.id)"
/> />
</view> </view>
</view> </view>
<!-- <u-grid align="center" :border="true" :col="1">
<u-grid-item v-for="item in list" :key="item.id" :name="item.id" @click="itemClick">
<u-image :src="`../../static/${item.key}.png`" width="40" height="40" />
<text class="grid-text">{{item.name}}</text>
</u-grid-item>
</u-grid> -->
</view> </view>
</template> </template>
@ -28,7 +23,10 @@
}, },
onLoad() { onLoad() {
const params = {_action: 'getData'} const params = {_action: 'getData'}
this.$ajax.get('/admin-api/category', { params }).then(res => { this.$ajax.get('/admin-api/category', {
params,
custom: { loading: true }
}).then(res => {
if (res.status == 0) { if (res.status == 0) {
this.list = res.data.items this.list = res.data.items
} }
@ -45,17 +43,6 @@
} }
</script> </script>
<style scoped> <style scoped>
.page ::v-deep .u-grid {
margin-top: 400rpx;
background: white;
}
.page ::v-deep .u-grid-item {
padding: 15px 0;
}
.page ::v-deep .grid-text {
margin-top: 10px
}
.btns { .btns {
margin-top: 400rpx; margin-top: 400rpx;
display: flex; display: flex;

View File

@ -222,11 +222,7 @@ export default {
toggleBirthday(name) { toggleBirthday(name) {
if (name) { if (name) {
this.datePicker.name = name this.datePicker.name = name
const value = this.info[name] this.datePicker.value = new Date(this.info[name]).getTime()
if (value) {
}
this.datePicker.value = (new Date(value)).getTime()
} }
this.datePicker.show = !this.datePicker.show this.datePicker.show = !this.datePicker.show
}, },

View File

@ -18,14 +18,14 @@
</u-form-item> </u-form-item>
<u-form-item prop="birthday" label="出生年月" @click="toggleBirthday('birthday')"> <u-form-item prop="birthday" label="出生年月" @click="toggleBirthday('birthday')">
<view class="input-text"> <view class="input-text">
<text v-if="form.birthday">{{ form.birthday | date('yyy-MM-dd') }}</text> <text v-if="form.birthday">{{ form.birthday | date('yyyy-MM-dd') }}</text>
<text v-else class="input-placeholder">请选择出生日期</text> <text v-else class="input-placeholder">请选择出生日期</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
</u-form-item> </u-form-item>
<u-form-item prop="treat_at" label="初诊日期" @click="toggleBirthday('treat_at')"> <u-form-item prop="treat_at" label="初诊日期" @click="toggleBirthday('treat_at')">
<view class="input-text"> <view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date('yyy-MM-dd') }}</text> <text v-if="form.treat_at">{{ form.treat_at | date('yyyy-MM-dd') }}</text>
<text v-else class="input-placeholder">请选择初诊日期</text> <text v-else class="input-placeholder">请选择初诊日期</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
@ -171,7 +171,7 @@ export default {
this.form.sex = e.value this.form.sex = e.value
}, },
selectBirthday(e) { selectBirthday(e) {
this.form[this.datePicker.name] = Math.floor(e.value / 1000) this.form[this.datePicker.name] = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
this.toggleBirthday() this.toggleBirthday()
}, },
opendDoctor() { opendDoctor() {

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="page"> <view class="page">
<u--form :model="form" ref="form" labelWidth="70" :borderBottom="false"> <u--form :model="form" ref="form" labelWidth="80" :borderBottom="false">
<u-form-item prop="patient_id" label="姓名" :borderBottom="true"> <u-form-item prop="patient_id" label="姓名" :borderBottom="true">
<view class="input-text"> <view class="input-text">
<text>{{ patient.name }}</text> <text>{{ patient.name }}</text>
@ -11,7 +11,7 @@
<u-radio v-for="item in typeList" :key="item.id" :label="item.name" :name="item.id" /> <u-radio v-for="item in typeList" :key="item.id" :label="item.name" :name="item.id" />
</u-radio-group> </u-radio-group>
</u-form-item> </u-form-item>
<u-form-item prop="form.treat_at" label="诊疗时间" :required="true" :borderBottom="true" @click="toggleDatePicker('treat_at')"> <u-form-item prop="form.treat_at" label="诊疗时间" :required="true" :borderBottom="true" @click="toggleDatePicker('treat_at', 'datetime')">
<view class="input-text"> <view class="input-text">
<text v-if="form.treat_at">{{ form.treat_at | date }}</text> <text v-if="form.treat_at">{{ form.treat_at | date }}</text>
<text v-else class="input-placeholder">请选择诊疗时间</text> <text v-else class="input-placeholder">请选择诊疗时间</text>
@ -26,27 +26,9 @@
</view> </view>
</u-form-item> </u-form-item>
<u-form-item prop="form.origin_price" label="划线价" :required="true" :borderBottom="true"> <u-form-item prop="form.origin_price" label="划线价" :required="true" :borderBottom="true">
<!-- <u-number-box
v-model="form.origin_price"
:showMinus="false"
:showPlus="false"
:min="0"
decimalLength="2"
inputWidth="100%"
asyncChange
/> -->
<input type="number" v-model="form.origin_price" placeholder="输入划线价" /> <input type="number" v-model="form.origin_price" placeholder="输入划线价" />
</u-form-item> </u-form-item>
<u-form-item prop="form.sell_price" label="实收价" :required="true" :borderBottom="true"> <u-form-item prop="form.sell_price" label="实收价" :required="true" :borderBottom="true">
<!-- <u-number-box
v-model="form.sell_price"
:showMinus="false"
:showPlus="false"
:min="0"
decimalLength="2"
inputWidth="100%"
asyncChange
/> -->
<input type="number" v-model="form.sell_price" placeholder="输入实收价" /> <input type="number" v-model="form.sell_price" placeholder="输入实收价" />
</u-form-item> </u-form-item>
<u-form-item prop="order_status" label="收费情况" :required="true" :borderBottom="true"> <u-form-item prop="order_status" label="收费情况" :required="true" :borderBottom="true">
@ -81,7 +63,7 @@
</u-form-item> </u-form-item>
<u-form-item prop="notify_at" label="通知时间" :borderBottom="true" @click="toggleDatePicker('notify_at', 'date')"> <u-form-item prop="notify_at" label="通知时间" :borderBottom="true" @click="toggleDatePicker('notify_at', 'date')">
<view class="input-text"> <view class="input-text">
<text v-if="form.notify_at">{{ form.notify_at | date }}</text> <text v-if="form.notify_at">{{ form.notify_at | date('yyyy-MM-dd') }}</text>
<text v-else class="input-placeholder">请选择通知时间</text> <text v-else class="input-placeholder">请选择通知时间</text>
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
@ -314,7 +296,7 @@ export default {
.input-text { .input-text {
color: #303133; color: #303133;
font-size: 15px; font-size: 15px;
padding: 6px 9px; padding: 6px 0;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -326,10 +308,7 @@ export default {
width: 100%; width: 100%;
margin-top: 20px; margin-top: 20px;
} }
.u-number-box { .page ::v-deep .u-radio:not(:first) {
width: 100%;
}
.u-radio {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>

View File

@ -65,12 +65,7 @@ export default {
}, },
onLoad(e) { onLoad(e) {
this.patient_id = e.patient this.patient_id = e.patient
this.$ajax.get(`/admin-api/patient/${this.patient_id}`, { params: {_action: 'getData'}}).then(res => { this.init()
if (res.status == 0) {
this.patient = res.data
uni.setNavigationBarTitle({ title: this.patient.name })
}
})
}, },
onShow() { onShow() {
this.loadData(true) this.loadData(true)
@ -78,15 +73,20 @@ export default {
onPullDownRefresh() { onPullDownRefresh() {
this.loadData(true) this.loadData(true)
}, },
onReady() { methods: {
this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}}).then(res => { async init() {
let res
res = await this.$ajax.get(`/admin-api/patient/${this.patient_id}`, { params: {_action: 'getData'}})
if (res.status == 0) {
this.patient = res.data
uni.setNavigationBarTitle({ title: `${this.patient.name}-病历记录` })
}
res = await this.$ajax.get('/admin-api/category', { params: {_action: 'getData'}})
if (res.status == 0) { if (res.status == 0) {
this.typeList = res.data.items this.typeList = res.data.items
this.loadData()
} }
}) this.loadData(true)
}, },
methods: {
changeType(e) { changeType(e) {
this.typeIndex = e this.typeIndex = e
this.loadData(true) this.loadData(true)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB