detail.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div class="app-container">
  3. <div class="base-info">
  4. <div class="base-info-title">基础信息</div>
  5. <el-form label-width="100px">
  6. <el-form-item label="盲票类型:">
  7. <span :class="loading ? 'el-icon-loading' : ''"></span>
  8. {{ info && info.type && info.type.desc }}
  9. </el-form-item>
  10. <el-form-item label="盲票组名称:">
  11. <span :class="loading ? 'el-icon-loading' : ''"></span>
  12. {{ info && info.title }}
  13. </el-form-item>
  14. <el-form-item label="图片:">
  15. <el-image
  16. style="width: 110px; height: 150px"
  17. :src="info && info.picUrl"
  18. :preview-src-list="[info && info.picUrl]"
  19. />
  20. </el-form-item>
  21. <el-form-item label="面值:">
  22. <span :class="loading ? 'el-icon-loading' : ''"></span>
  23. {{ info && info.facePrice && $numberFormat(info.facePrice) }}元
  24. </el-form-item>
  25. <el-form-item label="售价:">
  26. <span :class="loading ? 'el-icon-loading' : ''"></span>
  27. {{ info && info.salePrice && $numberFormat(info.salePrice) }}元
  28. </el-form-item>
  29. <el-form-item label="盲票总数:">
  30. <span :class="loading ? 'el-icon-loading' : ''"></span>
  31. {{ info && info.quantity }}张
  32. </el-form-item>
  33. <el-form-item label="每包张数:">
  34. <span :class="loading ? 'el-icon-loading' : ''"></span>
  35. {{ info && info.pkgUnit }}张
  36. </el-form-item>
  37. <el-form-item label="采购单价:" v-if="info.type == 'offline'">
  38. <span :class="loading ? 'el-icon-loading' : ''"></span>
  39. {{ info && info.pkgSalePrice && $numberFormat(info.pkgSalePrice) }}元
  40. </el-form-item>
  41. <el-form-item label="佣金系数:">
  42. <span :class="loading ? 'el-icon-loading' : ''"></span>
  43. {{ info && info.saleCommRate }}%
  44. </el-form-item>
  45. <el-form-item label="序列号:">
  46. <span :class="loading ? 'el-icon-loading' : ''"></span>
  47. {{ info && info.boxNo }}
  48. </el-form-item>
  49. </el-form>
  50. <div class="base-info-title">奖级设置</div>
  51. <!-- 奖级设置 -->
  52. <div class="prize" v-for="(item, index) in awardsList" :key="index">
  53. <div class="prize-top">
  54. <div>奖级名称:{{ item.name }}</div>
  55. <div>奖级:{{ item.sort }}</div>
  56. <div>奖级数量:{{ item.quantity }}</div>
  57. </div>
  58. <div class="prize-table">
  59. <el-table :data="item.prizeList" class="el-table">
  60. <el-table-column label="奖品图片">
  61. <template slot-scope="{ row }">
  62. <el-image
  63. style="width: 70px; height: 70px"
  64. :src="row.picUrl"
  65. :preview-src-list="[row.picUrl]"
  66. >
  67. </el-image>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="奖品名称" prop="title">
  71. <template slot-scope="{ row }">
  72. <div v-if="row.prizeType.value == 'coin'">盲豆 x{{ row.value }}</div>
  73. <div v-else>{{ row.title }}</div>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="奖品类型" align="center">
  77. <template slot-scope="{ row }">
  78. <div v-if="row.prizeType.value == 'goods'">商品</div>
  79. <div v-if="row.prizeType.value == 'coupon'">券</div>
  80. <div v-if="row.prizeType.value == 'coin'">盲豆</div>
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import { publicFileGetUrl } from "@/api/common";
  91. import { ticketBoxDetail } from "@/api/business/ticket";
  92. export default {
  93. name: "TicketDetail",
  94. components: {},
  95. data() {
  96. return {
  97. loading: false,
  98. // 盲票组ID
  99. boxId: "",
  100. // 盲票组详情
  101. info: {},
  102. // 奖品
  103. awardsList: [],
  104. };
  105. },
  106. created() {
  107. this.boxId = this.$route.query.id;
  108. this.getDetail();
  109. },
  110. methods: {
  111. // 获取详情
  112. getDetail() {
  113. this.loading = true;
  114. ticketBoxDetail({ boxId: this.boxId })
  115. .then((res) => {
  116. this.loading = false;
  117. if (res.code == 0) {
  118. let data = res.data;
  119. this.info = {
  120. ...data,
  121. type: JSON.parse(data.type),
  122. picUrl: publicFileGetUrl + data.picUrl,
  123. };
  124. data.awardsList.forEach((item) => {
  125. item.prizeList.forEach((ele) => {
  126. (ele.picUrl = publicFileGetUrl + ele.picUrl.split(',')[0]),
  127. (ele.prizeType = JSON.parse(ele.prizeType));
  128. });
  129. });
  130. this.awardsList = data.awardsList;
  131. }
  132. })
  133. .catch(() => {
  134. this.loading = false;
  135. });
  136. },
  137. },
  138. };
  139. </script>
  140. <style lang="scss" scoped>
  141. .base-info-title {
  142. padding: 10px;
  143. border-bottom: 1px solid #eaeaea;
  144. margin-bottom: 20px;
  145. }
  146. .tip {
  147. padding-left: 100px;
  148. height: 32px;
  149. margin-bottom: 20px;
  150. color: #828282;
  151. font-size: 14px;
  152. }
  153. .save-btn {
  154. display: flex;
  155. align-content: center;
  156. justify-content: center;
  157. margin-bottom: 100px;
  158. .ge {
  159. width: 100px;
  160. }
  161. }
  162. .prize {
  163. width: 1000px;
  164. margin-bottom: 50px;
  165. background: #f9f9f9;
  166. border: 1px solid #bbbbbb;
  167. font-size: 14px;
  168. &-top {
  169. padding: 10px 20px;
  170. margin-bottom: 10px;
  171. display: flex;
  172. align-content: center;
  173. justify-content: space-around;
  174. border-bottom: 1px solid #bbbbbb;
  175. div {
  176. line-height: 36px;
  177. }
  178. }
  179. }
  180. </style>