index.html 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. {include file="/shopro/common/script" /}
  2. <style>
  3. .coupon-index .card {
  4. height: 80px;
  5. background: var(--sa-background-assist);
  6. border: 1px solid var(--sa-space);
  7. box-shadow: 0px 2px 6px rgba(140, 140, 140, 0.12);
  8. border-radius: 8px;
  9. padding: 16px;
  10. margin-bottom: 16px;
  11. }
  12. .coupon-index .card .num {
  13. font-weight: 400;
  14. font-size: 24px;
  15. line-height: 26px;
  16. color: var(--sa-subfont);
  17. }
  18. .coupon-index .card .oper {
  19. font-weight: 400;
  20. font-size: 12px;
  21. line-height: 14px;
  22. color: #FAAD14;
  23. cursor: pointer;
  24. }
  25. .coupon-index .card .name {
  26. font-weight: 400;
  27. font-size: 12px;
  28. line-height: 14px;
  29. color: var(--sa-font);
  30. }
  31. .coupon-index .card .tip {
  32. font-size: 14px;
  33. color: var(--sa-subfont);
  34. }
  35. .coupon-index .sa-title {
  36. padding-top: 0;
  37. }
  38. </style>
  39. <div id="index" class="coupon-index panel panel-default panel-intro" v-cloak>
  40. <el-container class="panel-block">
  41. <el-header class="sa-header">
  42. <el-row class="mt-4" :gutter="20">
  43. <el-col v-for="(value,key) in state.dashboard" :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
  44. <div class="card">
  45. <div class="sa-flex sa-row-between mb-1">
  46. <div class="num">{{value.num}}</div>
  47. </div>
  48. <div class="sa-flex sa-row-between">
  49. <div class="name">{{value.name}}</div>
  50. <el-popover popper-class="sa-popper" trigger="hover">
  51. {{value.tip}}
  52. <template #reference>
  53. <el-icon class="tip">
  54. <warning />
  55. </el-icon>
  56. </template>
  57. </el-popover>
  58. </div>
  59. </div>
  60. </el-col>
  61. </el-row>
  62. <div class="sa-title sa-flex sa-row-between">
  63. <div class="sa-title-left">
  64. <div class="left-name">优惠券</div>
  65. <sa-filter-condition v-model="state.filter" @filter-delete="onChangeFilter">
  66. </sa-filter-condition>
  67. </div>
  68. <div class="sa-title-right">
  69. <el-button class="sa-button-refresh" icon="RefreshRight" @click="getData"></el-button>
  70. <el-button class="sa-button-refresh" icon="Search" @click="onOpenFilter"></el-button>
  71. {if $auth->check('shopro/coupon/add')}
  72. <el-button icon="Plus" type="primary" @click="onAdd">添加</el-button>
  73. {/if}
  74. {if $auth->check('shopro/coupon/recyclebin')}
  75. <el-button type="danger" icon="Delete" plain @click="onRecyclebin">回收站</el-button>
  76. {/if}
  77. </div>
  78. </div>
  79. </el-header>
  80. <el-main class="sa-main">
  81. <el-table height="100%" class="sa-table" :data="state.data" stripe @sort-change="onChangeSort">
  82. <el-table-column prop="id" label="ID" min-width="90" sortable="custom"> </el-table-column>
  83. <el-table-column label="优惠券名称" min-width="172">
  84. <template #default="scope">
  85. <div class="sa-table-line-1">{{ scope.row.name }}</div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="类型" min-width="74">
  89. <template #default="scope">
  90. <div class="sa-table-line-1">{{ scope.row.type_text }}</div>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="可用范围" min-width="116">
  94. <template #default="scope">
  95. <div class="sa-table-line-1">{{ scope.row.use_scope_text }}</div>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="优惠内容" min-width="214">
  99. <template #default="scope">
  100. <div class="sa-table-line-1">{{ scope.row.amount_text }}</div>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="领取状态" min-width="80">
  104. <template #default="scope">
  105. <el-popover popper-class="sa-popper" placement="bottom" title="优惠券有效期" trigger="hover">
  106. <div v-if="scope.row.use_time_type == 'days'">
  107. 领取{{ scope.row.start_days }}天后生效,有效期{{ scope.row.days }}天
  108. </div>
  109. <div v-if="scope.row.use_time_type == 'range'">
  110. <div>开始时间:{{ scope.row.use_start_time }}</div>
  111. <div>结束时间:{{ scope.row.use_end_time }}</div>
  112. </div>
  113. <template #reference>
  114. <div class="sa-table-line-1 get-time-text" :class="
  115. scope.row.get_time_status == 'ing'
  116. ? 'sa-color--success'
  117. : scope.row.get_time_status == 'ended'
  118. ? 'sa-color--danger'
  119. : 'sa-color--info'
  120. ">
  121. {{ scope.row.get_time_text }}
  122. </div>
  123. </template>
  124. </el-popover>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="已领取" min-width="96">
  128. <template #default="scope">
  129. <div class="sa-table-line-1">{{ scope.row.get_num }}</div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="已使用" min-width="96">
  133. <template #default="scope">
  134. <div class="sa-table-line-1">{{ scope.row.use_num }}</div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="剩余" min-width="96">
  138. <template #default="scope">
  139. <div class="sa-table-line-1">{{ scope.row.stock }}</div>
  140. </template>
  141. </el-table-column>
  142. <!--<el-table-column label="状态" min-width="130">
  143. <template #default="scope">
  144. {if $auth->check('shopro/coupon/edit')}
  145. <el-dropdown trigger="click" @command="onCommand">
  146. <el-button link>
  147. <el-tag type="info">
  148. {{ scope.row.status_text }}
  149. <el-icon>
  150. <arrow-down />
  151. </el-icon>
  152. </el-tag>
  153. </el-button>
  154. <template #dropdown>
  155. <el-dropdown-menu>
  156. <el-dropdown-item :command="{
  157. id: scope.row.id,
  158. type: 'normal',
  159. }">公开发放</el-dropdown-item>
  160. <el-dropdown-item :command="{
  161. id: scope.row.id,
  162. type: 'hidden',
  163. }">后台发放</el-dropdown-item>
  164. <el-dropdown-item :command="{
  165. id: scope.row.id,
  166. type: 'disabled',
  167. }">禁止使用</el-dropdown-item>
  168. </el-dropdown-menu>
  169. </template>
  170. </el-dropdown>
  171. {/if}
  172. </template>
  173. </el-table-column>-->
  174. <el-table-column label="操作" min-width="260" fixed="right">
  175. <template #default="scope">
  176. {if $auth->check('shopro/coupon/send')}
  177. <el-button type="primary" link @click="onSend(scope.row.id)">手动发放</el-button>
  178. {/if}
  179. {if $auth->check('shopro/user/coupon/index')}
  180. <el-button type="primary" link @click="onCoupon(scope.row.id)">领取记录</el-button>
  181. {/if}
  182. {if $auth->check('shopro/coupon/edit')}
  183. <el-button type="primary" link @click="onEdit(scope.row.id)">编辑</el-button>
  184. {/if}
  185. <el-popconfirm width="fit-content" confirm-button-text="确认" cancel-button-text="取消"
  186. title="确认删除这条记录?" @confirm="onDelete(scope.row.id)">
  187. <template #reference>
  188. {if $auth->check('shopro/coupon/delete')}
  189. <el-button type="danger" link>删除</el-button>
  190. {/if}
  191. </template>
  192. </el-popconfirm>
  193. </template>
  194. </el-table-column>
  195. </el-table>
  196. </el-main>
  197. <el-footer class="sa-footer sa-flex sa-row-right">
  198. <sa-pagination v-model="pagination" @pagination-change="getData"></sa-pagination>
  199. </el-footer>
  200. </el-container>
  201. <sa-filter v-model="state.filter" @filter-change="onChangeFilter"></sa-filter>
  202. </div>