ソースを参照

修改优惠卷展示

2297027248@qq.com 3 年 前
コミット
eb20c51050

+ 2 - 2
.env.development

@@ -2,7 +2,7 @@
 ENV = 'development'
 
 # 智慧易加管理系统/开发环境
-VUE_APP_BASE_API = 'http://test.huijy.net/prod-api'
-# VUE_APP_BASE_API = '/dev-api'
+#VUE_APP_BASE_API = 'http://test.huijy.net/prod-api'
+ VUE_APP_BASE_API = '/dev-api'
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 9 - 0
src/api/coupon.js

@@ -106,4 +106,13 @@ export function upIssueStatus(data) {
     method: 'put',
     data: data
   })
+}
+
+// 用户优惠卷信息
+export function queryCouponUserList(query) {
+  return request({
+    url: '/coupon/user/list',
+    method: 'get',
+    params: query
+  })
 }

+ 94 - 27
src/views/coupon/Coupon_CreateCoupon.vue

@@ -19,35 +19,67 @@
     </el-form>
     <div v-if="couponEnabledFlag == 1">
       <el-form
-        :model="createForm"
-        ref="createForm"
+        :model="queryForm"
+        ref="queryForm"
         :inline="true"
         label-width="88px"
       >
-        <!--
-        <el-form-item label="设备类型" prop="deviceType">
-          <el-select
-            v-model="createForm.deviceType"
-            clearable
-            placeholder="请选择"
-          >
-            <el-option label="小票打印机" value="1"></el-option>
-            <el-option label="POS" value="2"></el-option>
-          </el-select>
-        </el-form-item>
+       <el-form-item label="优惠卷标识" prop="couponRemark">
+        <el-input
+          v-model="queryForm.couponRemark"
+          placeholder="请输入标识"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+      <el-form-item label="优惠卷类型" prop="couponType">
+        <el-select
+          v-model="queryForm.couponType"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="现金卷" value="1" ></el-option>
+          <el-option label="折扣卷" value="2" ></el-option>
+          <el-option label="兑换卷" value="3" ></el-option>
+        </el-select>
+      </el-form-item>
+        <el-form-item label="优惠卷名称" prop="couponName">
+        <el-input
+          v-model="queryForm.couponName"
+          placeholder="请输入名称"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+        <el-form-item label="创建时间" prop="getCreateTime">
+        <el-date-picker
+          style="width: 350px"
+          v-model="dateRangeCreatedDate"
+          size="mini"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        >
+        </el-date-picker>
+      </el-form-item>
 
-        <el-form-item label="密钥" prop="deviceSerialNum">
-          <el-input
-            v-model="createForm.deviceSerialNum"
-            placeholder="请输入设备密钥"
-            clearable
-            size="small"
-            @keyup.enter.native="handleQuery"
-          />
-        </el-form-item>
-        -->
+      <el-form-item label="生效状态" prop="status">
+        <el-select
+          v-model="queryForm.status"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="开启" value="1" ></el-option>
+          <el-option label="关闭" value="0" ></el-option>
+         
+        </el-select>
+      </el-form-item>
         <el-form-item>
-          <!--
+    
           <el-button
             type="cyan"
             icon="el-icon-search"
@@ -62,7 +94,7 @@
             @click="resetQuery"
             >重置</el-button
           >
-          -->
+         
           <el-button
             type="primary"
             icon="el-icon-plus"
@@ -132,7 +164,7 @@
                 ? "适用油品:" + (scope.row.oilNameList || []).toString()
                 : ""
             }}
-            {{ scope.row.couponType == 3 ? "核销机构:" : "" }}
+            {{ scope.row.couponType == 3 ? "核销机构:"+ (scope.row.verificationNameList || []).toString() : "" }}
           </template>
         </af-table-column>
 
@@ -696,6 +728,8 @@ export default {
     //   callback()
     // };
     return {
+       //创建优惠卷的时间
+      dateRangeCreatedDate: [],
       couponEnabledFlag: "1",
       pageStatus: 4,
       // 油站设备管理表格数据
@@ -746,6 +780,13 @@ export default {
       queryForm: {
         pageNum: 1,
         pageSize: 10, // 初始值只能比10大
+        couponName:null,
+        couponRemark:null,
+        couponType:null,
+        levelId:this.levelId,
+        couponRemark:null,
+        status:null,
+        getCreateTime:null
       },
       // 表单校验
       rules: {
@@ -869,6 +910,28 @@ export default {
       timeString = timeString.replace(/(、)$/g, "") + "可以使用劵";
       return timeString;
     },
+   /** 查询优惠卷模板信息*/
+    getList() {
+       listInfo(this.addDateRange(this.queryForm, this.dateRangeCreatedDate))
+        .then((res) => {
+          if (res.code == 200) {
+            console.log(res);
+            if (res.rows == null) {
+              this.total = 0;
+              this.couponList = [];
+            } else {
+              this.total = res.total;
+              this.couponList = res.rows;
+            }
+          } else {
+            throw new Error("");
+          }
+        })
+        .catch((err) => {
+          this.msgError("亲,拉取优惠券列表失败~");
+        });
+    },
+   
     getTodayDateString() {
       const date = new Date();
       let y = date.getFullYear();
@@ -1063,7 +1126,11 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("createForm");
+      this.queryForm.pageNum=1;
+      this.queryForm.pageSize=10;
+      this.dateRangeCreatedDate = [];
+      //this.queryForm.couponRemark=null;
+      this.resetForm("queryForm");
       this.handleQuery();
     },
     /** 新增按钮操作 */

+ 70 - 29
src/views/coupon/Coupon_CreateIssue.vue

@@ -8,35 +8,67 @@
   <div v-else-if="pageStatus == 4" class="app-container">
     <div>
       <el-form
-        :model="createForm"
-        ref="createForm"
+        :model="queryForm"
+        ref="queryForm"
         :inline="true"
         label-width="88px"
       >
-        <!--
-        <el-form-item label="设备类型" prop="deviceType">
-          <el-select
-            v-model="createForm.deviceType"
-            clearable
-            placeholder="请选择"
-          >
-            <el-option label="小票打印机" value="1"></el-option>
-            <el-option label="POS" value="2"></el-option>
-          </el-select>
-        </el-form-item>
+       <el-form-item label="优惠卷标识" prop="issueRemark">
+        <el-input
+          v-model="queryForm.issueRemark"
+          placeholder="请输入标识"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+      <el-form-item label="优惠卷类型" prop="issueType">
+        <el-select
+          v-model="queryForm.issueType"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="消费发放" value="1" ></el-option>
+          <el-option label="网页 静态二维码" value="2" ></el-option>
+          <el-option label="支付成功后的展示位" value="3" ></el-option>
+        </el-select>
+      </el-form-item>
+        <el-form-item label="优惠卷名称" prop="issueName">
+        <el-input
+          v-model="queryForm.issueName"
+          placeholder="请输入名称"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+        <el-form-item label="创建时间" prop="getCreateTime">
+        <el-date-picker
+          style="width: 350px"
+          v-model="dateRangeCreatedDate"
+          size="mini"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        >
+        </el-date-picker>
+      </el-form-item>
 
-        <el-form-item label="密钥" prop="deviceSerialNum">
-          <el-input
-            v-model="createForm.deviceSerialNum"
-            placeholder="请输入设备密钥"
-            clearable
-            size="small"
-            @keyup.enter.native="handleQuery"
-          />
-        </el-form-item>
--->
+      <el-form-item label="生效状态" prop="status">
+        <el-select
+          v-model="queryForm.status"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="开启" value="1" ></el-option>
+          <el-option label="关闭" value="0" ></el-option>
+         
+        </el-select>
+      </el-form-item>
         <el-form-item>
-          <!--
+          
           <el-button
             type="cyan"
             icon="el-icon-search"
@@ -51,7 +83,7 @@
             @click="resetQuery"
             >重置</el-button
           >
-          -->
+          
           <el-button
             type="primary"
             icon="el-icon-plus"
@@ -708,6 +740,7 @@ export default {
       callback();
     };
     return {
+      dateRangeCreatedDate: [],
       couponEnabledFlag: "1",
       exportQrDialog: false,
       pageStatus: 4,
@@ -758,6 +791,12 @@ export default {
       queryForm: {
         pageNum: 1,
         pageSize: 10, // 初始值只能比10大
+        issueName:null,
+        issueRemark:null,
+        issueType:null,
+        levelId:this.levelId,
+        CreateTime:null,
+        status:null,
       },
       // 表单校验
       rules: {
@@ -925,7 +964,7 @@ export default {
       return timeString;
     },
     getIssueList() {
-      listIssue(this.queryForm)
+      listIssue(this.addDateRange(this.queryForm, this.dateRangeCreatedDate))
         .then((res) => {
           if (res.code == 200) {
             if (res.rows == null) {
@@ -1087,15 +1126,17 @@ export default {
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.createForm.pageNum = 1;
-      this.getList();
+      this.queryForm.pageNum = 1;
+      this.queryForm.pageSize=10;
+      this.getIssueList();
     },
     deviceNoInput(value) {
       this.dialogForm.posQueue = value;
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("createForm");
+      this.resetForm("queryForm");
+      this.dateRangeCreatedDate = [];
       this.handleQuery();
     },
     /** 新增按钮操作 */

+ 7 - 5
src/views/coupon/Coupon_Statistics/index.vue

@@ -9,13 +9,15 @@
     <el-tabs v-model="activeName">
       <el-tab-pane label="实时发放" name="realTime" :key="'info'">
         <child1></child1>
-        154
+        
       </el-tab-pane>
-      <el-tab-pane label="按发放方式" name="issue" :key="'pay'">
-        你好
+      <el-tab-pane label="按发放方式" name="issue" :key="'issue'">
+        <child2></child2>
+        
       </el-tab-pane>
       <el-tab-pane label="按优惠券类" name="model" :key="'pay'">
-        哈哈
+         <child3></child3>
+        
       </el-tab-pane>
     </el-tabs>
   </div>
@@ -207,7 +209,7 @@ export default {
     VueClipboard: VueClipboard,
     child1: tabZujianChild1,
     child2: tabZujianChild2,
-    child2: tabZujianChild3,
+    child3: tabZujianChild3,
   },
 
   created() {

+ 929 - 200
src/views/coupon/Coupon_Statistics/issue.vue

@@ -1,259 +1,988 @@
 <template>
-  <div class="app-container">
-    <el-row>
-      <el-col :span="24">
-        <el-card :body-style="{ padding: '20px', margin: '0 auto' }">
-          <div class="imgbox">
-            <el-upload
-              class="uploader"
-              :action="addressUrl"
-              :show-file-list="false"
-              :headers="headers"
-              :on-success="handleAvatarSuccess"
-              :before-upload="beforeAvatarUpload"
-              :disabled="editable"
+  <div v-if="pageStatus == 0">配置加载中...</div>
+  <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
+  <div v-else-if="pageStatus == 2">
+    没有此页内容的配置权限,请检查集团上的配置
+  </div>
+  <div v-else-if="pageStatus == 3">加载发生错误</div>
+  <div v-else-if="pageStatus == 4" class="app-container">
+    <div>
+       <el-form
+        :model="queryForm"
+        ref="queryForm"
+        :inline="true"
+        label-width="88px"
+      >
+       <el-form-item label="优惠卷标识" prop="issueRemark">
+        <el-input
+          v-model="queryForm.issueRemark"
+          placeholder="请输入标识"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+      <el-form-item label="优惠卷类型" prop="issueType">
+        <el-select
+          v-model="queryForm.issueType"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="消费发放" value="1" ></el-option>
+          <el-option label="网页 静态二维码" value="2" ></el-option>
+          <el-option label="支付成功后的展示位" value="3" ></el-option>
+        </el-select>
+      </el-form-item>
+        <el-form-item label="优惠卷名称" prop="issueName">
+        <el-input
+          v-model="queryForm.issueName"
+          placeholder="请输入名称"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+        <el-form-item label="创建时间" prop="getCreateTime">
+        <el-date-picker
+          style="width: 350px"
+          v-model="dateRangeCreatedDate"
+          size="mini"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        >
+        </el-date-picker>
+      </el-form-item>
+
+      <el-form-item label="生效状态" prop="status">
+        <el-select
+          v-model="queryForm.status"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="开启" value="1" ></el-option>
+          <el-option label="关闭" value="0" ></el-option>
+         
+        </el-select>
+      </el-form-item>
+        <el-form-item>
+          
+          <el-button
+            type="cyan"
+            icon="el-icon-search"
+            size="mini"
+            @click="handleQuery"
+            >搜索</el-button
+          >
+          <el-button
+            type="info"
+            icon="el-icon-refresh"
+            size="mini"
+            @click="resetQuery"
+            >重置</el-button
+          >
+        </el-form-item>
+      </el-form>
+      <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"
             >
-              <img
-                v-if="form.stationPic"
-                :src="form.stationPic"
-                class="avatar"
-              />
-              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-              <div class="el-upload__tip" slot="tip" v-show="!editable">
-                点击图片可以重新上传
-              </div>
-            </el-upload>
-          </div>
-          <div class="station">
-            <el-form ref="form" :model="form" :rules="rules" label-width="auto">
-              <el-form-item label="油站名称" prop="deptName">
-                <el-input
-                  v-model="form.deptName"
-                  placeholder="请输入油站名称"
-                  :disabled="editable"
-                />
-              </el-form-item>
-              <el-form-item label="油站地址" prop="deptAddress">
-                <el-input
-                  v-model="form.deptAddress"
-                  placeholder="请输入油站地址"
-                  :disabled="editable"
-                />
-              </el-form-item>
-              <el-form-item label="联系人" prop="leader">
-                <el-input
-                  v-model="form.leader"
-                  placeholder="请输入联系人"
-                  :disabled="editable"
-                />
-              </el-form-item>
-              <el-form-item label="电话" prop="phone">
-                <el-input
-                  v-model="form.phone"
-                  placeholder="请输入电话"
-                  :disabled="editable"
-                />
-              </el-form-item>
-            </el-form>
+              <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="center">
+                <template slot-scope="scope">
+                  {{ scope.row.status == "1" ? "启用状态" : "" }}
+                  {{ scope.row.status == "0" ? "停用状态" : "" }}
+                </template>
+              </af-table-column>
+            </el-table>
+          </template>
+        </af-table-column>
+        <af-table-column label="发放方式id" align="left" prop="id" v-if="false" />  
+        <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
+         <af-table-column label="状态" align="left">
+          <template slot-scope="scope">
+            {{ scope.row.status == "1" ? "启用" : "" }}
+            {{ scope.row.status == "0" ? "停用" : "" }}
+          </template>
+        </af-table-column> 
+        <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" ? "支付成功后的领取位" : "" }}
+          </template>
+        </af-table-column>
+        <!-- <af-table-column label="操作" align="left">
+          <template slot-scope="scope">
+            {{
+              scope.row.issueType == "1" || scope.row.issueType == "3"
+                ? "-------"
+                : ""
+            }}
             <el-button
-              type="primary"
-              size="small"
-              @click="
-                () => {
-                  this.editable = !editable;
-                }
-              "
+              size="mini"
+              type="text"
+              icon="el-icon-download"
+              @click="handleExport(scope.row)"
+              v-if="scope.row.issueType == '2'"
+              >导出二维码、网址</el-button
             >
-              {{ editable ? "修改资料" : "取消保存" }}
-            </el-button>
+          </template>
+        </af-table-column> -->
+        <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" ? "-------" : "" }}
+          </template>
+        </af-table-column>
+        <af-table-column label="领取限制" align="left">
+          <template slot-scope="scope">
+            {{ scope.row.issueType == "1" ? "-------" : "" }}
+            {{
+              scope.row.issueType != "1"
+                ? "单个用户能进入这个领取界面" +
+                  scope.row.giveCount +
+                  "次,一次可以领取" +
+                  scope.row.giveLimit +
+                  "张优惠券"
+                : ""
+            }}
+          </template>
+        </af-table-column>
+        <af-table-column label="可领取时间段" align="left">
+          <template slot-scope="scope">
+            {{ translateTime(scope.row) }}
+          </template>
+        </af-table-column>
+        
+       
+        <af-table-column
+          label="操作"
+          align="left"
+          class-name="small-padding fixed-width"
+          width="120px"
+        >
+          <template slot-scope="scope">
             <el-button
-              type="primary"
-              size="small"
-              v-show="!editable"
-              @click="submitForm"
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handlequeryCouponUserList(scope.row.id)"
+              >查看优惠卷</el-button
             >
-              保存资料
-            </el-button>
-          </div>
-        </el-card>
-      </el-col>
-    </el-row>
+          </template>
+        </af-table-column>
+      
+      </el-table>
+      <pagination
+        :hidden="total > 0 ? false : true"
+        :total="total"
+        :page.sync="queryForm.pageNum"
+        :limit.sync="queryForm.pageSize"
+        @pagination="getIssueList"
+        :autoScroll="true"
+      />
+    </div>
+
+    <!-- 添加或修改油站设备管理对话框 -->
+    <el-dialog
+      :title="title"
+      :visible.sync="open"
+      width="1200px"
+      append-to-body
+      status-icon
+    >
+     <el-table :data="couponUserList">
+      <af-table-column label="油站名" align="center" prop="id" v-if="jiBie==0||jiBie==1"/>
+      <af-table-column
+        v-if="false"
+        label="优惠卷id"
+        align="center"
+        prop="id"
+      />
+      <af-table-column label="用户ID" align="center" prop="unionId" v-if="false" />
+      <af-table-column label="油站ID" align="center" prop="stationId" v-if="false" />
+      <af-table-column label="发放方式ID" align="center" prop="issueId" v-if="false" />
+      <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
+       <af-table-column label="活动名称" align="left" prop="issueName" />
+      
+      <af-table-column label="优惠券ID" align="center" prop="couponId"  v-if="false"/>
+      <af-table-column
+          label="优惠券标识"
+          align="left"
+          prop="couponRemark"
+          fixed="left"
+        />
+        <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="center"
+       >
+           <template slot-scope="scope">
+            {{ scope.row.couponIsUsed == "0" ? "未使用" : "" }}
+            {{ scope.row.couponIsUsed == "1" ? "已使用" : "" }}
+            {{ scope.row.couponIsUsed == "2" ? "已核销" : "" }}
+          </template>
+      </af-table-column>
+      <af-table-column label="是否有效"
+       align="center"
+      >
+       <template slot-scope="scope">
+            {{ scope.row.couponIsEffective == "0" ? "无效" : "" }}
+            {{ scope.row.couponIsEffective == "1" ? "有效" : "" }}
+          </template>
+      </af-table-column>
+      <af-table-column label="用户保存id" align="center" prop="userId" v-if="false" />
+      <af-table-column label="手机号" align="center" prop="mobilePhone" />
+      <af-table-column label="用户名" align="center" prop="blogNickName" />
+      <af-table-column label="核销员手机号" align="center" prop="verificationUserPhone" />
+      <af-table-column label="优惠券获取时间" align="center" prop="getCouponTime">
+        <template slot-scope="scope">
+          <span>{{
+            parseTime(scope.row.getCouponTime, "{y}-{m}-{d} {h}:{i}:{s}")
+          }}</span>
+        </template>
+      </af-table-column>
+      <af-table-column label="优惠券截止时间" align="center" prop="couponEffectiveTime">
+        <template slot-scope="scope">
+          <span>{{
+            parseTime(scope.row.couponEffectiveTime, "{y}-{m}-{d} {h}:{i}:{s}")
+          }}</span>
+        </template>
+      </af-table-column>
+      
+    </el-table>
+    <pagination
+      v-show="userTotal > 0"
+      :total="userTotal"
+      :page.sync="queryCouponUserFrom.pageNum"
+      :limit.sync="queryCouponUserFrom.pageSize"
+      @pagination="queryCouponUserListByPage"
+    />
+    </el-dialog>
 
-    <!-- 添加或修改油站信息对话框 -->
+    <el-dialog
+      :visible.sync="exportQrDialog"
+      width="600px"
+      append-to-body
+      title="导出标签"
+    >
+      <div>
+        <qr
+          :text="currentExport.text"
+          @downloadImg="downloadImg"
+          :name="currentExport.name + '活动二维码'"
+        >
+          <div>{{ currentExport.name }} 活动二维码<b></b></div>
+        </qr>
+        <!--
+        <div
+          style="text-align: center; margin-top: 15px"
+          v-clipboard:copy="currentExport.text"
+          v-clipboard:error="onCopyError"
+          v-clipboard:success="onCopySuccess"
+        >
+          👇点击复制网址👇
+        </div>
+        -->
+        <div
+          style="text-align: center; margin-top: 15px"
+          v-clipboard:copy="currentExport.text"
+          v-clipboard:error="onCopyError"
+          v-clipboard:success="onCopySuccess"
+        >
+          活动网址:{{ currentExport.text }}
+        </div>
+        <div
+          style="text-align: center"
+          v-clipboard:copy="currentExport.text"
+          v-clipboard:error="onCopyError"
+          v-clipboard:success="onCopySuccess"
+        >
+          👆点击复制网址👆
+        </div>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import {
+  listManage,
+  getManage,
+  delManage,
+  addManage,
+  updateManage,
+  exportManage,
+  changeManageStatus,
+} from "@/api/station/manage";
+import { listPrice } from "@/api/station/price";
+
+import Vue from "vue";
+import VueClipboard from "vue-clipboard2";
+
+import Qr from "@/components/QrCode";
+import Base64 from "@/utils/base64";
+
+Vue.use(VueClipboard);
+
+import {
+  addInfo,
   listInfo,
   updateInfo,
-  exportInfo,
-} from "@/api/station/info";
-import { getToken } from "@/utils/auth";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+  changeCouponStatus,
+  addIssue,
+  listIssue,
+  upIssueStatus,
+  queryCouponUserList,
+} from "@/api/coupon";
+import SelectDay from "@/components/SelectDay";
+import settings from "@/settings";
+
 export default {
-  name: "Info",
-  components: { Treeselect },
+  name: "Coupon_CreateIssue",
   data() {
-    const validatorPhone = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error("手机号不能为空"));
-      } else {
-        const reg = /^1[3|4|5|7|8][0-9]\d{8}$/;
-        if (reg.test(value)) {
-          callback();
-        } else {
-          return callback(new Error("请输入正确的手机号"));
+    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 {
-      editable: true,
-      // 总条数
-      total: 0,
-      // 部门树选项
-      deptOptions: undefined,
+      dateRangeCreatedDate: [],
+      couponEnabledFlag: "1",
+      exportQrDialog: false,
+      pageStatus: 4,
+      createForm: {
+        issueRemark: "",
+        issueName: "",
+        showIdList: [],
+        availableControl: "0",
+        appointedDaysList: [],
+        cycleDaysList: [],
+        issueType: "",
+        discountThresholdAmt: "0",
+        couponIssueRelationList: [],
+        giveLimit: 9,
+        giveCount: 999999,
+      },
+      currentExport: {
+        text: "error",
+        type: "你好",
+        name: "二维码",
+      },
+      couponList: [],
+      oilNameList: [],
+      allVerificationList: [],
+      equipmentList: [],
+      // 油枪复选
+      allGunList: [],
+      // 已选的油枪
+      checkedGunList: [],
+      //设备状态
+      deviceStatusOptions: [],
+      //设备类型
+      deviceTypeOptions: [],
+      stationOptions: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
       open: false,
+      // 总条数
+      total: 100,
+      // 优惠卷总条数
+      userTotal: 100,
+      leftQuery: {},
+      rightQuery: {},
+      leftData: [],
+      rightData: [],
+      moveRightData: [],
+      moveLeftData: [],
+       // 优惠卷的信息
+      couponUserList: [],
       // 查询参数
-      queryParams: {
+      queryForm: {
+        pageNum: 1,
+        pageSize: 10, // 初始值只能比10大
+        issueName:null,
+        issueRemark:null,
+        issueType:null,
+        levelId:this.levelId,
+        CreateTime:null,
+        status:null,
+      },
+      queryCouponUserFrom:{
+        levelId:this.levelId,
+        issueId:0,
+        couponId: null,
+        stationId: null,
         pageNum: 1,
         pageSize: 10,
-        stationName: null,
-        deptAddress: null,
-        oilGunNum: null,
-        contacts: null,
-        phone: null,
-        stationGroupName: null,
-        stationPic: null,
-        stationLongitude: null,
-        stationLatitude: null,
-        mno: null,
-        deptId: this.deptId,
       },
-      // 表单参数
-      form: {},
       // 表单校验
       rules: {
-        deptName:[
-          { required: true, message: '请填写油站名', trigger: 'blur' }
+        availableControl: [
+          {
+            required: true,
+            message: "请选择有效期内时间控制",
+            trigger: "change",
+          },
+          { validator: validateAvailableControl, trigger: "change" },
         ],
-        deptAddress:[
-          { required: true, message: '请填写活动形式', trigger: 'blur' }
+        couponIssueRelationList: [
+          {
+            required: true,
+            message: "请选择优惠券",
+            trigger: "change",
+          },
+          { validator: validateCouponIssueRelationList, trigger: "change" },
         ],
-        leader:[
-          { required: true, message: '请填写联系人', trigger: 'blur' }
-        ],
-        phone:[
-          { validator: validatorPhone, required: true, trigger: 'blur' }
-        ]
       },
-      imageUrl: "",
-      headers: { Authorization: "Bearer " + getToken() },
-      addressUrl:process.env.VUE_APP_BASE_API + "/common/upload",
-      // addressUrl:  location.protocol +"//" +location.host +process.env.VUE_APP_BASE_API + "/common/upload",
+      day: [],
+      cycle: [],
+      issueList: [],
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "1号",
+          "2号",
+          "3号",
+          "4号",
+          "5号",
+          "6号",
+          "7号",
+          "8号",
+          "9号",
+          "10号",
+          "11号",
+          "12号",
+          "13号",
+          "14号",
+          "15号",
+          "16号",
+          "17号",
+          "18号",
+          "19号",
+          "20号",
+          "21号",
+          "22号",
+          "23号",
+          "24号",
+          "25号",
+          "26号",
+          "27号",
+          "28号",
+          "29号",
+          "30号",
+          "31号",
+        ],
+      ],
     };
   },
+  components: {
+    SelectDay: SelectDay,
+    Qr: Qr,
+    VueClipboard: VueClipboard,
+  },
   created() {
-    this.getList();
+    console.log("哈哈");
+    console.log("settings", settings);
+    // this.init();
+    this.getCoupon();
+    // this.setPageStatus();
+    this.getIssueList();
+     
+  },
+  computed: {
+    toggleable() {
+      if (this.moveRightData.length === 0 && this.moveLeftData.length === 0) {
+        return true;
+      }
+      return false;
+    },
+    selectedCouponList() {
+      return this.couponList.filter((ele) => {
+        if (this.createForm.couponIssueRelationList == null) {
+          this.createForm.couponIssueRelationList = [];
+        }
+        return this.createForm.couponIssueRelationList.includes(ele.id);
+      });
+    },
+    unselectedCouponList() {
+      return this.couponList.filter((ele) => {
+        if (this.createForm.couponIssueRelationList == null) {
+          this.createForm.couponIssueRelationList = [];
+        }
+        return !!!this.createForm.couponIssueRelationList.includes(ele.id);
+      });
+    },
+    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;
+    },
   },
-
   methods: {
-    /** 查询油站信息列表 */
-    getList() {
-      listInfo(this.queryParams).then((response) => {
-        this.form = response.rows[0];
+    couponIsUsedFotmat(row, column) {
+      if (row.couponIsUsed === "0") {
+        return "未使用";
+      } else if (row.couponIsUsed === "1") {
+        return "已使用";
+      }
+    },
+     couponIsEffectiveFotmat(row, column) {
+      if (row.couponIsEffective === "0") {
+        return "无效";
+      } else if (row.couponIsEffective === "1") {
+        return "有效";
+      }
+    },
+    onCopySuccess() {
+      this.msgSuccess("网址已经拷贝到剪切板");
+    },
+    onCopyError() {
+      this.msgError("网址拷贝失败,请手动复制");
+    },
+    // 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;
+    // },
+    handleExport(row) {
+      this.currentExport.name = row.issueName;
+      const base64 = Base64.getInstance();
+      const encodeStr = "i" + row.id;
+      const encodedStr = base64.encode(encodeStr);
+      const trimEqualStr = encodedStr.replace(/={1,}$/g, "");
+      this.exportQrDialog = true;
+      this.currentExport.text =
+        settings.baseURL + this.deptId + "/" + trimEqualStr;
+    },
+    downloadImg() {
+      console.log('');
+    },
+    translateTime(row) {
+      let timeString = "";
+      const availableControleType = row.availableControl;
+      if (availableControleType == 0) {
+        return "用户一直都可以领取";
+      }
+      timeString = "用户只能在";
+      if (availableControleType == 1) {
+        timeString += "每周的";
+      }
+      if (availableControleType == 2) {
+        timeString += "每月的";
+      }
+      if (availableControleType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (availableControleType == 1 || availableControleType == 2) {
+        row.cycleDaysList.forEach((ele) => {
+          timeString += this.timeSelect[availableControleType][ele] + "、";
+        });
+      } else if (availableControleType == 3) {
+        timeString += row.appointedDaysList.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + "可以领取劵";
+      return timeString;
+    },
+    getIssueList() {
+      listIssue(this.addDateRange(this.queryForm, this.dateRangeCreatedDate))
+        .then((res) => {
+          if (res.code == 200) {
+            if (res.rows == null) {
+              this.total = 0;
+              this.issueList = [];
+            } else {
+              this.total = res.total;
+              this.issueList = res.rows;
+            }
+          } else {
+            throw new Error("");
+          }
+        })
+        .catch((err) => {
+          this.msgError("亲,拉取领取方式列表失败~");
+        });
+    },
+    getCoupon() {
+      listInfo({
+        pageNum: 1,
+        pageSize: 1000,
+        status: 1,
+      })
+        .then((res) => {
+          if (res.code == 200) {
+            if (res.rows == null) {
+              this.couponList = [];
+            } else {
+              this.couponList = res.rows;
+            }
+          } else {
+            throw new Error("");
+          }
+        })
+        .catch((err) => {
+          this.msgError("亲,拉取优惠券列表失败~");
+        });
+    },
+    availableControlChange() {
+      this.createForm.appointedDaysList = [];
+      this.createForm.cycleDaysList = [];
+      this.createForm = { ...this.createForm };
+    },
+    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;
+          });
+      }
+    },
+    handleFlagChange() {
+      const that = this;
+      let text = this.couponEnabledFlag === "1" ? "启用" : "停用";
+      this.$confirm('确认要"' + text + '"优惠券功能吗?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return changeCouponStatus({
+            deptId: that.deptId,
+            couponEnabledFlag: that.couponEnabledFlag,
+          });
+        })
+        .then(() => {
+          that.msgSuccess(text + "成功");
+        })
+        .catch(function () {
+          that.couponEnabledFlag = that.couponEnabledFlag === "0" ? "1" : "0";
+        });
+    },
+    handleStatusChange(row) {
+      let text = row.status === "1" ? "启用" : "停用";
+      this.$confirm(
+        '确认要"' + text + '""' + row.issueName + '"发放方式吗?',
+        "警告",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      )
+        .then(function () {
+          return upIssueStatus({
+            id: row.id,
+            status: row.status,
+          });
+        })
+        .then(() => {
+          this.msgSuccess(text + "成功");
+        })
+        .catch(function () {
+          row.status = row.status === "0" ? "1" : "0";
+        });
+    },
+    toggleLabel() {
+      if (this.moveLeftData.length !== 0) {
+        this.createForm.couponIssueRelationList =
+          this.createForm.couponIssueRelationList.filter((ele) => {
+            return ele != this.moveLeftData;
+          });
+        this.createForm = { ...this.createForm };
+        return;
+      }
+      if (this.moveRightData.length !== 0) {
+        this.createForm.couponIssueRelationList = [
+          ...new Set(
+            this.createForm.couponIssueRelationList.concat(this.moveRightData)
+          ),
+        ].filter((ele) => {
+          return !!ele;
+        });
+        this.createForm = { ...this.createForm };
+        return;
+      }
+      return;
+    },
+    handleLeftChange(val) {
+      let changeArr = [];
+      val.map((ele) => {
+        changeArr.push(ele.id);
+      });
+      console.log(changeArr);
+      this.moveLeftData = [];
+      this.moveRightData = changeArr;
+      // console.log(this.moveRightData);
+      this.$refs.rightTable.clearSelection();
+    },
+    handleRightChange(val) {
+      let changeArr = [];
+      val.map((ele) => {
+        changeArr.push(ele.id);
+      });
+      this.moveLeftData = changeArr;
+      this.moveRightData = [];
+      this.$refs.leftTable.clearSelection();
+    },
+    init() {
+      this.getOilList();
+      this.getCoupon();
+      this.getVerificationList();
+    },
+    setPageStatus() {
+      this.queryPageStatus([2]).then((res) => {
+        this.pageStatus = res;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+       this.queryForm.pageNum = 1;
+      this.queryForm.pageSize=10;
+      this.getIssueList();
+    },
+    deviceNoInput(value) {
+      this.dialogForm.posQueue = value;
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+       this.resetForm("queryForm");
+      this.dateRangeCreatedDate = [];
+      this.handleQuery();
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.createForm = {
+        issueRemark: "",
+        issueName: "",
+        showIdList: [],
+        availableControl: "0",
+        appointedDaysList: [],
+        cycleDaysList: [],
+        issueType: "",
+        discountThresholdAmt: "0",
+        couponIssueRelationList: [],
+        giveLimit: 9,
+        giveCount: 999999,
+      }
+      
+      ;
+      this.title = "添加优惠券";
+      // this.createForm = {
+      //   couponName: "",
+      //   couponDetails: "",
+      //   couponThresholdAmt: 0,
+      //   couponType: "1",
+      //   couponAmt: 0,
+      //   oilNameList: [],
+      //   effectiveTimeType: "",
+      //   effectiveTime: [],
+      //   effectiveDayNum: 30,
+      //   couponHoldNum: 1,
+      //   couponReceiveNum: 100,
+      //   couponNum: 100,
+      //   status: "1",
+      //   couponIssueRelationList: [],
+      //   isCardFlag: "1",
+      //   isGradeFlag: "1",
+      //   isMarketFlag: "1",
+      // };
+      this.open = true;
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      
+      this.createForm = JSON.parse(JSON.stringify(row));
+      this.title = "用户优惠卷信息";
+      this.open = true;
+    },
+
+     /** 查看优惠卷信息 */
+    handlequeryCouponUserList(row) {
+      console.log(row);
+      console.log(this.queryCouponUserFrom.issueId);
+      this.queryCouponUserFrom.issueId=row;
+        
+     queryCouponUserList(
+       this.queryCouponUserFrom
+      ).then((response) => {
+        this.couponUserList = response.rows;
+        this.userTotal = response.total;
+        this.title = "用户优惠卷信息";
+        this.open = true;
+      });
+      
+    },
+   /** 分页查看信息 */
+    queryCouponUserListByPage() {
+      
+     queryCouponUserList(
+       this.queryCouponUserFrom
+      ).then((response) => {
+        this.couponUserList = response.rows;
+        this.userTotal = response.total;
+        this.title = "用户优惠卷信息";
+        this.open = true;
       });
+      
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate((valid) => {
+      console.log(123);
+      this.$refs["dialogForm"].validate((valid) => {
         if (valid) {
-          this.$confirm("确认更新油站信息", "警告", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning",
-          }).then(() => {
-            updateInfo(this.form).then((response) => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.editable=true
-              this.getList();
-            });
-          });
+          if (!!this.createForm.id) {
+            updateIssue(this.createForm)
+              .then((res) => {
+                if (res.code == 200) {
+                  this.msgSuccess("亲,修改成功了~");
+                  this.getIssueList();
+                  this.open = false;
+                } else {
+                  throw new Error("");
+                }
+              })
+              .catch((err) => {
+                this.msgError("修改失败了呀~");
+              });
+          } else {
+            addIssue(this.createForm)
+              .then((res) => {
+                if (res.code == 200) {
+                  this.msgSuccess("亲,新增成功了~");
+                  this.getIssueList();
+                  this.open = false;
+                } else {
+                  throw new Error("");
+                }
+              })
+              .catch((err) => {
+                this.msgError("创建失败了~");
+              });
+          }
         }
       });
     },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm("是否确认导出所有油站信息数据项?", "警告", {
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const deviceIds = row.deviceId;
+      this.$confirm("是否确认删除油站设备管理", "警告", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(function () {
-          return exportInfo(queryParams);
+          return delManage(deviceIds);
         })
-        .then((response) => {
-          this.download(response.msg);
+        .then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
         });
     },
-    handleAvatarSuccess(res, file) {
-      this.form.stationPic = res.url;
-      this.form = {...this.form} ;
-    },
-    beforeAvatarUpload(file) {
-      const isJPG = file.type === "image/jpeg";
-      const isLt2M = file.size / 1024 / 1024 < 4;
-      // if (!isJPG) {
-      //   this.$message.error("上传头像图片只能是 JPG 格式!");
-      // }
-      if (!isLt2M) {
-        this.$message.error("上传头像图片大小不能超过 4MB!");
-      }
-      return isJPG && isLt2M;
-    },
   },
 };
 </script>
-<style lang="scss" scoped>
-.imgbox {
-  margin: 0 auto;
-  padding: 20px;
-  width: 200px;
-  height: 240px;
-  img {
-    width: 100%;
-    height: 100%;
-  }
-  .uploader {
-    width: 100%;
-    height: 100%;
-    .el-upload {
-      width: 100%;
-      height: 100%;
-    }
-    .avatar {
-      width: 100%;
-      height: 100%;
-      margin: 0 auto;
-    }
-    .el-upload__tip {
-      text-align: center;
-      color: red;
-    }
-    .el-upload {
-      color: red;
-    }
-  }
-}
-.station {
-  width: 40%;
-  min-width: 300px;
-  margin: 0 auto;
+<style lang="scss">
+.el-transfer__buttons {
 }
 </style>

+ 962 - 0
src/views/coupon/Coupon_Statistics/model.vue

@@ -0,0 +1,962 @@
+<template>
+  <div v-if="pageStatus == 0">配置加载中...</div>
+  <div v-else-if="pageStatus == 1">此页面不对此账号开放</div>
+  <div v-else-if="pageStatus == 2">
+    没有此页内容的配置权限,请检查集团上的配置
+  </div>
+  <div v-else-if="pageStatus == 3">加载发生错误</div>
+  <div v-else-if="pageStatus == 4" class="app-container">
+   
+    <div v-if="couponEnabledFlag == 1">
+     <el-form
+        :model="queryForm"
+        ref="queryForm"
+        :inline="true"
+        label-width="88px"
+      >
+       <el-form-item label="优惠卷标识" prop="couponRemark">
+        <el-input
+          v-model="queryForm.couponRemark"
+          placeholder="请输入标识"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+      <el-form-item label="优惠卷类型" prop="couponType">
+        <el-select
+          v-model="queryForm.couponType"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="现金卷" value="1" ></el-option>
+          <el-option label="折扣卷" value="2" ></el-option>
+          <el-option label="兑换卷" value="3" ></el-option>
+        </el-select>
+      </el-form-item>
+        <el-form-item label="优惠卷名称" prop="couponName">
+        <el-input
+          v-model="queryForm.couponName"
+          placeholder="请输入名称"
+          clearable
+          size="small"
+          
+        />
+       </el-form-item>
+        <el-form-item label="创建时间" prop="getCreateTime">
+        <el-date-picker
+          style="width: 350px"
+          v-model="dateRangeCreatedDate"
+          size="mini"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        >
+        </el-date-picker>
+      </el-form-item>
+
+      <el-form-item label="生效状态" prop="status">
+        <el-select
+          v-model="queryForm.status"
+          clearable
+          placeholder="请选择"
+        >
+          <el-option label="开启" value="1" ></el-option>
+          <el-option label="关闭" value="0" ></el-option>
+         
+        </el-select>
+      </el-form-item>
+        <el-form-item>
+    
+          <el-button
+            type="cyan"
+            icon="el-icon-search"
+            size="mini"
+            @click="handleQuery"
+            >搜索</el-button
+          >
+          <el-button
+            type="info"
+            icon="el-icon-refresh"
+            size="mini"
+            @click="resetQuery"
+            >重置</el-button
+          >
+         
+          
+        </el-form-item>
+      </el-form>
+      <el-table :data="couponList">
+        <af-table-column
+          label="优惠券标识"
+          align="left"
+          prop="couponRemark"
+          fixed="left"
+        />
+        <af-table-column label="状态" align="left">
+          <template slot-scope="scope">
+                  {{ scope.row.status == "1" ? "启用状态" : "" }}
+                  {{ scope.row.status == "0" ? "停用状态" : "" }}
+                </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 ? "核销机构:"+ (scope.row.verificationNameList || []).toString() : ""   }}
+          </template>
+        </af-table-column>
+         <af-table-column label="油站ID" align="center" prop="id" />
+        <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="handlequeryCouponUserList(scope.row.id)"
+              v-if="scope.row.editFlag"
+              >查看优惠卷</el-button
+            >
+          </template>
+        </af-table-column>
+      </el-table>
+      <pagination
+        :hidden="total > 0 ? false : true"
+        :total="total"
+        :page.sync="queryForm.pageNum"
+        :limit.sync="queryForm.pageSize"
+        @pagination="getCoupon"
+        :autoScroll="true"
+      />
+    </div>
+    <div v-else style="text-align: center">
+      亲,您的油站暂未启动优惠券功能,呦~
+    </div>
+
+    <!-- 添加或修改油站设备管理对话框 -->
+
+    <el-dialog
+      :title="title"
+      :visible.sync="open"
+      width="1200px"
+      append-to-body
+      status-icon
+    >
+          <el-table :data="couponUserList">
+      <af-table-column label="油站名" align="center" prop="id" v-if="jiBie==0||jiBie==1"/>
+      <af-table-column
+        v-if="false"
+        label="优惠卷id"
+        align="center"
+        prop="id"
+      />
+      <af-table-column label="用户ID" align="center" prop="unionId" v-if="false" />
+      <af-table-column label="油站ID" align="center" prop="stationId" v-if="false" />
+      <af-table-column label="发放方式ID" align="center" prop="issueId" v-if="false" />
+      <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
+       <af-table-column label="活动名称" align="left" prop="issueName" />
+      
+      <af-table-column label="优惠券ID" align="center" prop="couponId"  v-if="false"/>
+      <af-table-column
+          label="优惠券标识"
+          align="left"
+          prop="couponRemark"
+          fixed="left"
+        />
+        <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="center"
+       >
+           <template slot-scope="scope">
+            {{ scope.row.couponIsUsed == "0" ? "未使用" : "" }}
+            {{ scope.row.couponIsUsed == "1" ? "已使用" : "" }}
+            {{ scope.row.couponIsUsed == "2" ? "已核销" : "" }}
+          </template>
+      </af-table-column>
+      <af-table-column label="是否有效"
+       align="center"
+      >
+       <template slot-scope="scope">
+            {{ scope.row.couponIsEffective == "0" ? "无效" : "" }}
+            {{ scope.row.couponIsEffective == "1" ? "有效" : "" }}
+          </template>
+      </af-table-column>
+      <af-table-column label="用户保存id" align="center" prop="userId" v-if="false" />
+      <af-table-column label="手机号" align="center" prop="mobilePhone" />
+      <af-table-column label="用户名" align="center" prop="blogNickName" />
+      <af-table-column label="核销员手机号" align="center" prop="verificationUserPhone" />
+      <af-table-column label="优惠券获取时间" align="center" prop="getCouponTime">
+        <template slot-scope="scope">
+          <span>{{
+            parseTime(scope.row.getCouponTime, "{y}-{m}-{d} {h}:{i}:{s}")
+          }}</span>
+        </template>
+      </af-table-column>
+      <af-table-column label="优惠券截止时间" align="center" prop="couponEffectiveTime">
+        <template slot-scope="scope">
+          <span>{{
+            parseTime(scope.row.couponEffectiveTime, "{y}-{m}-{d} {h}:{i}:{s}")
+          }}</span>
+        </template>
+      </af-table-column>
+      
+    </el-table>
+    <pagination
+      v-show="userTotal > 0"
+      :total="userTotal"
+      :page.sync="queryCouponUserFrom.pageNum"
+      :limit.sync="queryCouponUserFrom.pageSize"
+      @pagination="queryCouponUserListByPage"
+    />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listPrice } from "@/api/station/price";
+import SelectDay from "@/components/SelectDay";
+
+import {
+  addInfo,
+  verificationList,
+  listInfo,
+  updateInfo,
+  changeCouponStatus,
+  queryCouponUserList,
+} from "@/api/coupon";
+import { updateDept } from "@/api/system/dept";
+
+export default {
+  name: "Station_Equipment",
+  data() {
+    let validateOilNameList = (rule, value, callback) => {
+      console.log(value);
+      if (value.length == 0) {
+        callback(new Error("请选择优惠券的使用油品"));
+        return;
+      }
+      callback();
+    };
+    let validateEffectiveTimeType = (rule, value, callback) => {
+      if (!value) {
+        callback(new Error("请填入有效时间"));
+        return;
+      }
+      if (value == 1) {
+        if (this.createForm.effectiveTime.length == 0) {
+          callback(new Error("请选择有效时间"));
+          return;
+        }
+      }
+      if (value == 2) {
+        if (!this.createForm.effectiveDayNum) {
+          callback(new Error("请填入有效天数"));
+          return;
+        }
+      }
+      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 validateVerificationList = (rule, value, callback)=>{
+    //   if(this.createForm.couponType == 3){
+    //     if(this.createForm.validateVerificationList.length == 0){
+    //       callback(new Error("请选择核销机构"));
+    //       return;
+    //     }
+    //   }
+    //   callback()
+    // };
+    return {
+        //创建优惠卷的时间
+      dateRangeCreatedDate: [],
+      couponEnabledFlag: "1",
+      pageStatus: 4,
+      // 油站设备管理表格数据
+      createForm: {
+        couponRemark: "",
+        couponName: "",
+        couponDetails: "",
+        couponThresholdAmt: 0,
+        couponType: "1",
+        couponAmt: "",
+        oilNameList: [],
+        effectiveTimeType: "", //有效时间类型: 1,固定时间;2,领取后x天内有效
+        effectiveTime: [],
+        effectiveDayNum: 30,
+        couponHoldNum: 1,
+        couponReceiveNum: 100,
+        couponNum: 100,
+        status: "1",
+        verificationList: [],
+        isCardFlag: "1",
+        isGradeFlag: "1",
+        isMarketFlag: "1",
+        availableControl: "0",
+        appointedDaysList: [],
+        cycleDaysList: [],
+      },
+      couponList: [],
+      oilNameList: [],
+      allVerificationList: [],
+      day: [],
+      cycle: [],
+
+      deviceTypeOptions: [],
+      stationOptions: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 总条数
+      total: 100,
+      // 优惠卷总条数
+      userTotal: 100,
+      leftQuery: {},
+      rightQuery: {},
+      leftData: [],
+      rightData: [],
+      moveRightData: [],
+      // 优惠卷的信息
+      couponUserList: [],
+      moveLeftData: [],
+      // 查询参数
+      queryForm: {
+        pageNum: 1,
+        pageSize: 10, // 初始值只能比10大
+        couponName:null,
+        couponRemark:null,
+        couponType:null,
+        levelId:this.levelId,
+        couponRemark:null,
+        status:null,
+        getCreateTime:null
+      },
+       queryCouponUserFrom:{
+        levelId:this.levelId,
+        issueId:null,
+        couponId: null,
+        stationId: null,
+        pageNum: 1,
+        pageSize: 10,
+
+      },
+      // 表单校验
+      rules: {
+        oilNameList: [
+          { required: true, message: "请选择适用油品", trigger: "change" },
+          { validator: validateOilNameList, trigger: "change" },
+        ],
+        effectiveTimeType: [
+          { required: true, message: "请输入有效期类型", trigger: "change" },
+          { validator: validateEffectiveTimeType, trigger: "change" },
+        ],
+        availableControl: [
+          {
+            required: true,
+            message: "请选择有效期内时间控制",
+            trigger: "change",
+          },
+          { validator: validateAvailableControl, trigger: "change" },
+        ],
+        // verificationList:[
+        //   { required: true, message: "请选择核销机构", trigger: "change" },
+        //   { validator: validateVerificationList, trigger: "change" },
+        // ],
+      },
+      timeSelect: [
+        ,
+        ["周天", "周一", "周二", "周三", "周四", "周五", "周六"],
+        [
+          "1号",
+          "2号",
+          "3号",
+          "4号",
+          "5号",
+          "6号",
+          "7号",
+          "8号",
+          "9号",
+          "10号",
+          "11号",
+          "12号",
+          "13号",
+          "14号",
+          "15号",
+          "16号",
+          "17号",
+          "18号",
+          "19号",
+          "20号",
+          "21号",
+          "22号",
+          "23号",
+          "24号",
+          "25号",
+          "26号",
+          "27号",
+          "28号",
+          "29号",
+          "30号",
+          "31号",
+        ],
+      ],
+    };
+  },
+  created() {
+    this.init();
+    this.getCoupon();
+    this.setPageStatus();
+  },
+  computed: {
+    toggleable() {
+      if (this.moveRightData.length === 0 && this.moveLeftData.length === 0) {
+        return true;
+      }
+      return false;
+    },
+    selectedCouponList() {
+      return this.allVerificationList.filter((ele) => {
+        if (this.createForm.verificationList == null) {
+          this.createForm.verificationList = [];
+        }
+        return this.createForm.verificationList.includes(ele.deptId);
+      });
+    },
+    unselectedCouponList() {
+      return this.allVerificationList.filter((ele) => {
+        if (this.createForm.verificationList == null) {
+          this.createForm.verificationList = [];
+        }
+        return !!!this.createForm.verificationList.includes(ele.deptId);
+      });
+    },
+  },
+  components: {
+    SelectDay: SelectDay,
+  },
+  methods: {
+    couponIsUsedFotmat(row, column) {
+      if (row.couponIsUsed === "0") {
+        return "未使用";
+      } else if (row.couponIsUsed === "1") {
+        return "已使用";
+      }
+    },
+     couponIsEffectiveFotmat(row, column) {
+      if (row.couponIsEffective === "0") {
+        return "无效";
+      } else if (row.couponIsEffective === "1") {
+        return "有效";
+      }
+    },
+    translateTime(row) {
+      let timeString = "";
+      const availableControleType = row.availableControl;
+      if (availableControleType == 0) {
+        return ",有效期内一直都可以领取";
+      }
+      timeString = ",且用户只能在";
+      if (availableControleType == 1) {
+        timeString += "每周的";
+      }
+      if (availableControleType == 2) {
+        timeString += "每月的";
+      }
+      if (availableControleType == 3) {
+        timeString += "指定的日期 ";
+      }
+      if (availableControleType == 1 || availableControleType == 2) {
+        row.cycleDaysList.forEach((ele) => {
+          timeString += this.timeSelect[availableControleType][ele] + "、";
+        });
+      } else if (availableControleType == 3) {
+        timeString += row.appointedDaysList.toString();
+      }
+
+      timeString = timeString.replace(/(、)$/g, "") + "可以使用劵";
+      return timeString;
+    },
+    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;
+    },
+    availableControlChange() {
+      this.createForm.appointedDaysList = [];
+      this.createForm.cycleDaysList = [];
+      this.createForm = { ...this.createForm };
+    },
+    handleMoveLabel(direction, row) {
+      console.log(row);
+      if (this.createForm.verificationList == null) {
+        this.createForm.verificationList = [];
+      }
+
+      if (direction == "right") {
+        this.createForm.verificationList.push(row.deptId);
+      } else {
+        this.createForm.verificationList =
+          this.createForm.verificationList.filter((ele) => {
+            return ele != row.deptId;
+          });
+      }
+    },
+    handleFlagChange() {
+      const that = this;
+      let text = this.couponEnabledFlag === "1" ? "启用" : "停用";
+      this.$confirm('确认要"' + text + '"优惠券功能吗?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(function () {
+          return changeCouponStatus({
+            deptId: that.deptId,
+            couponEnabledFlag: that.couponEnabledFlag,
+          });
+        })
+        .then(() => {
+          that.msgSuccess(text + "成功");
+        })
+        .catch(function () {
+          that.couponEnabledFlag = that.couponEnabledFlag === "0" ? "1" : "0";
+        });
+    },
+    handleStatusChange(row) {
+      let text = row.status === "1" ? "启用" : "停用";
+      this.$confirm(
+        '确认要"' + text + '""' + row.couponName + '"该优惠券吗?',
+        "警告",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      )
+        .then(function () {
+          return updateInfo({
+            id: row.id,
+            status: row.status,
+          });
+        })
+        .then(() => {
+          this.msgSuccess(text + "成功");
+        })
+        .catch(function () {
+          row.status = row.status === "0" ? "1" : "0";
+        });
+    },
+    getOilList() {
+      listPrice()
+        .then((res) => {
+          if (res.code == 200) {
+            this.oilNameList = res.rows || [];
+          } else {
+            throw new Error("");
+          }
+        })
+        .catch((err) => {
+          this.msgError("亲,拉取油品列表失败~");
+        });
+    },
+    getCoupon() {
+      listInfo(this.queryForm)
+        .then((res) => {
+          if (res.code == 200) {
+            console.log(res);
+            if (res.rows == null) {
+              this.total = 0;
+              this.couponList = [];
+            } else {
+              this.total = res.total;
+              this.couponList = res.rows;
+            }
+          } else {
+            throw new Error("");
+          }
+        })
+        .catch((err) => {
+          this.msgError("亲,拉取优惠券列表失败~");
+        });
+    },
+    getVerificationList() {
+      verificationList({
+        pageNum: 1,
+        pageSize: 1000,
+      })
+        .then((res) => {
+          if (res.code == 200) {
+            if (res.rows == null) {
+              this.allVerificationList = [];
+            } else {
+              this.allVerificationList = res.rows;
+            }
+          } else {
+            throw new Error("");
+          }
+        })
+        .catch((err) => {
+          this.msgError("亲,拉取核销机构失败~");
+        });
+    },
+    toggleLabel() {
+      if (this.moveLeftData.length !== 0) {
+        this.createForm.verificationList =
+          this.createForm.verificationList.filter((ele) => {
+            return ele != this.moveLeftData;
+          });
+        this.createForm = { ...this.createForm };
+        return;
+      }
+      if (this.moveRightData.length !== 0) {
+        this.createForm.verificationList = [
+          ...new Set(
+            this.createForm.verificationList.concat(this.moveRightData)
+          ),
+        ].filter((ele) => {
+          return !!ele;
+        });
+        this.createForm = { ...this.createForm };
+        return;
+      }
+      return;
+    },
+     /** 查看优惠卷信息 */
+    handlequeryCouponUserList(row) {
+      this.queryCouponUserFrom.couponId=row;
+    
+     queryCouponUserList(
+       this.queryCouponUserFrom
+      ).then((response) => {
+        this.couponUserList = response.rows;
+        this.userTotal = response.total;
+        this.title = "用户优惠卷信息";
+        this.open = true;
+      });
+      
+    },
+      /** 查看优惠卷信息 */
+    queryCouponUserListByPage() {
+
+    
+     queryCouponUserList(
+       this.queryCouponUserFrom
+      ).then((response) => {
+        this.couponUserList = response.rows;
+        this.userTotal = response.total;
+        this.title = "用户优惠卷信息";
+        this.open = true;
+      });
+      
+    },
+    handleLeftChange(val) {
+      let changeArr = [];
+      val.map((ele) => {
+        changeArr.push(ele.deptId);
+      });
+      console.log(changeArr);
+      this.moveLeftData = [];
+      this.moveRightData = changeArr;
+      // console.log(this.moveRightData);
+      this.$refs.rightTable.clearSelection();
+    },
+    handleRightChange(val) {
+      let changeArr = [];
+      val.map((ele) => {
+        changeArr.push(ele.deptId);
+      });
+      this.moveLeftData = changeArr;
+      this.moveRightData = [];
+      this.$refs.leftTable.clearSelection();
+    },
+    init() {
+      this.getOilList();
+      this.getCoupon();
+      this.getVerificationList();
+    },
+    setPageStatus() {
+      this.queryPageStatus([2]).then((res) => {
+        this.pageStatus = res;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryForm.pageNum = 1;
+      this.getList();
+    },
+     /** 查询优惠卷模板信息*/
+    getList() {
+       listInfo(this.addDateRange(this.queryForm, this.dateRangeCreatedDate))
+        .then((res) => {
+          if (res.code == 200) {
+            console.log(res);
+            if (res.rows == null) {
+              this.total = 0;
+              this.couponList = [];
+            } else {
+              this.total = res.total;
+              this.couponList = res.rows;
+            }
+          } else {
+            throw new Error("");
+          }
+        })
+        .catch((err) => {
+          this.msgError("亲,拉取优惠券列表失败~");
+        });
+    },
+    deviceNoInput(value) {
+      this.createForm.posQueue = value;
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRangeCreatedDate=[];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.title = "添加优惠券";
+      this.createForm = {
+        couponRemark: "",
+        couponName: "",
+        couponDetails: "",
+        couponThresholdAmt: 0,
+        couponType: "1",
+        couponAmt: "",
+        oilNameList: [],
+        effectiveTimeType: "", //有效时间类型: 1,固定时间;2,领取后x天内有效
+        effectiveTime: [],
+        effectiveDayNum: 30,
+        couponHoldNum: 1,
+        couponReceiveNum: 100,
+        couponNum: 100,
+        status: "1",
+        verificationList: [],
+        isCardFlag: "1",
+        isGradeFlag: "1",
+        isMarketFlag: "1",
+        availableControl: "0",
+        appointedDaysList: [],
+        cycleDaysList: [],
+      };
+      this.open = true;
+    },
+    /** 修改按钮操作 */
+    handleUpdate(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["createForm"].validate((valid) => {
+        if (valid) {
+          if (!!this.createForm.id) {
+            updateInfo(this.createForm)
+              .then((res) => {
+                if (res.code == 200) {
+                  this.msgSuccess("亲,修改成功了~");
+                  this.getCoupon();
+                  this.open = false;
+                } else {
+                  throw new Error("");
+                }
+              })
+              .catch((err) => {
+                this.msgError("修改失败了呀~");
+              });
+          } else {
+            addInfo(this.createForm)
+              .then((res) => {
+                if (res.code == 200) {
+                  this.msgSuccess("亲,新增成功了~");
+                  this.getCoupon();
+                  this.open = false;
+                } else {
+                  throw new Error("");
+                }
+              })
+              .catch((err) => {
+                this.msgError("创建优惠劵失败了~");
+              });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      // const deviceIds = row.deviceId;
+      // this.$confirm("是否确认删除油站设备管理", "警告", {
+      //   confirmButtonText: "确定",
+      //   cancelButtonText: "取消",
+      //   type: "warning",
+      // })
+      //   .then(function () {
+      //     return delManage(deviceIds);
+      //   })
+      //   .then(() => {
+      //     this.getList();
+      //     this.msgSuccess("删除成功");
+      //   });
+    },
+  },
+};
+</script>
+<style lang="scss">
+.el-transfer__buttons {
+}
+</style>

+ 105 - 146
src/views/coupon/Coupon_Statistics/realTime.vue

@@ -6,27 +6,10 @@
       :inline="true"
       label-width="68px"
     >
-      <el-form-item label="订单号" prop="orderNo">
-        <el-input
-          v-model="queryParams.orderNo"
-          placeholder="请输入订单号"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="客户姓名" prop="likeConsumer">
-        <el-input
-          v-model="queryParams.likeConsumer"
-          placeholder="请输入客户姓名"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="油品名称" prop="oilName">
+     
+      <!-- <el-form-item label="是否使用" prop="couponIsUsed">
         <el-select
-          v-model="queryParams.oilName"
+          v-model="queryParams.couponIsUsed"
           placeholder="油品名称"
           clearable
           size="small"
@@ -38,27 +21,20 @@
             :value="dict.dictLabel"
           />
         </el-select>
-      </el-form-item>
-      <el-form-item label="加油员" prop="oilPersonnel">
-        <el-input
-          v-model="queryParams.oilPersonnel"
-          placeholder="请输入加油员"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="油枪" prop="oilGun">
-        <el-input
-          v-model="queryParams.oilGun"
-          placeholder="请输入油枪"
+      </el-form-item> -->
+       <el-form-item label="是否使用" prop="couponIsUsed">
+        <el-select
+          v-model="queryParams.couponIsUsed"
           clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
+          placeholder="请选择"
+        >
+          <el-option label="已使用" value="1" ></el-option>
+          <el-option label="未使用" value="0" ></el-option>
+         
+        </el-select>
       </el-form-item>
-
-      <el-form-item label="创建时间" prop="createdDate">
+    
+      <el-form-item label="领取时间" prop="getCouponTime">
         <el-date-picker
           style="width: 350px"
           v-model="dateRangeCreatedDate"
@@ -86,95 +62,91 @@
           @click="resetQuery"
           >重置</el-button
         >
-        <el-button
+        <!-- <el-button
           type="warning"
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
           >导出</el-button
-        >
+        > -->
       </el-form-item>
     </el-form>
-    <el-table :data="orderList">
-      <af-table-column label="油站名" align="center" prop="stationName" v-if="jiBie==0||jiBie==1"/>
+    <el-table :data="couponUserList">
+      <af-table-column label="油站名" align="center" prop="id" v-if="jiBie==0||jiBie==1"/>
       <af-table-column
         v-if="false"
-        label="订单id"
-        align="center"
-        prop="orderId"
-      />
-      <af-table-column label="订单号" align="center" prop="orderNo" />
-      <af-table-column label="油品名称" align="center" prop="oilName" />
-      <af-table-column label="油品价格" align="center" prop="oilPirce" />
-      <af-table-column label="加油升数" align="center" prop="orderLiters" />
-      <af-table-column label="应付金额" align="center" prop="receivableAmt" />
-      <af-table-column label="实付金额" align="center" prop="amt" />
-      <af-table-column label="优惠金额" align="center" prop="discountAmt" />
-      <af-table-column label="客户姓名" align="center" prop="consumer" />
-      <af-table-column label="加油员" align="center" prop="oilPersonnel" />
-      <af-table-column label="加油枪号" align="center" prop="oilGun" />
-      <af-table-column
-        label="支付类型"
+        label="优惠卷id"
         align="center"
-        prop="payType"
-        width="150px"
-        :formatter="payTypeFotmat"
+        prop="id"
       />
+      <af-table-column label="用户ID" align="center" prop="unionId" v-if="false" />
+      <af-table-column label="油站ID" align="center" prop="stationId" v-if="false" />
+      <af-table-column label="发放方式ID" align="center" prop="issueId" v-if="false" />
+      <af-table-column label="发放方式标识" align="left" prop="issueRemark" />
+       <af-table-column label="活动名称" align="left" prop="issueName" />
+      
+      <af-table-column label="优惠券ID" align="center" prop="couponId"  v-if="false"/>
       <af-table-column
-        label="油站名称"
-        align="center"
-        v-if="false"
-        prop="stationName"
-      />
-      <af-table-column
-        v-if="false"
-        label="用户id(消费者)"
-        align="center"
-        prop="consumerId"
-      />
-      <af-table-column
-        v-if="false"
-        label="油站id"
-        align="center"
-        prop="stationId"
-      />
-      <af-table-column
-        label="状态"
-        width="130px"
-        align="center"
-        prop="status"
-        :formatter="statusFotmat"
-      />
-      <af-table-column label="支付时间" align="center" prop="payDate">
+          label="优惠券标识"
+          align="left"
+          prop="couponRemark"
+          fixed="left"
+        />
+        <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="center"
+       >
+           <template slot-scope="scope">
+            {{ scope.row.couponIsUsed == "0" ? "未使用" : "" }}
+            {{ scope.row.couponIsUsed == "1" ? "已使用" : "" }}
+            {{ scope.row.couponIsUsed == "2" ? "已核销" : "" }}
+          </template>
+      </af-table-column>
+      <af-table-column label="是否有效"
+       align="center"
+      >
+       <template slot-scope="scope">
+            {{ scope.row.couponIsEffective == "0" ? "无效" : "" }}
+            {{ scope.row.couponIsEffective == "1" ? "有效" : "" }}
+          </template>
+      </af-table-column>
+      <af-table-column label="用户保存id" align="center" prop="userId" v-if="false" />
+      <af-table-column label="手机号" align="center" prop="mobilePhone" />
+      <af-table-column label="用户名" align="center" prop="blogNickName" />
+       <af-table-column label="核销员手机号" align="center" prop="verificationUserPhone" />
+      <af-table-column label="优惠券获取时间" align="center" prop="getCouponTime">
         <template slot-scope="scope">
           <span>{{
-            parseTime(scope.row.payDate, "{y}-{m}-{d} {h}:{i}:{s}")
+            parseTime(scope.row.getCouponTime, "{y}-{m}-{d} {h}:{i}:{s}")
           }}</span>
         </template>
       </af-table-column>
-      <af-table-column label="创建时间" align="center" prop="createdDate">
+      <af-table-column label="优惠券截止时间" align="center" prop="couponEffectiveTime">
         <template slot-scope="scope">
           <span>{{
-            parseTime(scope.row.createdDate, "{y}-{m}-{d} {h}:{i}:{s}")
+            parseTime(scope.row.couponEffectiveTime, "{y}-{m}-{d} {h}:{i}:{s}")
           }}</span>
         </template>
       </af-table-column>
-       <af-table-column
-        label="操作"
-        align="center"
-        class-name="small-padding fixed-width"
-        width="120px"
-        v-if="reprint"
-      >
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-plus"
-            @click="printOrderInfo(scope.row)"
-            >补打小票</el-button>
-        </template>
-      </af-table-column>
+      
     </el-table>
     <pagination
       v-show="total > 0"
@@ -189,20 +161,21 @@
 import { listOrder, exportOrder,printOrderInfo } from "@/api/station/order";
 import { stationinfo } from "@/api/station/gun";
 import { listPrice, getPrice } from "@/api/station/price";
+import {queryCouponUserList} from "@/api/coupon";
 import {
   listManage
 } from "@/api/station/manage";
 
 export default {
-  name: "Order_Oil",
+  name: "coupon_user",
   data() {
     return {
       //创建订单时间间隔
       dateRangeCreatedDate: [],
       // 总条数
       total: 0,
-      // 订单支付表格数据
-      orderList: [],
+      // 优惠卷的信息
+      couponUserList: [],
       oilNameOptions: [],
       // 字典
       payTypeOptions: [],
@@ -217,14 +190,12 @@ export default {
         levelId:this.levelId,
         pageNum: 1,
         pageSize: 10,
-        oilGun: null,
-        oilName: null,
+        issueId: null,
+        couponId: null,
         stationId: null,
-        orderType: 1,
-        oilPersonnel: null,
-        createdDate: null,
-        likeConsumer: null,
-        orderNo:null
+        couponIsUsed: null,
+        couponIsEffective: null,
+        getCouponTime: null
       },
       // 表单校验
       rules: {},
@@ -233,9 +204,9 @@ export default {
   },
   created() {
     this.getList();
-    listManage({
+    queryCouponUserList({
       pageNum: 1,
-      pageSize: 1,
+      pageSize: 10,
     }).then((response) => {
       const equipmentList = response.rows;
       if(!!equipmentList){
@@ -256,37 +227,30 @@ export default {
     });
   },
   methods: {
-    payTypeFotmat(row, column) {
-      if (row.payType === "wx") {
-        return "微信支付";
-      } else if (row.payType === "zfb") {
-        return "支付宝支付";
-      } else if (row.payType === "xj") {
-        return "现金支付";
-      } else if (row.payType === "dzk") {
-        return "电子卡支付";
-      } else if (row.payType === "POS") {
-        return "POS机支付";
-      } else if (row.payType === "yzf") {
-        return "预支付";
-      } else if (row.payType === "kbzf") {
-        return "卡包支付";
+ 
+    couponIsUsedFotmat(row, column) {
+      if (row.couponIsUsed === "0") {
+        return "未使用";
+      } else if (row.couponIsUsed === "1") {
+        return "已使用";
+      } else if (row.couponIsUsed === "2") {
+        return "已核销";
       }
     },
-    statusFotmat(row, column) {
-      if (row.status === "0") {
-        return "未支付";
-      } else if (row.status === "1") {
-        return "已支付";
+     couponIsEffectiveFotmat(row, column) {
+      if (row.couponIsEffective === "0") {
+        return "无效";
+      } else if (row.couponIsEffective ==="1") {
+        return "有效";
       }
     },
     /** 查询订单支付列表 */
     getList() {
       this.queryParams.levelId = this.levelId
-      listOrder(
+      queryCouponUserList(
         this.addDateRange(this.queryParams, this.dateRangeCreatedDate)
       ).then((response) => {
-        this.orderList = response.rows;
+        this.couponUserList = response.rows;
         this.total = response.total;
       });
     },
@@ -301,12 +265,7 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    //打印订单小票
-    printOrderInfo(row){
-      printOrderInfo({orderId:row.orderId}).then((response) => {
-         this.msgSuccess("小票打印成功");
-      });
-    },
+   
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;

+ 3 - 0
src/views/station/Station_Employee.vue

@@ -301,6 +301,9 @@ export default {
         checkedGunList: [
           { required: true, message: "请选择油枪", trigger: "change" },
         ],
+        personnelPhone: [
+          { required: true, message: "请输入加油员手机号", trigger: "blur" },
+        ],
       },
       pageStatus: 0,
       confirmDialog: false,

+ 5 - 2
src/views/station/Station_Group.vue

@@ -30,12 +30,15 @@
         </div>
       </el-form-item>
       <el-form-item label="集团内共享优惠劵" prop="couponFlag">
-        <el-radio-group v-model="form.couponFlag" :disabled="true">
+        <el-radio-group v-model="form.couponFlag" :disabled="disabled">
           <el-radio label="0">不共享</el-radio>
           <el-radio label="1">共享</el-radio>
         </el-radio-group>
         <div style="color: red; font-size: 12px">
-          此功能暂未开放,不支持设置
+          不共享:每个站点单独设置优惠卷规则,每个集团下优惠卷不通用
+        </div>
+        <div style="color: red; font-size: 12px">
+          共享:集团站点统一设置优惠卷规则,每个集团下的站点优惠卷通用
         </div>
       </el-form-item>
     </el-form>