setting.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="app-content">
  3. <div class="module-com flex-center-between switch-blo">
  4. <div class="app-size-32">开启状态</div>
  5. <div>
  6. <switch :checked="form.switch ? true : false" @change="switchChangeFn" />
  7. </div>
  8. </div>
  9. <div class="module-com flex-center">
  10. <label class="app-size-28">邀请成功下单奖励</label>
  11. <input type="text" class="app-size-28 reward-inp" v-model="form.prize" placeholder="请输入">
  12. </div>
  13. <div class="prompt-text">奖励可以是现金、绿植和散花等</div>
  14. <div class="module-com new_wrap">
  15. <div class="module-tit">新人可领取</div>
  16. <div class="module-det">
  17. <div>
  18. <input type="text" class="setting-inp" v-model="form.amount" />
  19. <span>元优惠券,满</span>
  20. <input type="text" class="setting-inp" v-model="form.miniCost" />
  21. <span>元可以使用,</span>
  22. </div>
  23. <div>
  24. <span>领取后</span>
  25. <input type="text" class="setting-inp" v-model="form.duration" />
  26. <span>天内有效。</span>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="prompt-text">提示:奖励额度可以比新人领券高一此, 这样可以吸引老客户邀请 新人,新人也更愿意到店消费。</div>
  31. <div class="admin-button-com blue big" @click="confirmFn">确认</div>
  32. </div>
  33. </template>
  34. <script>
  35. import { inviteAssetDet, inviteAssetUpdate } from '@/api/invite'
  36. export default {
  37. name: 'invite-setting',
  38. data() {
  39. return {
  40. form: {
  41. switch: 1,
  42. prize: 0,
  43. amount: 0,
  44. miniCost: 0,
  45. duration: 0
  46. }
  47. }
  48. },
  49. onLoad() {
  50. // this.init()
  51. },
  52. methods: {
  53. init() {
  54. this._getDet()
  55. },
  56. // 获取详情
  57. _getDet() {
  58. inviteAssetDet().then(res => {
  59. if (this.$util.isEmpty(res.data)) return
  60. Object.keys(this.form).forEach((i, index) => {
  61. this.form[i] = res.data[i]
  62. })
  63. })
  64. },
  65. // 设置奖励
  66. confirmFn() {
  67. inviteAssetUpdate(this.form).then(res => {
  68. this.$msg('修改成功!')
  69. })
  70. },
  71. switchChangeFn(e) {
  72. this.switch = e.target.value ? 1 : 0
  73. console.log('switch1 发生 change 事件,携带值为', e.target.value)
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .prompt-text {
  80. color: $fontColor3;
  81. padding-bottom: 20px;
  82. padding-left: 30px;
  83. }
  84. .module-com {
  85. margin-bottom: 20px;
  86. padding: 30px;
  87. background-color: #fff;
  88. color: $fontColor2;
  89. .module-tit {
  90. font-size: 28px;
  91. }
  92. }
  93. .admin-button-com {
  94. width: calc(100% - 100px);
  95. margin: 60px 30px 0;
  96. }
  97. .switch-blo {
  98. padding: 15px 30px;
  99. }
  100. .reward-inp {
  101. margin-left: 40px;
  102. }
  103. .new_wrap {
  104. .module-tit {
  105. margin-bottom: 30px;
  106. }
  107. .module-det {
  108. color: $fontColor2;
  109. & > div {
  110. @include disFlex(center, flex-start);
  111. flex-wrap: wrap;
  112. margin-bottom: 20px;
  113. &:last-child {
  114. margin-bottom: 0;
  115. }
  116. }
  117. .setting-inp {
  118. width: 150px;
  119. height: 70px;
  120. border: 2px solid $borderColor;
  121. border-radius: 10px;
  122. margin: 0 20px;
  123. text-align: center;
  124. &:first-child {
  125. margin-left: 0;
  126. }
  127. }
  128. }
  129. }
  130. </style>