Gao xiaosong
5 years ago
1 changed files with 202 additions and 200 deletions
@ -1,206 +1,208 @@ |
|||||||
<template> |
<template> |
||||||
<view class="deliver-goods"> |
<view class="deliver-goods"> |
||||||
<header> |
<header> |
||||||
<view class="order-num acea-row row-between-wrapper"> |
<view class="order-num acea-row row-between-wrapper"> |
||||||
<view class="num line1">订单号:{{ delivery.orderId }}</view> |
<view class="num line1">订单号:{{ delivery.orderId }}</view> |
||||||
<view class="name line1">{{ delivery.nickname }}</view> |
<view class="name line1">{{ delivery.nickname }}</view> |
||||||
</view> |
</view> |
||||||
<view class="address"> |
<view class="address"> |
||||||
<view class="name"> |
<view class="name"> |
||||||
{{ delivery.realName |
{{ delivery.realName }} |
||||||
}} |
<text class="phone">{{ delivery.userPhone }}</text> |
||||||
<text class="phone">{{ delivery.userPhone }}</text> |
</view> |
||||||
</view> |
<view>{{ delivery.userAddress }}</view> |
||||||
<view>{{ delivery.userAddress }}</view> |
</view> |
||||||
</view> |
<view class="line"><image src="@/static/images/line.jpg" /></view> |
||||||
<view class="line"> |
</header> |
||||||
<image src="@/static/images/line.jpg" /> |
<view class="wrapper"> |
||||||
</view> |
<view class="item acea-row row-between-wrapper"> |
||||||
</header> |
<view>发货方式</view> |
||||||
<view class="wrapper"> |
<view class="mode acea-row row-middle row-right"> |
||||||
<view class="item acea-row row-between-wrapper"> |
<view class="goods" :class="active === typesIndex ? 'on' : ''" v-for="(item, typesIndex) in types" :key="typesIndex" @click="changeType(item, typesIndex)"> |
||||||
<view>发货方式</view> |
{{ item.title }} |
||||||
<view class="mode acea-row row-middle row-right"> |
<text class="iconfont icon-xuanzhong2"></text> |
||||||
<view |
</view> |
||||||
class="goods" |
</view> |
||||||
:class="active === typesIndex ? 'on' : ''" |
</view> |
||||||
v-for="(item, typesIndex) in types" |
<view class="list" v-show="active === 0"> |
||||||
:key="typesIndex" |
<view class="item acea-row row-between-wrapper"> |
||||||
@click="changeType(item, typesIndex)" |
<view>快递公司</view> |
||||||
> |
<picker mode="selector" :range="logistics" class="mode" range-key="name" @change="changeLog"> |
||||||
{{ item.title }} |
<input type="text" placeholder="填写快递公司" disabled="disabled" v-model="deliveryNames" class="mode" /> |
||||||
<text class="iconfont icon-xuanzhong2"></text> |
</picker> |
||||||
</view> |
<!-- <input type="text" placeholder="填写快递公司" v-model="deliveryName" class="mode" /> --> |
||||||
</view> |
</view> |
||||||
</view> |
<view class="item acea-row row-between-wrapper"> |
||||||
<view class="list" v-show="active === 0"> |
<view>快递单号</view> |
||||||
<view class="item acea-row row-between-wrapper"> |
<input type="text" placeholder="填写快递单号" v-model="deliveryId" class="mode" /> |
||||||
<view>快递公司</view> |
</view> |
||||||
<input type="text" placeholder="填写快递公司" v-model="delivery_name" class="mode" /> |
</view> |
||||||
</view> |
<view class="list" v-show="active === 1"> |
||||||
<view class="item acea-row row-between-wrapper"> |
<view class="item acea-row row-between-wrapper"> |
||||||
<view>快递单号</view> |
<view>送货人</view> |
||||||
<input type="text" placeholder="填写快递单号" v-model="delivery_id" class="mode" /> |
<input type="text" placeholder="填写送货人" v-model="deliveryName" class="mode" /> |
||||||
</view> |
</view> |
||||||
</view> |
<view class="item acea-row row-between-wrapper"> |
||||||
<view class="list" v-show="active === 1"> |
<view>送货电话</view> |
||||||
<view class="item acea-row row-between-wrapper"> |
<input type="text" placeholder="填写送货电话" v-model="deliveryId" class="mode" /> |
||||||
<view>送货人</view> |
</view> |
||||||
<input type="text" placeholder="填写送货人" v-model="delivery_name" class="mode" /> |
</view> |
||||||
</view> |
</view> |
||||||
<view class="item acea-row row-between-wrapper"> |
<view style="height:100rpx;"></view> |
||||||
<view>送货电话</view> |
<view class="confirm" @click="saveInfo">确认提交</view> |
||||||
<input type="text" placeholder="填写送货电话" v-model="delivery_id" class="mode" /> |
</view> |
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<view style="height:100rpx;"></view> |
|
||||||
<view class="confirm" @click="saveInfo">确认提交</view> |
|
||||||
</view> |
|
||||||
</template> |
</template> |
||||||
<script> |
<script> |
||||||
import { getAdminOrderDelivery, setAdminOrderDelivery } from "@/api/admin"; |
import { getAdminOrderDelivery, setAdminOrderDelivery } from '@/api/admin'; |
||||||
import { getLogistics } from "@/api/public"; |
import { getLogistics } from '@/api/public'; |
||||||
import { required } from "@/utils/validate"; |
import { required } from '@/utils/validate'; |
||||||
import { validatorDefaultCatch } from "@/utils/dialog"; |
import { validatorDefaultCatch } from '@/utils/dialog'; |
||||||
|
|
||||||
export default { |
export default { |
||||||
name: "GoodsDeliver", |
name: 'GoodsDeliver', |
||||||
components: {}, |
components: {}, |
||||||
props: {}, |
props: {}, |
||||||
data: function() { |
data: function() { |
||||||
return { |
return { |
||||||
types: [ |
types: [ |
||||||
{ |
{ |
||||||
type: "express", |
type: 'express', |
||||||
title: "发货" |
title: '发货' |
||||||
} |
} |
||||||
// { |
// { |
||||||
// type: "send", |
// type: "send", |
||||||
// title: "送货" |
// title: "送货" |
||||||
// }, |
// }, |
||||||
// { |
// { |
||||||
// type: "fictitious", |
// type: "fictitious", |
||||||
// title: "无需发货" |
// title: "无需发货" |
||||||
// } |
// } |
||||||
], |
], |
||||||
active: 0, |
active: 0, |
||||||
order_id: "", |
order_id: '', |
||||||
delivery: [], |
delivery: [], |
||||||
logistics: [], |
logistics: [], |
||||||
delivery_type: "express", |
delivery_type: 'express', |
||||||
delivery_name: "", |
deliveryName: '', |
||||||
delivery_id: "" |
deliveryId: '', |
||||||
}; |
deliveryNames: '请选择' |
||||||
}, |
}; |
||||||
watch: { |
}, |
||||||
"$yroute.query.oid": function(newVal) { |
watch: { |
||||||
let that = this; |
'$yroute.query.oid': function(newVal) { |
||||||
if (newVal != undefined) { |
let that = this; |
||||||
that.order_id = newVal; |
if (newVal != undefined) { |
||||||
that.getIndex(); |
that.order_id = newVal; |
||||||
} |
that.getIndex(); |
||||||
} |
} |
||||||
}, |
} |
||||||
mounted: function() { |
}, |
||||||
this.order_id = this.$yroute.query.oid; |
mounted: function() { |
||||||
this.getIndex(); |
this.order_id = this.$yroute.query.oid; |
||||||
//this.getLogistics(); |
this.getIndex(); |
||||||
}, |
this.getLogistics(); |
||||||
methods: { |
}, |
||||||
changeType: function(item, index) { |
methods: { |
||||||
this.active = index; |
changeLog: function(value) { |
||||||
this.delivery_type = item.type; |
this.deliveryNames = this.logistics[value.detail.value].name; |
||||||
this.delivery_name = ""; |
this.deliveryName = this.logistics[value.detail.value].id; |
||||||
this.delivery_id = ""; |
}, |
||||||
}, |
changeType: function(item, index) { |
||||||
getIndex: function() { |
this.active = index; |
||||||
let that = this; |
this.delivery_type = item.type; |
||||||
getAdminOrderDelivery(that.order_id).then( |
this.deliveryName = ''; |
||||||
res => { |
this.deliveryId = ''; |
||||||
that.delivery = res.data; |
}, |
||||||
}, |
getIndex: function() { |
||||||
error => { |
let that = this; |
||||||
uni.showToast({ |
getAdminOrderDelivery(that.order_id).then( |
||||||
title: error.msg, |
res => { |
||||||
icon: "none", |
that.delivery = res.data; |
||||||
duration: 2000 |
}, |
||||||
}); |
error => { |
||||||
} |
uni.showToast({ |
||||||
); |
title: error.msg, |
||||||
}, |
icon: 'none', |
||||||
getLogistics: function() { |
duration: 2000 |
||||||
let that = this; |
}); |
||||||
getLogistics().then( |
} |
||||||
res => { |
); |
||||||
that.logistics = res.data; |
}, |
||||||
}, |
getLogistics: function() { |
||||||
error => { |
let that = this; |
||||||
uni.showToast({ |
getLogistics().then( |
||||||
title: error.msg, |
res => { |
||||||
icon: "none", |
console.log(res.data); |
||||||
duration: 2000 |
that.logistics = res.data; |
||||||
}); |
}, |
||||||
} |
error => { |
||||||
); |
uni.showToast({ |
||||||
}, |
title: error.msg, |
||||||
async saveInfo() { |
icon: 'none', |
||||||
let that = this, |
duration: 2000 |
||||||
delivery_type = that.delivery_type, |
}); |
||||||
delivery_name = that.delivery_name, |
} |
||||||
delivery_id = that.delivery_id, |
); |
||||||
save = {}; |
}, |
||||||
save.orderId = that.order_id; |
async saveInfo() { |
||||||
save.deliveryType = that.delivery_type; |
let that = this, |
||||||
switch (delivery_type) { |
delivery_type = that.delivery_type, |
||||||
case "send": |
deliveryName = that.deliveryName, |
||||||
try { |
deliveryId = that.deliveryId, |
||||||
await this.$validator({ |
save = {}; |
||||||
delivery_name: [required(required.message("快递公司"))], |
save.orderId = that.order_id; |
||||||
delivery_id: [required(required.message("快递单号"))] |
save.deliveryType = that.delivery_type; |
||||||
}).validate({ delivery_name, delivery_id }); |
switch (delivery_type) { |
||||||
} catch (e) { |
case 'express': |
||||||
return validatorDefaultCatch(e); |
try { |
||||||
} |
await this.$validator({ |
||||||
save.delivery_name = delivery_name; |
deliveryName: [required(required.message('快递公司'))], |
||||||
save.delivery_id = delivery_id; |
deliveryId: [required(required.message('快递单号'))] |
||||||
that.setInfo(save); |
}).validate({ deliveryName, deliveryId }); |
||||||
break; |
} catch (e) { |
||||||
case "express": |
return validatorDefaultCatch(e); |
||||||
try { |
} |
||||||
await this.$validator({ |
save.deliveryName = deliveryName; |
||||||
delivery_name: [required(required.message("发货人姓名"))], |
save.deliveryId = deliveryId; |
||||||
delivery_id: [required(required.message("发货人电话"))] |
that.setInfo(save); |
||||||
}).validate({ delivery_name, delivery_id }); |
break; |
||||||
} catch (e) { |
case 'send': |
||||||
return validatorDefaultCatch(e); |
try { |
||||||
} |
await this.$validator({ |
||||||
save.deliveryName = delivery_name; |
deliveryName: [required(required.message('发货人姓名'))], |
||||||
save.deliveryId = delivery_id; |
deliveryId: [required(required.message('发货人电话'))] |
||||||
that.setInfo(save); |
}).validate({ deliveryName, deliveryId }); |
||||||
break; |
} catch (e) { |
||||||
} |
return validatorDefaultCatch(e); |
||||||
}, |
} |
||||||
setInfo: function(item) { |
save.deliveryName = deliveryName; |
||||||
let that = this; |
save.deliveryId = deliveryId; |
||||||
setAdminOrderDelivery(item).then( |
that.setInfo(save); |
||||||
res => { |
break; |
||||||
uni.showToast({ |
} |
||||||
title: res.msg, |
}, |
||||||
icon: "none", |
setInfo: function(item) { |
||||||
duration: 2000 |
let that = this; |
||||||
}); |
console.log(item); |
||||||
that.$yrouter.go(-1); |
setAdminOrderDelivery(item) |
||||||
}, |
.then(res => { |
||||||
error => { |
console.log(res); |
||||||
uni.showToast({ |
uni.showToast({ |
||||||
title: error.msg, |
title: res.msg, |
||||||
icon: "none", |
icon: 'none', |
||||||
duration: 2000 |
duration: 2000 |
||||||
}); |
}); |
||||||
} |
that.$yrouter.go(-1); |
||||||
); |
}) |
||||||
} |
.catch(err => { |
||||||
} |
console.log(err); |
||||||
|
uni.showToast({ |
||||||
|
title: err.msg || err.response.data.msg || err.response.data.message, |
||||||
|
icon: 'none', |
||||||
|
duration: 2000 |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
}; |
}; |
||||||
</script> |
</script> |
||||||
|
Loading…
Reference in new issue