doFollow.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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}}<text v-if="item.require" class="tip">(必填)</text></view>
  18. <view class="option">
  19. <u-radio-group
  20. v-if="item.type==1"
  21. v-model="item.answers"
  22. placement="column"
  23. >
  24. <u-radio
  25. :customStyle="{marginBottom: '8px'}"
  26. v-for="(option, subIndex) in item.options"
  27. :key="subIndex"
  28. :label="option"
  29. :name="option"
  30. >
  31. </u-radio>
  32. </u-radio-group>
  33. <u-checkbox-group
  34. v-if="item.type==2"
  35. v-model="item.answers"
  36. placement="column"
  37. >
  38. <u-checkbox
  39. :customStyle="{marginBottom: '8px'}"
  40. v-for="(option, subIndex) in item.options"
  41. :key="subIndex"
  42. :label="option"
  43. :name="option"
  44. >
  45. </u-checkbox>
  46. </u-checkbox-group>
  47. <u--textarea count maxlength="200" v-if="item.type==3" v-model="item.answers" placeholder="请输入内容" ></u--textarea>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="btn-box">
  54. <view class="sub-btn" @click="doFollow()">提交随访</view>
  55. </view>
  56. </view>
  57. </template>
  58. <script >
  59. import {getFollowById,doFollow} from '@/api/follow.js'
  60. export default {
  61. data() {
  62. return {
  63. followId:null,
  64. follow:null,
  65. doctor:null,
  66. form:null,
  67. }
  68. },
  69. onLoad(options) {
  70. this.followId=options.followId;
  71. },
  72. onShow() {
  73. this.getFollowById();
  74. },
  75. methods: {
  76. doFollow(){
  77. var that=this;
  78. uni.showModal({
  79. title:"提示",
  80. content:"确认提交吗吗?",
  81. showCancel:true,
  82. cancelText:'取消',
  83. confirmText:'确定',
  84. success:res=>{
  85. if(res.confirm){
  86. // 用户点击确定
  87. var data={
  88. followId:this.followId,
  89. formJson:JSON.stringify(this.form)
  90. }
  91. doFollow(data).then(
  92. res => {
  93. if(res.code==200){
  94. uni.showToast({
  95. icon:'success',
  96. title: "操作成功",
  97. });
  98. setTimeout(function() {
  99. uni.$emit('refreshFollowList');
  100. uni.navigateBack({
  101. delta: 1
  102. })
  103. }, 500);
  104. }else{
  105. uni.showToast({
  106. icon:'none',
  107. title: res.msg,
  108. });
  109. }
  110. },
  111. rej => {}
  112. );
  113. }else{
  114. // 否则点击了取消
  115. }
  116. }
  117. })
  118. },
  119. getFollowById(){
  120. var that=this;
  121. var data={followId:this.followId}
  122. getFollowById(data).then(
  123. res => {
  124. if(res.code==200){
  125. this.follow=res.follow;
  126. this.doctor=res.doctor;
  127. this.form=JSON.parse( this.follow.formJson);
  128. this.form.forEach(function(element) {
  129. if(element.type==3){
  130. element.answers=""
  131. }
  132. });
  133. }
  134. },
  135. err => {
  136. }
  137. );
  138. },
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. page{
  144. background: #f6f6f6;
  145. }
  146. </style>
  147. <style scoped lang="scss">
  148. .content{
  149. position: relative;
  150. .cont-box{
  151. padding: 20rpx 20rpx 180rpx;
  152. .cont{
  153. padding: 20rpx;
  154. background-color: #fff;
  155. border-radius: 20upx;
  156. .doctor{
  157. display: flex;
  158. flex-direction: row;
  159. align-items: flex-start;
  160. justify-content: space-between;
  161. .left{
  162. display: flex;
  163. flex-direction: column;
  164. align-items: flex-start;
  165. justify-content: flex-start;
  166. .name{
  167. font-size: 28upx;
  168. font-family: PingFang SC;
  169. color: #9a9a9c;
  170. }
  171. .count{
  172. font-size: 28upx;
  173. font-family: PingFang SC;
  174. color: #9a9a9c;
  175. }
  176. }
  177. .right{
  178. font-size: 28upx;
  179. font-family: PingFang SC;
  180. color: #9a9a9c;
  181. }
  182. }
  183. .item-box{
  184. margin: 15rpx 0rpx;
  185. .item{
  186. .title{
  187. font-size: 28rpx;
  188. font-weight: bold;
  189. color: #111;
  190. .tip{
  191. margin-left: 10rpx;
  192. font-size: 24rpx;
  193. color: #9a9a9c;
  194. }
  195. }
  196. .option{
  197. margin-left: 10rpx;
  198. }
  199. }
  200. }
  201. }
  202. }
  203. }
  204. .btn-box{
  205. height: 140upx;
  206. z-index: 9999;
  207. width: 100%;
  208. padding: 0rpx 30upx;
  209. position: fixed;
  210. bottom: 0;
  211. left: 0;
  212. box-sizing: border-box;
  213. background-color: #ffffff;
  214. display: flex;
  215. align-items: center;
  216. justify-content: center;
  217. .sub-btn{
  218. width: 100%;
  219. height: 88upx;
  220. line-height: 88upx;
  221. text-align: center;
  222. font-size: 30upx;
  223. font-family: PingFang SC;
  224. font-weight: bold;
  225. color: #FFFFFF;
  226. background: #C39A58;
  227. border-radius: 44upx;
  228. }
  229. }
  230. </style>