<template>
	<view class="container">

		<view class="order-status">
			{{info.order_status==0?'待支付': info.order_status==1?'待配送' :info.order_status==2?'配送中':
		  info.order_status==3?'已完成':info.order_status==4?'已取消':info.order_status==5?'已退款':
		 info.order_status==6?'部分退款':info.order_status==7?'待自提':''}}
			<!-- {{info.is_pay == 1?info.cancel_status==2?'已退款':'已支付':'待支付'}} -->
		</view>
		<view class="page-block" v-if="info.state == 2 && info.is_pay == 1 &&info.cancel_status!=2">
			<view class="page-title-block">
				<view class="title">配送信息</view>
			</view>
			<view class="content">
				<view class="cell flex" v-if="info.is_send==0&&info.is_pay == 1">
					<view class="title-block required">
						<text>配送状态：</text>
					</view>
					<view class="desc flex-y-center box-pack-between">
						<text></text>
						<view class="info text-r flex-y-center" @click="bindSend('center')">
							{{info.is_send==1?'已配送':'点击开始配送'}}
							<view :class="info.is_send==0?'arr-r':''"></view>
						</view>
					</view>
				</view>

				<block v-if="info.is_send==1 && info.is_dd==2">
					<view class="cell flex flex-y-center" @click="bindOpen('bottom')">
						<view class="title-block required">
							<text>配送状态：</text>
						</view>
						<view class="desc arr-r flex-y-center">
							<view class="info" style="color: red;">{{juheInfo.statusMsg}}</view>
						</view>
					</view>
				</block>

				<block v-if="info.is_send==1 && info.is_dd==1">
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>配送状态：</text>
						</view>
						<view class="desc">
							<view class="info" style="color: red;">{{obj.statusMsg}}</view>
						</view>
					</view>
					<view class="cell flex flex-y-center" v-if="obj.transporterName">
						<view class="title-block required">
							<text>骑手名字：</text>
						</view>
						<view class="desc">
							<view class="info ">{{obj.transporterName}}</view>
						</view>
					</view>

					<view class="cell flex flex-y-center" v-if="obj.transporterPhone">
						<view class="title-block required">
							<text>联系方式：</text>
						</view>
						<view class="desc flex-y-center" @click="makePhoneCall(obj.transporterPhone)">
							<view class="info flex-y-center">
								<image src="../static/images/tel.png"></image> <text>{{obj.transporterPhone}}</text>
							</view>
						</view>
					</view>

					<view class="cell flex flex-y-center" v-if="obj.transporterPhone">
						<view class="title-block required">
							<text>接单时间：</text>
						</view>
						<view class="desc">
							<view class="info">{{obj.acceptTime}}</view>
						</view>
					</view>
				</block>

			</view>
		</view>

		<view class="page-block">

			<view class="page-title-block">
				<view class="title">订单信息</view>
			</view>

			<view class="content">
				<view class="cell flex flex-y-center" v-if="info.state == 1">
					<view class="title-block required">
						<text>取单号：</text>
					</view>
					<view class="desc">
						<view class="flex flex-y-center">
							<view class="info">{{info.number||info.id}}</view>
							<view class="qc-btn" @click="onQucan" v-if="info.no_meal == 1">
								{{info.no_meal == 1?'请取餐':'再次通知取餐'}}
							</view>
						</view>
					</view>
				</view>
				<view class="cell flex flex-y-center">
					<view class="title-block required">
						<text>总金额：</text>
					</view>
					<view class="desc">
						<view class="info" style="color:#FEAF44">￥{{info.total_price}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center" v-if="Number(info.member_discount)>0">
					<view class="title-block required">
						<text>会员折扣：</text>
					</view>
					<view class="desc">
						<view class="info" style="color:#FEAF44">{{info.discount}}折 | -￥{{info.member_discount}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center" v-if="info.coupon_content">
					<view class="title-block required">
						<text>优惠劵：</text>
					</view>
					<view class="desc">
                        <view class="coupon-name">支付宝官方券</view>
						<view class="info" style="color:#FEAF44">扫码点餐立减券 -￥{{info.coupon_price}}</view>
					</view>
				</view>
                <view class="cell flex flex-y-center" v-if="info.coupon_id">
                	<view class="title-block required">
                		<text>优惠劵：</text>
                	</view>
                	<view class="desc">
                        <view class="coupon-name">平台券</view>
                		<view class="info" style="color:#FEAF44">-￥{{info.coupon_price}}</view>
                	</view>
                </view>

				<view class="cell flex flex-y-center">
					<view class="title-block required">
						<text>支付金额：</text>
					</view>
					<view class="desc">
						<view class="info" style="color:#FEAF44">￥{{info.pay_price}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center" v-if="Number(info.delivery_price)>0">
					<view class="title-block required">
						<text>平台配送费：</text>
					</view>
					<view class="desc">
						<view class="info" style="color:#FEAF44">￥{{info.delivery_price}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center" v-if="Number(info.refund_price)>0">
					<view class="title-block required">
						<text>退款金额：</text>
					</view>
					<view class="desc">
						<view class="info" style="color:#FEAF44">￥{{info.refund_price}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center" v-if="info.remark">
					<view class="title-block required">
						<text>订单备注：</text>
					</view>
					<view class="desc">
						<view class="info">{{info.remark}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center" v-if="info.content&&info.is_pay == 2">
					<view class="title-block required">
						<text>金额备注：</text>
					</view>
					<view class="desc">
						<view class="info">{{info.content}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center" v-if="info.is_pay">
					<view class="title-block required">
						<text>支付方式：</text>
					</view>
					<view class="desc flex flex-y-center">
						<image
							:src="info.pay_type == 1?'../../static/images/wx.png':info.pay_type == 2?'../../static/images/ali.png':'../static/images/yu.png'"
							mode="aspectFit" class="pay-type-icon"></image>
						<view class="info">{{info.pay_type == 1?'微信支付': info.pay_type == 2?'支付宝支付':'余额支付'}}</view>
					</view>
				</view>
				<view class="cell flex flex-y-center">
					<view class="title-block required">
						<text>订单编号：</text>
					</view>
					<view class="desc">
						<view class="info">{{info.order_no}} <text @click="copy(info.order_no)"
								style="color:#00BFFF;margin-left: 20rpx;"> 复制</text></view>
					</view>
				</view>
				<view class="cell flex flex-y-center" v-if="info.check">
					<view class="title-block required">
						<text>交易单号：</text>
					</view>
					<view class="desc">
						<view class="info">{{info.check}}</view>
						<text @click="copy(info.check)" style="color:#00BFFF;margin-left: 20rpx;"> 复制</text>
					</view>
				</view>
				<view class="cell flex flex-y-center" v-if="info.is_pay">
					<view class="title-block required">
						<text>支付时间：</text>
					</view>
					<view class="desc">
						<view class="info">{{info.pay_time}}</view>
					</view>
				</view>
				<view class="cell flex flex-y-center">
					<view class="title-block required">
						<text>购买门店：</text>
					</view>
					<view class="desc">
						<view class="info">{{info.store_name}}</view>
					</view>
				</view>

				<view class="cell flex flex-y-center">
					<view class="title-block required">
						<text>下单方式：</text>
					</view>
					<view class="desc">
						<view class="info" v-if="info.state==1">堂食</view>
						<view class="info" v-else-if="info.state == 2">外卖</view>
						<view class="info" v-else-if="info.state == 3">自提</view>
						<view class="info" v-else>快速收款</view>
					</view>

					<view class="zt-btn" v-if="info.order_status == 7 && info.state ==3 " @click="confirmZiti">
						确认自提
					</view>

				</view>

				<view class="cell flex flex-y-center" v-if="info.table_name">
					<view class="title-block required">
						<text>位置号：</text>
					</view>
					<view class="desc">
						<view class="info">{{info.table_name}}</view>
					</view>
				</view>

				<block v-if="info.state == 3">
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>自提人：</text>
						</view>
						<view class="desc">
							<view class="info">{{info.name}}</view>
						</view>
					</view>
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>联系电话：</text>
						</view>
						<view class="desc">
							<view class="info">{{info.mobile}}</view>
						</view>
					</view>
				</block>
				<block v-if="info.state == 2">
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>收货人：</text>
						</view>
						<view class="desc">
							<view class="info">{{info.name||''}}</view>
						</view>
					</view>
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>收货地址：</text>
						</view>
						<view class="desc">
							<view class="info">{{info.address||''}}</view>
						</view>
					</view>
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>联系电话：</text>
						</view>
						<view class="desc">
							<view class="info">{{info.mobile||''}}</view>
						</view>
					</view>
				</block>
			</view>
			<view class="content" v-if="is_stup_price&&info.is_pay == 0">
				<view class="cell flex flex-y-center">
					<view class="title-block required">
						<text>修改后的金额：</text>
					</view>
					<view class="desc" style="border: 1rpx solid #f1f1f1; padding: 20rpx 10rpx;">
						<input class="info" @input="getPrice" type="digit" placeholder="请输入修改金额"></input>
					</view>
				</view>
				<view class="cell flex flex-y-center">
					<view class="title-block required">
						<text>备注：</text>
					</view>
					<view class="desc" style="border: 1rpx solid #f1f1f1; padding: 20rpx 10rpx;">
						<input class="info" @input="getContent" placeholder="请输入备注"></input>
					</view>
				</view>
			</view>
		</view>

		<view class="page-block" v-if="info.type!= 3">
			<view class="page-title-block">
				<view class="title">商品信息</view>
			</view>
			<view class="content">
				<view class="goods flex box-pack-between" v-for="(item,index) in goods_list" :key="index">
					<view class="flex">
						<image class="goods_list-img" :src="URL+item.spec_image"></image>

						<view class="name">
							<text> {{item.name}}</text>
							<view class="">
								×{{item.num}}
							</view>

						</view>
					</view>
					<view class="">
						<view class="price">
							￥{{item.unit_price}}
						</view>
						<view class="ft26 text-r">
							{{item.is_refund==1?'已退款':''}}
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="btm-btn-block-content">
			<view class="box-pack-between btm-btn-block">
				<view class="btn btn12" v-if="info.is_pay == 1 &&info.cancel_status==3">
					已驳回退款
				</view>
				<view class="btn btn12" :style="info.cancel_status==2?'width: 325rpx':''"
					v-if="info.is_pay == 1&&info.cancel_status==2">
					已退款
				</view>
				<view class="btn btn11" @click="bindRefund"
					v-if="info.is_pay == 1 && info.cancel_status!=2&&info.cancel_status!=3">
					退款
				</view>
				<view class="btn btn11" v-if="info.is_pay == 1&&info.cancel_status!=2"
					@click="bindPartRefund('center')">
					部分退款
				</view>
				<view class="btn btn11" :style="info.cancel_status==2?'width: 325rpx':''" @click="bindPrinter"
					v-if="info.is_pay == 1">
					打印小票
				</view>


			</view>

			<view class="box-pack-between btm-btn-block">

				<view class="btn btn11" :style="info.cancel_status==2?'width: 325rpx':''" @click="bindCancal"
					v-if="info.order_status==2">
					取消配送
				</view>

				<view class="btn btn11" :style="info.cancel_status==2?'width: 325rpx':''" @click="bindShop"
					v-if="info.order_status==2">
					改换商家配送
				</view>

			</view>



			<view class="btm-btn-block flex-center">
				<view class="btn btn11" style="width: 325rpx;" v-if="info.is_pay == 0" @click="bindStupPrice">
					{{is_stup_price?'确定修改金额':'修改订单金额'}}
				</view>
				<view class="btn btn11" style="width: 325rpx;margin-left:20rpx;"
					v-if="info.is_pay == 0 && info.state == 4" @click="getPayStatus">
					查询支付结果
				</view>
			</view>
		</view>

		<!-- 纵向排列 -->
		<uni-popup ref="popup" :type="type">

			<view class="model-content" v-if="type=='bottom'">
				<view class="flex-y-center model-content-title box-pack-between">
					<text style="width: 50rpx;"></text>
					订单跟踪
					<text @click="onClose" class="iconfont iconquchu"></text>
				</view>
				<scroll-view scroll-y="true" style="height: 700rpx;">
					<uni-steps :options="options" :active-color="setColor" direction="column"
						:active="Number(options.length)"></uni-steps>
				</scroll-view>
			</view>

			<view class="model-content-center" v-if="type=='center'">
				<block v-if="isRefund">
					<form @submit="onSubmit">
						<view class="model-refund-title">
							部分退款
						</view>
						<view class="content">
							<view style="padding-left: 20rpx;">
								<view class="flex-y-center amount-text">
									总金额：￥{{info.total_price}}
								</view>

								<view class="flex-y-center amount-text">
									支付金额：￥{{info.pay_price}}
								</view>
							</view>
							<scroll-view scroll-y="true" style="height: 500rpx;">
								<view class="goods flex-y-center " v-for="(item,index) of refundGoods" :key="index">
									<view class="round" :data-i="item.checked" @click="bindRefundGoods(index)"
										v-if="is_refund">
										<view v-if="item.checked">
											<icon type="success_no_circle" size="16" />
										</view>
									</view>
									<view class="box-pack-between flex-grow-1">
										<view class="flex">
											<image class="goods_list-img" :src="URL+item.spec_image"></image>
											<view class="name">
												<text> {{item.name}}</text>
												<view>
													×{{item.num}}
												</view>
											</view>
										</view>
										<view class="price">￥{{item.unit_price}}</view>
									</view>
								</view>
							</scroll-view>

							<view style="padding-left: 20rpx;">
								<view class="flex-y-center amount-text">
									已退金额：￥{{info.refund_price}}
								</view>
								<view class="flex-y-center amount-refund amount-text">
									退款金额： ￥
									<view class="amount-input">
										<input type="digit" name="refund_price" v-model="amountMoney"
											placeholder="请输入退款金额" />
									</view>
								</view>
							</view>
						</view>
						<view class="flex-y-center model-refund-btn">
							<view class="flex-grow-1 flex-center cancel" @click="cancel">
								取消
							</view>
							<button hover-class="none" form-type="submit" class="flex-grow-1 flex-center submit">
								确认退款
							</button>
						</view>
					</form>
				</block>

				<block v-if="isPeiSong">

					<view class="model-refund-title">
						配送模式
					</view>

					<view class="flex" style="height: 250rpx;">

						<view class="flex-grow-1">
							<view class="model-content-peiSong" :class="peiType==item.type?'act':''"
								@click="bindPei(item.type)" v-for="(item,index) of peiArr" :key='index'>
								{{item.title}}
							</view>
						</view>

						<view v-if="peiType==3" class="flex-grow-1" style="border-left: 1px solid #F1F1F1;">
							<scroll-view scroll-y="true" style="height: 250rpx;">
								<view class="flex-center pd10 ft28" :class="logisticType==item.logistic?'act':''"
									v-for="(item,index) of peiDl" :key='index' @click="bindPeiTwp(item.logistic)">
									{{item.name}}
								</view>
							</scroll-view>
						</view>
					</view>

					<view class="flex-y-center model-refund-btn">
						<view class="flex-grow-1 flex-center cancel" @click="cancel">
							取消
						</view>
						<button hover-class="none" @click="bindPeiCofig" class="flex-grow-1 flex-center submit">
							立即配送
						</button>
					</view>
				</block>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				URL: getApp().globalData.URL,
				id: "",
				info: {},
				goods_list: [],
				obj: {},
				is_stup_price: false,
				juheInfo: {},
				options: [],
				setColor: '#007AFF',
				type: 'center',
				refundGoods: [],
				is_refund: true,
				amountMoney: 0,
				ids: [],
				isRefund: false,
				isPeiSong: false,

				peiArr: [{
					title: "省钱",
					type: 1,
				}, {
					title: "最快",
					type: 2,
				}, {
					title: "指派",
					type: 3,
				}, {
					title: "价格从低到高依次呼叫",
					type: 4,
				}, ],

				peiDl: [{
						name: "美团",
						logistic: "mtps",
					},
					{
						name: "蜂鸟",
						logistic: "fengniao",
					},
					{
						name: "达达",
						logistic: "dada",
					},
					{
						name: "顺丰",
						logistic: "shunfeng",
					},
					{
						name: "闪送",
						logistic: "bingex",
					},
					{
						name: "UU跑腿",
						logistic: "uupt",
					}, {
						name: "点我达",
						logistic: "dianwoda",
					},
					{
						name: "爱跑腿",
						logistic: "aipaotui",
					},
					{
						name: "曹操",
						logistic: "caocao",
					},
					{
						name: "帮啦",
						logistic: "bangla",
					},
				],

				peiType: null,
				logisticType: null,
				ps_mode: null
			}
		},

		onLoad(options) {
			this.id = options.id;
			this.getData()
			this.peisongset_list();
		},

		methods: {
			//刷新支付结果（扫码收款订单）
			getPayStatus() {
				this.request({
					url: 'smdcshop/searchWxOrder',
					data: {
						order_id: this.info.id
					}
				}).then(res => {
					if (res.code == "200") {
						uni.showModal({
							content: res.message,
							showCancel: false,
							success: r => {
								this.getData();
							}
						})

					}
				})
			},
			confirmZiti() {
				uni.showModal({
					title: '提示',
					content: '确定是否自提？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确认',
					success: res => {
						if (res.confirm) {
							this.request({
								url: 'Smdcshop/complete_ziti',
								data: {
									order_id: this.info.id
								}
							}).then(res => {
								if (res.code == "200") {
									uni.showToast({
										title: res.message,
										icon: 'none'
									})
									setTimeout(() => {
										this.getData();
									}, 2000)
								}
							})
						}
					}
				})
			},
			peisongset_list() {
				this.request({
					url: 'Smdcshop/peisongset_list',
					data: {
						store_id: uni.getStorageSync("store_id")
					}
				}).then(res => {
					if (res.code == "200") {
						this.ps_mode = res.data.ps_mode;
					}
				})
			},
			cancel() {
				this.$refs.popup.close();
			},

			bindPartRefund(type) {
				this.type = type;
				this.isRefund = true;
				this.isPeiSong = false;
				this.$refs.popup.open();
			},

			bindOpen(type) {
				this.type = type;
				this.$refs.popup.open();
			},

			onClose() {
				this.$refs.popup.close();
			},

			bindPei(e) {
				this.peiType = e;
			},

			bindPeiTwp(e) {
				this.logisticType = e;
			},

			onSubmit(e) {
				let ids = '';
				if (this.ids.length > 0) {
					ids = this.ids.join(",");
				}
				this.request({
					url: 'Smdcshop/partRefund',
					data: {
						id: this.info.id,
						ids: ids,
						refund_price: e.detail.value.refund_price,
						admin_id: uni.getStorageSync("admin_id"),
					}
				}).then(res => {

					uni.showToast({
						title: res.message,
						icon: 'none'
					})

					setTimeout(() => {
						this.getData();
						this.$refs.popup.close();
					}, 1000)

				})
			},

			bindRefundGoods(index) {
				let num = 0,
					arr = [];
				this.is_refund = false;
				this.refundGoods[index].checked = !this.refundGoods[index].checked;
				for (let i of this.refundGoods) {
					if (i.checked) {
						num += Number(i.unit_price);
						arr.push(i.id)
					}
				}
				this.amountMoney = num;
				this.ids = arr;
				this.is_refund = true;
			},

			getData() {
				this.request({
					url: 'Smdcshop/orderinfo',
					data: {
						id: this.id
					}
				}).then(res => {
                    let info = res.data.info
                    if(info.coupon_content){
                        info.coupon_content = JSON.parse(info.coupon_content)
                    }
					this.info = info;

					if (res.data.goods_list) {
						this.goods_list = res.data.goods_list;
						for (let i of res.data.goods_list) {
							i.checked = false
						}
						this.refundGoods = res.data.goods_list;
					}

					if (res.data.info.is_dd == 1 && res.data.info.is_send == 1) {
						this.GetDadaInfo(res.data.info.id);
					}
					if (res.data.info.is_dd == 2 && res.data.info.is_send == 1) {

						this.juheInfo = res.data.juhe_list[0];

						// console.log(res.data.juhe_list,"res.data.juhe_list")
						let options = [];
						for (let i of res.data.juhe_list) {
							options.push({
								title: i.statusMsg,
								logistic: i.logistic,
								desc: i.ctime,
								content: i.content,
							})
						}
						this.options = options
					}
				})
			},

			// - 如果 is_send=1并且is_dd=1 就是达达配送  请求达达接口
			// 如果 is_send=1并且is_dd=2 就是商家配送 不需要请求达达接口
			// 如果 is_send=0 就是还没配送

			GetDadaInfo(id) {
				this.request({
					url: 'Smdcshop/GetDadaInfo',
					data: {
						id: id
					}
				}).then(res => {
					this.obj = res.data;
				})
			},

			bindRefund(e) {
				uni.showModal({
					title: '提示',
					content: '是否同意退款？',
					showCancel: true,
					cancelText: '拒绝',
					confirmText: '同意',
					success: res => {
						let is_cancel = res.confirm ? 1 : 2;
						this.request({
							url: 'Smdcshop/cancel',
							data: {
								admin_id: uni.getStorageSync("admin_id"),
								id: this.info.id,
								is_cancel: is_cancel
							}
						}).then(res => {

							uni.showToast({
								title: res.message,
								icon: 'none'
							})
							setTimeout(() => {
								this.getData();
							}, 1000)
						})
					},
					fail: () => {},
					complete: () => {}
				});
			},


			bindPrinter(e) {
				this.request({
					url: 'Smdcshop/dyorder',
					data: {
						id: this.info.id
					}
				}).then(res => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				})
			},

			bindCancal(e) {
				uni.showModal({
					title: '提示',
					content: '是否取消配送？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if(res.confirm){
							this.request({
								url: 'Smdcshop/cancel_peisong',
								data: {
									id: this.info.id
								}
							}).then(res => {
								uni.showToast({
									title: res.message,
									icon: 'none'
								})
								setTimeout(() => {
									this.getData();
								}, 2000)
							})
						}
				
					}
				})
			},

			bindShop(e) {
				uni.showModal({
					title: '提示',
					content: '是否更换为商家配送？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if(res.confirm){
							this.request({
								url: 'Smdcshop/shangjiapeisong',
								data: {
									id: this.info.id
								}
							}).then(res => {
								uni.showToast({
									title: res.message,
									icon: 'none'
								})
								setTimeout(() => {
									this.getData();
								}, 2000)
							})
						}
					}
				})
			},

			bindPeiCofig() {
				this.request({
					url: 'Smdcshop/peisong',
					data: {
						id: this.info.id,
						admin_id: uni.getStorageSync("admin_id"),
						dispatch_mode: this.peiType,
						logistic: this.peiType == 3 ? this.logisticType : '',
					},
				}).then(res => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
					setTimeout(() => {
						this.getData();
						this.$refs.popup.close();
					}, 2000)
				})
			},

			bindSend(type) {

				if (this.ps_mode == 3) {
					this.type = type;
					this.isRefund = false;
					this.isPeiSong = true;
					this.$refs.popup.open();
					return
				}

				uni.showModal({
					title: '提示',
					content: '确定进行配送吗？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '配送',
					success: res => {
						if (res.confirm) {
							this.request({
								url: 'Smdcshop/peisong',
								data: {
									id: this.info.id,
									admin_id: uni.getStorageSync("admin_id"),
								},
							}).then(res => {
								uni.showToast({
									title: res.message,
									icon: 'none'
								})
								setTimeout(() => {
									this.getData();
								}, 2000)
							})
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			bindStupPrice(e) {
				if (this.is_stup_price) {
					if (!this.pay_price) {
						uni.showToast({
							title: "请输入修改价格",
							icon: 'none'
						})
						return
					}
					this.request({
						url: 'Smdcshop/editprice',
						data: {
							id: this.info.id,
							pay_price: this.pay_price,
							content: this.content,
						}
					}).then(res => {
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
						this.is_stup_price = false;
						setTimeout(() => {
							this.getData();
						}, 2000)
					})
				}
				this.is_stup_price = true;
			},

			getPrice(e) {
				this.pay_price = e.detail.value;
			},

			getContent(e) {
				this.content = e.detail.value;
			},

			makePhoneCall(tel) {
				uni.makePhoneCall({
					phoneNumber: tel //仅为示例
				});
			},

			copy(text) {
				// #ifdef MP-WEIXIN 
				uni.setClipboardData({
					data: text,
					success: function() {
						console.log('success');
					}
				});
				// #endif
				// #ifdef H5
				let content = text;
				if (!document.queryCommandSupported('copy')) {
					// 不支持
					return false
				}
				let textarea = document.createElement("input")
				textarea.value = content
				textarea.readOnly = "readOnly"
				document.body.appendChild(textarea)
				textarea.select() // 选择对象
				textarea.setSelectionRange(0, content.length) //核心
				let result = document.execCommand("copy") // 执行浏览器复制命令
				textarea.remove();
				uni.showToast({
					title: "复制成功",
					icon: 'none'
				})
				return result
				// #endif
			},
			//提醒取餐
			onQucan() {

				this.request({
					url: 'merchant/take_meal',
					is_agent: 'agent',
					data: {
						order_id: this.info.id
					}
				}).then(res => {
					if (res.code == 200) {
						uni.showModal({
							content: "已提醒取餐",
							showCancel: false,
							success: r => {
								this.info.no_meal = 2

							}
						})
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #F4F5F7;
	}

	page .act {
		color: #007AFF;
	}

	.model-content-center {
		width: 650rpx;
		background-color: #FFFFFF;
		border-radius: 16rpx;
	}

	.model-content-center .content {
		padding: 20rpx;
	}

	.model-content-center .round {
		border: 1rpx solid #CCCCCC;
		width: 40rpx;
		height: 40rpx;
		margin-right: 10rpx;
		border-radius: 4rpx;
	}

	.amount-text {
		font-size: 26rpx;
		padding-bottom: 20rpx;
	}

	.amount-input {
		padding: 10rpx;
		border: 1rpx solid #F1F1F1;
	}

	.model-refund-title {
		font-size: 36rpx;
		text-align: center;
		padding: 20rpx 0;
	}

	.model-refund-btn {
		border-top-color: #f5f5f5;
		border-top-style: solid;
		border-top-width: 1px;

	}

	.model-refund-btn .cancel {
		height: 90rpx;
	}

	.model-refund-btn .submit {
		height: 90rpx;
		border-left-color: #f0f0f0;
		border-left-style: solid;
		border-left-width: 1px;
	}

	button {
		background-color: #fff;
		padding: 0;
		margin: 0;
		line-height: 1rpx;
		/* border: 1px solid #cccccc; */
		min-height: 0;
		font-size: 28rpx;
		background: #fff;
		border-radius: none;
	}

	button::after {
		border: none;
	}

	.model-content-peiSong {
		text-align: center;
		padding: 10rpx 0;
		border-bottom: 1rpx solid #F1F1F1;
		font-size: 28rpx;
	}

	.pd10 {
		padding: 10rpx 0;
	}

	.model {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		background: rgba(0, 0, 0, .5);
	}

	.model-content {
		background: #FFFFFF;
		height: 800rpx;
	}

	.model-content-title {
		padding: 20rpx;
	}

	.text-r {
		text-align: right;
		color: red;
	}

	.info image {
		width: 40rpx;
		height: 50rpx;
	}

	.goods_list-img {
		width: 100rpx;
		height: 100rpx;
		margin-right: 20rpx;
		min-width: 100rpx;
	}

	.order-status {
		width: 100%;
		height: 130rpx;
		background: url(../static/images/order_detail_bg.png) no-repeat center;
		background-size: 100%;
		text-align: center;
		line-height: 130rpx;
		font-size: 36rpx;
		color: #fff;
		font-weight: bold;

	}

	.page-block {}

	.page-block .page-title-block {
		height: 90rpx;
		padding: 0 35rpx;
	}

	.page-block .page-title-block .title {
		font-size: 32rpx;
		line-height: 90rpx;
		color: #999;
		font-weight: bold;
	}

	.page-block .content {
		padding: 30rpx 35rpx 0;
		background-color: #fff;
		overflow: hidden;
	}

	.page-block .cell {
		min-height: 45rpx;
		margin-bottom: 30rpx;
	}


	.page-block .cell .title-block {
		width: 175rpx;
		flex: none;
		font-size: 30rpx;
		line-height: 45rpx;
		font-weight: 600;
		color: #333;
	}

	.page-block .cell .desc {
		flex: auto;
		min-height: 45rpx;
		line-height: 45rpx;
		font-size: 32rpx;
		color: #333;
	}

	.pay-type-icon {
		display: block;
		width: 30rpx;
		height: 30rpx;
		margin-right: 8rpx;
	}

	.goods {
		font-size: 32rpx;
		color: #333;
		line-height: 45rpx;
		margin-bottom: 30rpx;
	}

	.price {
		color: red;
	}

	.btm-btn-block-content {
		margin-top: 50rpx;
	}

	.btm-btn-block {
		padding: 0 20rpx;
		margin-bottom: 20rpx;
	}

	.btm-btn-block .btn {
		flex: none;
		/* width: 325rpx; */
		width: 217rpx;
		height: 98rpx;
		border-radius: 8rpx;
		text-align: center;
		line-height: 98rpx;
		font-size: 32rpx;
		font-weight: 500;

	}

	.btm-btn-block .btn11 {
		background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
		box-shadow: 0 0 8rpx 0 rgba(51, 135, 255, 0.2);
		color: #fff;
	}

	.btm-btn-block .btn12 {
		background: linear-gradient(315deg, #999 2%, #999 99%);
		box-shadow: 0 0 8rpx 0 rgba(51, 135, 255, 0.2);
		color: #fff;
	}

	.zt-btn {
		background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
		box-shadow: 0 0 8rpx 0 rgba(51, 135, 255, 0.2);
		color: #fff;
		font-size: 24rpx;
		padding: 10rpx 12rpx;
		border-radius: 6rpx;
	}

	/*  */
	.qc-btn {
		background-color: #3387FF;
		color: #fff;
		border-radius: 6rpx;
		height: 48rpx;
		line-height: 48rpx;
		padding: 0 20rpx;
		margin-left: 10rpx;

	}
    .coupon-name{
        display: inline-block;
        background-color: #3387FF;
        color: #fff;
        border-radius: 6rpx;
        height: 48rpx;
        line-height: 48rpx;
        padding: 0 20rpx;
        font-size: 24rpx;
    }
</style>
