myrecordedit.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="page">
  3. <view class="form">
  4. <u-form :model="form" ref="uForm">
  5. <u-form-item label-width="150" label="备注信息" prop="record_remark" required label-position="top">
  6. <u-input :placeholder="remarkTips" v-model="form.record_remark" type="textarea"></u-input>
  7. </u-form-item>
  8. </u-form>
  9. <u-gap height="60"></u-gap>
  10. <u-button type="primary" @click="submitHandle">提交</u-button>
  11. </view>
  12. <!-- 列表选择 -->
  13. <u-select mode="single-column" :list="propertySelectList" v-model="propertySelectShow"
  14. @confirm="propertySelectConfirm"></u-select>
  15. <!-- modal -->
  16. <!-- utoast -->
  17. <u-toast ref="uToast" />
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. form: {
  25. record_remark: null,
  26. },
  27. customer_id: null,
  28. rules: {
  29. record_remark: [{
  30. required: true,
  31. message: '备注不能为空',
  32. trigger: ['change']
  33. }, ]
  34. },
  35. remarkTips: '请输入:购房预算(总价/均价/面积段)~现居住区域~现居住产品/面积段~工作类型~购房需求/关注点~已经看过的房源情况',
  36. propertySelectShow: false,
  37. propertySelectList: [],
  38. };
  39. },
  40. onLoad(data) {
  41. this.customer_id = data.id
  42. },
  43. created() {},
  44. // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
  45. onReady() {
  46. this.$refs.uForm.setRules(this.rules);
  47. },
  48. methods: {
  49. // // 选择所属项目回调
  50. // propertySelectConfirm(e) {
  51. // e.map((val, index) => {
  52. // this.form.estate_id = val.value;
  53. // this.form.estate_name = val.label;
  54. // });
  55. // },
  56. submitHandle() {
  57. const that = this
  58. this.$refs.uForm.validate(valid => {
  59. if (valid) {
  60. // 验证成功
  61. let apiStr = 'apiprivaterecordadd'
  62. let params = {
  63. record_remark: that.form.record_remark,
  64. customer_id: this.customer_id
  65. }
  66. if (that.isEdit) {
  67. apiStr = 'apiprivaterecordedit'
  68. params.id = that.form.id
  69. }
  70. uni.api.cust[apiStr](params).then(res => {
  71. if (that.isEdit) {
  72. uni.$msgConfirm('编辑成功', () => {
  73. uni.reLaunch({
  74. url: '/pages/cust/my'
  75. })
  76. }, () => {
  77. uni.reLaunch({
  78. url: '/pages/cust/my'
  79. })
  80. })
  81. } else {
  82. uni.$msgConfirm('添加跟进记录成功,是否前往列表?', () => {
  83. uni.navigateBack()
  84. }, () => {
  85. this.form = {
  86. record_remark: null,
  87. }
  88. })
  89. }
  90. })
  91. } else {
  92. console.log('验证失败');
  93. }
  94. });
  95. },
  96. }
  97. };
  98. </script>
  99. <style lang="scss">
  100. .page {
  101. padding: 20rpx;
  102. background-color: #ffffff;
  103. }
  104. .form {
  105. border-radius: 10rpx;
  106. padding: 0 40rpx;
  107. }
  108. .popup-body {
  109. .tips-title {
  110. font-size: $u-p;
  111. margin-bottom: 20rpx;
  112. }
  113. .tips-content {
  114. font-size: $u-p2;
  115. color: $u-tips-color;
  116. margin-bottom: 60rpx;
  117. }
  118. }
  119. .id_card {
  120. color: #606266;
  121. width: 100%;
  122. height: 350rpx;
  123. display: flex;
  124. flex-direction: column;
  125. align-items: center;
  126. justify-content: center;
  127. background-color: #f4f5f6;
  128. font-size: $u-p2;
  129. }
  130. .footer {
  131. position: absolute;
  132. text-align: center;
  133. bottom: 40rpx;
  134. font-size: $u-p2;
  135. .agreement {
  136. color: $u-type-error;
  137. }
  138. }
  139. .slot-content {
  140. font-size: 28rpx;
  141. color: $u-content-color;
  142. padding: 20rpx;
  143. }
  144. </style>