<style>
  .wexinappconfig .mimitBody {
    padding: 20px;
    background-color: #fff;
    margin: 10px 0 20px 0;
    display: table;
    width: 100%;
  }

  .wexinappconfig .mimitList {
    margin-bottom: 15px;
    display: flex;
    flex-direction: row;
  }

  .wexinappconfig .mimitBody .el-tag {
    min-width: 120px;
    padding-right: 50px;
  }

  .wexinappconfig .el-button--small {
    padding: 9px 25px;
  }

</style>
<template>
  <div class="wexinappconfig">
    <div class="CommonHeader">商城订阅消息</div>
    <div class="mimitBody">
      <el-form :model="appMallSubscribeMsg" ref="appMallSubscribeMsg" label-width="150px">
        <el-form-item label="下单成功提醒(类目: 服装/鞋/箱包 )">
          <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallSubscribeMsg.OrderSuccessTpl">
          </el-input>
        </el-form-item>
        <el-form-item label="订单取消通知(类目: 服装/鞋/箱包 )">
          <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallSubscribeMsg.OrderCancelTpl">
          </el-input>
        </el-form-item>
        <el-form-item label="订单发货通知(类目: 服装/鞋/箱包 )">
          <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallSubscribeMsg.OrderDeliverGoodsTpl">
          </el-input>
        </el-form-item>
        <el-form-item label="退款通知(类目: 服装/鞋/箱包 )">
          <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallSubscribeMsg.RefundTpl">
          </el-input>
        </el-form-item>
        <el-form-item label="活动状态通知(类目: 服装/鞋/箱包 )">
           <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallSubscribeMsg.ActiveStateTpl">
          </el-input>
        </el-form-item>
        <el-form-item label="审核结果通知(类目: 服装/鞋/箱包 )">
           <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallSubscribeMsg.AuditResultTpl">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" type="primary" @click="UpdateMallSubscribeMsg()">确 定</el-button>
      </span>
    </div>

    <div class="CommonHeader">分销订阅消息</div>
    <div class="mimitBody">
      <el-form :model="appMallDistributionMsg" ref="appMallDistributionMsg" label-width="150px">
        <el-form-item label="提现成功通知(类目: 服装/鞋/箱包 )">
          <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallDistributionMsg.ReflectSuccessTpl">
          </el-input>
        </el-form-item>
        <el-form-item label="提现失败通知(类目: 服装/鞋/箱包 )">
          <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallDistributionMsg.ReflectFailTpl">
          </el-input>
        </el-form-item>
        <el-form-item label="会员等级变更通知(类目: 服装/鞋/箱包 )">
          <el-input type="text" style="width:250px" size="small" maxlength="200" v-model="appMallDistributionMsg.MembersLevelChangeTpl">
          </el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" type="primary" @click="UpdateMallDistributionMsg()">确 定</el-button>
      </span>
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        //商城订阅消息
        appMallSubscribeMsg: {
          MallBaseId: 0, //小程序Id
          OrderSuccessTpl: "", //下单成功提醒(类目:服装/鞋/箱包)
          OrderCancelTpl: "", //订单取消提醒(类目:服装/鞋/箱包)
          OrderDeliverGoodsTpl: "", //订单发货提醒(类目:服装/鞋/箱包)
          RefundTpl: "", //退款提醒(类目:服装/鞋/箱包)
          ActiveStateTpl: "", //活动状态提醒(类目:服装/鞋/箱包)
          AuditResultTpl: "", //审核结果提醒(类目:服装/鞋/箱包)
        },
        //分销订阅消息
        appMallDistributionMsg: {
          MallBaseId: 0, //小程序Id
          ReflectSuccessTpl: "", //提现成功通知(类目: 服装/鞋/箱包 )
          ReflectFailTpl: "", //提现失败通知(类目: 服装/鞋/箱包 )
          MembersLevelChangeTpl: "", //会员等级变更通知(类目: 服装/鞋/箱包 )
        },
      };
    },
    created() {

    },
    methods: {
      //版权信息
      GetWeiXinAppConfig() {
        this.appMallSubscribeMsg.MallBaseId = this.getLocalStorage().MallBaseId;
        this.appMallDistributionMsg.MallBaseId = this.getLocalStorage().MallBaseId;
        this.apipost("/api/Tenant/GetMiniPrograme", {
          MallBaseId: this.getLocalStorage().MallBaseId,
        }, res => {
          if (res.data.resultCode == 1) {
            //商城订阅消息
            this.appMallSubscribeMsg.OrderSuccessTpl = res.data.data.OrderSuccessTpl;
            this.appMallSubscribeMsg.OrderCancelTpl = res.data.data.OrderCancelTpl;
            this.appMallSubscribeMsg.OrderDeliverGoodsTpl = res.data.data.OrderDeliverGoodsTpl;
            this.appMallSubscribeMsg.RefundTpl = res.data.data.RefundTpl;
            this.appMallSubscribeMsg.ActiveStateTpl = res.data.data.ActiveStateTpl;
            this.appMallSubscribeMsg.AuditResultTpl = res.data.data.AuditResultTpl;
            //分销订阅消息
            this.appMallDistributionMsg.ReflectSuccessTpl = res.data.data.ReflectSuccessTpl;
            this.appMallDistributionMsg.ReflectFailTpl = res.data.data.ReflectFailTpl;
            this.appMallDistributionMsg.MembersLevelChangeTpl = res.data.data.MembersLevelChangeTpl;

          } else {
            this.Info(res.data.message);
          }
        })
      },
      //修改商城订阅消息
      UpdateMallSubscribeMsg() {
        this.apipost("/api/Tenant/SetMiniProgramMallSubscribe", this.appMallSubscribeMsg, res => {
          if (res.data.resultCode == 1) {
            this.GetWeiXinAppConfig();
            this.Success("操作成功!");
          } else {
            this.Info(res.data.message);
          }
        })
      },
      //修改分销订阅配置信息
      UpdateMallDistributionMsg() {
        this.apipost("/api/Tenant/SetMiniProgramMallDistribution", this.appMallDistributionMsg, res => {
          if (res.data.resultCode == 1) {
            this.GetWeiXinAppConfig();
            this.Success("操作成功!");
          } else {
            this.Info(res.data.message);
          }
        })
      },
    },
    mounted() {
      this.GetWeiXinAppConfig();
    }
  };

</script>
