doFollow.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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(res => {
  92. if(res.code==200){
  93. uni.showToast({
  94. icon:'success',
  95. title: "操作成功",
  96. });
  97. setTimeout(function() {
  98. uni.$emit('refreshFollowList');
  99. uni.navigateBack({
  100. delta: 1
  101. })
  102. }, 500);
  103. }else{
  104. uni.showToast({
  105. icon:'none',
  106. title: res.msg
  107. });
  108. }
  109. },
  110. rej => {}
  111. );
  112. }else{
  113. // 否则点击了取消
  114. }
  115. }
  116. })
  117. },
  118. getFollowById(){
  119. var that=this;
  120. var data={followId:this.followId}
  121. getFollowById(data).then(
  122. res => {
  123. if(res.code==200){
  124. this.follow=res.follow;
  125. this.doctor=res.doctor;
  126. this.form=JSON.parse( this.follow.formJson);
  127. this.form.forEach(function(element) {
  128. if(element.type==3){
  129. element.answers=""
  130. }
  131. });
  132. }
  133. },
  134. err => {
  135. }
  136. );
  137. },
  138. }
  139. }
  140. </script>
  141. <style lang="scss">
  142. page{
  143. background: #f6f6f6;
  144. }
  145. </style>
  146. <style scoped lang="scss">
  147. .content{
  148. position: relative;
  149. .cont-box{
  150. padding: 20rpx 20rpx 180rpx;
  151. .cont{
  152. padding: 20rpx;
  153. background-color: #fff;
  154. border-radius: 20upx;
  155. .doctor{
  156. display: flex;
  157. flex-direction: row;
  158. align-items: flex-start;
  159. justify-content: space-between;
  160. .left{
  161. display: flex;
  162. flex-direction: column;
  163. align-items: flex-start;
  164. justify-content: flex-start;
  165. .name{
  166. font-size: 28upx;
  167. font-family: PingFang SC;
  168. color: #9a9a9c;
  169. }
  170. .count{
  171. font-size: 28upx;
  172. font-family: PingFang SC;
  173. color: #9a9a9c;
  174. }
  175. }
  176. .right{
  177. font-size: 28upx;
  178. font-family: PingFang SC;
  179. color: #9a9a9c;
  180. }
  181. }
  182. .item-box{
  183. margin: 15rpx 0rpx;
  184. .item{
  185. .title{
  186. font-size: 28rpx;
  187. font-weight: bold;
  188. color: #111;
  189. .tip{
  190. margin-left: 10rpx;
  191. font-size: 24rpx;
  192. color: #9a9a9c;
  193. }
  194. }
  195. .option{
  196. margin-left: 10rpx;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. }
  203. .btn-box{
  204. height: 140upx;
  205. z-index: 9999;
  206. width: 100%;
  207. padding: 0rpx 30upx;
  208. position: fixed;
  209. bottom: 0;
  210. left: 0;
  211. box-sizing: border-box;
  212. background-color: #ffffff;
  213. display: flex;
  214. align-items: center;
  215. justify-content: center;
  216. .sub-btn{
  217. width: 100%;
  218. height: 88upx;
  219. line-height: 88upx;
  220. text-align: center;
  221. font-size: 30upx;
  222. font-family: PingFang SC;
  223. font-weight: bold;
  224. color: #FFFFFF;
  225. background: #C39A58;
  226. border-radius: 44upx;
  227. }
  228. }
  229. </style>