From ecad399599cc91ebd70e2ed45262ca1579cbf9d2 Mon Sep 17 00:00:00 2001
From: zhaoxiaoqiang <287285524@qq.com>
Date: Fri, 01 Sep 2023 11:38:10 +0800
Subject: [PATCH] 订单管理接口调整

---
 src/views/qyp-project-order/history.vue |  256 ++++++++++++++++++++++++
 src/api/user.js                         |    8 
 src/views/qyp-project-order/admin.vue   |  110 ++++++++++
 src/views/qyp-project-order/plan.vue    |   44 +++-
 src/api/listapi.js                      |   26 ++
 src/utils/excelDownLoadConfig.js        |    5 
 src/views/qyp-project-order/draw.vue    |   97 ++++++++-
 src/api/credit.js                       |   16 +
 8 files changed, 509 insertions(+), 53 deletions(-)

diff --git a/src/api/credit.js b/src/api/credit.js
index cad6a5a..92a99a9 100644
--- a/src/api/credit.js
+++ b/src/api/credit.js
@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-22 10:18:34
- * @LastEditTime: 2023-07-10 10:39:47
+ * @LastEditTime: 2023-09-01 09:45:12
  * @LastEditors: zhaoxiaoqiang 287285524@qq.com
  * @Description: In User Settings Edit
  * @FilePath: \qyp_finlean_plat\src\api\credit.js
@@ -82,10 +82,18 @@
     data
   })
 }
-// 订单详情
-export function orderInit(data) {
+// 支付历史初始化
+export function payInit(data) {
   return request({
-    url: '/qyp/order/orderInit',
+    url: '/qyp/order/payInit',
+    method: 'post',
+    data
+  })
+}
+// 退款
+export function refund(data) {
+  return request({
+    url: '/qyp/order/refund',
     method: 'post',
     data
   })
diff --git a/src/api/listapi.js b/src/api/listapi.js
index 596aff3..5d2d258 100644
--- a/src/api/listapi.js
+++ b/src/api/listapi.js
@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-09-16 17:39:48
- * @LastEditTime: 2023-08-25 10:09:01
+ * @LastEditTime: 2023-09-01 11:28:03
  * @LastEditors: zhaoxiaoqiang 287285524@qq.com
  * @Description:这个文件只用作列表和导出接口的使用
  * @FilePath: \qyp-plat\src\api\listapi.js
@@ -11,6 +11,7 @@
 let accountApi = {
   // 用户列表
   userList(data) {
+    data.sysType = 4;
     return request({
       url: "/user/list",
       method: "post",
@@ -47,5 +48,28 @@
       data,
     });
   },
+  payList(data) {
+    return request({
+      url: "/qyp/order/payList",
+      method: "post",
+      data,
+    });
+  },
+  // 支付列表
+  payPlanList(data) {
+    return request({
+      url: "/qyp/order/payPlanList",
+      method: "post",
+      data,
+    });
+  },
+  // 权益领取
+  useList(data) {
+    return request({
+      url: "/qyp/order/useList",
+      method: "post",
+      data,
+    });
+  },
 };
 export default accountApi;
diff --git a/src/api/user.js b/src/api/user.js
index daa10ef..b4541a9 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -9,13 +9,6 @@
   })
 }
 
-export function getInfo(token) {
-  return request({
-    url: '/vue-admin-template/user/info',
-    method: 'get',
-    params: { token }
-  })
-}
 // 强制退出
 export function logout() {
   return request({
@@ -25,6 +18,7 @@
 }
 //更新用户密码
 export function updatePwd(data) {  
+  data.sysType = 4;
   return request({
     url: '/user/updatePwd',
     method: 'post',
diff --git a/src/utils/excelDownLoadConfig.js b/src/utils/excelDownLoadConfig.js
index d8150c3..c5afdad 100644
--- a/src/utils/excelDownLoadConfig.js
+++ b/src/utils/excelDownLoadConfig.js
@@ -2,7 +2,7 @@
  * @Author: 小明丶
  * @Date: 2019-10-25 10:17:56
  * @LastEditors: zhaoxiaoqiang 287285524@qq.com
- * @LastEditTime: 2023-07-28 16:27:12
+ * @LastEditTime: 2023-09-01 10:34:18
  * @Description: 
  */
 /**
@@ -62,7 +62,6 @@
 		downFile(blob, fileName);
 	},
 	configDate2: function(res, parFilename, from) {
-		console.log(res);
 		// let fileNamet =/\.{1}[A-Za-z]{1,}$/.exec(res.headers['content-disposition']);
 		let blob = new Blob([res.data], {type: 'application/vnd.ms-excel'});
 		let fileName = parFilename?parFilename:"";
@@ -71,8 +70,6 @@
 			if (window.navigator.msSaveOrOpenBlob) {
 				navigator.msSaveBlob(blob, fileName);
 			} else {
-				// let objectUrl = URL.createObjectURL(blob);
-				// window.location.href = objectUrl;
 				let link = document.createElement('a');
 				link.href = window.URL.createObjectURL(blob);
 				link.download = fileName;
diff --git a/src/views/qyp-project-order/admin.vue b/src/views/qyp-project-order/admin.vue
index 8ae691e..7320164 100644
--- a/src/views/qyp-project-order/admin.vue
+++ b/src/views/qyp-project-order/admin.vue
@@ -131,16 +131,23 @@
             <el-descriptions-item label="项目名称">{{ orderDetail.projName }}</el-descriptions-item>
         </el-descriptions>
       </el-dialog>
+      <el-dialog top="2vh"  :title="subTitle" fullscreen :visible.sync="productShow" width="60%">
+          <history v-if="isWhith==1"></history>
+          <plan  v-else-if="isWhith==2"></plan>
+          <draw  v-else-if="isWhith==3"></draw>
+      </el-dialog>
     </div>
   </template>
-  
   <script>
-  import Etable from "../../components/table.vue";
+  import Etable from "@/components/table.vue";
+  import history from './history.vue';
+  import plan from './plan.vue';
+  import draw from './draw.vue';
   import {orderInit,orderDtl} from "@/api/credit";
   import uploadImg from "@/components/upload.vue";
   export default {
     name: "order",
-    components: { Etable,uploadImg },
+    components: { Etable,uploadImg,history,plan,draw },
     data() {
       return {
           formInline: {status:"all"},
@@ -205,7 +212,7 @@
             {
               lable: "操作",
               align: "center",
-              width: "200",
+              width: "300",
               fixed: "right",
               render: (h, scope) => {
                 return h("div", [
@@ -229,6 +236,76 @@
                       },
                     },
                     "查看详情"
+                  ),
+                  h(
+                    "el-button",
+                    {
+                      props:{
+                        type:'text'
+                      },
+                      style: {
+                        // display: this.filterBtnById(150101)
+                        //   ? "inline-block"
+                        //   : "none",
+                      },
+                      on: {
+                        click: () => {
+
+                          this.isWhith = 1;
+                          this.productShow  = true;
+                          // this.title = '订单详情'; 
+                          // let {orderId} = scope.row;
+                          // this.getProductDetail(orderId);
+                        },
+                      },
+                    },
+                    "支付历史"
+                  ),
+                  h(
+                    "el-button",
+                    {
+                      props:{
+                        type:'text'
+                      },
+                      style: {
+                        // display: this.filterBtnById(150101)
+                        //   ? "inline-block"
+                        //   : "none",
+                      },
+                      on: {
+                        click: () => {
+                          this.isWhith = 2;
+                          this.productShow  = true;
+                          // this.title = '订单详情'; 
+                          // let {orderId} = scope.row;
+                          // this.getProductDetail(orderId);
+                        },
+                      },
+                    },
+                    "扣款计划"
+                  ),
+                  h(
+                    "el-button",
+                    {
+                      props:{
+                        type:'text'
+                      },
+                      style: {
+                        // display: this.filterBtnById(150101)
+                        //   ? "inline-block"
+                        //   : "none",
+                      },
+                      on: {
+                        click: () => {
+                          this.isWhith = 3;
+                          this.productShow  = true;
+                          // this.title = '订单详情'; 
+                          // let {orderId} = scope.row;
+                          // this.getProductDetail(orderId);
+                        },
+                      },
+                    },
+                    "权益领取"
                   )
                 ]);
               },
@@ -236,10 +313,23 @@
           ],
           relustObj: {},
           addProd:false,
+          productShow:false,
           createdTime:[],
           title:"新增项目",
           orderDetail:{},
-          exportExcelList:[]
+          exportExcelList:[],
+          isWhith:''
+      }
+    },
+    computed:{
+      subTitle(){
+        let text ='支付历史';
+        if(this.isWhith==2){
+          text = '扣款计划'
+        }else if(this.isWhith==3){
+          text = '权益领取'
+        }
+        return text;
       }
     },
     watch:{
@@ -249,7 +339,15 @@
           }
         },
         deep: true
-      }
+      },
+      productShow:{
+        handler: function(val) {
+          if(!val){
+            this.isWhith ='';
+          }
+        },
+        deep: true
+      },
     },
     //生命周期 - 创建完成(可以访问当前this实例)
     created() {
diff --git a/src/views/qyp-project-order/draw.vue b/src/views/qyp-project-order/draw.vue
index 8a43b3f..05e4283 100644
--- a/src/views/qyp-project-order/draw.vue
+++ b/src/views/qyp-project-order/draw.vue
@@ -1,32 +1,105 @@
+
 <!--
  * @Author: zhaoxiaoqiang 287285524@qq.com
  * @Date: 2023-08-24 15:16:23
  * @LastEditors: zhaoxiaoqiang 287285524@qq.com
- * @LastEditTime: 2023-08-24 15:17:26
+ * @LastEditTime: 2023-09-01 11:22:22
  * @FilePath: \qyp_plat\src\views\qyp-project-order\history.vue
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
 <template>
     <div>
-
+        <el-form
+            :model="formInline"
+            inline
+            label-width="120px"
+            class="form-flex"
+            size="small"
+        >
+            <div style="width: 90%">
+                <el-form-item label="权益账号:">
+                    <el-input
+                        v-model.trim="formInline.mblNo"
+                        style="width: 240px"
+                        @keyup.native="keyupEvent($event)"
+                        type="tel"
+                        clearable
+                        placeholder="请输入"
+                    ></el-input>
+                </el-form-item>
+                <el-form-item label="权益领取时间:">
+                    <el-date-picker
+                        v-model="createdTime"
+                        style="width: 240px"
+                        format="yyyy-MM-dd"
+                        value-format="yyyy-MM-dd"
+                        type="daterange"
+                        range-separator="-"
+                        start-placeholder="开始日期"
+                        end-placeholder="结束日期"
+                    >
+                    </el-date-picker>
+                </el-form-item>
+            </div>
+            <el-form-item style="text-align: right;">
+                <el-button type="primary" style="margin-left: 10px;margin-bottom: 8px;"  @click="onSearch">查 询</el-button>
+            </el-form-item>
+        </el-form>
+        <Etable
+            hasIndex
+            :searchData='searchData'
+            httpUrl="useList"
+            :columns="columns"
+            :exportUrl="{
+                url: '/qyp/order/useExport',
+                powerId: '',
+                name: '权益领取',
+            }"
+           >
+        </Etable>
     </div>
 </template>
 
 <script>
+import Etable from "@/components/table.vue";
 export default {
+    components: { Etable },
     data() {
         return {
-
-        };
+            columns:[
+                {
+                    lable: "权益账号",
+                    prop: "mblNo",
+                    align: "center",
+                },
+                {
+                    lable: "权益领取时间",
+                    prop: "creTime",
+                    align: "center",
+                },
+                {
+                    lable: "权益名称",
+                    prop: "productName",
+                    align: "center",
+                }
+            ],
+            formInline:{},
+            searchData:{},
+            createdTime:[]
+        }
     },
-    created() {
-
-    },
-    mounted() {
-
-    },
-    methods: {
-
+    methods:{
+        onSearch(){
+            this.formInline.creStartTime = this.createdTime[0]?this.createdTime[0]:null;
+            this.formInline.creEndTime = this.createdTime[1]?this.createdTime[1]:null;
+            let objForm = JSON.parse(JSON.stringify(this.formInline));
+            for (let key in objForm) {
+                if (objForm[key] === "all"||objForm[key] === null||objForm[key] === '') {
+                    delete objForm[key];
+                }
+            }
+            this.searchData = { ...objForm };
+        }
     }
 };
 </script>
diff --git a/src/views/qyp-project-order/history.vue b/src/views/qyp-project-order/history.vue
index bbe31b8..c8a0d42 100644
--- a/src/views/qyp-project-order/history.vue
+++ b/src/views/qyp-project-order/history.vue
@@ -3,31 +3,273 @@
  * @Author: zhaoxiaoqiang 287285524@qq.com
  * @Date: 2023-08-24 15:16:23
  * @LastEditors: zhaoxiaoqiang 287285524@qq.com
- * @LastEditTime: 2023-08-31 08:58:17
+ * @LastEditTime: 2023-09-01 11:19:29
  * @FilePath: \qyp_plat\src\views\qyp-project-order\history.vue
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
 <template>
     <div>
-       12121212
+        <el-form
+            :model="formInline"
+            inline
+            label-width="100px"
+            class="form-flex"
+            size="small"
+        >
+            <div style="width: 90%">
+                <el-form-item label="支付订单号:">
+                    <el-input
+                        v-model.trim="formInline.tradeNo"
+                        style="width: 240px"
+                        @keyup.native="keyupEvent($event)"
+                        type="tel"
+                        clearable
+                        placeholder="请输入"
+                    ></el-input>
+                </el-form-item>
+                <el-form-item label="支付时间:">
+                    <el-date-picker
+                        v-model="createdTime"
+                        style="width: 240px"
+                        format="yyyy-MM-dd"
+                        value-format="yyyy-MM-dd"
+                        type="daterange"
+                        range-separator="-"
+                        start-placeholder="开始日期"
+                        end-placeholder="结束日期"
+                    >
+                    </el-date-picker>
+                </el-form-item>
+                <el-form-item label="支付状态:">
+                        <el-select
+                            v-model="formInline.payStatus"
+                            style="width:240px"
+                            clearable
+                            placeholder="请选择"
+                        >
+                            <el-option label="全部" value="all"></el-option>
+                            <el-option
+                            v-for="item in relustObj.payStatusList"
+                            :key="item.code"
+                            :label="item.name"
+                            :value="item.code"
+                            ></el-option>
+                        </el-select>
+                </el-form-item>
+            </div>
+            <el-form-item style="text-align: right;">
+                <el-button type="primary" style="margin-left: 10px;margin-bottom: 8px;"  @click="onSearch">查 询</el-button>
+            </el-form-item>
+        </el-form>
+        <Etable
+            hasIndex
+            httpUrl="payList"
+            :columns="columns"
+            :searchData="searchData"
+            :exportUrl="{
+                url: '/qyp/order/payExport',
+                powerId: '',
+                name: '支付历史',
+            }"
+            >
+        </Etable>
+        <el-dialog top="2vh"  title="退款" append-to-body :visible.sync="productShow" width="40%">
+            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" size="small" label-width="100px" class="demo-ruleForm">
+                <el-form-item label="退款类型" prop="refundType">
+                    <el-radio-group v-model="ruleForm.refundType">
+                        <el-radio  v-for="item in  relustObj.refundTypeList" :disabled="!item.selected" :key="item.code" :label="item.code">{{ item.name }}</el-radio>
+                    </el-radio-group>
+                </el-form-item>
+                <el-form-item label="退款金额" prop="refundAmount">
+                    <el-input v-model="ruleForm.refundAmount" placeholder="请输入退款金额"></el-input>
+                </el-form-item>
+                <el-form-item style="text-align: right;">
+                    <el-button @click="resetForm('ruleForm')">取消</el-button>
+                    <el-button type="primary" @click="submitForm('ruleForm')">确认</el-button>
+                </el-form-item>
+            </el-form>
+        </el-dialog>
     </div>
 </template>
 
 <script>
+import {payInit,refund} from "@/api/credit";
+import Etable from "@/components/table.vue";
 export default {
+    components: { Etable },
     data() {
         return {
+            productShow:false,
+            formInline:{},
+            searchData:{},
+            createdTime:[],
+            relustObj:{},
+            columns:[
+                {
+                    lable: "支付订单号",
+                    prop: "tradeNo",
+                    align: "center",
+                    width: "300",
+                },
+                {
+                    lable: "支付时间",
+                    prop: "payTime",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "支付状态",
+                    prop: "payStatusStr",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "支付金额",
+                    prop: "payAmount",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "停车券退款状态",
+                    prop: "tcjRefundStatusStr",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "停车券退款金额",
+                    prop: "tcjRefundAmount",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "停车券退款时间",
+                    prop: "tcjRefundTime",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "权益会员退款状态",
+                    prop: "refundStatusStr",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "权益会员退款金额",
+                    prop: "refundAmount",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "权益会员退款时间",
+                    prop: "refundTime",
+                    align: "center",
+                    width: "180",
+                },
+                {
+                    lable: "操作",
+                    align: "center",
+                    width: "200",
+                    fixed: "right",
+                    render: (h, scope) => {
+                    return h("div", [
+                        h(
+                            "el-button",
+                            {
+                            props:{
+                                type:'text',
+                                disabled:!scope.row.canRefund&&!scope.row.tcjCanRefund
+                            },
+                            style: {
+                                // display: this.filterBtnById(150101)
+                                //   ? "inline-block"
+                                //   : "none",
+                            },
+                            on: {
+                                click: () => {
+                                    let {canRefund,tcjCanRefund,payId} = scope.row;
+                                    this.ruleForm.payId = payId;
+                                    this.relustObj.refundTypeList.forEach(element => {
+                                        if(element.code==1){
+                                            element.selected = canRefund;
+                                        }
+                                        if(element.code==2){
+                                            element.selected = tcjCanRefund;
+                                        }
+                                    });
+                                    this.productShow = true;
+                                },
+                            },
+                            },
+                            "退款"
+                        )
+                    ]);
+                },
+            },
 
+            ],
+            ruleForm:{},
+            rules:{
+                refundType: [
+                    { required: true, message: '请选择退款类型', trigger: 'change' }
+                ],
+                refundAmount: [{ required: true, message: '请输入退款金额', trigger: 'blur' }]  
+            }
         };
     },
-    created() {
-
+    watch:{
+        productShow:{
+            handler: function(val) {
+                if(!val){
+                    this.$refs['ruleForm'].resetFields(); 
+                }
+            },
+            deep: true
+        }
     },
-    mounted() {
-
+    created() {
+     this.initSerch();
     },
     methods: {
-
+        keyupEvent(e) {
+            //只能输入整数
+            e.target.value = e.target.value.replace(/[^\d]/g, "");
+        },
+        initSerch() {
+            payInit().then(({ body }) => {
+               this.relustObj = body;
+            });
+        },
+        onSearch() {
+            this.formInline.payStartTime = this.createdTime[0]?this.createdTime[0]:null;
+            this.formInline.payEndTime = this.createdTime[1]?this.createdTime[1]:null;
+            let objForm = JSON.parse(JSON.stringify(this.formInline));
+            for (let key in objForm) {
+                if (objForm[key] === "all"||objForm[key] === null||objForm[key] === '') {
+                    delete objForm[key];
+                }
+            }
+            this.searchData = { ...objForm };
+        },
+        submitForm(formName) {
+            this.$refs[formName].validate((valid) => {
+            if (valid) {
+                refund(this.ruleForm).then(({body})=>{
+                    this.$message.success("退款成功");
+                    this.onSearch();
+                    this.productShow = false;
+                }).catch(err=>{
+                    this.productShow = false;
+                })
+            } else {
+                console.log('error submit!!');
+                return false;
+            }
+            });
+        },
+        resetForm(formName) {
+            this.$refs[formName].resetFields();
+            this.productShow = false;
+        }
     }
 };
 </script>
diff --git a/src/views/qyp-project-order/plan.vue b/src/views/qyp-project-order/plan.vue
index 44775ce..0645fbf 100644
--- a/src/views/qyp-project-order/plan.vue
+++ b/src/views/qyp-project-order/plan.vue
@@ -1,33 +1,53 @@
+
 <!--
  * @Author: zhaoxiaoqiang 287285524@qq.com
  * @Date: 2023-08-24 15:16:23
  * @LastEditors: zhaoxiaoqiang 287285524@qq.com
- * @LastEditTime: 2023-08-24 15:17:08
+ * @LastEditTime: 2023-09-01 10:31:52
  * @FilePath: \qyp_plat\src\views\qyp-project-order\history.vue
  * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
 <template>
     <div>
-
+        <Etable
+            hasIndex
+            httpUrl="payPlanList"
+            :columns="columns"
+            :exportUrl="{
+                url: '/qyp/order/payPlanExport',
+                powerId: '',
+                name: '扣款计划',
+            }"
+           >
+        </Etable>
     </div>
 </template>
 
 <script>
+import Etable from "@/components/table.vue";
 export default {
+    components: { Etable },
     data() {
         return {
-
+            columns:[
+                {
+                    lable: "扣款次数",
+                    prop: "term",
+                    align: "center",
+                },
+                {
+                    lable: "扣款日期",
+                    prop: "deductTime",
+                    align: "center",
+                },
+                {
+                    lable: "扣款金额",
+                    prop: "payAmt",
+                    align: "center",
+                }
+            ]
         };
     },
-    created() {
-
-    },
-    mounted() {
-
-    },
-    methods: {
-
-    }
 };
 </script>
 

--
Gitblit v1.8.0