up.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view>
  3. <view class="mtop"><image src="../../static/lx.jpg" mode="widthFix"></image></view>
  4. <view class="cn">
  5. <view class="info">
  6. <view class="form_group hr">
  7. <view class="lable">散客预约人数</view>
  8. <input type="text" placeholder="请输入散客预约人数" v-model="item.scatteredAppointment" />
  9. </view>
  10. <view class="form_group hr">
  11. <view class="lable">散客接待人数</view>
  12. <input type="number" placeholder="请输入散客接待人数" v-model="item.scatteredReception" />
  13. </view>
  14. <view class="form_group hr">
  15. <view class="lable">团客预约人数</view>
  16. <input type="number" placeholder="请输入团客预约人数" v-model="item.groupAppointment" />
  17. </view>
  18. <view class="form_group hr">
  19. <view class="lable">团客接待人数</view>
  20. <input type="number" placeholder="请输入团客接待人数" v-model="item.groupReception" />
  21. </view>
  22. <view class="form_group hr">
  23. <view class="lable">销售金额</view>
  24. <input type="number" placeholder="请输入销售金额" v-model="item.salesAmount" />
  25. </view>
  26. </view>
  27. <button class="btn" @click="up()">上报数据</button>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. item: {}
  36. };
  37. },
  38. methods: {
  39. up() {
  40. let rule = [
  41. { name: 'scatteredAppointment', checkType: 'notnull', errorMsg: '请输入散客预约人数' },
  42. { name: 'scatteredReception', checkType: 'notnull', errorMsg: '请输入散客接待人数' },
  43. { name: 'groupAppointment', checkType: 'notnull', errorMsg: '请输入团客预约人数' },
  44. { name: 'groupReception', checkType: 'notnull', errorMsg: '请输入团客接待人数' },
  45. { name: 'salesAmount', checkType: 'notnull', errorMsg: '请输入销售金额' }
  46. ];
  47. if (!this.$verify.check(this.item, rule)) {
  48. uni.showModal({ content: this.$verify.error, showCancel: false });
  49. return;
  50. }
  51. this.$http.request({
  52. method: 'POST',
  53. url: this.$http.urls.pushRecord,
  54. data: this.item,
  55. success: res => {
  56. uni.showToast({ title: '上报成功' });
  57. setTimeout(() => {
  58. uni.navigateBack();
  59. }, 700);
  60. }
  61. });
  62. }
  63. }
  64. };
  65. </script>
  66. <style lang="scss">
  67. .mtop {
  68. text-align: center;
  69. image {
  70. width: 80%;
  71. }
  72. }
  73. .cn {
  74. padding: 15px;
  75. .info {
  76. background-color: white;
  77. border-radius: 5px;
  78. margin-top: 10px;
  79. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  80. }
  81. .btn {
  82. margin-top: 25px;
  83. }
  84. }
  85. </style>