BusMemberCardList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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="6">
  8. <a-form-item label="">
  9. <j-input
  10. placeholder="会员名称"
  11. v-model="queryParam.name"
  12. ></j-input>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="">
  17. <j-input
  18. placeholder="会员手机号"
  19. v-model="queryParam.mobile"
  20. ></j-input>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="8">
  24. <span
  25. style="float: left; overflow: hidden"
  26. class="table-page-search-submitButtons"
  27. >
  28. <a-button type="primary" @click="searchQuery" icon="search"
  29. >查询</a-button
  30. >
  31. <!-- <a-input-number
  32. style="margin-left: 8px"
  33. v-model="num"
  34. :min="1"
  35. :max="10"
  36. />
  37. <a-button
  38. @click="handleAdd"
  39. type="danger"
  40. :disabled="selectedRowKeys.length <= 0"
  41. >发放</a-button
  42. > -->
  43. <a-input-search
  44. style="width: 200px; margin-left: 8px"
  45. placeholder="请输入每人发放张数"
  46. enter-button="发放"
  47. v-model="num"
  48. type="danger"
  49. :disabled="selectedRowKeys.length <= 0"
  50. @search="handleAdd"
  51. />
  52. </span>
  53. </a-col>
  54. </a-row>
  55. </a-form>
  56. </div>
  57. <!-- 查询区域-END -->
  58. <!-- table区域-begin -->
  59. <div>
  60. <a-table
  61. ref="table"
  62. size="middle"
  63. :scroll="{ x: true }"
  64. bordered
  65. rowKey="id"
  66. :columns="columns"
  67. :dataSource="dataSource"
  68. :pagination="ipagination"
  69. :loading="loading"
  70. :rowSelection="{
  71. selectedRowKeys: selectedRowKeys,
  72. onChange: onSelectChange,
  73. }"
  74. class="j-table-force-nowrap"
  75. @change="handleTableChange"
  76. >
  77. <template slot="avatar" slot-scope="text">
  78. <a-avatar v-if="text" :src="text" />
  79. <a-avatar v-else icon="user" />
  80. </template>
  81. <template slot="imgSlot" slot-scope="text, record">
  82. <span v-if="!text" style="font-size: 12px; font-style: italic"
  83. >无图片</span
  84. >
  85. <img
  86. v-else
  87. :src="getImgView(text)"
  88. :preview="record.id"
  89. height="25px"
  90. alt=""
  91. style="max-width: 80px; font-size: 12px; font-style: italic"
  92. />
  93. </template>
  94. <template slot="fileSlot" slot-scope="text">
  95. <span v-if="!text" style="font-size: 12px; font-style: italic"
  96. >无文件</span
  97. >
  98. <a-button
  99. v-else
  100. :ghost="true"
  101. type="primary"
  102. icon="download"
  103. size="small"
  104. @click="downloadFile(text)"
  105. >
  106. 下载
  107. </a-button>
  108. </template>
  109. <span slot="action" slot-scope="text, record">
  110. <a @click="handleEdit(record)">编辑</a>
  111. <a-divider type="vertical" />
  112. <a-dropdown>
  113. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  114. <a-menu slot="overlay">
  115. <a-menu-item>
  116. <a @click="handleDetail(record)">详情</a>
  117. </a-menu-item>
  118. <a-menu-item>
  119. <a-popconfirm
  120. title="确定删除吗?"
  121. @confirm="() => handleDelete(record.id)"
  122. >
  123. <a>删除</a>
  124. </a-popconfirm>
  125. </a-menu-item>
  126. </a-menu>
  127. </a-dropdown>
  128. </span>
  129. </a-table>
  130. </div>
  131. </a-card>
  132. </template>
  133. <script>
  134. import "@/assets/less/TableExpand.less";
  135. import { mixinDevice } from "@/utils/mixin";
  136. import { JeecgListMixin } from "@/mixins/JeecgListMixin";
  137. import { httpAction } from "@/api/manage";
  138. export default {
  139. name: "BusMemberCardList",
  140. mixins: [JeecgListMixin, mixinDevice],
  141. props: {
  142. couponsId: {
  143. type: String,
  144. default: "",
  145. },
  146. couponsType: {
  147. type: Number,
  148. default: 1,
  149. },
  150. },
  151. data() {
  152. const hotelInfo = JSON.parse(localStorage.getItem("storeInfo"));
  153. return {
  154. hotelId: "",
  155. num: 1,
  156. description: "bus_member_card管理页面",
  157. // 表头
  158. columns: [
  159. {
  160. title: "商家",
  161. align: "center",
  162. dataIndex: "hotelName",
  163. },
  164. {
  165. title: "头像",
  166. align: "center",
  167. dataIndex: "avatar",
  168. scopedSlots: { customRender: "avatar" },
  169. },
  170. {
  171. title: "会员姓名",
  172. align: "center",
  173. dataIndex: "name",
  174. },
  175. {
  176. title: "手机号",
  177. align: "center",
  178. dataIndex: "mobile",
  179. },
  180. {
  181. title: "性别",
  182. align: "center",
  183. dataIndex: "sex",
  184. customRender: function (text) {
  185. return text === 1 ? "男" : "女";
  186. },
  187. },
  188. {
  189. title: "会员卡号",
  190. align: "center",
  191. dataIndex: "cardNo",
  192. },
  193. {
  194. title: "等级类型",
  195. align: "center",
  196. dataIndex: "gradeName",
  197. },
  198. {
  199. title: "证件号",
  200. align: "center",
  201. dataIndex: "certificateNo",
  202. },
  203. {
  204. title: "推荐员工",
  205. align: "center",
  206. dataIndex: "staffId",
  207. },
  208. {
  209. title: "可用积分",
  210. align: "center",
  211. dataIndex: "integral",
  212. },
  213. {
  214. title: "可用余额",
  215. align: "center",
  216. dataIndex: "balance",
  217. },
  218. // {
  219. // title: '操作',
  220. // dataIndex: 'action',
  221. // align:"center",
  222. // fixed:"right",
  223. // width:147,
  224. // scopedSlots: { customRender: 'action' }
  225. // }
  226. ],
  227. url: {
  228. list:
  229. hotelInfo && hotelInfo.id
  230. ? "/business/busMemberCard/list?hotelId=" + hotelInfo.id
  231. : "/business/busMemberCard/list",
  232. delete: "/business/busMemberCard/delete",
  233. deleteBatch: "/business/busMemberCard/deleteBatch",
  234. exportXlsUrl: "/business/busMemberCard/exportXls",
  235. importExcelUrl: "business/busMemberCard/importExcel",
  236. },
  237. dictOptions: {},
  238. superFieldList: [],
  239. };
  240. },
  241. created() {
  242. this.getSuperFieldList();
  243. },
  244. computed: {
  245. importExcelUrl: function () {
  246. return `${window._CONFIG["domianURL"]}/${this.url.importExcelUrl}`;
  247. },
  248. },
  249. methods: {
  250. handleAdd() {
  251. if (this.selectedRowKeys.length <= 0) {
  252. this.$message.warning("请选择一条记录!");
  253. return;
  254. }
  255. if (this.num <= 0) {
  256. this.$message.warning("发放数量不能小于0!");
  257. return;
  258. }
  259. var that = this;
  260. that.confirmLoading = true;
  261. var url = "/business/busMarketCouponsUsed/gainCouponsUsedToMember";
  262. if (this.couponsType === 2) {
  263. url = "/business/busMarketCouponsCashUsed/gainCouponsCashUsedToMember";
  264. }
  265. httpAction(
  266. url,
  267. {
  268. couponsId: this.couponsId,
  269. num: this.num,
  270. memberIds: this.selectedRowKeys,
  271. },
  272. "post"
  273. )
  274. .then((res) => {
  275. if (res.success) {
  276. that.$message.success(res.message);
  277. that.$emit("ok");
  278. } else {
  279. that.$message.warning(res.message);
  280. }
  281. })
  282. .finally(() => {
  283. that.confirmLoading = false;
  284. });
  285. },
  286. initDictConfig() {},
  287. getSuperFieldList() {
  288. let fieldList = [];
  289. fieldList.push({ type: "string", value: "tenantId", text: "关联租户" });
  290. fieldList.push({ type: "string", value: "hotelId", text: "关联酒店" });
  291. fieldList.push({ type: "string", value: "mobile", text: "手机号" });
  292. fieldList.push({ type: "string", value: "cardNo", text: "会员卡号" });
  293. fieldList.push({ type: "string", value: "cardInnerNo", text: "卡内码" });
  294. fieldList.push({ type: "string", value: "gradeId", text: "等级类型" });
  295. fieldList.push({ type: "number", value: "memberFee", text: "会员费" });
  296. fieldList.push({ type: "int", value: "payType", text: "付款类型" });
  297. fieldList.push({ type: "int", value: "paymentMethod", text: "付款方式" });
  298. fieldList.push({ type: "string", value: "name", text: "会员姓名" });
  299. fieldList.push({ type: "string", value: "avatar", text: "头像" });
  300. fieldList.push({ type: "int", value: "sex", text: "性别" });
  301. fieldList.push({
  302. type: "int",
  303. value: "certificateType",
  304. text: "证件类型",
  305. });
  306. fieldList.push({
  307. type: "string",
  308. value: "certificateNo",
  309. text: "证件号",
  310. });
  311. fieldList.push({ type: "string", value: "address", text: "地址" });
  312. fieldList.push({
  313. type: "string",
  314. value: "consumePassword",
  315. text: "消费密码",
  316. });
  317. fieldList.push({ type: "int", value: "validity", text: "有效期" });
  318. fieldList.push({
  319. type: "date",
  320. value: "validityEndTime",
  321. text: "有效期截止日期",
  322. });
  323. fieldList.push({ type: "string", value: "remark", text: "备注" });
  324. fieldList.push({ type: "string", value: "staffId", text: "推荐员工" });
  325. fieldList.push({ type: "int", value: "integral", text: "可用积分" });
  326. fieldList.push({ type: "number", value: "balance", text: "可用余额" });
  327. this.superFieldList = fieldList;
  328. },
  329. },
  330. };
  331. </script>
  332. <style scoped>
  333. @import "~@assets/less/common.less";
  334. /deep/ .ant-input-search-button {
  335. background-color: #ff4d4f;
  336. border-color: #ff4d4f;
  337. }
  338. /deep/ .ant-input-search-button[disabled]:hover {
  339. opacity: 0.7;
  340. background-color: #ff4d4f;
  341. border-color: #ff4d4f;
  342. }
  343. /deep/ .ant-input-search-button[disabled] {
  344. opacity: 0.7;
  345. color: #ffffff;
  346. }
  347. </style>