后端

payment-add-or-update.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <el-dialog
  3. :title="!dataForm.id ? '新增' : '修改'"
  4. :close-on-click-modal="false"
  5. :visible.sync="visible"
  6. >
  7. <el-form
  8. :model="dataForm"
  9. :rules="dataRule"
  10. ref="dataForm"
  11. @keyup.enter.native="dataFormSubmit()"
  12. label-width="150px"
  13. >
  14. <!-- <el-form-item label="订单号" prop="orderId">
  15. <el-input v-model="dataForm.orderId" placeholder="订单号"></el-input>
  16. </el-form-item>-->
  17. <el-form-item label="参会人员" prop="attenders">
  18. <!-- <el-input v-model="dataForm.attendersId" placeholder="参会人员id"></el-input> -->
  19. <el-select
  20. style="width:220px"
  21. v-model="dataForm.attenders"
  22. filterable
  23. remote
  24. reserve-keyword
  25. placeholder="请输入关键词"
  26. :remote-method="remoteMethod"
  27. :loading="loading"
  28. >
  29. <el-option
  30. v-for="item in options"
  31. :key="item.value"
  32. :label="item.label"
  33. :value="item.value"
  34. ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <!-- <el-form-item label="费用类型id" prop="feeId">
  38. <el-input v-model="dataForm.feeId" placeholder="费用类型id"></el-input>
  39. </el-form-item>-->
  40. <el-form-item label="缴费时间" prop="payTime">
  41. <!-- <el-input v-model="dataForm.payTime" placeholder="缴费时间"></el-input> -->
  42. <el-date-picker
  43. v-model="dataForm.payTime"
  44. type="datetime"
  45. placeholder="选择日期时间"
  46. value-format="yyyy-MM-dd HH:mm:ss"
  47. ></el-date-picker>
  48. </el-form-item>
  49. <el-form-item label="费用类型" prop="feeId">
  50. <el-select v-model="dataForm.feeId" placeholder="请选择">
  51. <el-option
  52. v-for="item in option"
  53. :key="item.value"
  54. :label="item.label"
  55. :value="item.value"
  56. ></el-option>
  57. </el-select>
  58. </el-form-item>
  59. <el-form-item label="缴费方式" prop="payType">
  60. <!-- <el-input v-model="dataForm.payType" placeholder="缴费方式"></el-input> -->
  61. <!-- <el-select v-model="dataForm.payType" placeholder="请选择">
  62. <el-option
  63. v-for="item in payTypeList"
  64. :key="item.value"
  65. :label="item.label"
  66. :value="item.value"
  67. ></el-option>
  68. </el-select>-->
  69. <el-radio v-model="dataForm.payType" :label="1">线上缴费</el-radio>
  70. <el-radio v-model="dataForm.payType" :label="2">现场缴费</el-radio>
  71. </el-form-item>
  72. <el-form-item label="缴费项目" prop="payOption">
  73. <el-input v-model="dataForm.payOption" placeholder="缴费项目"></el-input>
  74. </el-form-item>
  75. <el-form-item label="金额" prop="money">
  76. <el-input v-model="dataForm.money" placeholder="金额"></el-input>
  77. </el-form-item>
  78. <el-form-item label="发票抬头" prop="taxTitle">
  79. <el-input v-model="dataForm.taxTitle" placeholder="发票抬头"></el-input>
  80. </el-form-item>
  81. <el-form-item label="纳税人税号" prop="taxNumber">
  82. <el-input v-model="dataForm.taxNumber" placeholder="纳税人税号"></el-input>
  83. </el-form-item>
  84. <el-form-item label="公司注册地址及电话" prop="addrPhone">
  85. <el-input v-model="dataForm.addrPhone" placeholder="电话"></el-input>
  86. </el-form-item>
  87. <el-form-item label="开户行及账号" prop="bankAddrAccount">
  88. <el-input v-model="dataForm.bankAddrAccount" placeholder="开户行及账号"></el-input>
  89. </el-form-item>
  90. <el-form-item label="邮寄地址" prop="taxAddress">
  91. <el-input v-model="dataForm.taxAddress" placeholder="邮寄地址"></el-input>
  92. </el-form-item>
  93. <el-form-item label="确认是否已缴费" prop="isPay">
  94. <!-- <el-input v-model="dataForm.isPay" placeholder="确认是否已缴费"></el-input> -->
  95. <el-radio v-model="dataForm.isPay" :label="1"></el-radio>
  96. <el-radio v-model="dataForm.isPay" :label="0"></el-radio>
  97. </el-form-item>
  98. <!-- <el-form-item label="创建时间" prop="createTime">
  99. <el-input v-model="dataForm.createTime" placeholder="创建时间"></el-input>
  100. </el-form-item>-->
  101. <!-- <el-form-item label="是否被删除 状态 0:正常 1:删除" prop="isDel">
  102. <el-input v-model="dataForm.isDel" placeholder="是否被删除 状态 0:正常 1:删除"></el-input>
  103. </el-form-item>-->
  104. <!-- <el-form-item label="会议id" prop="meetingId">
  105. <el-input v-model="dataForm.meetingId" placeholder="会议id"></el-input>
  106. </el-form-item>-->
  107. <!-- <el-form-item label="发票类型0普1专" prop="taxType">
  108. <el-input v-model="dataForm.taxType" placeholder="发票类型0普1专"></el-input>
  109. </el-form-item>-->
  110. </el-form>
  111. <span slot="footer" class="dialog-footer">
  112. <el-button @click="visible = false">取消</el-button>
  113. <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
  114. </span>
  115. </el-dialog>
  116. </template>
  117. <script>
  118. export default {
  119. data() {
  120. return {
  121. visible: false,
  122. dataForm: {
  123. id: 0,
  124. attenders: "", //参会人员id
  125. payTime: "", //付款时间
  126. payType: "", //付款方式
  127. payOption: "", //付款项目
  128. feeId: "", //费用类型
  129. money: "", //金额
  130. isPay: "", //是否付款
  131. taxType: "", //发票类型
  132. taxTitle: "", //发票抬头
  133. taxNumber: "", //发票号
  134. addrPhone: "", //电话
  135. bankAddrAccount: "", //开户行
  136. taxAddress: "" //发票地址
  137. },
  138. dataRule: {
  139. orderId: [
  140. { required: true, message: "订单号不能为空", trigger: "blur" }
  141. ],
  142. attendersId: [
  143. { required: true, message: "参会人员id不能为空", trigger: "blur" }
  144. ],
  145. feeId: [
  146. { required: true, message: "费用类型id不能为空", trigger: "blur" }
  147. ],
  148. payTime: [
  149. { required: true, message: "缴费时间不能为空", trigger: "blur" }
  150. ],
  151. payType: [
  152. { required: true, message: "缴费方式不能为空", trigger: "blur" }
  153. ],
  154. payOption: [
  155. { required: true, message: "缴费项目不能为空", trigger: "blur" }
  156. ],
  157. money: [{ required: true, message: "金额不能为空", trigger: "blur" }],
  158. taxTitle: [
  159. { required: true, message: "发票抬头不能为空", trigger: "blur" }
  160. ],
  161. taxNumber: [
  162. { required: true, message: "纳税人税号不能为空", trigger: "blur" }
  163. ],
  164. addrPhone: [
  165. { required: true, message: "地址 电话不能为空", trigger: "blur" }
  166. ],
  167. bankAddrAccount: [
  168. { required: true, message: "开户行及账号不能为空", trigger: "blur" }
  169. ],
  170. taxAddress: [
  171. { required: true, message: "邮寄地址不能为空", trigger: "blur" }
  172. ],
  173. isPay: [
  174. { required: true, message: "确认是否已缴费不能为空", trigger: "blur" }
  175. ],
  176. createTime: [
  177. { required: true, message: "创建时间不能为空", trigger: "blur" }
  178. ],
  179. meetingId: [
  180. { required: true, message: "会议id不能为空", trigger: "blur" }
  181. ],
  182. taxType: [
  183. { required: true, message: "发票类型0普1专不能为空", trigger: "blur" }
  184. ]
  185. },
  186. loading: false,
  187. meetingList: [],
  188. list: [],
  189. options: [],
  190. payTypeList: [
  191. {
  192. value: "1",
  193. label: "线上缴费"
  194. },
  195. {
  196. value: "2",
  197. label: "现场缴费"
  198. }
  199. ],
  200. typesoffeeList: [],
  201. option: [],
  202. feeIdTypeList: [], //费用类型
  203. option: [],
  204. page: 0,
  205. limit: 10,
  206. meetingId: this.$route.params.id
  207. };
  208. },
  209. created() {
  210. this.getPaymentByname();
  211. this.getTypesoffee();
  212. },
  213. methods: {
  214. init(id) {
  215. this.dataForm.id = id || 0;
  216. this.visible = true;
  217. this.$nextTick(() => {
  218. this.$refs["dataForm"].resetFields();
  219. if (this.dataForm.id) {
  220. this.$http({
  221. url: this.$http.adornUrl(`/admin/payment/info/${this.dataForm.id}`),
  222. method: "get",
  223. params: this.$http.adornParams()
  224. }).then(({ data }) => {
  225. window.console.log(data);
  226. if (data && data.code === 0) {
  227. this.dataForm.orderId = data.payment.orderId;
  228. this.dataForm.attenders = data.payment.attenders;
  229. this.dataForm.feeId = data.payment.feeId;
  230. this.dataForm.payTime = data.payment.payTime;
  231. this.dataForm.payType = data.payment.payType;
  232. this.dataForm.payOption = data.payment.payOption;
  233. this.dataForm.money = data.payment.money;
  234. this.dataForm.taxTitle = data.payment.taxTitle;
  235. this.dataForm.taxNumber = data.payment.taxNumber;
  236. this.dataForm.addrPhone = data.payment.addrPhone;
  237. this.dataForm.bankAddrAccount = data.payment.bankAddrAccount;
  238. this.dataForm.taxAddress = data.payment.taxAddress;
  239. this.dataForm.isCheck = data.payment.isCheck;
  240. this.dataForm.createTime = data.payment.createTime;
  241. this.dataForm.isPay = data.payment.isPay;
  242. this.dataForm.meetingId = data.payment.meetingId;
  243. this.dataForm.taxType = data.payment.taxType;
  244. }
  245. });
  246. }
  247. });
  248. },
  249. // 表单提交
  250. dataFormSubmit() {
  251. this.$refs["dataForm"].validate(valid => {
  252. if (valid) {
  253. this.$http({
  254. url: this.$http.adornUrl(
  255. `/admin/payment/${!this.dataForm.id ? "save" : "update"}`
  256. ),
  257. method: "post",
  258. data: this.$http.adornData({
  259. id: this.dataForm.id || undefined,
  260. attenders: this.dataForm.attenders,
  261. feeId: this.dataForm.feeId,
  262. payTime: this.dataForm.payTime,
  263. payType: this.dataForm.payType,
  264. payOption: this.dataForm.payOption,
  265. money: this.dataForm.money,
  266. taxTitle: this.dataForm.taxTitle,
  267. taxNumber: this.dataForm.taxNumber,
  268. addrPhone: this.dataForm.addrPhone,
  269. bankAddrAccount: this.dataForm.bankAddrAccount,
  270. taxAddress: this.dataForm.taxAddress,
  271. isPay: this.dataForm.isPay,
  272. createTime: this.dataForm.createTime,
  273. meetingId: this.dataForm.meetingId,
  274. taxType: this.dataForm.taxType
  275. })
  276. }).then(({ data }) => {
  277. if (data && data.code === 0) {
  278. this.$message({
  279. message: "操作成功",
  280. type: "success",
  281. duration: 1500,
  282. onClose: () => {
  283. this.visible = false;
  284. this.$emit("refreshDataList");
  285. }
  286. });
  287. } else {
  288. this.$message.error(data.msg);
  289. }
  290. });
  291. }
  292. });
  293. },
  294. getPaymentByname(name = "") {
  295. this.loading = true;
  296. this.$http({
  297. url: this.$http.adornUrl(`/admin/attenders/selectbyname`),
  298. method: "get",
  299. params: this.$http.adornParams({
  300. name: name,
  301. meetingId: this.$route.params.id
  302. })
  303. }).then(({ data }) => {
  304. if (data) {
  305. this.loading = false;
  306. this.meetingList = data.list;
  307. this.list = this.meetingList.map(item => {
  308. return { value: `${item.id}`, label: `${item.name}` };
  309. });
  310. }
  311. });
  312. },
  313. remoteMethod(query) {
  314. if (query !== "") {
  315. this.loading = true;
  316. setTimeout(() => {
  317. this.loading = false;
  318. this.options = this.list.filter(item => {
  319. return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
  320. });
  321. }, 300);
  322. } else {
  323. this.options = [];
  324. }
  325. },
  326. getTypesoffee() {
  327. this.$http({
  328. url: this.$http.adornUrl(
  329. `/admin/typesoffee/listbymid/${this.meetingId}`
  330. ),
  331. methods: "get",
  332. params: {}
  333. }).then(({ data }) => {
  334. if (data && data.code === 0) {
  335. this.typesoffeeList = data.list;
  336. this.option = this.typesoffeeList.map(item => {
  337. return {
  338. value: item.id,
  339. label: item.name
  340. };
  341. });
  342. }
  343. });
  344. }
  345. }
  346. };
  347. </script>