orders.vue 4.8 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
          <el-table-column label="操作">
            <template slot-scope="scope">
50

喷火的神灵's avatar
喷火的神灵 已提交
51 52
              <el-button type="primary" size="mini" @click="buy(scope.row)" v-if="!scope.row.status" >支付</el-button>
              <el-button type="primary" size="mini" @click="buy(scope.row)" v-else disabled>支付</el-button>
53

54 55 56 57
              <el-button type="danger" icon="el-icon-delete" size="mini"
                         @click="openDeleteConfirm(scope.row)"></el-button>
            </template>
          </el-table-column>
喷火的神灵's avatar
喷火的神灵 已提交
58 59 60 61 62 63 64 65 66
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

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

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

          this.status=res.data.status
喷火的神灵's avatar
喷火的神灵 已提交
91 92 93
        }
      })
    },
94 95 96
    cancel (){

    },
喷火的神灵's avatar
喷火的神灵 已提交
97

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    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
喷火的神灵 已提交
120
// 弹出删除确认框
121
    openDeleteConfirm(tableData) {
喷火的神灵's avatar
喷火的神灵 已提交
122
      alert(tableData.status)
123
      let message = '此操作将永久删除【' + tableData.tradeName + '】订单,是否继续?';
喷火的神灵's avatar
喷火的神灵 已提交
124 125 126 127 128
      this.$confirm(message, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
129
        this.handleDeleteDetails(tableData);
喷火的神灵's avatar
喷火的神灵 已提交
130 131 132 133
      }).catch(() => {
      });
    },
    // 执行删除
134 135
    handleDeleteDetails(tableData) {
      handleDeleteOrders(tableData).then(res => {
喷火的神灵's avatar
喷火的神灵 已提交
136
        if (res.success) {
137
          this.$notify.success({
喷火的神灵's avatar
喷火的神灵 已提交
138
            message: '删除标签成功!',
139 140 141
            title: '成功',
            position: 'bottom-right',

喷火的神灵's avatar
喷火的神灵 已提交
142 143 144 145
          });
          this.loadOrdersListMethod();
        } else {
          let title = '操作失败';
146 147 148 149
          this.$notify.error({
            title: title,
            text: res.message,
            position: 'bottom-right'
喷火的神灵's avatar
喷火的神灵 已提交
150 151 152
          });
        }
      })
喷火的神灵's avatar
喷火的神灵 已提交
153 154 155
    }
  },
  created() {
喷火的神灵's avatar
喷火的神灵 已提交
156 157
    //加载订单列表
    this.loadOrdersListMethod()
喷火的神灵's avatar
喷火的神灵 已提交
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
  }
}
</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>