<template>
	<view>
		<view v-if="!singleServ">
			<view class="solid-bottom"><product-picked :product="product" :pickedList="pickedList" :columnTitleArr="columnTitleArr"></product-picked></view>
			<view class="padding-tb-sm solid-bottom flex justify-between align-center">
				<text class="margin-right-sm" style="width: 150rpx;">派单价格</text>
				<input class="line-input radius-input" v-model="dispatchTotalPrice" placeholder="请输入派出总额"></input>
			</view>
		</view>
		<!-- 可指派成员 -->
		<view class="bg-white padding" v-for="(member, index) in members">
			<view class="flex justify-between align-center">
				<view class="flex justify-start align-center">
					<view class="cu-avatar round"
						:style="'background-image:url(' + member.avatarUrl + ');min-width: 80rpx;min-height: 80rpx'"></view>
					<view class="text-lg margin-left-sm">{{member.name}}</view>
				</view>
				<view>
					<button class="cu-btn bg-main-color shadow-blur">指派</button>
					<text v-if="singleServ" class="padding-left text-lg text-gray text-bold" data-modal="showDispatchPriceModal" @click="showModal"><text class="cuIcon-right"></text></text>
				</view>
			</view>
		</view>
		<!-- 派单金额模态框 -->
		<view class="cu-modal" :class="showDispatchPriceModal?'show':''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end solid-bottom">
					<view class="content">按金额派出</view>
					<view class="action" data-modal="showDispatchPriceModal" @tap="hideModal">
						<text class="cuIcon-close text-red"></text>
					</view>
				</view>
				<view class="padding-xl bg-white">
					<view>请输入派单金额：</view>
					<view class="flex justify-center align-center margin-top-sm">
						<input class="radius-input" type="digit"></input>
						<text>元</text>
					</view>
				</view>
				<view class="cu-bar bg-white solid-top">
					<view class="action margin-0 flex-sub text-black" data-modal="showDispatchPriceModal" @tap="hideModal">取消</view>
					<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="showDispatchPriceModal" @tap="hideModal"
						@click="">确认派单</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import productPicked from '@/components/goods-card/product-picked.vue';
	
	export default {
		name: 'dispatch-order',
		components: {
			productPicked
		},
		props: {
			singleServ: {
				type: Boolean,
				default: true
			},
			product: {
				type: Object,
				default: {}
			},
			pickedList: {
				type: Array,
				default: []
			},
			columnTitleArr: {
				type: Array,
				default: {}
			},
			members: {
				type: Array,
				default: {}
			},
			orderNow: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				dispatchTotalPrice: null,
				showDispatchPriceModal: false
			}
		},
		methods: {
			showModal(e) {
				this[e.currentTarget.dataset.modal] = true;
			},
			hideModal(e) {
				this[e.currentTarget.dataset.modal] = false;
			}
		},
	}
</script>

<style scoped>
</style>
