<template>
    <view class="container">

        <form @submit="onSubmit">

            <view class="page-block">
                <view class="page-title-block">
                    <view class="title">基本信息</view>
                </view>
                <view class="content">
                    <view class="cell flex flex-y-center arr-r">
                        <view class="title-block required">
                            <text>配送方式</text>
                        </view>
                        <view class="desc">
                            <picker mode="selector" :range="printerAddrList" @change="onPrinterAddrChange">
                                <view :class="[printerAddr?'':'desc-placeholder','input-box']">{{printerAddr || '请选择'}}
                                </view>
                            </picker>
                        </view>
                    </view>
                </view>
            </view>
			
            <!--  -->
            <view class="page-block">
                <view class="content">
                    <block v-if="ps_mode==2">
                        <view class="cell flex flex-y-center">
                            <view class="title-block required">
                                <text>达达接单</text>
                            </view>
                            <view class="desc">
                                <view class="flex-center flex-x-start">
                                    <view class="checklist-box " @click="choiceDada(item.num)"
                                        v-for="(item,index) of dada_arr" :key='index'
                                        :class="is_dada==item.num?'actt':''">
                                        <view class="radio__inner" :class="is_dada==item.num?'act_border':''">
                                            <view :class="is_dada==item.num?'is-default-checked':''"
                                                class="radio__inner-icon radio__inner-icon ">
                                            </view>
                                        </view>
                                        <text class="checklist-text">{{item.name}}</text>
                                    </view>
                                </view>
                            </view>
                        </view>
                        <view class="cell flex flex-y-center">
                            <view class="title-block required">
                                <text>商户ID</text>
                            </view>
                            <view class="desc">
                                <input type="text" :value="info.source_id" name="source_id" class="input-box"
                                    placeholder="商户ID" placeholder-class="desc-placeholder">
                            </view>
                        </view>
                        <view class="cell flex flex-y-center">
                            <view class="title-block required">
                                <text>门店编号</text>
                            </view>
                            <view class="desc">
                                <input type="text" :value="info.shop_no" name="shop_no" class="input-box"
                                    placeholder="门店编号" placeholder-class="desc-placeholder">
                            </view>
                        </view>
                        <view class="red" @click="copyText(1)">
                            *点击复制去http://newopen.imdada.cn申请
                        </view>
                    </block>
                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>起送价</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.delivery_price" name="delivery_price" class="input-box"
                                placeholder="起送价" placeholder-class="desc-placeholder">
                        </view>
                    </view>

                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>默认配送费</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.default_delivery_price" name="default_delivery_price"
                                class="input-box" placeholder="默认配送费" placeholder-class="desc-placeholder">
                        </view>
                    </view>
					
                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>配送距离设置</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.number" name="number" class="input-box" placeholder="配送距离设置"
                                placeholder-class="desc-placeholder">
                        </view>
                    </view>

                    <view class="red">
                        *单位为:公里(千米)，*0不限制距离
                    </view>

                    <view class="cell flex flex-y-center" @click="bindMap">
                        <view class="title-block required">
                            <text>门店坐标</text>
                        </view>
                        <view class="desc">
                            <view class="input-box">{{coordinates}}</view>
                        </view>
                    </view>

                    <view class="red" @click="copyText(2)">
                        *点击复制去http://lbs.qq.com/tool/getpoint/申请
                    </view>

                </view>
            </view>

            <!--  -->
            <view class="page-block">
                <view class="content">
                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>是否开启DIY装修</text>
                        </view>
                        <view class="desc">
                            <view class="flex-center flex-x-start">
                                <view class="checklist-box " @click="choiceDiy(item.num)"
                                    v-for="(item,index) of diy_arr" :key='index' :class="is_diy==item.num?'actt':''">
                                    <view class="radio__inner" :class="is_diy==item.num?'act_border':''">
                                        <view :class="is_diy==item.num?'is-default-checked':''"
                                            class="radio__inner-icon radio__inner-icon ">
                                        </view>
                                    </view>
                                    <text class="checklist-text">{{item.name}}</text>
                                </view>
                            </view>
                        </view>
                    </view>
                    <block v-if="ps_mode != 1">
                        <view class="cell flex flex-y-center">
                            <view class="title-block required">
                                <text>是否自动派单功能</text>
                            </view>
                            <view class="desc">
                                <view class="flex-center flex-x-start">
                                    <view class="checklist-box " @click="choiceSingleStatus(item.num)"
                                        v-for="(item,index) of single_status_arr" :key='index'
                                        :class="single_status==item.num?'actt':''">
                                        <view class="radio__inner" :class="single_status==item.num?'act_border':''">
                                            <view :class="single_status==item.num?'is-default-checked':''"
                                                class="radio__inner-icon radio__inner-icon ">
                                            </view>
                                        </view>
                                        <text class="checklist-text">{{item.name}}</text>
                                    </view>
                                </view>
                            </view>
                        </view>
                        <block v-if="single_status == 1">
                            <block v-if="ps_mode == 3">
                                <view class="cell flex flex-y-center arr-r">
                                    <view class="title-block required">
                                        <text>配送模式</text>
                                    </view>
                                    <view class="desc">
                                        <picker mode="selector" :range="sendModeArr" range-key="name"
                                            @change="onSendModeChange">
                                            <view :class="['input-box']">
                                                {{sendModeArr[sendModeIndex].name}}
                                            </view>
                                        </picker>
                                    </view>
                                </view>
                                <view class="cell flex flex-y-center arr-r" v-if="sendModeIndex == 2">
                                    <view class="title-block required">
                                        <text>配送名称</text>
                                    </view>
                                    <view class="desc">
                                        <picker mode="selector" :range="sendModeNameArr" range-key="name"
                                            @change="onSendModeNameChange">
                                            <view :class="['input-box']">
                                                {{sendModeNameArr[sendModeNameIndex].name}}
                                            </view>
                                        </picker>
                                    </view>
                                </view>
                            </block>
                            <view class="cell flex flex-y-center">
                                <view class="title-block required">
                                    <text>缓冲时间</text>
                                </view>
                                <view class="desc">
                                    <input type="text" :value="info.single_status_time" name="single_status_time"
                                        class="input-box" placeholder="多少分钟" placeholder-class="desc-placeholder">
                                </view>
                            </view>
                        </block>
                    </block>
					
					
					
					<view class="cell flex flex-y-center">
					    <view class="title-block required">
					        <text>支付时提示开通会员</text>
					    </view>
					    <view class="desc">
					        <view class="flex-center flex-x-start">
					            <view class="checklist-box " @click="choiceOpen(item.num)"
					                v-for="(item,index) of open_arr" :key='index'
					                :class="open==item.num?'actt':''">
					                <view class="radio__inner" :class="open==item.num?'act_border':''">
					                    <view :class="open==item.num?'is-default-checked':''"
					                        class="radio__inner-icon radio__inner-icon ">
					                    </view>
					                </view>
					                <text class="checklist-text">{{item.name}}</text>
					            </view>
					        </view>
					    </view>
					</view>
					
					
                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>换桌开启</text>
                        </view>
                        <view class="desc">
                            <view class="flex-center flex-x-start">
                                <view class="checklist-box " @click="choiceTable(item.num)"
                                    v-for="(item,index) of table_arr" :key='index'
                                    :class="is_table==item.num?'actt':''">
                                    <view class="radio__inner" :class="is_table==item.num?'act_border':''">
                                        <view :class="is_table==item.num?'is-default-checked':''"
                                            class="radio__inner-icon radio__inner-icon ">
                                        </view>
                                    </view>
                                    <text class="checklist-text">{{item.name}}</text>
                                </view>
                            </view>
                        </view>
                    </view>

                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>余额支付优先等级</text>
                        </view>
                        <view class="desc">
                            <view class="flex-center flex-x-start">
                                <view class="checklist-box " @click="choiceYuer(item.num)"
                                    v-for="(item,index) of yuer_arr" :key='index' :class="is_yuer==item.num?'actt':''">
                                    <view class="radio__inner" :class="is_yuer==item.num?'act_border':''">
                                        <view :class="is_yuer==item.num?'is-default-checked':''"
                                            class="radio__inner-icon radio__inner-icon ">
                                        </view>
                                    </view>
                                    <text class="checklist-text">{{item.name}}</text>
                                </view>
                            </view>
                        </view>
                    </view>


                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>DIY首页购物车</text>
                        </view>
                        <view class="desc">
                            <view class="flex-center flex-x-start">
                                <view class="checklist-box " @click="choiceCart(item.num)"
                                    v-for="(item,index) of cart_arr" :key='index' :class="is_cart==item.num?'actt':''">
                                    <view class="radio__inner" :class="is_cart==item.num?'act_border':''">
                                        <view :class="is_cart==item.num?'is-default-checked':''"
                                            class="radio__inner-icon radio__inner-icon ">
                                        </view>
                                    </view>
                                    <text class="checklist-text">{{item.name}}</text>
                                </view>
                            </view>
                        </view>
                    </view>
					<view class="red">
                        *开启此功能DIY装修的商品模块只能放1个
                    </view>

                     <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>商品加载模式</text>
                        </view>
                        <view class="desc">
                            <view class="flex-center flex-x-start">
                                <view class="checklist-box " @click="choiceLoad(item.num)"
                                    v-for="(item,index) of load_arr" :key='index' :class="is_rebate==item.num?'actt':''">
                                    <view class="radio__inner" :class="is_rebate==item.num?'act_border':''">
                                        <view :class="is_rebate==item.num?'is-default-checked':''"
                                            class="radio__inner-icon radio__inner-icon ">
                                        </view>
                                    </view>
                                    <text class="checklist-text">{{item.name}}</text>
                                </view>
                            </view>
                        </view>
                    </view>
					
					<view class="red">
                        *商品数量多的话建议选择分类加载
                    </view>

                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>点餐标签</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.desc" name="desc" class="input-box" placeholder="点餐标签"
                                placeholder-class="desc-placeholder">
                        </view>
                    </view>

                    <view class="red">
                        *默认2个关键词（英文逗号隔开）：例如：下单,配送
                    </view>

                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>就餐方式</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.eat_mode" name="eat_mode" class="input-box"
                                placeholder="就餐方式" placeholder-class="desc-placeholder">
                        </view>
                    </view>

                    <view class="red">
                        *默认3个关键词（英文逗号隔开）：例如：购买方式,店内下单,到店自取
                    </view>

                    <view class="cell flex flex-y-center">
                        <view class="title-block ">
                            <text>位置类型</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.table_type" name="table_type" class="input-box"
                                placeholder="标题文字修改" placeholder-class="desc-placeholder">
                        </view>
                    </view>

                    <view class="cell flex flex-y-center">
                        <view class="title-block ">
                            <text>位置管理</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.table_manager" name="table_manager" class="input-box"
                                placeholder="标题文字修改" placeholder-class="desc-placeholder">
                        </view>
                    </view>
					
                     <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>未支付订单取消时间（分钟）</text>
                        </view>
                        <view class="desc">
                            <input type="number" :value="info.cancel_time" name="cancel_time" class="input-box"
                                placeholder="未支付订单取消时间" placeholder-class="desc-placeholder">
                        </view>
                    </view>
					
					
                    <view class="cell flex flex-y-center mrt10">
                        <view class="title-block required">
                            <text>是否开启积分功能</text>
                        </view>
                        <view class="desc">
                            <view class="flex-center flex-x-start">
                                <view class="checklist-box " @click="choicepay(item.num)"
                                    v-for="(item,index) of integral_arr" :key='index'
                                    :class="is_integral==item.num?'actt':''">
                                    <view class="radio__inner" :class="is_integral==item.num?'act_border':''">
                                        <view :class="is_integral==item.num?'is-default-checked':''"
                                            class="radio__inner-icon radio__inner-icon ">
                                        </view>
                                    </view>
                                    <text class="checklist-text">{{item.name}}</text>
                                </view>
                            </view>
                        </view>
                    </view>
					
                    <block v-if="is_integral == 3">
                        <view class="cell flex flex-y-center arr-r">
                            <view class="title-block required">
                                <text>微信</text>
                            </view>
                            <view class="desc">
                                <picker mode="selector" :range="jifen_jump_arr" range-key="name" @change="onWxChange">
                                    <view :class="['input-box']">
                                        {{jifen_jump_arr[wx_index].name}}
                                    </view>
                                </picker>
                            </view>
                        </view>
                        <!-- 微信内部URL -->
                        <view class="cell flex flex-y-center" v-if="wx == 1">
                            <view class="title-block required">
                                <text>微信内部URL</text>
                            </view>
                            <view class="desc">
                                <input type="text" :value="info.wx_url" name="wx_url" class="input-box"
                                    placeholder="请输入" placeholder-class="desc-placeholder">
                            </view>
                        </view>
                        <!-- 微信外部跳转小程序 -->
                        <block v-if="wx == 2">
                            <view class="cell flex flex-y-center">
                                <view class="title-block required">
                                    <text>微信外部appid</text>
                                </view>
                                <view class="desc">
                                    <input type="text" :value="info.wx_app_id" name="wx_app_id" class="input-box"
                                        placeholder="请输入" placeholder-class="desc-placeholder">
                                </view>
                            </view>
                            <view class="cell flex flex-y-center">
                                <view class="title-block required">
                                    <text>微信外部URL</text>
                                </view>
                                <view class="desc">
                                    <input type="text" :value="info.wx_app_url" name="wx_app_url" class="input-box"
                                        placeholder="请输入" placeholder-class="desc-placeholder">
                                </view>
                            </view>
                        </block>


                        <view class="cell flex flex-y-center arr-r">
                            <view class="title-block required">
                                <text>支付宝</text>
                            </view>
                            <view class="desc">
                                <picker mode="selector" :range="jifen_jump_arr" range-key="name" @change="onZfbChange">
                                    <view :class="['input-box']">
                                        {{jifen_jump_arr[zfb_index].name}}
                                    </view>
                                </picker>
                            </view>
                        </view>
                        <!-- 支付宝内部URL -->
                        <view class="cell flex flex-y-center" v-if="zfb == 1">
                            <view class="title-block required">
                                <text>支付宝内部URL</text>
                            </view>
                            <view class="desc">
                                <input type="text" :value="info.zfb_url" name="zfb_url" class="input-box"
                                    placeholder="请输入" placeholder-class="desc-placeholder">
                            </view>
                        </view>
                        <!-- 支付宝外部跳转小程序 -->
                        <block v-if="zfb == 2">
                            <view class="cell flex flex-y-center">
                                <view class="title-block required">
                                    <text>支付宝外部appid</text>
                                </view>
                                <view class="desc">
                                    <input type="text" :value="info.zfb_app_id" name="zfb_app_id" class="input-box"
                                        placeholder="请输入" placeholder-class="desc-placeholder">
                                </view>
                            </view>
                            <view class="cell flex flex-y-center">
                                <view class="title-block required">
                                    <text>支付宝外部URL</text>
                                </view>
                                <view class="desc">
                                    <input type="text" :value="info.zfb_app_url" name="zfb_app_url" class="input-box"
                                        placeholder="请输入" placeholder-class="desc-placeholder">
                                </view>
                            </view>
                        </block>

                    </block>
                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>积分兑换模式</text>
                        </view>
                        <view class="desc">
                            <view class="flex-center flex-x-start">
                                <view class="checklist-box " @click="choicepayType(item.num)"
                                    v-for="(item,index) of integral_arr_type" :key='index'
                                    :class="is_integral_type==item.num?'actt':''">
                                    <view class="radio__inner" :class="is_integral_type==item.num?'act_border':''">
                                        <view :class="is_integral_type==item.num?'is-default-checked':''"
                                            class="radio__inner-icon radio__inner-icon ">
                                        </view>
                                    </view>
                                    <text class="checklist-text">{{item.name}}</text>
                                </view>
                            </view>
                        </view>
                    </view>

                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>分享得积分</text>
                        </view>
                        <view class="desc">
                            <input type="number" :value="info.share_num" name="share_num" class="input-box"
                                placeholder="分享得积分" placeholder-class="desc-placeholder">
                        </view>
                    </view>

					<view class="cell flex flex-y-center">
					    <view class="title-block required">
					        <text>分享时间</text>
					    </view>
					    <view class="desc">
					        <view class="flex-center flex-x-start">
					            <view class="checklist-box " @click="choiceFenxiang(item.num)"
					                v-for="(item,index) of fenxiang_arr" :key='index'
					                :class="is_fenxiang==item.num?'actt':''">
					                <view class="radio__inner" :class="is_fenxiang==item.num?'act_border':''">
					                    <view :class="is_fenxiang==item.num?'is-default-checked':''"
					                        class="radio__inner-icon radio__inner-icon ">
					                    </view>
					                </view>
					                <text class="checklist-text">{{item.name}}</text>
					            </view>
					        </view>
					    </view>
					</view>
					
					<view class="cell flex flex-y-center">
					    <view class="title-block required">
					        <text>有效次数</text>
					    </view>
					    <view class="desc">
					        <input type="number" :value="info.fenxiaing_num" name="fenxiaing_num" class="input-box"
					            placeholder="有效次数" placeholder-class="desc-placeholder">
					    </view>
					</view>
					
					<view class="red">
					    *单个用户观看有效次数
					</view>
					
                    <view class="cell flex flex-y-center">
                        <view class="title-block required">
                            <text>消费得积分(%)</text>
                        </view>
                        <view class="desc">
                            <input type="text" :value="info.integral" name="integral" class="input-box"
                                placeholder="消费得积分(%)" placeholder-class="desc-placeholder">
                        </view>
                    </view>
					
					<view class="red">
					    *实际到账积分=按实际消费金额*消费得积分的比例%，不满足1积分，不计算入内，如：设置消费得积分的比例是1%，实际支付100元，获得1积分（1%*100元=1积分）；
					</view>
					
					<view class="cell flex flex-y-center">
					    <view class="title-block required">
					        <text>看广告得积分</text>
					    </view>
					    <view class="desc">
					        <input type="text" :value="info.adv_jf" name="adv_jf" class="input-box"
					            placeholder="看广告得积分" placeholder-class="desc-placeholder">
					    </view>
					</view>
					<view class="red">
					    *针对微信激励视频广告，请前往商家小程序开通流量主-激励广告
					</view>
					
					<view class="cell flex flex-y-center mrt10">
					    <view class="title-block required">
					        <text>设置打包费</text>
					    </view>
					    <view class="desc">
					        <view class="flex-center flex-x-start">
					            <view class="checklist-box " @click="choiceBox(item.num)"
					                v-for="(item,index) of box_arr" :key='index'
					                :class="is_box==item.num?'actt':''">
					                <view class="radio__inner" :class="is_box==item.num?'act_border':''">
					                    <view :class="is_box==item.num?'is-default-checked':''"
					                        class="radio__inner-icon radio__inner-icon ">
					                    </view>
					                </view>
					                <text class="checklist-text">{{item.name}}</text>
					            </view>
					        </view>
					    </view>
					</view>
					<block v-if="is_box!=1">
						<view class="cell flex flex-y-center">
							<view class="title-block required">
								<text>打包费</text>
							</view>
							<view class="desc">
								<input type="digit" :value="info.is_box_money" name="is_box_money" class="input-box"
									placeholder="请输入打包费" placeholder-class="desc-placeholder">
							</view>
						</view>
						
						<view class="red">
							*只限外卖、自提订单：按订单：如设置5元，则每笔订单收5元打包费；按商品：如设置为5元，则每个商品收5元打包费，商品中单独设置打包费不为0时，则按照商品中设置的打包费收取
						</view>
					</block>
                </view>
            </view>

            <view class=" page-block" style="background-color: #FFF;padding: 20rpx 25rpx; margin-top: 10px;">
                <view class="flex box-pack-between">
                    <view class="title-block required"
                        style="font-size: 30rpx;color: #333;font-weight: 600;padding-right: 20rpx;">
                        <text>会员权益</text>
                    </view>
                    <view class="flex-center" @click="getEnit">
                        <text style="color: #007AFF;">{{is_enit?'取消编辑':'编辑'}}</text>
                        <text class="iconfont icongengduo"></text>
                    </view>
                </view>
                <view class="desc">
                    <view>
                        <block v-if="is_enit">
                            <textarea type="text" :value="info.member_content" name="member_content"
                                class="input-box flex-grow-1" placeholder="请输入"
                                placeholder-class="desc-placeholder"></textarea>
                        </block>
                        <block v-else>
                            <rich-text :nodes="info.member_content"></rich-text>
                            <textarea type="text" :value="info.member_content" name="member_content"
                                style="display: none;" class="input-box" placeholder=""
                                placeholder-class="desc-placeholder"></textarea>
                        </block>
                    </view>
                </view>
            </view>

            <view class="footer-bar" style="position: relative;">
                <view class="content flex flex-center" style="background: none;">
                    <button hover-class="none" class="btn" form-type="submit">
                        保存
                    </button>
                </view>
            </view>
        </form>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                is_enit: false,
                info: {
					// desc:'下单,配送',
					// eat_mode:'购买方式,店内下单,到店自取',
				},
                printerAddrList: ['商家配送', '达达配送', '松鼠屋配送'],
                printerAddr: '达达配送',
                ps_mode: 2,
                dada_arr: [{
                        num: 0,
                        name: "正式接单",
                    },
                    {
                        num: 1,
                        name: "测试接单"
                    }
                ],
                is_dada: 0,

                diy_arr: [{
                        num: 1,
                        name: "开启"
                    },
                    {
                        num: 0,
                        name: "关闭"
                    }
                ],
                is_diy: 0,
                single_status_arr: [{
                        num: 1,
                        name: "开启"
                    },
                    {
                        num: 2,
                        name: "关闭"
                    }
                ],
                single_status: 2, //是否自动派单 1是 2否
				
				open_arr:[{
					num: 1,
					name: "开启"
				},{
					num: 2,
					name: "关闭"
				}
				],
				open:2,
				
                table_arr: [{
                        num: 1,
                        name: "开启"
                    },
                    {
                        num: 0,
                        name: "关闭"
                    }
                ],
                is_table: 0,

                yuer_arr: [{
                        num: 1,
                        name: "开启"
                    },
                    {
                        num: 0,
                        name: "关闭"
                    }
                ],
                is_yuer: 0,


				cart_arr: [{
						num: 1,
						name: "开启"
					},
					{
						num: 0,
						name: "关闭"
					}
				],
				is_cart:0,
				
				load_arr: [{
						num: 0,
						name: "一次性加载"
					},
					{
						num: 1,
						name: "分类加载"
					}
				],
				is_rebate:0,
					

                integral_arr: [{
                        num: 1,
                        name: "自动"
                    },
                    {
                        num: 3,
                        name: "手动"
                    }, {
                        num: 2,
                        name: "关闭"
                    }
                ],
                is_integral: 1,

                integral_arr_type: [{
                        num: 1,
                        name: "快递或自提"
                    },
                    {
                        num: 2,
                        name: "仅快递"
                    },
                    {
                        num: 3,
                        name: "仅自提"
                    },
                ],
                is_integral_type: 1,

				fenxiang_arr: [{
                        num: 1,
                        name: "每天"
                    },
                    {
                        num: 2,
                        name: "每星期"
                    },
                    {
                        num: 3,
                        name: "每月 "
                    },
                ],
                is_fenxiang: 1,

                store_id: "",
                coordinates: "",
                jifen_jump_arr: [{
                    num: 1,
                    name: "内部跳转页面"
                }, {
                    num: 2,
                    name: "外部跳转小程序"
                }],
                wx: 1,
                wx_index: 0,
                zfb: 1,
                zfb_index: 0,
                sendModeArr: [{
                    num: 1,
                    name: "省钱"
                }, {
                    num: 2,
                    name: "最快"
                }, {
                    num: 3,
                    name: "指派"
                }, {
                    num: 4,
                    name: "价格从低到高依次呼叫"
                }],
                sendModeIndex: 0,
                sendModeNameArr: [{
                    num: 'mtps',
                    name: "美团"
                }, {
                    num: 'fengniao',
                    name: "蜂鸟"
                }, {
                    num: 'dada',
                    name: "达达"
                }, {
                    num: 'shunfeng',
                    name: "顺丰"
                }, {
                    num: 'bingex',
                    name: "闪送"
                }, {
                    num: 'uupt',
                    name: "UU跑腿"
                }, {
                    num: 'dianwoda',
                    name: "点我达"
                }, {
                    num: 'aipaotui',
                    name: "爱跑腿"
                }, {
                    num: 'caocao',
                    name: "曹操"
                }, {
                    num: 'bangla',
                    name: "帮啦"
                }, ],
                sendModeNameIndex: 0,
				box_arr:[
					{   num: '1',
                    name: "免打包费"},
					{   num: '2',
                    name: "按订单"},
					{   num: '3',
                    name: "按商品"}
				],
				is_box:1,
            }
        },

        onLoad(e) {
            this.store_id = uni.getStorageSync("store_id")
            this.peisongset_list();
        },

        methods: {
			
            getEnit(e) {
                this.is_enit = !this.is_enit;
            },
			
            bindMap(e) {
                uni.chooseLocation({
                    success: (res) => {
                        console.log(res, "res")
                        this.coordinates = res.latitude + "," + res.longitude;
                    }
                })
            },
    
            choiceDiy(index) {
                this.is_diy = index;
            },
			
            choiceSingleStatus(index) {
                this.single_status = index;
            },
			
            //配送模式
            onSendModeChange(e) {
                this.sendModeIndex = e.detail.value
            },
            //配送方式
            onSendModeNameChange(e) {
                this.sendModeNameIndex = e.detail.value
            },
			
			choiceOpen(index) {
                this.open = index;
            },
			
            choiceTable(index) {
                this.is_table = index;
            },
			
            choiceYuer(index) {
                this.is_yuer = index;
            },
			
			choiceCart(index) {
                this.is_cart = index;
            },
			choiceLoad(index) {
                this.is_rebate = index;
            },
			
            choicepay(index) {
                this.is_integral = index;
            },
            onWxChange(e) {
                let index = e.detail.value
                this.wx = this.jifen_jump_arr[index].num
                this.wx_index = index
            },
            onZfbChange(e) {
                let index = e.detail.value
                this.zfb = this.jifen_jump_arr[index].num
                this.zfb_index = index
            },
            choicepayType(index) {
                this.is_integral_type = index;
            },
			choiceFenxiang(index) {
                this.is_fenxiang = index;
            },
            choiceDada(index) {
                this.is_dada = index;
            },
			choiceBox(index) {
                this.is_box = index;
            },


            copyText(e) {
                let a = e == 1 ? 'http://newopen.imdada.cn/' : 'http://lbs.qq.com/tool/getpoint/';
                uni.setClipboardData({
                    data: a,
                    success: function() {
                        console.log('success');
                    }
                });
            },

            peisongset_list() {
                this.request({
                    url: 'Smdcshop/peisongset_list',
                    data: {
                        store_id: this.store_id,
                    }
                }).then(res => {
                    if (res.code == "200") {
                        console.log(res, "res")
						res.data.member_content = res.data.member_content.replace(/\<img/gi,
							'<img style="max-width:100%;height:auto" ')
                        this.info = res.data;
                        this.printerAddr = res.data.ps_mode == 1 ? '商家配送' : res.data.ps_mode == 3 ? '聚合配送' :
                            '达达配送';
                        this.ps_mode = res.data.ps_mode;
                        this.is_integral = res.data.is_jf;
                        this.is_integral_type = res.data.is_delivery;
                        this.printerStatus = this.state == 1 ? '开启' : '关闭';
                        this.coordinates = res.data.coordinates;
                        this.is_dada = res.data.is_dada;
                        this.is_diy = res.data.is_diy;
                        this.single_status = res.data.single_status || 2;
                        this.is_table = res.data.change_table;
                        this.is_yuer = res.data.is_yuer;
                        this.wx = res.data.wx
                        this.wx_index = res.data.wx == 1 ? 0 : 1
                        this.zfb = res.data.zfb
                        this.zfb_index = res.data.zfb == 1 ? 0 : 1
						this.open = res.data.open
						this.is_cart=res.data.is_cart
						this.is_rebate = res.data.is_rebate
						this.is_box=res.data.is_box
						this.is_fenxiang=res.data.is_fenxiang
                        if (res.data.ps_mode == 3) {
                            this.single_status = res.data.single_status
                            if (res.data.single_status == 1) {
                                this.sendModeIndex = this.getSendModeIndex(res.data.dispatch_mode)
                                this.sendModeNameIndex = this.getSendModeNameIndex(res.data.logistic)
                            }

                        } else {
                            this.single_status = 2
                        }
                    }
                })
            },
            getSendModeIndex(num) {
                let index = this.sendModeArr.findIndex(item => {
                    return item.num == num
                })
                return index
            },
            getSendModeNameIndex(num) {
                let index = this.sendModeNameArr.findIndex(item => {
                    return item.num == num
                })
                return index
            },
            onPrinterAddrChange(e) {
                console.log(e)
                this.printerAddr = this.printerAddrList[e.detail.value];
                this.ps_mode = Number(e.detail.value) + 1;
                if (e.detail.value == 0) {
                    //非聚合派送
                    this.single_status = 2
                }
            },

            onSubmit(e) {
                let params = {
                        id: this.info.id,
                        store_id: this.store_id,
                        is_jf: this.is_integral,
                        ps_mode: this.ps_mode,
                        source_id: this.info.source_id,
                        is_delivery: this.is_integral_type,
                        coordinates: this.coordinates,
                        is_dada: this.is_dada,
                        is_diy: this.is_diy,
                        change_table: this.is_table,
                        is_yuer: this.is_yuer,
                        admin_id: uni.getStorageSync("admin_id"),
                        wx: this.wx,
                        zfb: this.zfb,
						open:this.open,
						is_cart:this.is_cart,
						is_rebate:this.is_rebate,
						is_box:this.is_box,
						is_fenxiang:this.is_fenxiang,
			
                    },
                    url;
                if (params.ps_mode == 3) {
                    params.single_status = this.single_status
                    params.single_status_time = this.single_status_time
                    if (params.single_status == 1) {
                        params.dispatch_mode = this.sendModeArr[this.sendModeIndex].num
                        params.logistic = this.sendModeNameArr[this.sendModeNameIndex].num
                    }
                } else {
                    params.single_status = 2
                }
                var data = Object.assign(params, e.detail.value);
                if (data.name == "") {
                    uni.showToast({
                        title: "请输入名称",
                        icon: 'none'
                    })
                    return false
                }
                console.log('提交数据', data)
                //return
                this.request({
                    url: "Smdcshop/peisongset_edit",
                    data: data
                }).then(res => {
                    if (res.code == 200) {
                        uni.showToast({
                            title: res.message,
                            icon: 'none'
                        })
                        setTimeout(() => {
                            uni.navigateBack()
                        }, 2000)

                    }
                }).catch((res) => {
                    uni.showToast({
                        title: res.message,
                        icon: 'none'
                    })
                });
            },
        }
    }
</script>

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

    .flex-x-start {
        justify-content: flex-start;
    }

    page {
        background-color: #F4F5F7;
    }

    page .page-block .content {
        background-color: #F4F5F7;
        padding: 0;
    }

    page .page-block .cell {
        background-color: #FFF;
        padding: 0 25rpx;
    }
	.mrt10{
		margin-top: 20rpx;
	}
    .red {
        color: red;
        padding: 10rpx 25rpx;
        font-size: 26rpx;
    }

    .checklist-box {

        display: -webkit-box;
        display: -webkit-flex;
        display: flex;

        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -webkit-flex-direction: row;
        flex-direction: row;
        -webkit-box-align: center;
        -webkit-align-items: center;
        align-items: center;
        margin: 5px 0;
        margin-right: 25rpx;
    }

    .radio__inner {
        -webkit-flex-shrink: 0;
        flex-shrink: 0;

        display: -webkit-box;
        display: -webkit-flex;
        display: flex;

        -webkit-box-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -webkit-align-items: center;
        align-items: center;
        position: relative;
        border: 1px solid #DCDFE6;
        border-radius: 2px;
        box-sizing: border-box;
        width: 16px;
        height: 16px;
        border-radius: 16px;
        background-color: #fff;
        z-index: 1;
        -webkit-transition: border-color .3s;
        transition: border-color .3s;
    }

    .radio__inner-icon {
        width: 8px;
        height: 8px;
        border-radius: 10px;
        opacity: 0;
        -webkit-transition: -webkit-transform .3s;
        transition: -webkit-transform .3s;
        transition: transform .3s;
        transition: transform .3s, -webkit-transform .3s;
    }

    .is-default-checked {
        opacity: 1;
        background-color: #007aff;
        -webkit-transform: rotate(45deg) scaleY(1);
        transform: rotate(45deg) scaleY(1);
    }

    .checklist-text {
        font-size: 28rpx;
        margin-left: 5px;
        -webkit-transition: color 0.2s;
        transition: color 0.2s;
        color: #000;
    }

    .act_border {
        border: 1rpx solid #007aff;
    }
</style>
