card_conf.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div class="content_t">
  3. <div>
  4. <span>单次价格</span>
  5. <el-input v-model="options[0].price" type="number" class="input_t"></el-input>
  6. </div>
  7. <template v-for="(item,key) in options">
  8. <div v-if="item.type !== '1'">
  9. <div class="conf_title">{{ item.name }}:</div>
  10. <div class="conf_content">
  11. <span>套餐次数</span>
  12. <el-input v-model="item.view_limit" type="number" class="input_t"></el-input>
  13. <spqn>次</spqn>
  14. <span>原价</span>
  15. <el-input v-model="item.original_price" type="number" class="input_t"></el-input>
  16. <spqn>元</spqn>
  17. <spqn>现价</spqn>
  18. <el-input v-model="item.price" type="number" class="input_t"></el-input>
  19. <spqn>元</spqn>
  20. </div>
  21. </div>
  22. </template>
  23. <div class="save-btn">
  24. <el-button @click="onSave" :loading="logding">保存配置</el-button>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. logding: false,
  33. options: [{name: '无套餐', price: '0.00', type: '1'}]
  34. };
  35. },
  36. mounted() {
  37. this.getData()
  38. },
  39. methods: {
  40. async getData() {
  41. const res = await this.$post("/api/admin/UserCards/getCardsConf");
  42. if (res && res.status === 1) {
  43. this.options = res.data || [{name: '无套餐', price: '0.00', type: '1'}];
  44. }
  45. },
  46. async onSave() {
  47. this.logding = true;
  48. let data = {
  49. content: JSON.stringify(this.options)
  50. };
  51. const res = await this.$post("/api/admin/UserCards/saveCardsConf", data);
  52. if (res && res.status === 1) {
  53. this.$message({
  54. message: '修改成功',
  55. type: 'success'
  56. })
  57. this.getData()
  58. }
  59. this.logding = false;
  60. }
  61. }
  62. };
  63. </script>
  64. <style scoped>
  65. .content_t {
  66. padding: 20px;
  67. }
  68. .conf_title {
  69. font-weight: 500;
  70. margin: 10px 0 10px 0;
  71. }
  72. .conf_content {
  73. margin-left: 30px;
  74. }
  75. .input_t {
  76. width: 120px;
  77. }
  78. .save-btn{
  79. margin-top: 30px;
  80. }
  81. </style>