xiangqing.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. <template>
  2. <view style="width: 100%;height: 100%;background-color: #F6F6F6;">
  3. <!-- 表单弹窗 -->
  4. <u-popup v-model="formshow" mode="center" border-radius="14" :closeable="false">
  5. <view style="width: 75vw;height: 60vh">
  6. <view class="flex justify-center align-center" style="height: 20%;font-size: 32rpx;font-weight: 500;">填写意见单</view>
  7. <view style="height: 60%;padding: 0 40rpx;">
  8. <!-- 病症 -->
  9. <view class="flex align-center" style="padding-bottom: 20rpx;margin-bottom: 20rpx;border-bottom: 1rpx solid #999999;">
  10. <text style="margin-right: 20rpx;font-weight: 500;font-size: 28rpx;">病症:</text>
  11. <input placeholder="请填写病症名称" @input="bzblur"/>
  12. </view>
  13. <!-- 病因-->
  14. <view class="flex align-center" style="padding-bottom: 20rpx;margin-bottom: 20rpx;border-bottom: 1rpx solid #999999;">
  15. <text style="margin-right: 20rpx;font-weight: 500;font-size: 28rpx;">病因:</text>
  16. <input placeholder="请填写患病因素" @input="byblur"/>
  17. </view>
  18. <!-- 结论 -->
  19. <view>
  20. <view style="margin-bottom: 20rpx;font-weight: 500;font-size: 28rpx;">结论因素:</view>
  21. <u-input v-model="jl" type="textarea" :auto-height="true" placeholder="请填写病情情况、建议等"
  22. :clearable="false" height='139' :border="true" borderColor="#C0C0C0"/>
  23. </view>
  24. </view>
  25. <!-- 两个按钮 -->
  26. <view style="height: 20%;display: flex;justify-content: center;align-items: center">
  27. <view style="display:flex;justify-content: center;align-items: center;width: 50%;">
  28. <u-button shape="shape" size="medium" @click="formshow = false">取消</u-button>
  29. </view>
  30. <view style="display:flex;justify-content: center;align-items: center ;width: 50%;">
  31. <u-button shape="shape" size="medium" type="primary" @click="qr">确认</u-button>
  32. </view>
  33. </view>
  34. </view>
  35. </u-popup>
  36. <u-gap height="30" bg-color="#f6f6f6"></u-gap>
  37. <view style="padding: 20rpx 28rpx;background-color: #FFFFFF;">
  38. <!-- 头部 -->
  39. <view class="flex align-center" style="font-weight: bold;font-size: 30rpx;margin:30rpx 0;">
  40. <view style="width: 25%;">订单号:</view>
  41. <view style="width: 50%;">{{orderID}}</view>
  42. <view style="width: 25%;" class="flex justify-center">
  43. <view class="but" v-if="zl ==1 ">电话咨询</view>
  44. <view class="but" v-else-if="zl ==2 ">图文咨询</view>
  45. </view>
  46. </view>
  47. <!-- 线 -->
  48. <u-line color="#EFEFEF" />
  49. <!-- 中部内容 -->
  50. <view style="font-size: 26rpx;background-color: #FFFFFF;">
  51. <view class="nr">
  52. <view class="left">患者:</view>
  53. <view class="right">{{name}}</view>
  54. </view>
  55. <view class="nr">
  56. <view class="left">年龄:</view>
  57. <view class="right">{{age}}</view>
  58. </view>
  59. <view class="nr">
  60. <view class="left">身份证号:</view>
  61. <view class="right">{{ID}}</view>
  62. </view>
  63. <!-- 这里需要判断咨询类型 图文咨询:病情描述,图片 电话咨询:拨打时间 -->
  64. <view class="nr" v-if="zl == 1">
  65. <view class="left">拨打时间:</view>
  66. <view class="right">{{callTime}}</view>
  67. </view>
  68. <view class="nr" v-if="zl == 2">
  69. <view class="left">病情描述:</view>
  70. <view class="right">{{ms}}</view>
  71. </view>
  72. <view class="nr" v-if="zl ==2">
  73. <view class="left">图片:</view>
  74. <view class="right" v-for="(item,index) in potolList" :key="index" style="width: auto;">
  75. <image style="width: 124rpx;height: 124rpx;margin-right: 10rpx;" :src="item" @click="TanPreviewImage(item)"></image>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <u-gap height="30" bg-color="#f6f6f6"></u-gap>
  81. <!-- 客户资料 -->
  82. <view class="" style="background-color: #FFFFFF;padding: 10rpx 28rpx;">
  83. <view class="nr">
  84. <view class="left">下单时间:</view>
  85. <view class="right">{{placeTime}}</view>
  86. </view>
  87. <view class="nr">
  88. <view class="left">下单客户:</view>
  89. <view class="right">{{xiadankh}}</view>
  90. </view>
  91. <view class="nr">
  92. <view class="left">接单时间:</view>
  93. <view class="right">{{receivingTime}}</view>
  94. </view>
  95. <view class="nr">
  96. <view class="left">订单状态:</view>
  97. <view class="right" v-if="zt==1">未支付</view>
  98. <view class="right" v-else-if="zt==2">待接单</view>
  99. <view class="right" v-else-if="zt==3">进行中</view>
  100. <view class="right" v-else-if="zt==4">已完成</view>
  101. <view class="right" v-else>已取消</view>
  102. </view>
  103. </view>
  104. <!-- 上面都是相同的 电话咨询下面需要添加通话记录 且已经接单-->
  105. <view v-if="zl == 1&&!(zt==1)" style="margin-bottom: 100rpx;">
  106. <view class="" style="background-color: #FFFFFF;padding: 10rpx 28rpx;" v-for="item,index in callList " :key='index'>
  107. <view class="nr">
  108. <view class="left" style="font-weight: bold;">{{item.frequency}}</view>
  109. <view class="right"></view>
  110. </view>
  111. <view class="nr">
  112. <view class="left">拨打时间:</view>
  113. <view class="right">{{item.start}}</view>
  114. </view>
  115. <view class="nr">
  116. <view class="left">结束时间:</view>
  117. <view class="right">{{item.end}}</view>
  118. </view>
  119. <view class="nr">
  120. <view class="left">通话时长:</view>
  121. <view class="right">{{item.duration}}</view>
  122. </view>
  123. </view>
  124. </view>
  125. <u-gap height="30" bg-color="#f6f6f6"></u-gap>
  126. <!-- 底部按钮 -->
  127. <!-- 当订单状态为未接单 zt==1 -->
  128. <view class="bottomButton" v-if="zt == 2">
  129. <!-- 左边的首页按钮 -->
  130. <view style="width: 20%;" class="flex align-center justify-center">
  131. <u-icon name="home" size="50" @click="home"></u-icon>
  132. </view>
  133. <!-- 右边的其他按钮 -->
  134. <view style="width: 80%;" class="flex justify-end align-center">
  135. <view class="b">
  136. <u-button shape="circle" :custom-style="btStyle" :value="pageid" @click="queren">确认订单</u-button>
  137. </view>
  138. </view>
  139. </view>
  140. <!-- 当订单状态为 zt==1 -->
  141. <view class="bottomButton" v-else-if="zl == 2 && zt == 3">
  142. <!-- 左边的首页按钮 -->
  143. <view style="width: 20%;" class="flex align-center justify-center">
  144. <u-icon name="home" size="50" @click="home"></u-icon>
  145. </view>
  146. <!-- 右边的其他按钮 -->
  147. <view style="width: 80%;" class="flex justify-end align-center">
  148. <view class="b">
  149. <u-button shape="circle" :custom-style="bStyle" @click="huihu">发起会话</u-button>
  150. </view>
  151. <view class="b">
  152. <u-button shape="circle" :custom-style="btStyle" @click="formshow = true">完成订单</u-button>
  153. </view>
  154. </view>
  155. </view>
  156. <!-- 状态是进行中并且是电话咨询 -->
  157. <view class="bottomButton" v-else-if="zl == 1 && zt==3">
  158. <!-- 左边的首页按钮 -->
  159. <view style="width: 20%;" class="flex align-center justify-center">
  160. <u-icon name="home" size="50" @click="home"></u-icon>
  161. </view>
  162. <!-- 右边的其他按钮 -->
  163. <view style="width: 80%;" class="flex justify-end align-center">
  164. <view class="b">
  165. <u-button shape="circle" :custom-style="bStyle" @click="phone">拨打电话</u-button>
  166. </view>
  167. <view class="b">
  168. <u-button shape="circle" :custom-style="btStyle" @click="formshow = true">完成订单</u-button>
  169. </view>
  170. </view>
  171. </view>
  172. <view class="bottomButton" v-else-if="zt ==4">
  173. <!-- 左边的首页按钮 -->
  174. <view style="width: 20%;" class="flex align-center justify-center">
  175. <u-icon name="home" size="50" @click="home"></u-icon>
  176. </view>
  177. <!-- 右边的其他按钮 -->
  178. <view style="width: 80%;" class="flex justify-end align-center">
  179. <view class="b" v-if="zl == 2">
  180. <u-button shape="circle" :custom-style="bStyle" @click="huihua">会话记录</u-button>
  181. </view>
  182. <view class="b">
  183. <u-button shape="circle" :custom-style="btStyle" @click="ckyj">查看意见</u-button>
  184. </view>
  185. </view>
  186. </view>
  187. </view>
  188. </template>
  189. <script>
  190. import IMService from "../../common/goeasyimutil.js"
  191. export default {
  192. onLoad(options) {
  193. console.log('获取ID:', options.data);
  194. this.pageid = options.data
  195. this.getInfo(options.data);
  196. // 心跳三次
  197. var i = 0;
  198. while(i<3){
  199. console.log('我是i',i);
  200. if(typeof getApp().globalData.imService =='undefined'){
  201. let res = uni.getStorageSync('user');
  202. getApp().globalData.imService = new IMService();
  203. let loginResult = getApp().globalData.imService.login({
  204. uuid: res.data.flag,
  205. name: res.data.name,
  206. avatar: res.data.avatar
  207. });
  208. if (loginResult) {
  209. //连接IM
  210. getApp().globalData.imService.connectIM();
  211. }
  212. }else{
  213. break;
  214. }
  215. i++;
  216. }
  217. },
  218. mounted() {
  219. },
  220. data() {
  221. return {
  222. user_id:'',
  223. pageid: '',
  224. patient_id: '',
  225. /********************** 图文咨询,包括某些电话咨询 *********************/
  226. // 上部数据
  227. orderID: '', //订单号
  228. zl: 1, //种类 1电话咨询 2图文咨询
  229. //中部数据
  230. name: '', //名字
  231. age: '', //年龄
  232. ID: '', //身份证
  233. //病情描述
  234. ms: '',
  235. potolList:[],
  236. xphone:'',
  237. //下部数据
  238. placeTime: '', //下单时间
  239. receivingTime: '', //接单时间
  240. xiadankh: '', //下单客户
  241. zt: 1, // 状态
  242. // 1未接单
  243. // 2进行中 显示未会话
  244. // 3已完成
  245. // 4已取消
  246. //底部按钮样式
  247. /********************* 电话咨询必要数据 *****************************/
  248. callTime: '', //拨打时间
  249. callList: [],
  250. //下部按钮样式
  251. bStyle: {
  252. width: '100%',
  253. height: '100%',
  254. fontSize: '28rpx',
  255. },
  256. btStyle: {
  257. width: '100%',
  258. height: '100%',
  259. fontSize: '28rpx',
  260. color: '#0B73B9',
  261. backgroundColor: '#FFFFFF'
  262. },
  263. //表单
  264. formshow: false, //提交表单弹窗
  265. bz: '', //病症
  266. by: '', //病因
  267. jl: '', //结论
  268. info: "",
  269. placeholderStyle: "color:'#00ff00'"
  270. }
  271. },
  272. methods: {
  273. //图片预览
  274. TanPreviewImage(imageUrl){
  275. console.log(imageUrl) // http://192.168.100.251:8970/6_1597822634094.png
  276. var images = [];
  277. images.push(imageUrl);
  278. console.log(images) // ["http://192.168.100.251:8970/6_1597822634094.png"]
  279. uni.previewImage({ // 预览图片 图片路径必须是一个数组 => ["http://192.168.100.251:8970/6_1597822634094.png"]
  280. current:0,
  281. urls:images,
  282. longPressActions: { //长按保存图片到相册
  283. itemList: ['保存图片'],
  284. success: (data)=> {
  285. console.log(data);
  286. uni.saveImageToPhotosAlbum({ //保存图片到相册
  287. filePath: payUrl,
  288. success: function () {
  289. uni.showToast({icon:'success',title:'保存成功'})
  290. },
  291. fail: (err) => {
  292. uni.showToast({icon:'none',title:'保存失败,请重新尝试'})
  293. }
  294. });
  295. },
  296. fail: (err)=> {
  297. console.log(err.errMsg);
  298. }
  299. }
  300. });
  301. },
  302. //
  303. phone:async function(){
  304. let res = await this.$request.post("patient/callPhones",{'order_id':this.orderID,'user_id':this.user_id});
  305. if(res.status==0){
  306. let phone = res.data;
  307. // 去拨打电话即可
  308. uni.makePhoneCall({
  309. // 手机号
  310. phoneNumber: phone,
  311. // 成功回调
  312. success: (res) => {
  313. console.log('调用成功!')
  314. },
  315. // 失败回调
  316. fail: (res) => {
  317. uni.showModal({
  318. title:"拨打电话调用失败",
  319. })
  320. }
  321. });
  322. console.log(res);
  323. }else{
  324. uni.showToast({
  325. title:res.message,
  326. icon:'none',
  327. duration:3000
  328. })
  329. }
  330. },
  331. getInfo:async function(id){
  332. let res = await this.$request.post("patient/orderPatientDetail",{'patient_id':id});
  333. if(res.status==0){
  334. let list = res.data;
  335. this.info = res.data
  336. this.user_id = list.user_id
  337. this.orderID = list.order_sn;
  338. this.patient_id = list.patient_id;
  339. this.zl = list.product_type;
  340. this.name = list.name;
  341. this.age = list.numbirthday;
  342. this.ID = list.card_number;
  343. this.placeTime = list.created_at;
  344. this.xiadankh = list.nickname;
  345. this.receivingTime = list.receiving_time
  346. if (list.product_type == 2) {
  347. // 图文咨询:
  348. this.ms = list.symptoms;
  349. this.potolList = list.medical_imgs;
  350. this.potolList = this.potolList.split(",")
  351. for (let a = 0; a < this.potolList.length; a++) {
  352. this.potolList[a] = this.potolList[a].replace(/\"/g, "");
  353. this.potolList[a] = this.potolList[a].replace("[", "");
  354. this.potolList[a] = this.potolList[a].replace("]", "");
  355. }
  356. console.log("处理后图片数组",this.potolList)
  357. } else {
  358. this.callTime = list.one_call;
  359. this.callList = list.call_list;
  360. this.xphone = list.secret_no;
  361. }
  362. this.zt = list.order_status;
  363. }
  364. },
  365. // 确认订单
  366. queren: async function(e) {
  367. let that = this;
  368. let order_id = that.pageid
  369. let res = await that.$request.post('patient/putOrderPatient', {
  370. 'order_id': order_id
  371. });
  372. if (res.status == 0) {
  373. uni.showModal({
  374. title: "提示",
  375. content: "接单成功!",
  376. confirmText: "确定",
  377. showCancel: false,
  378. success() {
  379. that.getInfo(order_id)
  380. }
  381. })
  382. }
  383. that.zt = 2
  384. },
  385. //完成订单
  386. wancheng(e) {
  387. this.zt = 3
  388. },
  389. //发起会话
  390. huihu(e) {
  391. console.log("1111")
  392. console.log(this.info);
  393. uni.navigateTo({
  394. url: "../conversation/conversationWindow?patient=" + JSON.stringify(this.info) + "&type=1"
  395. })
  396. },
  397. huihua(e) {
  398. console.log("222")
  399. uni.navigateTo({
  400. url: "../conversation/conversationWindow?patient=" + JSON.stringify(this.info) + "&type=2"
  401. })
  402. },
  403. //查看意见
  404. ckyj(e) {
  405. uni.navigateTo({
  406. url: '/pages/opinion/opiniondetails?id=' + this.pageid + '&type=2'
  407. })
  408. },
  409. //首页
  410. home(e) {
  411. uni.switchTab({
  412. url: '/pages/index/index'
  413. })
  414. },
  415. //病症提交
  416. bzblur(e) {
  417. this.bz = e.detail.value
  418. },
  419. byblur(e) {
  420. this.by = e.detail.value
  421. },
  422. jlblur(e) {
  423. this.jl = e.detail.value
  424. },
  425. //意见单 确认
  426. qr: async function(e) {
  427. let that = this;
  428. let order_id = that.pageid
  429. if(that.bz!=''){
  430. if(that.by!=''){
  431. if(that.jl!=''){
  432. that.formshow = false
  433. let bingzheng=that.bz;
  434. let bingyin=that.by;
  435. let jianyi=that.jl;
  436. let datas = {'order_id':order_id,'symptoms':bingzheng,'pathogen':bingyin,'suggest':jianyi,'patient_id':that.patient_id};
  437. if(this.zl==1){
  438. datas['xphone'] = this.xphone;
  439. }
  440. let res = await that.$request.post('patient/orderPatientok',datas);
  441. if(res.status==0){
  442. uni.showToast({
  443. title: "操作成功",
  444. duration: 3000,
  445. success() {
  446. that.getInfo(order_id)
  447. }
  448. })
  449. this.zt= 4
  450. }else{
  451. uni.showToast({
  452. title: "操作失败",
  453. duration: 3000,
  454. success() {
  455. that.getInfo(order_id)
  456. }
  457. })
  458. }
  459. } else {
  460. uni.showToast({
  461. title: '请填写结论',
  462. icon: 'none'
  463. })
  464. }
  465. } else {
  466. uni.showToast({
  467. title: '请填写病因',
  468. icon: 'none'
  469. })
  470. }
  471. } else {
  472. uni.showToast({
  473. title: '请填写病症',
  474. icon: 'none'
  475. })
  476. }
  477. },
  478. //意见单 取消
  479. }
  480. };
  481. </script>
  482. <style lang="scss">
  483. page {
  484. background-color: #f6f6f6;
  485. }
  486. .but {
  487. padding: 16rpx 30rpx;
  488. border-radius: 20rpx;
  489. background-color: #eaeaea;
  490. height: 50rpx;
  491. color: b1b1b1;
  492. display: flex;
  493. justify-content: center;
  494. align-items: center;
  495. font-weight: 400;
  496. font-size: 28rpx;
  497. }
  498. .nr {
  499. margin: 28rpx 0;
  500. display: flex;
  501. .left {
  502. width: 25%;
  503. color: #666666;
  504. }
  505. .right {
  506. width: 75%;
  507. }
  508. }
  509. .bottomButton {
  510. position: fixed;
  511. bottom: 0;
  512. left: 0;
  513. width: 100%;
  514. height: 100rpx;
  515. display: flex;
  516. background-color: #FFFFFF;
  517. z-index: 1;
  518. .b {
  519. /*按钮样式*/
  520. margin-right: 30rpx;
  521. padding: 20rpx 0rpx;
  522. height: 100%;
  523. width: 150rpx;
  524. }
  525. }
  526. </style>