join.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view class="page">
  3. <view class="scoped-header" v-if="curObj.estate_name">
  4. <view class="p1" style="color: #f00;font-weight: bold;">{{ curObj.estate_name || '' }} {{ curObj.remark || '' }}</view>
  5. <view class="p2" style="color: #f00;font-weight: bold;">截至时间:{{ curObj.end_at || '' }}</view>
  6. </view>
  7. <view class="form">
  8. <u-form :model="form" ref="uForm">
  9. <u-form-item label-width="150" label="抖音名" prop="info1" required>
  10. <u-input placeholder="请输入抖音名" v-model="form.info1" type="text"></u-input>
  11. </u-form-item>
  12. <u-form-item label-width="150" label="抖音账号" prop="info2" required>
  13. <u-input placeholder="请输入抖音账号" v-model="form.info2" type="text"></u-input>
  14. </u-form-item>
  15. <u-form-item label-width="150" label="姓名" prop="info3" required>
  16. <u-input placeholder="请输入姓名" v-model="form.info3" type="text"></u-input>
  17. </u-form-item>
  18. <u-form-item label-width="150" label="电话" prop="info4" required>
  19. <u-input placeholder="请输入电话" v-model="form.info4" type="number"></u-input>
  20. </u-form-item>
  21. <u-form-item label-width="150" label="微信号" prop="info5" required>
  22. <u-input placeholder="请输入微信号" v-model="form.info5" type="text"></u-input>
  23. </u-form-item>
  24. <u-form-item label-width="150" label="粉丝数量" prop="info6" required>
  25. <u-input placeholder="请输入粉丝数量" v-model="form.info6" type="text"></u-input>
  26. </u-form-item>
  27. <u-form-item label-width="150" label="获赞数量" prop="info6" required>
  28. <u-input placeholder="请输入获赞数量" v-model="form.info7" type="text"></u-input>
  29. </u-form-item>
  30. </u-form>
  31. <u-gap height="60"></u-gap>
  32. <u-button type="primary" @click="submitHandle">提交</u-button>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { arrToObj } from '@/utils'
  38. export default {
  39. data() {
  40. return {
  41. curId: '',
  42. curObj: {},
  43. form: {
  44. info1: null,
  45. info2: null,
  46. info3: null,
  47. info4: null,
  48. info5: null,
  49. },
  50. eIds: [],
  51. eArr: [],
  52. phoneBefore3: '',
  53. phoneAfter4: '',
  54. customer_id: null,
  55. submitButtonDisabled: true,
  56. rules: {
  57. info1: [
  58. {
  59. required: true,
  60. message: '抖音名不得为空',
  61. trigger: ['change', 'blur']
  62. },
  63. ],
  64. info2: [
  65. {
  66. required: true,
  67. message: '抖音账号不得为空',
  68. trigger: ['change', 'blur']
  69. },
  70. ],
  71. info3: [
  72. {
  73. required: true,
  74. message: '姓名不得为空',
  75. trigger: ['change', 'blur']
  76. },
  77. ],
  78. info4: [
  79. {
  80. required: true,
  81. message: '电话不得为空',
  82. trigger: ['change', 'blur']
  83. },
  84. ],
  85. info5: [
  86. {
  87. required: true,
  88. message: '微信号不得为空',
  89. trigger: ['change', 'blur']
  90. },
  91. ],
  92. info6: [
  93. {
  94. required: true,
  95. message: '粉丝数量不得为空',
  96. trigger: ['change', 'blur']
  97. },
  98. ],
  99. info7: [
  100. {
  101. required: true,
  102. message: '获赞数量不得为空',
  103. trigger: ['change', 'blur']
  104. },
  105. ],
  106. },
  107. propertySelectShow: false,
  108. propertySelectList: [],
  109. estateList: [],
  110. areaTypeObj: {},
  111. userInfo2: {},
  112. curEstateName: '',
  113. salerSelectShow: false,
  114. salerSelectList: [],
  115. submitModalShow: false,
  116. modalShow: false,
  117. modalContent: ''
  118. };
  119. },
  120. onLoad(data) {
  121. const curId = data.id
  122. this.curId = curId || ''
  123. uni.api.cust.apiactivityinfo({id: this.curId}).then(res => {
  124. this.curObj = res.activity || {}
  125. })
  126. },
  127. onShareAppMessage(options) {
  128. var shareObj = {
  129. title: `${this.curObj.estate_name}${this.curObj.remark}`,
  130. path: `/pages/agent/activity/join?id=${this.curId}`,
  131. success: function(res) {
  132. },
  133. complete: function(res) {
  134. console.log(res)
  135. },
  136. }
  137. return shareObj
  138. },
  139. onShareTimeline(options) {
  140. var shareObj = {
  141. title: `${this.curObj.estate_name}${this.curObj.remark}`,
  142. path: `/pages/agent/activity/join?id=${this.curId}`,
  143. success: function(res) {
  144. },
  145. complete: function(res) {
  146. console.log(res)
  147. },
  148. }
  149. return shareObj
  150. },
  151. created () {
  152. },
  153. // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
  154. onReady() {
  155. this.$refs.uForm.setRules(this.rules);
  156. },
  157. methods: {
  158. phoneHandle () {
  159. let p = this.form.phone
  160. p = p.replace(/ /g, '')
  161. this.form.phone = p
  162. this.form = {...this.form}
  163. },
  164. getEstateList () {
  165. uni.api.estate.apiestatelist({page_size: 100, report_open: 1, is_inner: 2, estate_name: this.curEstateName}).then(res => {
  166. let list = res.list || []
  167. this.estateList = [...list]
  168. })
  169. },
  170. listItemHandle (val) {
  171. let eIds = [...this.eIds]
  172. let eArr = [...this.eArr]
  173. let cIndex = eIds.indexOf(val.estate_id)
  174. if (cIndex > -1 ) {
  175. eIds.splice(cIndex,1)
  176. eArr.splice(cIndex,1)
  177. } else {
  178. eIds.push(val.estate_id)
  179. eArr.push(val)
  180. }
  181. this.eIds = [...eIds]
  182. this.eArr = [...eArr]
  183. },
  184. clearListHandle () {
  185. this.propertySelectShow = false
  186. this.eIds = []
  187. this.eArr = []
  188. this.form.estate_name = ''
  189. },
  190. saveListHandle () {
  191. let errMsg = ''
  192. let eNames = this.eArr.map(item => {
  193. if (item.phone_type == '2') {
  194. errMsg = item.estate_name
  195. }
  196. return item.estate_name
  197. })
  198. this.form.estate_name = eNames.join(',')
  199. if (this.eArr.length === 1 && this.eArr[0].phone_type == '2') {
  200. this.form.phone_type = '2'
  201. } else {
  202. this.form.phone_type = '1'
  203. }
  204. if (errMsg && this.eArr.length > 1) {
  205. uni.$msg(`${errMsg}是前三后四报备项目,请单独报备`)
  206. } else {
  207. this.propertySelectShow = false
  208. }
  209. },
  210. // // 选择所属项目回调
  211. // propertySelectConfirm(e) {
  212. // e.map((val, index) => {
  213. // this.form.estate_id = val.value;
  214. // this.form.estate_name = val.label;
  215. // });
  216. // },
  217. // openEstateList () {
  218. // uni.navigateTo({
  219. // url: `/pages/estate/list?eid=${this.form.estate_id}&ename=${this.form.estate_name}`
  220. // })
  221. // },
  222. submitHandle() {
  223. const that = this
  224. this.$refs.uForm.validate(valid => {
  225. if (valid) {
  226. // 验证成功
  227. let params = {
  228. activity_id: that.curId,
  229. info1: that.form.info1,
  230. info2: that.form.info2,
  231. info3: that.form.info3,
  232. info4: that.form.info4,
  233. info5: that.form.info5,
  234. info6: that.form.info6,
  235. info7: that.form.info7,
  236. }
  237. uni.api.cust.apiactivityenroll(params).then(res => {
  238. uni.$msgConfirm('报名成功', () => {
  239. uni.redirectTo({
  240. url: `/pages/index/index`
  241. })
  242. }, () => {
  243. uni.redirectTo({
  244. url: `/pages/index/index`
  245. })
  246. })
  247. })
  248. } else {
  249. console.log('验证失败');
  250. }
  251. });
  252. },
  253. // 获取手机号
  254. getPhoneNumber: function(e) {
  255. // 点击获取手机号码按钮
  256. let _that = this;
  257. if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
  258. _that.$refs.uToast.show({
  259. title: '您可以在个人设置中再次绑定',
  260. type: 'warning'
  261. });
  262. setTimeout(() => {
  263. _that.reLunchUser();
  264. }, 1500);
  265. return; // 即用户拒绝授权
  266. }
  267. console.log(e.detail.errMsg);
  268. console.log(e.detail.iv);
  269. console.log(e.detail.encryptedData);
  270. let iv = e.detail.iv;
  271. let encryptedData = e.detail.encryptedData;
  272. // 不是登陆完第一时间授权
  273. wx.login({
  274. success(res) {
  275. if (res.code) {
  276. // 设置用户手机号
  277. _that.setUserPhoneNumber(encryptedData, iv, res.code);
  278. } else {
  279. this.$refs.uToast.show({
  280. title: res.errMsg,
  281. type: 'warning'
  282. });
  283. console.log('登录失败!' + res.errMsg);
  284. }
  285. }
  286. });
  287. },
  288. // 以下是工具函数
  289. // 关闭键盘
  290. hideKeyboard() {
  291. uni.hideKeyboard();
  292. },
  293. // 格式化日期的月份或天数的显示(小于10,在前面增加0)
  294. getFormatDate(value) {
  295. if (value == undefined || value == '') {
  296. return '';
  297. }
  298. var str = value;
  299. if (parseInt(value) < 10) {
  300. str = '0' + value;
  301. }
  302. return str;
  303. }
  304. }
  305. };
  306. </script>
  307. <style lang="scss">
  308. .page {
  309. padding: 20rpx;
  310. background-color: #ffffff;
  311. }
  312. .form {
  313. border-radius: 10rpx;
  314. padding: 0 40rpx;
  315. }
  316. .popup-body {
  317. .tips-title {
  318. font-size: $u-p;
  319. margin-bottom: 20rpx;
  320. }
  321. .tips-content {
  322. font-size: $u-p2;
  323. color: $u-tips-color;
  324. margin-bottom: 60rpx;
  325. }
  326. }
  327. .id_card {
  328. color: #606266;
  329. width: 100%;
  330. height: 350rpx;
  331. display: flex;
  332. flex-direction: column;
  333. align-items: center;
  334. justify-content: center;
  335. background-color: #f4f5f6;
  336. font-size: $u-p2;
  337. }
  338. .footer {
  339. position: absolute;
  340. text-align: center;
  341. bottom: 40rpx;
  342. font-size: $u-p2;
  343. .agreement {
  344. color: $u-type-error;
  345. }
  346. }
  347. .slot-content {
  348. font-size: 28rpx;
  349. color: $u-content-color;
  350. padding: 20rpx;
  351. }
  352. .scoped-estate-list {
  353. .sel-item {
  354. display: flex;
  355. border-bottom: 1PX solid #dcdcdc;
  356. padding: 20rpx;
  357. &.cur {
  358. background: #369af7;
  359. border-radius: 10rpx;
  360. overflow: hidden;
  361. .img {
  362. opacity: .6;
  363. }
  364. .p1 {
  365. color: #fff;
  366. }
  367. .p3 {
  368. color: #fff;
  369. }
  370. }
  371. }
  372. .sel-left {
  373. width: 180rpx;
  374. border-radius: 10rpx;
  375. .img {
  376. width: 180rpx;
  377. height: 120rpx;
  378. border-radius: 10rpx;
  379. }
  380. }
  381. .sel-right {
  382. // width: 450rpx;
  383. margin-left: 20rpx;
  384. .p1 {
  385. font-size: 30rpx;
  386. font-weight: bold;
  387. margin-bottom: 10rpx;
  388. }
  389. .p2 {
  390. margin-bottom: 10rpx;
  391. }
  392. .p3 {
  393. color: #369af7;
  394. font-size: 24rpx;
  395. font-weight: bold;
  396. }
  397. }
  398. }
  399. .scoped-estate-popup {
  400. height: 100%;
  401. padding-bottom: 100rpx;
  402. .popup-body {
  403. box-sizing: border-box;
  404. border-bottom: 1PX solid #dcdcdc;
  405. }
  406. }
  407. .scoped-popup-header-input {
  408. position: fixed;
  409. width: 90%;
  410. display: flex;
  411. border-bottom: 1PX solid #dcdcdc;
  412. .input {
  413. flex: 1;
  414. padding-left: 20rpx;
  415. height: 80rpx;
  416. .u-input__input {
  417. height: 80rpx;
  418. }
  419. }
  420. .b {
  421. width: 200rpx;
  422. height: 80rpx;
  423. line-height: 80rpx;
  424. background: #2d8cf0;
  425. color: #fff;
  426. text-align: center;
  427. margin-left: 20rpx;
  428. }
  429. }
  430. </style>