epidemic-pass.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <text class=" text-xl ">出入信息填写</text>
  5. <view class="name">
  6. <view >
  7. <text>*</text>
  8. <text>您的姓名</text>
  9. </view>
  10. <view class="input">
  11. <input disabled="" type="text" value="" v-model="member.name" placeholder="请输入您的姓名"/>
  12. </view>
  13. </view>
  14. <view class="cause">
  15. <view >
  16. <text >*</text>
  17. <text>出入原因</text>
  18. </view>
  19. <view class="input">
  20. <input type="text" value="" v-model="reason" placeholder="请填写出入小区的原因"/>
  21. </view>
  22. </view>
  23. <view class="radio1 flex justify-between" >
  24. <view >
  25. <text >*</text>
  26. <text style="line-height: 56rpx;">体温是否异常(高于37.3摄氏度属于异常)</text>
  27. </view>
  28. <view class="switch">
  29. <switch style="transform: scale(.9);" class='blue' @change="switch1Change" :checked="switch1Check" ></switch>
  30. </view>
  31. </view>
  32. <view class="radio1 flex justify-between" >
  33. <view >
  34. <text >*</text>
  35. <text style="line-height: 56rpx;">是否有咳嗽 / 乏力 / 呼吸困难 / 流鼻涕 / 腹泻等异常症状</text>
  36. </view>
  37. <view class="switch">
  38. <switch style="transform: scale(.9);" class='blue' @change="switch2Change" :checked="switch2Check" ></switch>
  39. </view>
  40. </view>
  41. </view>
  42. <view @click="goList" class=" text-center margin-top-30">
  43. <u-icon name="order" color="#0081ff"></u-icon>
  44. <text class="text-blue text-df padding-left-10" >登记记录</text>
  45. </view>
  46. <button style="border-radius: 0;" v-if="$isEmpty(userInfo)" open-type="getUserInfo" @getuserinfo="getUserInfo" class=" footer-fixed" >
  47. <view class="cu-btn flex text-lg bg-red-btn" style="padding: 46rpx 0;">
  48. 提交信息
  49. </view>
  50. </button>
  51. <view v-else @click="submit" class=" footer-fixed">
  52. <view class="cu-btn flex text-lg bg-red-btn" style="padding: 46rpx 0;">
  53. 提交信息
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. //出入小区
  63. residentialId:'',
  64. residplotName:'',
  65. member:{},
  66. //出入原因
  67. reason:'',
  68. //体温是否异常
  69. switch1Check:false,
  70. //是否咳嗽
  71. switch2Check:false,
  72. //获取用户信息
  73. userInfo:{},
  74. }
  75. },
  76. onLoad() {
  77. this.member=getApp().globalData.member
  78. this.residentialId=uni.getStorageSync("residentialId")
  79. this.plotName=uni.getStorageSync("plotName")
  80. if (this.$isEmpty(this.member)||this.$isEmpty(this.residentialId)) {
  81. uni.showModal({
  82. content:'系统异常',
  83. showCancel:false,
  84. success: (res) => {
  85. if (res.confirm) {
  86. uni.navigateBack({
  87. delta:1
  88. })
  89. }
  90. }
  91. })
  92. return
  93. }
  94. this.login()
  95. this.getRecordByCondition()
  96. },
  97. methods: {
  98. /**
  99. * 通过member和当天时间查询当天是否填写了防疫通行记录
  100. * 如果有记录,直接跳转到通行详情那去
  101. */
  102. getRecordByCondition(){
  103. let that=this
  104. var date=new Date()
  105. let createDate= date .toLocaleDateString().replace(RegExp("/", "g"), "-")+" "+"00:00:00"
  106. let params={
  107. memberId:this.member.id,
  108. createDate:createDate,
  109. residentialId:this.residentialId
  110. }
  111. console.log(params);
  112. let operation='pratique/getListByMemberId'
  113. getApp().globalData.postRequest(params,operation,function(res){
  114. if (!that.$isEmpty(res.data.list)) {
  115. getApp().globalData.pratiqueData=res.data.list[0]
  116. uni.reLaunch({
  117. url:"./detail"
  118. })
  119. }
  120. })
  121. },
  122. switch1Change(e){
  123. this.switch1Check=e.target.value
  124. },
  125. switch2Change(e){
  126. this.switch2Check=e.target.value
  127. },
  128. getUserInfo(e){
  129. if (this.$isEmpty(e.detail.userInfo)) {
  130. this.$u.toast('用户拒绝获取头像信息')
  131. return
  132. }
  133. this.userInfo=e.detail.userInfo
  134. uni.setStorage({
  135. key:"userInfo",
  136. data:this.userInfo
  137. })
  138. this.submit()
  139. },
  140. login(){
  141. let that=this
  142. uni.login({
  143. success: function () {
  144. uni.getUserInfo({
  145. success: function (res) {
  146. that.userInfo=res.userInfo
  147. uni.setStorage({
  148. key:"userInfo",
  149. data:that.userInfo
  150. })
  151. }
  152. });
  153. }
  154. });
  155. },
  156. submit(){
  157. let that=this
  158. if (this.$isEmpty(this.reason)) {
  159. this.$u.toast('请输入出入原因')
  160. return
  161. }
  162. let params={
  163. memberId:this.member.id,
  164. reason:this.reason,
  165. residentialId:this.residentialId,
  166. residentialName:this.plotName,
  167. temparetureException:0,
  168. symptomException:0
  169. }
  170. if (this.switch1Check) {
  171. params.temparetureException=1
  172. }
  173. if (this.switch2Check) {
  174. params.symptomException=1
  175. }
  176. let operation='pratique/addPratique'
  177. getApp().globalData.postRequest(params,operation,(res)=>{
  178. if (res.data.result_code==1) {
  179. getApp().globalData.pratiqueData=res.data.pratique
  180. uni.reLaunch({
  181. url:"./detail"
  182. })
  183. }
  184. })
  185. },
  186. goList(){
  187. uni.navigateTo({
  188. url:"/pages/tool-list/epidemic-pass/list"
  189. })
  190. }
  191. }
  192. }
  193. </script>
  194. <style lang="scss">
  195. .page{
  196. min-height: 100vh;
  197. background-color: #FFFFFF;
  198. }
  199. .content{
  200. padding: 40rpx;
  201. .name,.cause,.radio1,.radio2{
  202. padding-top: 40rpx;
  203. view:nth-child(1){
  204. display: flex;
  205. // *星号
  206. text:nth-child(1){
  207. font-weight: 800;
  208. font-size: 38rpx;
  209. color: #D43A39;
  210. padding-right: 10rpx;
  211. }
  212. //您的姓名
  213. text:nth-child(2){
  214. font-size: 30rpx;
  215. }
  216. }
  217. .input{
  218. padding: 20rpx 0 15rpx 25rpx;
  219. border-bottom: 1rpx solid #d6d6d6;
  220. }
  221. }
  222. switch{
  223. display: flex;
  224. }
  225. .radio1,.radio2{
  226. padding-bottom: 15rpx;
  227. border-bottom: 1rpx solid #d6d6d6;
  228. .switch{
  229. display: flex;
  230. justify-content: center;
  231. align-items: center;
  232. }
  233. }
  234. }
  235. </style>