AwardForm.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <div>
  3. <div class="prize">
  4. <div class="prize-top">
  5. <div>关联商品列表</div>
  6. </div>
  7. <div class="prize-table">
  8. <el-table :data="goodsList" class="el-table">
  9. <el-table-column label="商品图片">
  10. <template slot-scope="scope">
  11. <el-image
  12. style="width: 70px; height: 70px"
  13. :src="scope.row.picUrl"
  14. :preview-src-list="[scope.row.picUrl]"
  15. >
  16. </el-image>
  17. </template>
  18. </el-table-column>
  19. <el-table-column label="商品名称" prop="title" >
  20. <template slot-scope="{ row }">
  21. <div v-if="row.type == 'coin' && row.value >= 0">盲豆 x{{ row.value }}</div>
  22. <div v-else>{{ row.title }}</div>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="商品类型">
  26. <template slot-scope="scope">
  27. <div v-if="scope.row.type == 'goods'">商品</div>
  28. <div v-if="scope.row.type == 'coupon'">券</div>
  29. <div v-if="scope.row.type == 'coupon_pkg'">券包</div>
  30. <div v-if="scope.row.type == 'coin'">盲豆</div>
  31. </template>
  32. </el-table-column>
  33. <el-table-column label="商品价格">
  34. <template slot-scope="scope">
  35. <div v-if="scope.row.type == 'goods'">¥{{ $numberFormat(scope.row.value) }}</div>
  36. <span v-else>--</span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="商品成本">
  40. <template slot-scope="scope">
  41. <div v-if="scope.row.type == 'goods'">¥{{ $numberFormat(scope.row.cost) }}</div>
  42. <span v-else>--</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="操作" align="center">
  46. <template slot-scope="scope">
  47. <el-button
  48. size="mini"
  49. type="text"
  50. @click="handleDel()"
  51. >删除</el-button
  52. >
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. </div>
  57. <div class="prize-btn">
  58. <!-- <el-button type="primary" :disabled="goodsList.length > 0" size="small" @click="goodsCommand('goods', 0)">-->
  59. <!-- 添加商品-->
  60. <!-- </el-button>-->
  61. <el-dropdown @command="goodsCommand($event, 0)">
  62. <el-button type="primary" size="small" :disabled="goodsList.length > 0">
  63. 添加商品<i class="el-icon-arrow-down el-icon--right"></i>
  64. </el-button>
  65. <el-dropdown-menu slot="dropdown">
  66. <el-dropdown-item command="goods">商品</el-dropdown-item>
  67. <el-dropdown-item command="coupon">券</el-dropdown-item>
  68. <el-dropdown-item command="coupon_pkg">券包</el-dropdown-item>
  69. <!-- <el-dropdown-item command="coin">盲豆</el-dropdown-item>-->
  70. </el-dropdown-menu>
  71. </el-dropdown>
  72. </div>
  73. </div>
  74. </div>
  75. </template>
  76. <script>
  77. export default {
  78. name: "AwardForm",
  79. props: {
  80. value: {
  81. type: Array,
  82. default: () => []
  83. },
  84. id: {
  85. type: [String,Number],
  86. default: false,
  87. },
  88. }, data() {
  89. return {
  90. boxId: this.$route.query.id,
  91. awardsLabelList: [],//关联奖级列表
  92. prizeIndex: 0, // 奖级下标
  93. // 奖级列表
  94. goodsList: [],
  95. ticketType: '',
  96. };
  97. },
  98. created() {
  99. },
  100. methods: {
  101. // 添加奖品
  102. add(type,item) {
  103. this.goodsList = item
  104. this.$emit('input', this.goodsList)
  105. this.$emit('close')
  106. },
  107. // 选择奖品种类
  108. goodsCommand(e, index) {
  109. this.$emit('goodsCommand', e)
  110. },
  111. // 奖级商品删除
  112. handleDel(index, item) {
  113. this.goodsList = []
  114. this.$emit('input', this.goodsList)
  115. },
  116. },
  117. };
  118. </script>
  119. <style lang="scss" scoped>
  120. .prize {
  121. width: 100%;
  122. margin-bottom: 50px;
  123. background: #f9f9f9;
  124. border: 1px solid #bbbbbb;
  125. font-size: 14px;
  126. &-top {
  127. padding: 10px 20px;
  128. margin-bottom: 10px;
  129. border-bottom: 1px solid #bbbbbb;
  130. div {
  131. line-height: 36px;
  132. }
  133. }
  134. &-btn {
  135. border-top: 1px solid #bbbbbb;
  136. padding: 10px;
  137. }
  138. }
  139. </style>