edit.vue 33 KB

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