Authored by lea guo

订单修改地址

... ... @@ -11,22 +11,27 @@
<slot name="item" :data="item">
<div class="user-item">
<div
:class="{'uncheck-item' : item.address_id !== selectedAddressId , 'check-item' : item.address_id === selectedAddressId }"
:class="{
'uncheck-item': item.address_id !== selectedAddressId,
'check-item': item.address_id === selectedAddressId
}"
></div>
<div class="user-info">
<div class="extra">
<p class="name">{{item.consignee}}</p>
<p class="mobile">{{item.mobile}}</p>
<p class="name">{{ item.consignee }}</p>
<p class="mobile">{{ item.mobile }}</p>
<div v-if="item.is_default === 'Y'" class="tag-btn">默认</div>
<div v-if="item.tag_code" class="tag-btn">{{item.tag}}</div>
<div v-if="item.tag_code" class="tag-btn">{{ item.tag }}</div>
<div
class="option-btn"
:data-item="JSON.stringify(item)"
:data-add="0"
@click="toEditorPage"
>编辑</div>
>
编辑
</div>
</div>
<p class="address">{{item.area}}{{item.address}}</p>
<p class="address">{{ item.area }}{{ item.address }}</p>
</div>
</div>
</slot>
... ... @@ -100,8 +105,7 @@ export default {
name: "addressEdit",
params: {
item: item,
update: !isAdd,
title: isAdd ? "添加地址" : "编辑地址"
update: !isAdd
}
});
}
... ...
... ... @@ -11,7 +11,12 @@
></CInput>
</FormItem>
<FormItem>
<CInput label="手机号" place-holder="请填写手机号" v-model="model.mobile" :textValue="model.mobile"></CInput>
<CInput
label="手机号"
place-holder="请填写手机号"
v-model="model.mobile"
:textValue="model.mobile"
></CInput>
</FormItem>
<template>
... ... @@ -20,7 +25,7 @@
<label class="input-label">所在区域</label>
<div class="wrapper-arrow" @click="chooseArea">
<template v-if="model.area">
<label class="text-label">{{model.area}}</label>
<label class="text-label">{{ model.area }}</label>
</template>
<template v-else>
<label class="choose-area">请选择</label>
... ... @@ -39,30 +44,32 @@
:textValue="model.address"
></CInput>
</FormItem>
<div class="wrapper-tag">
<!-- 订单修改地址隐藏 -->
<div v-if="!$route.params.code" class="wrapper-tag">
<p class="tag-text">设置标签:</p>
<RadioGroup class="wrapper-radio">
<div v-for="(tag, index) in addressTags" :key="index">
<Radio
class="tag-radio"
:label="{text: `${tag.name}`, value: `${tag.code}`}"
:label="{ text: `${tag.name}`, value: `${tag.code}` }"
v-model="model.tag_code"
checked="tag.code === model.tag_code"
></Radio>
</div>
</RadioGroup>
</div>
<div class="wrapper-del">
<!-- 订单修改地址隐藏 -->
<div v-if="!$route.params.code" class="wrapper-del">
<Radio
class="radio"
:label="{text: '设为默认地址', value: true}"
:label="{ text: '设为默认地址', value: true }"
style="flex: 0 1 100%;"
checked="model.is_default"
v-model="model.is_default"
></Radio>
<div v-if="isUpdate" class="del-address" @click="delAddress">删除地址</div>
<div v-if="isUpdate" class="del-address" @click="delAddress">
删除地址
</div>
</div>
<div :class="submitClass" @touchend="onSubmit">确 认</div>
... ... @@ -279,26 +286,24 @@ export default {
},
activated() {
this.fetchAddressTags();
this.isUpdate = this.$route.params.update;
this.title = this.$route.params.title
? this.$route.params.title
: "添加地址";
let { update, title, item, code } = this.$route.params;
// 订单编辑 不查标签
if (!code) {
this.fetchAddressTags();
}
if (this.$route.params.update) {
let item = JSON.parse(this.$route.params.item);
if (item) {
let that = this;
that.model.consignee = item.consignee;
that.model.address_id = item.address_id;
that.model.mobile = item.mobile;
that.model.area_code = item.area_code;
that.model.area = item.area;
that.model.address = item.address;
that.model.tag_code = item.tag_code;
that.model.is_default = item.is_default === "Y" ? true : false;
}
this.isUpdate = update;
this.title = update ? "编辑地址" : "添加地址";
if (update) {
item = JSON.parse(item || "{}");
this.model.consignee = item.consignee;
this.model.address_id = item.address_id;
this.model.mobile = item.mobile;
this.model.area_code = item.area_code;
this.model.area = item.area;
this.model.address = item.address;
this.model.tag_code = item.tag_code;
this.model.is_default = item.is_default === "Y" ? true : false;
} else {
this.model = {};
}
... ...
export default [{
name: 'address',
path: '/xianyu/address',
component: () => import(/* webpackChunkName: "address" */ './address')
}, {
name: 'addressEdit',
path: '/xianyu/address/edit',
component: () => import(/* webpackChunkName: "address" */ './addressEdit')
}];
export default [
{
name: 'address',
path: '/xianyu/address',
component: () => import(/* webpackChunkName: "address" */ './address'),
},
{
name: 'addressEdit',
path: '/xianyu/address/edit/:code?', // code 订单编码
component: () => import(/* webpackChunkName: "address" */ './addressEdit'),
},
];
... ...
... ... @@ -37,7 +37,12 @@ export default {
]),
onActionHandler(action) {
const { owner = ownType.SELL } = this.$route.params;
const { orderCode, priceInfo = {}, goodsInfo = {} } = this.order;
const {
orderCode,
priceInfo = {},
goodsInfo = {},
addressInfo = {}
} = this.order;
const { productId, storageId, skup } = goodsInfo;
... ... @@ -100,6 +105,18 @@ export default {
});
break;
// 修改地址
case orderActionsMap.MODIFY_ADDRESS.name:
this.$router.push({
name: "addressEdit",
params: {
code: orderCode,
update: true,
item: JSON.stringify(addressInfo)
}
});
break;
default:
this.$emit("on-action", action);
}
... ...
... ... @@ -9,7 +9,7 @@
v-show="!isShowEmpty"
>
<ul class="list-wrapper">
<li v-for="order in orderList" :key="order.orderCode">
<li v-for="order in orderList" :key="order.secendLevelCreateTime">
<order-info :order="order" />
<order-list-item :order="order" />
<!-- 订单操作 -->
... ...