doc_exception.vue 7.34 KB
<template>
	<view>
		<dHeader :title="$lang.lang.docException.doc"></dHeader>
		<view class="start-bar"></view>
		<view class="order-info">
			<view class="order-info-v">
				<view class="order-info-line">
					<view class="order-info-line-v">
						<view class="order_item"><text>{{$lang.lang.docException.orderNo}}:</text><text>{{orderData.orderNo}}</text></view>
						<view class="order_item"><text>{{$lang.lang.docException.transport}}:</text><text>{{getConfigLabel('transport',orderData.transportId)}}{{$lang.lang.docException.form}}{{orderData.logisticsInfoDto?orderData.logisticsInfoDto.startTitleZh:''}}{{$lang.lang.docException.to}}{{orderData.logisticsInfoDto?orderData.logisticsInfoDto.destTitleZh:''}}</text></view>
						<view class="corder-tab2 bgf">
							<view class="corder-goods" v-for="(item,index) in shopData" :key="index">
								<view class="corder-gnums">{{index+1}}</view>
								<view class="corder-goods-v">
									<view class="corder-goods-v-item">
										<view class="weight_style">
											<text>{{$lang.lang.docException.proZh}}</text>
											<text>{{item.prodTitleZh}}</text>
										</view>
										<view class="weight_style">
											<text>{{$lang.lang.docException.En}}</text>
											<text>{{item.prodTitleEn}}</text>
										</view>
										<view class="weight_style">
											<text>{{$lang.lang.docException.brand}}</text>
											<text>{{item.brandType?$lang.lang.docException.yes:$lang.lang.docException.no}}</text>
										</view>
										<view class="weight_style">
											<text>{{$lang.lang.docException.fromNum}}</text>
											<text>{{item.num||0}}</text>
										</view>
										<view class="weight_style">
											<text>{{$lang.lang.docException.levite}}</text>
											<text>{{item.warehouseInInfoVO?item.warehouseInInfoVO.cartonsNum:0}}</text>
										</view>

									</view>
									<view class="corder-goods-v-item">
										<view class="weight_style">
											<text>{{$lang.lang.docException.volume}}</text>
											<text>{{item.volume||0}}CBM</text>
										</view>
										<view class="weight_style">
											<text>{{$lang.lang.docException.weight}}</text>
											<text>{{item.num||0}}</text>
										</view>
										<view class="weight_style">
											<text>{{$lang.lang.docException.number}}</text>
											<text>{{item.quantity||0}}</text>
										</view>
										<view class="weight_style">
											<text>{{$lang.lang.docException.works}}</text>
											<text>{{item.worth||0}}</text>
										</view>
									</view>
								</view>
							</view>
						</view>
						<view class="corder-tab1-item order_item">
							<text>{{$lang.lang.docException.customsType}}:</text>
							<view class="upload" @click="uploadFile">
								<image src="../../static/img/up.png"></image>
								<text>{{$lang.lang.docException.choose}}</text>
							</view>
						</view>
						<view class="corder-tab1-item order_item">
							<view class="fills">
								<view class="fileList" v-for="(item,index) in params.file" :key="index">
									<view>{{getFileName(item)}}</view>
									<view @click="delFile(index)">{{$lang.lang.docException.delete}}</view>
								</view>
							</view>

						</view>
						<view class="corder-tab1-item order_item">
							<text>{{$lang.lang.docException.remark}}:</text>
							<textarea v-model="params.orderExceptionHandlerRemark"></textarea>
						</view>
						<view class="apply-btn" @click="sumbit">
								<view>{{$lang.lang.docException.confirm}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
    import dHeader from '../../components/dHeader/index.vue'
	export default {
		components: {
			dHeader
		},
		data() {
			return {
				orderData:[],
				shopData:[],
				orderExceptionData:[],
				config:{
					transport:{
						label:[],
						value:[]
					}
				},
				params:{
					orderExceptionHandlerRemark:'',
					file:[]
				}
			}
		},
		onLoad(op) {
			this.orderConfig('transport_type', 'transport')
			if(op.id){
				this.getExceptionData(op.id,op.orderId)
			}
		},
		methods: {
			getExceptionData(id,orderId){
				let that = this
				that.$request.get('/app-api/ecw/order-exception/getExceptionById',{id:id}).then(res => {
					if(res.code==0&&res.data){
						that.orderExceptionData = res.data
						if(res.data.orderExceptionAttr){
							that.params.file = res.data.orderExceptionAttr.split(',')
						}
						that.getOrderData(orderId)
					}
				})
			},
			getFileName(file){
				var fileArr = file.split('/')
				return fileArr[fileArr.length-1]
			},
			delFile(index){
				this.params.file.splice(index,1)
			},
			getOrderData(id){
				let that = this
				that.$request.get('/app-api/my/order/info/'+id).then(res => {
					if(res.data){
						that.orderData = res.data
						that.orderData.orderItemVOList.forEach((item)=>{
							if(item.orderItemId == that.orderExceptionData.orderItemId){
								that.shopData = item
							}
						})
					}
				})
			},
			reset(){
				this.params.orderExceptionHandlerRemark=""
				this.params.file=[]
			},
			getConfigLabel(key,value){
				var indexs = ''
				this.config[key].value.forEach(function(item,index){

					if(item == value){
						indexs = index
					}
				})
				console.log(this.config[key].label)
				return this.config[key].label[indexs]
			},
			orderConfig (field, key) {
				let that = this
				that.$request.getConfig(field).then(res => {
					if(res.data.list.length > 0){
						var d = res.data.list
						for(var i in d){
              that.config[key].label.push(d[i][this.$lang.label])
							that.config[key].value.push(d[i].value)
						}
					}
				})
			},
			changeResult(e){
				this.params.orderExceptionHandlerResult = e.detail.value
			},
			sumbit(){
				let that = this
				var paramsData = {
					orderExceptionId:that.orderExceptionData.id,
					orderExceptionStatus:that.orderExceptionData.orderExceptionStatus,
					files:that.params.file.join(','),
					source:'mobile',
					orderExceptionHandlerRemark:that.params.orderExceptionHandlerRemark
				}
				that.$request.post('/app-api/ecw/order-exception/handlerExceptionByExceptionId',paramsData).then(res => {
					if(res.code==0){
						uni.showToast({
							title:this.$lang.lang.notices.operation,
							icon:'none'
						})
						setTimeout(()=>{
							uni.reLaunch({
								url:'../exception/exception?id='+that.orderData.orderId
							})
						},2000)
					}else{
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				})
			},
			uploadFile(){
				uni.chooseFile({
					count: 1,
					success:(res)=> {
						uni.showLoading({
							title: this.$lang.lang.notices.loading,
						})
						const file = res.tempFilePaths[0]
						uni.uploadFile({
							url: this.$request.baseUrl + '/app-api/file/org-name/up',
							filePath: file,
							name: 'file',
							header: this.$request.getImgHeader(),
							success: (uploadFileRes) => {
								uni.hideLoading()
								let res = JSON.parse(uploadFileRes.data)
								console.log('res', res)
								if(res.code == 0){
									this.params.file.push(res.data)
								} else {
									uni.showToast({
										title: res.msg,
										icon: 'none',
									})
								}
							}
						})
					},
					fail: (Error) => {
						console.log(Error)
					}
				})
			}
		}
	}
</script>

<style>
	@import url("../../static/css/doc_exception.css");
</style>