|
|
@@ -2,29 +2,21 @@
|
|
|
<view class="app-main app-content">
|
|
|
<view class="express-form-container">
|
|
|
<!-- 订单信息显示 -->
|
|
|
- <view class="order-info-section" v-if="orderInfo">
|
|
|
+ <view class="order-info-section">
|
|
|
<view class="section-title">
|
|
|
订单信息
|
|
|
</view>
|
|
|
- <view class="info-item">
|
|
|
- <text class="label">下单客户:</text>
|
|
|
- <text class="value">{{ orderInfo.customName }}</text>
|
|
|
- </view>
|
|
|
- <view class="info-item">
|
|
|
- <text class="label">下单手机:</text>
|
|
|
- <text class="value">{{ orderInfo.bookMobile }}</text>
|
|
|
- </view>
|
|
|
<view class="info-item">
|
|
|
<text class="label">订单编号:</text>
|
|
|
<text class="value">{{ orderInfo.orderSn }}</text>
|
|
|
</view>
|
|
|
<view class="info-item">
|
|
|
<text class="label">收货姓名:</text>
|
|
|
- <text class="value">{{ expressForm.user_name }}</text>
|
|
|
+ <text class="value">{{ orderInfo.customName }}</text>
|
|
|
</view>
|
|
|
<view class="info-item">
|
|
|
<text class="label">手机号码:</text>
|
|
|
- <text class="value">{{ expressForm.c }}</text>
|
|
|
+ <text class="value">{{ orderInfo.customMobile }}</text>
|
|
|
</view>
|
|
|
<view class="info-item">
|
|
|
<text class="label">详细地址:</text>
|
|
|
@@ -41,7 +33,7 @@
|
|
|
<view class="form-section">
|
|
|
<view class="section-title">商品信息</view>
|
|
|
<view class="form-item">
|
|
|
- <text class="item-label">商品数量</text>
|
|
|
+ <text class="item-label">包裹数量</text>
|
|
|
<view class="item-value">
|
|
|
<input class="item-input" type="number" v-model="expressForm.packageNum" placeholder="请输入包裹数量" />
|
|
|
</view>
|
|
|
@@ -70,29 +62,19 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
-import { getStoreFee, createExpressOrder } from '@/api/shop-express'
|
|
|
+import { getOrderFee,createCallExpressOrder } from '@/api/shop/shop-express';
|
|
|
import { getDetail } from '@/api/order'
|
|
|
-
|
|
|
export default {
|
|
|
- name: 'ExpressCreate',
|
|
|
+ name: 'callExpress',
|
|
|
data() {
|
|
|
return {
|
|
|
orderId: '',
|
|
|
- isNew: 0, // 0: 重新配送, 1: 首次配送
|
|
|
orderInfo: null,
|
|
|
// 配送表单数据
|
|
|
expressForm: {
|
|
|
packageNum: 1,
|
|
|
- price: 0,
|
|
|
weight:'',
|
|
|
- user_name: '',
|
|
|
- user_phone: '',
|
|
|
- user_lng: 0,
|
|
|
- user_lat: 0,
|
|
|
- user_address: '',
|
|
|
- note: ''
|
|
|
},
|
|
|
cargo: {
|
|
|
name: '',
|
|
|
@@ -105,44 +87,16 @@ export default {
|
|
|
refreshPage:0
|
|
|
}
|
|
|
},
|
|
|
- onLoad(options) {
|
|
|
- if (options.orderId) {
|
|
|
- this.orderId = options.orderId
|
|
|
- this.isNew = options.isNew
|
|
|
- }
|
|
|
-
|
|
|
- //返回上一页时刷新
|
|
|
- let pages = getCurrentPages();
|
|
|
- let prevPage = pages[ pages.length - 2 ];
|
|
|
- prevPage.$vm.refreshPage = 1
|
|
|
-
|
|
|
+ onLoad() {
|
|
|
+
|
|
|
},
|
|
|
onShow() {
|
|
|
- if(this.orderId){
|
|
|
- this.getOrderDetail()
|
|
|
- } else {
|
|
|
- setTimeout(() => {
|
|
|
- this.getOrderDetail()
|
|
|
- }, 100)
|
|
|
- }
|
|
|
-
|
|
|
- if(this.refreshPage == 1){
|
|
|
- this.getOrderDetail()
|
|
|
- this.refreshPage = 0
|
|
|
- }
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
- init(){},
|
|
|
- /**
|
|
|
- * 跳转到修改订单页面
|
|
|
- */
|
|
|
- goToModifyPage() {
|
|
|
- uni.navigateTo({
|
|
|
- url: `/admin/order/modify?id=${this.orderId}`
|
|
|
- })
|
|
|
+ init(){
|
|
|
+ this.orderId = this.option.orderId?this.option.orderId:0
|
|
|
+ this.getOrderDetail()
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 获取订单详情
|
|
|
*/
|
|
|
@@ -151,13 +105,6 @@ export default {
|
|
|
if (res.code === 1) {
|
|
|
this.orderInfo = res.data
|
|
|
this.expressForm.weight = res.data.weight?parseFloat(res.data.weight):0
|
|
|
- this.expressForm.price = res.data.prePrice || 0
|
|
|
- // 自动填充收货信息
|
|
|
- this.expressForm.user_name = res.data.receiveUserName || res.data.bookName || ''
|
|
|
- this.expressForm.user_phone = res.data.receiveMobile || res.data.bookMobile || ''
|
|
|
- this.expressForm.user_address = res.data.dist + res.data.address + res.data.floor
|
|
|
- this.expressForm.user_lng = res.data.long || 0
|
|
|
- this.expressForm.user_lat = res.data.lat || 0
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
@@ -169,75 +116,37 @@ export default {
|
|
|
this.$msg('请输入重量')
|
|
|
return
|
|
|
}
|
|
|
- if (!this.expressForm.user_name) {
|
|
|
- this.$msg('收货人姓名不能为空')
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.expressForm.user_phone) {
|
|
|
- this.$msg('收货人手机号不能为空')
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.expressForm.user_address) {
|
|
|
- this.$msg('收货地址不能为空')
|
|
|
- return
|
|
|
- }
|
|
|
const data = {
|
|
|
- orderId: this.orderId,
|
|
|
- price: this.expressForm.price,
|
|
|
+ id: this.orderId,
|
|
|
weight: Number(this.expressForm.weight),
|
|
|
packageNum: this.expressForm.packageNum,
|
|
|
- user_name: this.expressForm.user_name,
|
|
|
- user_phone: this.expressForm.user_phone,
|
|
|
- user_address: this.expressForm.user_address,
|
|
|
- user_lng: this.expressForm.user_lng,
|
|
|
- user_lat: this.expressForm.user_lat
|
|
|
}
|
|
|
- const res = await getStoreFee(data)
|
|
|
+ const res = await getOrderFee(data)
|
|
|
if (res.code === 1) {
|
|
|
const deliveryFee = res.data.est_fee || '0'
|
|
|
- this.deliveryFee = deliveryFee/100.0
|
|
|
- this.$msg('运费查询成功')
|
|
|
+ this.deliveryFee = deliveryFee/100
|
|
|
+ this.deliveryFee = Number(this.deliveryFee).toFixed(2)
|
|
|
+ this.deliveryFee = parseFloat(this.deliveryFee)
|
|
|
+ this.$msg('查询成功')
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 提交配送订单
|
|
|
*/
|
|
|
async submitExpress() {
|
|
|
- // 验证必填字段
|
|
|
if (!this.expressForm.weight || Number(this.expressForm.weight) <= 0) {
|
|
|
this.$msg('请输入重量')
|
|
|
return
|
|
|
}
|
|
|
- if (!this.expressForm.user_name) {
|
|
|
- this.$msg('收货人姓名不能为空')
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.expressForm.user_phone) {
|
|
|
- this.$msg('收货人手机号不能为空')
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.expressForm.user_address) {
|
|
|
- this.$msg('收货地址不能为空')
|
|
|
- return
|
|
|
- }
|
|
|
- this.$util.confirmModal({content: '确认呼叫跑腿?'}, async () => {
|
|
|
+ this.$util.confirmModal({content: '确认呼叫?'}, async () => {
|
|
|
const data = {
|
|
|
orderId: this.orderId,
|
|
|
weight: Number(this.expressForm.weight),
|
|
|
- packageNum: this.expressForm.packageNum,
|
|
|
- user_name: this.expressForm.user_name,
|
|
|
- user_phone: this.expressForm.user_phone,
|
|
|
- user_address: this.expressForm.user_address,
|
|
|
- user_lng: this.expressForm.user_lng,
|
|
|
- user_lat: this.expressForm.user_lat,
|
|
|
- note: this.expressForm.note,
|
|
|
- isNew: this.isNew
|
|
|
+ packageNum: this.expressForm.packageNum
|
|
|
}
|
|
|
- const res = await createExpressOrder(data)
|
|
|
+ const res = await createCallExpressOrder(data)
|
|
|
if (res.code === 1) {
|
|
|
this.$msg('提交成功')
|
|
|
- // 返回订单列表页面
|
|
|
setTimeout(() => {
|
|
|
uni.navigateBack()
|
|
|
}, 1500)
|