Ver Fonte

add:支付状态同步

ct há 3 semanas atrás
pai
commit
a65c0f9afe

+ 3 - 2
src/api/his/storePayment.js

@@ -25,10 +25,11 @@ export function getStorePayment(paymentId) {
     method: 'get'
   })
 }
-export function getStatus(paymentId) {
+export function getStatus(paymentId,refundDate) {
   return request({
     url: '/his/storePayment/getStatus/' + paymentId,
-    method: 'get'
+    method: 'get',
+    params: { refundDate: refundDate }
   })
 }
 export function refund(paymentId) {

+ 97 - 19
src/views/components/his/storePayDetails.vue

@@ -9,7 +9,7 @@
       </div>
 
         <div class=""  style="float: right;margin: 5px;">
-           <el-button size="mini" @click="getPayStatus()" >同步支付状态</el-button>
+           <el-button size="mini" @click="openSyncDialog" >同步支付状态</el-button>
         </div>
         <div class="" v-if="item.status>=0" style="float: right; margin: 5px;" v-hasPermi="['his:storePayment:refund']" >
            <el-button size="mini" @click="payRefund()" >退款</el-button>
@@ -71,7 +71,34 @@
             </el-descriptions-item>
         </el-descriptions>
     </div>
+  <!-- 同步支付状态弹窗 -->
+  <el-dialog
+    title="同步支付状态"
+    :visible.sync="syncDialogVisible"
+    width="450px"
+    :close-on-click-modal="false"
+    append-to-body>
+
+    <el-form :model="syncForm" :rules="syncRules" ref="syncForm" label-width="100px">
+      <el-form-item label="退款日期" prop="refundDate">
+        <el-date-picker
+          v-model="syncForm.refundDate"
+          type="date"
+          placeholder="请选择退款日期"
+          value-format="yyyy-MM-dd"
+          style="width: 100%">
+        </el-date-picker>
+      </el-form-item>
+    </el-form>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="syncDialogVisible = false" size="small">取 消</el-button>
+      <el-button type="primary" :loading="syncLoading"  @click="getPayStatus()" size="small">
+        开始同步
+      </el-button>
     </div>
+  </el-dialog>
+</div>
 </template>
 
 <script>
@@ -81,6 +108,18 @@ import { refund,listStorePayment,getStatus, getStorePayment, delStorePayment, ad
     props:["data"],
     data() {
       return {
+        // 弹窗显示控制
+        syncDialogVisible: false,
+        // 加载状态
+        syncLoading: false,
+        syncForm: {
+          refundDate: '',
+        },
+        syncRules: {
+          refundDate: [
+            { required: true, message: '请选择退款日期', trigger: 'change' }
+          ]
+        },
         statusOptions: [],
         busineOptions: [],
         item:null,
@@ -88,16 +127,29 @@ import { refund,listStorePayment,getStatus, getStorePayment, delStorePayment, ad
       }
     },
     created() {
-     this.getDicts("sys_store_payment_status").then(response => {
-       this.statusOptions = response.data;
-     });
-  this.getDicts("sys_store_payment_business_type").then(response => {
-    this.busineOptions = response.data;
-  });
+       this.getDicts("sys_store_payment_status").then(response => {
+        this.statusOptions = response.data;
+      });
+      this.getDicts("sys_store_payment_business_type").then(response => {
+        this.busineOptions = response.data;
+      });
 
 
     },
     methods: {
+      // 打开同步弹窗
+      openSyncDialog() {
+        if (this.item.status==0){
+          return this.getPayStatus();
+        } else {
+          this.syncDialogVisible = true;
+          // 重置表单
+          this.$nextTick(() => {
+            this.$refs.syncForm && this.$refs.syncForm.resetFields();
+          });
+        }
+
+      },
       getDetails(orderId) {
         this.item=null;
         getStorePayment(orderId).then(response => {
@@ -105,19 +157,45 @@ import { refund,listStorePayment,getStatus, getStorePayment, delStorePayment, ad
         });
       },
       getPayStatus(){
-          var that=this;
-          this.$confirm('是否确认同步支付状态?', "警告", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          }).then(function() {
-            return getStatus(that.item.paymentId);
-          }).then(() => {
-            getStorePayment(that.item.paymentId).then(response => {
-                  that.item = response.data;
+        this.$confirm('是否确认同步支付状态?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          console.log("this.item.status", this.item.status);
+          console.log("this.item.status",  this.syncForm.refundDate);
+
+          if (this.item.status === 1) {
+            // 先验证表单
+            this.$refs.syncForm.validate(valid => {
+              if (valid) {
+                this.syncLoading = true;
+                getStatus(this.item.paymentId, this.syncForm.refundDate)
+                  .then(() => {
+                    this.$message.success('同步成功');
+                    this.syncDialogVisible = false;
+                    getStorePayment(that.item.paymentId).then(response => {
+                      that.item = response.data;
+                    });
+                  })
+                  .catch(err => {
+                    this.$message.error(err.msg || '同步失败');
+                  })
+                  .finally(() => {
+                    this.syncLoading = false;
+                  });
+              }
             });
-             this.msgSuccess("操作成功");
-          }).catch(function() {});
+          } else {
+            // status 不为 1 时直接调用,不传日期
+            getStatus(this.item.paymentId, null)
+              .then(() => {
+                getStorePayment(that.item.paymentId).then(response => {
+                  that.item = response.data;
+                });
+              });
+          }
+        }).catch(() => {});
       },
 
 

+ 1 - 1
src/views/course/userCourse/index.vue

@@ -517,7 +517,7 @@
     <el-dialog :title="updateCourse.title" :visible.sync="updateCourse.open" width="1200px" append-to-body>
       <el-form ref="updateCourseForm" :model="updateCourseForm"  label-width="110px">
 
-        <el-form-item label="关联公司" prop="tags">
+        <el-form-item label="新增关联公司" prop="tags">
           <el-select v-model="updateCourseForm.companyIds" multiple placeholder="请选择公司" filterable clearable style="width: 90%;">
             <el-option
               v-for="dict in companyOptions"