Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

548 rindas
12 KiB

  1. <template>
  2. <view class="cented-box">
  3. <!-- 背景图 -->
  4. <image class="bg-img" src="@/static/images/screenCode/screen_bg.png" mode=""></image>
  5. <!-- 头部 -->
  6. <view class="header">
  7. <view class="lside">
  8. <text class="text top">访客入场</text>
  9. <text class="text">登记表</text>
  10. </view>
  11. <view class="rside">
  12. <image src="@/static/images/screenCode/screen_note.png" mode=""></image>
  13. </view>
  14. </view>
  15. <!-- 表单 -->
  16. <view class="container">
  17. <view class="chented">
  18. <view class="title">
  19. <view class="titletext">客户姓名</view>
  20. <view class="titletext2">
  21. <input maxlength="10" class="titletext-input" style="color: #333333;" v-model="parames.name"
  22. placeholder-class="titletext-input" placeholder-style="color:#B2B2B2;" type="text"
  23. placeholder="请输入客户姓名(必填)" />
  24. </view>
  25. <view class="titleimg"></view>
  26. </view>
  27. </view>
  28. <view class="chented">
  29. <view class="title">
  30. <view class="titletext">客户性别</view>
  31. <!-- <view class="titletext2 displayclick"
  32. style="display: flex;align-items: center;padding-left: 10rpx;">
  33. <view class="sexRadio" @click="changeSex(1)" :class="{active:parames.sex == 1}">男士</view>
  34. <view class="sexRadio" @click="changeSex(2)" :class="{active:parames.sex == 2}">女士</view>
  35. </view> -->
  36. <u-radio-group v-model="parames.sex">
  37. <view style="display: flex;align-items: center;">
  38. <u-radio :name="1" shape="circle">男士</u-radio>
  39. <u-radio :name="2" shape="circle">女士</u-radio>
  40. </view>
  41. </u-radio-group>
  42. </view>
  43. <view class="title">
  44. <view class="titletext">到访人数</view>
  45. <view class="titletext2" style="display: flex;align-items: center;justify-content: space-around;">
  46. <view class="num" v-for="i in 4" :key="i" :class="{active:parames.howMany == i+1}"
  47. @click="changeHowMany(i+1)">
  48. {{i + 1}}
  49. </view>
  50. </view>
  51. </view>
  52. <!-- <view class="title" @click="Buildingselection()">
  53. <view class="titletext">到访途径</view>
  54. <view class="titletext2"
  55. style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 110rpx;padding-left: 10rpx;">
  56. <text v-if="parames.sourceName" style="color: #333333;">{{parames.sourceName}}</text>
  57. <text v-else>请选择客户来源</text>
  58. </view>
  59. <view class="titleimg">
  60. <image class="titleimg1" src="../../static/images/arrow.png" mode=""></image>
  61. </view>
  62. </view> -->
  63. </view>
  64. <button class="clive" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
  65. v-if="verifyPass">提交</button>
  66. <view class="clive" @click="save" v-else>提交</view>
  67. <view class="dengji">
  68. <view class="d-lside">
  69. 入场登记
  70. </view>
  71. <view class="d-rside">
  72. <view class="top">
  73. <text class="t-time">{{$u.timeFormat(new Date(), 'hh:MM:ss')}}</text>
  74. <text class="date">{{$u.timeFormat(new Date(), 'yyyy/mm/dd')}}</text>
  75. </view>
  76. <view class="address" style="font-size: 36rpx;">{{pname}}</view>
  77. </view>
  78. </view>
  79. <view class="bottoms">
  80. <u-checkbox v-model="parames.checked">我已阅读并同意</u-checkbox>
  81. <text class="books" @click="openModel">《{{tit}}》</text>
  82. </view>
  83. </view>
  84. <u-modal v-model="modelShow" :title="tit" width="720rpx" :mask-close-able="true" :show-confirm-button="false">
  85. <view class="slot-content" style="padding:0 20rpx;">
  86. <u-icon class="close" @click="readOk" name="close-circle" color="#CCCCCC" size="60"></u-icon>
  87. <view class="cont">
  88. <rich-text :nodes="content"></rich-text>
  89. </view>
  90. </view>
  91. </u-modal>
  92. <view class="tips">
  93. 疫情防控 人人有责
  94. </view>
  95. <u-select :mask-close-able="false" v-model="Showhiddenunits" mode="single-column" :list="list" @cancel="cancel"
  96. @confirm="confirm"></u-select>
  97. </view>
  98. </template>
  99. <script>
  100. var app = getApp();
  101. var config = require("@/config");
  102. let domain = require("@/utils/domain")
  103. export default {
  104. data() {
  105. return {
  106. Showhiddenunits: false,
  107. list: [{
  108. label: '自然到访',
  109. value: '自然到访'
  110. },
  111. {
  112. label: '渠道推荐',
  113. value: '渠道推荐'
  114. },
  115. ],
  116. parames: {
  117. name: '',
  118. sex: 1,
  119. // sourceName: "自然到访",
  120. howMany: 1,
  121. projectId: '',
  122. phone: '',
  123. projectId: '',
  124. projectName: 'xxx',
  125. version:"",
  126. checked: true,
  127. },
  128. pname:"",
  129. daitiReceptionobj: {},
  130. verifyPass: false,
  131. qrCodeUrl: '',
  132. // 是否同意隐私协议
  133. content:"",
  134. modelShow:false,
  135. tit:"",
  136. };
  137. },
  138. onLoad(options) {
  139. console.log(options)
  140. const sceneStr = decodeURIComponent(options.scene);
  141. this.parames.projectId = sceneStr
  142. this.initFetch()
  143. },
  144. watch: {
  145. parames: {
  146. deep: true,
  147. handler(newV) {
  148. if(newV.checked){
  149. if(newV.name.length != 0){
  150. this.verifyPass = true;
  151. }else{
  152. this.verifyPass = false;
  153. }
  154. }else{
  155. this.verifyPass = false;
  156. }
  157. // if (newV.name.length == 0) {
  158. // this.verifyPass = false;
  159. // } else {
  160. // this.verifyPass = true;
  161. // }
  162. }
  163. }
  164. },
  165. methods: {
  166. initFetch(){
  167. let appid = uni.getAccountInfoSync().miniProgram.appId;
  168. uni.request({
  169. url: config.service.privacyAgr,
  170. method: "GET",
  171. data:{
  172. id:appid,
  173. projectId:this.parames.projectId
  174. },
  175. header: {
  176. 'content-type': 'application/json',
  177. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  178. },
  179. success: (res) => {
  180. this.content = res.data.data.content
  181. this.tit = res.data.data.title
  182. this.parames.version = res.data.data.version
  183. this.pname = res.data.data.projectName
  184. }
  185. })
  186. },
  187. openModel(){
  188. this.modelShow = true;
  189. },
  190. readOk(){
  191. this.parames.checked = true;
  192. this.modelShow = false;
  193. },
  194. save() {
  195. if(this.parames.checked == false){
  196. uni.showToast({
  197. icon: "none",
  198. title: "请阅读并同意用户隐私协议"
  199. })
  200. return;
  201. }else{
  202. if (this.parames.name.length == 0) {
  203. uni.showToast({
  204. icon: "none",
  205. title: "姓名不能为空"
  206. })
  207. return;
  208. }
  209. }
  210. },
  211. getPhoneNumber(e) {
  212. this.qrCodeUrl = domain.baseUrl
  213. if (e.detail.errMsg == "getPhoneNumber:ok") {
  214. let data = {
  215. code: e.detail.code,
  216. appid: uni.getAccountInfoSync().miniProgram.appId,
  217. }
  218. uni.request({
  219. url: this.qrCodeUrl + '/code/loginSessionKey',
  220. method: "GET",
  221. data,
  222. success: (res) => {
  223. console.log(res.data.data)
  224. let phoneNum = JSON.parse(res.data.data).phone_info.phoneNumber
  225. this.parames.phone = phoneNum
  226. if (this.parames.phone != null && this.parames.phone != "") {
  227. if (this.parames.name.length > 8) {
  228. uni.showToast({
  229. icon: "none",
  230. title: "不能超过8个汉字"
  231. })
  232. } else {
  233. uni.request({
  234. url: this.qrCodeUrl + '/customer/codeAdd',
  235. method: "POST",
  236. data: this.parames,
  237. header: {
  238. 'content-type': 'application/json',
  239. 'Access-Token': uni.getStorageSync(
  240. 'weapp_session_login_data').token
  241. },
  242. success: (addres) => {
  243. if (addres.data.code == 10000) {
  244. uni.reLaunch({
  245. url: '/pages/mine/registerResult'
  246. })
  247. } else {
  248. uni.showToast({
  249. icon: "none",
  250. title: addres.data.message
  251. })
  252. }
  253. }
  254. })
  255. }
  256. }
  257. }
  258. })
  259. } else {
  260. return;
  261. }
  262. },
  263. changeSex(sex) {
  264. this.parames.sex = sex;
  265. },
  266. changeHowMany(num) {
  267. this.parames.howMany = num;
  268. },
  269. Buildingselection() {
  270. this.Showhiddenunits = true;
  271. },
  272. cancel() {
  273. this.Showhiddenunits = false;
  274. },
  275. confirm(e) {
  276. this.parames.sourceName = e[0].value;
  277. this.Showhiddenunits = false;
  278. },
  279. }
  280. };
  281. </script>
  282. <style lang="scss" scoped>
  283. /deep/ .u-model-title{
  284. padding-top: 0 !important;
  285. }
  286. .slot-content{
  287. position: relative;
  288. .close{
  289. position: absolute;
  290. top: 0;
  291. right: 0;
  292. }
  293. .cont{
  294. padding: 80rpx 0;
  295. }
  296. }
  297. .cented-box {
  298. position: relative;
  299. padding: 0 0 50rpx 0;
  300. width: 100vw;
  301. min-height: calc(100vh - var(--window-top));
  302. display: flex;
  303. flex-direction: column;
  304. .bg-img {
  305. width: 100%;
  306. height: 100%;
  307. z-index: -1;
  308. position: absolute;
  309. }
  310. .header {
  311. margin: 0 0 40rpx 0;
  312. width: 100%;
  313. display: flex;
  314. .lside {
  315. flex: 1;
  316. display: flex;
  317. flex-direction: column;
  318. justify-content: center;
  319. align-items: center;
  320. .text {
  321. color: #fff;
  322. font-size: 100rpx;
  323. font-weight: 800;
  324. }
  325. .top {
  326. font-size: 76rpx;
  327. }
  328. }
  329. .rside {
  330. flex: 1;
  331. display: flex;
  332. justify-content: center;
  333. align-items: center;
  334. image {
  335. width: 306rpx;
  336. height: 302rpx;
  337. }
  338. }
  339. }
  340. .container {
  341. position: relative;
  342. margin: 0 auto;
  343. width: 670rpx;
  344. height: 900rpx;
  345. background: #fff;
  346. border-radius: 16rpx;
  347. .chented {
  348. padding: 0 30rpx;
  349. width: 100%;
  350. .title {
  351. width: 100%;
  352. height: 110rpx;
  353. border-bottom: 1rpx solid #E0E0E0;
  354. display: flex;
  355. align-items: center;
  356. .titletext {
  357. width: 21%;
  358. font-size: 30rpx;
  359. font-weight: 400;
  360. color: #333333;
  361. }
  362. .titletext2 {
  363. width: 71%;
  364. }
  365. .titletext-input {
  366. width: 100%;
  367. height: 110rpx;
  368. font-size: 30rpx;
  369. font-weight: 400;
  370. color: #B2B2B2;
  371. line-height: 110rpx;
  372. padding-left: 10rpx;
  373. }
  374. .titleimg {
  375. width: 8%;
  376. text-align: right;
  377. .titleimg1 {
  378. width: 16rpx;
  379. height: 36rpx;
  380. }
  381. }
  382. }
  383. }
  384. .clive {
  385. margin: 100rpx auto 0;
  386. width: 610rpx;
  387. height: 88rpx;
  388. background: #2671E2;
  389. text-align: center;
  390. line-height: 88rpx;
  391. color: #FFFFFF;
  392. border-radius: 8rpx;
  393. font-size: 32rpx;
  394. }
  395. .dengji {
  396. margin: 60rpx 0 0 0;
  397. padding: 0 30rpx;
  398. width: 100%;
  399. display: flex;
  400. .d-lside {
  401. padding: 0 20rpx;
  402. height: 88rpx;
  403. display: flex;
  404. align-items: center;
  405. border-right: 1rpx solid #E0E0E0;
  406. font-size: 36rpx;
  407. font-weight: 500;
  408. }
  409. .d-rside {
  410. padding: 0 20rpx;
  411. height: 88rpx;
  412. display: flex;
  413. flex-direction: column;
  414. .top {
  415. display: flex;
  416. align-items: baseline;
  417. font-size: 24rpx;
  418. color: #333330;
  419. .t-time {
  420. margin-right: 20rpx;
  421. font-size: 36rpx;
  422. font-weight: 500;
  423. color: #333331;
  424. }
  425. }
  426. }
  427. }
  428. .bottoms {
  429. position: absolute;
  430. bottom: 30rpx;
  431. padding: 0 30rpx;
  432. width: 100%;
  433. .books {
  434. margin-left: -24rpx;
  435. color: #2671E2;
  436. font-size: 30rpx;
  437. }
  438. }
  439. }
  440. .tips {
  441. margin: 40rpx 0 0 0;
  442. width: 100%;
  443. text-align: center;
  444. color: #fff;
  445. font-size: 30rpx;
  446. }
  447. }
  448. .sexRadio {
  449. color: #BFBFBF;
  450. border: 1rpx solid #BFBFBF;
  451. font-size: 24upx;
  452. width: 120rpx;
  453. height: 60rpx;
  454. text-align: center;
  455. display: flex;
  456. align-items: center;
  457. justify-content: center;
  458. &:last-child {
  459. margin-left: 20rpx;
  460. }
  461. &.active {
  462. background: #2B6FFF;
  463. color: #fff;
  464. border-color: #2B6FFF;
  465. }
  466. }
  467. .num {
  468. width: 74rpx;
  469. height: 74rpx;
  470. border-radius: 8rpx;
  471. background: rgba(43, 110, 253, 0.1);
  472. color: #2B6EFD;
  473. font-size: 32rpx;
  474. display: flex;
  475. align-items: center;
  476. justify-content: center;
  477. &.active {
  478. background: #2B6EFD;
  479. color: #FFFFFF;
  480. }
  481. }
  482. .Pinspeak {
  483. width: 100%;
  484. height: 92rpx;
  485. border-bottom: 1rpx solid #E0E0E0;
  486. font-size: 32rpx;
  487. font-weight: bold;
  488. color: #333333;
  489. text-indent: 30rpx;
  490. line-height: 92rpx;
  491. background: #FFFFFF;
  492. margin-top: 20rpx;
  493. padding-left: 10rpx;
  494. }
  495. </style>