surveySubmit.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="container survey-box">
  3. <view class="survey-box-content">
  4. <view class="survey-textArea">
  5. <van-field
  6. :value="surveyText"
  7. type="textarea"
  8. :maxlength="100"
  9. placeholder="请详述您的调研需求"
  10. :border="false"
  11. :show-word-limit="true"
  12. :autosize="{ minHeight: 100 }"
  13. @change="inputChange($event)"
  14. ></van-field>
  15. </view>
  16. <view @click="submit" class="submit">提交</view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import { leafletUrl } from "@/config/config";
  22. import { purchaserApi } from "@/config/modules/purchaser.js";
  23. export default {
  24. data() {
  25. return {
  26. surveyText: "",
  27. };
  28. },
  29. methods: {
  30. inputChange(e) {
  31. this.surveyText = e.detail;
  32. },
  33. submit() {
  34. if (!this.surveyText) {
  35. uni.showToast({
  36. title: "调研需求不能为空",
  37. icon: "none",
  38. });
  39. return;
  40. }
  41. purchaserApi.purchaserSurveySubmit({ Content: this.surveyText }).then((res) => {
  42. if (res.Ret === 200) {
  43. uni.showToast({
  44. title: "提交成功,请等待销售与您联系",
  45. duration: 2000,
  46. icon: "none",
  47. });
  48. setTimeout(() => {
  49. uni.navigateBack();
  50. }, 2000);
  51. }
  52. });
  53. },
  54. },
  55. onLoad(option) {
  56. let id = option.Id || 0;
  57. this.url = `${leafletUrl}?Id=${id}#wechat_redirect`;
  58. },
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. .survey-box {
  63. padding: 30rpx 20rpx;
  64. display: flex;
  65. flex-direction: column;
  66. align-items: center;
  67. background-color: $uni-color-new;
  68. .survey-box-content {
  69. width: 100%;
  70. padding: 20rpx 20rpx 80rpx;
  71. border-radius: 8rpx;
  72. background-color: #fff;
  73. }
  74. .survey-textArea {
  75. width: 100%;
  76. border: solid 1rpx #dcdfe6;
  77. border-radius: 8rpx;
  78. padding: 6rpx;
  79. box-sizing: border-box;
  80. margin-bottom: 40rpx;
  81. }
  82. .submit {
  83. width: 500rpx;
  84. height: 60rpx;
  85. background: $uni-color-new;
  86. color: white;
  87. display: flex;
  88. align-items: center;
  89. justify-content: center;
  90. margin: 0 auto;
  91. }
  92. }
  93. </style>