|
@@ -4,7 +4,7 @@
|
|
|
<div class="moudle-list">
|
|
|
<div class="moudle">
|
|
|
<div class="title-list">
|
|
|
- <div @click="sendType = 1" :class=" sendType ? 'title' : 'normal-title'">
|
|
|
+ <div v-if="memberType !== 1" @click="sendType = 1" :class=" sendType ? 'title' : 'normal-title'">
|
|
|
商家发件
|
|
|
</div>
|
|
|
<div @click="sendType = 0" :class=" !sendType ? 'title' : 'normal-title'">
|
|
@@ -19,13 +19,13 @@
|
|
|
<el-button v-show="!sendType" @click="showShop(1)" class="but1 active" type="info">常用地址</el-button>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="发件人电话" required>
|
|
|
- <el-input size="small" class="phone-before" v-model="form.sendAddress.phone" placeholder="请填写发件人电话" :disabled="!!sendType"></el-input>
|
|
|
+ <el-input size="small" class="phone-before" v-model="form.sendAddress.phone" placeholder="请填写发件人电话"></el-input>
|
|
|
<div class="phone-center">~</div>
|
|
|
- <el-input size="small" class="phone-after" v-model="form.sendAddress.extension" placeholder="分机号" :disabled="!!sendType"></el-input>
|
|
|
+ <el-input size="small" class="phone-after" v-model="form.sendAddress.extension" placeholder="分机号"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="发件人地址" required>
|
|
|
<el-input size="small" v-model="form.sendAddress.address" placeholder="请填写/选择发件人地址" disabled>
|
|
|
- <el-image @click="showMap" slot="append" class="map" src="../../static/image/icon_map.png"></el-image>
|
|
|
+ <el-image @click="showMap(1)" slot="append" class="map" src="../../static/image/icon_map.png"></el-image>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="楼号/门牌号">
|
|
@@ -49,7 +49,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="收件人地址" required>
|
|
|
<el-input size="small" v-model="form.receiptAddress.address" placeholder="请填写/选择收件人地址">
|
|
|
- <el-image @click="showMap" slot="append" class="map" src="../../static/image/icon_map.png"></el-image>
|
|
|
+ <el-image @click="showMap(2)" slot="append" class="map" src="../../static/image/icon_map.png"></el-image>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="楼号/门牌号">
|
|
@@ -71,7 +71,7 @@
|
|
|
<el-radio class="item" v-for="(item,i) in products" :key="i" :label="item.id">{{item.name}}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="物品重量">
|
|
|
+ <el-form-item label="物品重量" required>
|
|
|
<div class="printer-num">
|
|
|
<img @click="reduce()" src="../../static/image/icon_reduce.png" class="reduce" alt="" srcset="" />
|
|
|
<!-- <div class="num">{{ form.weight }} KG</div> -->
|
|
@@ -149,7 +149,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
products: [],
|
|
|
- sendType: 1,
|
|
|
+ sendType: this.$store.state.userInfo.memberType === 1 ? 0 : 1,
|
|
|
addressType: 1,
|
|
|
form: {
|
|
|
name: "",
|
|
@@ -183,6 +183,7 @@ export default {
|
|
|
createType: 1,
|
|
|
shopId: this.$store.state.userInfo.shopId,
|
|
|
productAmount: "",
|
|
|
+ chooseAddressType: 1,
|
|
|
},
|
|
|
showChooseShop: false,
|
|
|
showChooseAddress: false,
|
|
@@ -201,6 +202,7 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
},
|
|
|
+ memberType: this.$store.state.userInfo.memberType,
|
|
|
};
|
|
|
},
|
|
|
components: {
|
|
@@ -256,13 +258,17 @@ export default {
|
|
|
chooseShop() {
|
|
|
this.showChooseShop = false;
|
|
|
let sendAddress = this.addressList[this.curIdx];
|
|
|
- Object.keys(this.form.sendAddress).map((v) => {
|
|
|
- this.form.sendAddress[v] = sendAddress[v];
|
|
|
- });
|
|
|
- if (!this.sendType) {
|
|
|
- this.shopId = "";
|
|
|
+ if (this.addressType === 1) {
|
|
|
+ Object.keys(this.form.sendAddress).map((v) => {
|
|
|
+ this.form.sendAddress[v] = sendAddress[v];
|
|
|
+ });
|
|
|
+ if (!this.sendType) {
|
|
|
+ this.shopId = "";
|
|
|
+ } else {
|
|
|
+ this.form.shopId = sendAddress.id;
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.form.shopId = sendAddress.id;
|
|
|
+ this.form.receiptAddress = sendAddress;
|
|
|
}
|
|
|
},
|
|
|
showShop(addressType) {
|
|
@@ -281,12 +287,11 @@ export default {
|
|
|
this.loading = true;
|
|
|
getAddressList({
|
|
|
searchKey: this.searchKey,
|
|
|
- searchType: this.sendType,
|
|
|
- addressType: this.addressType,
|
|
|
}).then((res) => {
|
|
|
this.loading = false;
|
|
|
if (res.code === 200) {
|
|
|
- if (this.sendType) {
|
|
|
+ if (this.sendType && this.addressType !== 2) {
|
|
|
+ console.log(1111);
|
|
|
this.addressList = res.data.shop;
|
|
|
let sendAddress = this.addressList.filter((v) => {
|
|
|
return v.id === this.form.shopId;
|
|
@@ -294,11 +299,15 @@ export default {
|
|
|
Object.keys(this.form.sendAddress).map((v) => {
|
|
|
this.form.sendAddress[v] = sendAddress[v];
|
|
|
});
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ if (!this.sendType || this.addressType === 2) {
|
|
|
+ console.log(2222);
|
|
|
this.addressList = res.data.personal;
|
|
|
- Object.keys(this.form.sendAddress).map((v) => {
|
|
|
- this.form.sendAddress[v] = "";
|
|
|
- });
|
|
|
+ if (!this.sendType) {
|
|
|
+ Object.keys(this.form.sendAddress).map((v) => {
|
|
|
+ this.form.sendAddress[v] = "";
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
this.$message({
|
|
@@ -354,7 +363,12 @@ export default {
|
|
|
}
|
|
|
// 预约发单
|
|
|
if (this.form.takeType) {
|
|
|
- this.form.takeTime = this.$tool.getFormatDate(this.form.takeTime);
|
|
|
+ if (!this.form.takeTime.trim()) {
|
|
|
+ return this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: "请先选择预约发单时间!",
|
|
|
+ });
|
|
|
+ }
|
|
|
this.form.saveFlag = 1;
|
|
|
this.saveOrder();
|
|
|
} else {
|
|
@@ -400,17 +414,26 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- showMap() {
|
|
|
+ showMap(type) {
|
|
|
+ this.searchKey = "";
|
|
|
+ if (this.sendType === 1) return;
|
|
|
+ this.chooseAddressType = type;
|
|
|
this.$refs.orderMap.chooseLocation();
|
|
|
},
|
|
|
getAddressDetail(v, lng, lat) {
|
|
|
- this.form.receiptAddress.address = v.address;
|
|
|
- this.form.receiptAddress.provinceName = v.province;
|
|
|
- this.form.receiptAddress.cityName = v.city;
|
|
|
- this.form.receiptAddress.cityCode = v.citycode;
|
|
|
- this.form.receiptAddress.districtName = v.district;
|
|
|
- this.form.receiptAddress.lng = lng;
|
|
|
- this.form.receiptAddress.lat = lat;
|
|
|
+ let type = "sendAddress";
|
|
|
+ if (this.chooseAddressType === 1) {
|
|
|
+ type = "sendAddress";
|
|
|
+ } else {
|
|
|
+ type = "receiptAddress";
|
|
|
+ }
|
|
|
+ this.form[type].address = v.address;
|
|
|
+ this.form[type].provinceName = v.province;
|
|
|
+ this.form[type].cityName = v.city;
|
|
|
+ this.form[type].cityCode = v.citycode;
|
|
|
+ this.form[type].districtName = v.district;
|
|
|
+ this.form[type].lng = lng;
|
|
|
+ this.form[type].lat = lat;
|
|
|
},
|
|
|
reduce() {
|
|
|
this.form.weight = this.form.weight === 1 ? 1 : --this.form.weight;
|