<template>
  <view class="container-settle">
    <navbar :config="config" backColor="#666666"></navbar>
    <view class="top ql-editor-box" v-html="content"></view>
    <view class="footer">
      <view class="online-btn btn" @click="jumpSettle(0)">线上商家入驻</view>
      <view class="btn" @click="jumpSettle(1)">联盟商家入驻</view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        config: {
          back: true, //false是tolbar页面 是则不写
          title: '商家入驻',
          color: '#1A1A1A',
          //背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
          backgroundColor: [1, "#fff"],
          statusBarFontColor: '#1A1A1A',
          // backPage: "/pages/index/personal"
          // backPage:"/pages/entrepreneurshipZone/index"
        },
        content: '',
      }
    },
    onLoad(options) {
      this.getShopConfig(options.type)
    },
    methods: {
      // 获取商家入驻协议
      getShopConfig(type) {
        // this.$http.get('/protocolConfig/info/tenants-agreement').then(res => {
        //   if (res.code == 200) {
        //     this.content = res.data.content
        //   }
        // })
		this.$yghttp.get('/protocol/info',{
						code: type
					})
			.then(res => {
				if (res && res.code == 200) {
					this.content = res.data.protocolContent
				}
			})
      },
      jumpSettle(settleMode) {
        this.$http.get("/yxt/shopapply/shopApplyInfo",{
          union_business: settleMode == 0 ? false : true
        }).then(res => {
          if (res && res.code == 200) {
            if (res.data == null) {
              uni.navigateTo({
                url: `/pages/user/merchant/registerAndAudit?settleMode=${settleMode}`
              })
            } else {
              if (settleMode == 0) {
                uni.navigateTo({
                  url: "/pages/user/merchant/audit"
                })
              } else {
                uni.navigateTo({
                  url: "/pages/workbench/shop/audit"
                })
              }
            }
          }
        })

      }
    }
  }
</script>

<style lang="scss" scoped>
  .container-settle {

    .top {
      padding: 30rpx;
      padding-bottom: 200rpx;

      .content {
        padding: 0 14rpx 26rpx 14rpx;
        font-size: 24rpx;
        color: #666666;
        font-weight: 500;
        line-height: 48rpx;
      }
    }

    .footer {
      width: 100%;
      padding: 30rpx 60rpx;
      position: fixed;
      bottom: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      background-color: #fff;

      .btn {
        width: 298rpx;
        color: #fff;
        text-align: center;
        line-height: 85rpx;
        border: 1rpx solid #FA6138;
        border-radius: 44rpx;
        background-color: #FA6138;
        font-size: 28rpx;
        font-family: PingFang SC, PingFang SC-Regular;
        font-weight: 400;
        text-align: center;
      }

      .online-btn {
        color: #FA6138;
        border: 1rpx solid #FA6138;
        background-color: #fff;
      }
    }
  }
</style>
