edit.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. <template>
  2. <view class="main">
  3. <uni-nav-bar dark :fixed="true" background-color="#18C7B0" status-bar left-icon="left" height="62.5rpx" width="750rpx"
  4. title="调配详情" @clickLeft="handleBack"
  5. />
  6. <view class="content">
  7. <view class="header">
  8. <view class="ti">
  9. <view class="left">
  10. <view class="baracode">
  11. <w-barcode :options="preseObj"></w-barcode>
  12. <view class="barnum">{{v.preNo}}</view>
  13. </view>
  14. </view>
  15. <view class="mid">
  16. <text class="title">中药处方笺</text>
  17. </view>
  18. <view class="rig"><text class="title">{{v.type=='1'?"中药处方":v.type=='1'?"中药制剂":""}}</text></view>
  19. </view>
  20. <view class="patiinfo">
  21. <view class="r1">
  22. <view class="row"><span class="we">姓名:</span>{{v.name}}</view>
  23. <view class="row"><span class="we">性别:</span>{{v.sex}}</view>
  24. <view class="row"><span class="we">年龄:</span>{{v.age}}岁</view>
  25. <view class="row"><span class="we">电话:</span>{{v.contactNumber}}</view>
  26. <view class="row"><span class="we">当前处方状态:</span>{{v.state=="1"?"配药":v.state=="2"?"煎药":v.state=="3"?"发药":v.state=="4"?"配送":""}}</view>
  27. </view>
  28. <view class="r2">
  29. <view class="row"><span class="we">就诊科室:</span>{{v.department}}</view>
  30. <view class="row"><span class="we">临床诊断:</span>{{v.disName}}—{{v.symName}}</view>
  31. <view class="row"><span class="we">开方时间:</span>{{v.prescriptionTime}}</view>
  32. </view>
  33. <view class="r3"><span class="we">联系地址:</span>{{v.address}}</view>
  34. </view>
  35. </view>
  36. <view class="rp">
  37. <view class="title">
  38. <text class="text">Rp:</text>
  39. </view>
  40. <view class="lists">
  41. <view class="item" v-for="(x, i) in v.rp" :key="i">
  42. <view class="le tag-view" @click="handleGetRps(x)">
  43. <uni-tag :inverted="!selectRps.includes(x)" :text="x.matName+x.matDose+x.matUnitName" />
  44. </view>
  45. <view class="rig">
  46. <view class="up"> {{x.matUsageName}}</view>
  47. <view class="do"> {{x.sign}}</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="footer">
  52. <view class="js">
  53. 剂数:{{v.number}}
  54. <view v-if="v.daijianCost!==''" class="pies_tips">
  55. (代煎)
  56. </view>
  57. </view>
  58. <view class="js">{{v.dosageForm}}</view>
  59. <view class="js">{{v.prescriptionUsage}}</view>
  60. <view class="js">每次{{v.concentration}}</view>
  61. <view class="js">{{v.frequency}}</view>
  62. <view class="freque">{{v.medicationTime}}</view>
  63. </view>
  64. <view class="rp-tips">{{v.entrust}}</view>
  65. </view>
  66. <view class="amountarea">
  67. <view class="amount">
  68. <view class="r1">
  69. <view class="pijw">药品金额:{{v.prescriptionSum}}</view>
  70. </view>
  71. <view class="r2">
  72. <view class="jyf">煎药费:{{v.daijianCost}}</view>
  73. <view class="psf">配送费:{{v.distributionCost}}</view>
  74. </view>
  75. <view class="r3">
  76. 总金额:{{v.prescriptionTotalSum}}
  77. <!-- <view class="zjw"></view> -->
  78. </view>
  79. </view>
  80. <view class="service">
  81. <view class="kf"><span class="we">开方:</span>{{v.operateList[0].operater || ''}}</view>
  82. <view class="kf"><span class="we">审核:</span>{{v.operateList[1].operater || ''}}</view>
  83. <view class="kf"><span class="we">调配:</span>{{v.operateList[2].operater || ''}}</view>
  84. <view class="kf"><span class="we">复核:</span>{{v.operateList[3].operater || ''}}</view>
  85. <view class="kf"><span class="we">浸泡:</span>{{v.operateList[4].operater || ''}}</view>
  86. <view class="kf"><span class="we">煎煮:</span>{{v.operateList[5].operater || ''}}</view>
  87. <view class="kf"><span class="we">打包:</span>{{v.operateList[6].operater || ''}}</view>
  88. <view class="kf"><span class="we">发药:</span>{{v.operateList[7].operater || ''}}</view>
  89. </view>
  90. </view>
  91. <view class="comment">
  92. <view class="z">注:</view>
  93. <text>{{v.entrust1111}}</text>
  94. </view>
  95. </view>
  96. <view class="upload">
  97. <view class="title">上传照片</view>
  98. <uni-file-picker
  99. :image-styles = "imageStyles"
  100. fileMediatype="image"
  101. mode="grid"
  102. :limit="3"
  103. :del-icon="false"
  104. :auto-upload="false"
  105. @select="selectUpload"
  106. />
  107. </view>
  108. <view class="cooment">
  109. <view class="title">备注内容</view>
  110. <view class="tex">
  111. <textarea placeholder="请输入备注内容" v-model="editForm.comments" placeholder-style="font-size: 15rpx;" height="60rpx" @input="bindTextInput" class="input" ></textarea>
  112. </view>
  113. </view>
  114. <view class="radio">
  115. <label for="">
  116. <switch :checked="isPrint" style="transform:scale(0.7)" @change="handleChange" /> 上传时直接打印标签
  117. </label>
  118. </view>
  119. <view class="submit">
  120. <button type="primary" class="bu" @click="handleSubmit">上传</button>
  121. </view>
  122. <view class="popup">
  123. <uni-popup ref="alertDialog" type="dialog">
  124. <uni-popup-dialog type="center" cancelText="不打印" confirmText="打印" title="打印标签" @confirm="dialogConfirm" @close="dialogClose">
  125. <view class="cotent" id="printMe">
  126. <view class="title">{{v.yljgName || '默默事中医院取药标签打印(门诊)'}}</view>
  127. <view class="body">
  128. <view class="lef">
  129. <view class="baracode">
  130. <w-barcode class="cav" :options="preseObj"></w-barcode>
  131. <view class="barnum">{{v.preNo}}</view>
  132. </view>
  133. </view>
  134. <view class="rig">
  135. <view class="hz">患者:<view class="bold">{{v.name}},{{v.sex}},{{v.age}}岁</view></view>
  136. <view class="hz">出生日期:<view class="bold">{{v.birth}}</view></view>
  137. </view>
  138. </view>
  139. </view>
  140. </uni-popup-dialog>
  141. </uni-popup>
  142. </view>
  143. <view class="popup">
  144. <uni-popup ref="printerDialog" type="dialog">
  145. <uni-popup-dialog type="center" cancelText="取消" confirmText="确认" title="设置打印机" @confirm="connectThenPrint" @close="cancelConfig">
  146. <view class="printconfig">
  147. <view style="font-size: 20rpx;">使用须知</view>
  148. <view style="font-size: 16rpx;color:brown;margin-bottom: 20rpx;">*使用前先连接wifi打印机</view>
  149. <uni-easyinput class="input" confirm-type="done" v-model="printInfo.ip" placeholder="请输入打印机ip地址" @confirm="connectThenPrint"></uni-easyinput>
  150. </view>
  151. </uni-popup-dialog>
  152. </uni-popup>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. export default {
  158. name: ''
  159. }
  160. </script>
  161. <script setup>
  162. import { onMounted, ref, getCurrentInstance } from 'vue'
  163. import { selectOrderDetail, upload, sendToUser, updateOrderStatus } from "@/static/js/request.js"
  164. import { saveDepoly, setIp } from '@/static/js/api.js'
  165. import debounce from 'lodash.debounce'
  166. import { onLoad } from '@dcloudio/uni-app'
  167. const printInfo = ref({
  168. ip: '',
  169. port: '9100',
  170. })
  171. const urlConfig = ref('http://zhongyao.fscuc.cn')
  172. // #ifdef APP-PLUS
  173. const plug= uni.requireNativePlugin('Html5app-Gprinter');
  174. // #endif
  175. const connectThenPrint = ()=>{
  176. const ipReg = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
  177. if(ipReg.test(printInfo.value.ip)){
  178. if(RegExp.$1<256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256){
  179. uni.$showMsg('打印机连接成功!', 500)
  180. plug.connectIP({"ip":printInfo.value.ip,"port":printInfo.value.port},ret=>{
  181. console.log('connectPrint>>ret',ret)
  182. const res = JSON.parse(JSON.stringify(ret))
  183. console.log('connectPrint>>res',res.code)
  184. if(res.code==3){
  185. // initPrint.value = true
  186. console.log('printInfo>>>', printInfo.value)
  187. uni.setStorageSync('hasPrinter', '1')
  188. uni.setStorageSync('printerIp', printInfo.value.ip)
  189. // _this.tip=JSON.stringify(ret);
  190. // console.log(_this.tip);
  191. // 关闭配置弹窗
  192. proxy.$refs.printerDialog.close()
  193. printerTsc()
  194. if(uni.getStorageSync('hasPrinter') == '1'){
  195. deploy()
  196. }
  197. } else{
  198. uni.$showMsg('打印机连接失败,请重试!', 500)
  199. }
  200. });
  201. } else{
  202. uni.$showMsg('ip地址有误,请重试!', 2000)
  203. }
  204. }
  205. }
  206. // const preseId = ref(11220822134401)
  207. const preseObj = ref({
  208. code: '',
  209. color:['#000'], // 条形码的颜色
  210. bgColor: '#FFFFFF', // 背景色
  211. width: 200, // 宽度
  212. height: 50 // 高度
  213. })
  214. const statusArr = ref([
  215. {name:'配药',id:'1'},
  216. {name:'煎药',id:'2'},
  217. {name:'发药',id:'3'},
  218. {name:'配送',id:'4'}
  219. ])
  220. const typeArr = ref([
  221. {name:'中药处方',id:'1'},
  222. {name:'中药制剂',id:'2'}
  223. ])
  224. const {proxy} = getCurrentInstance()
  225. const imageStyles =ref({
  226. width:112.5,
  227. height:112.5,
  228. border:{
  229. color:"#DDDDDD",
  230. width:1,
  231. style:'solid',
  232. radius:'4px'
  233. }
  234. })
  235. const depolyImage = ref([])
  236. const barOpations = ref({
  237. height: 80,
  238. displayValue: false
  239. })
  240. const selectRps = ref([])
  241. const isPrint = ref(true)
  242. const initPrint =ref(uni.getStorageSync('initPrint'))
  243. const photos = ref([])
  244. const v=ref({
  245. preNo:'11220822134401',
  246. presType:'普通处方',
  247. name:'李某',
  248. sex:'男',
  249. age:35,
  250. contactNumber:'13888888888',
  251. state: '发药',
  252. department:'中医内科',
  253. disName:'胃脘痛病',
  254. symName:'脾胃虚寒证',
  255. prescriptionTime:'2023-06-01 15:58',
  256. address:'浙江省某某事某某去某某事中医院门诊楼三楼302是',
  257. birth:'',
  258. rp:[
  259. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  260. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  261. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  262. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  263. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  264. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  265. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  266. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  267. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  268. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:''},
  269. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  270. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  271. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  272. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  273. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  274. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  275. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  276. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  277. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  278. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:''},
  279. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  280. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  281. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  282. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  283. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  284. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  285. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  286. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  287. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  288. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:''},
  289. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  290. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  291. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  292. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  293. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:'医生签名'},
  294. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'包煎',sign:'医生签名'},
  295. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  296. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  297. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'',sign:''},
  298. {matName:'车前子',matDose:'6',matUnitName:'g',tips:'先煎',sign:''}
  299. ],
  300. number:3,
  301. pies_tips:'待见',
  302. dosageForm:'汤剂',
  303. prescriptionUsage:'煎服',
  304. concentration:'200ml',
  305. frequency:'一日三次',
  306. medicationTime:'饭后服',
  307. entrust:'注意多休息,饮食清单。',
  308. prescriptionSum: '187.00',
  309. daijianCost:'30.00',
  310. distributionCost:'10.00',
  311. prescriptionTotleSum: '227.00',
  312. yljgName:'杭州某某高级中医院',
  313. operateList:[
  314. {py:'kf',title:'开方',operater:''},
  315. {py:'sh',title:'审核',operater:''},
  316. {py:'tp',title:'调配',operater:''},
  317. {py:'fh',title:'复核',operater:''},
  318. {py:'jp',title:'浸泡',operater:''},
  319. {py:'jz',title:'煎煮',operater:''},
  320. {py:'db',title:'打包',operater:''},
  321. {py:'fy',title:'发药',operater:''},
  322. ],
  323. // extra_doc:'A医生',
  324. // check_doc:'B医生',
  325. // depoly:'调陪人',
  326. // review:'复核人',
  327. // steep:'浸泡',
  328. // cook:'煎煮人',
  329. // pack:'大宝人',
  330. // dispen:'发药人',
  331. // },
  332. entrust1111:'1、本处方当日有效\n 2、取药时请您当面核对药品名称、规格、数量 \n 3、延长处方用量时间原因:慢性病 其他老年病 外地 其他'
  333. })
  334. const editForm =ref({
  335. urls:[],
  336. userId:uni.getStorageSync('userId'),
  337. comments:'',
  338. weight:'',
  339. coreId: ''
  340. })
  341. onMounted(() => {
  342. printInfo.value.ip = uni.getStorageSync('printerIp')
  343. })
  344. const handleRemove = (file, uploadFiles) => {
  345. console.log(file, uploadFiles)
  346. }
  347. const handlePreview = (uploadFile) => {
  348. console.log(uploadFile)
  349. }
  350. const bindTextInput = (e)=>{
  351. console.log(e.detail.value)
  352. }
  353. onLoad(async(options) => {
  354. console.log('options', options)
  355. const userId = uni.getStorageSync('userId')
  356. const params = {
  357. token: uni.getStorageSync('token'),
  358. data: {
  359. id: options.id || '',
  360. preNo: options.preId || '',
  361. depolyStatus: options.depolyStatus || ''
  362. }
  363. }
  364. console.log("params",params)
  365. const {data:res} = await selectOrderDetail(params)
  366. if (res.code === 200) {
  367. v.prescriptionTime = res.data.prescriptionTime,
  368. v.value.name = res.data.name,
  369. v.value.sex = res.data.sex,
  370. v.value.age = res.data.age,
  371. v.value.contactNumber = res.data.contactNumber
  372. v.value.address = res.data.address
  373. v.value.concentration = res.data.concentration
  374. v.value.frequency = res.data.frequency
  375. v.value.medicationTime = res.data.medicationTime
  376. editForm.value.coreId = v.value.id = res.data.id
  377. console.log('onLoad v.value.v.value.id', v.value.id)
  378. v.value.disName = res.data.disName,
  379. v.value.symName = res.data.symName,
  380. v.value.preNo = res.data.preNo,
  381. console.log('onLoad v.value.preNo', v.value.preNo)
  382. preseObj.value.code = v.value.preNo
  383. v.value.department = res.data.department,
  384. v.value.dosageForm = res.data.dosageForm,
  385. v.value.prescriptionUsage = res.data.prescriptionUsage,
  386. v.value.number = res.data.number,
  387. v.value.prescriptionSum = res.data.prescriptionSum,
  388. v.value.prescriptionTotalSum = res.data.prescriptionTotalSum,
  389. v.value.daijianCost = res.data.daijianCost,
  390. v.value.distributionCost = res.data.distributionCost,
  391. v.value.prescriptionTotleSum = res.data.prescriptionTotleSum,
  392. v.value.entrust = res.data.entrust
  393. v.value.rp = res.data.detailList
  394. v.value.yljgName = res.data.yljgName || ''
  395. v.value.birth = res.data.patientBirthday.substring(0,10) || ''
  396. v.value.state = res.data.state
  397. console.log('res.data.state',res.data.state)
  398. switch (res.data.state) {
  399. case '1':
  400. v.value.state = '配药'
  401. break
  402. case '2':
  403. v.value.state = '煎药'
  404. break
  405. case '3':
  406. v.value.state = '发药'
  407. break
  408. case '4':
  409. v.value.state = '配送'
  410. break
  411. case '5':
  412. v.value.state = '已分配'
  413. break
  414. case '6':
  415. v.value.state = '已传送'
  416. break
  417. default:
  418. v.value.state = '配药'
  419. }
  420. v.value.operateList[0].operater = res.data.doctor || ''
  421. v.value.operateList[1].operater = res.data.checkBy || ''
  422. v.value.operateList[2].operater = res.data.tiaopeiName || ''
  423. // 循环operateList
  424. const length = res.data.operateList
  425. if(length > 0){
  426. res.data.operateList.forEach((item)=>{
  427. switch(item.type){
  428. case '2':
  429. v.value.operateList[3].operater = item.createBy
  430. break
  431. case '3':
  432. v.value.operateList[4].operater = item.createBy
  433. break
  434. case '4':
  435. v.value.operateList[5].operater = item.createBy
  436. break
  437. case '5':
  438. v.value.operateList[6].operater = item.createBy
  439. break
  440. case '6':
  441. v.value.operateList[7].operater = item.createBy
  442. break
  443. defalut:console.log('处方签res.data.operateList数据异常',item.type)
  444. }
  445. })
  446. }
  447. }
  448. })
  449. const handleGetRps = (v)=>{
  450. console.log('handleGetRps', v)
  451. if(!selectRps.value.includes(v)) {
  452. selectRps.value.push(v)
  453. } else {
  454. selectRps.value.splice(selectRps.value.indexOf(v), 1)
  455. }
  456. }
  457. const handleChange = ()=>{
  458. isPrint.value = !isPrint.value
  459. console.log('handleChange', isPrint.value)
  460. }
  461. const handleBack =()=>{
  462. uni.navigateBack({
  463. delta: 1
  464. })
  465. }
  466. const cancelConfig = () => {
  467. console.log('不配置打印ip')
  468. proxy.$refs.printerDialog.close()
  469. }
  470. const handleSubmit = debounce(async()=>{
  471. console.log('handleSubmit>>>',editForm.value)
  472. console.log('isPrint.value>>', isPrint.value)
  473. if(isPrint.value){
  474. // 直接调用接口,然后打印
  475. // print("#printMe")
  476. // 打印成功后调用/userPrescription/sendToUser
  477. // if(uni.getStorageSync('initPrint')==true){
  478. // // APP-PLUS
  479. // const ret = printerTsc()
  480. // console.log('ret',ret)
  481. // // APP-PLUS
  482. // } else {
  483. // uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
  484. // return
  485. // }
  486. // todo 判断打印机是否连接成功,hasPrinter=='1'连接成功则开始打印,否则弹窗配置打印机,配置成功打印机后关闭弹窗直接打印
  487. if(uni.getStorageSync('hasPrinter') == '1'){
  488. printerTsc()
  489. const tmp = await deploy()
  490. uni.redirectTo({
  491. url:"/pages/index/index"
  492. })
  493. } else {
  494. // todo 判断打印机是否连接成功,hasPrinter空值则连接不成功,弹窗配置打印机,配置成功打印机后关闭弹窗直接打印
  495. proxy.$refs.printerDialog.open('center')
  496. }
  497. } else {
  498. // todo 打印预览弹窗显示
  499. console.log("cancelConfig proxy.$refs.alertDialog",proxy.$refs.alertDialog)
  500. proxy.$refs.alertDialog.open('center')
  501. }
  502. },500)
  503. const dialogConfirm = debounce(async()=>{
  504. console.log('dialogConfirm直接调用接口,然后打印')
  505. // if(uni.getStorageSync('initPrint')==true){
  506. // // #ifdef APP-PLUS
  507. // const ret = printerTsc()
  508. // console.log('ret',ret)
  509. // // #endif
  510. // } else {
  511. // uni.$showMsg('打印失败,打印机未连接,请先连接打印机', 2000)
  512. // }
  513. if(uni.getStorageSync('hasPrinter') == '1'){
  514. printerTsc()
  515. console.log("uni.getStorageSync('token')",uni.getStorageSync('token'))
  516. const ret1 = await deploy()
  517. uni.redirectTo({
  518. url:"/pages/index/index"
  519. })
  520. } else {
  521. // todo 判断打印机是否连接成功,hasPrinter空值则连接不成功,弹窗配置打印机,配置成功打印机后关闭弹窗直接打印
  522. proxy.$refs.alertDialog.close()
  523. proxy.$refs.printerDialog.open('center')
  524. }
  525. },500)
  526. const dialogClose = debounce(async()=>{
  527. console.log('dialogClose直接调用接口,不打印')
  528. const {data:res} = await saveDepoly({
  529. token: uni.getStorageSync('token'),
  530. data: JSON.stringify(editForm.value)
  531. })
  532. if(res.code===200){
  533. console.log('depoly success>>>')
  534. }
  535. const res1 = await sendToUser({
  536. token: uni.getStorageSync('token'),
  537. data: JSON.stringify({id:uni.getStorageSync('userId')})
  538. })
  539. const ret = await updateOrderStatus({
  540. token: uni.getStorageSync('token'),
  541. data: {
  542. id:v.value.id,
  543. status:'1',
  544. }
  545. })
  546. uni.redirectTo({
  547. url:"/pages/index/index"
  548. })
  549. },500)
  550. const deploy = async() => {
  551. const {data:res} = await saveDepoly({
  552. token: uni.getStorageSync('token'),
  553. data: JSON.stringify(editForm.value)
  554. })
  555. if(res.code===200){
  556. console.log('depoly success>>>')
  557. }
  558. const res1 = await sendToUser({
  559. token: uni.getStorageSync('token'),
  560. data: JSON.stringify({id:uni.getStorageSync('userId')})
  561. })
  562. const ret2 = await updateOrderStatus({
  563. token: uni.getStorageSync('token'),
  564. data: {
  565. id:v.value.id,
  566. status:'1',
  567. }
  568. })
  569. console.log('updateOrderStatus >>ret2',ret2)
  570. // 保存ip和端口
  571. console.log("保存ip和端口", uni.getStorageSync('userId'),printInfo.value.ip, printInfo.value.port)
  572. const res2 = await setIp({
  573. token: uni.getStorageSync('token'),
  574. data: JSON.stringify({userId:uni.getStorageSync('userId'),ip:printInfo.value.ip,port:printInfo.value.port})
  575. })
  576. if (res2.data.code !== 200){
  577. // uni.$showMsg('保存ip和端口数据异常', 2000)
  578. console.log("保存ip和端口数据异常", res2)
  579. }
  580. uni.redirectTo({
  581. url:"/pages/index/index"
  582. })
  583. }
  584. const selectUpload = debounce((e)=>{
  585. uni.showLoading({
  586. title: "上传中"
  587. });
  588. const tempFilePaths = e.tempFilePaths;
  589. for (var i = 0; i < tempFilePaths.length; i++) {
  590. const tempFile = e.tempFiles[i];
  591. uni.uploadFile({
  592. url: urlConfig.value + '/common/upload',
  593. header: {
  594. 'Authorization': 'Bearer '+uni.getStorageSync('token')
  595. },
  596. formData: {
  597. secretFlag: 'N',
  598. fileLocation: 5
  599. },
  600. filePath: tempFilePaths[i],
  601. name: 'file',
  602. success: (uploadFileRes) => {
  603. uni.hideLoading();
  604. console.log('upload success>>',uploadFileRes)
  605. const back = JSON.parse(uploadFileRes.data);
  606. console.log('upload success back >>',back)
  607. if (back.code == 200) {
  608. editForm.value.urls.push(back.url)
  609. }
  610. },
  611. fail: () => {
  612. uni.hideLoading();
  613. uni.showToast("上传失败,请联系开发!")
  614. },
  615. complete: function() {
  616. uni.hideLoading();
  617. }
  618. });
  619. }
  620. },500)
  621. const printerTsc = ()=>{
  622. //制作标签格式,
  623. let data=[]; //定义一个数组
  624. let line={}; //每添加一个,代表一行字
  625. //设置标签纸大小
  626. line={};
  627. line.width=80; //mm
  628. line.height=50; //mm
  629. line.gap=2; //标签纸之间,间隙长度 mm
  630. line.page=1; //打印几份
  631. line.direction=0, //上下反面打印,0=>正方向,1=> 反方向
  632. data.push(line); //每添加一个,代表一行字
  633. let filePath=plus.io.convertLocalFileSystemURL("static/OpenSans-Bold.ttf")
  634. //添加文字
  635. line={};
  636. line.customText=v.value.yljgName;
  637. line.x=100;
  638. line.y=40;
  639. line.fontSize=20;
  640. line.fontPath='';
  641. data.push(line); //每添加一个,代表一行字
  642. //添加图片
  643. // var imgage=plus.io.convertLocalFileSystemURL("static/gprinter.png");
  644. // line={};
  645. // line.image=imgage;
  646. // line.x=20;
  647. // line.y=65;
  648. // line.width=80;
  649. // data.push(line);
  650. // //添加黑块
  651. // line={};
  652. // line.addBar={x:10,y:10,width:200,height:4};
  653. // data.push(line);
  654. // //添加方框
  655. // line={};
  656. // line.addBox={x:10,y:25,xend:180,yend:50,thickness:2};
  657. // data.push(line);
  658. // //添加二维码
  659. // line={};
  660. // line.qrcode="https://www.baidu.com/";
  661. // line.x=205; //横坐标
  662. // line.y=25; //纵坐标
  663. // line.width=3; //二维码大小,1-10 之间
  664. // line.rotation=0; // 角度:有四个值:0,90,180,270
  665. // data.push(line);
  666. //添加条型码
  667. line={};
  668. line.barcode=v.value.preNo;
  669. line.x=50; //横坐标
  670. line.y=150; //纵坐标
  671. line.type="CODE128"; //条型码类型
  672. line.height=80; //条型码高度
  673. line.readable=true; //是否显示文字在条型下方
  674. line.rotation=0; // 角度:有四个值:0,90,180,270
  675. data.push(line)
  676. //患者
  677. line={};
  678. line.text='患者:'+v.value.name+', '+v.value.sex+', '+v.value.age+'岁';
  679. line.x=300;
  680. line.y=180;
  681. line.fontSize=14;
  682. line.fontPath='';
  683. data.push(line); //每添加一个,代表一行字
  684. //出生
  685. line={};
  686. line.customText='出生日期:'+v.value.birth;
  687. line.x=300;
  688. line.y=240;
  689. line.fontSize=13;
  690. line.fontPath='';
  691. data.push(line); //每添加一个,代表一行字
  692. // let _this=this;
  693. // #ifdef APP-PLUS
  694. plug.printer({TSC:data}, (ret) => {
  695. const tip = JSON.stringify(ret);
  696. })
  697. // #endif
  698. }
  699. </script>
  700. <style lang="scss">
  701. .main {
  702. display: flex;
  703. flex-direction:column;
  704. justify-content:flex-start;
  705. width: 750rpx;
  706. :deep(.uni-nav-bar-text){
  707. font-size: 20px;
  708. }
  709. :deep(.uni-navbar-btn-text){
  710. font-size: 16px;
  711. }
  712. .content{
  713. margin: 5rpx;
  714. background-color: #fff;
  715. flex-direction:column;
  716. align-items: center;
  717. .header{
  718. display: flex;
  719. flex-direction:column;
  720. margin:16rpx 16rpx 0;
  721. .ti{
  722. display: flex;
  723. flex-direction:row;
  724. justify-content: space-between;
  725. margin-top: 15.22rpx;
  726. .left{
  727. align-items: flex-start;
  728. .baracode{
  729. display: flex;
  730. flex-direction:column;
  731. .barnum{
  732. font-size: 15rpx;
  733. display: flex;
  734. justify-content:center;
  735. align-items: center;
  736. letter-spacing: 0.3em;
  737. }
  738. }
  739. }
  740. .mid{
  741. display: flex;
  742. margin-right: 160rpx;
  743. .title{
  744. font-size: 23.75rpx;
  745. font-weight: 800;
  746. }
  747. }
  748. .rig{
  749. display: flex;
  750. .title{
  751. font-size: 16rpx;
  752. width: 40rpx;
  753. font-weight: 300;
  754. }
  755. }
  756. }
  757. .patiinfo{
  758. display: flex;
  759. flex-direction:column;
  760. margin-top: 25.2rpx;
  761. padding-bottom: 21.45rpx;
  762. border-bottom: 1px solid #979797;
  763. .r1{
  764. display: flex;
  765. flex-direction:row;
  766. margin-bottom:15rpx;
  767. .row{
  768. font-size: 15rpx;
  769. font-weight: 400;
  770. margin-right: 30rpx;
  771. }
  772. .we{
  773. color:#999999;
  774. }
  775. }
  776. .r2{
  777. display: flex;
  778. flex-direction:row;
  779. margin-bottom:15rpx;
  780. .row{
  781. font-size: 15rpx;
  782. font-weight: 400;
  783. margin-right: 30rpx;
  784. }
  785. .we{
  786. color:#999999;
  787. }
  788. }
  789. .r3{
  790. display: flex;
  791. flex-direction:row;
  792. font-size: 15rpx;
  793. .we{
  794. color:#999999;
  795. }
  796. }
  797. }
  798. }
  799. .rp{
  800. display: flex;
  801. flex-direction:column;
  802. margin:22.39rpx 17.36rpx 0;
  803. border-bottom: 1px solid #979797;
  804. .title{
  805. font-size: 22rpx;
  806. margin-bottom: 10rpx;
  807. }
  808. .lists{
  809. display: flex;
  810. flex-wrap: wrap;
  811. flex-direction: row;
  812. justify-content:flex-start;
  813. align-content:flex-start;
  814. margin-left:20rpx;
  815. height: 545rpx;
  816. .item{
  817. display: flex;
  818. justify-content:center;
  819. align-items: center;
  820. width: 161rpx;
  821. margin: 0 10rpx 20rpx 0;
  822. // position: relative;
  823. .le{
  824. display: flex;
  825. font-size: 12rpx;
  826. width: 100rpx;
  827. word-wrap: break-word;
  828. // z-index: 100;
  829. // position: absolute;
  830. }
  831. .tag-view:deep(.uni-tag){
  832. display: flex;
  833. justify-content:center;
  834. align-items: center;
  835. font-size: 15rpx;
  836. font-weight:500;
  837. width: 80rpx;
  838. padding: 6rpx 6rpx;
  839. }
  840. .rig{
  841. display: flex;
  842. flex-direction:column;
  843. margin-left: 5.31rpx;
  844. width: 200rpx;
  845. // z-index: 200;
  846. // position: absolute;
  847. left:120rpx;
  848. .up{
  849. margin-bottom:8rpx;
  850. font-size: 10rpx;
  851. height: 12.5rpx;
  852. }
  853. .do{
  854. font-size: 12rpx;
  855. height: 12.5rpx;
  856. }
  857. }
  858. }
  859. }
  860. .footer{
  861. margin: 0 10rpx 8rpx;
  862. display: flex;
  863. font-size: 15rpx;
  864. .js{
  865. display: flex;
  866. margin-right: 54.4rpx;
  867. .pies_tips{}
  868. }
  869. .freque{}
  870. }
  871. .rp-tips{
  872. display: flex;
  873. justify-content:flex-end;
  874. font-size: 15rpx;
  875. margin-right: 10rpx;
  876. }
  877. }
  878. .amountarea{
  879. display: flex;
  880. margin: 21.3rpx 19.38px 0;
  881. padding-bottom: 20.94rpx;
  882. border-bottom: 1px solid #979797;
  883. .amount{
  884. display: flex;
  885. flex-direction:column;
  886. .r1{
  887. border: 1px solid #979797;
  888. font-size: 15rpx;
  889. width: 287.5rpx;
  890. display: flex;
  891. justify-content:center;
  892. align-items: center;
  893. height: 33.75rpx;
  894. }
  895. .r2{
  896. display: flex;
  897. justify-content:center;
  898. align-items: center;
  899. font-size: 15rpx;
  900. height: 33.75rpx;
  901. width: 287.5rpx;
  902. border-left: 1px solid #979797;
  903. border-right: 1px solid #979797;
  904. .jyf{
  905. width: 143.93rpx;
  906. display: flex;
  907. justify-content:center;
  908. align-items: center;
  909. }
  910. .psf{
  911. border-left: 1px solid #979797;
  912. width: 143.93rpx;
  913. display: flex;
  914. justify-content:center;
  915. align-items: center;
  916. }
  917. }
  918. .r3{
  919. display: flex;
  920. justify-content:center;
  921. align-items: center;
  922. height: 33.75rpx;
  923. font-size: 15rpx;
  924. border: 1px solid #979797;
  925. }
  926. }
  927. .service{
  928. display: flex;
  929. flex-wrap: wrap;
  930. margin-left: 60rpx;
  931. .kf{
  932. font-size: 15rpx;
  933. margin-right: 60rpx;
  934. width:90rpx;
  935. .we{
  936. font-size: 15rpx;
  937. color:#999999;
  938. }
  939. }
  940. }
  941. }
  942. .comment{
  943. margin: 10rpx 16rpx 10rpx;
  944. font-size: 15rpx;
  945. display: flex;
  946. }
  947. }
  948. .upload{
  949. margin: 0 10rpx 10rpx;
  950. background-color: #fff;
  951. flex-direction:column;
  952. align-items: center;
  953. padding: 20rpx;
  954. .title{
  955. font-size: 15rpx;
  956. margin-bottom:20px;
  957. color: #333333;
  958. }
  959. // :deep(.file-picker__box){
  960. // width: 112.5rpx;
  961. // height: 112.5rpx;
  962. // .file-picker__box-content{
  963. // width: 112.5rpx;
  964. // height: 112.5rpx;
  965. // }
  966. // }
  967. }
  968. .cooment{
  969. margin: 0 10rpx;
  970. background-color: #fff;
  971. flex-direction:column;
  972. align-items: center;
  973. padding: 5rpx 10rpx;
  974. .title{
  975. font-size: 15rpx;
  976. margin-bottom:20rpx;
  977. }
  978. .tex{
  979. display: flex;
  980. justify-content:flex-start;
  981. align-items: center;
  982. margin-bottom:12.7rpx;
  983. border: 1px solid #979797;
  984. // height: 74.38rpx;
  985. border-radius: 5rpx;
  986. .input{
  987. // height: 74.38rpx;
  988. // font-size: 15rpx;
  989. padding: 10rpx;
  990. // border-radius: 5rpx;
  991. :deep(.uni-textarea-placeholder){
  992. font-size: 15rpx;
  993. }
  994. }
  995. }
  996. }
  997. .radio{
  998. display: flex;
  999. margin: 0 10rpx;
  1000. background-color: #fff;
  1001. // padding: 0 20px 100px;
  1002. flex-direction:column;
  1003. // align-items: center;
  1004. font-size: 15rpx!important;
  1005. :deep(.uni-switch-input.uni-switch-input-checked){
  1006. border-color: #18C7B0;
  1007. background-color: #18C7B0;
  1008. }
  1009. }
  1010. .submit{
  1011. display: flex;
  1012. margin-top: 33.23rpx;
  1013. background-color: #fff;
  1014. align-items: center;
  1015. width: 750rpx;
  1016. height: 62.5rpx;
  1017. .bu{
  1018. display: flex;
  1019. justify-content:center;
  1020. align-items: center;
  1021. height: 40rpx;
  1022. width: 671.25rpx;
  1023. font-size: 17.5rpx;
  1024. border-radius: 3.75rpx;
  1025. background-color: #18c7b0;
  1026. color:#fff;
  1027. }
  1028. }
  1029. :deep(.uni-popup-dialog){
  1030. width: 500rpx;
  1031. // height: 268.75rpx;
  1032. display: flex;
  1033. flex-direction: column;
  1034. background-color: #ffffff;
  1035. // justify-content:center;
  1036. // align-items: center;
  1037. .uni-dialog-title-text{
  1038. display: flex;
  1039. font-size: 20rpx;
  1040. // padding-top: 20px;
  1041. }
  1042. .uni-dialog-content{
  1043. display: flex;
  1044. margin: 10rpx 20rpx;
  1045. background-color: #fff;
  1046. box-shadow: 0 0 20rpx rgba(0, 0, 0, 0.15);
  1047. .cotent{
  1048. display: flex;
  1049. flex-direction: column;
  1050. width:400rpx;
  1051. height: 112.5rpx;
  1052. .title{
  1053. font-size: 17.5rpx;
  1054. font-weight: 500;
  1055. margin-bottom: 10rpx;
  1056. display: flex;
  1057. align-items: center;
  1058. justify-content:center;
  1059. }
  1060. .body{
  1061. display: flex;
  1062. // flex-direction: column;
  1063. justify-content:center;
  1064. .lef{
  1065. display: flex;
  1066. flex-direction: column;
  1067. width: 200rpx;
  1068. justify-content:center;
  1069. .baracode{
  1070. display: flex;
  1071. flex-direction:column;
  1072. width: 200rpx;
  1073. height: 54.38rpx;
  1074. .cav{
  1075. width:200rpx;
  1076. }
  1077. .barnum{
  1078. width:200rpx;
  1079. font-size: 10rpx;
  1080. display: flex;
  1081. color: #333333;
  1082. justify-content:center;
  1083. align-items: center;
  1084. letter-spacing: 0.7em;
  1085. }
  1086. }
  1087. }
  1088. .rig{
  1089. display: flex;
  1090. flex-direction: column;
  1091. width: 340px;
  1092. margin-left: 13.75rpx;
  1093. .hz{
  1094. display: flex;
  1095. margin-bottom: 10rpx;
  1096. font-size: 15rpx;
  1097. }
  1098. .bold{
  1099. font-weight: 500;
  1100. }
  1101. }
  1102. }
  1103. }
  1104. }
  1105. .uni-dialog-button-group{
  1106. display: flex;
  1107. font-size: 17.5rpx;
  1108. .uni-dialog-button{
  1109. display: flex;
  1110. .uni-dialog-button-text{
  1111. }
  1112. }
  1113. .uni-border-left{
  1114. .uni-dialog-button-text{
  1115. color: #18c7b0;
  1116. }
  1117. }
  1118. }
  1119. }
  1120. }
  1121. .printconfig{
  1122. background-color: #fff;
  1123. width: 500rpx;
  1124. height: 100rpx;
  1125. padding: 20rpx;
  1126. .initPrint{
  1127. .title{
  1128. font-size: 20rpx;
  1129. }
  1130. .tips{
  1131. font-size: 16rpx;
  1132. }
  1133. .input{
  1134. width: 300rpx;
  1135. }
  1136. }
  1137. }
  1138. </style>