Browse Source

修改退款逻辑显示

martin.ma 4 years ago
parent
commit
375e0b7fff
1 changed files with 113 additions and 135 deletions
  1. 113 135
      pages/main/index/cert_count.vue

+ 113 - 135
pages/main/index/cert_count.vue

@@ -37,69 +37,68 @@
     </el-row>
 
     <div>
-      <el-table v-loading="loading" :border="true" :data="table" style="width: 100%">
-        <el-table-column label="真名+昵称" width="190">
-            <template slot-scope="scope">
-                <div>昵称:{{ scope.row.user_info.nickname }}</div>
-                <div>真名:{{ scope.row.user_info.realname }}</div>
-            </template>
-        </el-table-column>
-        <el-table-column prop="uid" label="uid" width="80"> </el-table-column>
-        <el-table-column label="技术栈" width="120">
-            <template slot-scope="scope">
-                <div>{{ scope.row.user_info.direction_name }}</div>
-            </template>
-        </el-table-column>
-        <el-table-column label="技能" width="180">
-            <template slot-scope="scope">
-                <div>{{ scope.row.user_info.skill_description }}</div>
-            </template>
-        </el-table-column>
-        <el-table-column label="作品" width="200">
-            <template slot-scope="scope">
-                <div>
-                    <el-popover placement="top-start" title="作品介绍" trigger="hover" width="600" :content="scope.row.user_info.work_description">
-                        <div class="text-line-1" slot="reference">
-                            {{ scope.row.user_info.work_description }}
-                        </div>
-                    </el-popover>
-                </div>
-            </template>
-        </el-table-column>
-        <el-table-column label="状态" width="120">
-            <template slot-scope="scope">
-                <div>
-                    {{ dev_statusMap[scope.row.dev_status] }}
-                </div>
-            </template>
-        </el-table-column>
-        <el-table-column prop="checktime" label="认证完成时间" width="190">
-        </el-table-column>
-        <el-table-column label="先认证后付款" width="120">
-            <template slot-scope="scope">
-                <div>
-                    <el-tag v-if="scope.row.cert_type == 1">直接付费</el-tag>
-                    <el-tag v-if="scope.row.cert_type == 2" type="warning">预付</el-tag>
-                </div>
-            </template>
-        </el-table-column>
-        <el-table-column label="退款" width="190">
-            <template slot-scope="scope">
-                <div>
-                    <template v-if="scope.row.refundState == 1">
-                        <el-button type="danger" plain size="small" @click="applyRefund(scope.row)">申请退款</el-button>
-                    </template>
-                    <template v-if="scope.row.refundState == 2">
-                        <el-tag type="info">已提交</el-tag>
-                        <el-button type="danger" plain size="small" @click="refund(scope.row)">确认退款</el-button>
-                    </template>
-
-                    <el-tag v-if="scope.row.refundState == 3" type="success">退款完成</el-tag>
-                    <el-tag v-if="scope.row.refundState == 4" type="warning">无法退款</el-tag>
-                </div>
-            </template>
-        </el-table-column>
-        <!-- <el-table-column label="操作" fixed="right">
+        <el-table v-loading="loading" :border="true" :data="table" style="width: 100%">
+            <el-table-column label="真名+昵称" width="190">
+                <template slot-scope="scope">
+                    <div>昵称:{{ scope.row.user_info.nickname }}</div>
+                    <div>真名:{{ scope.row.user_info.realname }}</div>
+                </template>
+            </el-table-column>
+            <el-table-column prop="uid" label="uid" width="80"> </el-table-column>
+            <el-table-column label="技术栈" width="120">
+                <template slot-scope="scope">
+                    <div>{{ scope.row.user_info.direction_name }}</div>
+                </template>
+            </el-table-column>
+            <el-table-column label="技能" width="180">
+                <template slot-scope="scope">
+                    <div>{{ scope.row.user_info.skill_description }}</div>
+                </template>
+            </el-table-column>
+            <el-table-column label="作品" width="200">
+                <template slot-scope="scope">
+                    <div>
+                        <el-popover placement="top-start" title="作品介绍" trigger="hover" width="600" :content="scope.row.user_info.work_description">
+                            <div class="text-line-1" slot="reference">
+                                {{ scope.row.user_info.work_description }}
+                            </div>
+                        </el-popover>
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column label="状态" width="120">
+                <template slot-scope="scope">
+                    <div>
+                        {{ dev_statusMap[scope.row.dev_status] }}
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column prop="checktime" label="认证完成时间" width="190">
+            </el-table-column>
+            <el-table-column label="先认证后付款" width="120">
+                <template slot-scope="scope">
+                    <div>
+                        <el-tag v-if="scope.row.cert_type == 1">直接付费</el-tag>
+                        <el-tag v-if="scope.row.cert_type == 2" type="warning">先用后付</el-tag>
+                    </div>
+                </template>
+            </el-table-column>
+            <el-table-column label="退款" width="190">
+                <template slot-scope="scope">
+                    <div>
+                        <template v-if="scope.row.tk_status == 1">
+                            <el-button size="small" @click="applyRefund(scope.row)">申请退款</el-button>
+                        </template>
+                        <template v-if="scope.row.tk_status == 2">
+                            <el-button type="danger" size="small" @click="refund(scope.row)">确认退款</el-button>
+                        </template>
+                        <template v-if="scope.row.tk_status == 3">
+                            <el-tag type="info">退款成功</el-tag>
+                        </template>
+                    </div>
+                </template>
+            </el-table-column>
+            <!-- <el-table-column label="操作" fixed="right">
             <template slot-scope="scope">
                 <template v-if="scope.row.status == 1">
                     <el-button type="success" size="mini" @click="setDynamicPass(scope.row.comId)">通过</el-button>
@@ -116,7 +115,7 @@
                 <el-button type="danger" size="mini" @click="delDynamic(scope.row.comId)">删除</el-button>
             </template>
         </el-table-column> -->
-    </el-table>
+        </el-table>
     </div>
 
     <el-row :gutter="24">
@@ -140,119 +139,119 @@ export default {
                 uid: undefined,
                 field102: [null, null],
                 dev_status: 0,
-                cert_type: 0,
+                cert_type: 0
             },
             rules: {
                 uid: [{
                     required: false,
                     message: "请输入uid",
-                    trigger: "blur",
-                }, ],
+                    trigger: "blur"
+                }],
                 field102: [{
                     required: false,
                     type: "array",
                     message: "请至少选择一个技术栈",
-                    trigger: "change",
-                }, ],
+                    trigger: "change"
+                }],
                 dev_status: [{
                     required: false,
                     message: "请选择状态",
-                    trigger: "change",
-                }, ],
+                    trigger: "change"
+                }],
                 cert_type: [{
                     required: false,
                     message: "请选择先认证后付款",
-                    trigger: "change",
-                }, ],
+                    trigger: "change"
+                }]
             },
             field102Options: [],
             order_statusOptions: [{
                     label: "全部",
-                    value: 0,
+                    value: 0
                 },
                 {
                     label: "完善基础信,待支付",
-                    value: 1,
+                    value: 1
                 },
                 {
                     label: "已经支付,待完善简历",
-                    value: 2,
+                    value: 2
                 },
                 {
                     label: "完善简历结束,等待后台审核",
-                    value: 3,
+                    value: 3
                 },
                 {
                     label: "后台审核成功,分配面试官",
-                    value: 4,
+                    value: 4
                 },
                 {
                     label: "面试官分配结束,待面试",
-                    value: 5,
+                    value: 5
                 },
                 {
                     label: "已拒绝",
-                    value: 6,
+                    value: 6
                 },
                 {
                     label: "面试结束",
-                    value: 7,
+                    value: 7
                 },
                 {
                     label: "已打款",
-                    value: 8,
-                },
+                    value: 8
+                }
             ],
             dev_statusOptions: [{
                     label: "全部",
-                    value: 0,
+                    value: 0
                 },
                 {
                     label: "未接单",
-                    value: 1,
+                    value: 1
                 },
                 {
                     label: "正在对接",
-                    value: 2,
+                    value: 2
                 },
                 {
                     label: "开发中",
-                    value: 3,
+                    value: 3
                 },
                 {
                     label: "已完成订单",
-                    value: 4,
+                    value: 4
                 },
                 {
                     label: "已退款",
-                    value: 5,
-                },
+                    value: 5
+                }
             ],
             cert_typeOptions: [{
                     label: "全部",
-                    value: 0,
+                    value: 0
                 },
                 {
                     label: "直接付费",
-                    value: 1,
+                    value: 1
                 },
                 {
-                    label: "付",
-                    value: 2,
-                },
+                    label: "先用后付",
+                    value: 2
+                }
             ],
             field102Props: {
                 multiple: false,
                 label: "label",
                 value: "value",
-                children: "children",
+                children: "children"
             },
 
             table: [],
             page: 1,
             page_size: 10,
             total: 0,
-            loading: false,
+            loading: false
         };
     },
     computed: {
@@ -262,9 +261,9 @@ export default {
                 2: "正在对接",
                 3: "开发中",
                 4: "已完成订单",
-                5: "已退款",
+                5: "已退款"
             };
-        },
+        }
     },
     watch: {},
     created() {
@@ -278,7 +277,7 @@ export default {
             return row.dev_status == 1 || row.dev_status == 2;
         },
         submitForm() {
-            this.$refs["modalForm"].validate((valid) => {
+            this.$refs["modalForm"].validate(valid => {
                 if (!valid) return;
 
                 this.page = 1;
@@ -291,7 +290,7 @@ export default {
         },
         getField102Options() {
             this.$post("/api/direction/get_all_data")
-                .then((res) => {
+                .then(res => {
                     if (res.status == 1) {
                         let aa = directionDataParse(res.data);
                         this.field102Options = [...aa];
@@ -300,7 +299,7 @@ export default {
                 .catch(() => {
                     this.$message({
                         type: "info",
-                        message: "操作失败",
+                        message: "操作失败"
                     });
                 });
         },
@@ -331,53 +330,32 @@ export default {
             let res = await this.$post("/uapi/cert/order", {
                 ...params,
                 page: this.page,
-                page_size: this.page_size,
+                page_size: this.page_size
             });
             this.loading = false;
             if (res && res.status === 1) {
-                let list = res.data.list.map(this.getRefundState);
-                this.table = [...list];
+                this.table = [...res.data.list];
                 this.total = res.data.total;
             }
         },
 
-        getRefundState(item) {
-            // refundState
-            // 1 正常
-            // 2 退款中
-            // 3 退款完成
-            // 4 无法退款
-            let refundState = 1;
-
-            if (item.dev_status == 1 || item.dev_status == 2) {
-                refundState = item.tk_status;
-            } else {
-                refundState = 4;
-            }
-
-            return {
-                ...item,
-                refundState,
-            };
-        },
-
         // 申请退款
         async applyRefund(row) {
             this.loading = true;
             let res = await this.$post("/uapi/cert/tk", {
-                id: row.id,
+                id: row.id
             });
             this.loading = false;
             if (res && res.status === 1) {
                 this.$message({
                     type: "success",
-                    message: "退款成功",
+                    message: "退款成功"
                 });
                 this.fetchData();
             } else {
                 this.$message({
                     type: "error",
-                    message: "退款失败",
+                    message: "退款失败"
                 });
             }
         },
@@ -386,23 +364,23 @@ export default {
         async refund(row) {
             this.loading = true;
             let res = await this.$post("/uapi/cert/confirm_tk", {
-                id: row.id,
+                id: row.id
             });
             this.loading = false;
             if (res && res.status === 1) {
                 this.$message({
                     type: "success",
-                    message: "退款成功",
+                    message: "退款成功"
                 });
                 this.fetchData();
             } else {
                 this.$message({
                     type: "error",
-                    message: "退款失败",
+                    message: "退款失败"
                 });
             }
-        },
-    },
+        }
+    }
 };
 
 function directionDataParse(arr) {
@@ -425,13 +403,13 @@ function directionDataParse(arr) {
                 ...other,
                 label,
                 value,
-                children,
+                children
             };
         } else {
             item = {
                 ...other,
                 label,
-                value,
+                value
             };
         }
         result.push(item);