115 lines
3.9 KiB
Vue
115 lines
3.9 KiB
Vue
<template>
|
|
<el-form ref="form" label-width="80px">
|
|
<el-form-item label="客户信息" required>
|
|
<p>收件人: {{ info.name }}</p>
|
|
<p>收件人联系方式: {{ info.phone }}</p>
|
|
<p>收件地址: {{ info.addressRegion.province.name }}{{ info.addressRegion.city.name }}{{ info.addressRegion.area.name }}{{ info.addressDetail }}</p>
|
|
</el-form-item>
|
|
<el-form-item label="物流公司" required>
|
|
<el-input v-model="expressName" placeholder="请输入物流公司"/>
|
|
</el-form-item>
|
|
<el-form-item label="物流单号" required>
|
|
<el-input v-model="expressNo" placeholder="请输入物流单号"/>
|
|
</el-form-item>
|
|
<el-form-item label="发货单" required>
|
|
<u-upload
|
|
multiple
|
|
:fileList="expressPhotoList"
|
|
@afterRead="afterRead"
|
|
@delete="deletePic"
|
|
width="120rpx"
|
|
height="120rpx"
|
|
></u-upload>
|
|
</el-form-item>
|
|
<el-form-item label="备注">
|
|
<el-input v-model="remark" placeholder="请输入备注"/>
|
|
</el-form-item>
|
|
<div class="mt-20 flex justify-center items-center text-center">
|
|
<el-button type="primary" size="small" plain @click.native="cancel">取消</el-button>
|
|
<el-button type="primary" size="small" @click.native="confirm">确定</el-button>
|
|
</div>
|
|
</el-form>
|
|
</template>
|
|
|
|
<script>
|
|
import dayjs from "dayjs";
|
|
import md5 from "js-md5";
|
|
|
|
export default {
|
|
name: "setExpress",
|
|
props: {
|
|
id: Number | String,
|
|
info: Object
|
|
},
|
|
data() {
|
|
return {
|
|
expressName: null,
|
|
expressNo: null,
|
|
remark: null,
|
|
expressPhoto: [],
|
|
expressPhotoList: [],
|
|
}
|
|
},
|
|
methods: {
|
|
afterRead({file}) {
|
|
file.forEach(item => {
|
|
const suffix = item.name.split('.').pop()
|
|
uniCloud.uploadFile({
|
|
filePath: item.url,
|
|
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + md5(item.name + Date.now().toString()) + `.${suffix}`,
|
|
success: ({fileID}) => {
|
|
uniCloud.getTempFileURL({
|
|
fileList: [fileID]
|
|
}).then(res => {
|
|
this.expressPhotoList.push({url: res.fileList[0].tempFileURL})
|
|
this.expressPhoto.push(res.fileList[0].tempFileURL)
|
|
})
|
|
}
|
|
})
|
|
})
|
|
},
|
|
deletePic({index}) {
|
|
this.expressPhoto.splice(index, 1)
|
|
},
|
|
close() {
|
|
this.$emit('close')
|
|
},
|
|
cancel() {
|
|
this.expressName = null
|
|
this.expressNo = null
|
|
this.remark = null
|
|
this.expressPhoto = []
|
|
this.$emit('close')
|
|
},
|
|
async confirm() {
|
|
if (!this.expressName) return this.$message({
|
|
type: 'error',
|
|
message: '请填写物流公司'
|
|
})
|
|
if (!this.expressNo) return this.$message({
|
|
type: 'error',
|
|
message: '请填写物流单号'
|
|
})
|
|
if (this.expressPhoto.length === 0) return this.$message({
|
|
type: 'error',
|
|
message: '请上传发货单'
|
|
})
|
|
await vk.callFunction({
|
|
url: 'client/order/kh/setExpress',
|
|
data: {
|
|
id: this.id,
|
|
expressName: this.expressName,
|
|
expressNo: this.expressNo,
|
|
remark: this.remark,
|
|
expressPhoto: this.expressPhoto
|
|
}
|
|
})
|
|
this.$emit('close')
|
|
this.$message({
|
|
type: 'success',
|
|
message: '发货成功'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script> |