Detail.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div>
  3. <div class="operation">
  4. <el-input v-model="eicode" placeholder="请输入兑换码" size="mini"></el-input>
  5. <div class="btn">
  6. <el-button type="primary" @click="search" size="mini">查询</el-button>
  7. </div>
  8. </div>
  9. <div v-bind:class="{show: isSearched, hidden:!isSearched}" class="ecdate">
  10. <el-row>
  11. <el-col :span="12" class="eccontent">
  12. <el-card class="box-card">
  13. <div slot="header" class="clearfix">
  14. <span>批次信息</span>
  15. </div>
  16. <div>
  17. <el-row>
  18. <el-col :span="8">商品名称:</el-col>
  19. <el-col :span="16">{{exchangecode.gname}}</el-col>
  20. </el-row>
  21. <el-row class="dataitem">
  22. <el-col :span="8">说明:</el-col>
  23. <el-col :span="16">{{exchangecode.remark}}</el-col>
  24. </el-row>
  25. <el-row class="dataitem">
  26. <el-col :span="8">创建人:</el-col>
  27. <el-col :span="16">{{exchangecode.cuname}}</el-col>
  28. </el-row>
  29. <el-row class="dataitem">
  30. <el-col :span="8">生成数量:</el-col>
  31. <el-col :span="16">{{exchangecode.num}}</el-col>
  32. </el-row>
  33. <el-row class="dataitem">
  34. <el-col :span="8">状态:</el-col>
  35. <el-col :span="16">
  36. <template v-if="exchangecode.status === 1">
  37. <p class="online">启用</p>
  38. </template>
  39. <template v-else>
  40. <p class="offline">禁用</p>
  41. </template>
  42. </el-col>
  43. </el-row>
  44. <el-row class="dataitem">
  45. <el-col :span="8">截止日期:</el-col>
  46. <el-col :span="16">{{exchangecode.endtime}}</el-col>
  47. </el-row>
  48. </div>
  49. </el-card>
  50. </el-col>
  51. <el-col :span="12" class="eccontent">
  52. <el-card class="box-card">
  53. <div slot="header" class="clearfix">
  54. <span>兑换码信息</span>
  55. </div>
  56. <el-row>
  57. <el-col :span="8">兑换码:</el-col>
  58. <el-col :span="16">{{item.eicode}}</el-col>
  59. </el-row>
  60. <el-row class="dataitem">
  61. <el-col :span="8">密码:</el-col>
  62. <el-col :span="16">{{item.eipwd}}</el-col>
  63. </el-row>
  64. <el-row class="dataitem">
  65. <el-col :span="8">使用状态:</el-col>
  66. <el-col :span="16">
  67. <template v-if="item.status === 1">
  68. <p class="online">已使用</p>
  69. </template>
  70. <template v-else>
  71. <p class="offline">未使用</p>
  72. </template>
  73. </el-col>
  74. </el-row>
  75. <el-row class="dataitem">
  76. <el-col :span="8">使用时间:</el-col>
  77. <el-col :span="16">{{item.utime}}</el-col>
  78. </el-row>
  79. <el-row class="dataitem">
  80. <el-col :span="8">使用信息:</el-col>
  81. <el-col :span="16">{{item.extend}}</el-col>
  82. </el-row>
  83. </el-card>
  84. </el-col>
  85. </el-row>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import { timeFormater } from "../../../util";
  91. export default {
  92. data() {
  93. return {
  94. eicode: "",
  95. exchangecode: {},
  96. item: {},
  97. isSearched: false
  98. };
  99. },
  100. methods: {
  101. endTimeFormat(row) {
  102. return timeFormater(row.endtime);
  103. },
  104. utimeFormat(row) {
  105. if (row.utime === 0) {
  106. return "-";
  107. } else {
  108. return timeFormater(row.utime);
  109. }
  110. },
  111. utimeFormat(row) {
  112. if (row.utime === 0) {
  113. return "-";
  114. } else {
  115. return timeFormater(row.utime);
  116. }
  117. },
  118. search: function() {
  119. this.$http
  120. .echangeCodeGetItemdetail({ eicode: this.eicode }, this)
  121. .then(res => {
  122. if (res.code === 0) {
  123. let exchangecode = res.obj.exchangecode;
  124. exchangecode.endtime = this.endTimeFormat(exchangecode);
  125. this.exchangecode = res.obj.exchangecode;
  126. let item = res.obj.item;
  127. item.utime = this.utimeFormat(item);
  128. this.item = item;
  129. this.isSearched = true;
  130. }
  131. });
  132. }
  133. }
  134. };
  135. </script>
  136. <style scoped>
  137. .online {
  138. color: #67c23a;
  139. }
  140. .offline {
  141. color: #f56c6c;
  142. }
  143. .ecdate {
  144. margin-top: 20px;
  145. }
  146. .dataitem {
  147. margin-top: 10px;
  148. }
  149. .eccontent {
  150. padding: 10px;
  151. }
  152. .show {
  153. display: block;
  154. }
  155. .hidden {
  156. display: none;
  157. }
  158. .operation {
  159. display: flex;
  160. height: 50px;
  161. border-bottom: 1px solid #e6e6e6;
  162. margin-bottom: 10px;
  163. }
  164. .operation .btn {
  165. display: flex;
  166. height: 28px;
  167. }
  168. .operation .btn,
  169. .operation .el-input,
  170. .operation .el-select {
  171. width: 150px;
  172. margin-right: 8px;
  173. }
  174. </style>