| | |
| | | <div class="button searchBtn" @click="searchingBtn">搜索</div> |
| | | <div class="button resetBtn" @click="clearSearch">重置</div> |
| | | </div> |
| | | <div class="to-excel"> |
| | | <div class="to-excel" @click="exportList"> |
| | | <span class="iconfont"></span> <span>导出</span> |
| | | </div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getOrders } from "@/api/order"; |
| | | import { getOrders, getAuthFile } from "@/api/order"; |
| | | import { getOrderById } from "@/api/product"; |
| | | |
| | | export default { |
| | |
| | | let param = { |
| | | page: this.page, |
| | | size: this.size, |
| | | startTime: this.searchTime[0], |
| | | endTime: this.searchTime[1], |
| | | startTime: this.searchTime ? this.searchTime[0] : "", |
| | | endTime: this.searchTime ? this.searchTime[1] : "", |
| | | inputText: this.inputText, |
| | | productBaseId: "0", |
| | | orderName: "", |
| | | orderType: "", |
| | | status: 0, |
| | | }; |
| | | getOrders(param).then((res) => { |
| | | this.dataList = res.data.list.map((item, indez) => { |
| | | let status = ""; |
| | | switch (item.orderStatus) { |
| | | case -1: |
| | | status = "已取消"; |
| | | break; |
| | | case 0: |
| | | status = "未下单"; |
| | | break; |
| | | case 1: |
| | | status = "待支付"; |
| | | break; |
| | | case 2: |
| | | status = "已支付"; |
| | | break; |
| | | case 11: |
| | | status = "审核中"; |
| | | break; |
| | | case 12: |
| | | status = "已驳回"; |
| | | break; |
| | | default: |
| | | status = ""; |
| | | } |
| | | let name = ""; |
| | | let downFlag = false; |
| | | let products = []; |
| | | item.products.forEach((every, index) => { |
| | | // 判断本订单是否存在可下载的内容(软件,sdk) |
| | | if (every.productType == 1 || every.productType == 3) { |
| | | downFlag = true; |
| | | getOrders(param) |
| | | .then((res) => { |
| | | this.dataList = res.data.list.map((item, indez) => { |
| | | let status = ""; |
| | | switch (item.orderStatus) { |
| | | case -1: |
| | | status = "已取消"; |
| | | break; |
| | | case 0: |
| | | status = "未下单"; |
| | | break; |
| | | case 1: |
| | | status = "待支付"; |
| | | break; |
| | | case 2: |
| | | status = "已支付"; |
| | | break; |
| | | case 11: |
| | | status = "审核中"; |
| | | break; |
| | | case 12: |
| | | status = "已驳回"; |
| | | break; |
| | | default: |
| | | status = ""; |
| | | } |
| | | // 归类产品和激活码以供下载 |
| | | products.push({ |
| | | productId: every.productId, |
| | | productName: every.productName, |
| | | activateCode: every.activateCode, |
| | | productTypeName: every.productTypeName, |
| | | let name = ""; |
| | | let downFlag = false; |
| | | let products = []; |
| | | item.products.forEach((every, index) => { |
| | | // 判断本订单是否存在可下载的内容(软件,sdk) |
| | | if (every.productType == 1 || every.productType == 3) { |
| | | downFlag = true; |
| | | } |
| | | // 归类产品和激活码以供下载 |
| | | products.push({ |
| | | productId: every.productId, |
| | | productName: every.productName, |
| | | activateCode: every.activateCode, |
| | | productTypeName: every.productTypeName, |
| | | }); |
| | | if (index == 0) { |
| | | name += every.productName + "(" + every.productTypeName + ")"; |
| | | } else { |
| | | name += |
| | | " / " + every.productName + "(" + every.productTypeName + ")"; |
| | | } |
| | | }); |
| | | if (index == 0) { |
| | | name += every.productName + "(" + every.productTypeName + ")"; |
| | | } else { |
| | | name += |
| | | " / " + every.productName + "(" + every.productTypeName + ")"; |
| | | } |
| | | return { |
| | | id: item.id, |
| | | sn: item.sn, |
| | | name: name, |
| | | source: item.source == 0 ? "激活码下载" : "线上购买", |
| | | createTime: item.createTime, |
| | | status: status, |
| | | orderStatus: item.orderStatus, |
| | | orderMoney: item.orderMoney, |
| | | payMethod: item.payMethod, |
| | | code: |
| | | item.products.length > 1 ? "-" : item.products[0].activateCode, |
| | | canDownLoad: downFlag, |
| | | products: products, |
| | | }; |
| | | }); |
| | | return { |
| | | id: item.id, |
| | | sn: item.sn, |
| | | name: name, |
| | | source: item.source == 0 ? "激活码下载" : "线上购买", |
| | | createTime: item.createTime, |
| | | status: status, |
| | | orderStatus: item.orderStatus, |
| | | orderMoney: item.orderMoney, |
| | | payMethod: item.payMethod, |
| | | code: |
| | | item.products.length > 1 ? "-" : item.products[0].activateCode, |
| | | canDownLoad: downFlag, |
| | | products: products, |
| | | }; |
| | | this.total = res.data.total; |
| | | if (res.data.total <= this.size) { |
| | | this.page = 1; |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | this.$notify.error(err.msg); |
| | | }); |
| | | this.total = res.data.total; |
| | | if (res.data.total <= this.size) { |
| | | this.page = 1; |
| | | } |
| | | }); |
| | | }, |
| | | //分页功能 |
| | | handleSizeChange(size) { |
| | |
| | | }, |
| | | |
| | | clearSearch() { |
| | | debugger; |
| | | this.searchTime = this.getDateInit(); |
| | | debugger; |
| | | this.inputText = ""; |
| | | this.searchingBtn(); |
| | | }, |
| | |
| | | }, |
| | | |
| | | openImg(url) { |
| | | window.open("http://" + url); |
| | | window.open("/httpImage/" + url); |
| | | }, |
| | | |
| | | async exportList() { |
| | | let param = { |
| | | page: this.page, |
| | | size: this.size, |
| | | startTime: this.searchTime ? this.searchTime[0] : "", |
| | | endTime: this.searchTime ? this.searchTime[1] : "", |
| | | inputText: this.inputText, |
| | | productBaseId: "0", |
| | | orderName: "", |
| | | orderType: "", |
| | | status: 0, |
| | | }; |
| | | |
| | | const result = await getAuthFile(param); |
| | | |
| | | console.log(result); |
| | | |
| | | var blob = new Blob([result.body.data], { |
| | | type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8", |
| | | }), |
| | | Temp = document.createElement("a"); |
| | | |
| | | Temp.href = window.URL.createObjectURL(blob); |
| | | |
| | | console.log(result); |
| | | console.log(result.fileName); |
| | | |
| | | Temp.download = window.decodeURI(result.fileName); |
| | | |
| | | Temp.setAttribute("download", result.fileName); |
| | | |
| | | document.body.appendChild(Temp); |
| | | |
| | | Temp.click(); |
| | | |
| | | document.body.removeChild(Temp); |
| | | |
| | | window.URL.revokeObjectURL(Temp); |
| | | }, |
| | | }, |
| | | mounted() {}, |
| | |
| | | align-items: center; |
| | | justify-content: center; |
| | | margin-left: 195px; |
| | | cursor: pointer; |
| | | } |
| | | .resetBtn { |
| | | width: 60px; |