<template>
  <view class="setPage">
    <button class="saveBtn" size='mini' type="primary" @click="save" :disabled="loading">保存</button>
    <view class="topBox">
      <image
        src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/bg.png"
        mode="widthFix"
        class="bg"
      />
      <view class="headImgBox"></view>
      <view class="nameBox"
        >{{ msg.MallName }}
        <u-icon
          name="edit"
          style="margin-left: 10rpx"
          @click="showBox1 = true"
        ></u-icon>
      </view>
      <u-modal
        v-model="showBox1"
        :show-cancel-button="true"
        title="修改商城名称"
        contentSlot
        @confirm="showBox1 = false"
      >
        <input type="text" v-model="msg.MallName" class="nameInput" />
      </u-modal>
    </view>
    <!-- <view class="boxGroup" style="display: none;">
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shop.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">营业状态</view>
          <u-switch v-model="msg.business"></u-switch>
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox"></view>
        <view
          class="rightBox"
          :style="businessKey == 1 ? 'border:none' : ''"
        ></view>
        <u-radio-group
          v-model="msg.businessTime"
          @change="radioGroupChange"
          class="radioGroup"
        >
          <u-radio
            v-for="(item, index) in businessTimeList"
            :key="index"
            :name="item.key"
            shape="circle"
          >
            {{ item.name }}
          </u-radio>
        </u-radio-group>
      </view>
      <view class="boxItem" v-if="businessKey == 2">
        <view class="leftBox"></view>
        <view class="rightBox" @click="showBox2 = true">
          <view class="name">选择日期</view>
          <view class="flex-center">
            <view class="weeek">{{ weekStr }}</view>
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <u-modal
        v-model="showBox2"
        :show-cancel-button="true"
        title="选择日期"
        contentSlot
        @confirm="showBox2 = false"
      >
        <view class="modelBox2">
          <view
            v-for="(item, index) in weekArr"
            :key="index"
            class="modelBox2Item"
            :class="item.choose ? 'modelBox2ItemActive' : ''"
            @click="chooseWeek(item)"
          >
            {{ item.name }}
          </view>
        </view>
      </u-modal>
      <view class="boxItem" v-if="businessKey == 2">
        <view class="leftBox"></view>
        <view
          class="rightBox"
          style="border: none"
          @click="jumpPage('/pages/MallMange/timeQuantum')"
        >
          <view class="name">选择时间段</view>
          <view class="flex-center">
            <view class="weeek">{{ timeArr.join("、") }}</view>
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
    </view>
    <view class="boxGroup" style="display: none;">
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" style="border: none">
          <view class="name">短信通知</view>
          <u-switch v-model="msg.business"></u-switch>
        </view>
      </view>
    </view> -->
    <!-- 基本设置 -->
    <view class="boxGroup">
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">联系电话</view>
          <input
            type="number"
            placeholder="联系电话"
            style="text-align: right"
            v-model="msg.ContactNumber"
          />
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">外部客服链接</view>
          <input
            type="number"
            placeholder="外部客服链接"
            style="text-align: right"
            v-model="msg.OuterServiceLink"
          />
        </view>
      </view>
      <view class="colTitle">一键导航:</view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">详细地址</view>
          <input
            type="number"
            placeholder="详细地址"
            style="text-align: right"
            v-model="msg.Address"
          />
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">经纬度</view>
          <input
            type="number"
            placeholder="经纬度"
            style="text-align: right"
            v-model="msg.LongAndLat"
            disabled
          />
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">地图</view>
          <button
            size="mini"
            type="primary"
            style="float: right; margin: 0"
            @click="map"
          >
            打开地图
          </button>
        </view>
      </view>
      <view class="colTitle">跳转小程序:</view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">小程序APPID</view>
          <input
            type="number"
            placeholder="小程序APPID"
            style="text-align: right"
            v-model="msg.MinAppId"
          />
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shortmsg.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" style="border: none">
          <view class="name">小程序路径</view>
          <input
            type="number"
            placeholder="小程序路径"
            style="text-align: right"
            v-model="msg.MinUrl"
          />
        </view>
      </view>
    </view>
    <!-- 交易设置 -->
    <view class="boxGroup">
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/money.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" @click="showBox3 = true">
          <view class="name">未支付订单超时时间</view>
          <view class="flex-center">
            {{ msg.CancelTime }}分
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shouhuo.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" @click="showBox4 = true">
          <view class="name">自动确认收货时间</view>
          <view class="flex-center">
            {{ msg.AutoReceiving }}天
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shouhou.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" style="border: none" @click="showBox5 = true">
          <view class="name">售后时间</view>
          <view class="flex-center">
            {{ msg.AfterTime }}天
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <u-modal
        v-model="showBox3"
        :show-cancel-button="true"
        title="未支付订单超时时间"
        contentSlot
        @confirm="showBox3 = false"
      >
        <view class="modelBox3 flex-center">
          <input type="number" class="input3" v-model="msg.CancelTime" />分钟
        </view>
      </u-modal>
      <u-modal
        v-model="showBox4"
        :show-cancel-button="true"
        title="自动确认收货时间"
        contentSlot
        @confirm="showBox4 = false"
      >
        <view class="modelBox3 flex-center">
          <input type="number" class="input3" v-model="msg.AutoReceiving" />天
        </view>
      </u-modal>
      <u-modal
        v-model="showBox5"
        :show-cancel-button="true"
        title="售后时间"
        contentSlot
        @confirm="showBox5 = false"
      >
        <view class="modelBox3 flex-center">
          <input type="number" class="input3" v-model="msg.AfterTime" />天
        </view>
      </u-modal>
    </view>
    <view class="boxGroup">
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/Payment.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" style="border: none" @click="showBox6 = true">
          <view class="name">支付方式</view>
          <view class="flex-center">
            <view class="weeek">{{ payTypeStr }}</view>
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <u-modal
        v-model="showBox6"
        :show-cancel-button="true"
        title="支付方式"
        contentSlot
        @confirm="showBox6 = false"
      >
        <view class="modelBox6 flex-center">
          <view
            v-for="(item, index) in payTypeArr"
            :key="index"
            class="flex-between modelBox6Item"
            :class="item.choose ? 'modelBox6ItemActive' : ''"
            @click="changePayType(item)"
          >
            <view class="flex-center">
              <image
                :src="item.img"
                mode="aspectFit"
                style="
                  width: 60rpx;
                  height: 60rpx;
                  border-radius: 6rpx;
                  margin-right: 20rpx;
                "
              />
              <view class="modelBox6ItemName">{{ item.name }}</view>
            </view>
            <u-icon
              name="success"
              color="#446dfc"
              size="30"
              v-if="item.choose"
            ></u-icon>
          </view>
        </view>
      </u-modal>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/Payment.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" @click="showBox10 = true">
          <view class="name">商品面议联系方式</view>
          <view class="flex-center">
            <view class="weeek">{{ concatTypeStr }}</view>
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <u-modal
        v-model="showBox10"
        :show-cancel-button="true"
        title="商品面议联系方式"
        contentSlot
        @confirm="showBox10 = false"
      >
        <view class="modelBox6 flex-center">
          <view
            v-for="(item, index) in contactTypeArr"
            :key="index"
            class="flex-between modelBox6Item"
            :class="item.choose ? 'modelBox6ItemActive' : ''"
            @click="changeConcatType(item)"
          >
            <view class="flex-center">
              <image
                :src="item.img"
                mode="aspectFit"
                style="
                  width: 60rpx;
                  height: 60rpx;
                  border-radius: 6rpx;
                  margin-right: 20rpx;
                "
              />
              <view class="modelBox6ItemName">{{ item.name }}</view>
            </view>
            <u-icon
              name="success"
              color="#446dfc"
              size="30"
              v-if="item.choose"
            ></u-icon>
          </view>
        </view>
      </u-modal>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shop.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox">
          <view class="name">余额功能</view>
          <u-switch
            v-model="msg.BalanceFun"
            :active-value="1"
            :inactive-value="0"
            @change="BalanceFun"
          ></u-switch>
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/shop.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" style="border: none">
          <view class="name">储值卡功能</view>
          <u-switch
            v-model="msg.DepositFun"
            :active-value="1"
            :inactive-value="0"
             @change="DepositFun"
          ></u-switch>
        </view>
      </view>
    </view>
    <view class="boxGroup">
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/fahuo.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" @click="showBox7 = true">
          <view class="name">发货方式</view>
          <view class="flex-center">
            <view class="weeek">{{ deliveryTypeStr }}</view>
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/dizhi.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view
          class="rightBox"
          style="border: none"
          @click="jumpPage(`/pages/MallMange/address`)"
        >
          <view class="name">退货地址</view>
          <view class="flex-center">
            <view class="weeek">{{ addrStr }}</view>
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <u-modal
        v-model="showBox7"
        :show-cancel-button="true"
        title="发货方式"
        contentSlot
        @confirm="showBox7 = false"
      >
        <view class="modelBox6 flex-center">
          <view
            v-for="(item, index) in deliveryTypeArr"
            :key="index"
            class="flex-between modelBox6Item"
            :class="item.choose ? 'modelBox6ItemActive' : ''"
            @click="changeDeliveryType(item)"
          >
            <view class="flex-center">
              <image
                :src="item.img"
                mode="aspectFit"
                style="
                  width: 60rpx;
                  height: 60rpx;
                  border-radius: 6rpx;
                  margin-right: 20rpx;
                "
              />
              <view class="modelBox6ItemName">{{ item.name }}</view>
            </view>
            <u-icon
              name="success"
              color="#446dfc"
              size="30"
              v-if="item.choose"
            ></u-icon>
          </view>
        </view>
      </u-modal>
    </view>
    <view class="boxGroup">
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/jizhi.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" @click="showBox8 = true">
          <view class="name">积分抵扣</view>
          <view class="flex-center"
            >{{ msg.integral }}积分抵扣一元
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <view class="boxItem">
        <view class="leftBox flex-center">
          <image
            src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/jifenguize.png"
            mode="widthFix"
            style="width: 100%"
          />
        </view>
        <view class="rightBox" style="border: none" @click="showBox9 = true">
          <view class="name">积分使用规则</view>
          <view class="flex-center"
            >{{
              msg.IntegralRule && msg.IntegralRule != "" ? "已填写" : "未填写"
            }}
            <u-icon name="arrow" style="margin-left: 10rpx"></u-icon
          ></view>
        </view>
      </view>
      <u-modal
        v-model="showBox8"
        :show-cancel-button="true"
        title="积分抵扣"
        contentSlot
        @confirm="showBox8 = false"
      >
        <view class="modelBox8 flex-center">
          <input
            type="number"
            class="input8"
            v-model="msg.integral"
          />积分抵扣一元
        </view>
      </u-modal>
      <u-modal
        v-model="showBox9"
        :show-cancel-button="true"
        title="积分使用规则"
        contentSlot
        @confirm="showBox9 = false"
      >
        <view class="modelBox8 flex-center">
          <textarea v-model="msg.IntegralRule" class="modelBoxItem" />
        </view>
      </u-modal>
    </view>
    <tabbar></tabbar>
  </view>
</template>
<script>
import tabbar from "./components/tabbar.vue";
export default {
  components: {
    tabbar,
  },
  data() {
    return {
      loading:false, 
      showBox1: false,
      username: "",
      showBox2: false,
      showBox3: false,
      showBox4: false,
      showBox5: false,
      showBox6: false,
      showBox7: false,
      showBox8: false,
      showBox9: false,
      showBox10: false,
      msg: {
        ID: "",
        MallName: "饭粒汪", //商城名称
        Indate: "", //有效期
        ContactNumber: "", //联系号码
        OuterServiceLink: "", //外链客服链接
        Address: "", //详细地址
        LongAndLat: "", //经纬度
        MinAppId: "", //小程序appId
        MinUrl: "", //小程序路径
        CancelTime: 0, //未支付订单超时时间
        AutoReceiving: 0, //自动确认收货时间
        AfterTime: 0, //售后时间
        PayWay: "", //支付方式
        DeliverWay: "", //发货方式
        BalanceFun: 0, //余额功能
        DepositFun: 0, //储值卡
        ConsultWay: "", //商品面议联系方式
        MinSwitch: 1, //添加到我的小程序开关
        MinBackColor: "#000000", //背影颜色
        MinBackClarity: 100, //背影透明度
        MinBackCircularBead: 36, //背景框圆角
        MinTips: "添加到我的小程序，购买更便捷", //提示文本内容
        MinTipsColor: "#FFFFFF", //文本颜色
        MinIcoColor: 1, //图标颜色
        MinShareTitle: "", //转发标题
        MinShareIco: "", //选择图标
        BuySwitch: 0, //首页购买记录框开关
        CarouselOrder: 0, //轮播订单数
        ListShopCar: 0,
        ListBuyCount: 1,
        ListName: 1,
        DetailsComment: 1,
        DetailsLineationPrice: 1,
        DetailsMemberPrice: 1,
        DetailsVipMemberPrice: 1,
        DeatilsExpress: 1,
        DetailsBuyNum: 1,
        DetailsSharePrice: 1,
        DetailsVideo: 1,
        OtherNoShare: 1,
        OtherIndexMoblie: 0,
        OtherManualMobile: 1,
        OtherTencent: 0,
        OtherMemerLevel: 0,
        OtherMustAddress: 0,
        OtherApplyShare: 0,
        SuspendBtn: 0,
        BackTopBtn: 1,
        CarSuspendBtn: 0,
        SellOutIcoSwitch: 1,
        SellOutDefaultIco: 0,
        GoodsNormalPic: "",
        GoodsZoomPic: "",
        SuspendStyle: 1,
        UnfoldIco: 0,
        PackUpIco: "",
        OnlineService: 0,
        OnlineServiceIco: "",
        BackTopNavigation: 0,
        BackTopNavigationIco: "",
        OneCall: 0,
        OneCallIco: "",
        ServiceOutLink: 0,
        ServiceOutLinkIco: "",
        ShortcutNavigation: 0,
        ShortcutNavigationIco: "",
        TurnMini: 0,
        TurnMiniIco: "",
        Custom: 0,
        TurnLink: "",
        TurnIco: 0,
        LookWeChatTimes: 0, //每月可查看微信次数
        IsOpenGuide: 1, //是否开启引导页
      },
      businessTimeList: [
        {
          name: "全天24小时",
          key: 1,
        },
        {
          name: "自定义营业时间",
          key: 2,
        },
      ],
      businessKey: 1,
      weekArr: [
        {
          name: "周一",
          key: 1,
          choose: false,
        },
        {
          name: "周二",
          key: 2,
          choose: false,
        },
        {
          name: "周三",
          key: 3,
          choose: false,
        },
        {
          name: "周四",
          key: 4,
          choose: false,
        },
        {
          name: "周五",
          key: 5,
          choose: false,
        },
        {
          name: "周六",
          key: 6,
          choose: false,
        },
        {
          name: "周日",
          key: 7,
          choose: false,
        },
      ],
      weekStr: "",
      timeArr: [],
      payTypeArr: [
        {
          Id: 1,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/cloudypay.png",
          name: "线上支付",
          choose: true,
        },
        {
          Id: 2,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/huodaofukuan.png",
          name: "货到付款",
          choose: false,
        },
        {
          Id: 3,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/yuezhifu.png",
          name: "余额支付",
          choose: false,
        },
      ],
      payTypeStr: "线上支付",
      deliveryTypeArr: [
        //发货方式
        {
          Id: 1,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/cloudypay.png",
          name: "快递配送",
          choose: true,
        },
        {
          Id: 2,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/yuezhifu.png",
          name: "到店自提",
          choose: false,
        },
        {
          Id: 3,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/huodaofukuan.png",
          name: "同城配送",
          choose: false,
        },
      ],
      deliveryTypeStr: "快递配送",
      addrStr: "退货地址",
      // 商品面议联系方式
      contactTypeArr: [
        {
          Id: 1,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/cloudypay.png",
          name: "在线客服",
          choose: true,
        },
        {
          Id: 2,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/yuezhifu.png",
          name: "联系电话",
          choose: false,
        },
        {
          Id: 3,
          img: "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/mallManage/huodaofukuan.png",
          name: "外链客服",
          choose: false,
        },
      ],
      concatTypeStr: "在线客服",
    };
  },
  methods: {
    radioGroupChange(e) {
      this.businessKey = e;
    },
    //选择日期
    chooseWeek(e) {
      e.choose = !e.choose;
      this.weekStr = this.weekArr
        .filter((item) => {
          return item.choose;
        })
        .map((item) => item.name)
        .join("、");
    },
    jumpPage(url) {
      uni.navigateTo({
        url: url,
      });
    },
    // 修改营业时间段
    getTimeArr(arr) {
      this.timeArr = arr;
      this.$forceUpdate();
    },
    //切换支付方式
    changePayType(e) {
      e.choose = !e.choose;
      this.payTypeStr = this.payTypeArr
        .filter((item) => {
          return item.choose;
        })
        .map((item) => item.name)
        .join("、");
      this.msg.PayWay = this.payTypeArr
        .filter((item) => {
          return item.choose;
        })
        .map((item) => item.Id)
        .join(",");
      if (this.payTypeStr == "") {
        this.payTypeArr[0].choose = true;
        this.payTypeStr = "线上支付";
      }
    },
    //商品面议联系方式
    changeConcatType(e) {
      e.choose = !e.choose;
      this.contactTypeStr = this.contactTypeArr
        .filter((item) => {
          return item.choose;
        })
        .map((item) => item.name)
        .join("、");
      this.msg.ConsultWay = this.contactTypeArr
        .filter((item) => {
          return item.choose;
        })
        .map((item) => item.Id)
        .join(",");
    },
    //切换发货方式
    changeDeliveryType(e) {
      e.choose = !e.choose;
      this.deliveryTypeStr = this.deliveryTypeArr
        .filter((item) => {
          return item.choose;
        })
        .map((item) => item.name)
        .join("、");
      if (this.deliveryTypeStr == "") {
        this.deliveryTypeArr[0].choose = true;
        this.deliveryTypeStr = "快递配送";
      }
    },
    save() {
      this.loading=true
      this.requestAdmin(
        "/api/MallBase/AddOrUpdateMallBase",
        this.msg,
        (res) => {
          this.loading=false
          uni.showToast({
            title: res.message,
           icon:'none'
          });
          this.getSetup();
        }
      );
    },
    map() {
      let that = this;
      uni.chooseLocation({
        success: function (res) {
          that.msg.Address = res.address;
          that.msg.LongAndLat = res.latitude + "," + res.longitude;
        },
      });
    },
    //获取设置数据
    getSetup() {
      this.requestAdmin("/api/MallBase/GetMallBaseInfo", {}, (res) => {
        this.msg = res.data;
        //支付方式
        this.payTypeArr.forEach((e) => {
          e.choose = this.msg.PayWay.split(",").includes(e.Id.toString());
        });
        this.payTypeStr = this.payTypeArr
          .filter((item) => {
            return item.choose;
          })
          .map((item) => item.name)
          .join("、");
        // 商品面议联系方式
        this.contactTypeArr.forEach((e) => {
          e.choose = this.msg.ConsultWay.split(",").includes(e.Id.toString());
        });
        this.concatTypeStr = this.contactTypeArr
          .filter((item) => {
            return item.choose;
          })
          .map((item) => item.name)
          .join("、");
        //发货方式
        this.deliveryTypeArr.forEach((e) => {
          e.choose = this.msg.DeliverWay.split(",").includes(e.Id.toString());
        });
        this.deliveryTypeStr = this.deliveryTypeArr
          .filter((item) => {
            return item.choose;
          })
          .map((item) => item.name)
          .join("、");
      });
    },
    BalanceFun(e){
      this.msg.BalanceFun=Number(e)
    },
    DepositFun(e){
      this.msg.DepositFun=Number(e)
    },
  },
  onLoad() {
    uni.setNavigationBarTitle({
      title: "商城设置",
    });
    this.getSetup();
  },
};
</script>
<style lang="scss" scoped>
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.setPage {
  min-height: 100vh;
  background-color: #f7f7f7;
  box-sizing: border-box;
  padding-bottom: 100rpx;
}
.topBox {
  position: relative;
  margin-bottom: 20rpx;
  .bg {
    width: 100%;
  }
  .headImgBox {
    position: absolute;
    top: 30rpx;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 140rpx;
    height: 140rpx;
    border-radius: 50%;
    border: 4rpx solid #fff;
    overflow: hidden;
    background-color: #f00;
  }
  .nameBox {
    width: 700rpx;
    height: 200rpx;
    border-radius: 10rpx;
    position: absolute;
    top: 110rpx;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    background-color: #fff;
    font-size: 28rpx;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
.boxGroup {
  width: 700rpx;
  padding: 0 30rpx;
  margin: 20rpx auto;
  background-color: #fff;
  border-radius: 10rpx;
  .boxItem {
    height: 100rpx;
    display: flex;
    align-items: center;
    position: relative;
    .leftBox {
      width: 50rpx;
      margin-right: 20rpx;
    }
    .rightBox {
      width: 560rpx;
      height: 100rpx;
      border-bottom: 2rpx solid #ccced5;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .name {
        font-size: 28rpx;
        color: #606266;
      }
    }
    .radioGroup {
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
    }
  }
}
/deep/.u-radio {
  margin-right: 60rpx;
}
/deep/.u-radio__icon-wrap {
  margin-right: 20rpx;
}
/deep/.u-model {
  border-radius: 10rpx;
}
.weeek {
  max-width: 260rpx;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  font-size: 28rpx;
  color: #606266;
}
.nameInput {
  width: 560rpx;
  height: 70rpx;
  border-radius: 10rpx;
  margin: 20rpx auto;
  box-sizing: border-box;
  padding: 0 20rpx;
  background-color: #f7f7f7;
}
.modelBox2 {
  width: 560rpx;
  border-radius: 10rpx;
  margin: 20rpx auto;
  box-sizing: border-box;
  padding: 0 20rpx;
  background-color: #fff;
  display: flex;
  flex-wrap: wrap;
  .modelBox2Item {
    width: 160rpx;
    height: 60rpx;
    border-radius: 30rpx;
    border: 2rpx solid #dfdfdf;
    font-size: 30rpx;
    color: #a4a4a4;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10rpx 20rpx 10rpx 0;
  }
  & .modelBox2Item:nth-child(3n) {
    margin-right: 0;
  }
  .modelBox2ItemActive {
    border-color: #111 !important;
    color: #111;
  }
}
.modelBox3 {
  margin: 40rpx auto;
  font-size: 26rpx;
  .input3 {
    width: 280rpx;
    height: 80rpx;
    border-radius: 10rpx;
    background-color: #f7f7f7;
    padding: 0 30rpx;
    font-size: 26rpx;
  }
}
.modelBox6 {
  margin: 30rpx auto;
  font-size: 26rpx;
  flex-wrap: wrap;
  .modelBox6Item {
    width: 550rpx;
    height: 100rpx;
    border-radius: 50rpx;
    margin: 10rpx 0;
    border: 2rpx solid #ccced5;
    padding: 0 50rpx;
    .modelBox6ItemName {
      font-size: 30rpx;
    }
  }
  .modelBox6ItemActive {
    border-color: #446dfc;
  }
}
.modelBox8 {
  margin: 40rpx auto;
  font-size: 26rpx;
  .input8 {
    width: 200rpx;
    height: 80rpx;
    border-radius: 10rpx;
    background-color: #f7f7f7;
    padding: 0 30rpx;
    font-size: 26rpx;
  }
  .modelBoxItem {
    width: 550rpx;
    border: 2rpx solid #999;
    border-radius: 10rpx;
    box-sizing: border-box;
    padding: 20rpx;
  }
}
.colTitle {
  line-height: 100rpx;
}
::-webkit-scrollbar {
  /*隐藏滚轮*/
  display: none;
}
.saveBtn{
  margin: 0;
  position: fixed;
  top: 20rpx;
  right: 20rpx;
  z-index: 5;
}
</style>