index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="公司名" prop="companyId">
  5. <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  6. <el-option
  7. v-for="item in companys"
  8. :key="item.companyId"
  9. :label="item.companyName"
  10. :value="item.companyId"/>
  11. </el-select>
  12. </el-form-item>
  13. <el-form-item label="付款单号" prop="payCode">
  14. <el-input
  15. v-model="queryParams.payCode"
  16. placeholder="请输入付款单号"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="订单号" prop="orderCode">
  23. <el-input
  24. v-model="queryParams.orderCode"
  25. placeholder="请输入订单号"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="外部订单" prop="tradeNo">
  32. <el-input
  33. v-model="queryParams.tradeNo"
  34. placeholder="请输入外部订单号"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="交易单号" prop="bankTransactionId">
  41. <el-input
  42. v-model="queryParams.bankTransactionId"
  43. placeholder="请输入交易单号"
  44. clearable
  45. size="small"
  46. @keyup.enter.native="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item label="银行单号" prop="bankSerialNo">
  50. <el-input
  51. v-model="queryParams.bankSerialNo"
  52. placeholder="请输入银行单号"
  53. clearable
  54. size="small"
  55. @keyup.enter.native="handleQuery"
  56. />
  57. </el-form-item>
  58. <el-form-item label="手机号" prop="mobile">
  59. <el-input
  60. v-model="queryParams.mobile"
  61. placeholder="请输入会员手机号"
  62. clearable
  63. size="small"
  64. @keyup.enter.native="handleQuery"
  65. />
  66. </el-form-item>
  67. <el-form-item label="员工姓名" prop="companyUserNickName">
  68. <el-input
  69. v-model="queryParams.companyUserNickName"
  70. placeholder="请输入员工姓名"
  71. clearable
  72. size="small"
  73. @keyup.enter.native="handleQuery"
  74. />
  75. </el-form-item>
  76. <el-form-item label="提交时间" prop="createTimeRange">
  77. <el-date-picker
  78. style="width: 215.4px"
  79. clearable size="small"
  80. v-model="createTimeRange"
  81. type="daterange"
  82. value-format="yyyy-MM-dd"
  83. start-placeholder="开始日期"
  84. end-placeholder="结束日期">
  85. </el-date-picker>
  86. </el-form-item>
  87. <el-form-item label="支付时间" prop="payTime">
  88. <el-date-picker
  89. style="width:215.4px"
  90. clearable size="small"
  91. v-model="dateRange"
  92. type="daterange"
  93. value-format="yyyy-MM-dd"
  94. start-placeholder="开始日期"
  95. end-placeholder="结束日期">
  96. </el-date-picker>
  97. </el-form-item>
  98. <el-form-item label="退款时间" prop="refundTime">
  99. <el-date-picker
  100. style="width: 215.4px"
  101. clearable size="small"
  102. v-model="refundDateRange"
  103. type="daterange"
  104. value-format="yyyy-MM-dd"
  105. start-placeholder="开始日期"
  106. end-placeholder="结束日期">
  107. </el-date-picker>
  108. </el-form-item>
  109. <el-form-item label="状态" prop="status">
  110. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small" >
  111. <el-option
  112. v-for="item in statusOptions"
  113. :key="item.dictValue"
  114. :label="item.dictLabel"
  115. :value="item.dictValue"
  116. />
  117. </el-select>
  118. </el-form-item>
  119. <el-form-item label="小程序" prop="appId">
  120. <el-select v-model="queryParams.appId" placeholder="请选择所属小程序" clearable size="small">
  121. <el-option
  122. v-for="dict in appMallOptions"
  123. :key="dict.appid"
  124. :label="dict.name + '(' + dict.appid + ')'"
  125. :value="dict.appid"
  126. />
  127. </el-select>
  128. </el-form-item>
  129. <el-form-item>
  130. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  131. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  132. </el-form-item>
  133. </el-form>
  134. <el-row :gutter="10" class="mb8">
  135. <el-col :span="1.5">
  136. <el-button
  137. type="warning"
  138. icon="el-icon-download"
  139. size="mini"
  140. @click="handleExport"
  141. v-hasPermi="['store:storePayment:export']"
  142. >导出</el-button>
  143. </el-col>
  144. <el-col :span="1.5">
  145. <el-button
  146. type="warning"
  147. size="mini"
  148. @click="handlePayNotify"
  149. v-hasPermi="['store:storePayment:payNotify']"
  150. >同步订单状态</el-button>
  151. </el-col>
  152. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  153. </el-row>
  154. <el-tabs type="card" v-model="queryParams.businessType" @tab-click="handleClick">
  155. <el-tab-pane label="收款记录" name="1"></el-tab-pane>
  156. <el-tab-pane label="订单支付记录" name="2"></el-tab-pane>
  157. <el-tab-pane label="直播订单支付记录" name="5"></el-tab-pane>
  158. </el-tabs>
  159. <el-table height="500" border v-loading="loading" :data="storePaymentList" @selection-change="handleSelectionChange">
  160. <el-table-column type="selection" width="55" align="center" />
  161. <el-table-column label="ID" align="center" prop="paymentId" />
  162. <el-table-column label="付款单号" align="center" prop="payCode" width="120px" />
  163. <el-table-column label="订单号" align="center" prop="orderCode" width="120px" />
  164. <el-table-column label="外部订单号" align="center" prop="tradeNo" width="120px" />
  165. <el-table-column label="会员手机号" align="center" prop="userPhone" width="120px" />
  166. <el-table-column label="支付类型" align="center" prop="payTypeCode" />
  167. <el-table-column label="服务商" align="center" prop="payMode" >
  168. <template slot-scope="scope">
  169. <el-tag prop="status" v-for="(item, index) in payModeOptions" v-if="scope.row.payMode==item.dictValue">{{item.dictLabel}}</el-tag>
  170. </template>
  171. </el-table-column>
  172. <el-table-column label="支付金额" align="center" prop="payMoney" />
  173. <el-table-column label="退款金额" align="center" prop="refundMoney" />
  174. <el-table-column label="交易单号" align="center" prop="bankTransactionId" />
  175. <el-table-column label="银行单号" align="center" prop="bankSerialNo" />
  176. <el-table-column label="所属公司" align="center" prop="companyName" />
  177. <el-table-column label="所属部门" align="center" prop="deptName" />
  178. <el-table-column label="员工" align="center" prop="companyUserNickName" />
  179. <el-table-column label="小程序名称" align="center" prop="miniProgramName" width="120px" />
  180. <el-table-column label="状态" align="center" prop="status" >
  181. <template slot-scope="scope">
  182. <el-tag prop="status" v-for="(item, index) in statusOptions" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="提交时间" align="center" prop="createTime" width="180">
  186. </el-table-column>
  187. <el-table-column label="支付时间" align="center" prop="payTime" width="180">
  188. </el-table-column>
  189. <el-table-column label="退款时间" align="center" prop="refundTime" width="180">
  190. </el-table-column>
  191. <el-table-column label="备注" align="center" prop="remark" />
  192. <el-table-column label="操作" fixed="right" align="center" width="120px" class-name="small-padding fixed-width">
  193. <template slot-scope="scope">
  194. <el-button
  195. size="mini"
  196. type="text"
  197. icon="el-icon-edit"
  198. @click="handleUpdate(scope.row)"
  199. v-hasPermi="['store:storePayment:edit']"
  200. >修改</el-button>
  201. <el-button
  202. v-if="scope.row.status==1&&scope.row.businessType==1"
  203. size="mini"
  204. type="text"
  205. @click="handleRefund(scope.row)"
  206. v-hasPermi="['store:storePayment:refund']"
  207. >退款</el-button>
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. <pagination
  212. v-show="total>0"
  213. :total="total"
  214. :page.sync="queryParams.pageNum"
  215. :limit.sync="queryParams.pageSize"
  216. @pagination="getList"
  217. />
  218. <el-dialog :title="payNotify.title" :visible.sync="payNotify.open" width="600px" append-to-body>
  219. <el-form ref="payNotifyForm" :model="payNotifyForm" :rules="payNotifyRules" label-width="100px">
  220. <el-form-item label="外部单号" prop="tradeNo" >
  221. <el-input v-model="payNotifyForm.tradeNo" placeholder="请输入物流单号" />
  222. </el-form-item>
  223. </el-form>
  224. <div slot="footer" class="dialog-footer">
  225. <el-button type="primary" @click="submitPayNotifyForm">确 定</el-button>
  226. <el-button @click="payNotify.open = false">取 消</el-button>
  227. </div>
  228. </el-dialog>
  229. <!-- 添加或修改支付明细对话框 -->
  230. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  231. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  232. <el-form-item label="支付订单号" prop="payCode">
  233. <el-input v-model="form.payCode" disabled placeholder="请输入支付订单号" />
  234. </el-form-item>
  235. <el-form-item label="支付类型" prop="payTypeCode">
  236. <el-input v-model="form.payTypeCode" disabled placeholder="请输入支付类型" />
  237. </el-form-item>
  238. <el-form-item label="支付金额" prop="payMoney">
  239. <el-input v-model="form.payMoney" disabled placeholder="请输入支付金额" />
  240. </el-form-item>
  241. <el-form-item label="备注" prop="remark">
  242. <el-input v-model="form.remark" placeholder="请输入备注" />
  243. </el-form-item>
  244. </el-form>
  245. <div slot="footer" class="dialog-footer">
  246. <el-button type="primary" @click="submitForm">确 定</el-button>
  247. <el-button @click="cancel">取 消</el-button>
  248. </div>
  249. </el-dialog>
  250. <el-dialog :title="refund.title" :visible.sync="refund.open" width="500px" append-to-body>
  251. <el-form ref="refundForm" :model="refundForm" :rules="refundRules" label-width="100px">
  252. <el-form-item label="支付订单号" prop="payCode">
  253. <el-input v-model="refundForm.payCode" disabled placeholder="请输入支付订单号" />
  254. </el-form-item>
  255. <el-form-item label="支付类型" prop="payTypeCode">
  256. <el-input v-model="refundForm.payTypeCode" disabled placeholder="请输入支付类型" />
  257. </el-form-item>
  258. <el-form-item label="支付金额" prop="payMoney">
  259. <el-input v-model="refundForm.payMoney" disabled placeholder="请输入支付金额" />
  260. </el-form-item>
  261. <el-form-item label="退款金额" prop="refundMoney">
  262. <el-input-number :min="0" v-model="refundForm.refundMoney" placeholder="请输入退款金额" />
  263. </el-form-item>
  264. </el-form>
  265. <div slot="footer" class="dialog-footer">
  266. <el-button type="primary" @click="submitRefundForm">确 定</el-button>
  267. <el-button @click="cancelRefund">取 消</el-button>
  268. </div>
  269. </el-dialog>
  270. </div>
  271. </template>
  272. <script>
  273. import { refundStorePayment,listStorePayment, getStorePayment, delStorePayment, addStorePayment, updateStorePayment, exportStorePayment,setPayNotify } from "@/api/hisStore/storePayment";
  274. import { getCompanyList } from "@/api/company/company";
  275. import { listLiveOrderPayments,getLivePayment,updateLivePayment,exportLiveOrderPayments } from "@/api/live/liveOrderPayment";
  276. import {list as getAppMallOptions} from '@/api/course/coursePlaySourceConfig';
  277. export default {
  278. name: "HisStorePayment",
  279. data() {
  280. return {
  281. appMallOptions:[],
  282. payModeOptions:[
  283. { dictLabel: "微信支付", dictValue: "wx" },
  284. { dictLabel: "汇付", dictValue: "hf" }
  285. ],
  286. refund:{
  287. title:"退款",
  288. open:false,
  289. },
  290. refundForm:{
  291. refundMoney:0
  292. },
  293. refundRules:{
  294. },
  295. payNotify:{
  296. title:"同步订单状态",
  297. open:false,
  298. },
  299. payNotifyForm:{
  300. tradeNo:null,
  301. },
  302. payNotifyRules:{
  303. tradeNo: [
  304. { required: true, message: "外部单号不能为空", trigger: "blur" }
  305. ],
  306. },
  307. companys:[],
  308. statusOptions:[],
  309. createTimeRange:[],
  310. showLoading:false,
  311. // 遮罩层
  312. loading: true,
  313. // 选中数组
  314. ids: [],
  315. // 非单个禁用
  316. single: true,
  317. dateRange:[],
  318. refundDateRange:[],
  319. // 非多个禁用
  320. multiple: true,
  321. // 显示搜索条件
  322. showSearch: true,
  323. // 总条数
  324. total: 0,
  325. // 支付明细表格数据
  326. storePaymentList: [],
  327. // 弹出层标题
  328. title: "",
  329. // 是否显示弹出层
  330. open: false,
  331. // 查询参数
  332. queryParams: {
  333. businessType:"1",
  334. pageNum: 1,
  335. pageSize: 10,
  336. payCode: null,
  337. payTypeCode: null,
  338. payMoney: null,
  339. payTime: null,
  340. tradeNo: null,
  341. userId: null,
  342. openId: null,
  343. businessOrderId: null,
  344. status: null,
  345. companyId: null,
  346. companyUserId: null,
  347. deptId: null,
  348. bankTransactionId:null,
  349. companyUserNickName:null,
  350. },
  351. // 表单参数
  352. form: {},
  353. // 表单校验
  354. rules: {
  355. }
  356. };
  357. },
  358. created() {
  359. this.getDicts("store_payment_status").then((response) => {
  360. this.statusOptions = response.data;
  361. });
  362. this.getDicts("sys_pay_mode").then((response) => {
  363. this.payModeOptions = response.data;
  364. });
  365. getCompanyList().then(response => {
  366. this.companys = response.data;
  367. });
  368. this.getList();
  369. // 获取小程序选项列表
  370. this.getAppMallOptions();
  371. },
  372. methods: {
  373. // 获取小程序选项列表
  374. getAppMallOptions() {
  375. getAppMallOptions({pageNum:1,pageSize:100,isMall:1}).then(response => {
  376. this.appMallOptions = response.rows;
  377. })
  378. },
  379. submitPayNotifyForm(){
  380. this.$refs["payNotifyForm"].validate(valid => {
  381. if (valid) {
  382. setPayNotify(this.payNotifyForm).then(response => {
  383. if (response.code === 200) {
  384. this.msgSuccess("操作成功");
  385. this.payNotify.open = false;
  386. this.getList();
  387. }
  388. });
  389. }
  390. });
  391. },
  392. handlePayNotify(){
  393. this.payNotify.open = true;
  394. this.payNotifyForm.tradeNo = null;
  395. },
  396. handleClick(tab, event) {
  397. this.queryParams.businessType=tab.name
  398. this.getList();
  399. },
  400. handleRefund(row){
  401. this.refundForm.paymentId=row.paymentId;
  402. this.refundForm.payCode=row.payCode;
  403. this.refundForm.payTypeCode=row.payTypeCode;
  404. this.refundForm.payMoney=row.payMoney;
  405. this.refundForm.refundMoney=row.payMoney;
  406. this.refund.open=true;
  407. },
  408. cancelRefund(){
  409. this.refund.open = false;
  410. },
  411. submitRefundForm() {
  412. this.$refs["refundForm"].validate(valid => {
  413. if (valid) {
  414. this.showLoading = this.$loading({
  415. lock: true,
  416. text: '处理中...',
  417. spinner: 'el-icon-loading',
  418. background: 'rgba(0, 0, 0, 0.7)'
  419. });
  420. refundStorePayment(this.refundForm).then(response => {
  421. this.showLoading.close()
  422. if (response.code === 200) {
  423. this.msgSuccess("操作成功");
  424. this.refund.open = false;
  425. this.getList();
  426. }
  427. else{
  428. this.msgError(response.msg);
  429. }
  430. });
  431. }
  432. });
  433. },
  434. /** 查询支付明细列表 */
  435. getList() {
  436. this.loading = true;
  437. if(this.createTimeRange!=null&&this.createTimeRange.length==2){
  438. this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
  439. }
  440. else{
  441. this.queryParams.createTimeRange=null;
  442. }
  443. if (this.queryParams.businessType === "5") {
  444. listLiveOrderPayments(this.addDateRange(this.queryParams, this.dateRange),this.refundDateRange).then(response => {
  445. this.storePaymentList = response.rows;
  446. this.total = response.total;
  447. this.loading = false;
  448. });
  449. } else{
  450. listStorePayment(this.addDateRange(this.queryParams, this.dateRange),this.refundDateRange).then(response => {
  451. this.storePaymentList = response.rows;
  452. this.total = response.total;
  453. this.loading = false;
  454. })
  455. }
  456. },
  457. // 取消按钮
  458. cancel() {
  459. this.open = false;
  460. this.reset();
  461. },
  462. // 表单重置
  463. reset() {
  464. this.form = {
  465. paymentId: null,
  466. payCode: null,
  467. payTypeCode: null,
  468. payMoney: null,
  469. payTime: null,
  470. createTime: null,
  471. tradeNo: null,
  472. userId: null,
  473. openId: null,
  474. businessType: null,
  475. businessOrderId: null,
  476. status: 0,
  477. remark: null,
  478. companyId: null,
  479. companyUserId: null,
  480. deptId: null
  481. };
  482. this.resetForm("form");
  483. },
  484. /** 搜索按钮操作 */
  485. handleQuery() {
  486. this.queryParams.pageNum = 1;
  487. this.getList();
  488. },
  489. /** 重置按钮操作 */
  490. resetQuery() {
  491. his.dateRange=[];
  492. this.refundDateRange=[];
  493. this.createTimeRange=[];
  494. this.resetForm("queryForm");
  495. this.handleQuery();
  496. },
  497. // 多选框选中数据
  498. handleSelectionChange(selection) {
  499. this.ids = selection.map(item => item.paymentId)
  500. this.single = selection.length!==1
  501. this.multiple = !selection.length
  502. },
  503. /** 新增按钮操作 */
  504. handleAdd() {
  505. this.reset();
  506. this.open = true;
  507. this.title = "添加支付明细";
  508. },
  509. /** 修改按钮操作 */
  510. handleUpdate(row) {
  511. this.reset();
  512. const paymentId = row.paymentId || this.ids
  513. if (this.queryParams.businessType === "5") {
  514. getLivePayment(paymentId).then(response => {
  515. this.form = response.data;
  516. this.open = true;
  517. this.title = "修改支付明细";
  518. });
  519. } else {
  520. getStorePayment(paymentId).then(response => {
  521. this.form = response.data;
  522. this.open = true;
  523. this.title = "修改支付明细";
  524. });
  525. }
  526. },
  527. /** 提交按钮 */
  528. submitForm() {
  529. this.$refs["form"].validate(valid => {
  530. if (valid) {
  531. if (this.form.paymentId != null) {
  532. if (this.queryParams.businessType === "5") {
  533. updateLivePayment(this.form).then(response => {
  534. if (response.code === 200) {
  535. this.msgSuccess("修改成功");
  536. this.open = false;
  537. this.getList();
  538. }
  539. });
  540. } else {
  541. updateStorePayment(this.form).then(response => {
  542. if (response.code === 200) {
  543. this.msgSuccess("修改成功");
  544. this.open = false;
  545. this.getList();
  546. }
  547. });
  548. }
  549. } else {
  550. addStorePayment(this.form).then(response => {
  551. if (response.code === 200) {
  552. this.msgSuccess("新增成功");
  553. this.open = false;
  554. this.getList();
  555. }
  556. });
  557. }
  558. }
  559. });
  560. },
  561. /** 删除按钮操作 */
  562. handleDelete(row) {
  563. const paymentIds = row.paymentId || this.ids;
  564. this.$confirm('是否确认删除支付明细编号为"' + paymentIds + '"的数据项?', "警告", {
  565. confirmButtonText: "确定",
  566. cancelButtonText: "取消",
  567. type: "warning"
  568. }).then(function() {
  569. return delStorePayment(paymentIds);
  570. }).then(() => {
  571. this.getList();
  572. this.msgSuccess("删除成功");
  573. }).catch(function() {});
  574. },
  575. /** 导出按钮操作 */
  576. handleExport() {
  577. const queryParams = this.queryParams;
  578. this.$confirm('是否确认导出所有支付明细数据项?', "警告", {
  579. confirmButtonText: "确定",
  580. cancelButtonText: "取消",
  581. type: "warning"
  582. }).then(function() {
  583. return exportStorePayment(queryParams);
  584. }).then(response => {
  585. this.download(response.msg);
  586. }).catch(function() {});
  587. }
  588. }
  589. };
  590. </script>