

export default {
	data() {
		return {
		}
	},
	computed: {
	},
	methods: {
		// 立即支付
		toPayOrder(item){
			let api = ''
			
			// if([0, 1].includes(item.shopState)){
				// api = 'createOrderTwo'
			// }else{
				api = 'payOrder'
			// }
			
			this.$api(api, {
				orderId : item.id,
                type : 1,
			}, res => {
				if(res.code == 200){
					if(res.result.id){
						this.id = res.result.id
					}
					this.getData()
					uni.requestPaymentWxPay({
						result : res.result.pay || res.result
					})
					.then(res => {
						uni.showToast({
							title: '支付成功',
							icon: 'none'
						})
						this.getData()
					}).catch(n => {
						this.getData()
					})
				}
			})
		},
		// 确认收货
		confirmOrder(item){
			uni.showModal({
				title: '您收到货了吗？',
				success : e => {
					if(e.confirm){
						this.$api('confirmOrder', {
							orderId : item.id,
						}, res => {
							this.getData()
						})
					}
				}
			})
		},
		// 取消订单
		cancelOrder(item){
			uni.showModal({
				title: '确认取消订单吗？',
				success : e => {
					if(e.confirm){
						this.$api('cancelOrder', {
							orderId : item.id,
						}, res => {
							this.getData()
						})
					}
				}
			})
		},
	}
}