orders.vue 4.5 KB
Newer Older
喷火的神灵's avatar
喷火的神灵 已提交
1 2 3 4
<!--支付界面-->
<template>
  <div>
    <div class="idxs">
5 6 7 8 9 10 11
      <el-table
          :data="tableData.filter(data => !search || data.tradeName.toLowerCase().includes(search.toLowerCase()))"
          style="width: 100%">
        <el-table-column
            label="商品号"
            prop="orderID">
        </el-table-column>
喷火的神灵's avatar
喷火的神灵 已提交
12 13
        <el-table-column
            label="商品名称"
14
            prop="tradeName">
喷火的神灵's avatar
喷火的神灵 已提交
15 16 17
        </el-table-column>
        <el-table-column
            label="订单号"
18 19 20 21 22
            prop="orderNumber">
        </el-table-column>
        <el-table-column
            label="支付宝订单号"
            prop="zfbNumber">
喷火的神灵's avatar
喷火的神灵 已提交
23 24 25
        </el-table-column>
        <el-table-column
            label="支付方式"
26
            prop="payment">
喷火的神灵's avatar
喷火的神灵 已提交
27 28 29
        </el-table-column>
        <el-table-column
            label="金额"
30
            prop="price">
喷火的神灵's avatar
喷火的神灵 已提交
31 32 33
        </el-table-column>
        <el-table-column
            label="购买时间"
34
            prop="payTime">
喷火的神灵's avatar
喷火的神灵 已提交
35 36
        </el-table-column>
        <el-table-column
37 38
            label="订单状态"
            prop="enable">
喷火的神灵's avatar
喷火的神灵 已提交
39 40 41 42 43 44 45 46 47
        </el-table-column>
        <el-table-column
            align="right">
          <template slot="header" slot-scope="scope">
            <el-input
                v-model="search"
                size="mini"
                placeholder="输入关键字搜索"/>
          </template>
48 49 50 51 52 53 54
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button type="primary" size="mini" @click="buy(scope.row)">支付</el-button>
              <el-button type="danger" icon="el-icon-delete" size="mini"
                         @click="openDeleteConfirm(scope.row)"></el-button>
            </template>
          </el-table-column>
喷火的神灵's avatar
喷火的神灵 已提交
55 56 57 58 59 60 61 62 63
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import Handder from "@/components/Handder";
import Sidebar from "@/components/sidebar";
喷火的神灵's avatar
喷火的神灵 已提交
64 65
import {
  handleDeleteOrders,
66 67
  loadOrdersList,
  BuyOrders
喷火的神灵's avatar
喷火的神灵 已提交
68
} from "@/utils/option";
喷火的神灵's avatar
喷火的神灵 已提交
69 70 71 72 73 74

export default {
  name: "orders",
  components: {Handder, Sidebar},
  data() {
    return {
75
      tableData: [],
喷火的神灵's avatar
喷火的神灵 已提交
76 77 78 79
      search: ''
    }
  },
  methods: {
喷火的神灵's avatar
喷火的神灵 已提交
80 81 82 83
    //加载订单列表
    loadOrdersListMethod() {
      loadOrdersList().then(res => {
        if (res.success) {
84
          this.tableData = res.data;
喷火的神灵's avatar
喷火的神灵 已提交
85 86 87 88
        }
      })
    },

89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
    buy(row) {
      console.log(row.tradeName)
      console.log(row.orderNumber)
      console.log(row.price)
      window.open("http://localhost:8089/alipay/pay?subject=" + row.tradeName + "&out_trade_no=" + row.orderNumber + "&total_amount=" + row.price)
      this.$notify.success({
        title: '成功',
        message: '支付宝请求成功',
        position: 'bottom-right'
      })
    },


    // //支付功能
    // buy(row){
    //   BuyOrders().then(res=>{
    //       let url = "http://localhost:8089/alipay/pay?subject="+row.tradeName+"&tradeNo="+row.orderNumber+"&totalAmount="+row.price
    //       window.open(url)
    //       this.$message.success("支付宝请求成功!")
    //   })
    // },

喷火的神灵's avatar
喷火的神灵 已提交
111
// 弹出删除确认框
112 113
    openDeleteConfirm(tableData) {
      let message = '此操作将永久删除【' + tableData.tradeName + '】订单,是否继续?';
喷火的神灵's avatar
喷火的神灵 已提交
114 115 116 117 118
      this.$confirm(message, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
119
        this.handleDeleteDetails(tableData);
喷火的神灵's avatar
喷火的神灵 已提交
120 121 122 123
      }).catch(() => {
      });
    },
    // 执行删除
124 125
    handleDeleteDetails(tableData) {
      handleDeleteOrders(tableData).then(res => {
喷火的神灵's avatar
喷火的神灵 已提交
126
        if (res.success) {
127
          this.$notify.success({
喷火的神灵's avatar
喷火的神灵 已提交
128
            message: '删除标签成功!',
129 130 131
            title: '成功',
            position: 'bottom-right',

喷火的神灵's avatar
喷火的神灵 已提交
132 133 134 135
          });
          this.loadOrdersListMethod();
        } else {
          let title = '操作失败';
136 137 138 139
          this.$notify.error({
            title: title,
            text: res.message,
            position: 'bottom-right'
喷火的神灵's avatar
喷火的神灵 已提交
140 141 142
          });
        }
      })
喷火的神灵's avatar
喷火的神灵 已提交
143 144 145
    }
  },
  created() {
喷火的神灵's avatar
喷火的神灵 已提交
146 147
    //加载订单列表
    this.loadOrdersListMethod()
喷火的神灵's avatar
喷火的神灵 已提交
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
  }
}
</script>

<style scoped>
@media screen and (min-width: 1970px) {
  .idxs {
    margin: 60px auto;
    width: calc(100% - 290px);
    max-width: 1570px;
    min-width: 1200px;
  }
}

@media screen and (max-width: 1969px) {
  .idxs {
    /*width: 1270px;*/
    /*min-width: 1000px;*/
    /*margin-top: 60px;*/
    /*margin-left: 270px;*/
    /*padding: 40px;*/
    width: calc(100% - 290px);
    max-width: 1570px;
    min-width: 1200px;
    margin: 60px auto;
  }

  .idxs {
    margin-left: 50px;
  }
}


</style>