You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

535 lines
19 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <el-card>
  4. <div class="publiccss">会员卡登记</div>
  5. <div style="display: flex;margin-top:20px">
  6. <div :style="'display: block; width:' + (window.pageWidth - 120 - 80) + 'px;'">
  7. <div style="display: flex; flex-wrap: wrap; height:70px;">
  8. <div class="query">
  9. <el-select v-model="query.dateType" placeholder="请选择" filterable size="small"
  10. style="width: 90px">
  11. <el-option label="登记日期" value="createDate" />
  12. <el-option label="有效日期" value="expiryDate" />
  13. </el-select>
  14. <el-date-picker v-model="query.startDate" type="date" placeholder="起始日期" size="small" style="width: 100px" />
  15. <span>--</span>
  16. <el-date-picker v-model="query.endDate" type="date" placeholder="截止日期" size="small" style="width: 100px"/>
  17. </div>
  18. <div class="query">
  19. <span>卡类别</span>
  20. <el-select v-model="query.cardTypeId" placeholder="请选择" clearable size="small"
  21. style="width: 80px">
  22. <el-option v-for="item in dict.cardType" :key="item.id" :label="item.displayName" :value="item.id" />
  23. </el-select>
  24. </div>
  25. <div class="query">
  26. <span>卡状态</span>
  27. <!--
  28. <el-radio-group v-model="query.cardFlag">
  29. <el-radio :label="1">启用</el-radio>
  30. <el-radio :label="0">停用</el-radio>
  31. </el-radio-group>
  32. -->
  33. <el-select v-model="query.cardFlag" placeholder="请选择" clearable size="small"
  34. style="width: 80px">
  35. <el-option label="启用" value="1" />
  36. <el-option label="停用" value="0" />
  37. </el-select>
  38. </div>
  39. <div class="query">
  40. <span>卡号</span>
  41. <el-input placeholder="卡号" v-model="query.cardNo" size="small" clearable style="width: 120px" />
  42. </div>
  43. <div class="query">
  44. <span>卡主姓名</span>
  45. <el-input placeholder="卡主姓名" v-model="query.customerName" size="small" clearable style="width: 80px" />
  46. </div>
  47. <div class="query">
  48. <span>身份证号</span>
  49. <el-input placeholder="身份证号" v-model="query.idNo" size="small" clearable style="width: 180px" />
  50. </div>
  51. <div class="query">
  52. <span>电话</span>
  53. <el-input placeholder="手机号/电话" v-model="query.mobileTelephone" size="small" clearable style="width: 120px" />
  54. </div>
  55. </div>
  56. <el-table :data="dataList" border width="100%" :height="window.pageHeight < 600 ? 160 : window.pageHeight - 440"
  57. row-key="id" size="small" highlight-current-row ref="dataList" @selection-change="handleSelectionChange"
  58. @row-click="rowClick">
  59. <el-table-column prop="cardTypeId" label="卡类别" width="100">
  60. <template slot-scope="scope">
  61. <div>{{ dddw(dict.cardType, "id", scope.row.cardTypeId, "displayName") }}</div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="cardNo" label="会员卡号" width="150" />
  65. <el-table-column prop="discount" label="折扣率" width="80" />
  66. <el-table-column prop="expiryDate" label="有效期限" width="120">
  67. <template slot-scope="scope">
  68. <div v-if="scope.row.expiryDate">
  69. {{ moment(scope.row.expiryDate).format("yyyy-MM-DD") }}
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="customerName" label="卡主姓名" width="80" />
  74. <el-table-column prop="idNo" label="卡主身份证号" width="200" />
  75. <el-table-column prop="telephone" label="卡主电话" width="150" />
  76. <el-table-column prop="mobileTelephone" label="卡主手机号" width="150" />
  77. <el-table-column prop="cardFlag" label="启用" width="80">
  78. <template slot-scope="scope">
  79. <div>{{ scope.row.cardFlag == '0' ? '否' : '是' }}</div>
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="remark" label="备注" width="200" />
  83. <el-table-column prop="creatorName" label="创建人员" width="100" />
  84. <el-table-column prop="creationTime" label="创建日期" width="150">
  85. <template slot-scope="scope">
  86. <div v-if="scope.row.creationTime">
  87. {{ moment(scope.row.creationTime).format("yyyy-MM-DD") }}
  88. </div>
  89. </template>
  90. </el-table-column>
  91. <el-table-column prop="lastModifierName" label="修改人员" width="100" />
  92. <el-table-column prop="lastModificationTime" label="修改日期" width="150">
  93. <template slot-scope="scope">
  94. <div v-if="scope.row.lastModificationTime">
  95. {{ moment(scope.row.lastModificationTime).format("yyyy-MM-DD") }}
  96. </div>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <el-table :data="cardBillList" border width="100%" height="170" row-key="id" size="small" highlight-current-row
  101. ref="dataList" @selection-change="handleSelectionChange" @row-click="rowClick">
  102. <el-table-column prop="cardNo" label="会员卡号" width="150" />
  103. <el-table-column prop="customerName" label="卡主姓名" width="80" />
  104. <el-table-column prop="mobileTelephone" label="手机号" width="150" />
  105. <el-table-column prop="payModeId" label="支付方式" width="100">
  106. <template slot-scope="scope">
  107. <div>{{ dddw(dict.payMode, "id", scope.row.payModeId, "displayName") }}</div>
  108. </template>
  109. </el-table-column>
  110. <el-table-column prop="billMoney" label="记账金额" width="80" />
  111. <el-table-column prop="billFlag" label="记账标志" width="100">
  112. <template slot-scope="scope">
  113. <div>{{ dddw(dict.billFlag, "id", scope.row.billFlag, "displayName") }}</div>
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="creatorName" label="创建人员" width="100" />
  117. <el-table-column prop="creationTime" label="创建日期" width="150">
  118. <template slot-scope="scope">
  119. <div v-if="scope.row.creationTime">
  120. {{ moment(scope.row.creationTime).format("yyyy-MM-DD") }}
  121. </div>
  122. </template>
  123. </el-table-column>
  124. <el-table-column prop="lastModifierName" label="修改人员" width="100" />
  125. <el-table-column prop="lastModificationTime" label="修改日期" width="150">
  126. <template slot-scope="scope">
  127. <div v-if="scope.row.lastModificationTime">
  128. {{ moment(scope.row.lastModificationTime).format("yyyy-MM-DD") }}
  129. </div>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. </div>
  134. <div style=" margin-left: 10px;width:110px;">
  135. <div class="listBtn">
  136. <el-button class="btnClass" @click="btnQuery">查询</el-button>
  137. </div>
  138. <div class="listBtn">
  139. <el-button type="success" class="btnClass" @click="add">新增</el-button>
  140. </div>
  141. <div class="listBtn">
  142. <el-button type="primary" class="btnClass" @click="edit">编辑</el-button>
  143. </div>
  144. <div class="listBtn">
  145. <el-button type="danger" class="btnClass" @click="edit">删除</el-button>
  146. </div>
  147. </div>
  148. </div>
  149. </el-card>
  150. <el-dialog :title="form.id ? '编辑' : '新增'" :visible.sync="dialogVisible" width="800px" :close-on-click-modal="false">
  151. <el-form ref="form" :model="form" label-width="100px" :rules="rules" size="small">
  152. <el-row>
  153. <el-col :span="8">
  154. <el-form-item label="卡类别" prop="cardTypeId">
  155. <el-select v-model="form.cardTypeId" placeholder="请选择" filterable>
  156. <el-option v-for="item in dict.cardType" :key="item.id" :label="item.displayName" :value="item.id" />
  157. </el-select>
  158. </el-form-item>
  159. </el-col>
  160. <el-col :span="8">
  161. <el-form-item label="会员卡号" prop="cardNo">
  162. <el-input v-model="form.cardNo" />
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="8">
  166. <el-form-item label="折扣率" prop="discount">
  167. <el-input type="number" v-model="form.discount" />
  168. </el-form-item>
  169. </el-col>
  170. </el-row>
  171. <el-row>
  172. <el-col :span="8">
  173. <el-form-item label="有效期限" prop="expiryDate">
  174. <el-input type="date" v-model="form.expiryDate" />
  175. </el-form-item>
  176. </el-col>
  177. <el-col :span="8">
  178. <el-form-item label="卡主姓名" prop="customerName">
  179. <el-input v-model="form.customerName" />
  180. </el-form-item>
  181. </el-col>
  182. <el-col :span="8">
  183. <el-form-item label="卡主身份证" prop="idNo">
  184. <el-input v-model="form.idNo" />
  185. </el-form-item>
  186. </el-col>
  187. </el-row>
  188. <el-row>
  189. <el-col :span="8">
  190. <el-form-item label="卡主电话" prop="telephone">
  191. <el-input type="tel" v-model="form.telephone" />
  192. </el-form-item>
  193. </el-col>
  194. <el-col :span="8">
  195. <el-form-item label="卡主手机号" prop="mobileTelephone">
  196. <el-input type="tel" v-model="form.mobileTelephone" />
  197. </el-form-item>
  198. </el-col>
  199. <el-col :span="8">
  200. <el-form-item label="启用" prop="cardFlag">
  201. <el-radio v-model="form.cardFlag" label="1"></el-radio>
  202. <el-radio v-model="form.cardFlag" label="0"></el-radio>
  203. </el-form-item>
  204. </el-col>
  205. </el-row>
  206. <el-row>
  207. <el-col :span="24">
  208. <el-form-item label="备注" prop="remark">
  209. <el-input v-model="form.remark" />
  210. </el-form-item>
  211. </el-col>
  212. </el-row>
  213. <el-row>
  214. <el-col :span="6">
  215. <el-form-item label="创建人员" label-width="80px">
  216. <el-input v-model="form.creatorId" disabled></el-input>
  217. </el-form-item>
  218. </el-col>
  219. <el-col :span="6">
  220. <el-form-item label="创建时间" label-width="80px">
  221. <el-input :value="form.creationTime ? moment(form.creationTime).format('yyyy-MM-DD') : ''"
  222. disabled></el-input>
  223. </el-form-item>
  224. </el-col>
  225. <el-col :span="6">
  226. <el-form-item label="修改人员" label-width="80px">
  227. <el-input v-model="form.lastModifierId" disabled></el-input>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="6">
  231. <el-form-item label="修改时间" label-width="80px">
  232. <el-input :value="form.lastModificationTime
  233. ? moment(form.lastModificationTime).format('yyyy-MM-DD') : ''" disabled></el-input>
  234. </el-form-item>
  235. </el-col>
  236. </el-row>
  237. </el-form>
  238. <div slot="footer" class="dialog-footer">
  239. <el-button type="primary" @click="onSubmit('form')">确定</el-button>
  240. <el-button @click="dialogVisible = false">关闭</el-button>
  241. </div>
  242. </el-dialog>
  243. </div>
  244. </template>
  245. <script>
  246. import moment from "moment";
  247. import { mapState, mapActions } from "vuex";
  248. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  249. import { dddw, objCopy, arrayReduce, arrayExistObj,deepCopy } from "@/utlis/proFunc";
  250. export default {
  251. components: {
  252. },
  253. data() {
  254. return {
  255. query: {
  256. dateType: 'createDate',
  257. cardModeId: '',
  258. cardTypeId:null,
  259. cardNo:'',
  260. customerName:'',
  261. cardFlag:'',
  262. startDate:'',
  263. endDate:'',
  264. mobileTelephone:'',
  265. }, //查询条件
  266. dataList: [], //列表数据
  267. cardBillList: [], //卡记账数据
  268. multipleSelection: [], //选中的数据列表
  269. dialogVisible: false,
  270. form: {
  271. id: null,
  272. cardTypeId: null,
  273. cardNo: '',
  274. discount: 100,
  275. expiryDate: null,
  276. customerName: '',
  277. idNo: '',
  278. telephone: '',
  279. mobileTelephone: '',
  280. cardFlag: '0',
  281. remark: '',
  282. },
  283. formInit: {},
  284. rules: {
  285. cardTypeId: [
  286. { required: true, message: "请填写卡类别", trigger: "blur" },
  287. ],
  288. cardNo: [
  289. { required: true, message: "请填写卡号", trigger: "blur" },
  290. ],
  291. discount: [
  292. { required: true, message: "请填写卡折扣", trigger: "blur" },
  293. ],
  294. expiryDate: [
  295. { required: true, message: "请填写卡有效期", trigger: "blur" },
  296. ],
  297. customerName: [
  298. { required: true, message: "请填写卡主姓名", trigger: "blur" },
  299. ],
  300. idNo: [
  301. { required: true, message: "请填写卡主身份证", trigger: "blur" },
  302. ],
  303. mobileTelephone: [
  304. { required: true, message: "请填写卡主身份证", trigger: "blur" },
  305. ],
  306. cardFlag: [
  307. { required: true, message: "请填写卡启用状态", trigger: "blur" },
  308. ]
  309. },
  310. curChoosedRow: {}, //当前选择的行数据
  311. curChoosedId:'', //当前选择的行ID
  312. };
  313. },
  314. created() {
  315. this.query.startDate = new Date();
  316. this.query.endDate = this.query.startDate;
  317. this.formInit = deepCopy(this.form);
  318. },
  319. //挂载完成
  320. mounted() {
  321. this.dictInit();
  322. this.btnQuery();
  323. },
  324. computed: {
  325. ...mapState(["window", "dict"]),
  326. },
  327. methods: {
  328. ...mapActions(["getCustomerOrgGroup", "getPatientRegisterAbs"]),
  329. dddw, moment,
  330. //初始化字典数据
  331. dictInit(){
  332. //获取卡类别
  333. getapi('/api/app/cardtype/getcardtypelist')
  334. .then((res) => {
  335. if(res.code != -1){
  336. this.dict.cardType = res.data;
  337. }
  338. });
  339. },
  340. handleSelectionChange(val) {
  341. this.multipleSelection = val;
  342. },
  343. rowClick(row) {
  344. this.curChoosedRow = row;
  345. this.curChoosedId = row.id;
  346. },
  347. add() {
  348. this.form = deepCopy(this.formInit);
  349. this.dialogVisible = true;
  350. },
  351. edit() {
  352. if (!this.curChoosedId) {
  353. this.$message.warning("请先选择要操作的数据!");
  354. return;
  355. }
  356. objCopy(this.curChoosedRow,this.form);
  357. console.log('this.form',this.form);
  358. this.dialogVisible = true;
  359. },
  360. del() {
  361. let lfind = -1;
  362. if (!this.curChoosedId) {
  363. this.$message.warning("请先选择要操作的数据!");
  364. return;
  365. }
  366. //执行删除操作
  367. lfind = arrayExistObj(this.dataList, 'id', this.curChoosedRow.id);
  368. if (lfind > - 1) this.dataList.splice(lfind, 1);
  369. this.curChoosedRow.id = null;
  370. },
  371. //提交
  372. onSubmit(formName) {
  373. this.$refs[formName].validate((valid, fields) => {
  374. if (!valid) {
  375. //console.log('fields',fields,Object.keys(fields));
  376. this.$message.error(fields[Object.keys(fields)[0]][0].message);
  377. return;
  378. }
  379. // {
  380. // "organizationUnitId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  381. // "cardTypeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  382. // "cardNo": "string",
  383. // "cardPassword": "string",
  384. // "discount": 0,
  385. // "expiryDate": "string",
  386. // "customerName": "string",
  387. // "idNo": "string",
  388. // "telephone": "string",
  389. // "mobileTelephone": "string",
  390. // "cardFlag": "string",
  391. // "remark": "string"
  392. // }
  393. //编辑
  394. if (this.form.id) {
  395. postapi(`/api/app/cardregister/update?id=${this.form.id}`,body).then(res =>{
  396. if(res.code != -1){
  397. this.$message.success("操作成功!");
  398. lfind = arrayExistObj(this.dataList,'id',this.form.id);
  399. if(lfind > -1) objCopy(this.form,this.dataList[lfind]);
  400. }
  401. });
  402. } else {
  403. //新增
  404. postapi('/api/app/cardregister/create',body).then(res =>{
  405. if(res.code != - 1){
  406. this.$message.success("操作成功!");
  407. objCopy(res.data,this.form);
  408. this.dataList.push(deepCopy(this.form));
  409. }
  410. });
  411. }
  412. });
  413. },
  414. //查询
  415. btnQuery(queryType) {
  416. let body = {}
  417. console.log('this.query',this.query);
  418. switch (queryType) {
  419. case 'idNo':
  420. if(!this.query.idNo) return;
  421. body = { idNo: this.query.idNo };
  422. break;
  423. case 'cardNo':
  424. if(!this.query.cardNo) return;
  425. body = { cardNo: this.query.cardNo };
  426. break;
  427. default:
  428. if(this.query.idNo){
  429. body = { idNo: this.query.idNo };
  430. }else if(this.query.cardNo){
  431. body = { cardNo: this.query.cardNo };
  432. }else{
  433. // if(!this.query.startDate) this.query.startDate = moment(new Date()).format('yyyy-MM-DD');
  434. // if(!this.query.endDate) this.query.endDate = moment(new Date()).format('yyyy-MM-DD');
  435. if(this.query.startDate > this.query.endDate){
  436. this.$message.error("数据不合法,起始日期不能大于截止日期!");
  437. return;
  438. }
  439. body.startDate = moment(this.query.startDate).format('yyyy-MM-DD');
  440. body.endDate = moment(this.query.endDate).format('yyyy-MM-DD');
  441. if(this.query.cardModeId) body.cardModeId = this.query.cardModeId;
  442. if(this.query.cardTypeId) body.cardTypeId = this.query.cardTypeId;
  443. if(this.query.customerName) body.customerName = this.query.customerName;
  444. if(this.query.cardFlag) body.cardFlag = this.query.cardFlag;
  445. if(this.query.mobileTelephone) body.mobileTelephone = this.query.mobileTelephone;
  446. }
  447. break;
  448. }
  449. // {
  450. // "cardModeId": "string",
  451. // "cardTypeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  452. // "cardNo": "string",
  453. // "customerName": "string",
  454. // "idNo": "string",
  455. // "cardFlag": "string",
  456. // "startDate": "string",
  457. // "endDate": "string"
  458. // }
  459. console.log('/api/app/cardregister/getcardregisterlist', body)
  460. postapi('/api/app/cardregister/getcardregisterlist', body)
  461. .then((res) => {
  462. if (res.code != -1) {
  463. this.dataList = res.data;
  464. }
  465. });
  466. },
  467. },
  468. //监听事件
  469. watch: {
  470. //触发查询事件
  471. "patientRegister.query.times"(newVal, oldVal) {
  472. if (newVal != oldVal) {
  473. //alert('触发查询事件')
  474. this.query();
  475. }
  476. },
  477. },
  478. };
  479. </script>
  480. <style scoped>
  481. ::v-deep .el-input__inner {
  482. /*text-align: center;*/
  483. padding-left: 5px;
  484. padding-right: 25px;
  485. }
  486. ::v-deep .el-icon-date:before {
  487. content: ""
  488. }
  489. .query {
  490. margin-left: 10px;
  491. }
  492. .listBtn {
  493. margin-top: 20px;
  494. }
  495. .btnClass {
  496. width: 110px;
  497. text-align: center;
  498. }
  499. .btnClass {
  500. width: 110px;
  501. }
  502. </style>