followDetails.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view class="content">
  3. <u-alert fontSize="13" type = "info" description = "为了给您提供更好的服务,希望您能用几分钟时间,将您的感受和建议告诉我们,我们非常重视您的宝贵意见!"></u-alert>
  4. <view class="cont-box">
  5. <view class="cont">
  6. <view class="doctor">
  7. <view class="left">
  8. <view class="name" >发布医生:{{dortor!=null?doctor.doctorName:""}}</view>
  9. <view class="count" v-if="follow!=null">{{follow.num}}/{{follow.totalNum}}期</view>
  10. </view>
  11. <view class="right">
  12. {{follow.planTime}}
  13. </view>
  14. </view>
  15. <view class="item-box">
  16. <view class="item" v-for="(item,index) in form">
  17. <view class="title">{{item.question}}</view>
  18. <view class="option">
  19. <u-radio-group
  20. :disabled="true"
  21. v-if="item.type==1"
  22. v-model="item.answers"
  23. placement="column"
  24. >
  25. <u-radio
  26. :customStyle="{marginBottom: '8px'}"
  27. v-for="(option, subIndex) in item.options"
  28. :key="subIndex"
  29. :label="option"
  30. :name="option"
  31. >
  32. </u-radio>
  33. </u-radio-group>
  34. <u-checkbox-group
  35. :disabled="true"
  36. v-if="item.type==2"
  37. v-model="item.answers"
  38. placement="column"
  39. >
  40. <u-checkbox
  41. :customStyle="{marginBottom: '8px'}"
  42. v-for="(option, subIndex) in item.options"
  43. :key="subIndex"
  44. :label="option"
  45. :name="option"
  46. >
  47. </u-checkbox>
  48. </u-checkbox-group>
  49. <u--textarea :disabled="true" count maxlength="200" v-if="item.type==3" v-model="item.answers" placeholder="请输入内容" ></u--textarea>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="btn-box" >
  56. <view class="btn cancel" @click="toIM()" >咨询</view>
  57. </view>
  58. </view>
  59. </template>
  60. <script >
  61. import store from "@/store";
  62. import {getFollowById,doFollow} from '@/api/follow.js'
  63. export default {
  64. data() {
  65. return {
  66. followId:null,
  67. follow:null,
  68. doctor:null,
  69. form:null,
  70. }
  71. },
  72. onLoad(options) {
  73. this.followId=options.followId;
  74. },
  75. onShow() {
  76. this.getFollowById();
  77. },
  78. methods: {
  79. toIM(){
  80. var that=this;
  81. var id="C2CD-"+this.follow.doctorId;
  82. console.log(uni.$TUIKit.TUIConversationServer)
  83. store.commit("timStore/setType","startFollow");
  84. store.commit("timStore/setOrderId",this.follow.orderId);
  85. store.commit("timStore/setFollowId",this.follow.followId);
  86. store.commit("timStore/setImType", 2);
  87. store.commit("timStore/setConversationID", id);
  88. //uni.$TUIKit.TUIChatServer.updateStore(conversationId)
  89. uni.$TUIKit.TUIConversationServer.setMessageRead(id);
  90. uni.$TUIKit.TUIConversationServer.getConversationProfile(id)
  91. .then((res) => {
  92. console.log(res)
  93. // uni.$TUIKit.TUIConversationServer.setConversationValue(id,that.orderId.toString())
  94. // .then((res) => {
  95. // console.log("更新order")
  96. // })
  97. // .catch((err) => {
  98. // });
  99. //通知 TUIChat 关闭当前会话
  100. const { conversation } = res.data;
  101. store.commit("timStore/setConversation", conversation);
  102. let url = "/pages/TUIKit/TUIPages/TUIChat/index";
  103. const { nick: name } = conversation.userProfile;
  104. url = `${url}?conversationName=${
  105. conversation.userProfile.nick?.nick ||
  106. conversation.userProfile.userID
  107. }`;
  108. uni.redirectTo({ url });
  109. })
  110. .catch((err) => {
  111. console.warn("获取 group profile 异常 = ", err);
  112. });
  113. },
  114. doFollow(){
  115. var that=this;
  116. uni.showModal({
  117. title:"提示",
  118. content:"确认提交吗吗?",
  119. showCancel:true,
  120. cancelText:'取消',
  121. confirmText:'确定',
  122. success:res=>{
  123. if(res.confirm){
  124. // 用户点击确定
  125. var data={
  126. followId:this.followId,
  127. formJson:JSON.stringify(this.form)
  128. }
  129. doFollow(data).then(
  130. res => {
  131. if(res.code==200){
  132. uni.showToast({
  133. icon:'success',
  134. title: "操作成功",
  135. });
  136. setTimeout(function() {
  137. uni.$emit('refreshFollowList');
  138. uni.navigateBack({
  139. delta: 1
  140. })
  141. }, 500);
  142. }else{
  143. uni.showToast({
  144. icon:'none',
  145. title: res.msg,
  146. });
  147. }
  148. },
  149. rej => {}
  150. );
  151. }else{
  152. // 否则点击了取消
  153. }
  154. }
  155. })
  156. },
  157. getFollowById(){
  158. var that=this;
  159. var data={followId:this.followId}
  160. getFollowById(data).then(
  161. res => {
  162. if(res.code==200){
  163. this.follow=res.follow;
  164. this.doctor=res.doctor;
  165. this.form=JSON.parse( this.follow.formJson);
  166. }
  167. },
  168. err => {
  169. }
  170. );
  171. },
  172. }
  173. }
  174. </script>
  175. <style lang="scss">
  176. page{
  177. background: #f6f6f6;
  178. }
  179. </style>
  180. <style scoped lang="scss">
  181. .content{
  182. position: relative;
  183. .cont-box{
  184. padding: 20rpx 20rpx 140rpx;
  185. .cont{
  186. padding: 20rpx;
  187. background-color: #fff;
  188. border-radius: 20upx;
  189. .doctor{
  190. display: flex;
  191. flex-direction: row;
  192. align-items: flex-start;
  193. justify-content: space-between;
  194. .left{
  195. display: flex;
  196. flex-direction: column;
  197. align-items: flex-start;
  198. justify-content: flex-start;
  199. .name{
  200. font-size: 28upx;
  201. font-family: PingFang SC;
  202. color: #9a9a9c;
  203. }
  204. .count{
  205. font-size: 28upx;
  206. font-family: PingFang SC;
  207. color: #9a9a9c;
  208. }
  209. }
  210. .right{
  211. font-size: 28upx;
  212. font-family: PingFang SC;
  213. color: #9a9a9c;
  214. }
  215. }
  216. .item-box{
  217. margin: 15rpx 0rpx;
  218. .item{
  219. .title{
  220. font-size: 28rpx;
  221. font-weight: bold;
  222. }
  223. .option{
  224. margin-left: 10rpx;
  225. }
  226. }
  227. }
  228. }
  229. }
  230. }
  231. .btn-box{
  232. z-index: 999;
  233. bottom: 0;
  234. width: 100%;
  235. position: fixed;
  236. height: 120upx;
  237. box-sizing: border-box;
  238. background: #FFFFFF;
  239. padding: 0 30upx;
  240. display: flex;
  241. align-items: center;
  242. justify-content: flex-end;
  243. .btn{
  244. width: 155upx;
  245. height: 64upx;
  246. line-height: 64upx;
  247. font-size: 26upx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. text-align: center;
  251. border-radius: 32upx;
  252. margin-left: 15upx;
  253. &.cancel{
  254. border: 1px solid #DDDDDD;
  255. color: #666666;
  256. }
  257. &.pay{
  258. background: #C39A58;
  259. color: #FFFFFF;
  260. }
  261. }
  262. }
  263. </style>