Joe 3 lat temu
rodzic
commit
d262882a1e

+ 0 - 0
src/components/PanThumb/index.vue → src/components/QrCode/PanThumb/index.vue


+ 1 - 4
src/components/SelectDay/index.vue

@@ -176,10 +176,7 @@ export default {
 
     collectClickCalendar: {
       get() {
-        if(this.cycle == null ){
-          this.cycle = []
-        }
-        return this.cycle;
+        return this.cycle.map(calendar=>+calendar);
       },
       set(val) {
         if( val == null ){

+ 57 - 37
src/views/coupon/Coupon_CreateCoupon.vue

@@ -73,9 +73,13 @@
         </el-form-item>
       </el-form>
       <el-table :data="couponList">
-        <af-table-column label="优惠券标识" align="center" prop="couponSign" />
-        <af-table-column label="优惠券名称" align="center" prop="couponName" />
-        <af-table-column label="状态" align="center">
+        <af-table-column
+          label="优惠券标识"
+          align="left"
+          prop="couponRemark"
+          fixed="left"
+        />
+        <af-table-column label="状态" align="left">
           <template slot-scope="scope">
             <el-switch
               v-model="scope.row.status"
@@ -85,7 +89,7 @@
             ></el-switch>
           </template>
         </af-table-column>
-        <af-table-column label="卡片类型" align="center">
+        <af-table-column label="卡片类型" align="left">
           <template slot-scope="scope">
             {{
               scope.row.couponType == 1
@@ -99,12 +103,17 @@
             }}
             {{
               scope.row.couponType == 3
-                ? "兑换券" + "--商品:" + scope.row.couponDetails
+                ? "兑换券" + "--商品:" + scope.row.couponName
                 : ""
             }}
           </template>
         </af-table-column>
-        <af-table-column label="使用门槛" align="center">
+        <af-table-column
+          label="优惠券说明"
+          align="left"
+          prop="couponDetails"
+        />
+        <af-table-column label="使用门槛" align="left">
           <template slot-scope="scope">
             {{
               scope.row.couponType == 1 || scope.row.couponType == 2
@@ -116,18 +125,18 @@
             {{ scope.row.couponType == 3 ? "------------" : "" }}
           </template>
         </af-table-column>
-        <af-table-column label="适用油品" align="center">
+        <af-table-column label="适用" align="left">
           <template slot-scope="scope">
             {{
               scope.row.couponType == 1 || scope.row.couponType == 2
-                ? (scope.row.oilNameList || []).toString()
+                ? "适用油品:" + (scope.row.oilNameList || []).toString()
                 : ""
             }}
-            {{ scope.row.couponType == 3 ? "------------" : "" }}
+            {{ scope.row.couponType == 3 ? "核销机构:" : "" }}
           </template>
         </af-table-column>
 
-        <af-table-column label="使用状态" align="center">
+        <af-table-column label="使用状态" align="left">
           <template slot-scope="scope">
             {{
               "共生成了" +
@@ -141,7 +150,7 @@
           </template>
         </af-table-column>
 
-        <af-table-column label="有效期内使用限制" align="center">
+        <af-table-column label="有效期内使用限制" align="left">
           <template slot-scope="scope">
             {{
               (scope.row.effectiveTimeType == 1
@@ -153,7 +162,7 @@
           </template>
         </af-table-column>
 
-        <af-table-column label="领取限制" align="center">
+        <af-table-column label="领取限制" align="left">
           <template slot-scope="scope">
             {{
               "单用户最多持有" +
@@ -165,7 +174,7 @@
           </template>
         </af-table-column>
 
-        <af-table-column label="优惠叠加" align="center">
+        <af-table-column label="优惠叠加" align="left">
           <template slot-scope="scope">
             {{
               scope.row.couponType == 1 || scope.row.couponType == 2
@@ -183,7 +192,7 @@
 
         <af-table-column
           label="操作"
-          align="center"
+          align="left"
           class-name="small-padding fixed-width"
           width="120px"
         >
@@ -222,24 +231,24 @@
       status-icon
     >
       <el-form
-        ref="dialogForm"
+        ref="createForm"
         :model="createForm"
         :rules="rules"
         label-width="180px"
       >
         <el-form-item
           label="优惠劵标识(给油站备注)"
-          prop="couponSign"
+          prop="couponRemark"
           :rules="{
             required: true,
-            message: '请填写优惠券标识',
+            message: '标签不能为空,不需要请删除此项',
             trigger: 'blur',
           }"
         >
           <input
             type="text"
             class="form-control"
-            v-model="createForm.couponSign"
+            v-model="createForm.couponRemark"
             style="width: 180px"
           />
         </el-form-item>
@@ -494,10 +503,7 @@
             <el-radio label="0">不叠加优惠方案</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item
-          label="有效期内可用时间控制"
-          prop="availableControl"
-        >
+        <el-form-item label="有效期内可用时间控制" prop="availableControl">
           <el-radio-group
             v-model="createForm.availableControl"
             @change="availableControlChange"
@@ -545,7 +551,7 @@
                   type="selection"
                 ></el-table-column>
                 <el-table-column prop="deptName" label="机构"></el-table-column>
-                <el-table-column label="添加" width="60px" align="center">
+                <el-table-column label="添加" width="60px" align="left">
                   <template slot-scope="scope">
                     <el-button
                       type="text"
@@ -594,7 +600,7 @@
                   type="selection"
                 ></el-table-column>
                 <el-table-column prop="deptName" label="姓名"></el-table-column>
-                <el-table-column label="移除" width="60px" align="center">
+                <el-table-column label="移除" width="60px" align="left">
                   <template slot-scope="scope">
                     <el-button
                       type="text"
@@ -662,20 +668,23 @@ export default {
       }
       callback();
     };
-    let validateAvailableControl = (rule, value, callback)=>{
-      if(this.createForm.availableControl == 1 || this.createForm.availableControl == 2){
-        if(this.createForm.cycleDaysList.length == 0){
+    let validateAvailableControl = (rule, value, callback) => {
+      if (
+        this.createForm.availableControl == 1 ||
+        this.createForm.availableControl == 2
+      ) {
+        if (this.createForm.cycleDaysList.length == 0) {
           callback(new Error("请选择时间"));
           return;
         }
       }
-      if(this.createForm.availableControl == 3){
-        if(this.createForm.cycleDaysList.length == 0){
+      if (this.createForm.availableControl == 3) {
+        if (this.createForm.cycleDaysList.length == 0) {
           callback(new Error("请选择日期"));
           return;
         }
       }
-      callback()
+      callback();
     };
     // let validateVerificationList = (rule, value, callback)=>{
     //   if(this.createForm.couponType == 3){
@@ -691,7 +700,7 @@ export default {
       pageStatus: 4,
       // 油站设备管理表格数据
       createForm: {
-        couponSign: "",
+        couponRemark: "",
         couponName: "",
         couponDetails: "",
         couponThresholdAmt: 0,
@@ -748,8 +757,12 @@ export default {
           { required: true, message: "请输入有效期类型", trigger: "change" },
           { validator: validateEffectiveTimeType, trigger: "change" },
         ],
-        availableControl:[
-          { required: true, message: "请选择有效期内时间控制", trigger: "change" },
+        availableControl: [
+          {
+            required: true,
+            message: "请选择有效期内时间控制",
+            trigger: "change",
+          },
           { validator: validateAvailableControl, trigger: "change" },
         ],
         // verificationList:[
@@ -1046,7 +1059,7 @@ export default {
       this.getList();
     },
     deviceNoInput(value) {
-      this.dialogForm.posQueue = value;
+      this.createForm.posQueue = value;
     },
     /** 重置按钮操作 */
     resetQuery() {
@@ -1057,7 +1070,7 @@ export default {
     handleAdd() {
       this.title = "添加优惠券";
       this.createForm = {
-        couponSign: "",
+        couponRemark: "",
         couponName: "",
         couponDetails: "",
         couponThresholdAmt: 0,
@@ -1084,14 +1097,21 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       // // 查找自己已经选中的枪号
-      this.createForm = JSON.parse(JSON.stringify(row));
+      const createForm = JSON.parse(JSON.stringify(row));
+      if (createForm.appointedDaysList == null) {
+        createForm.appointedDaysList = [];
+      }
+      if (createForm.cycleDaysList == null) {
+        createForm.cycleDaysList = [];
+      }
+      this.createForm = createForm;
       this.title = "修改油站设备管理";
       this.open = true;
     },
 
     /** 提交按钮 */
     submitForm() {
-      this.$refs["dialogForm"].validate((valid) => {
+      this.$refs["createForm"].validate((valid) => {
         if (valid) {
           if (!!this.createForm.id) {
             updateInfo(this.createForm)

+ 439 - 102
src/views/coupon/Coupon_CreateIssue.vue

@@ -13,7 +13,7 @@
         :inline="true"
         label-width="88px"
       >
-      <!--
+        <!--
         <el-form-item label="设备类型" prop="deviceType">
           <el-select
             v-model="createForm.deviceType"
@@ -36,7 +36,7 @@
         </el-form-item>
 -->
         <el-form-item>
-        <!--
+          <!--
           <el-button
             type="cyan"
             icon="el-icon-search"
@@ -61,9 +61,191 @@
           >
         </el-form-item>
       </el-form>
-      <el-table :data="issueList">
-        <af-table-column label="发放方式名称" align="center" prop="issueName" />
-        <af-table-column label="状态" align="center">
+      <el-table :data="issueList" >
+        <af-table-column type="expand">
+          <template slot-scope="props">
+            <el-table :data="props.row.couponList"
+              :show-header="false"
+              :highlight-current-row="false"
+               style="width: 90vw"
+            >
+              <af-table-column label="名城" align="left">
+                 <template slot-scope="scope">
+                 {{ '优惠券:' }}<b>{{scope.row.couponRemark}}</b>
+                </template>
+              </af-table-column>
+              <af-table-column label="卡片类型" align="left">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.couponType == 1
+                      ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
+                      : ""
+                  }}
+                  {{
+                    scope.row.couponType == 2
+                      ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
+                      : ""
+                  }}
+                  {{
+                    scope.row.couponType == 3
+                      ? "兑换券" + "--商品:" + scope.row.couponName
+                      : ""
+                  }}
+                </template>
+              </af-table-column>
+              <af-table-column label="状态" align="left">
+                <template slot-scope="scope">
+                {{ scope.row.status == '0'? '启用状态': ''}}
+                {{ scope.row.status == '1'? '停用状态': ''}}
+                </template>
+              </af-table-column>
+            </el-table>
+              
+            <!--
+            <el-table :data="props.row.couponIssueRelations">
+              <af-table-column
+                label="优惠券标识"
+                align="left"
+                prop="couponRemark"
+                disabled
+              />
+              <af-table-column label="状态" align="left">
+                <template slot-scope="scope">
+                  <el-switch
+                    v-model="scope.row.status"
+                    active-value="1"
+                    inactive-value="0"
+                    @change="handleStatusChange(scope.row)"
+                  ></el-switch>
+                </template>
+              </af-table-column>
+              <af-table-column label="卡片类型" align="left">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.couponType == 1
+                      ? "现金劵" + "--面值:" + scope.row.couponAmt + "元"
+                      : ""
+                  }}
+                  {{
+                    scope.row.couponType == 2
+                      ? "折扣券" + "--折扣:" + scope.row.couponAmt + "% "
+                      : ""
+                  }}
+                  {{
+                    scope.row.couponType == 3
+                      ? "兑换券" + "--商品:" + scope.row.couponName
+                      : ""
+                  }}
+                </template>
+              </af-table-column>
+              <af-table-column
+                label="优惠券说明"
+                align="left"
+                prop="couponDetails"
+              />
+              <af-table-column label="使用门槛" align="left">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.couponType == 1 || scope.row.couponType == 2
+                      ? scope.row.couponThresholdAmt == 0
+                        ? "无门槛"
+                        : "满" + scope.row.couponThresholdAmt + "元可用"
+                      : ""
+                  }}
+                  {{ scope.row.couponType == 3 ? "------------" : "" }}
+                </template>
+              </af-table-column>
+              <af-table-column label="适用" align="left">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.couponType == 1 || scope.row.couponType == 2
+                      ? "适用油品:" + (scope.row.oilNameList || []).toString()
+                      : ""
+                  }}
+                  {{ scope.row.couponType == 3 ? "核销机构:" : "" }}
+                </template>
+              </af-table-column>
+
+              <af-table-column label="使用状态" align="left">
+                <template slot-scope="scope">
+                  {{
+                    "共生成了" +
+                    scope.row.couponNum +
+                    "张,已领取" +
+                    scope.row.couponCumulativeNum +
+                    "张,已使用" +
+                    scope.row.couponUseNum +
+                    "张"
+                  }}
+                </template>
+              </af-table-column>
+
+              <af-table-column label="有效期内使用限制" align="left">
+                <template slot-scope="scope">
+                  {{
+                    (scope.row.effectiveTimeType == 1
+                      ? scope.row.effectiveTime[0] +
+                        "到" +
+                        scope.row.effectiveTime[1]
+                      : "用户领取" + scope.row.effectiveDayNum + "天内有效") +
+                    "内有效"
+                  }}
+                  {{ translateTime(scope.row) }}
+                </template>
+              </af-table-column>
+
+              <af-table-column label="领取限制" align="left">
+                <template slot-scope="scope">
+                  {{
+                    "单用户最多持有" +
+                    scope.row.couponHoldNum +
+                    "张,累计可拥有" +
+                    scope.row.couponReceiveNum +
+                    "张"
+                  }}
+                </template>
+              </af-table-column>
+
+              <af-table-column label="优惠叠加" align="left">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.couponType == 1 || scope.row.couponType == 2
+                      ? ["不", ""][scope.row.isCardFlag] +
+                        "可用电子卡," +
+                        ["不", ""][scope.row.isGradeFlag] +
+                        "可用等级优惠," +
+                        ["不", ""][scope.row.isMarketFlag] +
+                        "可用优惠方案"
+                      : ""
+                  }}
+                  {{ scope.row.couponType == 3 ? "------------" : "" }}
+                </template>
+              </af-table-column>
+
+              <af-table-column
+                label="操作"
+                align="left"
+                class-name="small-padding fixed-width"
+                width="120px"
+              >
+                <template slot-scope="scope">
+                  <el-button
+                    size="mini"
+                    type="text"
+                    icon="el-icon-edit"
+                    @click="handleUpdate(scope.row)"
+                    v-if="scope.row.editFlag"
+                    >修改</el-button
+                  >
+                </template>
+              </af-table-column>
+            </el-table>
+            -->
+          </template>
+        </af-table-column>
+
+        <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
+        <af-table-column label="状态" align="left">
           <template slot-scope="scope">
             <el-switch
               v-model="scope.row.status"
@@ -73,36 +255,51 @@
             ></el-switch>
           </template>
         </af-table-column>
-        <af-table-column label="发放方式类型" align="center">
+        <af-table-column label="活动名称" align="left" prop="issueName" />
+        <af-table-column label="类型" align="left">
           <template slot-scope="scope">
-            {{scope.row.issueType == '1'? '消费发放':''}}
-            {{scope.row.issueType == '2'? '网页方式':''}}
-            {{scope.row.issueType == '3'? '二维码-静态码':''}}
-            {{scope.row.issueType == '4'? '支付成功后的领取位':''}}
+            {{ scope.row.issueType == "1" ? "消费发放" : "" }}
+            {{ scope.row.issueType == "2" ? "网页方式、二维码-静态码" : "" }}
+            {{ scope.row.issueType == "3" ? "支付成功后的领取位" : "" }}
           </template>
         </af-table-column>
-        <af-table-column label="发放门槛" align="center">
+        <af-table-column label="发放门槛" align="left">
           <template slot-scope="scope">
-            {{scope.row.issueType == '1' ?  scope.row.discountThresholdAmt == '0' ? '无门槛,消费都发放': '满' + scope.row.discountThresholdAmt + '元发放' :''}}
-            {{scope.row.issueType != '1'? '-------':''}}
+            {{
+              scope.row.issueType == "1"
+                ? scope.row.discountThresholdAmt == "0"
+                  ? "无门槛,消费都发放"
+                  : "满" + scope.row.discountThresholdAmt + "元发放"
+                : ""
+            }}
+            {{ scope.row.issueType != "1" ? "-------" : "" }}
           </template>
         </af-table-column>
-        <af-table-column label="领取限制" align="center">
+        <af-table-column label="领取限制" align="left">
           <template slot-scope="scope">
-            {{scope.row.issueType == '1'? '-------':''}}
-            {{scope.row.issueType != '1' ? '用户能进入这个领取界面' + scope.row.giveCount + '次,一次可以领取'+  scope.row.giveLimit + '张优惠券': ''}}
+            {{ scope.row.issueType == "1" ? "-------" : "" }}
+            {{
+              scope.row.issueType != "1"
+                ? "单个用户能进入这个领取界面" +
+                  scope.row.giveCount +
+                  "次,一次可以领取" +
+                  scope.row.giveLimit +
+                  "张优惠券"
+                : ""
+            }}
           </template>
         </af-table-column>
-        <af-table-column label="可领取时间段" align="center">
+        <af-table-column label="可领取时间段" align="left">
           <template slot-scope="scope">
             {{ translateTime(scope.row) }}
           </template>
         </af-table-column>
-        <!-- <af-table-column label="面值" align="center" prop="gunNo" /> -->
-        <!-- <af-table-column label="有效期" align="center" prop="deviceFactory" /> -->
+        <!-- <af-table-column label="面值" align="left" prop="gunNo" /> -->
+        <!-- <af-table-column label="有效期" align="left" prop="deviceFactory" /> -->
+        <!--
         <af-table-column
           label="操作"
-          align="center"
+          align="left"
           class-name="small-padding fixed-width"
           width="120px"
         >
@@ -116,6 +313,7 @@
             >
           </template>
         </af-table-column>
+        -->
       </el-table>
       <pagination
         :hidden="total > 0 ? false : true"
@@ -141,7 +339,31 @@
         :rules="rules"
         label-width="180px"
       >
-        <el-form-item label="发放方式名称" prop="issueName">
+        <el-form-item
+          label="发放标识(给油站备注)"
+          prop="issueRemark"
+          :rules="{
+            required: true,
+            message: '请填入方案方式标识',
+            trigger: 'blur',
+          }"
+        >
+          <input
+            type="text"
+            class="form-control"
+            v-model="createForm.issueRemark"
+            style="width: 180px"
+          />
+        </el-form-item>
+        <el-form-item
+          label="活动名称(给用户展示)"
+          prop="issueName"
+          :rules="{
+            required: true,
+            message: '请填入活动名称',
+            trigger: 'blur',
+          }"
+        >
           <input
             type="text"
             class="form-control"
@@ -149,28 +371,57 @@
             style="width: 180px"
           />
         </el-form-item>
-        <el-form-item label="发放类型" prop="issueType">
+        <el-form-item
+          label="发放类型"
+          prop="issueType"
+          :rules="{
+            required: true,
+            message: '请选择发放类型',
+            trigger: 'change',
+          }"
+        >
           <el-radio-group v-model="createForm.issueType">
             <div>
               <el-radio label="1">消费发放</el-radio>
-              <el-radio label="2">网页方式</el-radio>
-              <el-radio label="3">二维码-静态码</el-radio>
             </div>
             <div>
-              <el-radio label="4">支付成功后的领取位(只能设置一次)</el-radio>
+              <el-radio label="2">网页方式、二维码-静态码</el-radio>
+            </div>
+            <div>
+              <el-radio label="3">支付成功后的领取位(只能设置一次)</el-radio>
             </div>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="能进入的次数" prop="giveCount" v-if="createForm.issueType!=1">
-            用户能进入这个领取界面 <input
+        <el-form-item
+          label="能进入的次数"
+          prop="giveCount"
+          v-if="createForm.issueType != 1"
+          :rules="{
+            required: createForm.issueType != 1,
+            message: '请填入能进入的次数',
+            trigger: 'blur',
+          }"
+        >
+          单个用户能进入这个领取界面
+          <input
             type="text"
             class="form-control d-inline-block"
             v-model.number="createForm.giveCount"
             style="width: 80px"
-          /> 次
+          />
+          次
         </el-form-item>
 
-        <el-form-item label="一次能领取几张次数" prop="giveLimit" v-if="createForm.issueType!=1">
+        <el-form-item
+          label="一次能领取几张次数"
+          prop="giveLimit"
+          v-if="createForm.issueType != 1"
+          :rules="{
+            required: createForm.issueType != 1,
+            message: '请填入一次能领取几张次数',
+            trigger: 'blur',
+          }"
+        >
           用户进入后一次能领取<input
             type="text"
             class="form-control d-inline-block"
@@ -178,20 +429,11 @@
             style="width: 80px"
           />张
         </el-form-item>
-        <!--
-        <el-form-item label="展示位选择" prop="showIdList" v-if="createForm.issueType==2">
-          <el-checkbox-group v-model="createForm.showIdList">
-            <div>
-              <el-checkbox label="1">支付成功后的展示位</el-checkbox>
-              <el-checkbox label="2" disabled>待定</el-checkbox>
-            </div>
-            <div>
-              <el-checkbox label="3" disabled>更多位置后续开放</el-checkbox>
-            </div>
-          </el-checkbox-group>
-        </el-form-item>
-        -->
-        <el-form-item label="发放门槛" prop="discountThresholdAmt" v-if="createForm.issueType==1">
+        <el-form-item
+          label="发放门槛"
+          prop="discountThresholdAmt"
+          v-if="createForm.issueType == 1"
+        >
           消费达到
           <input
             type="text"
@@ -201,43 +443,44 @@
           />元时,系统自动发放
         </el-form-item>
         <el-form-item label="可领取时间段" prop="availableControl">
-          <el-radio-group
-            v-model="createForm.availableControl"
-            @change="availableControlChange"
-          >
-            <div>
-              <div>
-                <el-radio label="0">一直都可用</el-radio>
-                <el-radio label="1">每周指定日</el-radio>
-              </div>
+          <div>
+            <el-radio-group
+              v-model="createForm.availableControl"
+              @change="availableControlChange"
+            >
               <div>
-                <el-radio label="2">每月指定日</el-radio>
-                <el-radio label="3">固定指定日</el-radio>
+                <div>
+                  <el-radio label="0">一直都可用</el-radio>
+                  <el-radio label="1">每周指定日</el-radio>
+                </div>
+                <div>
+                  <el-radio label="2">每月指定日</el-radio>
+                  <el-radio label="3">固定指定日</el-radio>
+                </div>
               </div>
-            </div>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item
-          label="可用时间选择"
-          prop="isMarketFlag1"
-          v-if="
-            createForm.availableControl == 1 ||
-            createForm.availableControl == 2 ||
-            createForm.availableControl == 3
-          "
-        >
-          <div>
+            </el-radio-group>
+          </div>
+          <div
+            v-if="
+              createForm.availableControl == 1 ||
+              createForm.availableControl == 2 ||
+              createForm.availableControl == 3
+            "
+            style="margin-top: 10px"
+          >
             <select-day
               :type="createForm.availableControl"
               :day.sync="createForm.appointedDaysList"
               :cycle.sync="createForm.cycleDaysList"
-            ></select-day>
+            >
+            </select-day>
           </div>
         </el-form-item>
         <el-form-item
           label="此领取方式下的优惠券"
           prop="couponIssueRelationList"
         >
+          (用于用户领取)
         </el-form-item>
 
         <div>
@@ -261,7 +504,7 @@
                   type="selection"
                 ></el-table-column>
                 <el-table-column
-                  prop="couponName"
+                  prop="couponRemark"
                   label="优惠券"
                 ></el-table-column>
                 <el-table-column label="添加" width="60px" align="center">
@@ -313,7 +556,7 @@
                   type="selection"
                 ></el-table-column>
                 <el-table-column
-                  prop="couponName"
+                  prop="couponRemark"
                   label="优惠券"
                 ></el-table-column>
                 <el-table-column label="移除" width="60px" align="center">
@@ -338,6 +581,20 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+    
+      <el-dialog
+      :visible.sync="exportQrDialog"
+      width="600px"
+      append-to-body
+      title="导出标签"
+    >
+      <div>
+        <qr :text="currentExport.text" @downloadImg="downloadImg" name="总标签码">
+          <div>网站:你好呀</div>
+        </qr>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -352,6 +609,7 @@ import {
   changeManageStatus,
 } from "@/api/station/manage";
 import { listPrice } from "@/api/station/price";
+import qr from "@/components/QrCode";
 
 import {
   addInfo,
@@ -360,7 +618,7 @@ import {
   changeCouponStatus,
   addIssue,
   listIssue,
-  upIssueStatus
+  upIssueStatus,
 } from "@/api/coupon";
 import SelectDay from "@/components/SelectDay";
 
@@ -370,21 +628,50 @@ export default {
     let validateGunNo = (rule, value, callback) => {
       callback();
     };
+    let validateAvailableControl = (rule, value, callback) => {
+      if (
+        this.createForm.availableControl == 1 ||
+        this.createForm.availableControl == 2
+      ) {
+        if (this.createForm.cycleDaysList.length == 0) {
+          callback(new Error("请选择时间"));
+          return;
+        }
+      }
+      if (this.createForm.availableControl == 3) {
+        if (this.createForm.appointedDaysList.length == 0) {
+          callback(new Error("请选择日期"));
+          return;
+        }
+      }
+      callback();
+    };
+    let validateCouponIssueRelationList = (rule, value, callback) => {
+      if (this.createForm.couponIssueRelationList.length == 0) {
+        callback(new Error("请选择优惠券"));
+      }
+      callback();
+    };
     return {
       couponEnabledFlag: "1",
-
+      exportQrDialog: true,
       pageStatus: 4,
       createForm: {
-        issueName:'',
+        issueRemark: "",
+        issueName: "",
         showIdList: [],
         availableControl: "0",
         appointedDaysList: [],
         cycleDaysList: [],
-        issueType: "2",
+        issueType: "",
         discountThresholdAmt: "0",
         couponIssueRelationList: [],
-        giveLimit:9999999,
-        giveCount:100,
+        giveLimit: 9,
+        giveCount: 999999,
+      },
+      currentExport:{
+        text:"http://mp.huijy.net/123/coupon/get",
+        type:"你好"
       },
       couponList: [],
       oilNameList: [],
@@ -417,10 +704,27 @@ export default {
         pageSize: 10, // 初始值只能比10大
       },
       // 表单校验
-      rules: {},
+      rules: {
+        availableControl: [
+          {
+            required: true,
+            message: "请选择有效期内时间控制",
+            trigger: "change",
+          },
+          { validator: validateAvailableControl, trigger: "change" },
+        ],
+        couponIssueRelationList: [
+          {
+            required: true,
+            message: "请选择优惠券",
+            trigger: "change",
+          },
+          { validator: validateCouponIssueRelationList, trigger: "change" },
+        ],
+      },
       day: [],
       cycle: [],
-      issueList:[],
+      issueList: [],
       timeSelect: [
         ,
         ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
@@ -462,6 +766,7 @@ export default {
   },
   components: {
     SelectDay: SelectDay,
+    qr,
   },
   created() {
     // this.init();
@@ -478,7 +783,7 @@ export default {
     },
     selectedCouponList() {
       return this.couponList.filter((ele) => {
-        if(this.createForm.couponIssueRelationList == null) {
+        if (this.createForm.couponIssueRelationList == null) {
           this.createForm.couponIssueRelationList = [];
         }
         return this.createForm.couponIssueRelationList.includes(ele.id);
@@ -486,31 +791,44 @@ export default {
     },
     unselectedCouponList() {
       return this.couponList.filter((ele) => {
-        if(this.createForm.couponIssueRelationList == null) {
+        if (this.createForm.couponIssueRelationList == null) {
           this.createForm.couponIssueRelationList = [];
         }
         return !!!this.createForm.couponIssueRelationList.includes(ele.id);
       });
     },
-    getTodayDateString(){
-      const date = new Date()
+    getTodayDateString() {
+      const date = new Date();
       let y = date.getFullYear();
       let m = date.getMonth().toString();
       let s = date.getDate().toString();
-      m = '' + (m.length == 1 ? '0':'') + m
-      s = '' + (s.length == 1 ? '0':'') + s
-      console.log('' + h + ':' + m +':' + s)
-      return '' + y + ':' + m +':' + s
-    }
+      m = "" + (m.length == 1 ? "0" : "") + m;
+      s = "" + (s.length == 1 ? "0" : "") + s;
+      console.log("" + h + ":" + m + ":" + s);
+      return "" + y + ":" + m + ":" + s;
+    },
   },
   methods: {
+    // exportUrl(url){
+    //   this.currentExport.name = emp.personnelName;
+    //   this.currentExport.type = 1;
+
+    //   const encodeStr = "e" + emp.personnelId + "/l" + this.currentExport.labelId + "/";
+    //   const encodedStr = this.base.encode(encodeStr);
+    //   const trimEqualStr = encodedStr.replace(/={1,}$/g, "");
+    //   this.currentExport.text = "https://goto.huijy.net/" + this.deptId + "/" + trimEqualStr;
+    //   this.exportQrDialog = true;
+    // },
+    downloadImg(){
+      console.log(1221);
+    },
     translateTime(row) {
       let timeString = "";
       const availableControleType = row.availableControl;
-      if(availableControleType == 0){
-        return '用户一直都可以领取'
+      if (availableControleType == 0) {
+        return "用户一直都可以领取";
       }
-      timeString = '用户只能在'
+      timeString = "用户只能在";
       if (availableControleType == 1) {
         timeString += "每周的";
       }
@@ -531,8 +849,9 @@ export default {
       timeString = timeString.replace(/(、)$/g, "") + "可以领取劵";
       return timeString;
     },
-    getIssueList(){
-      listIssue(this.queryForm).then((res) => {
+    getIssueList() {
+      listIssue(this.queryForm)
+        .then((res) => {
           if (res.code == 200) {
             if (res.rows == null) {
               this.total = 0;
@@ -553,7 +872,7 @@ export default {
       listInfo({
         pageNum: 1,
         pageSize: 1000,
-        status:1
+        status: 1,
       })
         .then((res) => {
           if (res.code == 200) {
@@ -575,18 +894,19 @@ export default {
       this.createForm.cycleDaysList = [];
       this.createForm = { ...this.createForm };
     },
-    handleMoveLabel(direction, row){
-      console.log(row)
-      if(this.createForm.couponIssueRelationList == null) {
+    handleMoveLabel(direction, row) {
+      console.log(row);
+      if (this.createForm.couponIssueRelationList == null) {
         this.createForm.couponIssueRelationList = [];
       }
 
-      if(direction == "right"){
-        this.createForm.couponIssueRelationList.push(row.id)
-      }else{
-        this.createForm.couponIssueRelationList = this.createForm.couponIssueRelationList.filter((ele)=>{
-          return ele != row.id
-        })
+      if (direction == "right") {
+        this.createForm.couponIssueRelationList.push(row.id);
+      } else {
+        this.createForm.couponIssueRelationList =
+          this.createForm.couponIssueRelationList.filter((ele) => {
+            return ele != row.id;
+          });
       }
     },
     handleFlagChange() {
@@ -705,6 +1025,19 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd() {
+      this.createForm = {
+        issueRemark: "",
+        issueName: "",
+        showIdList: [],
+        availableControl: "0",
+        appointedDaysList: [],
+        cycleDaysList: [],
+        issueType: "",
+        discountThresholdAmt: "0",
+        couponIssueRelationList: [],
+        giveLimit: 9,
+        giveCount: 999999,
+      }
       this.title = "添加优惠券";
       // this.createForm = {
       //   couponName: "",
@@ -737,8 +1070,11 @@ export default {
 
     /** 提交按钮 */
     submitForm() {
+      console.log(123);
       this.$refs["dialogForm"].validate((valid) => {
+        console.log(234);
         if (valid) {
+          console.log(567);
           if (!!this.createForm.id) {
             updateIssue(this.createForm)
               .then((res) => {
@@ -754,6 +1090,7 @@ export default {
                 this.msgError("修改失败了呀~");
               });
           } else {
+            console.log(678);
             addIssue(this.createForm)
               .then((res) => {
                 if (res.code == 200) {

+ 1 - 1
src/views/label/Label_AddLabel.vue

@@ -236,7 +236,7 @@ export default {
       exportEmployeeQr: {},
       personnelList: [],
       currentExport:{
-        name:'李哈哈',
+        name:'',
         type:1, // 0 总标签码 1 员工标签码
         text:'',
         labelName:'',