<!DOCTYPE html>
<html>
<head>
    <title>门店推广</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
	<Card v-show="!showViewList">
        <p slot="title">渠道追踪</p>
        <Row :gutter="16">
            <div class="search-group">
                <i-col span="3">
                    <i-select v-model="q.storeId" placeholder="门店"  @on-change="queryChangeGoodsByStore">
                        <i-option v-for="store in queryStoreList" :value="store.id" :key="store.id">{{store.storeName}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.goodsId" placeholder="商品" >
                        <i-option v-for="goods in queryGoodsList" :value="goods.goodsId" :key="goods.goodsId">{{goods.goodsName}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.promName" @on-enter="query" placeholder="名称"/>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.promType" placeholder="推广类型" label-in-value>
                        <i-option value="00">活动
                        </i-option>
                        <i-option value="10">商品
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.isFinished" placeholder="活动状态" label-in-value>
                        <i-option value="2">未开始
                        </i-option>
                        <i-option value="1">进行中
                        </i-option>
                        <i-option value="0">已结束
                        </i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
            <div class="buttons-group">
                #if($shiro.hasPermission("mkstoreprom:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                <a href="${rc.contextPath}/mk/mkcenter.html">
                    <i-button type="warning" ><i class="fa"></i>&nbsp;返回营销中心页</i-button>
                </a>
                <!--#if($shiro.hasPermission("mkstoreprom:update"))-->
                <!--<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>-->
                <!--#end-->
                <!--#if($shiro.hasPermission("mkstoreprom:delete"))-->
                <!--<i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>-->
                <!--#end-->
            </div>
        </Row>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </Card>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
		<i-form ref="formValidate" :model="mkStoreProm" :rules="ruleValidate" :label-width="110">
            <Form-item label="推广名称" prop="promName">
                <i-input v-model="mkStoreProm.promName" placeholder="推广名称"/>
            </Form-item>
            <Form-item label="所属三方商户" prop="thirdMerchSn">
                <i-select v-model="mkStoreProm.thirdMerchSn" placeholder="所属三方商户" style="width: 268px;" @on-change="changeStore" label-in-value v-show="!isOperatorShow">
                    <i-option v-for="thirdMerchant in thirdMerchantBizList" :value="thirdMerchant.thirdMerchSn" :key="thirdMerchant.thirdMerchSn">{{thirdMerchant.thirdPartyMerchName}}</i-option>
                </i-select>
                <i-select v-model="mkStoreProm.thirdMerchSn" placeholder="所属三方商户" style="width: 268px;" @on-change="changeStore" label-in-value v-show="isOperatorShow" disabled>
                    <i-option v-for="thirdMerchant in thirdMerchantBizList" :value="thirdMerchant.thirdMerchSn" :key="thirdMerchant.thirdMerchSn">{{thirdMerchant.thirdPartyMerchName}}</i-option>
                </i-select>
            </Form-item>
            <Form-item label="所属门店" prop="storeId">
                <i-select v-model="mkStoreProm.storeId" placeholder="所属门店" style="width: 268px;" label-in-value  @on-change="changeGoods" v-show="!isOperatorShow">
                    <i-option v-for="store in storeList" :value="store.id" :key="store.id">{{store.storeName}}
                    </i-option>
                </i-select>
                <i-select v-model="mkStoreProm.storeId" placeholder="所属门店" style="width: 268px;" label-in-value  @on-change="changeGoods" v-show="isOperatorShow" disabled>
                    <i-option v-for="store in storeList" :value="store.id" :key="store.id">{{store.storeName}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="推广起始时间" prop="promBegTime">
                <Date-picker type="datetime" format="yyyy-MM-dd HH:mm:ss" v-model="mkStoreProm.promBegTime" placeholder="推广起始时间"
                             style="width: 240px" v-show="!isOperatorShow"></Date-picker>
                <Date-picker type="datetime" format="yyyy-MM-dd HH:mm:ss" v-model="mkStoreProm.promBegTime" placeholder="推广起始时间"
                             style="width: 240px" v-show="isOperatorShow" disabled></Date-picker>
            </Form-item>
            <Form-item label="推广结束时间" prop="promEndTime">
                <!--<i-input v-model="mkStoreProm.promEndTime" placeholder="推广结束时间"/>-->
                <Date-picker type="datetime" format="yyyy-MM-dd HH:mm:ss" v-model="mkStoreProm.promEndTime" placeholder="推广结束时间"
                             style="width: 240px;"/>
            </Form-item>
            <Form-item label="推广分类" prop="promType">
                <i-select v-model="mkStoreProm.promType" placeholder="推广分类" style="width: 268px;" label-in-value @on-change="changeProm" v-show="!isOperatorShow">
                    <!--<i-option value="00">活动-->
                    <!--</i-option>-->
                    <i-option value="10">商品
                    </i-option>
                </i-select>
                <i-select v-model="mkStoreProm.promType" placeholder="推广分类" style="width: 268px;" label-in-value @on-change="changeProm" v-show="isOperatorShow" disabled>
                    <!--<i-option value="00">活动-->
                    <!--</i-option>-->
                    <i-option value="10">商品
                    </i-option>
                </i-select>
            </Form-item>
            <!--<Form-item label="活动分类" prop="promTypeId">-->
                <!--<i-input v-model="mkStoreProm.promTypeId" placeholder="活动分类"/>-->
            <!--</Form-item>-->
            <Form-item label="推广活动" prop="storeTopicId" v-show="isPomTypeBy00">
                <i-select v-model="mkStoreProm.storeTopicId" placeholder="推广活动" style="width: 268px;" label-in-value v-show="!isOperatorShow" >
                    <i-option v-for="topic in storeTopicList" :value="topic.id" :key="topic.id">{{topic.title}}
                    </i-option>
                </i-select>
                <i-select v-model="mkStoreProm.storeTopicId" placeholder="推广活动" style="width: 268px;" label-in-value v-show="isOperatorShow" disabled >
                    <i-option v-for="topic in storeTopicList" :value="topic.id" :key="topic.id">{{topic.title}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="推广商品" prop="goodsId" v-show="isPomTypeBy10">
                <i-select v-model="mkStoreProm.goodsId" placeholder="推广商品" style="width: 268px;" label-in-value v-show="!isOperatorShow" >
                    <i-option v-for="goods in goodsList" :value="goods.goodsId" :key="goods.goodsId">{{goods.goodsName}}
                    </i-option>
                </i-select>
                <i-select v-model="mkStoreProm.goodsId" placeholder="推广商品" style="width: 268px;" label-in-value v-show="isOperatorShow" disabled >
                    <i-option v-for="goods in goodsList" :value="goods.goodsId" :key="goods.goodsId">{{goods.goodsName}}
                    </i-option>
                </i-select>
            </Form-item>
            <Form-item label="推广渠道" prop="promChnlId">
                <i-select v-model="mkStoreProm.promChnlId" placeholder="推广渠道" style="width: 268px;" label-in-value v-show="!isOperatorShow">
                    <i-option v-for="chnl in promChnlList" :value="chnl.promChnlId" :key="chnl.promChnlId">{{chnl.promChnName}}
                    </i-option>
                </i-select>
                <i-select v-model="mkStoreProm.promChnlId" placeholder="推广渠道" style="width: 268px;" label-in-value v-show="isOperatorShow" disabled>
                    <i-option v-for="chnl in promChnlList" :value="chnl.promChnlId" :key="chnl.promChnlId">{{chnl.promChnName}}
                    </i-option>
                </i-select>
                #if($shiro.hasPermission("mkstoreprom:save"))
                <i-button type="info" @click="addPromChnl" v-show="!isOperatorShow"><i class="fa fa-plus"></i>&nbsp;新增推广渠道</i-button>
                #end
            </Form-item>
            <Form-item label="是否投放" prop="isPut">
                <Radio-group v-model="mkStoreProm.isPut" v-show="!isOperatorShow">
                    <Radio label="1">
                        <span>否</span>
                    </Radio>
                    <Radio label="0">
                        <span>是</span>
                    </Radio>
                </Radio-group>
                <Radio-group v-model="mkStoreProm.isPut" v-show="isOperatorShow">
                    <Radio label="1" disabled>
                        <span>否</span>
                    </Radio>
                    <Radio label="0" disabled>
                        <span>是</span>
                    </Radio>
                </Radio-group>
            </Form-item>
            <!--<Form-item label="是否结束" prop="isFinished">
                <Radio-group v-model="mkStoreProm.isFinished" v-show="!isOperatorShow">
                    <Radio label="1">
                        <span>否</span>
                    </Radio>
                    <Radio label="0">
                        <span>是</span>
                    </Radio>
                </Radio-group>
                <Radio-group v-model="mkStoreProm.isFinished" v-show="isOperatorShow">
                    <Radio label="1" disabled>
                        <span>否</span>
                    </Radio>
                    <Radio label="0" disabled>
                        <span>是</span>
                    </Radio>
                </Radio-group>
            </Form-item>-->
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
            </Form-item>
        </i-form>
	</Card>
    <Card v-show="!showChnlList">
        <p slot="title">{{title}}</p>
        <i-form ref="chnlFormValidate" :model="mkStorePromChnl" :rules="chnlRuleValidate" :label-width="110">
            <Form-item label="推广渠道名称" prop="promChnName">
                <i-input v-model="mkStorePromChnl.promChnName" placeholder="推广渠道名称"/>
            </Form-item>
            <i-button type="primary" @click="chnlHandleSubmit('formValidate')">提交</i-button>
            <i-button type="warning" @click="reloadChnl" style="margin-left: 8px"/>返回</i-button>
            </Form-item>
        </i-form>
    </Card>
    <Card v-show="!showInfoList">
        <p slot="title">{{title}}</p>
        <i-form :label-width="150">
            <Form-item label="推广名称" prop="promName">
                {{mkStoreProm.promName}}
            </Form-item>
            <Form-item label="推广起始时间" prop="promBegTime">
                {{mkStoreProm.inValidDate}}
            </Form-item>

            <Form-item label="推广内容">
                {{mkStoreProm.promType=='00'?mkStoreProm.topicTitle:mkStoreProm.goodsName}}
            </Form-item>
            <Form-item label="推广渠道" prop="promChnlId">
                {{mkStoreProm.promChnName}}
            </Form-item>
            <Form-item label="是否投放" prop="isPut">
                {{mkStoreProm.isPut==1?'否':'是'}}
            </Form-item>
            <Form-item label="是否结束" prop="isFinished">
                {{mkStoreProm.isFinished==1?'否':'是'}}
            </Form-item>
            <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
            <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>
<div id="qrcode" style="display: none;padding: 10px;">
    <div id="qrcodeCanvas" style="margin: 20px 0 0 55px"></div>
</div>
<div id="qrcImg" style="display:none">
    <img class="qrcImg align-center" height="300px" width="300px" src="">
</div>


<script src="${rc.contextPath}/js/mk/mkstoreprom.js?_${date.systemTime}"></script>
</body>
</html>