couponDetails.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
  3. <div style="padding: 20px; background-color: #fff;">
  4. 优惠劵详情
  5. </div>
  6. <div class="contentx" v-if="item!=null">
  7. <div class="desct"> 优惠劵信息</div>
  8. <el-descriptions title="" :column="3" border>
  9. <el-descriptions-item label="标题"><span v-if="item!=null">{{item.title}}</span></el-descriptions-item>
  10. <el-descriptions-item label="面额"><span v-if="item!=null">{{item.price}}</span></el-descriptions-item>
  11. <el-descriptions-item label="数量"><span v-if="item!=null">{{item.number}}</span></el-descriptions-item>
  12. <el-descriptions-item label="卷类型"><span v-if="item!=null">{{item.couponType}}</span></el-descriptions-item>
  13. <el-descriptions-item label="最低消费金额可用"><span v-if="item!=null">{{item.minPrice}}</span></el-descriptions-item>
  14. <el-descriptions-item label="剩余数量"><span v-if="item!=null">{{item.remainNumber}}</span></el-descriptions-item>
  15. <el-descriptions-item label="有效期"><span v-if="item!=null">{{item.limitTime}}</span></el-descriptions-item>
  16. <el-descriptions-item label="状态"><span v-if="item!=null"> <dict-tag :options="statusOptions" :value="item.status"/></span></el-descriptions-item>
  17. <el-descriptions-item label="卷类型"><span v-if="item!=null"> <dict-tag :options="couponTypeOptions" :value="item.couponType"/></span></el-descriptions-item>
  18. <el-descriptions-item label="logo" v-if="item.logo">
  19. <template>
  20. <el-popover
  21. placement="right"
  22. title=""
  23. trigger="hover">
  24. <img slot="reference" :src="item.logo" width="50">
  25. <img :src="item.logo" style="max-width: 150px;">
  26. </el-popover>
  27. </template>
  28. </el-descriptions-item>
  29. <el-descriptions-item label="项目归属" v-if="item.projectId && (item.couponType === 5 || item.couponType === 6)">
  30. <dict-tag :options="projects" :value="item.projectId"/>
  31. </el-descriptions-item>
  32. </el-descriptions>
  33. </div>
  34. <!-- 积分商品展示 - 仅当优惠券类型为7时显示 -->
  35. <div class="contentx" v-if="item!=null && item.couponType === 7 && integralGoods">
  36. <div class="desct">免单积分商品</div>
  37. <el-table border width="100%" style="margin-top:5px;" :data="[integralGoods]">
  38. <el-table-column label="商品ID" align="center" prop="goodsId" />
  39. <el-table-column label="商品图片" align="center" width="100">
  40. <template slot-scope="scope">
  41. <el-popover
  42. placement="right"
  43. title=""
  44. trigger="hover">
  45. <img slot="reference" :src="scope.row.imgUrl" width="50" v-if="scope.row.imgUrl">
  46. <img :src="scope.row.imgUrl" style="max-width: 100px;" v-if="scope.row.imgUrl">
  47. <div v-else style="width: 50px; height: 50px; background-color: #f5f5f5; display: flex; align-items: center; justify-content: center;">
  48. <span style="color: #999; font-size: 12px;">无图片</span>
  49. </div>
  50. </el-popover>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="商品名称" show-overflow-tooltip align="center" prop="goodsName" />
  54. <el-table-column label="商品编号" align="center" prop="barCode" />
  55. <el-table-column label="所需积分" align="center" prop="integral" />
  56. <el-table-column label="商品价格" align="center" prop="cash">
  57. <template slot-scope="scope">
  58. <div v-if="scope.row.cash != null">
  59. {{scope.row.cash.toFixed(2)}}
  60. </div>
  61. <div v-else>-</div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="库存数量" align="center" prop="stock" />
  65. <el-table-column label="商品状态" align="center" prop="status">
  66. <template slot-scope="scope">
  67. <el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">
  68. {{scope.row.status === 1 ? '上架' : '下架'}}
  69. </el-tag>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. </div>
  74. <div class="contentx" v-if="item!=null">
  75. <div class="desct"> 优惠劵领取信息</div>
  76. <el-tabs type="card" v-model="actName" @tab-click="handleClickX">
  77. <el-tab-pane label="全部" name="10"></el-tab-pane>
  78. <el-tab-pane v-for="(item,index) in couponStatusOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  79. </el-tabs>
  80. <el-table v-loading="loading" :data="userCouponList">
  81. <el-table-column label="券号" align="center" prop="couponCode" />
  82. <el-table-column label="会员昵称" align="center" prop="nickName" />
  83. <!-- <el-table-column label="会员电话" align="center" prop="phone" /> -->
  84. <el-table-column label="关联订单ID" align="center" prop="businessId" />
  85. <el-table-column label="订单类型" align="center" prop="businessType">
  86. <template slot-scope="scope">
  87. <dict-tag :options="businessTypeOptions" :value="scope.row.businessType"/>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="状态" align="center" prop="status">
  91. <template slot-scope="scope">
  92. <dict-tag :options="couponStatusOptions" :value="scope.row.status"/>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="创建时间" align="center" prop="createTime" width="180"/>
  96. <el-table-column label="使用时间" align="center" prop="useTime" width="180"/>
  97. </el-table>
  98. <pagination
  99. v-show="total>0"
  100. :total="total"
  101. :page.sync="queryParams.pageNum"
  102. :limit.sync="queryParams.pageSize"
  103. @pagination="getList"
  104. />
  105. </div>
  106. </div>
  107. </template>
  108. <script>
  109. import { listCoupon, getCoupon, delCoupon, addCoupon, updateCoupon, exportCoupon } from "@/api/his/coupon";
  110. import { getListUserCoupon } from "@/api/his/userCoupon";
  111. import { getIntegralGoods } from "@/api/his/integralGoods";
  112. export default {
  113. name: "coupon",
  114. props:["data"],
  115. data() {
  116. return {
  117. actName:"10",
  118. couponId:null,
  119. item:null,
  120. statusOptions: [],
  121. couponTypeOptions: [],
  122. businessTypeOptions:[],
  123. couponStatusOptions:[],
  124. total: 0,
  125. loading: true,
  126. // 会员优惠券表格数据
  127. userCouponList: [],
  128. queryParams: {
  129. pageNum: 1,
  130. pageSize: 10,
  131. couponId: null,
  132. },
  133. // 积分商品数据
  134. integralGoods: null,
  135. // 项目数据
  136. projects: [],
  137. }
  138. },
  139. created() {
  140. this.getDicts("sys_coupon_type").then(response => {
  141. this.couponTypeOptions = response.data;
  142. });
  143. this.getDicts("sys_coupon_business_type").then(response => {
  144. this.businessTypeOptions = response.data;
  145. });
  146. this.getDicts("sys_company_status").then(response => {
  147. this.statusOptions = response.data;
  148. });
  149. this.getDicts("sys_coupon_status").then(response => {
  150. this.couponStatusOptions = response.data;
  151. });
  152. this.getDicts("sys_course_project").then(response => {
  153. this.projects = response.data || [];
  154. });
  155. },
  156. methods: {
  157. getList() {
  158. this.loading = true;
  159. getListUserCoupon(this.queryParams).then(response => {
  160. this.userCouponList = response.rows;
  161. this.total = response.total;
  162. this.loading = false;
  163. });
  164. },
  165. handleClickX(tab, event) {
  166. if(tab.name=="10"){
  167. this.queryParams.status=null;
  168. }else{
  169. this.queryParams.status=tab.name;
  170. }
  171. this.queryParams.pageNum = 1;
  172. this.couponId = this.queryParams.couponId;
  173. this.getList();
  174. },
  175. getDetails(orderId) {
  176. this.item=null;
  177. this.couponId = orderId;
  178. this.integralGoods = null;
  179. getCoupon(orderId).then(response => {
  180. this.item = response.data;
  181. this.queryParams.couponId = orderId;
  182. this.getList();
  183. // 如果优惠券类型为7(积分商品免单券),获取积分商品详情
  184. if (this.item.couponType === 7 && this.item.freeGoodsId) {
  185. this.getIntegralGoodsDetails(this.item.freeGoodsId);
  186. }
  187. });
  188. },
  189. /** 获取积分商品详情 */
  190. getIntegralGoodsDetails(goodsId) {
  191. getIntegralGoods(goodsId).then(response => {
  192. this.integralGoods = response.data;
  193. }).catch(error => {
  194. console.error("获取积分商品详情失败:", error);
  195. this.integralGoods = null;
  196. });
  197. },
  198. }
  199. }
  200. </script>
  201. <style>
  202. .contentx{
  203. height: 100%;
  204. background-color: #fff;
  205. padding: 0px 20px 20px;
  206. margin: 20px;
  207. }
  208. .el-descriptions-item__label.is-bordered-label{
  209. font-weight: normal;
  210. }
  211. .el-descriptions-item__content {
  212. max-width: 150px;
  213. min-width: 100px;
  214. }
  215. .desct{
  216. padding-top: 20px;
  217. padding-bottom: 20px;
  218. color: #524b4a;
  219. font-weight: bold;
  220. }
  221. </style>