exitwritoff.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view class="m-w partol ">
  3. <view class="logo-back">
  4. </view>
  5. <view class="title-font u-p-l-30 u-p-r-30">
  6. <scroll-view class="cell-item">
  7. <u-cell-group>
  8. <u-cell-item title="访客姓名" :arrow="false"
  9. :title-style="{fontSize:'28rpx',color:'#333333',fontWeight: 'bold'}">
  10. <view slot="right-icon" class="rig-font">{{menulist.username}}</view>
  11. </u-cell-item>
  12. <u-cell-item title="访客手机号" :arrow="false"
  13. :title-style="{fontSize:'28rpx',color:'#333333',fontWeight: 'bold'}">
  14. <view slot="right-icon" class="rig-font">{{menulist.userPhone}}</view>
  15. </u-cell-item>
  16. <u-cell-item title="访客公司" :arrow="false"
  17. :title-style="{fontSize:'28rpx',color:'#333333',fontWeight: 'bold'}">
  18. <view slot="right-icon" class="rig-font">{{menulist.company}}</view>
  19. </u-cell-item>
  20. <u-cell-item title="进入事由" :arrow="false"
  21. :title-style="{fontSize:'28rpx',color:'#333333',fontWeight: 'bold'}">
  22. <view slot="right-icon" class="rig-font">{{menulist.reason}}</view>
  23. </u-cell-item>
  24. </u-cell-group>
  25. <view class="u-m-l-30">
  26. <view class="valabel u-m-t-28 u-m-b-20">出厂备注</view>
  27. <view class="span-textra ">
  28. <textarea v-model="remark" style="width: 100%; height: 100%;"></textarea>
  29. </view>
  30. <view class="subscribe" @click="temporary">确定核销 </view>
  31. </view>
  32. </scroll-view>
  33. </view>
  34. <!-- 消息提示组件 -->
  35. <u-toast ref="exToast" />
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. visitorlast,
  41. visitorupdate,
  42. loginWeixin
  43. } from '@/api/index'
  44. export default {
  45. data() {
  46. return {
  47. menulist: null,
  48. textarea: "测试测试",
  49. remark: ""
  50. }
  51. },
  52. onLoad() {
  53. this.init()
  54. },
  55. methods: {
  56. //获取openid
  57. init() {
  58. let openid = uni.getStorageSync("openid");
  59. if (openid) {
  60. this.getRecord()
  61. } else {
  62. uni.login({
  63. provider: 'weixin',
  64. success: loginRes => {
  65. loginWeixin({
  66. code: loginRes.code
  67. })
  68. .then(({
  69. data,
  70. code,
  71. message
  72. }) => {
  73. if (code == 200) {
  74. uni.setStorageSync('openid', data)
  75. this.getRecord()
  76. } else {
  77. this.$refs.exToast.show({
  78. title: code == 200 ? '查询成功' : message,
  79. type: code == 200 ? "success" : "warning",
  80. })
  81. }
  82. })
  83. }
  84. });
  85. }
  86. },
  87. //获取登记记录
  88. getRecord() {
  89. let openid = uni.getStorageSync("openid");
  90. visitorlast(openid)
  91. .then(({
  92. code,
  93. data,
  94. message
  95. }) => {
  96. this.menulist = data
  97. this.$refs.exToast.show({
  98. title: code == 200 ? '查询成功' : message,
  99. type: code == 200 ? "success" : "warning",
  100. })
  101. })
  102. .catch((err) => {
  103. this.$refs.exToast.show({
  104. title: err,
  105. type: "error",
  106. })
  107. })
  108. },
  109. //核销按钮
  110. temporary() {
  111. visitorupdate({
  112. id: this.menulist.id,
  113. remark: this.remark
  114. })
  115. .then(({
  116. data,
  117. code,
  118. message
  119. }) => {
  120. this.$refs.exToast.show({
  121. title: code == 200 ? '核销成功' : message,
  122. type: code == 200 ? "success" : "info",
  123. })
  124. setTimeout(() => {
  125. uni.redirectTo({
  126. url: "/pages/onsitpection/home/index"
  127. })
  128. }, 2000)
  129. })
  130. .catch((err) => {
  131. this.$refs.exToast.show({
  132. title: err,
  133. type: "warning"
  134. })
  135. })
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss">
  141. .partol {
  142. height: 100vh;
  143. background: #f0f2f5;
  144. .subscribe {
  145. width: 650rpx;
  146. height: 90rpx;
  147. background: #4A8BFF;
  148. border-radius: 4rpx;
  149. font-size: 28rpx;
  150. text-align: center;
  151. line-height: 90rpx;
  152. font-family: Microsoft YaHei-3970(82674968);
  153. font-weight: bold;
  154. color: #FFFFFF;
  155. margin-top: 337rpx;
  156. }
  157. .logo-back {
  158. width: 751rpx;
  159. height: 350rpx;
  160. position: relative;
  161. &::after {
  162. content: '';
  163. width: 140%;
  164. height: 350rpx;
  165. position: absolute;
  166. left: -20%;
  167. top: 0;
  168. border-radius: 0 0 45% 45%;
  169. background: #4a8bff !important;
  170. }
  171. }
  172. .valabel {
  173. font-size: 28rpx;
  174. font-family: Microsoft YaHei-3970(82674968);
  175. font-weight: bold;
  176. color: #333333;
  177. }
  178. .span-textra {
  179. width: 650rpx;
  180. height: 160rpx;
  181. border: 1px solid #AAAAAA;
  182. border-radius: 4rpx;
  183. padding: 22rpx;
  184. textarea {
  185. width: 100%;
  186. height: 100%;
  187. color: #000000;
  188. }
  189. }
  190. .title-font {
  191. width: 100%;
  192. font-size: 28rpx;
  193. font-weight: 400;
  194. color: #FFFFFF;
  195. position: absolute;
  196. top: 75rpx;
  197. .cell-item {
  198. width: 690rpx;
  199. height: calc(100vh - 70rpx);
  200. background: #FFFFFF;
  201. border-radius: 20rpx 20rpx 0px 0px;
  202. padding: 1rpx;
  203. overflow-x: hidden;
  204. box-sizing: border-box;
  205. }
  206. .rig-font {
  207. font-size: 28rpx;
  208. font-family: Microsoft YaHei-3970(82674968);
  209. font-weight: 400;
  210. color: #808080;
  211. }
  212. }
  213. view {
  214. line-height: 1;
  215. }
  216. }
  217. </style>