优化
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import Toast from '@vant/weapp/toast/toast';
|
||||
import { API } from './../../../utils/network/api'
|
||||
import Dialog from '@vant/weapp/dialog/dialog';
|
||||
|
||||
const api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
@@ -138,11 +140,24 @@ Page({
|
||||
|
||||
let product_id = this.data.save_durg_product_id;
|
||||
this.delDrugBox(product_id);
|
||||
let save_durg_prescription_product_num = this.data.save_durg_prescription_product_num;
|
||||
|
||||
if(!save_durg_prescription_product_num || save_durg_prescription_product_num <0){
|
||||
Dialog.alert({
|
||||
message: '请输入药品数量',
|
||||
}).then(() => {
|
||||
this.setData({
|
||||
save_durg_prescription_product_num: ""
|
||||
})
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
let save_durg = {};
|
||||
save_durg.product_name = this.data.product_name;
|
||||
save_durg.product_id = this.data.save_durg_product_id;
|
||||
save_durg.prescription_product_num = this.data.save_durg_prescription_product_num;
|
||||
|
||||
save_durg.single_unit = this.data.save_durg_single_unit;
|
||||
save_durg.single_use = this.data.save_durg_single_use;
|
||||
save_durg.packaging_unit = this.data.save_durg_packaging_unit;
|
||||
@@ -394,6 +409,37 @@ Page({
|
||||
})
|
||||
})
|
||||
},
|
||||
get_save_durg_prescription_product_num(e){
|
||||
console.log("get_save_durg_prescription_product_num")
|
||||
let save_durg_prescription_product_num = e.detail
|
||||
console.log(typeof save_durg_prescription_product_num)
|
||||
save_durg_prescription_product_num = Number.parseInt(save_durg_prescription_product_num)
|
||||
console.log(save_durg_prescription_product_num)
|
||||
if(isNaN(save_durg_prescription_product_num)){
|
||||
Dialog.alert({
|
||||
message: '请输入正确数字',
|
||||
}).then(() => {
|
||||
this.setData({
|
||||
save_durg_prescription_product_num: ""
|
||||
})
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
if(save_durg_prescription_product_num > 5){
|
||||
Dialog.alert({
|
||||
message: '每个药品数量不允许添加超过5个',
|
||||
}).then(() => {
|
||||
this.setData({
|
||||
save_durg_prescription_product_num: ""
|
||||
})
|
||||
});
|
||||
return
|
||||
}
|
||||
this.setData({
|
||||
save_durg_prescription_product_num: save_durg_prescription_product_num
|
||||
})
|
||||
},
|
||||
putDoctorPrescription(){//修改处方
|
||||
let sub_disabled = this.data.sub_disabled;
|
||||
if(sub_disabled) return
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"van-search": "@vant/weapp/search/index",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"van-toast": "@vant/weapp/toast/index",
|
||||
"van-icon": "@vant/weapp/icon/index"
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index"
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,8 @@
|
||||
<van-field
|
||||
label="药品数量"
|
||||
type="number"
|
||||
model:value="{{save_durg_prescription_product_num}}"
|
||||
bind:input="get_save_durg_prescription_product_num"
|
||||
value="{{save_durg_prescription_product_num}}"
|
||||
input-align="left"
|
||||
placeholder="请输入数量"
|
||||
custom-style="font-size: 30rpx;"
|
||||
@@ -255,5 +256,6 @@
|
||||
<van-toast id="van-toast" />
|
||||
</view>
|
||||
<view style="height: 50rpx;">
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<van-dialog id="van-dialog" confirm-button-color="#3CC7C0"/>
|
||||
Reference in New Issue
Block a user