followDetails.vue 6.0 KB

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