followDetails.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. import {navigateToDesignatedConversation,setConversation} from "@/pages_im/util/imCommon";
  64. import IMSDK, {GroupJoinSource,GroupMemberRole,SessionType} from "openim-uniapp-polyfill";
  65. export default {
  66. data() {
  67. return {
  68. followId:null,
  69. follow:null,
  70. doctor:null,
  71. form:null,
  72. }
  73. },
  74. onLoad(options) {
  75. this.followId=options.followId;
  76. },
  77. onShow() {
  78. this.getFollowById();
  79. },
  80. methods: {
  81. toIM(){
  82. var that=this;
  83. var user = JSON.parse(uni.getStorageSync('userInfo'));
  84. var uid = 'U' + user.userId;
  85. var did='D' + this.follow.doctorId;
  86. var conversationID=`si_D${did}_U${user.userId}`;
  87. var ex={imType:2,orderId:this.follow.orderId,followId:this.follow.followId,type:"startFollow"}
  88. this.$store.commit("timStore/setType","startFollow");
  89. this.$store.commit("timStore/setOrderId",this.follow.orderId);
  90. this.$store.commit("timStore/setFollowId",this.follow.followId);
  91. this.$store.commit("timStore/setImType", 2);
  92. this.$store.commit("timStore/setConversationID", conversationID);
  93. navigateToDesignatedConversation(did,SessionType.Single,false).then((res) => {
  94. setConversation(conversationID,JSON.stringify(ex)).then(() => {
  95. console.log("qxj setConversation ex:"+JSON.stringify(ex));
  96. }).catch(() => {});
  97. }).catch(() => uni.$u.toast("操作失败") );
  98. },
  99. doFollow(){
  100. var that=this;
  101. uni.showModal({
  102. title:"提示",
  103. content:"确认提交吗吗?",
  104. showCancel:true,
  105. cancelText:'取消',
  106. confirmText:'确定',
  107. success:res=>{
  108. if(res.confirm){
  109. // 用户点击确定
  110. var data={
  111. followId:this.followId,
  112. formJson:JSON.stringify(this.form)
  113. }
  114. doFollow(data).then(
  115. res => {
  116. if(res.code==200){
  117. uni.showToast({
  118. icon:'success',
  119. title: "操作成功",
  120. });
  121. setTimeout(function() {
  122. uni.$emit('refreshFollowList');
  123. uni.navigateBack({
  124. delta: 1
  125. })
  126. }, 500);
  127. }else{
  128. uni.showToast({
  129. icon:'none',
  130. title: res.msg,
  131. });
  132. }
  133. },
  134. rej => {}
  135. );
  136. }else{
  137. // 否则点击了取消
  138. }
  139. }
  140. })
  141. },
  142. getFollowById(){
  143. var that=this;
  144. var data={followId:this.followId}
  145. getFollowById(data).then(
  146. res => {
  147. if(res.code==200){
  148. this.follow=res.follow;
  149. this.doctor=res.doctor;
  150. this.form=JSON.parse( this.follow.formJson);
  151. }
  152. },
  153. err => {
  154. }
  155. );
  156. },
  157. }
  158. }
  159. </script>
  160. <style lang="scss">
  161. page{
  162. background: #f6f6f6;
  163. }
  164. </style>
  165. <style scoped lang="scss">
  166. .content{
  167. position: relative;
  168. .cont-box{
  169. padding: 20rpx 20rpx 140rpx;
  170. .cont{
  171. padding: 20rpx;
  172. background-color: #fff;
  173. border-radius: 20upx;
  174. .doctor{
  175. display: flex;
  176. flex-direction: row;
  177. align-items: flex-start;
  178. justify-content: space-between;
  179. .left{
  180. display: flex;
  181. flex-direction: column;
  182. align-items: flex-start;
  183. justify-content: flex-start;
  184. .name{
  185. font-size: 28upx;
  186. font-family: PingFang SC;
  187. color: #9a9a9c;
  188. }
  189. .count{
  190. font-size: 28upx;
  191. font-family: PingFang SC;
  192. color: #9a9a9c;
  193. }
  194. }
  195. .right{
  196. font-size: 28upx;
  197. font-family: PingFang SC;
  198. color: #9a9a9c;
  199. }
  200. }
  201. .item-box{
  202. margin: 15rpx 0rpx;
  203. .item{
  204. .title{
  205. font-size: 28rpx;
  206. font-weight: bold;
  207. }
  208. .option{
  209. margin-left: 10rpx;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. .btn-box{
  217. z-index: 999;
  218. bottom: 0;
  219. width: 100%;
  220. position: fixed;
  221. height: 120upx;
  222. box-sizing: border-box;
  223. background: #FFFFFF;
  224. padding: 0 30upx;
  225. display: flex;
  226. align-items: center;
  227. justify-content: flex-end;
  228. .btn{
  229. width: 155upx;
  230. height: 64upx;
  231. line-height: 64upx;
  232. font-size: 26upx;
  233. font-family: PingFang SC;
  234. font-weight: 500;
  235. text-align: center;
  236. border-radius: 32upx;
  237. margin-left: 15upx;
  238. &.cancel{
  239. border: 1px solid #DDDDDD;
  240. color: #666666;
  241. }
  242. &.pay{
  243. background: #FF5030;
  244. color: #FFFFFF;
  245. }
  246. }
  247. }
  248. </style>