verification_detail.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <el-card class="box-card order-list">
  3. <div slot="header" class="clearfix">
  4. <el-breadcrumb separator="/">
  5. <el-breadcrumb-item :to="{ path: '/order/verification_list' }">核销记录</el-breadcrumb-item>
  6. <el-breadcrumb-item>核销验证</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. </div>
  9. <div class="ns-verification" v-loading="loading">
  10. <div class="ns-verification-order">
  11. <p class="ns-site-name">{{ verifyInfo.site_name }}</p>
  12. <div class="ns-goods-list" v-for="(item, index) in verifyInfo.item_array" :key="index">
  13. <div class="ns-goods-img"><el-image fit="cover" :src="$img(item.img)" @error="imageError(index)"></el-image></div>
  14. <div class="ns-goods-info">
  15. <p>{{ item.name }}</p>
  16. <p class="ns-goods-price ns-text-color">¥{{ item.price }}</p>
  17. <p>数量:{{ item.num }}</p>
  18. </div>
  19. </div>
  20. <div class="ns-order-info">
  21. <p v-for="(item, index) in verifyInfo.remark_array" :key="index">{{ item.title }}:{{ item.value }}</p>
  22. <p>核销类型:{{ verifyInfo.verify_type_name }}</p>
  23. <template v-if="verifyInfo.is_verify">
  24. <p>核销状态:已核销</p>
  25. <p v-if="verifyInfo.verify_time">核销人员:{{ verifyInfo.verifier_name }}</p>
  26. <p v-if="verifyInfo.verify_time">核销时间:{{ $timeStampTurnTime(verifyInfo.verify_time) }}</p>
  27. </template>
  28. </div>
  29. <div class="ns-btn"><el-button @click="verify" v-if="verifyInfo.is_verify == 0">确认使用</el-button></div>
  30. </div>
  31. </div>
  32. </el-card>
  33. </template>
  34. <script>
  35. import { checkisverifier, verifyInfo, verify } from '@/api/order/verification';
  36. import { mapGetters } from 'vuex';
  37. export default {
  38. name: 'verification_detail',
  39. components: {},
  40. data: () => {
  41. return {
  42. verify_code: '',
  43. verifyInfo: {},
  44. isSub: false,
  45. loading: true
  46. };
  47. },
  48. created() {
  49. this.verify_code = this.$route.query.code;
  50. this.getVerifyInfo();
  51. },
  52. computed: {
  53. ...mapGetters(['defaultGoodsImage'])
  54. },
  55. layout: 'member',
  56. methods: {
  57. getVerifyInfo() {
  58. verifyInfo({
  59. verify_code: this.verify_code
  60. })
  61. .then(res => {
  62. if (res.code >= 0) {
  63. this.verifyInfo = res.data;
  64. } else {
  65. this.$message({ message: res.message, type: 'warning' });
  66. this.$router.push('/member');
  67. }
  68. this.loading = false;
  69. })
  70. .catch(err => {
  71. this.$message.error(err.message);
  72. this.$router.push('/member');
  73. this.loading = false;
  74. });
  75. },
  76. verify() {
  77. if (this.isSub) return;
  78. this.isSub = true;
  79. verify({
  80. verify_code: this.verify_code
  81. })
  82. .then(res => {
  83. if (res.code >= 0) {
  84. this.$message({
  85. message: res.message,
  86. type: 'success',
  87. duration: 2000,
  88. onClose: () => {
  89. this.$router.push('/order/verification_list');
  90. }
  91. });
  92. } else {
  93. this.$message({ message: res.message, type: 'warning' });
  94. this.isSub = false;
  95. }
  96. })
  97. .catch(err => {
  98. this.$message.error(err.message);
  99. this.isSub = false;
  100. });
  101. },
  102. /**
  103. * 图片加载失败
  104. */
  105. imageError(index) {
  106. this.verifyInfo.item_array[index].img = this.defaultGoodsImage;
  107. }
  108. }
  109. };
  110. </script>
  111. <style lang="scss" scoped>
  112. .ns-verification {
  113. .ns-verification-order {
  114. .ns-goods-list {
  115. display: flex;
  116. margin: 10px 0;
  117. .el-image {
  118. width: 80px;
  119. height: 80px;
  120. line-height: 80px;
  121. text-align: center;
  122. margin-right: 10px;
  123. border-radius: 5px;
  124. }
  125. .ns-goods-price span:first-child {
  126. font-weight: 600;
  127. font-size: 16px;
  128. }
  129. }
  130. .ns-order-info {
  131. border-top: 1px solid #eeeeee;
  132. padding-top: 20px;
  133. color: $base-color-info;
  134. line-height: 30px;
  135. }
  136. .ns-btn {
  137. text-align: right;
  138. .el-button {
  139. background: $base-color;
  140. color: #ffffff;
  141. }
  142. }
  143. }
  144. }
  145. </style>