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.
 
 
 

328 lines
7.6 KiB

  1. <template>
  2. <view class="cented-box">
  3. <view class="chented" style="margin-bottom: 26rpx;">
  4. <view class="title" style="border: none;">
  5. <view class="titletext">姓名</view>
  6. <view class="titletext2">
  7. <input maxlength="10" class="titletext-input" style="color: #333333;" v-model="parames.name"
  8. placeholder-class="titletext-input" placeholder-style="color:#B2B2B2;" type="text"
  9. placeholder="请输入客户姓名(必填)" />
  10. </view>
  11. <view class="titleimg">
  12. <!-- <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image> -->
  13. </view>
  14. </view>
  15. </view>
  16. <view class="chented">
  17. <view class="title">
  18. <view class="titletext">性别</view>
  19. <view class="titletext2 displayclick" style="display: flex;align-items: center;padding-left: 10rpx;">
  20. <view class="sexRadio" @click="changeSex(1)" :class="{active:parames.sex == 1}">男士</view>
  21. <view class="sexRadio" @click="changeSex(2)" :class="{active:parames.sex == 2}">女士</view>
  22. </view>
  23. </view>
  24. <view class="title">
  25. <view class="titletext">到访人数</view>
  26. <view class="titletext2" style="display: flex;align-items: center;justify-content: space-around;">
  27. <view class="num" v-for="i in 6" :key="i" :class="{active:parames.howMany == i+1}"
  28. @click="changeHowMany(i+1)">
  29. {{i + 1}}
  30. </view>
  31. </view>
  32. </view>
  33. <view class="title" @click="Buildingselection()">
  34. <view class="titletext">到访途径</view>
  35. <view class="titletext2"
  36. style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 110rpx;padding-left: 10rpx;">
  37. <!-- {{parames.sourceName||'请选择客户来源'}} -->
  38. <text v-if="parames.sourceName" style="color: #333333;">{{parames.sourceName}}</text>
  39. <text v-else>请选择客户来源</text>
  40. </view>
  41. <view class="titleimg">
  42. <image class="titleimg1" src="../../static/images/arrow.png" mode=""></image>
  43. </view>
  44. </view>
  45. <!-- <view class="title" style="border: none;" @click="Buildingselection()">
  46. <view class="titletext">咨询业务</view>
  47. <view class="titletext2"
  48. style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 110rpx;padding-left: 10rpx;">
  49. <text v-if="parames.sourceName" style="color: #333333;">{{parames.sourceName}}</text>
  50. <text v-else>请选择咨询业务</text>
  51. </view>
  52. <view class="titleimg">
  53. <image class="titleimg1" src="../../static/images/arrow.png" mode=""></image>
  54. </view>
  55. </view> -->
  56. </view>
  57. <button class="clive" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="verifyPass">提交2</button>
  58. <view class="clive" @click="save" v-else>提交1</view>
  59. <view v-if="Showhiddenunits">
  60. <u-select :mask-close-able="false" v-model="Showhiddenunits" mode="single-column" :list="list"
  61. @cancel="cancel" @confirm="confirm"></u-select>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. var app = getApp();
  67. var config = require("@/config");
  68. let domain = require("@/utils/domain")
  69. let WXBizDataCrypt = require("@/sdk/WXBizDataCrypt")
  70. export default {
  71. data() {
  72. return {
  73. Showhiddenunits: false,
  74. list: [{
  75. label: '自然到访',
  76. value: '自然到访'
  77. },
  78. {
  79. label: '渠道推荐',
  80. value: '渠道推荐'
  81. },
  82. ],
  83. parames: {
  84. name: '',
  85. sex: 1,
  86. sourceName: null,
  87. howMany: 1,
  88. agentId: null,
  89. projectId: '',
  90. phone:''
  91. },
  92. daitiReceptionobj: {},
  93. verifyPass:false,
  94. qrCodeUrl:''
  95. };
  96. },
  97. onShow() {
  98. this.parames.projectId = uni.getStorageSync('buildingID').id;
  99. },
  100. watch:{
  101. parames:{
  102. deep:true,
  103. handler(newV){
  104. if (newV.name.length == 0) {
  105. this.verifyPass = false;
  106. }else{
  107. this.verifyPass = true;
  108. }
  109. }
  110. }
  111. },
  112. methods: {
  113. save() {
  114. if (this.parames.name.length == 0) {
  115. uni.showToast({
  116. icon: "none",
  117. title: "姓名不能为空"
  118. })
  119. return;
  120. }
  121. },
  122. getPhoneNumber(e){
  123. this.qrCodeUrl = domain.baseUrl
  124. uni.login({
  125. success:(login_res)=> {
  126. if(e.detail.errMsg=="getPhoneNumber:ok"){
  127. let data = {
  128. code:login_res.code,
  129. }
  130. uni.request({
  131. url:this.qrCodeUrl + '/code/loginSessionKey',
  132. method:"GET",
  133. data,
  134. success:(SessionKey_res)=> {
  135. let pc = new WXBizDataCrypt('wx8f883dca5ecc5510',SessionKey_res.data.data.session_key);
  136. let data = pc.decryptData(e.detail.encryptedData,e.detail.iv)
  137. console.log(data)
  138. this.parames.phone = data.phoneNumber
  139. if(this.parames.phone!=null && this.parames.phone!=""){
  140. uni.request({
  141. url:this.qrCodeUrl + '/customer/add',
  142. method:"POST",
  143. data:this.parames,
  144. header: {
  145. 'content-type': 'application/json',
  146. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  147. },
  148. success: (addres) => {
  149. if(addres.data.code == 10000){
  150. uni.navigateTo({
  151. url:'/pages/mine/registerResult'
  152. })
  153. }
  154. }
  155. })
  156. }else{
  157. console.log("fail")
  158. uni.showToast({
  159. title: "获取手机号失败,重新提交",
  160. icon: "none"
  161. })
  162. }
  163. }
  164. })
  165. }else{
  166. return;
  167. }
  168. }
  169. })
  170. },
  171. changeSex(sex) {
  172. this.parames.sex = sex;
  173. },
  174. changeHowMany(num) {
  175. this.parames.howMany = num;
  176. },
  177. Buildingselection() {
  178. this.Showhiddenunits = true;
  179. },
  180. cancel() {
  181. this.Showhiddenunits = false;
  182. },
  183. confirm(e) {
  184. this.parames.sourceName = e[0].value;
  185. this.Showhiddenunits = false;
  186. },
  187. }
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. .sexRadio {
  192. color: #BFBFBF;
  193. border: 1rpx solid #BFBFBF;
  194. font-size: 24upx;
  195. width: 120rpx;
  196. height: 60rpx;
  197. text-align: center;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. &:last-child {
  202. margin-left: 20rpx;
  203. }
  204. &.active {
  205. background: #2B6FFF;
  206. color: #fff;
  207. border-color: #2B6FFF;
  208. }
  209. }
  210. .num {
  211. width: 50rpx;
  212. height: 50rpx;
  213. background: rgba(43, 110, 253, 0.1);
  214. color: #2B6EFD;
  215. font-size: 30rpx;
  216. display: flex;
  217. align-items: center;
  218. justify-content: center;
  219. &.active {
  220. background: #2B6EFD;
  221. color: #FFFFFF;
  222. }
  223. }
  224. .cented-box {
  225. background: #F8F8F8;
  226. width: 100%;
  227. height: 100vh;
  228. }
  229. .Pinspeak {
  230. width: 100%;
  231. height: 92rpx;
  232. border-bottom: 1rpx solid #E0E0E0;
  233. font-size: 32rpx;
  234. font-weight: bold;
  235. color: #333333;
  236. text-indent: 30rpx;
  237. line-height: 92rpx;
  238. background: #FFFFFF;
  239. margin-top: 20rpx;
  240. padding-left: 10rpx;
  241. }
  242. .chented {
  243. width: 100%;
  244. padding-left: 30rpx;
  245. padding-right: 30rpx;
  246. background-color: #FFFFFF;
  247. .title {
  248. width: 100%;
  249. height: 110rpx;
  250. border-bottom: 1rpx solid #E0E0E0;
  251. display: flex;
  252. align-items: center;
  253. .titletext {
  254. width: 21%;
  255. height: 110rpx;
  256. font-size: 30rpx;
  257. font-weight: 400;
  258. color: #333333;
  259. line-height: 110rpx;
  260. text-indent: 10rpx;
  261. }
  262. .titletext2 {
  263. width: 71%;
  264. height: 110rpx;
  265. }
  266. .titletext-input {
  267. width: 100%;
  268. height: 110rpx;
  269. font-size: 30rpx;
  270. font-weight: 400;
  271. color: #B2B2B2;
  272. line-height: 110rpx;
  273. padding-left: 10rpx;
  274. }
  275. .titleimg {
  276. width: 8%;
  277. text-align: right;
  278. .titleimg1 {
  279. width: 16rpx;
  280. height: 36rpx;
  281. }
  282. }
  283. }
  284. }
  285. .clive {
  286. position: absolute;
  287. bottom: 32rpx;
  288. left: 30rpx;
  289. right: 30rpx;
  290. width: 690rpx;
  291. height: 88rpx;
  292. background: #2671E2;
  293. text-align: center;
  294. line-height: 88rpx;
  295. color: #FFFFFF;
  296. border-radius: 8rpx;
  297. font-size: 32rpx;
  298. }
  299. </style>