|
@@ -1,73 +1,58 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
- <el-card class="box-card" style="margin: 0 auto;">
|
|
|
|
- <div class="refund-item" />
|
|
|
|
- </el-card>
|
|
|
|
<el-card class="box-card" style="margin: 10px auto;">
|
|
<el-card class="box-card" style="margin: 10px auto;">
|
|
<div class="refund-item">
|
|
<div class="refund-item">
|
|
<el-form ref="logisticFrom" :model="params" :rules="rules" label-width="120px">
|
|
<el-form ref="logisticFrom" :model="params" :rules="rules" label-width="120px">
|
|
- <el-row v-for="(logistic,index) in params.transportations" :key="index" :gutter="24" class="box-row">
|
|
|
|
- <el-col :span="8">
|
|
|
|
- <el-form-item label="快递公司:" :prop="`transportations.${index}.logisticsCompanyName`" :rules="rules.logisticsCompanyName">
|
|
|
|
- <el-select v-model="logistic.logisticsCompanyName" style="width:250px;" clearable size="mini" @change="hanldeCompny($event,index)">
|
|
|
|
- <el-option value="" label="请选择物流公司" />
|
|
|
|
- <el-option v-for="item in kuaiduLisrt" :key="item.id" :label="item.label" :value="item" />
|
|
|
|
- </el-select>
|
|
|
|
- <el-button v-if="index === 0" type="primary" icon="el-icon-plus" size="mini" style="margin-left: 10px;" @click="hanldeAddlogis(logistic,index)" />
|
|
|
|
- <el-button v-if="(index+1) > 1" type="danger" icon="el-icon-minus" size="mini" style="margin-left: 10px;" @click="handeleDelete(index)" />
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="8">
|
|
|
|
- <div v-for="(sticsNu,numIndex) in logistic.logisticsNu" :key="numIndex">
|
|
|
|
- <el-form-item label="物流编号:" :prop="`transportations.${index}.logisticsNu.${numIndex}.num`" :rules="rules.num">
|
|
|
|
- <el-input :key="numIndex" v-model="sticsNu.num" placeholder="请输入物流单号" style="width: 250px" size="mini" />
|
|
|
|
- <el-button v-if="numIndex === 0" type="primary" icon="el-icon-plus" size="mini" style="margin-left: 10px;" @click="hanldeAddNumber(logistic,numIndex)" />
|
|
|
|
- <el-button v-if="(numIndex+1) > 1" type="danger" icon="el-icon-minus" size="mini" style="margin-left: 10px;" @click="handeleDeleteNumber(logistic,numIndex)" />
|
|
|
|
- </el-form-item>
|
|
|
|
- </div>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
<el-row :gutter="24" class="box-row">
|
|
<el-row :gutter="24" class="box-row">
|
|
- <el-form-item label="图片备注:" prop="logImage">
|
|
|
|
- <div class="form-el-upload" style="width: 148px;height: 148px;">
|
|
|
|
|
|
+ <el-form-item label="备注:" prop="remarks">
|
|
|
|
+ <el-input v-model.trim="params.remarks" type="textarea" show-word-limit placeholder="请输入备注文字,200字以内" maxlength="200" :autosize="{ minRows: 5, maxRows: 6}" style="width: 600px;" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="图片:" prop="logImage">
|
|
|
|
+ <div class="form-el-upload">
|
|
<el-upload
|
|
<el-upload
|
|
- class="avatar-uploader"
|
|
|
|
|
|
+ :class="{hide: hideImg}"
|
|
:action="actionUrl"
|
|
:action="actionUrl"
|
|
:headers="getToken"
|
|
:headers="getToken"
|
|
list-type="picture-card"
|
|
list-type="picture-card"
|
|
|
|
+ :before-upload="beforeUploadImg"
|
|
:on-remove="handleRemove"
|
|
:on-remove="handleRemove"
|
|
:on-success="handleSuccess"
|
|
:on-success="handleSuccess"
|
|
|
|
+ :limit="5"
|
|
>
|
|
>
|
|
|
|
+ <div slot="tip" class="el-upload__tip">请上传jgp,jpeg,png格式的图片,每张不超过5M</div>
|
|
<i class="el-icon-plus" />
|
|
<i class="el-icon-plus" />
|
|
</el-upload>
|
|
</el-upload>
|
|
- <p style="margin: 0;line-height: 20px;font-size: 14px;color: red;">注意:请上传jpg / png格式的图片,最大不超过5M,最多可上传10张</p>
|
|
|
|
</div>
|
|
</div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="备注:" prop="name">
|
|
|
|
- <el-input v-model="params.remark" type="textarea" show-word-limit placeholder="请输入备注文字,200字以内" maxlength="200" :autosize="{ minRows: 5, maxRows: 6}" style="width: 600px;" />
|
|
|
|
|
|
+ <el-form-item label="文件:" class="fileUpload" style="margin-bottom: 0;">
|
|
|
|
+ <el-upload
|
|
|
|
+ :action="fileUrl"
|
|
|
|
+ :headers="getToken"
|
|
|
|
+ :before-upload="beforeUploadFile"
|
|
|
|
+ :on-remove="handlerFileRemove"
|
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
|
+ :limit="5"
|
|
|
|
+ >
|
|
|
|
+ <div slot="tip" class="el-upload__tip">请上传pdf,doc,xlsx格式的文件,每个不超过5M</div>
|
|
|
|
+ <el-button v-if="!hideFile" size="small" type="primary">浏览</el-button>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <div class="filter-container" style="text-align: left;margin-top: 20px;">
|
|
|
|
+ <el-button type="primary" @click="HandlerConfirm('logisticFrom')">保存</el-button>
|
|
|
|
+ <el-button plain @click="backToList">返回</el-button>
|
|
|
|
+ </div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-row>
|
|
</el-row>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
</el-card>
|
|
- <div class="filter-container" style="text-align: right;margin-top: 20px;">
|
|
|
|
- <el-button plain @click="backToList">取消</el-button>
|
|
|
|
- <el-button type="primary" :disabled="disabled" @click="hanldeConfirm('logisticFrom')">确认发货</el-button>
|
|
|
|
- </div>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { confirmDeliver, deliverShipCompany } from '@/api/order'
|
|
|
|
-const defaultForm = () => {
|
|
|
|
- return {
|
|
|
|
- logisticsCompanyCode: '',
|
|
|
|
- logisticsCompanyName: '',
|
|
|
|
- logisticsNu: [
|
|
|
|
- { num: '' }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+import { orderAddNote } from '@/api/order'
|
|
|
|
+import { mapState } from 'vuex'
|
|
export default {
|
|
export default {
|
|
name: 'AddRemarks',
|
|
name: 'AddRemarks',
|
|
filters: {
|
|
filters: {
|
|
@@ -76,27 +61,22 @@ export default {
|
|
return {
|
|
return {
|
|
params: {
|
|
params: {
|
|
images: [], // 发货图片备注
|
|
images: [], // 发货图片备注
|
|
- orderProducts: [],
|
|
|
|
- remark: '',
|
|
|
|
- transportations: [
|
|
|
|
- {
|
|
|
|
- logisticsCompanyCode: '',
|
|
|
|
- logisticsCompanyName: '',
|
|
|
|
- logisticsNu: [
|
|
|
|
- { num: '' }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ remarks: '',
|
|
|
|
+ ossFiles: [],
|
|
|
|
+ orderId: ''
|
|
},
|
|
},
|
|
- islogisticsCompany: false,
|
|
|
|
- islogisticsNumber: false,
|
|
|
|
- productList: [],
|
|
|
|
- kuaiduLisrt: [],
|
|
|
|
fileImageList: [], // 上传图片列表
|
|
fileImageList: [], // 上传图片列表
|
|
|
|
+ fileUrl: process.env.VUE_APP_BASE_API + '/order/cmOrderRemark/upload/remark',
|
|
|
|
+ fileList: [], // 上传文件列表
|
|
rules: {
|
|
rules: {
|
|
- logisticsCompanyName: [{ required: true, message: '请选择物流公司', trigger: 'blur' }],
|
|
|
|
- num: [{ required: true, message: '请输入物流单号', trigger: 'blur' }]
|
|
|
|
- }
|
|
|
|
|
|
+ remarks: [{
|
|
|
|
+ required: true,
|
|
|
|
+ message: '请输入备注信息',
|
|
|
|
+ trigger: 'blur'
|
|
|
|
+ }]
|
|
|
|
+ },
|
|
|
|
+ hideImg: false, // 上传图片隐藏
|
|
|
|
+ hideFile: false // 上传文件隐藏
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -111,121 +91,95 @@ export default {
|
|
orderId: function() {
|
|
orderId: function() {
|
|
return this.$route.query.orderId * 1
|
|
return this.$route.query.orderId * 1
|
|
},
|
|
},
|
|
- disabled() {
|
|
|
|
- return this.params.transportations[0] === ''
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- created() {
|
|
|
|
- if (this.$route.query.products) {
|
|
|
|
- this.params.orderProducts = JSON.parse(this.$route.query.products)
|
|
|
|
- }
|
|
|
|
- this.deliverShipCompany()
|
|
|
|
- console.log('productList', this.params.orderProducts)
|
|
|
|
|
|
+ ...mapState({ adminName: state => state.user.name })
|
|
},
|
|
},
|
|
|
|
+ created() {},
|
|
methods: {
|
|
methods: {
|
|
- // 付款单详情
|
|
|
|
- async deliverShipCompany() {
|
|
|
|
- try {
|
|
|
|
- const res = await deliverShipCompany()
|
|
|
|
- console.log('res', res)
|
|
|
|
- this.kuaiduLisrt = res.data
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log('error', error)
|
|
|
|
- }
|
|
|
|
|
|
+ isImage(file) {
|
|
|
|
+ return file.type === 'image/png' ||
|
|
|
|
+ file.type === 'image/jpeg' ||
|
|
|
|
+ file.type === 'image/jpg' ||
|
|
|
|
+ file.type === 'image/webp'
|
|
},
|
|
},
|
|
- // 选择物流公司
|
|
|
|
- hanldeCompny(value, index) {
|
|
|
|
- console.log('value', value)
|
|
|
|
- this.params.transportations[index].logisticsCompanyName = value.label
|
|
|
|
- this.params.transportations[index].logisticsCompanyCode = value.value
|
|
|
|
- this.islogisticsCompany = false
|
|
|
|
|
|
+ HandlerConfirm(formName) {
|
|
|
|
+ this.$refs[formName].validate(async valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.params.orderId = this.$route.query.orderId
|
|
|
|
+ try {
|
|
|
|
+ await orderAddNote(this.params)
|
|
|
|
+ this.$message.success('添加成功')
|
|
|
|
+ this.backToList()
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- // 添加一条物流公司
|
|
|
|
- hanldeAddlogis() {
|
|
|
|
- this.params.transportations.push(defaultForm())
|
|
|
|
|
|
+ // 上传图片事件
|
|
|
|
+ handleSuccess(res, file, fileList) {
|
|
|
|
+ this.params.images.push(res.data)
|
|
|
|
+ this.handleChange()
|
|
},
|
|
},
|
|
- // 删除 一条物流公司
|
|
|
|
- handeleDelete(index) {
|
|
|
|
- this.params.transportations.splice(index, 1)
|
|
|
|
|
|
+ // 上传文件
|
|
|
|
+ handleFileSuccess(res, file, fileList) {
|
|
|
|
+ this.params.ossFiles.push(res.data.ossFiles)
|
|
|
|
+ this.handleFileChange()
|
|
},
|
|
},
|
|
- // 添加物流单号
|
|
|
|
- hanldeAddNumber(logistic, num, numIndex) {
|
|
|
|
- logistic.logisticsNu.push({ num: '' })
|
|
|
|
|
|
+ // 删除图片事件
|
|
|
|
+ handleRemove(file, fileList) {
|
|
|
|
+ this.params.images = fileList.map(e => e.response.data)
|
|
|
|
+ this.handleChange()
|
|
},
|
|
},
|
|
- // 删除一条物流编号
|
|
|
|
- handeleDeleteNumber(logistic, numIndex) {
|
|
|
|
- logistic.logisticsNu.splice(numIndex, 1)
|
|
|
|
|
|
+ // 删除文件
|
|
|
|
+ handlerFileRemove(file, fileList) {
|
|
|
|
+ this.params.ossFiles = fileList.map(e => e.response.data.ossFiles)
|
|
|
|
+ this.handleFileChange()
|
|
},
|
|
},
|
|
- checkedParams() { // 校验参数信息
|
|
|
|
- const _this = this
|
|
|
|
- this.params.transportations.forEach(function(pros) {
|
|
|
|
- pros.logisticsNu.forEach(function(item) {
|
|
|
|
- const transpor = {
|
|
|
|
- logisticsCompanyCode: pros.logisticsCompanyCode,
|
|
|
|
- logisticsCompanyName: pros.logisticsCompanyName,
|
|
|
|
- num: item.num
|
|
|
|
- }
|
|
|
|
- if (transpor.logisticsCompanyCode === '' && transpor.logisticsCompanyName === '') {
|
|
|
|
- _this.islogisticsCompany = true
|
|
|
|
- } else {
|
|
|
|
- _this.islogisticsCompany = false
|
|
|
|
- }
|
|
|
|
- if (transpor.num === '') {
|
|
|
|
- console.log('1111111111')
|
|
|
|
- _this.islogisticsNumber = true
|
|
|
|
- } else {
|
|
|
|
- _this.islogisticsNumber = false
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- hanldeConfirm(formName) {
|
|
|
|
- // 保存编辑
|
|
|
|
- // this.checkedParams()
|
|
|
|
- this.$refs[formName].validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- this.fileImageList.forEach((image) => {
|
|
|
|
- this.params.images.push(image.response.data)
|
|
|
|
- })
|
|
|
|
- this.confirmDeliver(this.params)
|
|
|
|
|
|
+ // 文件限制
|
|
|
|
+ beforeUploadImg(file) {
|
|
|
|
+ const isUpload = file.size / 1024 / 1024 < 5
|
|
|
|
+ if (this.isImage(file)) {
|
|
|
|
+ if (isUpload) {
|
|
|
|
+ return true
|
|
} else {
|
|
} else {
|
|
|
|
+ this.$message.error('文件过大,请重新上传!')
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- })
|
|
|
|
- },
|
|
|
|
- async confirmDeliver(params) {
|
|
|
|
- try {
|
|
|
|
- await confirmDeliver(params)
|
|
|
|
- this.$message.success('操作成功')
|
|
|
|
- this.backToList()
|
|
|
|
- } catch (error) {
|
|
|
|
- console.log('error', error)
|
|
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('请上传jgp,jpeg,png格式的图片!')
|
|
|
|
+ return false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // 上传图片事件
|
|
|
|
- handleSuccess(res, file, fileList) {
|
|
|
|
- this.fileImageList = fileList
|
|
|
|
- console.log('images', this.fileImageList)
|
|
|
|
- },
|
|
|
|
- // 删除图片事件
|
|
|
|
- handleRemove(file, fileList) {
|
|
|
|
- this.fileImageList = fileList
|
|
|
|
- console.log('images', this.fileImageList)
|
|
|
|
|
|
+ beforeUploadFile(file) {
|
|
|
|
+ const whiteList = ['pdf', 'doc', 'docx', 'xlsx']
|
|
|
|
+ const isUpload = file.size / 1024 / 1024 < 5
|
|
|
|
+ if (whiteList.indexOf(file.name.substring(file.name.lastIndexOf('.') + 1)) === -1) {
|
|
|
|
+ this.$message.error('请上传 pdf、doc、docx、xlsx格式的文件!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if (isUpload) {
|
|
|
|
+ return true
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('文件过大,请重新上传!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- reloadImage() {
|
|
|
|
- this.loadImgLoading = true
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.temp.classifyImage = this.temp.classifyImage.split('?')[0] + '?r=' + Math.floor(Math.random() * 1000)
|
|
|
|
- }, 1000 * 2)
|
|
|
|
|
|
+ // 文件数量判断
|
|
|
|
+ handleChange(file, fileList) {
|
|
|
|
+ this.hideImg = this.params.images.length >= 5
|
|
},
|
|
},
|
|
- loadSucess() {
|
|
|
|
- this.loadImgLoading = false
|
|
|
|
|
|
+ // 文件数量判断
|
|
|
|
+ handleFileChange(file, fileList) {
|
|
|
|
+ this.hideFile = this.params.ossFiles.length >= 5
|
|
},
|
|
},
|
|
backToList() {
|
|
backToList() {
|
|
this.$store.dispatch('tagsView/delView', this.$route).then(() => {
|
|
this.$store.dispatch('tagsView/delView', this.$route).then(() => {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.$router.replace({
|
|
this.$router.replace({
|
|
- path: '/order/list'
|
|
|
|
|
|
+ path: '/order/order-remarks',
|
|
|
|
+ query: {
|
|
|
|
+ orderId: this.orderId
|
|
|
|
+ }
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|
|
@@ -234,7 +188,26 @@ export default {
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style lang="scss">
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+::v-deep .el-upload-list {
|
|
|
|
+ display: inline-flex !important;
|
|
|
|
+}
|
|
|
|
+::v-deep .el-upload--picture-card {
|
|
|
|
+ width: 148px !important;
|
|
|
|
+ height: 148px !important;
|
|
|
|
+}
|
|
|
|
+::v-deep .el-upload__tip {
|
|
|
|
+ position: static !important;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+::v-deep .hide .el-upload--picture-card {
|
|
|
|
+ display: none;
|
|
|
|
+}
|
|
|
|
+.fileUpload {
|
|
|
|
+ ::v-deep .el-upload-list {
|
|
|
|
+ flex-direction: column !important;
|
|
|
|
+ }
|
|
|
|
+}
|
|
.app-title{
|
|
.app-title{
|
|
line-height: 36px;
|
|
line-height: 36px;
|
|
font-size: 26px;
|
|
font-size: 26px;
|