promoCode.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="warp">
  3. <view class="font">
  4. <uni-list class="font">
  5. <uni-list-item title="购买优惠码" @click="buy()" />
  6. </uni-list>
  7. </view>
  8. <view class="box">
  9. <view class="font">优惠码列表</view>
  10. <view class="header">
  11. <view class="nickname">
  12. 筛选条件:
  13. </view>
  14. <!-- <view class="header"> -->
  15. <view class="nickname">
  16. 状态:
  17. </view>
  18. <view style="width: 20%; margin-bottom: 2px;padding-top: 2upx; ">
  19. <xfl-select :list="list" :clearable="false" :showItemNum="4" :focusShowList="true" :isCanInput="false"
  20. :style_Container="'height: 18px;font-size: 13px;'" :placeholder="''" :initValue="'全部'" :selectHideType="'hideAll'"
  21. @change="change">
  22. </xfl-select>
  23. </view>
  24. <!-- </view> -->
  25. </view>
  26. <t-table @change="change">
  27. <t-tr>
  28. <t-th>优惠码</t-th>
  29. <t-th>到期时间</t-th>
  30. <t-th>状态</t-th>
  31. <t-th>使用时间</t-th>
  32. <t-th>使用机器</t-th>
  33. </t-tr>
  34. <t-tr v-for="item in tableList" :key="item.id">
  35. <t-td>{{ item.code}}</t-td>
  36. <t-td>{{ item.lastUseDate}}</t-td>
  37. <t-td>{{ item.isUse=='0'?'未使用':item.isUse=='1'?'已使用':item.isUse=='2'?'已过期':''}}</t-td>
  38. <t-td>{{ item.useDate}}</t-td>
  39. <t-td>{{ item.useBy}}</t-td>
  40. </t-tr>
  41. </t-table>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import tTable from '@/components/t-table/t-table.vue';
  47. import tTh from '@/components/t-table/t-th.vue';
  48. import tTr from '@/components/t-table/t-tr.vue';
  49. import tTd from '@/components/t-table/t-td.vue';
  50. import xflSelect from '@/components/xfl-select/xfl-select.vue';
  51. import uniList from '@/components/uni-list/uni-list.vue';
  52. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  53. export default {
  54. components: {
  55. uniList,
  56. uniListItem,
  57. tTable,
  58. tTh,
  59. tTr,
  60. tTd,
  61. xflSelect
  62. },
  63. data() {
  64. return {
  65. tableList: [],
  66. list: [ //要展示的数据
  67. '全部',
  68. '未使用',
  69. '使用',
  70. '已过期',
  71. ],
  72. };
  73. },
  74. onShow() {
  75. this.init();
  76. },
  77. methods: {
  78. buy() {
  79. uni.navigateTo({
  80. url: 'buyPromo',
  81. });
  82. },
  83. init() {
  84. var globalUser = uni.getStorageSync("globalUser");
  85. var id = globalUser.id;
  86. uni.request({
  87. url: this.serverurl + '/TPromoCode/findList',
  88. data: {
  89. "adminId": id,
  90. },
  91. method: "POST",
  92. success: (res) => {
  93. this.tableList = res.data.data;
  94. }
  95. })
  96. },
  97. change({
  98. newVal,
  99. oldVal,
  100. index,
  101. orignItem
  102. }) {
  103. this.tableList=null;
  104. if(index==0){
  105. var isUse = null;
  106. }
  107. if(index==1){
  108. var isUse = 0;
  109. }
  110. if(index==2){
  111. var isUse = 1;
  112. }
  113. if(index==3){
  114. var isUse = 2;
  115. }
  116. var globalUser = uni.getStorageSync("globalUser");
  117. var id = globalUser.id;
  118. uni.request({
  119. url: this.serverurl + '/TPromoCode/findList',
  120. data: {
  121. "adminId": id,
  122. "isUse":isUse
  123. },
  124. method: "POST",
  125. success: (res) => {
  126. this.tableList = res.data.data;
  127. }
  128. })
  129. }
  130. }
  131. };
  132. </script>
  133. <style>
  134. .header {
  135. display: flex;
  136. flex-direction: row;
  137. justify-content: flex-start;
  138. padding-left: 10upx;
  139. }
  140. .nickname {
  141. padding-left: 10upx;
  142. height: 32upx;
  143. color: #363D44;
  144. font-size: 32upx;
  145. font-family: "PingFang-SC-Bold";
  146. }
  147. .font{
  148. color: #363D44;
  149. font-size: 36upx;
  150. font-family: "PingFang-SC-Bold";
  151. }
  152. </style>