bargain-popup.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template id="bargain-popup">
  2. <div flex="main:around">
  3. <div class="general-modal-left" style="padding: 85px 35px; position: relative;"></div>
  4. <div class="general-modal-right">
  5. <div flex="cross:center" style="margin-bottom: 20px;">
  6. <div class="label">是否开启</div>
  7. <el-switch v-model="form.value"></el-switch>
  8. </div>
  9. <div flex="cross:center">
  10. <div class="label">显示类型</div>
  11. <el-radio-group v-model="form.showType" @change="typeChange">
  12. <el-radio :label="1">仅首次</el-radio>
  13. <el-radio :label="2">多次</el-radio>
  14. </el-radio-group>
  15. </div>
  16. <div flex v-if="form.showType === 1">
  17. <div class="label"></div>
  18. <div class="desc">
  19. <!-- 砍价成功后只显示一次弹窗,再次砍价成功不再显示,更换砍价图后砍价成功可再次显示 -->
  20. </div>
  21. </div>
  22. <div flex v-else style="margin-top: 20px;">
  23. <div class="label">显示次数</div>
  24. <div class="desc">
  25. <el-input placeholder="请输入内容" v-model="form.count">
  26. <template slot="append">人/日</template>
  27. </el-input>
  28. <div style="margin-top: 10px;">
  29. 每次进入商城显示一次广告,每人每日最多显示1次,建议每人每日显示弹窗不超过3次
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. Vue.component('bargain-popup', {
  38. name: "bargain-popup",
  39. template: '#bargain-popup',
  40. props: {
  41. data: {
  42. type: Object,
  43. default () {
  44. return {}
  45. }
  46. }
  47. },
  48. data() {
  49. return {
  50. form: {
  51. value: false,
  52. showType: 1,
  53. count: 1,
  54. }
  55. }
  56. },
  57. watch: {
  58. form: {
  59. handler(newVal) {
  60. // 直接监听
  61. this.$emit("change", Object.assign({}, newVal))
  62. },
  63. deep: true
  64. },
  65. data: {
  66. handler(newVal) {
  67. // 直接监听
  68. console.log(newVal, "=======> newVal");
  69. if (newVal) {
  70. this.form = newVal
  71. }
  72. },
  73. immediate: true
  74. },
  75. },
  76. methods: {
  77. typeChange(data){
  78. if(data === 1){
  79. this.form.count = 1;
  80. }
  81. }
  82. }
  83. });
  84. </script>
  85. <style>
  86. .general-modal-left {
  87. position: relative;
  88. padding: 85px 35px;
  89. width: 222px;
  90. height: 378px;
  91. border-radius: 4px;
  92. background: rgba(0, 0, 0, 0.4) url('resources/img/decorate/bargain-popup.png') center center no-repeat;
  93. background-size: cover;
  94. }
  95. .general-modal-right {
  96. margin-left: 40px;
  97. width: 270px;
  98. }
  99. .label {
  100. min-width: 68px;
  101. text-align: right;
  102. vertical-align: middle;
  103. float: left;
  104. font-size: 12px;
  105. color: #666;
  106. padding: 10px 20px 10px 0;
  107. box-sizing: border-box;
  108. }
  109. .general-modal-right .desc {
  110. color: #999;
  111. font-size: 12px;
  112. padding: 0;
  113. }
  114. .general-modal-right .el-input__inner {
  115. height: 32px;
  116. line-height: 32px;
  117. }
  118. </style>