zweizhao 7 gadi atpakaļ
vecāks
revīzija
b1b120e91e
1 mainītis faili ar 19 papildinājumiem un 10 dzēšanām
  1. 19 10
      src/module/main/components/gongmall.vue

+ 19 - 10
src/module/main/components/gongmall.vue

@@ -25,10 +25,11 @@
             <a v-else-if="prop === 'nickname'" :href="`/rooter/user/${scope.row['uid']}`" target="_blank">{{scope.row[prop]}}</a>
             <span v-else-if="prop === 'create_time'">{{scope.row[prop] | toDate}}</span>
             <template v-else-if="prop === 'state'">
-              <el-button v-if="scope.row[prop] === '1'" type="primary">确认付款</el-button>
+              <el-button v-if="scope.row[prop] === '1'" type="primary" @click="confirmPay(scope.row)">确认付款</el-button>
               <span v-else-if="scope.row[prop] === '4'">已提交</span>
               <span v-else-if="scope.row[prop] === '8'">已成功</span>
-              <el-button v-else-if="scope.row[prop] === '16'" type="danger">失败重试</el-button>
+              <el-button v-else-if="scope.row[prop] === '16'" type="danger" @click="rePay(scope.row)">失败重试</el-button>
+              <span v-else>--</span>
             </template>
             <span v-else>{{scope.row[prop]}}</span>
           </template>
@@ -109,12 +110,20 @@ export default {
     }
   },
   methods: {
-    // 根据状态显示图表样式
-    tableRowClassName({ row, rowIndex }) {
-      // console.log({row, rowIndex})
-      let className = ""
-      if(row.status === "1") className = "success-row"
-      return className
+    // 重新支付
+    async rePay(i) {
+      const res = await this.$post('/api/admin/gongmall/confirm_pay', {
+        id: i.id,
+        amount: i.current_gongmall,
+        nickname: i.nickname,
+      })
+      if(res) {
+        this.getTableData()
+      }
+    },
+    // 确认支付
+    confirmPay(i) {
+      this.rePay(i)
     },
     // 页码变动
     changePagination() {
@@ -157,10 +166,10 @@ export default {
       })
     },
     // 获取列表数据
-    async getTableData(status = 0) {
+    async getTableData() {
       this.tableData = []
       const p = this.currentPage
-      const res = await this.$post("/api/admin/gongmall/orders", { p, status })
+      const res = await this.$post("/api/admin/gongmall/orders", { p })
       // console.log(res)
       const data = res.data
       const list = data.list