coupons.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :span="4">
  8. <a-form-item label="">
  9. <a-input
  10. placeholder="免房券名称"
  11. v-model="queryParam.name"
  12. ></a-input>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="">
  17. <a-range-picker
  18. format="YYYY-MM-DD"
  19. :placeholder="['开始日期', '结束日期']"
  20. @change="onChange"
  21. v-model="datetime"
  22. />
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="8">
  26. <span
  27. style="float: left; overflow: hidden"
  28. class="table-page-search-submitButtons"
  29. >
  30. <a-button type="primary" @click="searchQuery" icon="search"
  31. >查询</a-button
  32. >
  33. <a-button
  34. type="primary"
  35. @click="searchReset"
  36. icon="reload"
  37. style="margin-left: 8px"
  38. >重置</a-button
  39. >
  40. </span>
  41. </a-col>
  42. </a-row>
  43. </a-form>
  44. </div>
  45. <!-- 查询区域-END -->
  46. <!-- 操作按钮区域 -->
  47. <div class="table-operator">
  48. <a-button @click="handleAdd" type="danger" icon="plus">新增</a-button>
  49. <!-- <a-button type="primary" icon="download" @click="handleExportXls('bus_market_coupons_info')">导出</a-button>
  50. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  51. <a-button type="primary" icon="import">导入</a-button>
  52. </a-upload> -->
  53. <!-- 高级查询区域 -->
  54. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  55. <a-dropdown v-if="selectedRowKeys.length > 0">
  56. <a-menu slot="overlay">
  57. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  58. </a-menu>
  59. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  60. </a-dropdown> -->
  61. </div>
  62. <!-- table区域-begin -->
  63. <div>
  64. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  65. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  66. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  67. </div> -->
  68. <a-table
  69. ref="table"
  70. size="middle"
  71. :scroll="{ x: true }"
  72. bordered
  73. rowKey="id"
  74. :columns="columns"
  75. :dataSource="dataSource"
  76. :pagination="ipagination"
  77. :loading="loading"
  78. :rowSelection="{
  79. selectedRowKeys: selectedRowKeys,
  80. onChange: onSelectChange,
  81. }"
  82. class="j-table-force-nowrap"
  83. @change="handleTableChange"
  84. >
  85. <template slot="htmlSlot" slot-scope="text">
  86. <div v-html="text"></div>
  87. </template>
  88. <template slot="imgSlot" slot-scope="text, record">
  89. <span v-if="!text" style="font-size: 12px; font-style: italic"
  90. >无图片</span
  91. >
  92. <img
  93. v-else
  94. :src="getImgView(text)"
  95. :preview="record.id"
  96. height="25px"
  97. alt=""
  98. style="max-width: 80px; font-size: 12px; font-style: italic"
  99. />
  100. </template>
  101. <template slot="fileSlot" slot-scope="text">
  102. <span v-if="!text" style="font-size: 12px; font-style: italic"
  103. >无文件</span
  104. >
  105. <a-button
  106. v-else
  107. :ghost="true"
  108. type="primary"
  109. icon="download"
  110. size="small"
  111. @click="downloadFile(text)"
  112. >
  113. 下载
  114. </a-button>
  115. </template>
  116. <span slot="action" slot-scope="text, record">
  117. <a @click="handleConfig(record)">详情</a>
  118. <a-divider type="vertical" />
  119. <a @click="handleProvide(record)">发放</a>
  120. <a-divider type="vertical" />
  121. <a @click="handleEdit(record)">编辑</a>
  122. <a-divider type="vertical" />
  123. <a @click="handleDelete(record.id)">删除</a>
  124. </span>
  125. </a-table>
  126. </div>
  127. <bus-market-coupons-modal
  128. ref="modalForm"
  129. @ok="modalFormOk"
  130. ></bus-market-coupons-modal>
  131. <bus-market-coupons-used-list-modal
  132. ref="modalCouponsUsedListModal"
  133. :couponsId="couponsId"
  134. ></bus-market-coupons-used-list-modal>
  135. <provide-index-modal
  136. ref="modalProvideIndexModal"
  137. :couponsId="couponsId"
  138. @ok="modalFormOk"
  139. ></provide-index-modal>
  140. </a-card>
  141. </template>
  142. <script>
  143. import "@/assets/less/TableExpand.less";
  144. import { mixinDevice } from "@/utils/mixin";
  145. import { JeecgListMixin } from "@/mixins/JeecgListMixin";
  146. import BusMarketCouponsModal from "./modules/coupons/BusMarketCouponsModal";
  147. import BusMarketCouponsUsedListModal from "./modules/coupons/BusMarketCouponsUsedListModal";
  148. import ProvideIndexModal from "./modules/couponsProvide/index";
  149. import { deleteAction } from "@/api/manage";
  150. export default {
  151. name: "coupons",
  152. mixins: [JeecgListMixin, mixinDevice],
  153. components: {
  154. BusMarketCouponsModal,
  155. BusMarketCouponsUsedListModal,
  156. ProvideIndexModal,
  157. },
  158. data() {
  159. return {
  160. couponsId: "",
  161. datetime: [],
  162. queryParam: {},
  163. description: "bus_market_coupons_info管理页面",
  164. // 表头
  165. columns: [
  166. // {
  167. // title: "#",
  168. // dataIndex: "",
  169. // key: "rowIndex",
  170. // width: 60,
  171. // align: "center",
  172. // customRender: function (t, r, index) {
  173. // return parseInt(index) + 1;
  174. // },
  175. // },
  176. // {
  177. // title: "关联租户",
  178. // align: "center",
  179. // dataIndex: "tenantId",
  180. // },
  181. {
  182. title: "商家",
  183. align: "center",
  184. dataIndex: "hotelName",
  185. },
  186. {
  187. title: "名称",
  188. align: "center",
  189. dataIndex: "name",
  190. },
  191. {
  192. title: "开始时间",
  193. align: "center",
  194. dataIndex: "startTime",
  195. customRender: function (text) {
  196. return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
  197. },
  198. },
  199. {
  200. title: "结束时间",
  201. align: "center",
  202. dataIndex: "endTime",
  203. customRender: function (text) {
  204. return !text ? "" : text.length > 10 ? text.substr(0, 10) : text;
  205. },
  206. },
  207. {
  208. title: "生成数量",
  209. align: "center",
  210. dataIndex: "count",
  211. },
  212. {
  213. title: "待领取",
  214. align: "center",
  215. dataIndex: "notClaimed",
  216. },
  217. {
  218. title: "已领取",
  219. align: "center",
  220. dataIndex: "received",
  221. },
  222. {
  223. title: "已使用",
  224. align: "center",
  225. dataIndex: "used",
  226. },
  227. {
  228. title: "已作废",
  229. align: "center",
  230. dataIndex: "voided",
  231. },
  232. {
  233. title: "每人可领取张数",
  234. align: "center",
  235. dataIndex: "klqzs",
  236. },
  237. {
  238. title: "操作",
  239. dataIndex: "action",
  240. align: "center",
  241. fixed: "right",
  242. width: 147,
  243. scopedSlots: { customRender: "action" },
  244. },
  245. ],
  246. url: {
  247. list: "/business/busMarketCoupons/list",
  248. delete: "/business/busMarketCoupons/delete",
  249. deleteBatch: "/business/busMarketCoupons/deleteBatch",
  250. exportXlsUrl: "/business/busMarketCoupons/exportXls",
  251. importExcelUrl: "business/busMarketCoupons/importExcel",
  252. },
  253. dictOptions: {},
  254. superFieldList: [],
  255. };
  256. },
  257. created() {
  258. // this.getSuperFieldList();
  259. },
  260. computed: {
  261. importExcelUrl: function () {
  262. return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
  263. },
  264. },
  265. methods: {
  266. handleDelete: function (id) {
  267. if (!this.url.delete) {
  268. this.$message.error("请设置url.delete属性!");
  269. return;
  270. }
  271. var that = this;
  272. this.$confirm({
  273. title: "确认删除",
  274. content: "是否删除?",
  275. onOk: function () {
  276. deleteAction(that.url.delete, { id: id }).then((res) => {
  277. if (res.success) {
  278. //重新计算分页问题
  279. that.reCalculatePage(1);
  280. that.$message.success(res.message);
  281. that.loadData();
  282. } else {
  283. that.$message.warning(res.message);
  284. }
  285. });
  286. },
  287. onCancel: function () {},
  288. });
  289. },
  290. handleProvide(item) {
  291. this.couponsId = item.id;
  292. this.$refs.modalProvideIndexModal.visible = true;
  293. this.$refs.modalProvideIndexModal.title = "发放";
  294. this.$refs.modalProvideIndexModal.disableSubmit = true;
  295. },
  296. handleConfig(item) {
  297. this.couponsId = item.id;
  298. // this.$refs.modalCouponsUsedListModal.eventId = item.id;
  299. this.$refs.modalCouponsUsedListModal.visible = true;
  300. this.$refs.modalCouponsUsedListModal.title = "详情";
  301. this.$refs.modalCouponsUsedListModal.disableSubmit = true;
  302. this.$refs.modalCouponsUsedListModal.add(item.id);
  303. },
  304. searchReset() {
  305. this.datetime =[];
  306. this.queryParam = {};
  307. this.loadData(1);
  308. },
  309. onChange(e, dateString) {
  310. // console.log("Selected Time: ", e);
  311. // console.log("Formatted Selected Time: ", dateString);
  312. this.queryParam.startTime = dateString[0];
  313. this.queryParam.endTime = dateString[1];
  314. },
  315. initDictConfig() {},
  316. getSuperFieldList() {
  317. let fieldList = [];
  318. fieldList.push({ type: "string", value: "tenantId", text: "关联租户" });
  319. fieldList.push({ type: "string", value: "hotelId", text: "关联酒店" });
  320. fieldList.push({ type: "string", value: "name", text: "名称" });
  321. fieldList.push({ type: "date", value: "startTime", text: "开始时间" });
  322. fieldList.push({ type: "date", value: "endTime", text: "结束时间" });
  323. fieldList.push({ type: "string", value: "tenantId", text: "适用房型" });
  324. fieldList.push({ type: "int", value: "klqzs", text: "可领取张数" });
  325. fieldList.push({ type: "string", value: "type", text: "类型" });
  326. fieldList.push({ type: "string", value: "introduce", text: "说明" });
  327. fieldList.push({ type: "int", value: "lqNum", text: "领取数量" });
  328. fieldList.push({ type: "string", value: "ruleDec", text: "使用说明" });
  329. this.superFieldList = fieldList;
  330. },
  331. },
  332. };
  333. </script>
  334. <style scoped>
  335. @import "~@assets/less/common.less";
  336. </style>