storePayDetails.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
  3. <div style="padding: 20px; background-color: #fff;">
  4. 支付详情
  5. </div>
  6. <div class="contentx" v-if="item!=null">
  7. <div class="desct">
  8. 支付信息
  9. </div>
  10. <div class="" style="float: right;margin: 5px;">
  11. <el-button size="mini" @click="openSyncDialog" >同步支付状态</el-button>
  12. </div>
  13. <div class="" v-if="item.status>=0" style="float: right; margin: 5px;" v-hasPermi="['his:storePayment:refund']" >
  14. <el-button size="mini" @click="payRefund()" >退款</el-button>
  15. </div>
  16. <el-descriptions title="" :column="3" border>
  17. <el-descriptions-item label="支付订单号" >
  18. <span v-if="item!=null">{{item.payCode}}</span>
  19. </el-descriptions-item>
  20. <el-descriptions-item label="支付类型" >
  21. <span v-if="item!=null">{{item.payTypeCode}}</span>
  22. </el-descriptions-item>
  23. <el-descriptions-item label="支付金额" >
  24. <span v-if="item!=null">{{item.payMoney}}</span>
  25. </el-descriptions-item>
  26. <el-descriptions-item label="外部订单号" >
  27. <span v-if="item!=null">{{item.tradeNo}}</span>
  28. </el-descriptions-item>
  29. <el-descriptions-item label="用户昵称" >
  30. <span v-if="item!=null">{{item.nickName}}</span>
  31. </el-descriptions-item>
  32. <el-descriptions-item label="OPENID" >
  33. <span v-if="item!=null">{{item.openId}}</span>
  34. </el-descriptions-item>
  35. <el-descriptions-item label="用户电话" >
  36. <span v-if="item!=null">{{item.phone}}</span>
  37. </el-descriptions-item>
  38. <el-descriptions-item label="店铺名称" >
  39. <span v-if="item!=null">{{item.storeName}}</span>
  40. </el-descriptions-item>
  41. <el-descriptions-item label="交易单号" >
  42. <span v-if="item!=null">{{item.bankTransactionId}}</span>
  43. </el-descriptions-item>
  44. <el-descriptions-item label="银行流水号" >
  45. <span v-if="item!=null">{{item.bankSerialNo}}</span>
  46. </el-descriptions-item>
  47. <el-descriptions-item label="退款金额" >
  48. <span v-if="item!=null">{{item.refundMoney}}</span>
  49. </el-descriptions-item>
  50. <el-descriptions-item label="退款时间" >
  51. <span v-if="item!=null">{{item.refundTime}}</span>
  52. </el-descriptions-item>
  53. <el-descriptions-item label="业务类型" >
  54. <span v-if="item!=null">
  55. <dict-tag :options="busineOptions" :value="item.businessType"/>
  56. </span>
  57. </el-descriptions-item>
  58. <el-descriptions-item label="状态" >
  59. <span v-if="item!=null">
  60. <dict-tag :options="statusOptions" :value="item.status"/>
  61. </span>
  62. </el-descriptions-item>
  63. <el-descriptions-item label="创建时间" >
  64. <span v-if="item!=null">{{item.createTime}}</span>
  65. </el-descriptions-item>
  66. <el-descriptions-item label="支付时间" >
  67. <span v-if="item!=null">{{item.payTime}}</span>
  68. </el-descriptions-item>
  69. </el-descriptions>
  70. </div>
  71. <!-- 同步支付状态弹窗 -->
  72. <el-dialog
  73. title="同步支付状态"
  74. :visible.sync="syncDialogVisible"
  75. width="450px"
  76. :close-on-click-modal="false"
  77. append-to-body>
  78. <el-form :model="syncForm" :rules="syncRules" ref="syncForm" label-width="100px">
  79. <el-form-item label="退款日期" prop="refundDate">
  80. <el-date-picker
  81. v-model="syncForm.refundDate"
  82. type="date"
  83. placeholder="请选择退款日期"
  84. value-format="yyyy-MM-dd"
  85. style="width: 100%">
  86. </el-date-picker>
  87. </el-form-item>
  88. </el-form>
  89. <div slot="footer" class="dialog-footer">
  90. <el-button @click="syncDialogVisible = false" size="small">取 消</el-button>
  91. <el-button type="primary" :loading="syncLoading" @click="getPayStatus()" size="small">
  92. 开始同步
  93. </el-button>
  94. </div>
  95. </el-dialog>
  96. </div>
  97. </template>
  98. <script>
  99. import { refund,listStorePayment,getStatus, getStorePayment, delStorePayment, addStorePayment, updateStorePayment, exportStorePayment } from "@/api/his/storePayment";
  100. export default {
  101. name: "depdetails",
  102. props:["data"],
  103. data() {
  104. return {
  105. // 弹窗显示控制
  106. syncDialogVisible: false,
  107. // 加载状态
  108. syncLoading: false,
  109. syncForm: {
  110. refundDate: '',
  111. },
  112. syncRules: {
  113. refundDate: [
  114. { required: true, message: '请选择退款日期', trigger: 'change' }
  115. ]
  116. },
  117. statusOptions: [],
  118. busineOptions: [],
  119. item:null,
  120. }
  121. },
  122. created() {
  123. this.getDicts("sys_store_payment_status").then(response => {
  124. this.statusOptions = response.data;
  125. });
  126. this.getDicts("sys_store_payment_business_type").then(response => {
  127. this.busineOptions = response.data;
  128. });
  129. },
  130. methods: {
  131. // 打开同步弹窗
  132. openSyncDialog() {
  133. if (this.item.status==0){
  134. return this.getPayStatus();
  135. } else {
  136. this.syncDialogVisible = true;
  137. // 重置表单
  138. this.$nextTick(() => {
  139. this.$refs.syncForm && this.$refs.syncForm.resetFields();
  140. });
  141. }
  142. },
  143. getDetails(orderId) {
  144. this.item=null;
  145. getStorePayment(orderId).then(response => {
  146. this.item = response.data;
  147. });
  148. },
  149. getPayStatus(){
  150. this.$confirm('是否确认同步支付状态?', "警告", {
  151. confirmButtonText: "确定",
  152. cancelButtonText: "取消",
  153. type: "warning"
  154. }).then(() => {
  155. console.log("this.item.status", this.item.status);
  156. console.log("this.item.status", this.syncForm.refundDate);
  157. if (this.item.status === 1) {
  158. // 先验证表单
  159. this.$refs.syncForm.validate(valid => {
  160. if (valid) {
  161. this.syncLoading = true;
  162. getStatus(this.item.paymentId, this.syncForm.refundDate)
  163. .then(() => {
  164. this.$message.success('同步成功');
  165. this.syncDialogVisible = false;
  166. getStorePayment(that.item.paymentId).then(response => {
  167. that.item = response.data;
  168. });
  169. })
  170. .catch(err => {
  171. this.$message.error(err.msg || '同步失败');
  172. })
  173. .finally(() => {
  174. this.syncLoading = false;
  175. });
  176. }
  177. });
  178. } else {
  179. // status 不为 1 时直接调用,不传日期
  180. getStatus(this.item.paymentId, null)
  181. .then(() => {
  182. getStorePayment(that.item.paymentId).then(response => {
  183. that.item = response.data;
  184. });
  185. });
  186. }
  187. }).catch(() => {});
  188. },
  189. payRefund(){
  190. var that=this;
  191. this.$confirm('是否确认退款?', "警告", {
  192. confirmButtonText: "确定",
  193. cancelButtonText: "取消",
  194. type: "warning"
  195. }).then(function() {
  196. return refund(that.item.paymentId);
  197. }).then(() => {
  198. getStorePayment(that.item.paymentId).then(response => {
  199. that.item = response.data;
  200. });
  201. this.msgSuccess("操作成功");
  202. }).catch(function() {});
  203. },
  204. }
  205. }
  206. </script>
  207. <style>
  208. .contentx{
  209. height: 100%;
  210. background-color: #fff;
  211. padding: 0px 20px 20px;
  212. margin: 20px;
  213. }
  214. .el-descriptions-item__label.is-bordered-label{
  215. font-weight: normal;
  216. }
  217. .el-descriptions-item__content {
  218. max-width: 150px;
  219. min-width: 100px;
  220. }
  221. .desct{
  222. padding-top: 20px;
  223. padding-bottom: 20px;
  224. color: #524b4a;
  225. font-weight: bold;
  226. }
  227. </style>