...
|
...
|
@@ -17,7 +17,7 @@ |
|
|
<div class="list-item exchange-mode">
|
|
|
<span>换货方式</span>
|
|
|
<i class="icon icon-right right"></i>
|
|
|
<select class="right" v-model="deliveryType">
|
|
|
<select class="right" v-model="deliveryTpye">
|
|
|
<option v-for="mode in delivery" :value="mode.id">{{mode.name}}</option>
|
|
|
</select>
|
|
|
</div>
|
...
|
...
|
@@ -33,7 +33,7 @@ |
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
const $ = require('yoho-jquery');
|
|
|
const $ = require('jquery');
|
|
|
const qs = require('yoho-qs');
|
|
|
const tip = require('common/tip');
|
|
|
const bus = require('common/vue-bus');
|
...
|
...
|
@@ -42,6 +42,7 @@ |
|
|
|
|
|
const productList = require('home/return/list.vue');
|
|
|
const featureSelector = require('component/product/feature-selector.vue');
|
|
|
const reasonConfig = require('home/return/reason');
|
|
|
|
|
|
module.exports = {
|
|
|
el: '#exchange',
|
...
|
...
|
@@ -58,8 +59,9 @@ |
|
|
address: {},
|
|
|
delivery: [],
|
|
|
|
|
|
deliveryType: null,
|
|
|
indexMap: {} // goods[index].id 与 index 的映射
|
|
|
deliveryTpye: null,
|
|
|
indexMap: {}, // goods[index].id 与 index 的映射
|
|
|
processing: false
|
|
|
};
|
|
|
},
|
|
|
events: {
|
...
|
...
|
@@ -104,12 +106,13 @@ |
|
|
const arr = [];
|
|
|
|
|
|
res.data.specialExchangeReason.forEach(obj => arr.push(obj.id));
|
|
|
global.store.reasons = [{
|
|
|
reasonConfig.reasons = [{
|
|
|
id: 0,
|
|
|
name: '请选择'
|
|
|
}].concat(res.data.exchangeReason);
|
|
|
global.store.specialReasons = arr;
|
|
|
global.store.specialNotice = res.data.specialNoticeBo;
|
|
|
|
|
|
reasonConfig.specialReasons = arr;
|
|
|
reasonConfig.specialNotice = res.data.specialNoticeBo;
|
|
|
}
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -125,7 +128,7 @@ |
|
|
yoho.goAddress({
|
|
|
type: '1'
|
|
|
}, (address) => {
|
|
|
if(address) {
|
|
|
if (address) {
|
|
|
self.$set('address', {
|
|
|
addressId: address.address_id,
|
|
|
area: address.area,
|
...
|
...
|
@@ -154,8 +157,6 @@ |
|
|
console.log(goods.goodsId);
|
|
|
|
|
|
this.showFeatureSelector = false;
|
|
|
|
|
|
// this.goodsArr.$set(index, Object.assign({}, goods, change));
|
|
|
},
|
|
|
|
|
|
// 查询 商品 feature
|
...
|
...
|
@@ -173,24 +174,26 @@ |
|
|
order_code: this.orderCode,
|
|
|
address_id: this.address.addressId,
|
|
|
address: this.address.address,
|
|
|
consigee_name: this.address.consignee,
|
|
|
consignee_name: this.address.consignee,
|
|
|
area_code: this.address.areaCode,
|
|
|
zip_code: this.address.zipCode,
|
|
|
mobile: this.address.mobile,
|
|
|
delivery_typ: this.deliveryType,
|
|
|
delivery_tpye: this.deliveryTpye,
|
|
|
app_type: 1,
|
|
|
goods: []
|
|
|
};
|
|
|
|
|
|
this.selectedGoods.forEach(good => {
|
|
|
|
|
|
data.goods.push({
|
|
|
product_skn: good.productSkn,
|
|
|
product_skc: good.productSku,
|
|
|
product_skc: good.productSkc,
|
|
|
product_sku: good.productSku,
|
|
|
goods_type: good.goodsTypeId,
|
|
|
last_price: good.lastPrice,
|
|
|
exchange_reason: good.reason.id,
|
|
|
remark: good.remark,
|
|
|
evidence_images: good.imageList,
|
|
|
remark: good.remark || '',
|
|
|
evidence_images: good.imageList || '',
|
|
|
new_goods_id: good.change.goodsId,
|
|
|
new_product_sku: good.change.sku
|
|
|
});
|
...
|
...
|
@@ -199,19 +202,60 @@ |
|
|
return data;
|
|
|
},
|
|
|
|
|
|
// 提交 换货
|
|
|
submit() {
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: '/home/exchange/submit',
|
|
|
data: this.submitData()
|
|
|
}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
console.log(result);
|
|
|
} else {
|
|
|
modal.alert(result.message);
|
|
|
validator: function(data) {
|
|
|
let msg = '';
|
|
|
|
|
|
if (!data.order_code) {
|
|
|
msg = '订单号有问题';
|
|
|
}
|
|
|
|
|
|
if (!data.goods.length) {
|
|
|
msg = '至少选中一个换货商品';
|
|
|
}
|
|
|
|
|
|
data.goods.some(goods => {
|
|
|
let isSpecialReason = reasonConfig.specialReasons.indexOf(goods.exchange_reason) !== -1;
|
|
|
|
|
|
if (goods.exchange_reason === 0) {
|
|
|
msg = '请选择选货原因';
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
if (isSpecialReason && !(goods.mark && goods.evidence_images)) {
|
|
|
msg = '换货原因 请填写完整';
|
|
|
return true;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return msg;
|
|
|
},
|
|
|
|
|
|
// 提交 换货
|
|
|
submit() {
|
|
|
const self = this;
|
|
|
const data = this.submitData();
|
|
|
const msg = this.validator(data);
|
|
|
|
|
|
if (msg === '' && !this.processing) {
|
|
|
this.processing = true;
|
|
|
data.goods = JSON.stringify(data.goods);
|
|
|
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: '/home/exchange/submit',
|
|
|
data
|
|
|
}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
yoho.goNewPage({url: `/home/exchange-status?orderId=${self.orderCode}`});
|
|
|
} else {
|
|
|
modal.alert(result.message);
|
|
|
}
|
|
|
}).always(()=>{
|
|
|
self.processing = false;
|
|
|
});
|
|
|
} else {
|
|
|
modal.alert(msg);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -225,13 +269,21 @@ |
|
|
.then(result => {
|
|
|
$.each(result.data, (index, obj) => {
|
|
|
if (obj.isDefault === 'Y') {
|
|
|
self.$set('deliveryType', obj.id);
|
|
|
self.$set('deliveryTpye', obj.id);
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
self.$set('delivery', result.data);
|
|
|
});
|
|
|
},
|
|
|
processing(val) {
|
|
|
if (val) {
|
|
|
// when processing
|
|
|
} else {
|
|
|
// when not in processing
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
components: {
|
...
|
...
|
|