fill-form.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="app-content">
  3. <form @submit="formSubmit">
  4. <app-delivery-module ref="appDelivery" />
  5. <!-- 匿名派送 -->
  6. <!-- <div class="none-name-delivery flex-center">
  7. <checkbox class="ljd-checkbox" @change="anonymityChange"></checkbox>
  8. <span class="none-name-text">匿名派送</span>
  9. </div> -->
  10. <!-- 按钮 -->
  11. <div class="app-footer">
  12. <button class="admin-button-com blue middle" formType="submit">提交</button>
  13. </div>
  14. </form>
  15. </div>
  16. </template>
  17. <script>
  18. import { mapGetters } from 'vuex'
  19. import AppDeliveryModule from '@/components/app-delivery'
  20. const form = require('@/utils/formValidation.js')
  21. // api
  22. // import { getShopUser } from '@/utils/auth'
  23. import { getOrderShop } from '@/utils/config'
  24. import { updateSheet } from '@/api/order'
  25. export default {
  26. name: 'fill-form',
  27. components: {
  28. AppDeliveryModule
  29. },
  30. data() {
  31. return {
  32. // 初始form
  33. form: {
  34. anonymity: '0' // 是否匿名 0不 1要
  35. }
  36. }
  37. },
  38. computed: {
  39. ...mapGetters({ orderShop: 'getOrderShop' }),
  40. // ...mapGetters({ shopUser: 'getShopUser' })
  41. },
  42. onLoad() {
  43. // this.init()
  44. },
  45. methods: {
  46. init() {
  47. getOrderShop()
  48. // getShopUser()
  49. },
  50. confirmFn() {
  51. let form = this.$refs.appDelivery.form ? this.$refs.appDelivery.form : {}
  52. let region = this.$refs.appDelivery.region ? this.$refs.appDelivery.region : {}
  53. updateSheet({
  54. id: this.option.id,
  55. ...this.form,
  56. ...form,
  57. ...region
  58. }).then(res => {
  59. uni.navigateBack({
  60. });
  61. // this.$util.pageTo({
  62. // url: '/admin/order/ship',
  63. // type: 2,
  64. // query: {
  65. // id: this.option.id,
  66. // pagestatus: 1
  67. // }
  68. // })
  69. })
  70. },
  71. // operate
  72. anonymityChange(e) {
  73. this.form.anonymity = this.form.anonymity == 1 ? 0 : 1
  74. },
  75. // 表单验证
  76. formSubmit(e) {
  77. // 表单规则
  78. let rules = [
  79. // {
  80. // name: 'receiveUserName',
  81. // rule: ['required'],
  82. // msg: ['请输入姓名']
  83. // }
  84. ]
  85. // 进行表单检查
  86. let formData = e.detail.value
  87. let checkRes = form.validation(formData, rules)
  88. // 验证通过!
  89. if (!checkRes) {
  90. this.confirmFn()
  91. } else {
  92. this.$msg(checkRes)
  93. }
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. // 匿名派送
  100. .none-name-delivery {
  101. padding-left: 30px;
  102. margin-top: 40px;
  103. .none-name-text {
  104. margin-left: 14px;
  105. color: $fontColor2;
  106. }
  107. }
  108. .app-footer {
  109. .admin-button-com {
  110. width: 90%;
  111. }
  112. }
  113. </style>