用户导入

master
lion 11 months ago
parent 204bcc8735
commit 4baf253736

@ -64,6 +64,14 @@ export function visitLog(params) {
})
}
export function imports(params) {
return request({
method: "get",
url: "/api/admin/user/import",
params
})
}

@ -1,550 +1,144 @@
export default {
data() {
return {
countryList: [{
"code": "AF",
"name": "Afghanistan"
},
{
"code": "AL",
"name": "Albania"
},
{
"code": "DZ",
"name": "Algeria"
},
{
"code": "AQ",
"name": "Antarctica"
},
{
"code": "AR",
"name": "Argentina"
},
{
"code": "AM",
"name": "Armenia"
},
{
"code": "AU",
"name": "Australia"
},
{
"code": "AT",
"name": "Austria"
},
{
"code": "AZ",
"name": "Azerbaijan"
},
{
"code": "BS",
"name": "Bahamas"
},
{
"code": "BH",
"name": "Bahrain"
},
{
"code": "BD",
"name": "Bangladesh"
},
{
"code": "BY",
"name": "Belarus"
},
{
"code": "BE",
"name": "Belgium"
},
{
"code": "BZ",
"name": "Belize"
},
{
"code": "BM",
"name": "Bermuda"
},
{
"code": "BO",
"name": "Bolivia"
},
{
"code": "BA",
"name": "Bosnia-Herzog."
},
{
"code": "BW",
"name": "Botswana"
},
{
"code": "BR",
"name": "Brazil"
},
{
"code": "BN",
"name": "Brunei"
},
{
"code": "BG",
"name": "Bulgaria"
},
{
"code": "KH",
"name": "Cambodia"
},
{
"code": "CA",
"name": "Canada"
},
{
"code": "CL",
"name": "Chile"
},
{
"code": "CN",
"name": "China"
},
{
"code": "CO",
"name": "Colombia"
},
{
"code": "CG",
"name": "Congo"
},
{
"code": "CR",
"name": "Costa Rica"
},
{
"code": "HR",
"name": "Croatia"
},
{
"code": "CY",
"name": "Cyprus"
},
{
"code": "CZ",
"name": "Czech Republic"
},
{
"code": "DK",
"name": "Denmark"
},
{
"code": "EC",
"name": "Ecuador"
},
{
"code": "EG",
"name": "Egypt"
},
{
"code": "SV",
"name": "El Salvador"
},
{
"code": "EE",
"name": "Estonia"
},
{
"code": "ET",
"name": "Ethiopia"
},
{
"code": "FJ",
"name": "Fiji"
},
{
"code": "FI",
"name": "Finland"
},
{
"code": "FR",
"name": "France"
},
{
"code": "GM",
"name": "Gambia"
},
{
"code": "GE",
"name": "Georgia"
},
{
"code": "DE",
"name": "Germany"
},
{
"code": "GH",
"name": "Ghana"
},
{
"code": "GI",
"name": "Gibraltar"
},
{
"code": "GR",
"name": "Greece"
},
{
"code": "GD",
"name": "Grenada"
},
{
"code": "GP",
"name": "Guadeloupe"
},
{
"code": "GU",
"name": "Guam"
},
{
"code": "GT",
"name": "Guatemala"
},
{
"code": "HT",
"name": "Haiti"
},
{
"code": "HN",
"name": "Honduras"
},
{
"code": "HK",
"name": "Hong Kong"
},
{
"code": "HU",
"name": "Hungary"
},
{
"code": "IS",
"name": "Iceland"
},
{
"code": "IN",
"name": "India"
},
{
"code": "ID",
"name": "Indonesia"
},
{
"code": "IQ",
"name": "Iraq"
},
{
"code": "IE",
"name": "Ireland"
},
{
"code": "IL",
"name": "Israel"
},
{
"code": "IT",
"name": "Italy"
},
{
"code": "JM",
"name": "Jamaica"
},
{
"code": "JP",
"name": "Japan"
},
{
"code": "JE",
"name": "Jersey"
},
{
"code": "JO",
"name": "Jordan"
},
{
"code": "KZ",
"name": "Kazakhstan"
},
{
"code": "KE",
"name": "Kenya"
},
{
"code": "KW",
"name": "Kuwait"
},
{
"code": "LV",
"name": "Latvia"
},
{
"code": "LB",
"name": "Lebanon"
},
{
"code": "LY",
"name": "Libya"
},
{
"code": "LT",
"name": "Lithuania"
},
{
"code": "LU",
"name": "Luxembourg"
},
{
"code": "MO",
"name": "Macao"
},
{
"code": "MK",
"name": "Macedonia"
},
{
"code": "MY",
"name": "Malaysia"
},
{
"code": "MT",
"name": "Malta"
},
{
"code": "MX",
"name": "Mexico"
},
{
"code": "ME",
"name": "Montenegro"
},
{
"code": "MA",
"name": "Morocco"
},
{
"code": "MM",
"name": "Myanmar"
},
{
"code": "NP",
"name": "Nepal"
},
{
"code": "AN",
"name": "Neth.Antilles"
},
{
"code": "NL",
"name": "Netherlands"
},
{
"code": "NC",
"name": "New Caledonia"
},
{
"code": "NZ",
"name": "New Zealand"
},
{
"code": "NI",
"name": "Nicaragua"
},
{
"code": "NG",
"name": "Nigeria"
},
{
"code": "NF",
"name": "Norfolk Island"
},
{
"code": "NO",
"name": "Norway"
},
{
"code": "OM",
"name": "Oman"
},
{
"code": "PK",
"name": "Pakistan"
},
{
"code": "PS",
"name": "Palestinian Territory"
},
{
"code": "PA",
"name": "Panama"
},
{
"code": "PG",
"name": "Papua New Guinea"
},
{
"code": "PY",
"name": "Paraguay"
},
{
"code": "PE",
"name": "Peru"
},
{
"code": "PH",
"name": "Philippines"
},
{
"code": "PL",
"name": "Poland"
},
{
"code": "PF",
"name": "Polynesia FR"
},
{
"code": "PT",
"name": "Portugal"
},
{
"code": "PR",
"name": "Puerto Rico"
},
{
"code": "QA",
"name": "Qatar"
},
{
"code": "RO",
"name": "Romania"
},
{
"code": "RU",
"name": "Russia"
},
{
"code": "LC",
"name": "Saint Lucia"
},
{
"code": "SA",
"name": "Saudi Arabia"
},
{
"code": "SN",
"name": "Senegal"
},
{
"code": "RS",
"name": "Serbia"
},
{
"code": "SG",
"name": "Singapore"
},
{
"code": "SK",
"name": "Slovakia"
},
{
"code": "SI",
"name": "Slovenia"
},
{
"code": "ZA",
"name": "South Africa"
},
{
"code": "KR",
"name": "South Korea"
},
{
"code": "ES",
"name": "Spain"
},
{
"code": "LK",
"name": "Sri Lanka"
},
{
"code": "SE",
"name": "Sweden"
},
{
"code": "CH",
"name": "Switzerland"
},
{
"code": "TW",
"name": "Taiwan"
},
{
"code": "TH",
"name": "Thailand"
},
{
"code": "TT",
"name": "Trinidad And Tobago"
},
{
"code": "TN",
"name": "Tunisia"
},
{
"code": "TR",
"name": "Turkey"
},
{
"code": "AE",
"name": "U Arab Emirates"
},
{
"code": "VI",
"name": "US Virgin Is."
},
{
"code": "UA",
"name": "Ukraine"
},
{
"code": "GB",
"name": "United Kingdom"
},
{
"code": "US",
"name": "United States of America"
},
{
"code": "UY",
"name": "Uruguay"
},
{
"code": "UZ",
"name": "Uzbekistan"
},
{
"code": "VU",
"name": "Vanuatu"
},
{
"code": "VE",
"name": "Venezuela"
},
{
"code": "VN",
"name": "Vietnam"
},
{
"code": "YE",
"name": "Yemen"
},
{
"code": "ZM",
"name": "Zambia"
}
countryList: [
{"code": "AF", "name": "Afghanistan"},
{"code": "AL", "name": "Albania"},
{"code": "DZ", "name": "Algeria"},
{"code": "AQ", "name": "Antarctica"},
{"code": "AR", "name": "Argentina"},
{"code": "AM", "name": "Armenia"},
{"code": "AU", "name": "Australia"},
{"code": "AT", "name": "Austria"},
{"code": "AZ", "name": "Azerbaijan"},
{"code": "BS", "name": "Bahamas"},
{"code": "BH", "name": "Bahrain"},
{"code": "BD", "name": "Bangladesh"},
{"code": "BY", "name": "Belarus"},
{"code": "BE", "name": "Belgium"},
{"code": "BZ", "name": "Belize"},
{"code": "BM", "name": "Bermuda"},
{"code": "BO", "name": "Bolivia"},
{"code": "BA", "name": "Bosnia and Herzegovina"},
{"code": "BW", "name": "Botswana"},
{"code": "BR", "name": "Brazil"},
{"code": "BN", "name": "Brunei"},
{"code": "BG", "name": "Bulgaria"},
{"code": "KH", "name": "Cambodia"},
{"code": "CA", "name": "Canada"},
{"code": "CL", "name": "Chile"},
{"code": "CN", "name": "China"},
{"code": "CO", "name": "Colombia"},
{"code": "CG", "name": "Congo"},
{"code": "CR", "name": "Costa Rica"},
{"code": "HR", "name": "Croatia"},
{"code": "CY", "name": "Cyprus"},
{"code": "CZ", "name": "Czech Republic"},
{"code": "DK", "name": "Denmark"},
{"code": "EC", "name": "Ecuador"},
{"code": "EG", "name": "Egypt"},
{"code": "SV", "name": "El Salvador"},
{"code": "EE", "name": "Estonia"},
{"code": "ET", "name": "Ethiopia"},
{"code": "FJ", "name": "Fiji"},
{"code": "FI", "name": "Finland"},
{"code": "FR", "name": "France"},
{"code": "GM", "name": "Gambia"},
{"code": "GE", "name": "Georgia"},
{"code": "DE", "name": "Germany"},
{"code": "GH", "name": "Ghana"},
{"code": "GI", "name": "Gibraltar"},
{"code": "GR", "name": "Greece"},
{"code": "GD", "name": "Grenada"},
{"code": "GP", "name": "Guadeloupe"},
{"code": "GU", "name": "Guam"},
{"code": "GT", "name": "Guatemala"},
{"code": "HT", "name": "Haiti"},
{"code": "HN", "name": "Honduras"},
{"code": "HK", "name": "Hong Kong"},
{"code": "HU", "name": "Hungary"},
{"code": "IS", "name": "Iceland"},
{"code": "IN", "name": "India"},
{"code": "ID", "name": "Indonesia"},
{"code": "IQ", "name": "Iraq"},
{"code": "IE", "name": "Ireland"},
{"code": "IL", "name": "Israel"},
{"code": "IT", "name": "Italy"},
{"code": "JM", "name": "Jamaica"},
{"code": "JP", "name": "Japan"},
{"code": "JE", "name": "Jersey"},
{"code": "JO", "name": "Jordan"},
{"code": "KZ", "name": "Kazakhstan"},
{"code": "KE", "name": "Kenya"},
{"code": "KW", "name": "Kuwait"},
{"code": "LV", "name": "Latvia"},
{"code": "LB", "name": "Lebanon"},
{"code": "LY", "name": "Libya"},
{"code": "LT", "name": "Lithuania"},
{"code": "LU", "name": "Luxembourg"},
{"code": "MO", "name": "Macao"},
{"code": "MK", "name": "Macedonia"},
{"code": "MY", "name": "Malaysia"},
{"code": "MT", "name": "Malta"},
{"code": "MX", "name": "Mexico"},
{"code": "ME", "name": "Montenegro"},
{"code": "MA", "name": "Morocco"},
{"code": "MM", "name": "Myanmar"},
{"code": "NP", "name": "Nepal"},
{"code": "AN", "name": "Neth.Antilles"},
{"code": "NL", "name": "Netherlands"},
{"code": "NC", "name": "New Caledonia"},
{"code": "NZ", "name": "New Zealand"},
{"code": "NI", "name": "Nicaragua"},
{"code": "NG", "name": "Nigeria"},
{"code": "NF", "name": "Norfolk Island"},
{"code": "NO", "name": "Norway"},
{"code": "OM", "name": "Oman"},
{"code": "PK", "name": "Pakistan"},
{"code": "PS", "name": "Palestinian Territory"},
{"code": "PA", "name": "Panama"},
{"code": "PG", "name": "Papua New Guinea"},
{"code": "PY", "name": "Paraguay"},
{"code": "PE", "name": "Peru"},
{"code": "PH", "name": "Philippines"},
{"code": "PL", "name": "Poland"},
{"code": "PF", "name": "Polynesia FR"},
{"code": "PT", "name": "Portugal"},
{"code": "PR", "name": "Puerto Rico"},
{"code": "QA", "name": "Qatar"},
{"code": "RO", "name": "Romania"},
{"code": "RU", "name": "Russia"},
{"code": "LC", "name": "Saint Lucia"},
{"code": "SA", "name": "Saudi Arabia"},
{"code": "SN", "name": "Senegal"},
{"code": "RS", "name": "Serbia"},
{"code": "SG", "name": "Singapore"},
{"code": "SK", "name": "Slovakia"},
{"code": "SI", "name": "Slovenia"},
{"code": "ZA", "name": "South Africa"},
{"code": "KR", "name": "South Korea"},
{"code": "ES", "name": "Spain"},
{"code": "LK", "name": "Sri Lanka"},
{"code": "SE", "name": "Sweden"},
{"code": "CH", "name": "Switzerland"},
{"code": "TW", "name": "Taiwan"},
{"code": "TH", "name": "Thailand"},
{"code": "TT", "name": "Trinidad And Tobago"},
{"code": "TN", "name": "Tunisia"},
{"code": "TR", "name": "Turkey"},
{"code": "AE", "name": "U Arab Emirates"},
{"code": "VI", "name": "US Virgin Is."},
{"code": "UA", "name": "Ukraine"},
{"code": "GB", "name": "United Kingdom"},
{"code": "US", "name": "United States of America",
},
{"code": "UY", "name": "Uruguay"},
{"code": "UZ", "name": "Uzbekistan"},
{"code": "VU", "name": "Vanuatu"},
{"code": "VE", "name": "Venezuela"},
{"code": "VN", "name": "Vietnam"},
{"code": "YE", "name": "Yemen"},
{"code": "ZM", "name": "Zambia"}
]
}
},

@ -22,13 +22,13 @@
</div>
</div>
</template>
<template v-slot:organization>
<template v-slot:origination>
<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>Organization
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>Origination
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.organization"></el-input>
<el-input placeholder="Please Input" style="width:100%" v-model="form.origination"></el-input>
</div>
</div>
</template>
@ -41,6 +41,16 @@
<el-input placeholder="Please Input" style="width:100%" v-model="form.email"></el-input>
</div>
</div>
</template>
<template v-slot:mobile>
<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>Phone
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.mobile"></el-input>
</div>
</div>
</template>
<template v-slot:country>
<div class="xy-table-item">
@ -53,17 +63,92 @@
</el-select>
</div>
</div>
</template>
<template v-slot:shipping_region>
<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>States/Province
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.shipping_region" placeholder="Please Select">
<el-option v-for="(item,index) in taxList" :key="index" :label="item.year+'-'+item.name" :value="item.name"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:address>
<template v-slot:shipping_address>
<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>Address
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>Shipping Address
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.address"></el-input>
<el-input placeholder="Please Input" style="width:100%" v-model="form.shipping_address"></el-input>
</div>
</div>
</template>
</template>
<template v-slot:shipping_city>
<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>Shipping City
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.shipping_city"></el-input>
</div>
</div>
</template>
<template v-slot:shipping_postal>
<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>Shipping Zip/Postal Code
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.shipping_postal"></el-input>
</div>
</div>
</template>
<!-- <template v-slot:billing_region>
<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>Billing States/Province
</div>
<div class="xy-table-item-content">
<el-select style="width:100%" v-model="form.billing_region" placeholder="Please Select">
<el-option v-for="(item,index) in taxList" :key="index" :label="item.year+'-'+item.name" :value="item.name"></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:billing_address>
<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>Billing Address
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.billing_address"></el-input>
</div>
</div>
</template>
<template v-slot:billing_city>
<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>Billing City
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.billing_city"></el-input>
</div>
</div>
</template>
<template v-slot:billing_postal>
<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>Billing Zip/Postal Code
</div>
<div class="xy-table-item-content">
<el-input placeholder="Please Input" style="width:100%" v-model="form.billing_postal"></el-input>
</div>
</div>
</template> -->
</xy-dialog>
@ -75,6 +160,9 @@
save,
show
} from "@/api/customer"
import {
index
} from "@/api/order/tax.js"
import customerMixin from "@/mixin/customer.js"
export default {
mixins:[customerMixin],
@ -82,17 +170,26 @@
return {
isShow: false,
id: '',
type: 'add',
type: 'add',
taxList:[],
uploadOther: {
token: ""
},
form: {
first_name: '',
last_name: '',
organization: '',
email: '',
country: '',
address: ''
origination: '',
email: '',
mobile:'',
country: '',
shipping_region:'',
shipping_address: '',
shipping_city:'',
shipping_postal:'',
// billing_city:'',
// billing_postal:'',
// billing_address:'',
// billing_region:''
},
rules: {
first_name: [{
@ -103,7 +200,7 @@
required: true,
message: 'Please Input'
}],
organization: [{
origination: [{
required: true,
message: 'Please Input'
}],
@ -118,8 +215,17 @@
}
}
},
created() {},
methods: {
created() {
this.getTaxList()
},
methods: {
async getTaxList() {
const res = await index({
page:1,
page_size:999
})
this.taxList = res.data
},
submit() {
if (this.id) {
this.form.id = this.id
@ -162,10 +268,18 @@
this.form = {
first_name: '',
last_name: '',
organization: '',
email: '',
country: '',
address: ''
origination: '',
email: '',
mobile:'',
country: '',
shipping_region:'',
shipping_address: '',
shipping_city:'',
shipping_postal:'',
// billing_city:'',
// billing_postal:'',
// billing_address:'',
// billing_region:''
}
this.$refs['dialog'].reset()
}

@ -0,0 +1,159 @@
<template>
<div>
<el-dialog :visible.sync="dialogVisible" title="import" width="740px">
<div class="title">Download The Template</div>
<el-button
style="margin-top: 10px"
size="small"
type="primary"
@click="exportExcel('Customer' + new Date().getTime().toString())"
>Download</el-button
>
<div style="color: red; margin-top: 10px">
Do not modify the title name of the template when importing,unique index for part number.
</div>
<el-upload
style="margin-top: 10px"
drag
:action="action"
:headers="{
Authorization: `Bearer ${getToken()}`,
}"
:on-success="uploadSuccess"
:on-error="uploadFail"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">Drag the file here, or <em>click Upload</em></div>
<div class="el-upload__tip" slot="tip">Only xls/xlsx files can be uploaded</div>
</el-upload>
<!-- <div class="title" style="margin-top: 10px;">数据预览</div>
<Table :data="tableList" :columns="table" style="margin-top: 10px;"></Table>
<div style="font-size: 12px;zoom: 0.8;">总共数据{{ tableList.length }}</div> -->
<!-- <el-button type="primary" size="small" style="margin-top: 10px;" @click="imports"></el-button> -->
</el-dialog>
</div>
</template>
<script>
import * as XLSX from "xlsx";
import { saveAs } from "file-saver";
import { getToken } from "@/utils/auth";
import { imports } from "@/api/system/baseForm";
import { imports as importProduct } from "@/api/customer/index";
export default {
props: {
formInfo: {
type: Array,
default: () => [],
},
tableName: String,
},
data() {
return {
action: `${process.env.VUE_APP_BASE_API}/api/admin/user/import`,
dialogVisible: false,
headers: [],
tableList: [],
table: [],
};
},
methods: {
getToken,
show() {
this.dialogVisible = true;
},
hidden() {
this.dialogVisible = false;
},
//
uploadFail(err) {
console.log(err);
this.$message({
message: "Upload failed.",
type: "error",
});
},
uploadSuccess(response) {
this.tableList = response;
this.$message({
message: `Upload successful`,
type: "success",
});
this.hidden();
this.$emit('refresh')
},
exportExcel(sheetName) {
let headers_all = this.headers.filter((header) => header.export)
const data = [headers_all.map((header) => header.label)];
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, sheetName);
const wbout = XLSX.write(wb, {
bookType: "xlsx",
bookSST: true,
type: "array",
});
saveAs(
new Blob([wbout], { type: "application/octet-stream" }),
`${sheetName}.xlsx`
);
},
imports() {
importProduct({
data: this.tableList
}).then(res => {
console.log(res)
this.$message({
type: 'success',
message: `成功导入${res.total}`
})
})
this.hidden();
this.$emit('refresh')
}
},
computed: {},
watch: {
formInfo(newVal) {
console.log("newVal",newVal)
if (newVal && newVal instanceof Array) {
this.headers = newVal.map((i) => {
return {
key: i.prop,
title: i.label,
};
});
}
},
},
};
</script>
<style scoped lang="scss">
.title {
font-size: 15px;
font-weight: 600;
padding: 8px 4px;
position: relative;
&::before {
content: '';
width: 4px;
background: $primaryColor;
position: absolute;
top: 8px;
bottom: 8px;
left: -8px;
}
}
::v-deep .el-upload-list{
display:none!important
}
</style>

@ -20,19 +20,24 @@
v-model="dateRange" type="datetimerange" range-separator="To" start-placeholder="Start Date"
end-placeholder="End Date">
</el-date-picker>
</div>
</div>
<div>
<el-button type="primary" size="small" @click="select.page=1,getList()">search</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="resetSearch">reset</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="editCustomer('add')">add</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="exportExcel">export</el-button>
</div>
<div>
<el-button type="primary" size="small" @click="importTable">import</el-button>
</div>
<!-- <div>
<el-button type="primary" size="small" @click="editCustomer('add')">add</el-button>
</div> -->
</div>
</div>
@ -45,7 +50,7 @@
<el-table-column align='center' fixed="right" label="Operate" width="180" header-align="center">
<template slot-scope="scope">
<!-- <el-button type="primary" size="small" @click="showCustomer(scope.row.id)">orders</el-button> -->
<el-button type="primary" size="small" @click="showCustomer(scope.row.id)">view</el-button>
<el-button type="primary" size="small" @click="editCustomer('editor',scope.row.id)">edit</el-button>
<!-- <el-button type="primary" size="small" @click="editCustomer('editor',scope.row.id)">edit</el-button> -->
<el-popconfirm confirm-button-text="confirm" cancel-button-text="cancel" style="margin:0 10px"
@confirm="deleteList(scope.row.id)" title="Are you sure to delete it?">
@ -56,13 +61,15 @@
</template>
</xy-table>
<show-customer ref="showCustomer" @refresh="getList"></show-customer>
<addCustomer ref="addCustomer" @refresh="getList"></addCustomer>
<addCustomer ref="addCustomer" @refresh="getList"></addCustomer>
<imports ref="imports" @refresh="getList"></imports>
</div>
</template>
<script>
import showCustomer from './components/showCustomer.vue';
import addCustomer from './components/addCustomer.vue';
import addCustomer from './components/addCustomer.vue';
import imports from "./components/imports.vue"
import {
index,
destroy
@ -73,7 +80,8 @@
export default {
components: {
showCustomer,
addCustomer
addCustomer,
imports
},
data() {
return {
@ -91,42 +99,102 @@
table_item: [{
type: 'index',
width: 50,
fixed: 'left'
fixed: 'left',
export:false,
}, {
prop: 'first_name',
label: 'First Name',
align: 'left',
width: 240,
width: 240,
export:true,
}, {
prop: 'last_name',
label: 'Last Name',
align: 'left',
width: 240,
width: 240,
export:true,
},
{
prop: 'origination',
label: 'Organization',
align: 'left',
width: 240
width: 240,
export:true,
},
{
prop: 'email',
label: 'Email',
align: 'left',
width: 240
},
width: 240,
export:true,
},
{
prop: 'mobile',
label: 'Phone',
align: 'left',
width: 240,
export:true,
},
{
prop: 'country',
label: 'Country/Region',
align: 'left',
width: 240
width: 240,
export:true,
},
{
prop: 'shipping_region',
label: 'States/Province',
align: 'left',
width: 240,
export:true,
},
{
prop: 'shipping_address',
label: 'Address',
label: 'Shipping Address',
align: 'left',
width: 360
},
width: 240,
export:true,
},
{
prop: 'shipping_city',
label: 'Shipping City',
align: 'left',
width: 240,
export:true,
},
{
prop: 'shipping_postal',
label: 'Shipping Zip/Postal Code',
align: 'left',
width: 240,
export:true,
},
// {
// prop: 'billing_address',
// label: 'Billing Address',
// align: 'left',
// width: 240
// },
// {
// prop: 'billing_region',
// label: 'Billing States/Province',
// align: 'left',
// width: 240
// },
// {
// prop: 'billing_city',
// label: 'Billing City',
// align: 'left',
// width: 240
// },
// {
// prop: 'billing_postal',
// label: 'Billing Zip/Postal Code',
// align: 'left',
// width: 240
// },
{
prop: 'created_at',
label: 'Created At',
@ -140,7 +208,11 @@
created() {
this.getList()
},
methods: {
methods: {
importTable(row) {
this.$refs.imports.headers = this.table_item
this.$refs.imports.show()
},
showCustomer(id) {
this.$refs.showCustomer.id = id
this.$refs.showCustomer.isShow = true

@ -1,16 +1,19 @@
<template>
<div>
<el-dialog :visible.sync="dialogVisible" title="import" width="740px">
<!-- <div class="title">模板下载</div> -->
<!-- <el-button
<div class="title">Download The Template</div>
<el-button
style="margin-top: 10px"
size="small"
type="primary"
@click="exportExcel(new Date().getTime().toString())"
>模板下载</el-button
> -->
@click="exportExcel('Product' + new Date().getTime().toString())"
>Download</el-button
>
<div style="color: red; margin-top: 10px">
Do not modify the title name of the template when importing,unique index for part number.
<p>Do not modify the title name of the template when importing,unique index for part number.</p>
<p>Top,Product Visible,Active, please fill in <strong>yes</strong> or <strong>no</strong></p>
<p>Price Visible, please fill in <strong>Need to contact sales</strong> or <strong>Need to log in</strong></p>
<p>Please fill in the standard time for Sort Time, such as <strong>2025-05-10 12:00:00</strong></p>
</div>
<el-upload
@ -87,7 +90,8 @@ export default {
},
exportExcel(sheetName) {
const data = [this.headers.map((header) => header.title)];
let headers_all = this.headers.filter((header) => header.export)
const data = [headers_all.map((header) => header.label)];
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, sheetName);

@ -153,27 +153,32 @@
table_item: [{
type: 'index',
width: 50,
fixed: 'left'
fixed: 'left',
export:false
}, {
prop: 'category',
label: 'Product Phase',
align: 'left',
align: 'left',
export:false
}, {
prop: 'name',
label: 'Product Name',
align: 'left',
width: 360
width: 360,
export:true
}, {
prop: 'number',
label: 'Part Number',
align: 'left',
width: 360
width: 360,
export:true
}, {
prop: 'list_price',
label: 'List Price',
align: 'left',
width: 240
width: 240,
export:true
},
{
prop: 'is_top',
@ -181,6 +186,7 @@
align: 'center',
width: 120,
is_text:true,
export:true,
text_prop:'is_top_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
@ -192,6 +198,7 @@
align: 'center',
width: 120,
is_text:true,
export:true,
text_prop:'is_visible_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
@ -203,6 +210,7 @@
align: 'center',
width: 120,
is_text:true,
export:true,
text_prop:'is_sell_text',
formatter: (cell, data, value) => {
return value == 1 ? 'Yes' : 'No'
@ -214,6 +222,7 @@
align: 'center',
width: 180,
is_text:true,
export:true,
text_prop:'show_price_text',
formatter: (cell, data, value) => {
if(value==1){
@ -228,6 +237,7 @@
label: 'Sort Time',
align: 'center',
width: 180,
export:true
}
]
@ -239,6 +249,7 @@
},
methods: {
importTable(row) {
this.$refs.imports.headers = this.table_item
this.$refs.imports.show()
},
editProduct(type, id) {

Loading…
Cancel
Save