|
|
@@ -1,123 +1,101 @@
|
|
|
<template>
|
|
|
<div class="app-container" v-loading="listLoading">
|
|
|
- <el-button size="small" type="primary" @click="dialog = true">{{ $t('config.createAddress') }}</el-button>
|
|
|
- <el-table
|
|
|
- :data="list"
|
|
|
- border
|
|
|
- fit
|
|
|
- highlight-current-row
|
|
|
- style="width: 100%; margin-top: 25px;"
|
|
|
- >
|
|
|
- <el-table-column width="120px" align="center" :label="$t('config.consignee')" prop="CONSIGNEE">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.CONSIGNEE }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="130px" align="center" :label="$t('shop.phoneNumber')" prop="MOBILE">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.MOBILE }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" :label="$t('config.detailedAddress')" prop="ADDRESS">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.ADDRESS }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="130px" align="center" :label="$t('config.city')" prop="CITY_NAME">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.CITY_NAME }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="180px" align="center" :label="$t('config.localGovernmentArea')" prop="LGA_NAME">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.LGA_NAME }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="120px" align="center" :label="$t('config.state')" prop="PROVINCE_NAME">
|
|
|
- <template slot-scope="{row}">
|
|
|
- <span>{{ row.PROVINCE_NAME }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column width="130px" align="center" :label="$t('config.default')" prop="IS_DEFAULT">
|
|
|
+ <el-table :data="list" border fit highlight-current-row>
|
|
|
+ <el-table-column align="center" :label="$t('config.consignee')" prop="CONSIGNEE"></el-table-column>
|
|
|
+ <el-table-column align="center" :label="$t('shop.phoneNumber')" prop="MOBILE"></el-table-column>
|
|
|
+ <el-table-column align="center" :label="$t('config.detailedAddress')" prop="ADDRESS"></el-table-column>
|
|
|
+ <el-table-column align="center" :label="$t('config.city')" prop="CITY_NAME"></el-table-column>
|
|
|
+ <el-table-column align="center" :label="$t('config.localGovernmentArea')" prop="LGA_NAME"></el-table-column>
|
|
|
+ <el-table-column align="center" :label="$t('config.state')" prop="PROVINCE_NAME"></el-table-column>
|
|
|
+ <el-table-column align="center" :label="$t('config.default')" prop="IS_DEFAULT">
|
|
|
<template slot-scope="{row}">
|
|
|
<el-switch size="small" v-model="row.IS_DEFAULT" active-value="1" inactive-value="0" @change="changeDefault($event, row)"></el-switch>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column width="150px" align="center" :label="$t('common.action')" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column align="center" :label="$t('common.action')" min-width="90px">
|
|
|
<template slot-scope="{row}">
|
|
|
- <el-button-group>
|
|
|
- <el-button type="primary" size="mini" @click="handleEdit(row)">{{ $t('common.edit') }}</el-button>
|
|
|
- <el-button type="danger" size="mini" @click="handleDelete(row.ID)">{{ $t('common.delete') }}</el-button>
|
|
|
- </el-button-group>
|
|
|
+ <el-button type="text" size="mini" @click="handleEdit(row)">{{ $t('common.edit') }}</el-button>
|
|
|
+ <el-button type="text" size="mini" @click="handleDelete(row.ID)">{{ $t('common.delete') }}</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
- <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
|
|
|
+ <div class="white-box-footer" style="margin-top: 10px;">
|
|
|
+ <el-button size="small" type="primary" @click="dialog = true">{{ $t('config.createAddress') }}</el-button>
|
|
|
+ <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.pageSize" @pagination="getList" />
|
|
|
+ </div>
|
|
|
|
|
|
- <el-dialog :title="$t('config.createAddress')" :visible.sync="dialog" v-loading="dialogLoading" style="margin-top: -50px;">
|
|
|
- <el-form ref="dataForm" :model="dataForm" label-position="right" label-width="180px" style="width: 500px; margin-left:50px;">
|
|
|
- <el-form-item :label="$t('config.consignee')" prop="consignee" required>
|
|
|
- <el-input size="small" v-model="dataForm.consignee" type="text" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('shop.phoneNumber')" prop="mobile" required>
|
|
|
- <el-input size="small" v-model="dataForm.mobile" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.state')" prop="province" required style="width: 100%;">
|
|
|
- <el-select v-model="dataForm.province" class="filter-item" >
|
|
|
- <el-option v-for="item in regionData" :key="item.id" :label="item.address" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.detailedAddress')" prop="address" required>
|
|
|
- <el-input size="small" v-model="dataForm.address" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.city')" prop="cityName" required>
|
|
|
- <el-input size="small" v-model="dataForm.cityName" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.localGovernmentArea')" prop="lgaName" required>
|
|
|
- <el-input size="small" v-model="dataForm.lgaName" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.default')" prop="isDefault">
|
|
|
- <el-switch size="small" v-model="dataForm.isDefault" active-value="1" inactive-value="0"></el-switch>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer" style="margin-right: 110px; margin-top: -30px;">
|
|
|
- <el-button type="warning" size="small" @click="dialog = false">{{ $t('table.cancel') }}</el-button>
|
|
|
- <el-button type="primary" size="small" @click="createAddress">{{ $t('table.confirm') }}</el-button>
|
|
|
- </div>
|
|
|
+ <el-dialog :title="$t('config.createAddress')" :width="screenWidth" :visible.sync="dialog" v-loading="dialogLoading" style="margin-top: -70px;">
|
|
|
+ <el-form ref="dataForm" :model="dataForm" :label-position="labelPosition" style="margin-top: -30px; margin-bottom: -25px;">
|
|
|
+ <el-row :gutter="1">
|
|
|
+ <el-col :xs="24" :sm="24" :lg="24">
|
|
|
+ <el-form-item :label="$t('config.consignee')" prop="consignee" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="dataForm.consignee" type="text" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('shop.phoneNumber')" prop="mobile" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="dataForm.mobile" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.state')" prop="province" required style="margin-bottom: 10px;">
|
|
|
+ <el-select v-model="dataForm.province" class="filter-item" style="width: 100%;">
|
|
|
+ <el-option v-for="item in regionData" :key="item.id" :label="item.address" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.detailedAddress')" prop="address" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="dataForm.address" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.city')" prop="cityName" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="dataForm.cityName" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.localGovernmentArea')" prop="lgaName" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="dataForm.lgaName" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.default')" prop="isDefault" style="margin-bottom: 10px;">
|
|
|
+ <el-switch size="small" v-model="dataForm.isDefault" active-value="1" inactive-value="0"></el-switch>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item style="margin-bottom: 10px;">
|
|
|
+ <el-button type="warning" size="small" @click="dialog = false">{{ $t('table.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="createAddress">{{ $t('table.confirm') }}</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <el-dialog :title="$t('config.editAddress')" :visible.sync="dialogEdit" v-loading="editLoading" style="margin-top: -50px;">
|
|
|
- <el-form ref="editForm" :model="editForm" label-position="right" label-width="180px" style="width: 500px; margin-left:50px;">
|
|
|
- <el-input size="small" v-model="editForm.id" type="text" v-show="false" />
|
|
|
- <el-form-item :label="$t('config.consignee')" prop="consignee" required>
|
|
|
- <el-input size="small" v-model="editForm.consignee" type="text" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('shop.phoneNumber')" prop="mobile" required>
|
|
|
- <el-input size="small" v-model="editForm.mobile" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.state')" prop="province" required style="width: 100%;">
|
|
|
- <el-select v-model="editForm.province" class="filter-item" >
|
|
|
- <el-option v-for="item in regionData" :key="item.id" :label="item.address" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.detailedAddress')" prop="address" required>
|
|
|
- <el-input size="small" v-model="editForm.address" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.city')" prop="cityName" required>
|
|
|
- <el-input size="small" v-model="editForm.cityName" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.localGovernmentArea')" prop="lgaName" required>
|
|
|
- <el-input size="small" v-model="editForm.lgaName" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item :label="$t('config.default')" prop="isDefault">
|
|
|
- <el-switch size="small" v-model="editForm.isDefault" active-value="1" inactive-value="0"></el-switch>
|
|
|
- </el-form-item>
|
|
|
+ <el-dialog :title="$t('config.editAddress')" :width="screenWidth" :visible.sync="dialogEdit" v-loading="editLoading" style="margin-top: -70px;">
|
|
|
+ <el-form ref="editForm" :model="editForm" :label-position="labelPosition" style="margin-top: -30px; margin-bottom: -25px;">
|
|
|
+ <el-row :gutter="3">
|
|
|
+ <el-col :xs="24" :sm="24" :lg="24">
|
|
|
+ <el-input size="small" v-model="editForm.id" type="text" v-show="false" />
|
|
|
+ <el-form-item :label="$t('config.consignee')" prop="consignee" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="editForm.consignee" type="text" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('shop.phoneNumber')" prop="mobile" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="editForm.mobile" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.state')" prop="province" required style="margin-bottom: 10px;">
|
|
|
+ <el-select v-model="editForm.province" class="filter-item" style="width: 100%;">
|
|
|
+ <el-option v-for="item in regionData" :key="item.id" :label="item.address" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.detailedAddress')" prop="address" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="editForm.address" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.city')" prop="cityName" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="editForm.cityName" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.localGovernmentArea')" prop="lgaName" required style="margin-bottom: 10px;">
|
|
|
+ <el-input size="small" v-model="editForm.lgaName" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('config.default')" prop="isDefault" style="margin-bottom: 10px;">
|
|
|
+ <el-switch size="small" v-model="editForm.isDefault" active-value="1" inactive-value="0"></el-switch>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item style="margin-bottom: 10px;">
|
|
|
+ <el-button type="warning" size="small" @click="dialogEdit = false">{{ $t('table.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="updateAddress">{{ $t('table.confirm') }}</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
- <div slot="footer" class="dialog-footer" style="margin-right: 110px; margin-top: -30px;">
|
|
|
- <el-button type="warning" size="small" @click="dialogEdit = false">{{ $t('table.cancel') }}</el-button>
|
|
|
- <el-button type="primary" size="small" @click="updateAddress">{{ $t('table.confirm') }}</el-button>
|
|
|
- </div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -126,6 +104,7 @@
|
|
|
import {createAddress, fetchAddressList, updateAddress, deleteAddress} from '@/api/config'
|
|
|
import waves from '@/directive/waves'
|
|
|
import Pagination from '@/components/Pagination'
|
|
|
+import {getScreenWidth} from "@/utils";
|
|
|
|
|
|
export default {
|
|
|
name: 'receiveAddressList',
|
|
|
@@ -176,6 +155,8 @@ export default {
|
|
|
address: 'test2',
|
|
|
},
|
|
|
],
|
|
|
+ screenWidth: getScreenWidth() > 600 ? '500px' : getScreenWidth() + 'px',
|
|
|
+ labelPosition: getScreenWidth() > 600 ? 'right' : 'top',
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -197,7 +178,7 @@ export default {
|
|
|
this.dialogLoading = true
|
|
|
createAddress(this.dataForm).then(() => {
|
|
|
this.$message({
|
|
|
- message: this.$t('config.messageCreate'),
|
|
|
+ message: this.$t('common.successfully'),
|
|
|
type: 'success',
|
|
|
duration: 5 * 1000
|
|
|
})
|
|
|
@@ -229,7 +210,7 @@ export default {
|
|
|
this.listLoading = true
|
|
|
updateAddress(data).then(() => {
|
|
|
this.$message({
|
|
|
- message: this.$t('config.messageUpdate'),
|
|
|
+ message: this.$t('common.successfully'),
|
|
|
type: 'success',
|
|
|
duration: 5 * 1000
|
|
|
})
|
|
|
@@ -248,15 +229,15 @@ export default {
|
|
|
},
|
|
|
handleDelete(id) {
|
|
|
this.$confirm(this.$t('common.deleteTips'), this.$t('common.hint'), {
|
|
|
- confirmButtonText: 'Confirm',
|
|
|
- cancelButtonText: 'Cancel',
|
|
|
+ confirmButtonText: this.$t('common.confirm'),
|
|
|
+ cancelButtonText: this.$t('common.cancel'),
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
const data = { selected: [id]}
|
|
|
this.listLoading = true
|
|
|
deleteAddress(data).then(() => {
|
|
|
this.$message({
|
|
|
- message: this.$t('config.messageDelete'),
|
|
|
+ message: this.$t('common.successfully'),
|
|
|
type: 'success',
|
|
|
duration: 5 * 1000
|
|
|
})
|
|
|
@@ -290,7 +271,7 @@ export default {
|
|
|
this.editLoading = true
|
|
|
updateAddress(this.editForm).then(() => {
|
|
|
this.$message({
|
|
|
- message: this.$t('config.messageUpdate'),
|
|
|
+ message: this.$t('common.successfully'),
|
|
|
type: 'success',
|
|
|
duration: 5 * 1000
|
|
|
})
|