|
@@ -21,22 +21,23 @@
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
:scroll="{ x: 1050 }"
|
|
|
+ :showPagination="false"
|
|
|
bordered>
|
|
|
<!-- 收货人 -->
|
|
|
<template slot="consignee" slot-scope="text, record">
|
|
|
<div class="item-box">
|
|
|
<a-tooltip placement="top">
|
|
|
<template slot="title">
|
|
|
- <span>{{ record.consignee }}</span>
|
|
|
+ <span>{{ record.consigneeName }}</span>
|
|
|
</template>
|
|
|
- <p class="ellipsis-txt">{{ record.consignee }}</p>
|
|
|
+ <p class="ellipsis-txt">{{ record.consigneeName }}</p>
|
|
|
</a-tooltip>
|
|
|
- <span v-if="record.isDefault" class="badge-txt">默认</span>
|
|
|
+ <span v-if="record.defaultFlag==1" class="badge-txt">默认</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
- <a-button size="small" type="link" v-if="!record.isDefault" @click="handleDefault(record)" id="chooseAddressList-default-btn">设置为默认地址</a-button>
|
|
|
+ <a-button size="small" type="link" v-if="record.defaultFlag==0" @click="handleDefault(record)" id="chooseAddressList-default-btn">设置为默认地址</a-button>
|
|
|
<a-divider type="vertical" style="margin: 0;" />
|
|
|
<a-button size="small" type="link" @click="handleEdit(record)" id="chooseAddressList-edit-btn" style="margin-left: 5px;">编辑</a-button>
|
|
|
<a-divider type="vertical" style="margin: 0;" />
|
|
@@ -48,13 +49,14 @@
|
|
|
</template>
|
|
|
</s-table>
|
|
|
<!-- 新增/编辑地址 -->
|
|
|
- <edit-address-modal :openModal="openAddrModal" @ok="handleOk" @close="openAddrModal=false" />
|
|
|
+ <edit-address-modal ref="addrModal" :openModal="openAddrModal" @ok="handleOk" @close="openAddrModal=false" />
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import editAddressModal from './editAddressModal'
|
|
|
+import { shippingAddressQuery, shippingAddressSet, shippingAddressDel } from '@/api/shippingAddress.js'
|
|
|
export default {
|
|
|
name: 'ChooseAddressModal',
|
|
|
components: { STable, VSelect, editAddressModal },
|
|
@@ -67,45 +69,28 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
isShow: this.openModal, // 是否打开弹框
|
|
|
+ queryParam: {},
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
{ title: '收货人', scopedSlots: { customRender: 'consignee' }, align: 'center', ellipsis: true },
|
|
|
- { title: '手机号码', dataIndex: 'phone', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '收货地址', dataIndex: 'address', width: 300, align: 'center', ellipsis: true },
|
|
|
+ { title: '手机号码', dataIndex: 'consigneeTel', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '收货地址', dataIndex: 'address', width: 400, align: 'center', ellipsis: true },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 250, align: 'center', fixed: 'right' },
|
|
|
{ title: '选择', scopedSlots: { customRender: 'choose' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
- // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
|
|
|
- // const data = res.data
|
|
|
- // const no = (data.pageNo - 1) * data.pageSize
|
|
|
- // for (var i = 0; i < data.list.length; i++) {
|
|
|
- // data.list[i].no = no + i + 1
|
|
|
- // }
|
|
|
- // this.disabled = false
|
|
|
- // return data
|
|
|
- // })
|
|
|
- const _this = this
|
|
|
- return new Promise(function (resolve, reject) {
|
|
|
- const data = {
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 10,
|
|
|
- list: [
|
|
|
- { id: '1', consignee: '张三', phone: '15878458789', address: '陕西省西安市雁塔区高新三路', isDefault: true },
|
|
|
- { id: '2', consignee: '张冀凯股份结构设计风格剑荡四方收费价格就会收到福建师范大书法家顾客三', phone: '15878458789', address: '陕西省西安市雁塔区高新三路', isDefault: false },
|
|
|
- { id: '3', consignee: '张三', phone: '15878458789', address: '陕西省西安市到福建师范大书法家雁塔区高新三路', isDefault: false }
|
|
|
- ],
|
|
|
- count: 10
|
|
|
+ return shippingAddressQuery(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ const data = res.data
|
|
|
+ const no = 0
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ data[i].no = no + i + 1
|
|
|
+ data[i].address = data[i].provinceName + '-' + data[i].cityName + '-' + data[i].countyName + '-' + data[i].addr
|
|
|
}
|
|
|
- const no = (data.pageNo - 1) * data.pageSize
|
|
|
- for (var i = 0; i < data.list.length; i++) {
|
|
|
- data.list[i].no = no + i + 1
|
|
|
- }
|
|
|
- _this.disabled = false
|
|
|
- resolve(data)
|
|
|
+ this.disabled = false
|
|
|
+ return data
|
|
|
})
|
|
|
},
|
|
|
openAddrModal: false // 选择地址弹框是否显示
|
|
@@ -114,10 +99,29 @@ export default {
|
|
|
methods: {
|
|
|
// 设为默认
|
|
|
handleDefault (row) {
|
|
|
-
|
|
|
+ shippingAddressSet({ id: row.id }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ }
|
|
|
+ this.$message.info(res.message)
|
|
|
+ })
|
|
|
},
|
|
|
// 新增/编辑收货地址
|
|
|
handleEdit (row) {
|
|
|
+ if (row) {
|
|
|
+ this.$refs.addrModal.setData({
|
|
|
+ id: row.id,
|
|
|
+ consigneeName: row.consigneeName,
|
|
|
+ consigneeTel: row.consigneeTel,
|
|
|
+ provinceSn: row.provinceSn,
|
|
|
+ provinceName: row.provinceName,
|
|
|
+ citySn: row.citySn,
|
|
|
+ cityName: row.cityName,
|
|
|
+ countySn: row.countySn,
|
|
|
+ countyName: row.countyName,
|
|
|
+ addr: row.addr
|
|
|
+ })
|
|
|
+ }
|
|
|
this.openAddrModal = true
|
|
|
},
|
|
|
// 选择
|
|
@@ -130,23 +134,22 @@ export default {
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
content: '删除后不可恢复,确定要进行删除吗?',
|
|
|
- centered: true,
|
|
|
+ centered: true,
|
|
|
onOk () {
|
|
|
- // delectRolePower({
|
|
|
- // id: row.id
|
|
|
- // }).then(res => {
|
|
|
- // console.log(res, 'res1111')
|
|
|
- // if (res.status == 200) {
|
|
|
- // _this.$message.success(res.message)
|
|
|
- // _this.$refs.table.refresh()
|
|
|
- // }
|
|
|
- // })
|
|
|
+ shippingAddressDel({
|
|
|
+ id: row.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$refs.table.refresh(true)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 地址保存
|
|
|
+ // 地址保存成功
|
|
|
handleOk (data) {
|
|
|
-
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -171,6 +174,8 @@ export default {
|
|
|
}
|
|
|
.item-box{
|
|
|
position: relative;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
.ellipsis-txt{
|
|
|
margin: 0;
|
|
|
width: 100%;
|
|
@@ -179,9 +184,6 @@ export default {
|
|
|
whitewhite-space: nowrap;
|
|
|
}
|
|
|
.badge-txt{
|
|
|
- position: absolute;
|
|
|
- right: -15px;
|
|
|
- top: -17px;
|
|
|
line-height: 20px;
|
|
|
padding: 0 7px;
|
|
|
font-size: 12px;
|