freight.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <div class="app-content">
  3. <div class="module-com new_wrap">
  4. <div class="module-det">
  5. <div>
  6. <input type="text" v-model="form.first" class="setting-inp" />
  7. <span>公里内免运费,超过每增加1公里,</span>
  8. </div>
  9. <div>
  10. <span>运费增加</span>
  11. <input type="text" v-model="form.add" class="setting-inp" />
  12. <span>元。</span>
  13. </div>
  14. </div>
  15. </div>
  16. <div class="admin-button-com blue big" @click="confirmFn">确认</div>
  17. </div>
  18. </template>
  19. <script>
  20. import { mapGetters, mapState } from 'vuex'
  21. import { getUser } from '@/utils/auth'
  22. import { freightSet } from '@/api/goods'
  23. export default {
  24. name: 'setting-freight',
  25. data() {
  26. return {
  27. form: {
  28. first: 0,
  29. add: 0
  30. }
  31. }
  32. },
  33. computed: {
  34. ...mapGetters({ userInfo: 'getUser' })
  35. },
  36. onLoad() {},
  37. mounted() {
  38. // this.init()
  39. },
  40. watch: {
  41. userInfo() {
  42. if (!this.$util.isEmpty(this.userInfo)) {
  43. this.form.first = this.userInfo.extend.freeDistance
  44. this.form.add = this.userInfo.extend.freight
  45. }
  46. }
  47. },
  48. methods: {
  49. init() {
  50. getUser().then(res => {
  51. this.form.first = this.userInfo.extend.freeDistance
  52. this.form.add = this.userInfo.extend.freight
  53. })
  54. },
  55. confirmFn() {
  56. freightSet(this.form).then(res => {
  57. this.$msg('修改成功!')
  58. })
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .module-com {
  65. margin-bottom: 20px;
  66. padding: 30px;
  67. background-color: #fff;
  68. color: $fontColor2;
  69. }
  70. .admin-button-com {
  71. width: calc(100% - 100px);
  72. margin: 60px 30px 0;
  73. }
  74. .new_wrap {
  75. .module-det {
  76. color: $fontColor3;
  77. font-size: 28px;
  78. & > div {
  79. @include disFlex(center, flex-start);
  80. flex-wrap: wrap;
  81. margin-bottom: 20px;
  82. &:last-child {
  83. margin-bottom: 0;
  84. }
  85. }
  86. .setting-inp {
  87. width: 140px;
  88. height: 70px;
  89. border: 2px solid $borderColor;
  90. border-radius: 10px;
  91. margin: 0 16px;
  92. text-align: center;
  93. &:first-child {
  94. margin-left: 0;
  95. }
  96. &:last-child {
  97. margin-right: 0;
  98. }
  99. }
  100. }
  101. }
  102. </style>