<template>
	<view class="">
		<uni-swipe-action ref="swipeAction">
			<uni-swipe-action-item :right-options="isEdit==true?options1:options2" @click="swipeClick($event)">
				
				<view class="">
					实际
				</view>
				<view class="uni-flex uni-row">
					<view class="">
						库位 {{dataContent.handledLocationCode}}
					</view>
					<view class="">
						数量{{dataContent.handledQty}}
					</view>
					<view class="">
						单位{{dataContent.handledUom}}
					</view>
				</view>
				
			</uni-swipe-action-item>
		</uni-swipe-action>
			<receipt-edit ref="receiptEdit" :dataContent="dataContent" @change="change"></receipt-edit>

	</view>
</template>

<script>
	import receiptEdit from '../modelCom/receiptEdit.vue'
	export default {
		components: {
			receiptEdit
		},
		props: {
			dataContent: {
				type: Object,
				default: {}
			},
			isEdit:{
				type:Boolean,
				default:false
			}
		},
		data() {
			return {
				options1: [{
						text: '编辑',
						style: {
							backgroundColor: 'rgb(254,156,1)'
						}
					},
					{
						text: '删除',
						style: {
							backgroundColor: 'rgb(255,58,49)'
						}
					}
				],
				options2: [
					{
						text: '删除',
						style: {
							backgroundColor: 'rgb(255,58,49)'
						}
					}
				]
			}
		},
		methods:{
			swipeClick(e) {
				if(e.content.text=='编辑'){
					this.startEdit();
				}else if(e.content.text=='删除'){
					uni.showToast({
						title: `点击了${e.content.text}按钮`,
						icon: 'none'
					});
				}
			},
			startEdit(){
				this.$refs.receiptEdit.openScanPopup()
			},
			change(data){
			   // this.$emit("change",data)
			}
		}
	}
</script>

<style>
</style>
