lion 10 months ago
parent e116f211a9
commit 4481fa90df

@ -8,11 +8,39 @@ import { Loading, Message } from "element-ui";
*/
let loading;
function customParamsSerializer(params) {
let result = '';
for (let key in params) {
if (params.hasOwnProperty(key)) {
if (Array.isArray(params[key])) {
params[key].forEach((item,index) => {
if(item.key){
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
}else{
result +=`${key}[${index}]=${item}&`
}
});
}else if( typeof params[key] === 'object' ){
for(var k in params[key]){
result +=`${key}[${k}]=${params[key][k]}&`
}
} else {
result += `${key}=${params[key]}&`;
}
}
}
// result += 'token='+getToken()
console.log("result",result, result.slice(0, -1))
return result.slice(0, -1);
}
export async function download(url, method = "get", info, filename) {
loading = Loading.service({
lock: true,
background: "rgba(0,0,0,0.4)",
text: "文件正在生成中...",
text: "Loading...",
});
let options = {
@ -29,6 +57,7 @@ export async function download(url, method = "get", info, filename) {
},
};
if (method === "get") {
// options.url = url+'?'+customParamsSerializer(info)
Object.defineProperty(options, "params", {
value: info,
enumerable: true,
@ -44,6 +73,10 @@ export async function download(url, method = "get", info, filename) {
}
try {
if(options.method==='get'){
options.paramsSerializer = customParamsSerializer
}
console.log("options",options)
const response = await axios.request(options);
loading.close();

@ -74,12 +74,12 @@
fixed: 'left'
}, {
prop: 'number',
label: 'Application Id(应用id)',
label: 'Application Id',
align: 'left',
width:360
}, {
prop: 'title',
label: 'Title(标题)',
label: 'Title',
align: 'left',
}
]

@ -72,42 +72,42 @@
fixed: 'left'
}, {
prop: 'first_name',
label: 'First Name(名)',
label: 'First Name',
align: 'left',
width: 240,
}, {
prop: 'last_name',
label: 'Last Name(姓)',
label: 'Last Name',
align: 'left',
width: 240,
},
{
prop: 'origination',
label: 'Organization(组织)',
label: 'Organization',
align: 'left',
width: 240
},
{
prop: 'email',
label: 'Email(邮箱)',
label: 'Email',
align: 'left',
width: 240
},
{
prop: 'country',
label: 'Country/Region(国家)',
label: 'Country/Region',
align: 'left',
width: 240
},
{
prop: 'shipping_address',
label: 'Address(地址)',
label: 'Address',
align: 'left',
width: 360
},
{
prop: 'Created At',
label: 'created_at(创建时间)',
label: 'created_at',
align: 'left',
width: 240
}

@ -14,7 +14,11 @@
</div>
<div>
<el-button type="primary" size="small" @click="resetSearch">reset</el-button>
</div>
</div>
<div>
<el-button type="primary" size="small" @click="exportExcel">export</el-button>
</div>
<!-- <div>
<el-button type="primary" size="small" @click="editNote('add')">add</el-button>
</div> -->
@ -26,17 +30,9 @@
</div>
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange"
:table-item="table_item">
<template v-slot:product>
<template v-slot:order_product>
<el-table-column align='left' label="Product" minWidth="360" header-align="center">
<!-- <template slot-scope="scope">
<el-table :data="scope.row.order_products" style="width: 100%; margin-top: 10px;">
<el-table-column prop="name" label="订单名称"></el-table-column>
<el-table-column prop="number" label="订单日期"></el-table-column>
<el-table-column prop="total" label="金额"></el-table-column>
</el-table>
</template> -->
<el-table-column align='left' label="name" width="360" header-align="center">
<el-table-column align='left' label="Product Name" width="360" header-align="center">
<template slot-scope="scope">
<template v-if="scope.row.order_products && scope.row.order_products.length>0">
<template v-for="item in scope.row.order_products">
@ -45,7 +41,7 @@
</template>
</template>
</el-table-column>
<el-table-column align='left' label="number" width="360" header-align="center">
<el-table-column align='left' label="Part Number" width="360" header-align="center">
<template slot-scope="scope">
<template v-if="scope.row.order_products && scope.row.order_products.length>0">
<template v-for="item in scope.row.order_products">
@ -54,7 +50,7 @@
</template>
</template>
</el-table-column>
<el-table-column align='left' label="total" width="120" header-align="center">
<el-table-column align='left' label="Total" width="120" header-align="center">
<template slot-scope="scope">
<template v-if="scope.row.order_products && scope.row.order_products.length>0">
<template v-for="item in scope.row.order_products">
@ -86,7 +82,10 @@
import {
index,
destroy
} from "@/api/order/index.js"
} from "@/api/order/index.js"
import {
download
} from "@/utils/downloadRequest";
export default {
components: {},
data() {
@ -98,7 +97,8 @@
},
total: 0,
list: [],
table_item: [{
table_item: [{
prop:'index',
type: 'index',
width: 50,
fixed: 'left'
@ -108,7 +108,7 @@
align: 'left',
width: 240
}, {
prop: 'product',
prop: 'order_product',
label: 'Product',
align: 'left',
minWidth: 360,
@ -136,6 +136,11 @@
label: 'Address',
align: 'left',
width: 360
}, {
prop: 'created_at',
label: 'Created At',
align: 'left',
width: 240
}]
}
},
@ -156,6 +161,31 @@
this.select.page = 1
this.select.number = ''
this.getList()
},
exportExcel() {
let _export = {}
this.table_item.map(item => {
if (item.prop === 'index') {
}else {
_export[item.prop] = item.label
}
})
download(
'/api/admin/order/index',
'get', {
export_fields: _export,
show_relation: ['orderProducts.product', 'user'],
filter: [{
key: 'number',
op: 'like',
value: this.select.number
}],
is_export: 1,
page: 1,
page_size: 99999
},
`Orders.xlsx`)
},
async getList() {
const res = await index({

@ -69,23 +69,23 @@
fixed: 'left'
}, {
prop: 'number',
label: 'Parameter Encoding(参数编码)',
label: 'Parameter Encoding',
align: 'left',
width:240,
}, {
prop: 'name',
label: 'Parameter Name(参数名称)',
label: 'Parameter Name',
align: 'left',
width:240,
},
{
prop: 'remark',
label: 'Remark(备注)',
label: 'Remark',
align: 'left'
},
{
prop: 'sort',
label: 'Sort(排序)',
label: 'Sort',
align: 'left',
width: 120
}

@ -61,7 +61,7 @@
<template v-slot:is_visible>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Visible前台是否显示
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Visible
</div>
<div class="xy-table-item-content">
<el-radio-group v-model="form.is_visible">
@ -74,7 +74,7 @@
<template v-slot:is_sell>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Active当前是否售卖
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Active
</div>
<div class="xy-table-item-content">
<el-radio-group v-model="form.is_sell">
@ -87,13 +87,13 @@
<template v-slot:show_price>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Web Visibility(是否显示价格)
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Web Visibility
</div>
<div class="xy-table-item-content">
<el-radio-group v-model="form.show_price" @change="changeWeb">
<!-- <el-radio style="margin-bottom:5px" :label="2">Direct display(直接显示价格)</el-radio> -->
<el-radio style="margin-bottom:5px" :label="0">Need to log in(需要登录)</el-radio>
<el-radio style="margin-bottom:5px" :label="1">Need to contact sales(需要联系销售)</el-radio>
<el-radio style="margin-bottom:5px" :label="0">Need to log in</el-radio>
<el-radio style="margin-bottom:5px" :label="1">Need to contact sales</el-radio>
</el-radio-group>
</div>

@ -122,11 +122,11 @@
// },
{
id:0,
value:'Need to log in(需要登录)'
value:'Need to log in'
},
{
id:1,
value:'Need to contact sales(需要联系销售)'
value:'Need to contact sales'
}],
table_item: [{
type: 'index',
@ -134,28 +134,28 @@
fixed: 'left'
}, {
prop: 'category',
label: 'Product Phase(产品项)',
label: 'Product Phase',
align: 'left',
}, {
prop: 'name',
label: 'Product Name(产品名称)',
label: 'Product Name',
align: 'left',
width: 360
}, {
prop: 'number',
label: 'Part Number(产品编号)',
label: 'Part Number',
align: 'left',
width: 360
}, {
prop: 'list_price',
label: 'List Price(产品价格)',
label: 'List Price',
align: 'left',
width: 240
},
{
prop: 'is_visible',
label: 'Visible(前台是否显示)',
label: 'Visible',
align: 'center',
width: 120,
formatter: (cell, data, value) => {
@ -164,7 +164,7 @@
},
{
prop: 'is_sell',
label: 'Active(当前是否售卖)',
label: 'Active',
align: 'center',
width: 120,
formatter: (cell, data, value) => {
@ -173,14 +173,14 @@
},
{
prop: 'show_price',
label: 'Web Visibility(是否显示价格)',
label: 'Web Visibility',
align: 'center',
width: 180,
formatter: (cell, data, value) => {
if(value==1){
return 'Need to contact sales(需要联系销售)'
return 'Need to contact sales'
}else{
return 'Need to log in(需要登录)'
return 'Need to log in'
}
}
}

@ -1,13 +1,13 @@
<template>
<el-form :model="form" ref="form" :rules="rules">
<el-form-item label="姓名" label-position="right" prop="name">
<el-form-item label="Username" label-position="right" prop="name">
<el-input v-model.trim="form.name" />
</el-form-item>
<el-form-item label="密码" label-position="right" prop="password">
<el-form-item label="Password" label-position="right" prop="password">
<el-input v-model.trim="form.password" type="password" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submit"></el-button>
<el-button type="primary" @click="submit">Confirm</el-button>
</el-form-item>
</el-form>
</template>
@ -32,12 +32,12 @@
rules: {
name: [{
required: true,
message: '请输入姓名',
message: 'Please Input Username',
trigger: 'blur'
}],
password: [{
required: true,
message: '请输入密码',
message: 'Please Input Password',
trigger: 'blur',
}]
},

@ -3,17 +3,17 @@
<div v-if="user">
<el-row :gutter="20">
<el-col :span="6" :xs="24">
<!-- <el-col :span="6" :xs="24">
<user-card :user="user" />
</el-col>
</el-col> -->
<el-col :span="18" :xs="24">
<el-col :span="24" :xs="24">
<el-card>
<el-tabs v-model="activeTab">
<el-tab-pane label="操作日志" name="timeline">
<!-- <el-tab-pane label="操作日志" name="timeline">
<timeline />
</el-tab-pane>
<el-tab-pane label="信息修改" name="account">
</el-tab-pane> -->
<el-tab-pane label="Information" name="account">
<account />
</el-tab-pane>
</el-tabs>
@ -47,7 +47,7 @@
data() {
return {
user: {},
activeTab: 'timeline'
activeTab: 'account'
}
},
computed: {

@ -25,7 +25,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath
*/
publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: '/Users/mac/Documents/朗业/2024/s-美国赛分/saifen/public/admin_test',
outputDir: '/Users/mac/Documents/朗业/2024/s-美国赛分/saifen/public/admin',
assetsDir: 'static',
css: {
loaderOptions: { // 向 CSS 相关的 loader 传递选项

Loading…
Cancel
Save