Browse Source

修改发货页面无法进行发货的问题

master
Gao xiaosong 5 years ago
parent
commit
852da49d92
  1. 114
      pages/orderAdmin/GoodsDeliver/index.vue

114
pages/orderAdmin/GoodsDeliver/index.vue

@ -7,27 +7,18 @@
</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"> <view class="line"><image src="@/static/images/line.jpg" /></view>
<image src="@/static/images/line.jpg" />
</view>
</header> </header>
<view class="wrapper"> <view class="wrapper">
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<view>发货方式</view> <view>发货方式</view>
<view class="mode acea-row row-middle row-right"> <view class="mode acea-row row-middle row-right">
<view <view class="goods" :class="active === typesIndex ? 'on' : ''" v-for="(item, typesIndex) in types" :key="typesIndex" @click="changeType(item, typesIndex)">
class="goods"
:class="active === typesIndex ? 'on' : ''"
v-for="(item, typesIndex) in types"
:key="typesIndex"
@click="changeType(item, typesIndex)"
>
{{ item.title }} {{ item.title }}
<text class="iconfont icon-xuanzhong2"></text> <text class="iconfont icon-xuanzhong2"></text>
</view> </view>
@ -36,21 +27,24 @@
<view class="list" v-show="active === 0"> <view class="list" v-show="active === 0">
<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_name" class="mode" /> <picker mode="selector" :range="logistics" class="mode" range-key="name" @change="changeLog">
<input type="text" placeholder="填写快递公司" disabled="disabled" v-model="deliveryNames" class="mode" />
</picker>
<!-- <input type="text" placeholder="填写快递公司" v-model="deliveryName" class="mode" /> -->
</view> </view>
<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="deliveryId" class="mode" />
</view> </view>
</view> </view>
<view class="list" v-show="active === 1"> <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_name" class="mode" /> <input type="text" placeholder="填写送货人" v-model="deliveryName" class="mode" />
</view> </view>
<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="deliveryId" class="mode" />
</view> </view>
</view> </view>
</view> </view>
@ -59,21 +53,21 @@
</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",
@ -85,16 +79,17 @@ export default {
// } // }
], ],
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: { watch: {
"$yroute.query.oid": function(newVal) { '$yroute.query.oid': function(newVal) {
let that = this; let that = this;
if (newVal != undefined) { if (newVal != undefined) {
that.order_id = newVal; that.order_id = newVal;
@ -105,14 +100,18 @@ export default {
mounted: function() { mounted: function() {
this.order_id = this.$yroute.query.oid; this.order_id = this.$yroute.query.oid;
this.getIndex(); this.getIndex();
//this.getLogistics(); this.getLogistics();
}, },
methods: { methods: {
changeLog: function(value) {
this.deliveryNames = this.logistics[value.detail.value].name;
this.deliveryName = this.logistics[value.detail.value].id;
},
changeType: function(item, index) { changeType: function(item, index) {
this.active = index; this.active = index;
this.delivery_type = item.type; this.delivery_type = item.type;
this.delivery_name = ""; this.deliveryName = '';
this.delivery_id = ""; this.deliveryId = '';
}, },
getIndex: function() { getIndex: function() {
let that = this; let that = this;
@ -123,7 +122,7 @@ export default {
error => { error => {
uni.showToast({ uni.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
duration: 2000 duration: 2000
}); });
} }
@ -133,12 +132,13 @@ export default {
let that = this; let that = this;
getLogistics().then( getLogistics().then(
res => { res => {
console.log(res.data);
that.logistics = res.data; that.logistics = res.data;
}, },
error => { error => {
uni.showToast({ uni.showToast({
title: error.msg, title: error.msg,
icon: "none", icon: 'none',
duration: 2000 duration: 2000
}); });
} }
@ -147,59 +147,61 @@ export default {
async saveInfo() { async saveInfo() {
let that = this, let that = this,
delivery_type = that.delivery_type, delivery_type = that.delivery_type,
delivery_name = that.delivery_name, deliveryName = that.deliveryName,
delivery_id = that.delivery_id, deliveryId = that.deliveryId,
save = {}; save = {};
save.orderId = that.order_id; save.orderId = that.order_id;
save.deliveryType = that.delivery_type; save.deliveryType = that.delivery_type;
switch (delivery_type) { switch (delivery_type) {
case "send": case 'express':
try { try {
await this.$validator({ await this.$validator({
delivery_name: [required(required.message("快递公司"))], deliveryName: [required(required.message('快递公司'))],
delivery_id: [required(required.message("快递单号"))] deliveryId: [required(required.message('快递单号'))]
}).validate({ delivery_name, delivery_id }); }).validate({ deliveryName, deliveryId });
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e);
} }
save.delivery_name = delivery_name; save.deliveryName = deliveryName;
save.delivery_id = delivery_id; save.deliveryId = deliveryId;
that.setInfo(save); that.setInfo(save);
break; break;
case "express": case 'send':
try { try {
await this.$validator({ await this.$validator({
delivery_name: [required(required.message("发货人姓名"))], deliveryName: [required(required.message('发货人姓名'))],
delivery_id: [required(required.message("发货人电话"))] deliveryId: [required(required.message('发货人电话'))]
}).validate({ delivery_name, delivery_id }); }).validate({ deliveryName, deliveryId });
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e);
} }
save.deliveryName = delivery_name; save.deliveryName = deliveryName;
save.deliveryId = delivery_id; save.deliveryId = deliveryId;
that.setInfo(save); that.setInfo(save);
break; break;
} }
}, },
setInfo: function(item) { setInfo: function(item) {
let that = this; let that = this;
setAdminOrderDelivery(item).then( console.log(item);
res => { setAdminOrderDelivery(item)
.then(res => {
console.log(res);
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
duration: 2000 duration: 2000
}); });
that.$yrouter.go(-1); that.$yrouter.go(-1);
}, })
error => { .catch(err => {
console.log(err);
uni.showToast({ uni.showToast({
title: error.msg, title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: 'none',
duration: 2000 duration: 2000
}); });
} });
);
} }
} }
}; };

Loading…
Cancel
Save