surveySubmit.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. // console.log(this.surveyText);
  35. if (!this.surveyText) {
  36. uni.showToast({
  37. title: "调研需求不能为空",
  38. icon: "none",
  39. });
  40. return;
  41. }
  42. purchaserApi.purchaserSurveySubmit({ Content: this.surveyText }).then((res) => {
  43. if (res.Ret === 200) {
  44. uni.showToast({
  45. title: "提交成功,请等待销售与您联系",
  46. duration: 2000,
  47. icon: "none",
  48. });
  49. setTimeout(() => {
  50. uni.navigateBack();
  51. }, 2000);
  52. }
  53. });
  54. },
  55. },
  56. onLoad(option) {
  57. let id = option.Id || 0;
  58. this.url = `${leafletUrl}?Id=${id}#wechat_redirect`;
  59. console.log(this.url);
  60. },
  61. };
  62. </script>
  63. <style lang="scss" scoped>
  64. .survey-box {
  65. padding: 30rpx 20rpx;
  66. display: flex;
  67. flex-direction: column;
  68. align-items: center;
  69. background-color: $uni-color-new;
  70. .survey-box-content {
  71. width: 100%;
  72. padding: 20rpx 20rpx 80rpx;
  73. border-radius: 8rpx;
  74. background-color: #fff;
  75. }
  76. .survey-textArea {
  77. width: 100%;
  78. border: solid 1rpx #dcdfe6;
  79. border-radius: 8rpx;
  80. padding: 6rpx;
  81. box-sizing: border-box;
  82. margin-bottom: 40rpx;
  83. }
  84. .submit {
  85. width: 500rpx;
  86. height: 60rpx;
  87. background: $uni-color-new;
  88. color: white;
  89. display: flex;
  90. align-items: center;
  91. justify-content: center;
  92. margin: 0 auto;
  93. }
  94. }
  95. </style>