You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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