Selaa lähdekoodia

引入基础文件

Joe 4 vuotta sitten
vanhempi
commit
43926b6407
47 muutettua tiedostoa jossa 4664 lisäystä ja 1315 poistoa
  1. 3 2
      package.json
  2. 53 0
      src/api/coupon/info.js
  3. 71 0
      src/api/customer/card.js
  4. 19 0
      src/api/customer/cardReport.js
  5. 9 0
      src/api/customer/cardSetting.js
  6. 60 0
      src/api/customer/cardSettingDetail.js
  7. 81 0
      src/api/customer/consumption.js
  8. 79 0
      src/api/customer/recharge.js
  9. 18 0
      src/api/customer/record.js
  10. 34 4
      src/api/dataSource/saleReport.js
  11. 25 1
      src/api/integral/rule.js
  12. 3 1
      src/components/SelectDept/index.vue
  13. 6 0
      src/store/modules/user.js
  14. 42 0
      src/views/coupon/common/couponTable.vue
  15. 333 0
      src/views/coupon/info/index.vue
  16. 414 0
      src/views/customer/card/index.vue
  17. 364 125
      src/views/customer/cardSetting/index.vue
  18. 200 0
      src/views/customer/cardSettingDetail/index.vue
  19. 24 13
      src/views/customer/consumption/index.vue
  20. 32 70
      src/views/customer/manage/index.vue
  21. 15 15
      src/views/customer/recharge/index.vue
  22. 647 0
      src/views/customer/report/customerReport copy.vue
  23. 421 0
      src/views/customer/report/customerReport.vue
  24. 61 32
      src/views/customer/setting/index.vue
  25. 169 29
      src/views/dataSource/dayReport.vue
  26. 96 45
      src/views/dataSource/saleReport.vue
  27. 3 1
      src/views/integral/order/index.vue
  28. 8 4
      src/views/integral/points/index.vue
  29. 4 1
      src/views/integral/record/index.vue
  30. 97 382
      src/views/integral/rule/index.vue
  31. 36 13
      src/views/integral/rule/index1.vue
  32. 307 129
      src/views/integral/ruledetail/index.vue
  33. 29 59
      src/views/integral/wares/index.vue
  34. 2 2
      src/views/login.vue
  35. 249 106
      src/views/market/plan/index.vue
  36. 3 0
      src/views/station/adjust/index.vue
  37. 95 47
      src/views/station/gun/index.vue
  38. 6 6
      src/views/station/info/index.vue
  39. 38 33
      src/views/station/manage/index.vue
  40. 18 15
      src/views/station/order/index.vue
  41. 19 22
      src/views/station/order/notOil.vue
  42. 43 64
      src/views/station/pay/index.vue
  43. 45 36
      src/views/station/personnel/index.vue
  44. 62 38
      src/views/station/price/index.vue
  45. 7 4
      src/views/station/structure/index.vue
  46. 312 15
      src/views/station/summary/index.vue
  47. 2 1
      vue.config.js

+ 3 - 2
package.json

@@ -36,8 +36,8 @@
     "management-system"
   ],
   "dependencies": {
-    "@riophae/vue-treeselect": "0.4.0",
-    "axios": "0.18.1",
+    "@riophae/vue-treeselect": "^0.4.0",
+    "axios": "^0.21.1",
     "clipboard": "2.0.4",
     "core-js": "3.6.5",
     "echarts": "4.2.1",
@@ -56,6 +56,7 @@
     "vue": "2.6.10",
     "vue-count-to": "1.0.13",
     "vue-cropper": "0.4.9",
+    "vue-resource": "^1.5.2",
     "vue-router": "3.0.2",
     "vue-splitpane": "1.0.4",
     "vuedraggable": "2.20.0",

+ 53 - 0
src/api/coupon/info.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询优惠劵列表
+export function listInfo(query) {
+  return request({
+    url: '/coupon/info/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询优惠劵详细
+export function getInfo(id) {
+  return request({
+    url: '/coupon/info/' + id,
+    method: 'get'
+  })
+}
+
+// 新增优惠劵
+export function addInfo(data) {
+  return request({
+    url: '/coupon/info',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改优惠劵
+export function updateInfo(data) {
+  return request({
+    url: '/coupon/info',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除优惠劵
+export function delInfo(id) {
+  return request({
+    url: '/coupon/info/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出优惠劵
+export function exportInfo(query) {
+  return request({
+    url: '/coupon/info/export',
+    method: 'get',
+    params: query
+  })
+}

+ 71 - 0
src/api/customer/card.js

@@ -0,0 +1,71 @@
+import request from '@/utils/request'
+
+// 查询客户电子会员卡(储蓄卡)列表
+export function listCard(query) {
+  return request({
+    url: '/customer/card/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员卡(储蓄卡)列表
+export function listSum(query) {
+  return request({
+    url: '/customer/card/listSum',
+    method: 'get',
+    params: query
+  })
+}
+// 查询客户电子会员卡(储蓄卡)列表
+export function selectCard(query) {
+  return request({
+    url: '/customer/card/selectCard',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询客户电子会员卡(储蓄卡)详细
+export function getCard(id) {
+  return request({
+    url: '/customer/card/' + id,
+    method: 'get'
+  })
+}
+
+// 新增客户电子会员卡(储蓄卡)
+export function addCard(data) {
+  return request({
+    url: '/customer/card',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改客户电子会员卡(储蓄卡)
+export function updateCard(data) {
+  return request({
+    url: '/customer/card',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除客户电子会员卡(储蓄卡)
+export function delCard(id) {
+  return request({
+    url: '/customer/card/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出客户电子会员卡(储蓄卡)
+export function exportCard(query) {
+  return request({
+    url: '/customer/card/export',
+    method: 'get',
+    params: query
+  })
+}

+ 19 - 0
src/api/customer/cardReport.js

@@ -0,0 +1,19 @@
+import request from '@/utils/request'
+
+// 查询客户电子会员汇总数据
+export function listSum(query) {
+  return request({
+    url: '/customer/cardsetting/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员汇总数据
+export function amtList(query) {
+  return request({
+    url: '/customer/cardsetting/list',
+    method: 'get',
+    params: query
+  })
+}

+ 9 - 0
src/api/customer/cardSetting.js

@@ -50,4 +50,13 @@ export function exportSetting(query) {
     method: 'get',
     params: query
   })
+}
+
+// 查询客户电子会员卡充值优惠设置详细
+export function selectCustomerCardSetting(query) {
+  return request({
+    url: '/customer/cardsetting/selectCustomerCardSetting' ,
+    method: 'get',
+    params: query
+  })
 }

+ 60 - 0
src/api/customer/cardSettingDetail.js

@@ -0,0 +1,60 @@
+import request from '@/utils/request'
+
+// 查询客户电子会员卡充值优惠设置明细列表
+export function listDetail(query) {
+  return request({
+    url: '/customer/detail/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function listDetailInfo(query) {
+  return request({
+    url: '/customer/detail/listDetailInfo',
+    method: 'get',
+    params: query
+  })
+}
+// 查询客户电子会员卡充值优惠设置明细详细
+export function getDetail(id) {
+  return request({
+    url: '/customer/detail/' + id,
+    method: 'get'
+  })
+}
+
+// 新增客户电子会员卡充值优惠设置明细
+export function addDetail(data) {
+  return request({
+    url: '/customer/detail',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改客户电子会员卡充值优惠设置明细
+export function updateDetail(data) {
+  return request({
+    url: '/customer/detail',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除客户电子会员卡充值优惠设置明细
+export function delDetail(id) {
+  return request({
+    url: '/customer/detail/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出客户电子会员卡充值优惠设置明细
+export function exportDetail(query) {
+  return request({
+    url: '/customer/detail/export',
+    method: 'get',
+    params: query
+  })
+}

+ 81 - 0
src/api/customer/consumption.js

@@ -0,0 +1,81 @@
+import request from '@/utils/request'
+
+// 查询客户电子会员卡消费记录列表
+export function listConsumption(query) {
+  return request({
+    url: '/customer/consumption/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员卡消费记录详细
+export function getConsumption(id) {
+  return request({
+    url: '/customer/consumption/' + id,
+    method: 'get'
+  })
+}
+
+// 新增客户电子会员卡消费记录
+export function addConsumption(data) {
+  return request({
+    url: '/customer/consumption',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改客户电子会员卡消费记录
+export function updateConsumption(data) {
+  return request({
+    url: '/customer/consumption',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除客户电子会员卡消费记录
+export function delConsumption(id) {
+  return request({
+    url: '/customer/consumption/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出客户电子会员卡消费记录
+export function exportConsumption(query) {
+  return request({
+    url: '/customer/consumption/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员卡消费记录列表
+export function xfAmtQuery(query) {
+  return request({
+    url: '/customer/consumption/xfAmtQuery',
+    method: 'get',
+    params: query
+  })
+}
+
+
+// 查询客户电子会员卡消费记录列表
+export function listXdata(query) {
+  return request({
+    url: '/customer/consumption/listXdata',
+    method: 'get',
+    params: query
+  })
+}
+
+
+export function listQydataXF(query) {
+  return request({
+    url: '/customer/consumption/listQydataXF',
+    method: 'get',
+    params: query
+  })
+}

+ 79 - 0
src/api/customer/recharge.js

@@ -0,0 +1,79 @@
+import request from '@/utils/request'
+
+// 查询客户电子会员卡充值记录列表
+export function listRecharge(query) {
+  return request({
+    url: '/customer/recharge/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员卡充值记录详细
+export function getRecharge(id) {
+  return request({
+    url: '/customer/recharge/' + id,
+    method: 'get'
+  })
+}
+
+// 新增客户电子会员卡充值记录
+export function addRecharge(data) {
+  return request({
+    url: '/customer/recharge',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改客户电子会员卡充值记录
+export function updateRecharge(data) {
+  return request({
+    url: '/customer/recharge',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除客户电子会员卡充值记录
+export function delRecharge(id) {
+  return request({
+    url: '/customer/recharge/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出客户电子会员卡充值记录
+export function exportRecharge(query) {
+  return request({
+    url: '/customer/recharge/export',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员卡充值记录列表
+export function czAmtQuery(query) {
+  return request({
+    url: '/customer/recharge/czAmtQuery',
+    method: 'get',
+    params: query
+  })
+}
+
+export function listQydataCZ(query) {
+  return request({
+    url: '/customer/recharge/listQydataCZ',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员卡(储蓄卡)列表
+export function selectCardDetail(query) {
+  return request({
+    url: '/customer/recharge/selectCardDetail',
+    method: 'get',
+    params: query
+  })
+}

+ 18 - 0
src/api/customer/record.js

@@ -50,4 +50,22 @@ export function exportRecord(query) {
     method: 'get',
     params: query
   })
+}
+
+// 查询客户电子会员汇总数据
+export function listSum(query) {
+  return request({
+    url: '/customer/cardsetting/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询客户电子会员汇总数据
+export function amtList(query) {
+  return request({
+    url: '/customer/cardsetting/list',
+    method: 'get',
+    params: query
+  })
 }

+ 34 - 4
src/api/dataSource/saleReport.js

@@ -38,7 +38,8 @@ export function listDayReport(query) {
     method: 'get',
     params: query
   })
-}export function selectDayReportDetail(query) {
+}
+export function selectDayReportDetail(query) {
   return request({
     url: '/station/order/selectDayReportDetail',
     method: 'get',
@@ -47,7 +48,7 @@ export function listDayReport(query) {
 }
 export function getDetails(query) {
   return request({
-    url: '/station/order/list',
+    url: '/station/order/dayOilTypeSources',
     method: 'get',
     params: query
   })
@@ -66,9 +67,9 @@ export function listQydata95(query) {
     params: query
   })
 }
-export function listQydata97(query) {
+export function listQydata98(query) {
   return request({
-    url: '/station/order/listQydata97',
+    url: '/station/order/listQydata98',
     method: 'get',
     params: query
   })
@@ -101,4 +102,33 @@ export function listXdata(query) {
     params: query
   })
 }
+export function listCZData(query) {
+  return request({
+    url: '/customer/recharge/listCZData',
+    method: 'get',
+    params: query
+  })
+}
+
+export function listXFData(query) {
+  return request({
+    url: '/customer/consumption/listXFData',
+    method: 'get',
+    params: query
+  })
+}
+export function listHYData(query) {
+  return request({
+    url: '/customer/card/listHYData',
+    method: 'get',
+    params: query
+  })
+}
+export function listJRHYData(query) {
+  return request({
+    url: '/customer/card/listJRHYData',
+    method: 'get',
+    params: query
+  })
+}
 

+ 25 - 1
src/api/integral/rule.js

@@ -8,7 +8,22 @@ export function listRule(query) {
     params: query
   })
 }
-
+// 查询积分规则明细
+export function listRuleInfo(query) {
+  return request({
+    url: '/integral/rule/listRuleInfo',
+    method: 'get',
+    params: query
+  })
+}
+// 查询积分规则列表
+export function listRuleOne(query) {
+  return request({
+    url: '/integral/rule/listRuleOne',
+    method: 'get',
+    params: query
+  })
+}
 // 查询规则详细
 export function getRule(id) {
   return request({
@@ -24,6 +39,15 @@ export function oilNameList(query) {
     params: query
   })
 }
+
+// 查询油站对应的油品名称
+export function oilNameInfo(query) {
+  return request({
+    url: '/station/price/oilNameInfo',
+    method: 'get',
+    params: query
+  })
+}
 // 查询油站,油品,对应的等级
 export function gradeList(query) {
   return request({

+ 3 - 1
src/components/SelectDept/index.vue

@@ -2,9 +2,10 @@
   <treeselect
     style="
       width: 180px;
-      height: 28px;
+      height: 40px;
       position: relative;
       display: inline-block;
+      line-height: 50px;
     "
     v-model="value"
     :options="options"
@@ -39,6 +40,7 @@ export default {
       userdepttree().then((response) => {
         this.options = response.data;
         if (response.data != null && response.data.length > 0) {
+          console.log("111",response);
           this.value = response.data[0].id;
           this.$store.selectDeptName = response.data[0].label;
           this.$store.selectDeptId = response.data[0].id;

+ 6 - 0
src/store/modules/user.js

@@ -5,6 +5,7 @@ const user = {
   state: {
     token: getToken(),
     name: '',
+    deptId:'',
     avatar: '',
     roles: [],
     permissions: []
@@ -25,6 +26,9 @@ const user = {
     },
     SET_PERMISSIONS: (state, permissions) => {
       state.permissions = permissions
+    },
+    SET_DEPT:(state,deptId)=>{
+      state.deptId=deptId
     }
   },
 
@@ -60,6 +64,7 @@ const user = {
           }
           commit('SET_NAME', user.userName)
           commit('SET_AVATAR', avatar)
+          commit('SET_DEPT', user.deptId)
           resolve(res)
         }).catch(error => {
           reject(error)
@@ -74,6 +79,7 @@ const user = {
           commit('SET_TOKEN', '')
           commit('SET_ROLES', [])
           commit('SET_PERMISSIONS', [])
+          commit('SET_DEPT', '')
           removeToken()
           resolve()
         }).catch(error => {

+ 42 - 0
src/views/coupon/common/couponTable.vue

@@ -0,0 +1,42 @@
+<template>
+  <div class="tabCoupone">
+    <el-tabs v-model="activeName" >
+      <el-tab-pane label="所有劵" name="some" :key="'some'">
+        <child1></child1>
+      </el-tab-pane>
+      <el-tab-pane label="待发劵" name="daifa" :key="'daifa'">
+        <child2></child2>
+      </el-tab-pane>
+      <el-tab-pane label="已发放" name="yifa" :key="'yifa'">
+        <child3></child3>
+      </el-tab-pane>
+      <el-tab-pane label="已下线" name="xiaxian" :key="'xiaxian'">
+        <child3></child3>
+      </el-tab-pane>
+    </el-tabs>
+  </div>
+</template>
+<script>
+  import tabChild1 from '../info/index.vue'
+  // import tabChild2 from '../pay/index.vue'
+  // import tabChild3 from '../manage/index.vue'
+  export default {
+    name: 'tabCoupone',
+    components:{
+      child1:tabChild1
+    },
+    data() {
+      return {
+        activeName: 'info'
+      };
+    },
+    methods: {
+    }
+  };
+</script>
+<style>
+  .tabZujian {
+    margin-left: 20px;
+    margin-top: 20px;
+  }
+</style>

+ 333 - 0
src/views/coupon/info/index.vue

@@ -0,0 +1,333 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="优惠劵类别" prop="couponType">
+        <el-select v-model="queryParams.couponType" placeholder="请选择优惠劵类型 1现金劵,2折扣券,3兑换券" clearable size="small">
+          <el-option label="请选择字典生成" value="" />
+        </el-select>
+      </el-form-item>
+      
+      <el-form-item label="油品名称" prop="oilName">
+        <el-input
+          v-model="queryParams.oilName"
+          placeholder="请输入油品名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="发放状态" prop="grantStatus">
+        <el-select v-model="queryParams.grantStatus" placeholder="请选择发放状态" clearable size="small">
+          <el-option label="请选择字典生成" value="" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button  type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['coupon:info:add']">创建优惠劵</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="id" align="center" prop="id" v-if="false"/>
+      <el-table-column label="优惠劵ID" align="center" prop="couponId"  />
+      <el-table-column label="优惠劵名称" align="center" prop="couponName" />
+      <el-table-column label="油品名称" align="center" prop="oilName" />
+      <el-table-column label="优惠劵类型" align="center" prop="couponType" v-if="false" />
+      <el-table-column label="使用门槛" align="center" prop="useDiscountType" />
+      <el-table-column label="1 柴油,2 汽油" align="center" prop="oilType" v-if="false" />
+      <el-table-column label="面值" align="center" prop="couponAmt" />
+      <el-table-column label="优惠劵数量" align="center" prop="couponNum" />
+      <el-table-column label="有效时间类型" align="center" prop="effectiveTimeType" v-if="false"  />
+      <el-table-column label="固定时间-有效开始时间" align="center" prop="effectiveTimeStart" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.effectiveTimeStart, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="固定时间-有效结束时间" align="center" prop="effectiveTimeEnd" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.effectiveTimeEnd, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="有效天数" align="center" prop="effectiveDayNum" />
+      <el-table-column label="优惠劵领取数量" align="center" prop="couponReceiveNum" />
+      <el-table-column label="有效状态,1未生效" align="center" prop="status" />
+      <!-- <el-table-column label="发放平台,1.微信 2支付宝" align="center" prop="openPlatform" /> -->
+      <el-table-column label="发放状态" align="center" prop="grantStatus" />
+      <el-table-column label="创建人" align="center" prop="createBy" />
+      <el-table-column label="创建时间" align="center" prop="createTime" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['coupon:info:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['coupon:info:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改优惠劵对话框 -->
+    <el-dialog :title="title" :visible.sync="open"  append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="90px">
+        <el-form-item label="优惠劵ID" prop="couponId">
+          <el-input v-model="form.couponId" placeholder="请输入优惠劵ID" />
+        </el-form-item>
+        <el-form-item label="优惠劵名称" prop="couponName">
+          <el-input v-model="form.couponName" placeholder="请输入优惠劵名称" />
+        </el-form-item>
+        <el-form-item label="优惠劵类型" prop="couponType">
+          <el-select v-model="form.couponType" placeholder="请选择优惠劵类型 1现金劵,2折扣券,3兑换券">
+            <el-option label="请选择字典生成" value="" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="油品" prop="oilName">
+          <!-- <el-input v-model="form.oilName" placeholder="请输入油品" /> -->
+        </el-form-item>
+        <el-form-item label="使用门槛类型" prop="useDiscountType">
+          <el-select v-model="form.useDiscountType" placeholder="请选择优惠劵使用门槛类型。 1.无门槛,2满减劵,3折扣">
+            <el-option label="请选择字典生成" value="" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="优惠劵面值" prop="couponAmt">
+          <el-input v-model="form.couponAmt" placeholder="请输入优惠劵面值" />元
+        </el-form-item>
+        <el-form-item label="优惠劵数量" prop="couponNum">
+          <el-input v-model="form.couponNum" placeholder="请输入优惠劵数量" />张
+        </el-form-item>
+        <el-form-item label="有效时间类型" prop="effectiveTimeType">
+          <el-select v-model="form.effectiveTimeType" placeholder="请选择有效时间类型 1固定时间,2领取后x天内有效">
+            <el-option label="请选择字典生成" value="" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="固定时间" >
+          <el-date-picker clearable size="small" style="width: 200px"
+            v-model="form.effectiveTimeStart"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择固定时间-有效开始时间">
+          </el-date-picker>
+          <el-date-picker clearable size="small" style="width: 200px"
+            v-model="form.effectiveTimeEnd"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择固定时间-有效结束时间">
+          </el-date-picker>
+        </el-form-item>
+   
+        <el-form-item label="有效天数" prop="effectiveDayNum">
+          <el-input v-model="form.effectiveDayNum" placeholder="请输入有效天数" />
+        </el-form-item>
+        <el-form-item label="每人限领取数量" prop="couponReceiveNum">
+          <el-input v-model="form.couponReceiveNum" placeholder="请输入优惠劵领取数量" />
+        </el-form-item>
+        <el-form-item label="发放平台,1.微信 2支付宝" prop="openPlatform">
+          <el-input v-model="form.openPlatform" placeholder="请输入发放平台,1.微信 2支付宝" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo } from "@/api/coupon/info";
+
+export default {
+  name: "Info",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 优惠劵表格数据
+      infoList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        couponId: null,
+        couponName: null,
+        couponType: null,
+        useDiscountType: null,
+        oilName: null,
+        oilType: null,
+        couponAmt: null,
+        couponNum: null,
+        effectiveTimeType: null,
+        effectiveTimeStart: null,
+        effectiveTimeEnd: null,
+        effectiveDayNum: null,
+        couponReceiveNum: null,
+        openPlatform: null,
+        grantStatus: null,
+        status: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询优惠劵列表 */
+    getList() {
+      this.loading = true;
+      listInfo(this.queryParams).then(response => {
+        this.infoList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        couponId: null,
+        couponName: null,
+        couponType: null,
+        useDiscountType: null,
+        oilName: null,
+        oilType: null,
+        couponAmt: null,
+        couponNum: null,
+        effectiveTimeType: null,
+        effectiveTimeStart: null,
+        effectiveTimeEnd: null,
+        effectiveDayNum: null,
+        couponReceiveNum: null,
+        openPlatform: null,
+        grantStatus: "0",
+        status: "0",
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加优惠劵";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getInfo(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改优惠劵";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateInfo(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addInfo(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除优惠劵编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delInfo(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有优惠劵数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportInfo(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        })
+    }
+  }
+};
+</script>

+ 414 - 0
src/views/customer/card/index.vue

@@ -0,0 +1,414 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="微信用户唯一标识unionId" prop="unionId">
+        <el-input
+          v-model="queryParams.unionId"
+          placeholder="请输入微信用户唯一标识unionId"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="公众号openId" prop="blogOpenid">
+        <el-input
+          v-model="queryParams.blogOpenid"
+          placeholder="请输入公众号openId"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="小程序openId" prop="minaOpenid">
+        <el-input
+          v-model="queryParams.minaOpenid"
+          placeholder="请输入小程序openId"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="会员编号" prop="customerNo">
+        <el-input
+          v-model="queryParams.customerNo"
+          placeholder="请输入会员编号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="客户名" prop="customerName">
+        <el-input
+          v-model="queryParams.customerName"
+          placeholder="请输入客户名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="用户手机号" prop="mobilePhone">
+        <el-input
+          v-model="queryParams.mobilePhone"
+          placeholder="请输入用户手机号"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="电子储蓄卡余额" prop="amt">
+        <el-input
+          v-model="queryParams.amt"
+          placeholder="请输入电子储蓄卡余额"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="电子会员卡类型:1,汽油;2.柴油;" prop="cardOilsType">
+        <el-select v-model="queryParams.cardOilsType" placeholder="请选择电子会员卡类型:1,汽油;2.柴油;" clearable size="small">
+          <el-option label="请选择字典生成" value="" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="油站ID" prop="stationId">
+        <el-input
+          v-model="queryParams.stationId"
+          placeholder="请输入油站ID"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="油站名称" prop="stationName">
+        <el-input
+          v-model="queryParams.stationName"
+          placeholder="请输入油站名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="最近使用时间" prop="recentlyTime">
+        <el-date-picker clearable size="small" style="width: 200px"
+          v-model="queryParams.recentlyTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          placeholder="选择最近使用时间">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['customer:card:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['customer:card:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['customer:card:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['customer:card:export']"
+        >导出</el-button>
+      </el-col>
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="cardList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="主键" align="center" prop="id" />
+      <el-table-column label="微信用户唯一标识unionId" align="center" prop="unionId" />
+      <el-table-column label="公众号openId" align="center" prop="blogOpenid" />
+      <el-table-column label="小程序openId" align="center" prop="minaOpenid" />
+      <el-table-column label="会员编号" align="center" prop="customerNo" />
+      <el-table-column label="客户名" align="center" prop="customerName" />
+      <el-table-column label="用户手机号" align="center" prop="mobilePhone" />
+      <el-table-column label="电子储蓄卡余额" align="center" prop="amt" />
+      <el-table-column label="电子会员卡类型:1,汽油;2.柴油;" align="center" prop="cardOilsType" />
+      <el-table-column label="油站ID" align="center" prop="stationId" />
+      <el-table-column label="油站名称" align="center" prop="stationName" />
+      <el-table-column label="最近使用时间" align="center" prop="recentlyTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.recentlyTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['customer:card:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['customer:card:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改客户电子会员卡(储蓄卡)对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="微信用户唯一标识unionId" prop="unionId">
+          <el-input v-model="form.unionId" placeholder="请输入微信用户唯一标识unionId" />
+        </el-form-item>
+        <el-form-item label="公众号openId" prop="blogOpenid">
+          <el-input v-model="form.blogOpenid" placeholder="请输入公众号openId" />
+        </el-form-item>
+        <el-form-item label="小程序openId" prop="minaOpenid">
+          <el-input v-model="form.minaOpenid" placeholder="请输入小程序openId" />
+        </el-form-item>
+        <el-form-item label="会员编号" prop="customerNo">
+          <el-input v-model="form.customerNo" placeholder="请输入会员编号" />
+        </el-form-item>
+        <el-form-item label="客户名" prop="customerName">
+          <el-input v-model="form.customerName" placeholder="请输入客户名" />
+        </el-form-item>
+        <el-form-item label="用户手机号" prop="mobilePhone">
+          <el-input v-model="form.mobilePhone" placeholder="请输入用户手机号" />
+        </el-form-item>
+        <el-form-item label="电子储蓄卡余额" prop="amt">
+          <el-input v-model="form.amt" placeholder="请输入电子储蓄卡余额" />
+        </el-form-item>
+        <el-form-item label="电子会员卡类型:1,汽油;2.柴油;" prop="cardOilsType">
+          <el-select v-model="form.cardOilsType" placeholder="请选择电子会员卡类型:1,汽油;2.柴油;">
+            <el-option label="请选择字典生成" value="" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="油站ID" prop="stationId">
+          <el-input v-model="form.stationId" placeholder="请输入油站ID" />
+        </el-form-item>
+        <el-form-item label="油站名称" prop="stationName">
+          <el-input v-model="form.stationName" placeholder="请输入油站名称" />
+        </el-form-item>
+        <el-form-item label="最近使用时间" prop="recentlyTime">
+          <el-date-picker clearable size="small" style="width: 200px"
+            v-model="form.recentlyTime"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择最近使用时间">
+          </el-date-picker>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listCard, getCard, delCard, addCard, updateCard, exportCard } from "@/api/customer/card";
+
+export default {
+  name: "Card",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 客户电子会员卡(储蓄卡)表格数据
+      cardList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        unionId: null,
+        blogOpenid: null,
+        minaOpenid: null,
+        customerNo: null,
+        customerName: null,
+        mobilePhone: null,
+        amt: null,
+        cardOilsType: null,
+        stationId: null,
+        stationName: null,
+        recentlyTime: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询客户电子会员卡(储蓄卡)列表 */
+    getList() {
+      this.loading = true;
+      this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      listCard(this.queryParams).then(response => {
+        this.cardList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        unionId: null,
+        blogOpenid: null,
+        minaOpenid: null,
+        customerNo: null,
+        customerName: null,
+        mobilePhone: null,
+        amt: null,
+        cardOilsType: null,
+        stationId: null,
+        stationName: null,
+        createTime: null,
+        recentlyTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加客户电子会员卡(储蓄卡)";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getCard(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改客户电子会员卡(储蓄卡)";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateCard(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addCard(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除客户电子会员卡(储蓄卡)编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delCard(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有客户电子会员卡(储蓄卡)数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportCard(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        })
+    }
+  }
+};
+</script>

+ 364 - 125
src/views/customer/cardSetting/index.vue

@@ -1,48 +1,55 @@
 <template>
   <div class="app-container">
-    <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-      <el-form-item label="开通卡类型设置" >
-      </el-form-item>
-      <el-form-item prop="cardOilsType">
-        <el-checkbox-group v-model="form.cardOilsType">
-          <el-checkbox
-            v-for = "item in oilOptions"
-            :key="item.dictLabel"
-            :label="item.dictValue"
-            :value="item.dictValue"
-          >
-            {{item.dictLabel}}
-          </el-checkbox>
-        </el-checkbox-group>
-      </el-form-item>
+    <el-form ref="form" :model="form" :rules="rules" label-width="130px">
+      <el-row>
+        <el-col :span="6" style=""> 
+          <el-form-item label="是否启用充值规则">
+            <el-checkbox-group v-model="cardOilsTypeList">
+              <el-checkbox v-for = "item in checkList" :key="item.id" :label="item.id" :value="item.value">{{item.value}}</el-checkbox>
+            </el-checkbox-group>
+          </el-form-item> 
+        </el-col>
+        <el-col :span="8" style=""> 
+          <el-button type="primary" style="" @click="handleAdd">新增充值规则</el-button>
+        </el-col> 
+      </el-row>
       <div>
-        <el-button type="primary" @click="handleAdd">设置充值规则</el-button>
-        <el-table v-loading="false" :data="detailList" >
+        <el-table v-loading="false" :data="form.detailList" >
           <el-table-column label="id" align="center" prop="id" v-if="false" />
           <el-table-column label="所对应电子会员卡ID" align="center" prop="parentId"  v-if="false" />
           <el-table-column label="油品" align="center" prop="oilName"  :formatter="oilNameFormatter"/>
-          <el-table-column label="优惠条件金额" align="center" prop="discountAmtTerm" />
+          <el-table-column label="优惠条件金额" align="center" prop="discountAmtTerm" >
+            <template slot-scope="scope1">
+               {{scope1.row.discountAmtStart}}≤充值金额(元)&lt;{{scope1.row.discountAmtEnd}}
+            </template>
+          </el-table-column>
           <el-table-column label="赠送方式" align="center" prop="settingRuleType"  :formatter="settingRuleTypeFotmat"/>
-          <el-table-column label="赠送金额值或比例" align="center" prop="presentAmt" />
+          <el-table-column label="赠送金额值或比例" align="center" prop="presentAmt">
+            <template slot-scope="scope2">
+               {{scope2.row.presentAmt}}
+                <span v-show="scope2.row.settingRuleType=='1'">元</span>
+                <span v-show="scope2.row.settingRuleType=='2'">%</span>
+            </template>
+          </el-table-column>
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
               <el-button
                 size="mini"
                 type="text"
                 icon="el-icon-edit"
-                @click="handleUpdate(scope.row)"
+                @click="handleUpdate(scope.$index,scope.row)"
               >修改</el-button>
               <el-button
                 size="mini"
                 type="text"
                 icon="el-icon-delete"
-                @click="handleDelete(scope.row)"
+                @click="handleDelete(scope.$index,scope.row)"
               >删除</el-button>
             </template>
           </el-table-column>
         </el-table>
       </div>
-      <el-form-item label="重置活动设置">
+      <el-form-item label="充值活动设置">
       </el-form-item>
       <el-form-item >
        <el-radio-group v-model="form.discountTimeSetting">
@@ -55,11 +62,10 @@
       </el-form-item>  
       <el-row>
         <el-col :span="8" style="">
-          <el-form-item  label="日期选择" prop="datePicker">
-            <el-select v-model="form.datePicker" 
-             clearable size="small" @change="datePickerChang" >
+          <el-form-item  label="周期选择" >
+            <el-select v-model="form.discountTimeType" clearable  size="mini"  @change="datePickerChang" >
                 <el-option
-                  v-for="item in datePickerOptions"
+                  v-for="item in discountTimeTypeOptions"
                   :key="item.dictValue"
                   :label="item.dictLabel"
                   :value="item.dictValue"
@@ -101,49 +107,64 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="赠送比例" prop="presentScale">
-            <el-input v-model="form.presentScale" placeholder="请输入赠送比例" />
+            <el-input v-model="form.presentScale" placeholder="请输入赠送比例" style="width:70px;"/>%
           </el-form-item>
         </el-col>
       </el-row>  
-      <el-form-item label="支付设置" ></el-form-item>
-      <el-row>
-        <el-form-item label="是否可以使用优惠券">
-        </el-form-item>
-      </el-row>
-      <el-row>
-        <el-form-item  prop="isDiscountCoupon">
-          <el-radio-group v-model="form.isDiscountCoupon">
-            <el-radio
-              v-for="dict in isDiscountCouponOptions"
-              :key="dict.dictValue"
-              :label="dict.dictValue"
-            >{{dict.dictLabel}}</el-radio>
-          </el-radio-group>
-        </el-form-item>
+      <el-form-item label="叠加优惠设置" ></el-form-item>
+      <el-row style="margin-left:80px;">
+        <el-col :span="8" >
+          <el-form-item  prop="isDiscountCoupon" label="是否叠加优惠券">
+            <el-radio-group v-model="form.isDiscountCoupon">
+              <el-radio
+                v-for="dict in isDiscountCouponOptions"
+                :key="dict.dictValue"
+                :label="dict.dictValue"
+              >{{dict.dictLabel}}</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" >
+          <el-form-item  prop="isMarket" label="是否叠加营销方案">
+            <el-radio-group v-model="form.isMarket">
+              <el-radio
+                v-for="dict in isDiscountCouponOptions"
+                :key="dict.dictValue"
+                :label="dict.dictValue"
+              >{{dict.dictLabel}}</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" >
+          <el-form-item  prop="isGradeSetting" label="是否叠加等级优惠">
+            <el-radio-group v-model="form.isGradeSetting">
+              <el-radio
+                v-for="dict in isDiscountCouponOptions"
+                :key="dict.dictValue"
+                :label="dict.dictValue"
+              >{{dict.dictLabel}}</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
       </el-row>
       <el-row>
-          <el-form-item label="积分可享受倍数" prop="enjoyIntegralMultiple">
-            <el-input v-model="form.enjoyIntegralMultiple" placeholder="请输入积分可享受倍数" />
+        <el-col :span="8" style="margin-left:80px;">
+          <el-form-item  prop="isDiscountCoupon" label="电子卡支付产生积分可享受倍数" label-width="225px">
+            <el-input v-model="form.enjoyIntegralMultiple" placeholder="请输入积分可享受倍数" style="width:100px;"/>倍
           </el-form-item>
+        </el-col>
       </el-row>
-      <el-form-item label="油站ID" prop="stationId" v-show="false">
-        <el-input v-model="form.stationId" placeholder="请输入油站ID" />
-      </el-form-item>
-      <el-form-item label="油站名称" prop="stationName" v-show="false">
-        <el-input v-model="form.stationName" placeholder="请输入油站名称" />
-      </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer">
       <el-button type="primary" @click="submitForm">确 定</el-button>
-      <el-button @click="cancel">取 消</el-button>
     </div>
 
      <!-- 添加或修改客户电子会员卡充值优惠设置明细对话框 -->
     <el-dialog :title="title" :visible.sync="open"  append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="110px">
-        <el-form-item label="选择油品" prop="oilName">
+      <el-form ref="infoform" :model="infoform" :rules="rules" label-width="110px">
+        <el-form-item label="选择油品" >
           <el-select
-            v-model="form.oilName"
+            v-model="infoform.oilName"
             placeholder="请选择油品"
             clearable
             size="small"
@@ -157,40 +178,54 @@
           </el-select>
         </el-form-item>
         <el-form-item label="充值条件金额" prop="discountAmtTerm">
-          <span>初始值</span>
-          <el-input-number v-model="form.discountAmtStart" placeholder="请输入充值条件开始金额" style="width:100px;" /> 
-          <span>终止值</span>
-          <el-input-number v-model="form.discountAmtEnd" placeholder="请输入充值条件结束金额" style="width:100px;"/> 
+          <el-input-number v-model="infoform.discountAmtStart" placeholder="请输入充值条件开始金额" style="width:200px;" /> 
+          <span>≤充值金额(元)&lt;</span>
+          <el-input-number v-model="infoform.discountAmtEnd" placeholder="请输入充值条件结束金额" style="width:200px;"/> 
         </el-form-item>
         <el-form-item label="赠送方式"></el-form-item>
         <el-row>
-          <el-col>
+          <el-col :span="12">
             <el-form-item >
-              <el-select v-model="form.settingRuleType" placeholder="请选择设置充值优惠类型:1,按赠送金额;2,按赠送比例">
-                <el-option label="请选择字典生成" value="" />
+              <el-select v-model="infoform.settingRuleType" placeholder="请选择赠送方式" @change="settingRuleTypeChange">
+                <el-option
+                  v-for="item in settingRuleTypeOptions"
+                  :key="item.dictLabel"
+                  :label="item.dictLabel"
+                  :value="item.dictValue"
+                ></el-option>
               </el-select>
-            
             </el-form-item>
           </el-col>
-          <el-col>
+          <el-col :span="12" >
             <el-form-item>
-              <el-input v-model="form.presentAmt" placeholder="请输入赠送金额值或者赠送c充值金额的比例" />
+              <el-input v-model="infoform.presentAmt" style="width:100px;"/>
+              <span v-show="jine">元</span>
+              <span v-show="bili">%</span>
             </el-form-item>
           </el-col>
         </el-row>
-      
+        <el-row>
+           <span style="color:red;margin-left:90px;">例:按赠送金额:充100赠送10元;按赠送比例:充100赠送10%</span>
+        </el-row>
+        <!-- <el-form-item label="状态">
+           <el-radio-group v-model="infoform.status">
+            <el-radio v-for="dict in statusOptions"
+            :key="dict.dictValue"
+            :label="dict.dictValue"
+            >{{dict.dictLabel}}</el-radio>
+          </el-radio-group>
+        </el-form-item> -->
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">设置</el-button>
-        <el-button @click="cancel">取 消</el-button>
+        <el-button type="primary" @click="save">设置</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import {  getSetting, delSetting, addSetting, updateSetting } from "@/api/customer/cardSetting";
-
+import { addSetting, updateSetting,selectCustomerCardSetting} from "@/api/customer/cardSetting";
+import { getDept } from "@/api/system/dept";
 export default {
   name: "Setting",
   data() {
@@ -209,13 +244,21 @@ export default {
       total: 0,
       // 客户电子会员卡充值优惠设置表格数据
       settingList: [],
-      detailList:[],
       oilOptions:[],
+      statusOptions:[],
       isDiscountCouponOptions:[],
       discountTimeSettingOptions:[],
       collectClickCalendar: [], // 收集固定日期选择的日子
       collectClickWorkDay:[],
-      datePickerOptions :[],
+      discountTimeTypeOptions :[],
+      stationOptions:[],
+      settingRuleTypeOptions:[],
+      checkList:[
+        {id:"1",value:"汽油"},
+        {id:"2",value:"柴油"}
+      ],
+      cardOilsTypeList:[],
+      pickerTime:"",
       moonEverDay: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10',
       '11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
       '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
@@ -223,10 +266,28 @@ export default {
       workDaytrue:false,
       moonDaytrue:false,
       datetrue:false,
+      jine:false,
+      bili:false,
       // 弹出层标题
       title: "",
       // 表单参数
-      form: {},
+      form: {
+        detailList:[]
+      },
+      //判断保存次数
+      num:0,
+      query:{
+        deptId: null
+      },
+      deptId:null,
+      queryParams:{
+        stationId: null
+      },
+      deptInfo:{},
+      checked: {},
+      index:null,
+      open:false,
+      infoform:{},
       // 表单校验
       rules: {
       }
@@ -236,8 +297,12 @@ export default {
     this.getDicts("integral_manage").then(response => {
       this.discountTimeSettingOptions = response.data;
     });
+    
+    this.getDicts("status").then(response => {
+      this.statusOptions = response.data;
+    });
     this.getDicts("date_picker").then(response => {
-      this.datePickerOptions = response.data;
+      this.discountTimeTypeOptions = response.data;
     });
     this.getDicts("is_flag").then(response => {
       this.isDiscountCouponOptions = response.data;
@@ -245,9 +310,54 @@ export default {
     this.getDicts("oil").then(response => {
       this.oilOptions = response.data;
     });
+    this.getDicts("setting_rule_type").then(response => {
+      this.settingRuleTypeOptions = response.data;
+    });
+    this.deptId=this.$store.selectDeptId;
+    if(this.deptId==null || this.deptId==""){
+      this.deptId =this.$store.state.user.deptId;
+    }
+    getDept(this.deptId).then(response => {
+      this.deptInfo = response.data;
+      if(this.deptInfo.jiBie==2){
+        this.queryParams.stationId=this.deptInfo.deptId;
+        this.form.stationId = this.deptInfo.deptId;
+        this.form.stationName =this.deptInfo.deptName;
+        selectCustomerCardSetting(this.queryParams).then(response => {
+          if(response.hasOwnProperty('data')){
+            this.form = response.data;
+            if(this.form.cardOilsType!=null &&this.form.cardOilsType!="" ){
+              this.cardOilsTypeList=this.form.cardOilsType.split(",");
+            }
+            if(this.form.discountTimeType == "1"){
+              this.workDaytrue=true;
+              this.moonDaytrue=false;
+              this.datetrue=false;
+              this.collectClickWorkDay =this.form.discountTime.split(",").map(parseFloat);
+            }else if(this.form.discountTimeType == "2"){
+              this.workDaytrue=false;
+              this.moonDaytrue=true;
+              this.datetrue=false;
+              this.collectClickCalendar= this.form.discountTime.split(',').map(parseFloat);
+            }else if(this.form.discountTimeType == "3"){
+              this.workDaytrue=false;
+              this.moonDaytrue=false;
+              this.datetrue=true;
+              if(this.form.discountTime!=""){
+                  this.pickerTime =this.form.discountTime.split(",");
+              }else{
+                this.pickerTime =null;
+              }
+            }
+          }
+        });
+      }else{
+          this.msgSuccess("请选择油站");
+      }
+    });
   },
   methods: {
-     oilNameFormatter(row, column){
+    oilNameFormatter(row, column){
       if(row.oilName === '1'){
         return '汽油'
       }else if(row.oilName === '2'){
@@ -261,16 +371,32 @@ export default {
         return '按赠送比例'
       }
     },
+    settingRuleTypeChange(){
+      if(this.infoform.settingRuleType == "1"){
+        this.jine=true;
+        this.bili=false;
+      }else if(this.infoform.settingRuleType == "2"){
+        this.jine=false;
+        this.bili=true;
+      }
+    },
+    statusFormatter(row, column){
+      if(row.status === '1'){
+        return '开启'
+      }else if(row.status === '2'){
+        return '关闭'
+      }
+    },
     datePickerChang(){
-      if(this.form.datePicker == "1"){
+      if(this.form.discountTimeType == "1"){
         this.workDaytrue=true;
         this.moonDaytrue=false;
         this.datetrue=false;
-      }else if(this.form.datePicker == "2"){
+      }else if(this.form.discountTimeType == "2"){
         this.workDaytrue=false;
         this.moonDaytrue=true;
         this.datetrue=false;
-      }else if(this.form.datePicker == "3"){
+      }else if(this.form.discountTimeType == "3"){
         this.workDaytrue=false;
         this.moonDaytrue=false;
         this.datetrue=true;
@@ -292,83 +418,171 @@ export default {
         enjoyIntegralMultiple: null,
         stationId: null,
         stationName: null,
-        createTime: null
+        createTime: null,
+        detailList:[],
+        datePicker:null
       };
       this.resetForm("form");
+
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+    resetInfo() {
+      this.infoform = {
+        id: null,
+        parentId:null,
+        oilName: null,
+        discountAmtStart: null,
+        discountAmtEnd: null,
+        settingRuleType: null,
+        presentAmt: null
+      };
+      this.resetForm("infoform");
+
     },
-   
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
+      this.resetInfo();
+      this.index1=null;
       this.open = true;
       this.title = "添加客户电子会员卡充值优惠设置";
+      // this.infoform.status="1";
     },
     /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getSetting(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改客户电子会员卡充值优惠设置";
-      });
+    handleUpdate(index,row) {
+      this.index1=index;
+      this.infoform = row;
+      this.open = true;
+      this.title = "修改客户电子会员卡充值优惠设置";
+      this.settingRuleTypeChange();
     },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+          let flag=true;
+          if(this.cardOilsTypeList !=null && this.cardOilsTypeList.length>0){
+            this.form.cardOilsType=this.cardOilsTypeList.toString();
+          }else{
+            this.form.cardOilsType="";
+            flag=false;
+          }
           if (this.form.id != null) {
-            let datepicker = this.form.datePicker;
+            let datepicker = this.form.discountTimeType;
             if(datepicker=="1"){
-              this.form.discountTime=this.collectClickWorkDay.toString();
+              if(this.collectClickWorkDay!=null&&this.collectClickWorkDay.length>0){
+                let discountTime=null;
+                for(let i =0;i<this.collectClickWorkDay.length;i++){
+                  if(!isNaN(this.collectClickWorkDay[i]) && this.collectClickWorkDay[i]!="NaN"){
+                    if( discountTime!=null){
+                      discountTime =discountTime+","+this.collectClickWorkDay[i];
+                    }else{
+                      discountTime =this.collectClickWorkDay[i];
+                    }
+                  }else{
+                    discountTime =discountTime;
+                  }
+                }
+                this.form.discountTime=discountTime; 
+                discountTime=null;
+              } else{
+                  this.form.discountTime=""; 
+              }
             }else if(datepicker=="2"){
-              this.form.discountTime=this.collectClickCalendar.toString();
+              if(this.collectClickCalendar!=null&&this.collectClickCalendar.length>0){
+                let discountTime=null;
+                for(let i =0;i<this.collectClickCalendar.length;i++){
+                  if(!isNaN(this.collectClickCalendar[i]) && this.collectClickCalendar[i]!="NaN"){
+                    if( discountTime!=null){
+                      discountTime =discountTime+","+this.collectClickCalendar[i];
+                    }else{
+                      discountTime =this.collectClickCalendar[i];
+                    }
+                  }else{
+                    discountTime =discountTime;
+                  }
+                }
+                this.form.discountTime=discountTime; 
+                discountTime=null;
+              } else{
+                  this.form.discountTime=""; 
+              }
             }else{
-              this.form.discountTime = this.pickerTime.toString();
-            }
+              if(this.pickerTime!=null){
+                  this.form.discountTime = this.pickerTime.toString();
+              }else{
+                this.form.discountTime = "";
+              }
+            }    
             updateSetting(this.form).then(response => {
               this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
+              this.jine=false;
+              this.bili=false;
             });
           } else {
-            let datepicker = this.form.datePicker;
-            if(datepicker=="1"){
-              this.form.discountTime=this.collectClickWorkDay.toString();
-            }else if(datepicker=="2"){
-              this.form.discountTime=this.collectClickCalendar.toString();
+            if(this.num==0){
+              if(datepicker=="1"){
+                if(this.collectClickWorkDay!=null&&this.collectClickWorkDay.length>0){
+                  let discountTime=null;
+                  for(let i =0;i<this.collectClickWorkDay.length;i++){
+                    if(!isNaN(this.collectClickWorkDay[i]) && this.collectClickWorkDay[i]!="NaN"){
+                      if( discountTime!=null){
+                        discountTime =discountTime+","+this.collectClickWorkDay[i];
+                      }else{
+                        discountTime =this.collectClickWorkDay[i];
+                      }
+                    }else{
+                      discountTime =discountTime;
+                    }
+                  }
+                  this.form.discountTime=discountTime; 
+                  discountTime=null;
+                } else{
+                    this.form.discountTime=""; 
+                }
+              }else if(datepicker=="2"){
+                  // this.form.discountTime=this.collectClickCalendar.toString();
+                  if(this.collectClickCalendar!=null&&this.collectClickCalendar.length>0){
+                    let discountTime=null;
+                    for(let i =0;i<this.collectClickCalendar.length;i++){
+                      if(!isNaN(this.collectClickCalendar[i]) && this.collectClickCalendar[i]!="NaN"){
+                        if( discountTime!=null){
+                          discountTime =discountTime+","+this.collectClickCalendar[i];
+                        }else{
+                          discountTime =this.collectClickCalendar[i];
+                        }
+                      }else{
+                        discountTime =discountTime;
+                      }
+                    }
+                    this.form.discountTime=discountTime; 
+                    discountTime=null;
+                  } else{
+                      this.form.discountTime=""; 
+                  }
+              }else{
+                if(this.pickerTime!=null){
+                   this.form.discountTime = this.pickerTime.toString();
+                }else{
+                  this.form.discountTime = "";
+                }
+              }
+              addSetting(this.form).then(response => {
+                this.msgSuccess("新增成功");
+                this.num=this.num+1;
+                this.jine=false;
+                this.bili=false;
+              });
             }else{
-              this.form.discountTime = this.pickerTime.toString();
+              this.msgSuccess("已新增成功,如需修改请刷新页面");
             }
-            addSetting(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
           }
         }
       });
     },
     /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$confirm('是否确认删除客户电子会员卡充值优惠设置编号为"' + ids + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delSetting(ids);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        })
+    handleDelete(index) {
+     this.form.detailList.splice(index, 1)
     },
-     deleteItemFromArr(item) {
+    deleteItemFromArr(item) {
       // eslint-disable-next-line
       Array.prototype.indexOf = function(val) {
         for (var i = 0; i < this.length; i++) {
@@ -389,7 +603,6 @@ export default {
       this.collectClickCalendar.remove(item)
     },
     clickCalendar(item, index) {
-      console.log('item, index:', item, index)
       if (this.collectClickCalendar.indexOf(index) === -1) {
         this.collectClickCalendar.push(index)
       } else if (this.collectClickCalendar.indexOf(index) > -1) {
@@ -413,7 +626,7 @@ export default {
         }
       }
       // 删除数组元素
-      this.collectClickWorkDay.remove(item)
+      this.collectClickWorkDay.remove(item);
     },
     clickWorkDayCalendar(item, index) {
       if (this.collectClickWorkDay.indexOf(index) === -1) {
@@ -421,6 +634,32 @@ export default {
       } else if (this.collectClickWorkDay.indexOf(index) > -1) {
         this.deleteWorkDayFromArr(index)
       }
+    },
+    cancelOpen(){
+      this.infoform = {
+        oilName: null,
+        discountAmtStart: null,
+        discountAmtEnd: null,
+        settingRuleType: null,
+        presentAmt: null
+      };
+      this.index1=null;
+      this.resetForm("infoform");
+      this.open = false;
+      this.jine=false;
+      this.bili=false;
+    },
+    save(){
+      const that = this;
+      this.$refs["infoform"].validate(valid => {
+        if (valid) {
+          if(that.index1!=null){
+            that.handleDelete(that.index1);
+          }
+          that.form.detailList.push(that.infoform);
+        }
+      });
+      this.cancelOpen();
     }
   }
 };

+ 200 - 0
src/views/customer/cardSettingDetail/index.vue

@@ -0,0 +1,200 @@
+<template>
+  <div class="app-container">
+    <!-- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="" prop="presentAmt">
+        <el-input
+          v-model="queryParams.presentAmt"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item> 
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>-->
+
+    <el-table v-loading="loading" :data="detailList" >
+      <el-table-column label="电子会员卡充值规则" align="center" prop="parentId" >
+        <template slot-scope="scope">
+          <span v-show="scope.row.oilName=='1'">汽油</span>
+          <span v-show="scope.row.oilName=='2'">柴油</span>
+          <span>充值金额大于等于{{scope.row.discountAmtStart}}元小于{{scope.row.discountAmtEnd}}元赠送</span>
+          <span v-show="scope.row.settingRuleType==1">{{scope.row.presentAmt}}元</span>
+          <span v-show="scope.row.settingRuleType==2">{{scope.row.presentAmt}}%</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="是否启用充值规则" align="center" prop="cardOilsType" >
+        <template slot-scope="scope1">
+          <span v-show="scope1.row.cardOilsType=='1' && scope1.row.oilName=='1'">开启</span>
+          <span v-show="scope1.row.cardOilsType=='2' && scope1.row.oilName=='2'">开启</span>
+          <span v-show="scope1.row.cardOilsType=='1,2'">开启</span>
+          <span v-show="scope1.row.cardOilsType=='2,1'">开启</span>
+          <span v-show="scope1.row.cardOilsType==''">关闭</span>
+           <span v-show="scope1.row.cardOilsType=='2' && scope1.row.oilName=='1'">关闭</span>
+           <span v-show="scope1.row.cardOilsType=='1' && scope1.row.oilName=='2'">关闭</span>
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="已开通油卡类型" align="center" prop="cardOilsType" width="120px;"/> -->
+      <el-table-column label="充值活动设置" align="center" prop="discountTimeSetting" :formatter="discountTimeSettingFormatter" width="100px;"/>
+      <el-table-column label="周期类型" align="center" prop="discountTimeType" :formatter="discountTimeTypeFormatter" width="90px;"/>
+      <el-table-column label="赠送比例" align="center" width="90px;" >
+        <template slot-scope="scope1">
+           <span >{{scope1.row.presentScale}}</span>
+           <span v-show="scope1.row.presentScale!=null&&scope1.row.presentScale!=''">%</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="电子卡支付产生积分可享受倍数" align="center" width="90px;" >
+        <template slot-scope="scope2">
+           <span >{{scope2.row.enjoyIntegralMultiple}}</span>
+           <span v-show="scope2.row.enjoyIntegralMultiple!=null&&scope2.row.enjoyIntegralMultiple!=''">倍</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="是否叠加优惠劵" align="center" prop="isDiscountCoupon" :formatter="isDiscountCouponFormatter" width="90px;"/>
+      <el-table-column label="是否叠加营销活动" align="center" prop="isMarket" :formatter="isMarketFormatter" width="90px;"/>
+      <el-table-column label="是否叠加等级设置" align="center" prop="isGradeSetting" :formatter="isGradeSettingFormatter" width="90px;"/>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listDetailInfo} from "@/api/customer/cardSettingDetail";
+export default {
+  name: "Detail",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 客户电子会员卡充值优惠设置明细表格数据
+      detailList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        parentId: null,
+        settingRuleType: null,
+        discountAmtTerm: null,
+        presentAmt: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    cardOilsTypeFormatter(row, column){
+      if(row.cardOilsType === '1'){
+        return '汽油卡'
+      }else if(row.cardOilsType === '2'){
+        return '柴油卡'
+      }else if(row.cardOilsType === '1,2'){
+        return '汽油卡,柴油卡'
+      }
+    },
+    discountTimeSettingFormatter(row, column){
+      if(row.discountTimeSetting === '1'){
+        return '开启'
+      }else if(row.discountTimeSetting === '2'){
+        return '关闭'
+      }
+    },
+    discountTimeTypeFormatter(row, column){
+      if(row.discountTimeSetting === '1'){
+        return '每周指定日'
+      }else if(row.discountTimeSetting === '2'){
+        return '每月指定日'
+      }else if(row.discountTimeSetting === '2'){
+        return '固定活动日'
+      }
+    },
+    isDiscountCouponFormatter(row, column){
+      if(row.isDiscountCoupon === '0'){
+        return '是'
+      }else if(row.isDiscountCoupon === '1'){
+        return '否'
+      }
+    },
+    isMarketFormatter(row, column){
+      if(row.isMarket === '0'){
+        return '是'
+      }else if(row.isMarket === '1'){
+        return '否'
+      }
+    },
+    isGradeSettingFormatter(row, column){
+      if(row.isGradeSetting === '0'){
+        return '是'
+      }else if(row.isGradeSetting === '1'){
+        return '否'
+      }
+    },
+    /** 查询客户电子会员卡充值优惠设置明细列表 */
+    getList() {
+      this.loading = true;
+      this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      listDetailInfo(this.queryParams).then(response => {
+        this.detailList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        parentId: null,
+        settingRuleType: null,
+        discountAmtTerm: null,
+        presentAmt: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+  }
+};
+</script>

+ 24 - 13
src/views/customer/record/consumption.vue → src/views/customer/consumption/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="客户名" prop="customerName">
+      <el-form-item label="会员名" prop="customerName">
         <el-input
           v-model="queryParams.customerName"
           placeholder="请输入客户名"
@@ -25,7 +25,7 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="充值时间" prop="">
+      <el-form-item label="消费时间" prop="">
         <el-date-picker
           v-model="dateRangeCreatedDate"
           type="daterange"
@@ -38,26 +38,34 @@
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">汇总</el-button>
-        <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['customer:record:export']" >导出</el-button>
+        <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">汇总</el-button> -->
+        <!-- <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['customer:record:export']" >导出</el-button> -->
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="id" align="center" prop="id" v-if="false" />
       <el-table-column label="消费单号" align="center" prop="orderNo" />
       <el-table-column label="微信用户唯一标识" align="center" prop="unionId" v-if="false" />
-      <el-table-column label="会员号ID" align="center" prop="customerNo" />
+      <el-table-column label="电子卡号" align="center" prop="customerNo" />
       <el-table-column label="会员名" align="center" prop="customerName" />
-      <el-table-column label="油品" align="center" prop="cardOilsType" formatter="cardOilsTypeFotmat"/>
+      <el-table-column label="油品" align="center" prop="cardOilsType" :formatter="cardOilsTypeFotmat"/>
       <el-table-column label="电子会员卡消费充值类型:+,充值;-,消费;" align="center" prop="usageType" v-if="false" />
       <el-table-column label="电子会员卡充值消费类型:1.微信;2.POS机" align="center" prop="payType" v-if="false"/>
       <el-table-column label="消费金额" align="center" prop="amt" />
-      <el-table-column label="赠送金额" align="center" prop="presentAmt" v-if="false"/>
       <el-table-column label="余额" align="center" prop="balance"  />
       <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
-      <el-table-column label="油站名称" align="center" prop="stationName" v-if="false"/>
-      <el-table-column label="是否充值或者消费成功:0,未成功;1,成功" align="center" prop="status" v-if="false"/>
+      <el-table-column label="油站名称" align="center" prop="stationName" />
+      <el-table-column label="支付时间" align="center" prop="payDate" width="150">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.payDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="创建时间" align="center" prop="createTime" width="150">
+        <template slot-scope="scope1">
+          <span>{{ parseTime(scope1.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="是否消费成功:0,未成功;1,成功" align="center" prop="status" v-if="false"/>
     </el-table>
     <pagination
       v-show="total>0"
@@ -70,7 +78,7 @@
 </template>
 
 <script>
-import { listRecord, exportRecord } from "@/api/customer/record";
+import { listConsumption, exportConsumption } from "@/api/customer/consumption";
 
 export default {
   name: "Record",
@@ -140,7 +148,10 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
-      listRecord(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      listConsumption(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
         this.recordList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -197,7 +208,7 @@ export default {
           cancelButtonText: "取消",
           type: "warning"
         }).then(function() {
-          return exportRecord(queryParams);
+          return exportConsumption(queryParams);
         }).then(response => {
           this.download(response.msg);
         })

+ 32 - 70
src/views/customer/manage/index.vue

@@ -20,7 +20,7 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="车牌号" prop="carNumber">
+      <!-- <el-form-item label="车牌号" prop="carNumber">
         <el-input
           v-model="queryParams.carNumber"
           placeholder="请输入车牌号"
@@ -28,7 +28,7 @@
           size="small"
           @keyup.enter.native="handleQuery"
         />
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item label="会员等级" prop="memberGrade">
         <el-input
           v-model="queryParams.memberGrade"
@@ -38,11 +38,11 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="专车类型" prop="specialCarType">
+      <!-- <el-form-item label="专车类型" prop="specialCarType">
         <el-select v-model="queryParams.specialCarType" placeholder="请选择专车类型" clearable size="small">
           <el-option label="请选择字典生成" value="" />
         </el-select>
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item label="油品" prop="oilName">
         <el-select
           v-model="queryParams.oilName"
@@ -51,76 +51,46 @@
           size="small">
           <el-option
             v-for="dict in oilNameOptions"
-            :key="dict.dictValue"
+            :key="dict.dictLabel"
             :label="dict.dictLabel"
-            :value="dict.dictValue"
+            :value="dict.dictLabel"
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="推荐人" prop="commendMan">
-        <el-input
-          v-model="queryParams.commendMan"
-          placeholder="请输入推荐人"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <!-- <el-form-item label="油站名称" prop="stationId">
-        <el-select
-          v-model="queryParams.stationId"
-          placeholder="请选择油站"
-          clearable
-          size="small"
-        >
-          <el-option
-            v-for="item in stationOptions"
-            :key="item.deptId"
-            :label="item.deptName"
-            :value="item.deptId"
-          ></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 icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
 
     <el-table v-loading="loading" :data="manageList" @selection-change="handleSelectionChange">
-      <el-table-column label="客户表id" align="center" prop="id" v-if="false" />
+      <!-- <el-table-column label="客户表id" align="center" prop="id" v-if="false" /> -->
       <el-table-column label="会员id" align="center" prop="memberId" />
+      <el-table-column label="" align="center" prop="unionId" v-if="false"/>
       <el-table-column label="客户姓名" align="center" prop="customerName" />
-      <el-table-column label="推荐人" align="center" prop="commendMan" />
-      <el-table-column label="会员等级" align="center" prop="memberGrade" />
+      <!-- <el-table-column label="推荐人" align="center" prop="commendMan" /> -->
+      <el-table-column label="会员等级" align="center" prop="grade" />
       <el-table-column label="手机号" align="center" prop="phoneNumber" />
-      <el-table-column label="车牌号" align="center" prop="carNumber" />
+      <el-table-column label="车牌号" align="center" prop="carNumber" v-if="false"/>
       <el-table-column label="油品" align="center" prop="oilName" />
-      <el-table-column label="余额" align="center" prop="balance" />
+      <el-table-column label="汽油余额" align="center" prop="qyAmt" />
+      <el-table-column label="柴油余额" align="center" prop="cyAmt" />
       <el-table-column label="积分" align="center" prop="integral" />
-      <el-table-column label="专车类型" align="center" prop="specialCarType" />
-      <el-table-column label="注册时间" align="center" prop="regtime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.regtime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="油站id" align="center" prop="stationId" v-if="false"/>
-      <el-table-column label="油站名称" align="center" prop="stationName" />
+      <el-table-column label="专车类型" align="center" prop="specialCarType" v-if="false"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-          >编辑</el-button>
+          >编辑</el-button> -->
           <el-button
             size="mini"
             type="text"
             icon="el-icon-search"
             @click="lookinfo(scope.row)"
-          >查询</el-button>
+          >订单查询</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -183,23 +153,6 @@
             placeholder="选择注册时间">
           </el-date-picker>
         </el-form-item>
-
-        <el-form-item label="油站名称" prop="stationId">
-            <el-select
-              v-model="form.stationId"
-              placeholder="请选择油站"
-              clearable
-              size="small"
-              @change="onInstitutionChang"
-            >
-              <el-option
-                v-for="item in stationOptions"
-                :key="item.deptId"
-                :label="item.deptName"
-                :value="item.deptId"
-              ></el-option>
-            </el-select>
-        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -217,7 +170,7 @@
         <el-table-column label="消费者" width="120" align="center" prop="consumer" />
         <el-table-column label="加油员" width="120" align="center" prop="oilPersonnel" />
         <el-table-column label="加油枪号" align="center" prop="oilGun" />
-        <el-table-column label="支付类型" align="center" prop="payType" :formatter="payTypeFotmat"/>
+        <el-table-column label="支付类型" align="center" prop="payType"  v-if="false"  :formatter="payTypeFotmat"/>
         <el-table-column label="油站名称" width="120" align="center" v-if="false" prop="stationName" />
         <el-table-column v-if="false" label="用户id(消费者)" align="center" prop="consumerId" />
         <el-table-column v-if="false" label="油站id" align="center" prop="stationId" />
@@ -306,6 +259,9 @@ export default {
       },
       // 表单参数
       form: {},
+      query:{
+        deptId:null
+      },
       row: {},
       // 表单校验
       rules: {
@@ -314,7 +270,11 @@ export default {
   },
   created() {
     this.getList();
-    stationinfo().then(response => {
+    this.query.deptId =this.$store.selectDeptId;
+    if(this.query.deptId ==null || this.query.deptId ==""){
+      this.query.deptId  =this.$store.state.user.deptId;
+    }
+    stationinfo(this.query).then(response => {
       this.stationOptions = response.rows;
     });
     this.getDicts("oil_name").then(response => {
@@ -345,6 +305,9 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listManage(this.queryParams).then(response => {
         this.manageList = response.rows;
         this.total = response.total;
@@ -422,9 +385,8 @@ export default {
       this.listPage(row);
     },
     listPage(row){
-      this.queryOrder.oilName=this.row.oilName;
-      this.queryOrder.stationId=this.row.stationId;
-      this.queryOrder.consumer =this.row.customerName;
+      this.queryOrder.stationId=this.$store.selectDeptId;
+      this.queryOrder.consumer=row.customerName;
       this.queryOrder.pageNum=row.page;
       this.queryOrder.pageSize =row.limit;
       getOrderInfo(this.queryOrder).then(response => {

+ 15 - 15
src/views/customer/record/recharge.vue → src/views/customer/recharge/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="客户名" prop="customerName">
+      <el-form-item label="会员名" prop="customerName">
         <el-input
           v-model="queryParams.customerName"
           placeholder="请输入客户名"
@@ -38,27 +38,24 @@
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">汇总</el-button>
-        <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['customer:record:export']" >导出</el-button>
+        <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">汇总</el-button> -->
+        <!-- <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['customer:record:export']" >导出</el-button> -->
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="id" align="center" prop="id" v-if="false" />
       <el-table-column label="充值单号" align="center" prop="orderNo" />
       <el-table-column label="微信用户唯一标识" align="center" prop="unionId" v-if="false" />
-      <el-table-column label="会员号ID" align="center" prop="customerNo" />
+      <el-table-column label="电子卡号" align="center" prop="customerNo" />
       <el-table-column label="会员名" align="center" prop="customerName" />
-      <el-table-column label="油品" align="center" prop="cardOilsType" formatter="cardOilsTypeFotmat"/>
+      <el-table-column label="油品" align="center" prop="cardOilsType" :formatter="cardOilsTypeFotmat"/>
       <el-table-column label="电子会员卡消费充值类型:+,充值;-,消费;" align="center" prop="usageType" v-if="false" />
-    
-      <el-table-column label="消费金额" align="center" prop="amt" />
-      <el-table-column label="赠送金额" align="center" prop="presentAmt" v-if="false"/>
+      <el-table-column label="充值金额" align="center" prop="amt" />
       <el-table-column label="余额" align="center" prop="balance" />
-      <el-table-column label="消费方式" align="center" prop="payType" formatter="payTypeFotmat"/>
+      <el-table-column label="消费方式" align="center" prop="payType" :formatter="payTypeFotmat"/>
       <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
-      <el-table-column label="油站名称" align="center" prop="stationName" v-if="false"/>
-      <el-table-column label="油站名称" align="center" prop="create_time" />
+      <el-table-column label="油站名称" align="center" prop="stationName" />
+      <el-table-column label="油站名称" align="center" prop="create_time" v-if="false"/>
     </el-table>
     <pagination
       v-show="total>0"
@@ -71,7 +68,7 @@
 </template>
 
 <script>
-import { listRecord, exportRecord } from "@/api/customer/record";
+import { listRecharge, exportRecharge } from "@/api/customer/recharge";
 
 export default {
   name: "Record",
@@ -149,7 +146,10 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
-      listRecord(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      listRecharge(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
         this.recordList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -206,7 +206,7 @@ export default {
           cancelButtonText: "取消",
           type: "warning"
         }).then(function() {
-          return exportRecord(queryParams);
+          return exportRecharge(queryParams);
         }).then(response => {
           this.download(response.msg);
         })

+ 647 - 0
src/views/customer/report/customerReport copy.vue

@@ -0,0 +1,647 @@
+<template>
+  <el-scrollbar style="height:100%">
+    <div>
+      <div>
+        <el-form
+          :model="queryParams"
+          style="margin-left: 20px;"
+          ref="queryForm"
+          :inline="true"
+          v-show="showSearch"
+          label-width="68px"
+        >
+         <el-row :gutter="10" class="panel-group">
+            <el-col :xs="12" :sm="12" :lg="6">
+              <div class="flex xiaoe">
+                <div style="font-size: 28px;">电子会员总量</div>
+                <div style="line-height: 62px;font-size: 44px;">{{ cardNum }}</div>
+              </div>
+            </el-col>
+         
+            <el-col :xs="12" :sm="12" :lg="6">
+              <div class="flex xiaoliang">
+                <div style="font-size: 28px;">总余额</div>
+                <div style="line-height: 62px;font-size: 32px;">{{hzAmt }}</div>
+              </div>
+            </el-col>
+          </el-row>
+          <el-form-item>
+            <el-button size="mini" @click="dayDataSource">今天</el-button>
+            <el-button size="mini" @click="yesDataSource">昨天</el-button>
+            <el-button size="mini" @click="workDataSource">本周</el-button>
+            <el-button size="mini" @click="monthDataSource">本月</el-button>
+            <el-date-picker
+              style="margin: 0px 10px;"
+              size="mini"
+              v-model="dateRangeCreatedDate"
+              type="daterange"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+            ></el-date-picker>
+            <el-button  size="mini" @click="queryDataSource">查询</el-button>
+          </el-form-item>
+        </el-form>
+        <span style="color:#ff9955;font-size:25px;">|</span>
+        <span style="font-size:20px;">数据概览</span>
+        <el-row :gutter="10" class="panel-group">
+          <el-col :xs="12" :sm="12" :lg="6">
+            <div class="flex xiaoliang">
+              <div style="font-size: 28px;">充值总额</div>
+              <div style="line-height: 62px;font-size: 44px;">{{ form.czAmt }}</div>
+            </div>
+          </el-col>
+         
+          <el-col :xs="12" :sm="12" :lg="6">
+            <div class="flex xiaoliang">
+              <div style="font-size: 28px;">消费额度</div>
+              <div style="line-height: 62px;font-size: 44px;">{{ form.xfAmt}}</div>
+            </div>
+          </el-col>
+        </el-row>
+      </div>
+      <div style="width:100%; height: 360px;background: #FFFFFF;">
+        <span style="color:#ff9955;font-size:25px;">|</span>
+        <span style="font-size:20px;">充值/消费走势</span>
+        <div ref="myChart" style="width:100%; height: 350px;margin: 0px 25px;"></div>
+      </div>
+      <div style="width:100%; height: 181px;">
+        <span style="color:#ff9955;font-size:25px;">|</span>
+        <span style="font-size:20px;">详情:</span>
+        <el-table v-loading="loading" :data="dayReportList">
+          <el-table-column label="日期" align="center" prop="createTime">
+              <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="充值总额度" align="center" prop="czamt" />
+          <el-table-column label="消费总额度" align="center" prop="xfamt" v-if="false" />
+          <el-table-column label="电子会员数量" align="center" prop="cumnum" />
+          <el-table-column label="余额" align="center" prop="cumamt" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                @click="handleLook(scope.row)"
+              >详情</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- <pagination class="pagination-container"
+          v-show="total>0"
+          :total="total"
+          :page.sync="queryParams.pageNo"
+          :limit.sync="queryParams.pageSetting"
+          @pagination="dayReportDetail"
+          style="display:inline-block;float:right "
+        /> -->
+        <div  style="display:inline-block;float:right ">
+          <el-pagination
+            style="padding-top: 15px"
+            @size-change="findSizeChange"
+            @current-change="findPage"
+            :current-page.sync="pageNow"
+            background
+            :pager-count="6"
+            :page-sizes="[5,10,20,50,100]"
+            :page-size="size"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="total">
+          </el-pagination>
+        </div>
+      </div> 
+      <el-dialog :title="title" width="800px"  :visible.sync="open" append-to-body>
+        <el-table v-loading="loading" :data="dayReportDetailsList">
+          <el-table-column label="订单单号" align="center" prop="orderNo" />
+          <el-table-column label="微信用户唯一标识" align="center" prop="unionId" v-if="false" />
+          <el-table-column label="会员号ID" align="center" prop="customerNo" />
+          <el-table-column label="会员名" align="center" prop="customerName" />
+          <el-table-column label="油品" align="center" prop="cardOilsType" :formatter="cardOilsTypeFotmat"/>
+          <el-table-column label="订单类型" align="center" prop="usageType" :formatter="usageTypeFotmat"/>
+          <el-table-column label="消费金额" align="center" prop="amt" />
+          <el-table-column label="余额" align="center" prop="balance" />
+          <el-table-column label="消费方式" align="center" prop="payType" :formatter="payTypeFotmat"/>
+          <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
+          <el-table-column label="油站名称" align="center" prop="stationName" />
+          <el-table-column label="油站名称" align="center" prop="create_time" v-if="false"/>
+        </el-table>
+        <div  class="pagination-container">
+          <el-pagination
+            style="padding-top: 15px"
+            @size-change="sizeChange"
+            @current-change="currentChange"
+            :current-page.sync="pageNow2"
+            background
+            :pager-count="6"
+            :page-sizes="[5,10,20,50,100]"
+            :page-size="setting"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="total1">
+          </el-pagination>
+        </div>
+      </el-dialog>
+    </div>
+  </el-scrollbar>
+</template>
+
+<script>
+import echarts from "echarts";
+require("echarts/theme/macarons"); // echarts theme
+import {listSum,selectCard} from "@/api/customer/card";
+import { xfAmtQuery,listXdata,listQydataXF } from "@/api/customer/consumption";
+import { czAmtQuery,listQydataCZ,selectCardDetail } from "@/api/customer/recharge";
+export default {
+  name: "source",
+  data() {
+    return {
+      charts: null,
+      size:10,
+      pageNow:1,
+      pageNow2:1,
+      setting:10,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      total1: 0,
+      hzAmt: 0,
+      cardNum:0,
+      // 优惠劵管理表格数据
+      couponList: [],
+      dayReportDetailsList: [],
+      dateRangeCreatedDate: [],
+      //x轴数据
+      xdata: [],
+      //92#汽油数据
+      czdata: [],
+      //95#汽油数据
+      xfdata: [],
+      // 弹出层标题
+      title: "",
+      rows:[],
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageSetting:10,
+        pageNum:1,
+        createdDate: null,
+        stationId:null,
+        stationName: null,
+        beginTime: null,
+        endTime: null,
+        payDate: null,
+        status:"1"
+      },
+      // 查询参数
+      queryInfo: {
+        pageSetting:10,
+        pageNo:1,
+        createDate: null
+      },
+      query:{
+        stationId:null
+      },
+      //日报数据
+      dayReportList: [],
+      // 表单参数
+      form: {
+        czAmt: 0,
+        xfAmt: 0
+      },
+      // 表单校验
+      rules: {}
+    };
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.queryParams.beginTime = this.getMonthDate();
+      this.queryParams.endTime = this.getEndFormatDate(new Date());
+      this.queryParams.stationId=this.$store.selectDeptId;
+      setTimeout(() => {
+        this.initChart();
+      }, 1000);
+    });
+  },
+  created() {
+    this.dayDataSource();
+    this.getHZlist();
+    //获取折线图的数据
+    this.reset();
+    this.queryParams.beginTime = this.getMonthDate();
+    this.queryParams.endTime = this.getEndFormatDate(new Date());
+    this.queryParams.stationId=this.$store.selectDeptId;
+    this.getDatas();
+    
+  },
+  methods: {
+    usageTypeFotmat(row, column){
+      if(row.usageType === '+'){
+        return '充值'
+      }else if(row.usageType === '-'){
+        return '消费'
+      }
+    },
+    payTypeFotmat(row, column){
+      if(row.payType === '1'){
+        return '小程序'
+      }else if(row.payType === '2'){
+        return 'POS'
+      }
+    },
+    cardOilsTypeFotmat(row, column){
+      if(row.cardOilsType === '1'){
+        return '汽油'
+      }else if(row.cardOilsType === '2'){
+        return '柴油'
+      }
+    },
+    initChart() {
+      // 初始化echarts
+      this.charts = echarts.init(this.$refs.myChart, "macarons");
+      this.charts.setOption(
+        {
+          xAxis: {
+            data: this.xdata,
+            boundaryGap: false,
+            axisTick: {
+              show: false
+            }
+          },
+          tooltip: {
+            trigger: "axis",
+            axisPointer: {
+              type: "cross"
+            },
+            padding: [5, 10]
+          },
+          yAxis: {
+            axisTick: {
+              show: false
+            }
+          },
+          legend: {
+            data: [ "充值","消费"]
+          },
+          animation: false,
+          series: [
+            {
+              name: "充值",
+              itemStyle: {
+                normal: {
+                  color: "#FF005A",
+                  lineStyle: {
+                    color: "#FF005A",
+                    width: 2
+                  }
+                }
+              },
+              smooth: true,
+              type: "line",
+              data: this.czdata
+            },
+            {
+              name: "消费",
+              smooth: true,
+              type: "line",
+              itemStyle: {
+                normal: {
+                  color: "#3888fa",
+                  lineStyle: {
+                    color: "#3888fa",
+                    width: 2
+                  }
+                }
+              },
+              data: this.xfdata
+            }
+          ]
+        },
+        true
+      );
+    },
+    getXData() {
+      return listXdata(this.queryParams).then(response => {
+        this.xdata = [];
+        if(response.hasOwnProperty('rows')){
+          for (let i in response.rows) {
+            this.xdata.push(response.rows[i].createTime);
+          }
+        }
+      });
+    },
+
+    getQyDataCZ() {
+      return listQydataCZ(this.queryParams).then(response => {
+        this.czdata = [];
+        if(response.hasOwnProperty('rows')){
+          for (let i in response.rows) {
+            let data = [];
+            data.push(response.rows[i].createTime);
+            data.push(response.rows[i].amt);
+            this.czdata.push(data);
+          }
+        }
+      });
+    },
+
+    getQydataXF() {
+      return listQydataXF(this.queryParams).then(response => {
+        this.xfdata = [];
+        if(response.hasOwnProperty('rows')){
+          for (let i in response.rows) {
+            let data = [];
+            data.push(response.rows[i].createTime);
+            data.push(response.rows[i].amt);
+            this.xfdata.push(data);
+          }
+        }
+      });
+    },
+    //获取折线图用到的数据
+    getDatas() {
+      Promise.all([
+        this.getXData(),
+        this.getQyDataCZ(),
+        this.getQydataXF(),
+      ]).then(res => {
+        this.initChart();
+      });
+    },
+    /** 查询电子会员数据 */
+    getList() {
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      xfAmtQuery(this.queryParams).then(response => {
+        if (response.hasOwnProperty('data')) {
+          this.form.xfAmt = response.data.amt;
+        }
+      });
+      czAmtQuery(this.queryParams).then(response => {
+        if (response.hasOwnProperty('data')) {
+          this.form.czAmt = response.data.amt;
+        }
+      });
+      this.dayReportDetail();
+    },
+    getHZlist(){
+      //汇总电子会员数据
+      this.query.stationId=this.$store.selectDeptId;
+      if(this.query.stationId==null || this.query.stationId==""){
+        this.query.stationId =this.$store.state.user.deptId;
+      }
+      listSum(this.query).then(response => {
+        if (response.hasOwnProperty('data')) {
+          this.cardNum= response.data.num;
+          this.hzAmt = response.data.amt;
+        }
+      });
+      
+    },
+    findPage(val){
+      this.pageNow = val;
+      this.dayReportDetail();
+    },
+    findSizeChange(size) {
+      //将val赋值给size
+      this.size = size;
+      //重新去后台查询数据
+      this.dayReportDetail();
+    },
+   
+    dayReportDetail(){
+      this.loading = false;
+      this.queryParams.pageNo =this.pageNow;
+      this.queryParams.pageSetting =this.size;
+      selectCard(this.queryParams).then(response => {
+       this.dayReportList= response.rows;
+        this.total = response.total;
+      });
+    },
+    //本日的数据
+    dayDataSource() {
+      this.reset();
+      this.queryParams.beginTime = this.getNowFormatDate(new Date());
+      this.queryParams.endTime = this.getEndFormatDate(new Date());
+      this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      this.getList();
+    },
+    //昨天的数据
+    yesDataSource() {
+      this.reset();
+      this.queryParams.beginTime = this.getFormatDate(new Date());
+      this.queryParams.endTime = this.getNowFormatDate(new Date());
+      this.queryParams.stationId=this.$store.selectDeptId;
+      this.getList();
+    },
+    //本周的数据
+    workDataSource() {
+      this.reset();
+      this.queryParams.beginTime = this.getDates();
+      this.queryParams.endTime = this.getEndFormatDate(new Date());
+      this.queryParams.stationId=this.$store.selectDeptId;
+      this.getDatas();
+      this.getList();
+    },
+    //本月数据
+    monthDataSource() {
+      this.reset();
+      this.queryParams.beginTime = this.getMonthDate();
+      this.queryParams.endTime = this.getEndFormatDate(new Date());
+      this.queryParams.stationId=this.$store.selectDeptId;
+      this.getDatas();
+      this.getList();
+    },
+    //按照指定日期
+    queryDataSource() {
+      this.reset();
+      this.queryParams.beginTime = this.dateRangeCreatedDate[0];
+      this.queryParams.endTime = this.dateRangeCreatedDate[1];
+      this.queryParams.stationId=this.$store.selectDeptId;
+      this.getDatas();
+      this.getList();
+    },
+    //今天
+    getNowFormatDate(date) {
+      let seperator1 = "-";
+      let month = date.getMonth() + 1;
+      let strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      let currentdate1 =
+        date.getFullYear() + seperator1 + month + seperator1 + strDate;
+      return currentdate1;
+    },
+    //明天
+    getEndFormatDate(myDate) {
+      let date = myDate.getDate();
+      date = date + 1;
+      myDate.setDate(date);
+      let seperator2 = "-";
+      let month = myDate.getMonth() + 1;
+      let strDate = myDate.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      let currentdate2 =
+        myDate.getFullYear() + seperator2 + month + seperator2 + strDate;
+      return currentdate2;
+    },
+    //昨天
+    getFormatDate(myDate) {
+      let date = myDate.getDate();
+      date = date - 1;
+      myDate.setDate(date);
+      let seperator3 = "-";
+      let month = myDate.getMonth() + 1;
+      let strDate = myDate.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      let currentdate3 =
+        myDate.getFullYear() + seperator3 + month + seperator3 + strDate;
+      return currentdate3;
+    },
+    getDates() {
+      var new_Date = new Date();
+      var timesStamp = new_Date.getTime();
+      var currenDay = new_Date.getDay();
+      var dates = new Date(
+        timesStamp + 24 * 60 * 60 * 1000 * (0 - ((currenDay + 6) % 7))
+      )
+        .toLocaleDateString()
+        .replace(/[年月]/g, "-")
+        .replace(/[日上下午]/g, "");
+      let s = dates.replace(/-/g, "/");
+      var dt = new Date(s);
+      var m = dt.getMonth() + 1;
+      var d = dt.getDate();
+      m = m < 10 ? "0" + m : m;
+      d = d < 10 ? "0" + d : d;
+      dates = dt.getFullYear() + "-" + m + "-" + d;
+      return dates;
+    },
+    //本月第一天
+    getMonthDate() {
+      let date = new Date();
+      let seperator1 = "-";
+      let month = date.getMonth() + 1;
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      let currentdate =
+        date.getFullYear() + seperator1 + month + seperator1 + "01";
+      return currentdate;
+    },
+    // 表单重置
+    reset() {
+      this.queryParams = {
+        pageSetting:10,
+        pageNo:1,
+        createDate: null,
+        stationId: null,
+        stationName: null,
+        beginTime:null,
+        endTime:null
+      };
+      this.form = {
+        czAmt: 0,
+        xfAmt: 0
+      };
+      this.queryInfo={
+        pageSetting:10,
+        pageNo:1,
+        createDate: null
+      };
+    },
+
+    /** 查看详情按钮操作 */
+    handleLook(row) {
+      this.rows=row;
+      this.getLookOrder(row);
+    },
+    sizeChange(psize){
+      //将val赋值给size
+      this.setting = psize;
+      this.getLookOrder(this.rows);
+    },
+    currentChange(val) {
+      this.pageNow2 = val;
+      //重新去后台查询数据
+      this.getLookOrder(this.rows);
+    },
+    getLookOrder(row) {
+      const createDate = row.createTime;
+      this.queryInfo.createDate =createDate.substring(0,10);
+      this.queryInfo.pageNo =this.pageNow2;
+      this.queryInfo.pageSetting =this.setting;
+      return selectCardDetail(this.queryInfo).then(response => {
+        this.dayReportDetailsList = response.rows;
+        this.total1 = response.total;
+        this.open = true;
+        this.title = "电子会员明细";
+      });
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.flex {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  height: 270px;
+  flex-direction: column;
+}
+.flex-qy {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.flex-qy-sx {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+}
+.panel-group {
+  padding-left: 10px;
+}
+
+.flex-sr {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  flex-direction: column;
+}
+.sr-font {
+  font-size: 20px;
+  color: #f4a645;
+}
+</style>

+ 421 - 0
src/views/customer/report/customerReport.vue

@@ -0,0 +1,421 @@
+<template>
+  <el-scrollbar style="height:100%">
+    <div>
+      <div style="width:99%;">
+        <span style="color:#ff9955;font-size:25px;">|</span>
+        <span style="font-size:20px;">数据概览</span>
+        <el-row :gutter="10" class="panel-group">
+          <el-col :xs="12" :sm="12" :lg="6">
+            <div class="flex xiaoliang">
+              <div style="font-size: 28px;">电子会员余额</div>
+              <div style="line-height: 62px;font-size: 32px;">{{hzAmt }}元</div>
+            </div>
+          </el-col>
+          <el-col :xs="12" :sm="12" :lg="6">
+            <div class="flex xiaoe">
+              <div style="font-size: 28px;">电子会员总数</div>
+              <div style="line-height: 62px;font-size: 32px;">{{ cardNum }}个</div>
+            </div>
+          </el-col>
+        </el-row>
+      </div>
+      <div style="width:99%; height: 181px;">
+        <span style="color:#ff9955;font-size:25px;">|</span>
+        <span style="font-size:20px;">详情:</span>
+        <el-table v-loading="loading"  :data="dayReportList">
+          <el-table-column label="日期" align="center" prop="createTime">
+              <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="充值金额" align="center" prop="czamt" />
+          <el-table-column label="消费金额" align="center" prop="xfamt"/>
+          <el-table-column label="新增电子会员" align="center" prop="cardnum" />
+        </el-table>
+        <div  style="float:right;">
+          <el-pagination
+            style="padding-top: 15px;"
+            @size-change="findSizeChange"
+            @current-change="findPage"
+            :current-page.sync="pageNow"
+            background
+            :pager-count="6"
+            :page-sizes="[5,10,20,50,100]"
+            :page-size="size"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="total">
+          </el-pagination>
+        </div>
+      </div> 
+      <el-dialog :title="title" width="800px"  :visible.sync="open" append-to-body>
+        <el-table v-loading="loading" :data="dayReportDetailsList">
+          <el-table-column label="订单单号" align="center" prop="orderNo" />
+          <el-table-column label="微信用户唯一标识" align="center" prop="unionId" v-if="false" />
+          <el-table-column label="会员号ID" align="center" prop="customerNo" />
+          <el-table-column label="会员名" align="center" prop="customerName" />
+          <el-table-column label="油品" align="center" prop="cardOilsType" :formatter="cardOilsTypeFotmat"/>
+          <el-table-column label="订单类型" align="center" prop="usageType" :formatter="usageTypeFotmat"/>
+          <el-table-column label="消费金额" align="center" prop="amt" />
+          <el-table-column label="余额" align="center" prop="balance" />
+          <el-table-column label="消费方式" align="center" prop="payType" :formatter="payTypeFotmat"/>
+          <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
+          <el-table-column label="油站名称" align="center" prop="stationName" />
+          <el-table-column label="油站名称" align="center" prop="create_time" v-if="false"/>
+        </el-table>
+        <div  class="pagination-container">
+          <el-pagination
+            style="padding-top: 15px"
+            @size-change="sizeChange"
+            @current-change="currentChange"
+            :current-page.sync="pageNow2"
+            background
+            :pager-count="6"
+            :page-sizes="[5,10,20,50,100]"
+            :page-size="setting"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="total1">
+          </el-pagination>
+        </div>
+      </el-dialog>
+    </div>
+  </el-scrollbar>
+</template>
+
+<script>
+
+import {listSum,selectCard} from "@/api/customer/card";
+import { xfAmtQuery } from "@/api/customer/consumption";
+import { czAmtQuery,selectCardDetail } from "@/api/customer/recharge";
+export default {
+  name: "source",
+  data() {
+    return {
+      charts: null,
+      size:10,
+      pageNow:1,
+      pageNow2:1,
+      setting:10,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      total1: 0,
+      hzAmt: 0,
+      cardNum:0,
+      // 优惠劵管理表格数据
+      couponList: [],
+      dayReportDetailsList: [],
+      dateRangeCreatedDate: [],
+      //x轴数据
+      xdata: [],
+      //92#汽油数据
+      czdata: [],
+      //95#汽油数据
+      xfdata: [],
+      // 弹出层标题
+      title: "",
+      rows:[],
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageSetting:10,
+        pageNum:1,
+        createdDate: null,
+        stationId:null,
+        stationName: null,
+        beginTime: null,
+        endTime: null,
+        payDate: null,
+        status:"1"
+      },
+      // 查询参数
+      queryInfo: {
+        pageSetting:10,
+        pageNo:1,
+        createDate: null
+      },
+      query:{
+        stationId:null
+      },
+      //日报数据
+      dayReportList: [],
+      // 表单参数
+      form: {
+        czAmt: 0,
+        xfAmt: 0
+      },
+      // 表单校验
+      rules: {}
+    };
+  },
+ 
+  created() {
+    this.dayDataSource();
+    this.getHZlist();
+    //获取折线图的数据
+    this.reset();
+    this.queryParams.beginTime = this.getMonthDate();
+    this.queryParams.endTime = this.getEndFormatDate(new Date());
+    this.queryParams.stationId=this.$store.selectDeptId;
+  },
+  methods: {
+    usageTypeFotmat(row, column){
+      if(row.usageType === '+'){
+        return '充值'
+      }else if(row.usageType === '-'){
+        return '消费'
+      }
+    },
+    payTypeFotmat(row, column){
+      if(row.payType === '1'){
+        return '小程序'
+      }else if(row.payType === '2'){
+        return 'POS'
+      }
+    },
+    cardOilsTypeFotmat(row, column){
+      if(row.cardOilsType === '1'){
+        return '汽油'
+      }else if(row.cardOilsType === '2'){
+        return '柴油'
+      }
+    },
+    /** 查询电子会员数据 */
+    getList() {
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      xfAmtQuery(this.queryParams).then(response => {
+        if (response.hasOwnProperty('data')) {
+          this.form.xfAmt = response.data.amt;
+        }
+      });
+      czAmtQuery(this.queryParams).then(response => {
+        if (response.hasOwnProperty('data')) {
+          this.form.czAmt = response.data.amt;
+        }
+      });
+      this.dayReportDetail();
+    },
+    getHZlist(){
+      //汇总电子会员数据
+      this.query.stationId=this.$store.selectDeptId;
+      if(this.query.stationId==null || this.query.stationId==""){
+        this.query.stationId =this.$store.state.user.deptId;
+      }
+      listSum(this.query).then(response => {
+        if (response.hasOwnProperty('data')) {
+          this.cardNum= response.data.num;
+          this.hzAmt = response.data.amt;
+        }
+      });
+    },
+    findPage(val){
+      this.pageNow = val;
+      this.dayReportDetail();
+    },
+    findSizeChange(size) {
+      //将val赋值给size
+      this.size = size;
+      //重新去后台查询数据
+      this.dayReportDetail();
+    },
+    dayReportDetail(){
+      this.loading = false;
+      this.queryParams.pageNo =this.pageNow;
+      this.queryParams.pageSetting =this.size;
+      selectCard(this.queryParams).then(response => {
+       this.dayReportList= response.rows;
+        this.total = response.total;
+      });
+    },
+    //本日的数据
+    dayDataSource() {
+      this.reset();
+      this.queryParams.beginTime = this.getNowFormatDate(new Date());
+      this.queryParams.endTime = this.getEndFormatDate(new Date());
+      this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      this.getList();
+    },
+    //今天
+    getNowFormatDate(date) {
+      let seperator1 = "-";
+      let month = date.getMonth() + 1;
+      let strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      let currentdate1 =
+        date.getFullYear() + seperator1 + month + seperator1 + strDate;
+      return currentdate1;
+    },
+    //明天
+    getEndFormatDate(myDate) {
+      let date = myDate.getDate();
+      date = date + 1;
+      myDate.setDate(date);
+      let seperator2 = "-";
+      let month = myDate.getMonth() + 1;
+      let strDate = myDate.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      let currentdate2 =
+        myDate.getFullYear() + seperator2 + month + seperator2 + strDate;
+      return currentdate2;
+    },
+    //昨天
+    getFormatDate(myDate) {
+      let date = myDate.getDate();
+      date = date - 1;
+      myDate.setDate(date);
+      let seperator3 = "-";
+      let month = myDate.getMonth() + 1;
+      let strDate = myDate.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      let currentdate3 =
+        myDate.getFullYear() + seperator3 + month + seperator3 + strDate;
+      return currentdate3;
+    },
+    getDates() {
+      var new_Date = new Date();
+      var timesStamp = new_Date.getTime();
+      var currenDay = new_Date.getDay();
+      var dates = new Date(
+        timesStamp + 24 * 60 * 60 * 1000 * (0 - ((currenDay + 6) % 7))
+      )
+        .toLocaleDateString()
+        .replace(/[年月]/g, "-")
+        .replace(/[日上下午]/g, "");
+      let s = dates.replace(/-/g, "/");
+      var dt = new Date(s);
+      var m = dt.getMonth() + 1;
+      var d = dt.getDate();
+      m = m < 10 ? "0" + m : m;
+      d = d < 10 ? "0" + d : d;
+      dates = dt.getFullYear() + "-" + m + "-" + d;
+      return dates;
+    },
+    //本月第一天
+    getMonthDate() {
+      let date = new Date();
+      let seperator1 = "-";
+      let month = date.getMonth() + 1;
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      let currentdate =
+        date.getFullYear() + seperator1 + month + seperator1 + "01";
+      return currentdate;
+    },
+    // 表单重置
+    reset() {
+      this.queryParams = {
+        pageSetting:10,
+        pageNo:1,
+        createDate: null,
+        stationId: null,
+        stationName: null,
+        beginTime:null,
+        endTime:null
+      };
+      this.form = {
+        czAmt: 0,
+        xfAmt: 0
+      };
+      this.queryInfo={
+        pageSetting:10,
+        pageNo:1,
+        createDate: null
+      };
+    },
+
+    /** 查看详情按钮操作 */
+    handleLook(row) {
+      this.rows=row;
+      this.getLookOrder(row);
+    },
+    sizeChange(psize){
+      //将val赋值给size
+      this.setting = psize;
+      this.getLookOrder(this.rows);
+    },
+    currentChange(val) {
+      this.pageNow2 = val;
+      //重新去后台查询数据
+      this.getLookOrder(this.rows);
+    },
+    getLookOrder(row) {
+      const createDate = row.createTime;
+      this.queryInfo.createDate =createDate.substring(0,10);
+      this.queryInfo.pageNo =this.pageNow2;
+      this.queryInfo.pageSetting =this.setting;
+      return selectCardDetail(this.queryInfo).then(response => {
+        this.dayReportDetailsList = response.rows;
+        this.total1 = response.total;
+        this.open = true;
+        this.title = "电子会员明细";
+      });
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.flex {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  height: 170px;
+  flex-direction: column;
+}
+.flex-qy {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+.flex-qy-sx {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+}
+.panel-group {
+  padding-left: 10px;
+}
+
+.flex-sr {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  flex-direction: column;
+}
+.sr-font {
+  font-size: 20px;
+  color: #f4a645;
+}
+</style>

+ 61 - 32
src/views/customer/setting/index.vue

@@ -2,24 +2,24 @@
   <div class="app-container" style="padding-top: 5px;">
 <!--固态等级-->
     <p style="margin: 5px"><span class="textlineHeader">固定等级</span>
-      <el-button class="settingButton" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['customer:setting:add']" >添加固定等级</el-button>
+      <el-button class="settingButton" type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['customer:setting:add']" >添加固定等级</el-button>
     </p>
     <div class="cutLine firstLine"></div>
     <el-table v-loading="loading" :data="settingList" >
       <el-table-column label="id" align="center" prop="id" v-if="false"/>
-      <el-table-column label="油品名称" align="center" prop="oilName" />
-      <el-table-column label="等级名称" align="center" prop="grade" />
-      <el-table-column label="优惠方式" align="center" prop="discountWay" />
-      <el-table-column label="会员条件" align="center" >
+      <el-table-column label="油品名称" align="center" prop="oilName" width="100px;" />
+      <el-table-column label="等级名称" align="center" prop="grade"  />
+      <el-table-column label="优惠方式" align="center" prop="discountWay" width="80px;" />
+      <el-table-column label="会员条件" align="center"   >
         <template slot-scope="scope">
-          {{scope.row.memberConditStart}} - {{scope.row.memberConditEnd}}
+          {{scope.row.memberConditStart}} ≤累计历史消费金额&lt;{{scope.row.memberConditEnd}}
         </template>
       </el-table-column>
-      <el-table-column label="优惠/L" align="center" prop="gasoilDiscountLitre" />
+      <el-table-column label="优惠/L" align="center" prop="gasoilDiscountLitre" width="80px;" />
       <el-table-column label="初始值" align="center" v-if="false" prop="memberConditStart" />
       <el-table-column label="结束值" align="center" v-if="false" prop="memberConditEnd" />
 <!--      <el-table-column label="柴油优惠/L" align="center" prop="dieseloilDiscountLitre" />-->
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width " width="100px;">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -41,7 +41,7 @@
     <!-- 添加或修改客户优惠等级设置对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="90px">
-        <el-form-item label="油站名称"  prop="stationId">
+        <!-- <el-form-item label="油站名称"  prop="stationId">
           <el-select v-model="form.stationId"
                      placeholder="请选择油站"
                      clearable
@@ -56,17 +56,16 @@
             ></el-option>
           </el-select>
         </el-form-item>
-
         <el-form-item label="油站名称" v-show="false" prop="stationName" >
           <el-input v-model="form.stationName" placeholder="请输入油站名称" />
-        </el-form-item>
+        </el-form-item> -->
         <el-form-item label="油品名称" prop="oilName">
           <el-select v-model="form.oilName" placeholder="油品名称" clearable size="small">
             <el-option
               v-for="dict in oilNameOptions"
-              :key="dict.dictLabel"
-              :label="dict.dictLabel"
-              :value="dict.dictLabel"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
             />
           </el-select>
         </el-form-item>
@@ -77,17 +76,16 @@
           <el-input v-model="form.discountWay" placeholder="请输入优惠方式" />
         </el-form-item>
         <el-form-item label="会员条件" >
-          初始值
-          <el-input-number v-model="form.memberConditStart"  size="mini" :min="0"  />
-          终止值
-          <el-input-number v-model="form.memberConditEnd"   size="mini" :min="0" />
+          <div>
+            <el-input-number v-model="form.memberConditStart"  style="width:110px" size="mini" :min="0"  />
+            ≤累计消费金额(元)&lt;
+            <el-input-number v-model="form.memberConditEnd"  style="width:110px" size="mini" :min="0" />
+          </div>
+          <span ><font style="color:red;size:10px;" >注:优惠条件按照累计历史消费金额计算</font></span>
         </el-form-item>
-        <el-form-item label="优惠/L" prop="gasoilDiscountLitre">
-          <el-input v-model="form.gasoilDiscountLitre" placeholder="请输入汽油优惠/L" />
+        <el-form-item label="优惠金额" prop="gasoilDiscountLitre">
+          <el-input-number v-model="form.gasoilDiscountLitre" size="mini" :min="0" placeholder="请输入优惠金额" /> 元/L
         </el-form-item>
-<!--        <el-form-item label="柴油优惠/L" prop="dieseloilDiscountLitre">-->
-<!--          <el-input v-model="form.dieseloilDiscountLitre" placeholder="请输入柴油优惠/L" />-->
-<!--        </el-form-item>-->
         <el-form-item label="类型" v-show="false" prop="growthValue">
           <el-input v-model="form.gradeType" value="1" />
         </el-form-item>
@@ -221,6 +219,8 @@
 <script>
 import { listSetting, getGrouthRuleList, addGrouthRule, editGrouthRule, delGrouthRule, getSetting, delSetting, addSetting, updateSetting, exportSetting } from "@/api/customer/setting";
 import {stationinfo} from "@/api/station/gun";
+import { getDept } from "@/api/system/dept";
+import { listPrice } from "@/api/station/price";
 export default {
   name: "Setting",
   data() {
@@ -291,6 +291,13 @@ export default {
         date: null,
         deductionGrowthValue: null
       },
+      query:{
+        deptId: null
+      },
+      queryInfo:{
+        stationId: null
+      }, 
+      deptId:null,
       // 表单参数
       form: {},
       formGrouthRule:{},
@@ -306,12 +313,11 @@ export default {
   },
   created() {
     this.getList();
-    //this.getRuleList();
-   // this.getList2();
-    this.getDicts("oil_name").then(response => {
-      this.oilNameOptions = response.data;
-    });
-    stationinfo().then(response => {
+    this.query.deptId =this.$store.selectDeptId;
+    if(this.query.deptId==null || this.query.deptId==""){
+      this.query.deptId =this.$store.state.user.deptId;
+    }
+    stationinfo(this.query).then(response => {
       this.stationOptions = response.rows;
     });
   },
@@ -321,6 +327,9 @@ export default {
       this.queryParams.gradeType="1";
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listSetting(this.queryParams).then(response => {
         this.settingList = response.rows;
         this.total = response.total;
@@ -332,6 +341,9 @@ export default {
       this.selectParams.gradeType="3";
       this.loading = true;
       this.selectParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listSetting(this.selectParams).then(response => {
         this.DTsettingList = response.rows;
         this.total = response.total;
@@ -385,9 +397,26 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.form.discountWay ="直降";
-      this.title = "添加客户优惠等级设置";
+      this.deptId=this.$store.selectDeptId;
+      if(this.deptId==null || this.deptId==""){
+        this.deptId =this.$store.state.user.deptId;
+      }
+      getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+            this.open = true;
+            this.form.discountWay ="直降";
+            this.title = "添加客户优惠等级设置";
+            this.form.stationId=this.deptInfo.deptId;
+            this.form.stationName=this.deptInfo.deptName;
+            this.queryInfo.stationId=this.deptInfo.deptId;
+            listPrice(this.queryInfo).then(response => {
+              this.oilNameOptions = response.rows;
+            });
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+      }); 
     },
     /** 修改按钮操作 */
     handleUpdate(row) {

+ 169 - 29
src/views/dataSource/dayReport.vue

@@ -19,12 +19,12 @@
               style="margin: 0px 10px;"
               size="mini"
               v-model="dateRangeCreatedDate"
-              type="daterange"
+              type="datetimerange"
               range-separator="至"
               start-placeholder="开始日期"
               end-placeholder="结束日期"
             ></el-date-picker>
-            <el-button size="mini" @click="queryDataSource">查询</el-button>
+            <el-button type="cyan" size="mini" @click="queryDataSource">查询</el-button>
           </el-form-item>
         </el-form>
         <span style="color:#ff9955;font-size:25px;">|</span>
@@ -58,7 +58,7 @@
       </div>
       <div style="width:100%; height: 360px;background: #FFFFFF;">
         <span style="color:#ff9955;font-size:25px;">|</span>
-        <span style="font-size:20px;">销售情况</span>
+        <span style="font-size:20px;">销售情况(本月)</span>
         <div ref="myChart" style="width:100%; height: 350px;margin: 0px 25px;"></div>
       </div>
       <div style="width:100%; height: 181px;">
@@ -75,8 +75,8 @@
           <el-table-column label="汽油" align="center" prop="qyAmt" />
           <el-table-column label="柴油" align="center" prop="cyAmt" />
           <el-table-column label="订单数" align="center" prop="orderNo" />
-          <el-table-column label="应收" align="center" prop="receivableAmt" />
-          <el-table-column label="到账" align="center" prop ="receivedAmt"/>
+          <el-table-column label="应收(元)" align="center" prop="receivableAmt" />
+          <el-table-column label="实收(元)" align="center" prop ="amt"/>
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
               <el-button
@@ -97,7 +97,7 @@
         />
       </div>
       <el-dialog :title="title" width="800px"  :visible.sync="open" append-to-body>
-        <el-table v-loading="loading" :data="dayReportDetailsList">
+        <el-table v-loading="loading" :data="dayReportDetailsList" show-summary   :summary-method="getTotal" >
           <el-table-column label="油品" align="center" prop="oilName" />
           <el-table-column label="油枪号" align="center" prop="oilGun" />
           <el-table-column label="销量(L)" align="center" prop="orderLiters" />
@@ -107,17 +107,17 @@
           <el-table-column label="优惠劵" align="center" prop="discountCouponAmt" v-if="false"/>
           <el-table-column label="会员支付" align="center" prop="menberAmt" v-if="false" />
           <el-table-column label="微信支付" align="center" prop="wxAmt" v-if="false" />
-          <el-table-column label="支付宝支付" align="center" prop="zfbAmt"v-if="false" />
+          <el-table-column label="支付宝支付" align="center" prop="zfbAmt" v-if="false" />
           <el-table-column label="会员充值" align="center" prop v-if="false" />
           <el-table-column label="积分消费" align="center" prop v-if="false" />
         </el-table>
-        <pagination
+        <!-- <pagination
           v-show="total1>0"
           :total="total1"
           :page.sync="queryInfo.pageNum"
           :limit.sync="queryInfo.pageSize"
           @pagination="getLookOrder"
-        />
+        /> -->
       </el-dialog>
     </div>
   </el-scrollbar>
@@ -135,7 +135,7 @@ import {
   listXdata,
   listQydata92,
   listQydata95,
-  listQydata97,
+  listQydata98,
   listQydata0,
   listQydata10,
   listQydata20
@@ -169,8 +169,8 @@ export default {
       qydata92: [],
       //95#汽油数据
       qydata95: [],
-      //97#汽油数据
-      qydata97: [],
+      //98#汽油数据
+      qydata98: [],
       //0#柴油数据
       cydata0: [],
       //-10#柴油数据
@@ -189,6 +189,8 @@ export default {
         beginTime: null,
         endTime: null,
         payDate: null,
+        pageNum: 1,
+        pageSize: 10,
         status:"1"
       },
       // 查询参数
@@ -221,6 +223,9 @@ export default {
       this.queryParams.beginTime = this.getMonthDate();
       this.queryParams.endTime = this.getEndFormatDate(new Date());
       this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       setTimeout(() => {
         this.initChart();
       }, 1000);
@@ -233,6 +238,9 @@ export default {
     this.queryParams.beginTime = this.getMonthDate();
     this.queryParams.endTime = this.getEndFormatDate(new Date());
     this.queryParams.stationId=this.$store.selectDeptId;
+    if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
     this.getDatas();
   },
   methods: {
@@ -258,10 +266,11 @@ export default {
           yAxis: {
             axisTick: {
               show: false
-            }
+            },
+            name:"元"
           },
           legend: {
-            data: ["92#", "95#", "97#", "0#", "-10#", "-20#"]
+            data: ["92#", "95#", "98#", "0#", "-10#", "-20#"]
           },
           animation: false,
           series: [
@@ -296,7 +305,7 @@ export default {
               data: this.qydata95
             },
             {
-              name: "97#",
+              name: "98#",
               smooth: true,
               type: "line",
               itemStyle: {
@@ -308,7 +317,7 @@ export default {
                   }
                 }
               },
-              data: this.qydata97
+              data: this.qydata98
             },
             {
               name: "0#",
@@ -401,15 +410,15 @@ export default {
       });
     },
 
-    getQydata97() {
-      return listQydata97(this.queryParams).then(response => {
-        this.qydata97 = [];
+    getQydata98() {
+      return listQydata98(this.queryParams).then(response => {
+        this.qydata98 = [];
         if(response.hasOwnProperty('rows')){
           for (let i in response.rows) {
             let data = [];
             data.push(response.rows[i].createdDate);
             data.push(response.rows[i].amt);
-            this.qydata97.push(data);
+            this.qydata98.push(data);
           }
         }
       });
@@ -463,7 +472,7 @@ export default {
         this.getXData(),
         this.getQyData92(),
         this.getQydata95(),
-        this.getQydata97(),
+        this.getQydata98(),
         this.getQydata0(),
         this.getQydata10(),
         this.getQydata20()
@@ -474,6 +483,9 @@ export default {
 
     /** 查询优惠劵管理列表 */
     getList() {
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listSum(this.queryParams).then(response => {
         if (response.hasOwnProperty('data')) {
           this.form.zongAmt = response.data.amt;
@@ -503,48 +515,79 @@ export default {
     //本日的数据
     dayDataSource() {
       this.reset();
+      this.dateRangeCreatedDate=null;
       this.queryParams.beginTime = this.getNowFormatDate(new Date());
       this.queryParams.endTime = this.getEndFormatDate(new Date());
       this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       this.getList();
     },
     //昨天的数据
     yesDataSource() {
       this.reset();
+      this.dateRangeCreatedDate=null;
       this.queryParams.beginTime = this.getFormatDate(new Date());
       this.queryParams.endTime = this.getNowFormatDate(new Date());
       this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       this.getList();
     },
     //本周的数据
     workDataSource() {
       this.reset();
+      this.dateRangeCreatedDate=null;
       this.queryParams.beginTime = this.getDates();
       this.queryParams.endTime = this.getEndFormatDate(new Date());
       this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       //this.initChart();
-      this.getDatas();
+      //this.getDatas();
       this.getList();
     },
 
     //本月数据
     monthDataSource() {
       this.reset();
+      this.dateRangeCreatedDate=null;
       this.queryParams.beginTime = this.getMonthDate();
       this.queryParams.endTime = this.getEndFormatDate(new Date());
       this.queryParams.stationId=this.$store.selectDeptId;
-      this.getDatas();
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      //this.getDatas();
       this.getList();
     },
 
     //按照指定日期
     queryDataSource() {
       this.reset();
-      this.queryParams.beginTime = this.dateRangeCreatedDate[0];
-      this.queryParams.endTime = this.dateRangeCreatedDate[1];
-      this.queryParams.stationId=this.$store.selectDeptId;
-      this.getDatas();
-      this.getList();
+      if(this.dateRangeCreatedDate==null){
+        this.queryParams.stationId=this.$store.selectDeptId;
+        this.queryParams.beginTime = null;
+        this.queryParams.endTime = null;
+        if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+          this.queryParams.stationId =this.$store.state.user.deptId;
+        }
+        //  this.getDatas();
+        this.getList();
+      }else {
+        this.queryParams.beginTime = this.dateRangeCreatedDate[0];
+        this.queryParams.endTime = this.dateRangeCreatedDate[1];
+        this.queryParams.stationId=this.$store.selectDeptId;
+        if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+          this.queryParams.stationId =this.$store.state.user.deptId;
+        }
+        // this.getDatas();
+        this.getList();
+      }
+     
     },
     //今天
     getNowFormatDate(date) {
@@ -631,6 +674,8 @@ export default {
     // 表单重置
     reset() {
       this.queryParams = {
+        pageNum: 1,
+        pageSize: 10,
         createdDate: null,
         stationId: null,
         stationName: null,
@@ -667,7 +712,102 @@ export default {
         this.open = true;
         this.title = "日报详细信息";
       });
-    }
+    },
+    getTotal(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计';
+          return;
+        }
+        const values = data.map(item => Number(item[column.property]));
+        if (column.property === 'orderLiters') {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'receivableAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'amt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'discountAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'discountCouponAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'menberAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'wxAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'zfbAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else {
+          sums[index] = '';
+        }
+      });
+      return sums;
+    },
   }
 };
 </script>

+ 96 - 45
src/views/dataSource/saleReport.vue

@@ -10,73 +10,69 @@
           <el-button  size="mini" @click="monthDataSource">本月</el-button>
           <el-date-picker style="margin: 0px 10px;"
             v-model="dateRangeCreatedDate"
-            type="daterange"
+            type="datetimerange"
             size="mini"
             range-separator="至"
             start-placeholder="开始日期"
             end-placeholder="结束日期">
           </el-date-picker>
-          <el-button  size="mini" @click="queryDataSource">查询</el-button>
+          <el-button type="cyan" size="mini" @click="queryDataSource">查询</el-button>
         </el-form-item>
       </el-form>
       <el-row :gutter="10" class="panel-group">
         <el-col :xs="12" :sm="12" :lg="6" >
           <div class="flex xiaoliang">
-            <div style="line-height: 62px;font-size: 44px;">
-              {{ form.zongliters }}L
+            <div style="line-height: 62px;font-size: 2vw;">
+              {{ form.zongliters }}
             </div>
-            <div style="font-size: 28px;">
-              总销量
+            <div style="font-size: 2vw;">
+              总销量(L)
             </div>
           </div>
         </el-col>
         <el-col :xs="12" :sm="12" :lg="6">
           <div  class="flex xiaoe">
-            <div style="line-height: 62px;font-size: 44px;">
-              {{ form.zongAmt }}
+            <div style="line-height: 62px;font-size: 2vw;">
+              {{ form.zongAmt }}
             </div>
-            <div style="font-size: 28px;">
-              总金额
+            <div style="font-size: 2vw;">
+              总金额(元)
             </div>
           </div>
         </el-col>
         <el-col   :xs="12" :sm="12" :lg="6">
           <div class="flex qiyou">
-            <div style="font-size: 28px;margin-top: -80px;">  汽油  </div>
+            <div style="font-size: 28px;margin-top: -20px;">  汽油  </div>
             <div class="flex-qy" style="margin-top: 30px;">
-              <div class="flex-qy-sx"  style="margin-right: 25px;">
-                <div style="font-size: 36px;" >
-                  {{ form.qyliters }}L
-                </div>
-                <div style="font-size: 22px;">升数</div>
+              <div class="flex-qy-sx"  style="margin-right: 10px;">
+                <div style="font-size: 1.5vw;" >{{ form.qyliters }}</div>
+                <div style="font-size: 1.5vw;">升数(L)</div>
               </div>
-              <div class="flex-qy-sx"  style="margin-left: 25px;">
-                <div style="font-size: 36px;">
-                  {{ form.qyamt }}元
-                </div>
-                <div style="font-size: 22px;">金额</div>
+              <div class="flex-qy-sx"  style="margin-left: 10px;">
+                <div style="font-size: 1.5vw;">{{ form.qyamt }} </div>
+                <div style="font-size: 1.5vw;">金额(元)</div>
               </div>
             </div>
           </div>
         </el-col>
         <el-col  :xs="12" :sm="12" :lg="6">
           <div class="flex chaiyou">
-            <div style="font-size: 28px;margin-top: -80px;">  柴油  </div>
+            <div style="font-size: 28px;margin-top: -20px;">  柴油  </div>
             <div class="flex-qy" style="margin-top: 30px;">
-              <div class="flex-qy-sx" style="margin-right: 25px;">
-                <div style="font-size: 36px;">{{ form.cyliters }}L</div>
-                <div style="font-size: 22px;">升数</div>
+              <div class="flex-qy-sx" style="margin-right: 10px;">
+                <div style="font-size:1.5vw;">{{ form.cyliters }}</div>
+                <div style="font-size: 1.5vw;">升数(L)</div>
               </div>
-              <div class="flex-qy-sx" style="margin-left: 25px;">
-                <div style="font-size: 36px;">{{ form.cyamt }}元</div>
-                <div style="font-size: 22px;">金额</div>
+              <div class="flex-qy-sx" style="margin-left: 10px;">
+                <div style="font-size: 1.5vw;">{{ form.cyamt }}</div>
+                <div style="font-size: 1.5vw;">金额(元)</div>
               </div>
             </div>
           </div>
         </el-col>
       </el-row>
     </div>
-    <div style="width:100%; height: 181px;background: #FFFFFF;">
+    <div style="width:100%; height: 151px;background: #FFFFFF;">
       <span  style="color:#ff9955;font-size:25px;" >|</span><span style="font-size:20px;">收入概览</span>
       <el-row style="display:flex; align-items:center;justify-content:center;width:100%; height: 100%;">
         <el-col :xs="12" :sm="12" :lg="3" >
@@ -135,13 +131,13 @@
         </el-col>
       </el-row>
     </div>
-    <div style="width:100%; height: 181px;">
+    <div style="width:100%; height: 151px;">
       <span  style="color:#ff9955;font-size:25px;" >|</span><span style="font-size:20px;">今日数据</span>
       <el-row style="display:flex; align-items:center;justify-content:center;width:100%; height: 100%;">
         <el-col :xs="12" :sm="12" :lg="3">
           <div class="flex-sr">
             <div>
-              <span>0</span>
+               <span class="sr-font">{{ infoFrom.czAmt }}</span>
             </div>
             <div>充值金额(元)</div>
           </div>
@@ -149,27 +145,27 @@
         <el-col :xs="12" :sm="12" :lg="3">
           <div class="flex-sr">
             <div>
-              <span>0</span>
+               <span class="sr-font">{{ infoFrom.xfAmt }}</span>
             </div>
-            <div>会员消费金额(元)</div>
+            <div>消费金额(元)</div>
           </div>
         </el-col>
         <el-col :xs="12" :sm="12" :lg="3">
           <div class="flex-sr">
-            <div><span>0</span></div>
-            <div>会员余额(元)</div>
+            <div><span class="sr-font">{{ infoFrom.yeAmt }}</span></div>
+            <div>余额(元)</div>
           </div>
         </el-col>
         <el-col :xs="12" :sm="12" :lg="3">
           <div class="flex-sr">
-            <div><span>0</span></div>
-            <div>新增会员(人)</div>
+            <div><span class="sr-font">{{ infoFrom.jrhy}}</span></div>
+            <div>新增电子卡(个)</div>
           </div>
         </el-col>
         <el-col :xs="12" :sm="12" :lg="3">
           <div class="flex-sr">
-            <div><span>0</span></div>
-            <div>会员总数(人)</div>
+             <div><span class="sr-font">{{ infoFrom.zonghy }}</span></div>
+            <div>电子卡总数(个)</div>
           </div>
         </el-col>
         <el-col :xs="12" :sm="12" :lg="3">
@@ -197,7 +193,7 @@
 </template>
 
 <script>
-  import { listSum,listOilType,listViewData } from "@/api/dataSource/saleReport";
+  import { listSum,listOilType,listViewData,listCZData,listXFData,listHYData,listJRHYData } from "@/api/dataSource/saleReport";
 
 export default {
   name: "source",
@@ -230,6 +226,9 @@ export default {
         beginTime:null,
         endTime:null
       },
+      queryInfo:{
+        stationId:null
+      },
       // 表单参数
       form: {
         zongAmt:0,
@@ -245,8 +244,14 @@ export default {
         tyAppAmt:0,
         otherAmt:0,
         memberAmt:0,
-        posAmt:0,
-        
+        posAmt:0              
+      },
+      infoFrom:{
+         czAmt:0,
+        xfAmt:0,
+        yeAmt:0,
+        jrhy:0,
+        zonghy:0
       },
       // 表单校验
       rules: {
@@ -259,6 +264,9 @@ export default {
   methods: {
     /** 查询优惠劵管理列表 */
     getList() {
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listSum(this.queryParams).then(response => {
         if(response.hasOwnProperty('data')){
           this.form.zongAmt = response.data.amt;
@@ -322,6 +330,8 @@ export default {
           }
         }
       });
+      
+      
     },
     //本日的数据
     dayDataSource(){
@@ -330,6 +340,49 @@ export default {
       this.queryParams.endTime =this.getEndFormatDate(new Date());
       this.queryParams.stationId=this.$store.selectDeptId;
       this.getList();
+      console.log("this.queryParams",this.queryParams);
+      listCZData(this.queryParams).then(response => {
+        if(response.hasOwnProperty('data')){
+          if(response.data.amt){
+            this.infoFrom.czAmt = response.data.amt;
+          }else{
+            this.infoFrom.czAmt = 0;
+          }
+        }
+      });
+      listXFData(this.queryParams).then(response => {
+        if(response.hasOwnProperty('data')){
+          if(response.data.amt){
+            this.infoFrom.xfAmt = response.data.amt;
+          }else{
+            this.infoFrom.xfAmt = 0;
+          }
+        }
+      });
+      this.queryInfo.stationId =this.queryParams.stationId;
+      listHYData(this.queryInfo).then(response => {
+        if(response.hasOwnProperty('data')){
+          if(response.data.amt){
+            this.infoFrom.yeAmt = response.data.amt;
+          }else{
+            this.infoFrom.yeAmt = 0;
+          }
+          if(response.data.num){
+            this.infoFrom.zonghy = response.data.num;
+          }else{
+            this.infoFrom.zonghy = 0;
+          }
+        }
+      });
+      listJRHYData(this.queryParams).then(response => {
+        if(response.hasOwnProperty('data')){
+          if(response.data.num){
+            this.infoFrom.jrhy = response.data.num;
+          }else{
+            this.infoFrom.jrhy = 0;
+          }
+        }
+      });
     },
     //昨天的数据
     yesDataSource(){
@@ -360,9 +413,7 @@ export default {
       this.reset();
       this.queryParams.beginTime =this.dateRangeCreatedDate[0];
       this.queryParams.endTime = this.dateRangeCreatedDate[1];
-      console.log("selectDeptId",this.$store.selectDeptId);
       this.queryParams.stationId=this.$store.selectDeptId;
-      console.log("stationId",this.queryParams.stationId);
       this.getList();
     },
     //今天
@@ -476,7 +527,7 @@ export default {
     align-items:center;
     justify-content:center;
     width: 100%;
-    height: 270px;
+    height: 170px;
     flex-direction:column;
 
   }

+ 3 - 1
src/views/integral/order/index.vue

@@ -45,7 +45,6 @@
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="积分订单id" align="center" prop="id" v-if="false"/>
       <el-table-column label="订单号" align="center" prop="integralOrderNo" />
       <el-table-column label="商品类型" align="center" prop="waresType" v-if="false"/>
@@ -133,6 +132,9 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listOrder(this.queryParams).then(response => {
         this.orderList = response.rows;
         this.total = response.total;

+ 8 - 4
src/views/integral/points/index.vue

@@ -12,8 +12,8 @@
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
+        <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <!-- <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="pointsList" @selection-change="handleSelectionChange">
@@ -22,14 +22,15 @@
       <el-table-column label="微信用户unionID" align="center" prop="unionId" v-if="false"/>
       <el-table-column label="公众号的openID" align="center" prop="blogOpenid" v-if="false"/>
       <el-table-column label="小程序的openID" align="center" prop="minaOpenid" v-if="false" />
+      <el-table-column label="会员名" align="center" prop="customerName" />
       <el-table-column label="手机号码" align="center" prop="mobilePhone" />
       <el-table-column label="账户积分余额" align="center" prop="points" />
       <el-table-column label="使用积分累计" align="center" prop="consumptionPoints" />
       <el-table-column label="获得积分累计" align="center" prop="accumulatePoints" />
       <el-table-column label="失效积分累计" align="center" prop="invalidPoints" />
-      <el-table-column label="最近积分消费日期" align="center" prop="recentConsumptionDate" width="180">
+      <el-table-column label="最近积分变化日期" align="center" prop="recentConsumptionDate" width="180">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.recentConsumptionDate, '{y}-{m}-{d}') }}</span>
+          <span>{{ parseTime(scope.row.recentConsumptionDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
         </template>
       </el-table-column>
       <el-table-column label="油站ID" align="center" prop="stationId" v-if="false"/>
@@ -156,6 +157,9 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listPoints(this.queryParams).then(response => {
         this.pointsList = response.rows;
         this.total = response.total;

+ 4 - 1
src/views/integral/record/index.vue

@@ -121,6 +121,9 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listRecord(this.queryParams).then(response => {
         this.recordList = response.rows;
         this.total = response.total;
@@ -201,7 +204,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$confirm('是否确认删除客户积分记录编号为"' + ids + '"的数据项?', "警告", {
+      this.$confirm('是否确认删除客户积分记录', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"

+ 97 - 382
src/views/integral/rule/index.vue

@@ -1,64 +1,63 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="油品名称" prop="oilName">
-        <el-input
-          v-model="queryParams.oilName"
-          placeholder="请输入油品名称"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
+     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+       <!-- <el-form-item label="油品名称" prop="oilName">
+         <el-select  v-model="queryParams.oilName" placeholder="油品名称" clearable size="small"  @keyup.enter.native="handleQuery">
+            <el-option
+              v-for="dict in oilNameOptions"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
+            />
+          </el-select>
+      </el-form-item>   -->
+      <el-form-item style="float:right">
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">刷新</el-button>
+        <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> -->
       </el-form-item>
     </el-form>
-
-    <el-table v-loading="loading" :data="ruleList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="主键id" align="center" prop="id" v-if="false"/>
+    <el-table v-loading="loading" :data="ruleList">
       <el-table-column label="油站id" align="center" prop="stationId" v-if="false"/>
-      <el-table-column label="油站名称" align="center" prop="stationName" />
-      <el-table-column label="积分计算规则类型" align="center" prop="ruleType" />
-      <el-table-column label="有效期设置" align="center" prop="termDateManage" />
-      <el-table-column label="清空积分时间" align="center" prop="emptyDate" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.emptyDate, '{y}-{m}-{d}') }}</span>
-        </template>
+      <el-table-column label="规则" align="center" >
+          <template slot-scope="scope">
+            <div v-show="scope.row.oilType==1">
+              <span v-show="scope.row.ruleType==3">以加油升数累计</span>
+                <span v-show="scope.row.ruleType==1">以订单实付金额累计</span>
+                  <span v-show="scope.row.ruleType==2">以订单应付金额累计</span>
+              <span>满{{scope.row.ruleTerms}}</span>
+              <span v-show="scope.row.ruleType==3">L起累计</span>
+              <span v-show="scope.row.ruleType!=3">元起累计</span>
+              <span>{{ scope.row.oilName}}油</span>
+              <span v-show="scope.row.gread=='所有人'">{{ scope.row.gread}}每消费</span>
+              <span v-show="scope.row.gread!='所有人'">{{ scope.row.gread}}会员每消费</span>
+              <span>{{ scope.row.saleAmt}}</span>
+              <span v-show="scope.row.ruleType==3">L</span>
+               <span v-show="scope.row.ruleType!=3">元</span>
+              <span>{{scope.row.integral}}积分</span>
+            </div>
+            <div v-show="scope.row.oilType==2">
+              <span>非油品满{{scope.row.ruleTerms}}元起累计每消费</span>
+              <span>{{ scope.row.saleAmt}}元兑换{{scope.row.integral}}积分</span>
+            </div>
+          </template>
       </el-table-column>
-      <el-table-column label="到期提醒设置" align="center" prop="expirationReminder" />
-      <el-table-column label="提醒时间设置" align="center" prop="remindDate" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.remindDate, '{y}-{m}-{d}') }}</span>
-        </template>
+      <el-table-column label="积分规则是否开启" align="center" prop="integralFlag" width="100px;">
+         <template slot-scope="scope2">
+            <span v-show="scope2.row.integralFlag==1">开启</span>
+            <span v-show="scope2.row.integralFlag==2">关闭</span>
+         </template>  
       </el-table-column>
-      <el-table-column label="积分活动设置" align="center" prop="integralActivity" />
-      <el-table-column label="日期选择" align="center" prop="datePicker" />
-      <el-table-column label="积分比例" align="center" prop="integralProportion" />
-      <el-table-column label="积分抵扣油品规则" align="center" prop="integralDeductionOil" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['integral:rule:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['integral:rule:remove']"
-          >删除</el-button>
-        </template>
+      <el-table-column label="油站名称" align="center" prop="stationName" width="100px;" />
+      <el-table-column label="积分活动时限" align="center" prop="termDateManage" :formatter="termDateManageFormat" width="120px;"/>    
+      <el-table-column label="多倍积分活动" align="center" prop="integralActivity"  :formatter="integralActivityFormat" width="100px;"/>
+      <el-table-column label="周期类型" align="center" prop="datePicker" :formatter="datePickerFormat" width="100px;"/>
+      <el-table-column label="积分比例" align="center" prop="integralProportion" width="100px;">
+            <template slot-scope="scope1">
+               <span>{{ scope1.row.integralProportion}}</span>
+               <span v-show="scope1.row.integralProportion!=''">倍</span>
+            </template>
       </el-table-column>
     </el-table>
-
     <pagination
       v-show="total>0"
       :total="total"
@@ -66,225 +65,13 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
-
-    <!-- 添加或修改对话框 -->
-    <el-dialog :title="title" :visible.sync="open"   append-to-body>
-      <div class="app-container">
-        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-          <el-form-item label="油站名称" prop="stationId" >
-            <el-select
-              v-model="form.stationId"
-              placeholder="请选择油站"
-              clearable
-              size="small"
-              @change="onInstitutionChang"
-            >
-              <el-option
-                v-for="item in stationOptions"
-                :key="item.deptId"
-                :label="item.deptName"
-                :value="item.deptId"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          <el-form-item v-show="false" label="油站名称" prop="stationName">
-            <el-input v-model="form.stationName"  placeholder="请输入油站名称" />
-          </el-form-item>
-          <el-form-item  label="油品积分规则" ></el-form-item>
-          <div>
-            <el-row v-for="(item, index) in form.itemsDetail"  :key="index" >
-              <el-form
-                :inline="true"
-                :model="form.itemsDetail[index]"
-                :rules="rules"
-                ref="ruleForms"
-                class="demo-form-inline"
-                size="small"
-              >
-                <el-form-item>
-                  <span>规则类型</span>
-                  <el-select v-model="item.ruleType" placeholder="请选择油品" style="width:150px;" clearable size="small" @change="oilNameChang" >
-                    <el-option
-                      v-for="item in ruleTypeOptions"
-                      :key="item.dictValue"
-                      :label="item.dictLabel"
-                      :value="item.dictValue"
-                    ></el-option>
-                  </el-select>
-                  <span>满</span>
-                  <el-input-number v-model="item.ruleTerms" :min="0" size="small" />
-                  <span>元</span>
-                  <span>L</span>
-                  <span>起累计 </span>
-                  <el-select v-model="item.oilName" placeholder="请选择油品" style="width:150px;" clearable size="small" @change="oilNameChang" >
-                    <el-option
-                      v-for="item in oilNameOptions"
-                      :key="item.oilName"
-                      :label="item.oilName"
-                      :value="item.oilName"
-                    ></el-option>
-                  </el-select>
-                  <el-select
-                    v-model="item.gread"
-                    placeholder="请选择等级"
-                    clearable
-                    size="small"
-                    style="width:150px;"
-                  >
-                    <el-option
-                      v-for="item in gradeOptions"
-                      :key="item.grade"
-                      :label="item.grade"
-                      :value="item.grade"
-                    ></el-option>
-                  </el-select>
-                  <span>每消费</span>
-                  <el-input-number v-model="item.saleAmt"  size="small" :min="0"/>
-                  <span>元</span>
-                  <el-input-number v-model="item.integral" size="small" :min="0"/>
-                  <span>积分</span>
-                </el-form-item>
-                <el-form-item>
-                  <el-button
-                    type="danger"
-                    @click="del(index)"
-                    size="small"
-                  >删除</el-button>
-                  <el-button
-                    type="success"
-                    @click="addItem"
-                    size="small"
-                  >新增</el-button>
-                </el-form-item>
-              </el-form>
-            </el-row>
-          </div>
-          <el-form-item  label="非油品积分规则" ></el-form-item>
-          <div>
-            <el-row v-for="(item, index) in form.notOilList"  :key="index" style="margin-left: 80px;">
-              <el-form
-                :inline="true"
-                :model="form.notOilList[index]"
-                :rules="rules"
-                ref="ruleForms"
-                class="demo-form-inline"
-                size="small"
-              >
-                <el-form-item>
-                  <span>满</span>
-                  <el-input-number v-model="item.ruleTerms" :min="0" size="small" />
-                  <span></span>
-                  <span>元  起累计 </span>
-                  <span>每消费</span>
-                  <el-input-number v-model="item.saleAmt"  size="small" :min="0"/>
-                  <span>元</span>
-                  <el-input-number v-model="item.integral" size="small" :min="0"/>
-                  <span>积分</span>
-                </el-form-item>
-              </el-form>
-            </el-row>
-          </div>
-          <el-form-item label="有效期设置" prop="termDateManage">
-            <el-radio-group v-model="form.termDateManage">
-              <el-radio
-                v-for="dict in termDateManageOptions"
-                :key="dict.dictValue"
-                :label="dict.dictValue"
-              >{{dict.dictLabel}}</el-radio>
-            </el-radio-group>
-            <el-date-picker clearable size="small" style="width: 200px;margin-left: 10px;"
-                            v-model="form.emptyDate"
-                            type="date"
-                            value-format="yyyy-MM-dd"
-                            placeholder="选择清空积分时间">
-            </el-date-picker>
-            <span>清空积分</span>
-          </el-form-item>
-          <el-form-item label=  "到期提醒设置" prop="expirationReminder">
-            <el-radio-group v-model="form.expirationReminder">
-              <el-radio
-                v-for="dict in expirationOptions"
-                :key="dict.dictValue"
-                :label="dict.dictValue"
-              >{{dict.dictLabel}}</el-radio>
-            </el-radio-group>
-            <el-date-picker clearable size="small" style="margin-left: 10px;width: 200px"
-                            v-model="form.remindDate"
-                            type="date"
-                            value-format="yyyy-MM-dd"
-                            placeholder="选择提醒时间设置">
-            </el-date-picker>
-          </el-form-item>
-          <el-form-item label="积分活动设置" ></el-form-item>
-          <el-form-item >
-            <el-radio-group v-model="form.integralActivity">
-              <el-radio
-                v-for="dict in integralActivityOptions"
-                :key="dict.dictValue"
-                :label="dict.dictValue"
-              >{{dict.dictLabel}}</el-radio>
-            </el-radio-group>
-          </el-form-item>
-          <el-row>
-            <el-col :span="8" style="margin-left: 80px;">
-              <el-form-item  label="日期选择" prop="datePicker">
-                <el-date-picker clearable size="small" style="margin-left: 10px;width: 200px"
-                                v-model="form.datePicker"
-                                type="dates"
-                                value-format="yyyy-MM-dd"
-                                placeholder="选择提醒时间设置">
-                </el-date-picker>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item  label="积分比例" prop="integralProportion">
-                <el-input-number v-model="form.integralProportion" :min="1" placeholder="请输入加倍比例" />
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-form-item label="抵扣油品规则" prop="integralDeductionOil">
-            <el-radio-group v-model="form.integralDeductionOil">
-              <el-radio
-                v-for="dict in integralDeductionOilOptions"
-                :key="dict.dictValue"
-                :label="dict.dictValue"
-              >{{dict.dictLabel}}</el-radio>
-            </el-radio-group>
-          </el-form-item>
-          <el-form-item label="积分轮播图">
-            <el-upload
-              ref="upload"
-              action="#"
-              multiple
-              list-type="picture-card"
-              :limit='5'
-              :file-list="form.imgFileList"
-              accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
-              :on-preview="handlePictureCardPreview"
-              :on-change="pictureChange"
-              :on-remove="handleRemove">
-              <i class="el-icon-plus"></i>
-              <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,最多上传5张且单张图片不超过5M</div>
-            </el-upload>
-            <el-dialog :visible.sync="dialogVisible">
-              <img width="100%" :src="dialogImageUrl" alt="" />
-            </el-dialog>
-          </el-form-item>
-        </el-form>
-        <div slot="footer" class="dialog-footer"> 
-            <el-button type="primary" @click="submitUpload">确 定</el-button>      
-          <!-- <el-button type="primary" @click="submitForm">确 定</el-button> -->
-          <el-button @click="cancel">取 消</el-button>
-        </div>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listRule, getRule, delRule, addRule, updateRule, exportRule } from "@/api/integral/rule";
+import {listRuleInfo} from "@/api/integral/rule";
 import {stationinfo} from "@/api/station/gun";
-
+import { listPrice } from "@/api/station/price";
 export default {
   name: "Rule",
   data() {
@@ -299,23 +86,11 @@ export default {
       showSearch: true,
       // 弹出层标题
       title: "",
-      uploadUrl:"",
-      stationOptions:[],
-      oilNameOptions:[],
-      ruleTypeOptions:[],
-      termDateManageOptions:[],
-      expirationOptions:[],
-      integralDeductionOilOptions:[],
-      integralActivityOptions:[],
-      gradeOptions:[],
-      imgInfoList: [], //包含图片的id,name,size的集合
-      imgNameList: [], //后端返回的上传图片的name集合,传到后端
-      imgSize: [], //后端返回的上传图片的imgSize集合,传到后端
-      deleteImgFileList: [], //存已被删除了的图片的id
-      dialogImageUrl: '',
-      dialogVisible: false,
+      total:0,
       // 是否显示弹出层
       open: false,
+      oilNameOptions:[],
+      ruleList:[],
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -325,6 +100,7 @@ export default {
         ruleType: null,
         oilName: null
       },
+      queryInfo:{},
       // 表单参数
       form: {
         itemsDetail: [{}],
@@ -338,6 +114,16 @@ export default {
   },
   created() {
     this.getList();
+    // this.getDicts("oil_name").then(response => {
+    //   this.oilNameOptions = response.data;
+    // });
+    this.queryInfo.stationId=this.$store.selectDeptId;
+    if(this.queryInfo.stationId==null || this.queryParams.stationId==""){
+      this.queryInfo.stationId =this.$store.state.user.deptId;
+    }
+    listPrice(this.queryInfo).then(response => {
+      this.oilNameOptions = response.rows;
+    });
     stationinfo().then(response => {
       this.stationOptions = response.rows;
     });
@@ -356,42 +142,45 @@ export default {
     this.getDicts("integral_manage").then(response => {
       this.integralActivityOptions = response.data;
     });
+        
   },
   methods: {
     /** 查询列表 */
     getList() {
       this.loading = true;
-      listRule(this.queryParams).then(response => {
+      this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
+      //积分规则信息
+      listRuleInfo(this.queryParams).then(response => {
         this.ruleList = response.rows;
         this.total = response.total;
         this.loading = false;
       });
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        stationId: null,
-        stationName: null,
-        ruleType: null,
-        ruleAmt: null,
-        gread: null,
-        oilName: null,
-        saleAmt: null,
-        integral: null,
-        termDateManage: null,
-        emptyDate: null,
-        expirationReminder: null,
-        remindDate: null,
-        integralActivity: null,
-        datePicker: null,
-        integralProportion: null,
-        integralDeductionOil: null,
-        itemsDetail: [{}],
-        notOilList: [{}],
-        imgFileList:[]
-      };
-      this.resetForm("form");
+    termDateManageFormat(row, column){
+      if(row.termDateManage === '1'){
+        return '不指定结束时间'
+      }else if(row.termDateManage === '2'){
+        return '指定结束时间'
+      }
+    },
+    integralActivityFormat(row, column){
+      if(row.integralActivity === '1'){
+        return '开启'
+      }else if(row.integralActivity === '2'){
+        return '关闭'
+      }
+    },
+    datePickerFormat(row, column){
+      if(row.datePicker === '1'){
+        return '每周指定日'
+      }else if(row.datePicker === '2'){
+        return '每月指定日'
+      }else if(row.datePicker === '3'){
+        return '固定活动日'
+      }
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -403,86 +192,12 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
       this.open = true;
       this.title = "添加";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getRule(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改";
-      });
-      this.queryParams.stationId =row.stationId;
-      oilNameList(this.queryParams).then(response => {
-        this.oilNameOptions = response.rows;
-      });
-    },
-    onInstitutionChang(e){
-      let obj = {};
-      obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.deptId === e;//筛选出匹配数据
-      })
-      this.form.stationName=obj.deptName;
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateRule(this.form).then(response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addRule(this.form).then(response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$confirm('是否确认删除编号为"' + ids + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delRule(ids);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        })
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      const queryParams = this.queryParams;
-      this.$confirm('是否确认导出所有数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return exportRule(queryParams);
-        }).then(response => {
-          this.download(response.msg);
-        })
-    }
+    },  
   }
 };
 </script>

+ 36 - 13
src/views/integral/rule/index1.vue

@@ -28,16 +28,20 @@
           <span>{{ parseTime(scope.row.emptyDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="到期提醒设置" align="center" prop="expirationReminder" :formatter="expirationReminderFormat" />
-      <el-table-column label="提醒时间设置" align="center" prop="remindDate" width="180">
+      <el-table-column label="到期提醒设置" align="center" prop="expirationReminder"  v-if="false" :formatter="expirationReminderFormat" />
+      <el-table-column label="提醒时间设置" align="center" prop="remindDate" width="180" v-if="false">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.remindDate, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
       <el-table-column label="积分活动设置" align="center" prop="integralActivity" :formatter="activityFormat" />
-      <el-table-column label="日期选择" align="center" prop="datePicker" />
-      <el-table-column label="积分比例" align="center" prop="integralProportion" />
-      <el-table-column label="积分抵扣油品规则" align="center" prop="integralDeductionOil" :formatter="integralDeductionOilFormat" />
+      <el-table-column label="日期选择" align="center" prop="datePicker" :formatter="datePickerFormat"/>
+      <el-table-column label="积分比例" align="center" prop="integralProportion" >
+        <template slot-scope="scope1">
+          <span>{{ scope1.row.integralProportion}}倍</span>
+        </template>
+      </el-table-column>
+      <!-- <el-table-column label="积分抵扣油品规则" align="center" prop="integralDeductionOil" :formatter="integralDeductionOilFormat" /> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -46,7 +50,7 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['integral:rule:edit']"
-          >修改</el-button>
+          >积分规则明细</el-button>
           <el-button
             size="mini"
             type="text"
@@ -70,6 +74,7 @@
 <script>
 import { listRule, delRule, addRule, updateRule, exportRule } from "@/api/integral/rule";
 import {stationinfo} from "@/api/station/gun";
+import { getDept } from "@/api/system/dept";
 export default {
   name: "Rule",
   data() {
@@ -102,6 +107,8 @@ export default {
         stationName: null,
         oilName: null
       },
+      deptId:null,
+      deptInfo:{},
       // 表单参数
       form: {
         itemsDetail: [{}]
@@ -121,11 +128,13 @@ export default {
     });
   },
   methods: {
-    integralDeductionOilFormat(row, column){
-      if(row.integralDeductionOil === '1'){
-        return '不可抵扣'
-      }else if(row.integralDeductionOil === '2'){
-        return '可抵扣'
+    datePickerFormat(row, column){
+      if(row.datePicker === '1'){
+        return '每周指定日'
+      }else if(row.datePicker === '2'){
+        return '每月指定日'
+      }else if(row.datePicker === '3'){
+        return '固定活动日'
       }
     },
     activityFormat(row, column){
@@ -144,13 +153,16 @@ export default {
       if(row.termDateManage === '1'){
         return '永久有效'
       }else if(row.termDateManage === '2'){
-        return '自定义时间'
+        return '指定结束日期'
       }
     },
     /** 查询规则设置列表 */
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listRule(this.queryParams).then(response => {
         this.ruleList = response.rows;
         this.total = response.total;
@@ -193,7 +205,18 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.$router.push({path:'/integral/ruledetail',query:{stationId:"",parentId:""}});
+      this.deptId=this.$store.selectDeptId;
+      if(this.deptId==null || this.deptId==""){
+        this.deptId =this.$store.state.user.deptId;
+      }
+      getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+             this.$router.push({path:'/integral/ruledetail',query:{stationId:"",parentId:""}});
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+      });
     },
     /** 修改按钮操作 */
     handleUpdate(row) {

+ 307 - 129
src/views/integral/ruledetail/index.vue

@@ -1,24 +1,14 @@
 <template>
   <div class="app-container">
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-      <el-form-item label="油站名称" prop="stationId" >
-        <el-select
-          v-model="form.stationId"
-          placeholder="请选择油站"
-          clearable
-          size="small"
-          @change="onInstitutionChang"
-        >
-          <el-option
-            v-for="item in stationOptions"
-            :key="item.deptId"
-            :label="item.deptName"
-            :value="item.deptId"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item v-show="false" label="油站名称" prop="stationName">
-        <el-input v-model="form.stationName"  placeholder="请输入油站名称" />
+      <el-form-item label="是否开启积分规则功能"  label-width="160px">
+        <el-radio-group v-model="ruleForm.integralFlag">
+          <el-radio
+            v-for="dict in integralFlagOptions"
+            :key="dict.dictValue"
+            :label="dict.dictValue"
+          >{{dict.dictLabel}}</el-radio>
+        </el-radio-group>
       </el-form-item>
       <el-form-item  label="油品积分规则" ></el-form-item>
       <div>
@@ -33,7 +23,7 @@
           >
             <el-form-item>
               <span>规则类型</span>
-              <el-select v-model="item.ruleType" placeholder="请选择规则" clearable size="small"  >
+              <el-select v-model="item.ruleType" placeholder="请选择规则" clearable size="small">
                 <el-option
                   v-for="item in ruleTypeOptions"
                   :key="item.dictValue"
@@ -61,7 +51,7 @@
                 size="small"
               >
                 <el-option
-                  v-for="item in gradeOptions"
+                  v-for="item in gradeOptions[index]"
                   :key="item.grade"
                   :label="item.grade"
                   :value="item.grade"
@@ -69,7 +59,8 @@
               </el-select>
               <span>每消费</span>
               <el-input-number v-model="item.saleAmt"  size="small" :min="0"/>
-              <span>元</span>
+              <span v-if="item.ruleType=='3'">L</span>
+              <span v-else>元</span>
               <el-input-number v-model="item.integral" size="small" :min="0"/>
               <span>积分</span>
             </el-form-item>
@@ -80,8 +71,9 @@
                 size="small"
               >删除</el-button>
               <el-button
+                v-show="index==rowsnum"
                 type="success"
-                @click="addItem"
+                @click="addItem()"
                 size="small"
               >新增</el-button>
             </el-form-item>
@@ -110,40 +102,45 @@
               <el-input-number v-model="item.integral" size="small" :min="0"/>
               <span>积分</span>
             </el-form-item>
+            <el-button
+                type="danger"
+                @click="delNoil()"
+                size="small"
+              >清空非油品积分规则</el-button>
           </el-form>
         </el-row>
       </div>
-      <el-form-item label="有效期设置" prop="termDateManage">
-        <el-radio-group v-model="form.termDateManage">
+       <el-form-item label="积分有效期设置" prop="termDateManage">
+        <el-radio-group v-model="form.integralTermSetting">
           <el-radio
-            v-for="dict in termDateManageOptions"
+            v-for="dict in integralTermSettingOptions"
             :key="dict.dictValue"
             :label="dict.dictValue"
           >{{dict.dictLabel}}</el-radio>
         </el-radio-group>
         <el-date-picker clearable size="small" style="width: 200px;margin-left: 10px;"
-                        v-model="form.emptyDate"
-                        type="date"
-                        value-format="yyyy-MM-dd">
+                        v-model="form.integralEmptyTime"
+                        type="datetime">
         </el-date-picker>
       </el-form-item>
-      <el-form-item label=  "到期提醒设置" prop="expirationReminder">
-        <el-radio-group v-model="form.expirationReminder">
+    
+      <el-form-item label="积分活动时限" prop="termDateManage">
+        <el-radio-group v-model="form.termDateManage">
           <el-radio
-            v-for="dict in expirationOptions"
+            v-for="dict in termDateManageOptions"
             :key="dict.dictValue"
             :label="dict.dictValue"
           >{{dict.dictLabel}}</el-radio>
         </el-radio-group>
-        <el-date-picker clearable size="small" style="margin-left: 10px;width: 200px"
-                        v-model="form.remindDate"
+        <el-date-picker clearable size="small" style="width: 200px;margin-left: 10px;"
+                        v-model="form.emptyDate"
                         type="date"
-                        value-format="yyyy-MM-dd"
-                        placeholder="选择提醒时间设置">
+                        value-format="yyyy-MM-dd">
         </el-date-picker>
       </el-form-item>
+    
       <el-form-item label="积分活动设置" ></el-form-item>
-      <el-form-item >
+      <el-form-item label="多倍积分活动">
         <el-radio-group v-model="form.integralActivity">
           <el-radio
             v-for="dict in integralActivityOptions"
@@ -154,7 +151,7 @@
       </el-form-item>
       <el-row>
         <el-col :span="8" style="">
-          <el-form-item  label="日期选择" prop="datePicker">
+          <el-form-item  label="周期类型" prop="datePicker">
             <el-select v-model="form.datePicker" 
              clearable size="small" @change="datePickerChang" >
                 <el-option
@@ -200,19 +197,11 @@
         </el-col>
         <el-col :span="8">
           <el-form-item  label="积分比例" prop="integralProportion">
-            <el-input-number v-model="form.integralProportion" :min="1" placeholder="请输入加倍比例" />
+            <el-input-number v-model="form.integralProportion" style="width:130px;" :min="1" placeholder="请输入加倍比例" />
+            <span>倍</span>
           </el-form-item>
         </el-col>
       </el-row>
-      <el-form-item label="抵扣油品规则" prop="integralDeductionOil">
-        <el-radio-group v-model="form.integralDeductionOil">
-          <el-radio
-            v-for="dict in integralDeductionOilOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
-        </el-radio-group>
-      </el-form-item>
       <el-form-item label="积分轮播图">
         <el-upload
           class="avatar-uploader"
@@ -235,16 +224,16 @@
       </el-form-item>
     </el-form>
     <div slot="footer" class="dialog-footer"> 
-      <el-button type="primary" @click="submitForm">确 定</el-button>
-      <el-button @click="cancel">取 消</el-button>
+      <el-button type="primary" @click="submitForm" :disabled="flage" >确 定</el-button>
     </div>
   </div>
 </template>
 
 <script>
 import { getToken } from "@/utils/auth";
-import { stationinfo} from "@/api/station/gun";
-import {  addRule, updateRule,oilNameList,gradeList,getRule } from "@/api/integral/rule";
+import {  addRule, updateRule,oilNameInfo,gradeList,getRule,listRuleOne} from "@/api/integral/rule";
+import { getDept } from "@/api/system/dept";
+import {getStationPay,updatePay} from "@/api/station/pay";
 export default {
 name: "ruleDetail",
   data() {
@@ -258,13 +247,14 @@ name: "ruleDetail",
       // 弹出层标题
       title: "",
       uploadUrl:"",
-      stationOptions:[],
+      // stationOptions:[],
       oilNameOptions:[],
       ruleTypeOptions:[],
       termDateManageOptions:[],
       expirationOptions:[],
       integralDeductionOilOptions:[],
       integralActivityOptions:[],
+      integralTermSettingOptions:[],
       datePickerOptions:[],
       gradeOptions:[],
       imgInfoList: [], //包含图片的id,name,size的集合
@@ -272,6 +262,12 @@ name: "ruleDetail",
       imgSize: [], //后端返回的上传图片的imgSize集合,传到后端
       deleteImgFileList: [], //存已被删除了的图片的id
       dialogImageUrl: '',
+      integralFlagOptions:[],
+      ruleForm:{
+        imgFileList:[]
+      },
+      flage:false,
+      num :0,
       pickerTime:"",
       dialogVisible: false,
       // 是否显示弹出层
@@ -288,13 +284,19 @@ name: "ruleDetail",
         ruleType: null,
         oilName: null
       },
+      rowsnum:0,
       // 表单参数
       form: {
         itemsDetail: [{}],
         notOilList: [{}],
         imgFileList:[]
       },
-       query:{
+      queryRule:{
+          stationId: null
+        },
+      deptId:null,
+      deptInfo:{},
+      query:{
         deptId: null
       },
       // 表单校验
@@ -311,39 +313,8 @@ name: "ruleDetail",
     };
   },
   created() {
-    //判断是否是做修改
-    if(this.$route.query.stationId!=null && this.$route.query.stationId!="" && this.$route.query.parentId !=null &&this.$route.query.parentId !=""){
-      this.queryParams.stationId=this.$route.query.stationId;
-      let id=this.$route.query.parentId;
-      if(id!=null && id != ""){
-        getRule(id).then(response => {
-          this.form = response.data;
-          if(this.form.notOilList.length==0 ){
-            this.form.notOilList=[{}];
-          }
-          if(this.form.itemsDetail.length==0 ){
-            this.form.itemsDetail=[{}];
-          }
-          let datepicker = this.form.datePicker;
-          if(datepicker=="1"){
-            this.workDaytrue=true;
-            this.collectClickWorkDay= this.form.datePickerTime.split(',').map(parseFloat);
-          }else if(datepicker=="2"){
-            this.moonDaytrue=true;
-            this.collectClickCalendar= this.form.datePickerTime.split(',').map(parseFloat);
-          }else{
-            this.datetrue=true;
-            this.pickerTime = this.form.datePickerTime.split(',');
-          }
-        });
-        oilNameList(this.queryParams).then(response => {
-          this.oilNameOptions = response.rows;
-        });
-      }
-    }
-    this.query.deptId =this.$store.selectDeptId;
-    stationinfo(this.query).then(response => {
-      this.stationOptions = response.rows;
+    this.getDicts("status").then(response => {
+      this.integralFlagOptions = response.data;
     });
     this.getDicts("rule_type").then(response => {
       this.ruleTypeOptions = response.data;
@@ -351,21 +322,100 @@ name: "ruleDetail",
     this.getDicts("term_date").then(response => {
       this.termDateManageOptions = response.data;
     });
-    this.getDicts("expiration").then(response => {
-      this.expirationOptions = response.data;
-    });
-    this.getDicts("integral_deduction_oil").then(response => {
-      this.integralDeductionOilOptions = response.data;
-    });
+    
     this.getDicts("integral_manage").then(response => {
       this.integralActivityOptions = response.data;
     });
+    this.getDicts("integral_term_setting").then(response => {
+      this.integralTermSettingOptions = response.data;
+    });
     this.getDicts("date_picker").then(response => {
       this.datePickerOptions = response.data;
     });
-    
+    this.deptId=this.$store.selectDeptId;
+    if(this.deptId==null || this.deptId==""){
+      this.deptId =this.$store.state.user.deptId;
+    }
+    getDept(this.deptId).then(response => {
+        this.deptInfo = response.data;
+        if(this.deptInfo.jiBie==2){
+          this.form.stationId=this.deptInfo.deptId;
+          this.form.stationName=this.deptInfo.deptName;
+          this.queryParams.stationId=this.deptInfo.deptId;
+          listRuleOne(this.queryParams).then(response => {
+            if(response.hasOwnProperty('data')){
+              this.form = response.data;
+              if(response.data.hasOwnProperty('notOilList')){
+                if(this.form.notOilList.length==0){
+                   this.form.notOilList=[{}];
+                }
+              }else{
+                  this.form.notOilList=[{}];
+              }
+              if(response.data.hasOwnProperty('itemsDetail')  ){
+                if(this.form.itemsDetail.length==0){
+                   this.form.itemsDetail=[{}];
+                }else{
+                  let itemDetail = this.form.itemsDetail;
+                  this.sjfa(itemDetail);
+                  this.rowsnum= this.form.itemsDetail.length-1;
+                }
+              }else{
+                this.form.itemsDetail=[{}];
+              }
+              let datepicker = this.form.datePicker;
+              if(datepicker=="1"){
+                this.workDaytrue=true;
+                if(this.form.datePickerTime!=null){
+                  this.collectClickWorkDay= this.form.datePickerTime.split(',').map(parseFloat);
+                }
+              }else if(datepicker=="2"){
+                this.moonDaytrue=true;
+                if(this.form.datePickerTime!=null){
+                  this.collectClickCalendar= this.form.datePickerTime.split(',').map(parseFloat);
+                }
+              }else{
+                this.datetrue=true;
+                if(this.form.datePickerTime!=null){
+                  this.pickerTime= this.form.datePickerTime.split(',');
+                }else{
+                  this.pickerTime=null;
+                }
+              }
+            }
+          });
+          oilNameInfo(this.queryParams).then(response => {
+            this.oilNameOptions = response.rows;
+          });
+        }else{
+            this.msgSuccess("请选择油站");
+        }
+    });
+//查看当前积分设置
+    this.queryRule.stationId= this.$store.selectDeptId;
+    if(this.queryRule.stationId==null || this.queryRule.stationId==""){
+      this.queryRule.stationId =this.$store.state.user.deptId;
+    }
+    getStationPay(this.queryRule).then(response => {
+      this.ruleForm = response.data;
+      if(this.ruleForm.integralFlag == ""){
+        this.ruleForm.integralFlag ="0";
+      }
+    });
   },
   methods: {
+    async sjfa(itemDetail ){
+      for(let j = 0; j < itemDetail.length; j++) {
+        this.queryParams.stationId = this.form.stationId;
+        this.queryParams.oilName = itemDetail[j].oilName;
+        if(itemDetail[j].gread ===""){
+            itemDetail[j].gread = "所有人";
+        }
+        const response = await gradeList(this.queryParams);
+        response.rows.push({grade:"所有人"});
+        this.gradeOptions.push(response.rows);
+      }
+    },
     //添加行
     addItem() {
       this.form.itemsDetail.push({
@@ -376,10 +426,18 @@ name: "ruleDetail",
         integral: '',
         ruleType: ''
       });
+      this.rowsnum=this.form.itemsDetail.length-1;
     },
     // 删除行
     del(index) {
       this.form.itemsDetail.splice(index, 1);
+      this.rowsnum=this.form.itemsDetail.length-1;
+      if(this.form.itemsDetail.length<=0){
+         this.addItem();
+      }
+    },
+    delNoil(){
+      this.form.notOilList =[{}];
     },
     queryreset() {
       this.queryParams={
@@ -388,10 +446,6 @@ name: "ruleDetail",
         oilName: null
       }
     },
-    changeGread(e){
-      //获取等级名称和id
-      console.log(e);
-    },
     onInstitutionChang(){
       let obj = {};
       obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
@@ -400,26 +454,24 @@ name: "ruleDetail",
       this.queryreset();
       this.form.stationName=obj.deptName;
       this.queryParams.stationId=obj.deptId;
-      oilNameList(this.queryParams).then(response => {
+      oilNameInfo(this.queryParams).then(response => {
         this.oilNameOptions = response.rows;
       });
     },
-    oilNameChang(e){
+    oilNameChang(index){
       let obj = {};
-      console.log("oilNameOptions:",this.oilNameOptions);
-        console.log("e:",this.form.itemsDetail[e].oilName);
       obj = this.oilNameOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.oilName === this.form.itemsDetail[e].oilName;//筛选出匹配数据
+        return item.oilName === this.form.itemsDetail[index].oilName;//筛选出匹配数据
       })
       this.queryreset();
       //获取油站名称
       this.queryParams.stationId = this.form.stationId;
       this.queryParams.oilName=obj.oilName;
-      console.log("stationId", this.form.stationId);
-      console.log("oilname",obj.oilName);
       gradeList(this.queryParams).then(response => {
-        this.gradeOptions = response.rows;
-          console.log("gradeOptions", this.gradeOptions );
+        const temp = [...this.gradeOptions]
+        response.rows.push({grade:"所有人"});
+        temp[index] = response.rows;
+        this.gradeOptions = temp;
       });
     },
     handlePictureCardPreview(file) {
@@ -460,42 +512,169 @@ name: "ruleDetail",
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
-            if(this.form.notOilList!=null&&this.form.notOilList.length>0||this.form.notOilList[0].hasOwnProperty(saleAmt)){
-              if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
-                this.form.notOilList=[];
+            if(this.form.notOilList!=null&&this.form.notOilList.length==0 ){
+            }else{
+               if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
+                this.form.notOilList=[{}];
               }
             }
             let datepicker = this.form.datePicker;
             if(datepicker=="1"){
-              this.form.datePickerTime=this.collectClickWorkDay.toString();
+              if(this.collectClickWorkDay!=null&&this.collectClickWorkDay.length>0){
+                let discountTime=null;
+                for(let i =0;i<this.collectClickWorkDay.length;i++){
+                  if(!isNaN(this.collectClickWorkDay[i]) && this.collectClickWorkDay[i]!="NaN"){
+                    if( discountTime!=null){
+                      discountTime =discountTime+","+this.collectClickWorkDay[i];
+                    }else{
+                      discountTime =this.collectClickWorkDay[i];
+                    }
+                  }else{
+                    discountTime =discountTime;
+                  }
+                }
+                this.form.datePickerTime=discountTime; 
+                discountTime=null;
+              }else{
+                  this.form.datePickerTime=""; 
+              }  
             }else if(datepicker=="2"){
-              this.form.datePickerTime=this.collectClickCalendar.toString();
+              if(this.collectClickCalendar!=null&&this.collectClickCalendar.length>0){
+                let discountTime=null;
+                for(let i =0;i<this.collectClickCalendar.length;i++){
+                  if(!isNaN(this.collectClickCalendar[i]) && this.collectClickCalendar[i]!="NaN"){
+                    if( discountTime!=null){
+                      discountTime =discountTime+","+this.collectClickCalendar[i];
+                    }else{
+                      discountTime =this.collectClickCalendar[i];
+                    }
+                  }else{
+                    discountTime =discountTime;
+                  }
+                }
+                this.form.datePickerTime=discountTime; 
+                discountTime=null;
+              } else{
+                  this.form.datePickerTime=""; 
+              }
             }else{
-              this.form.datePickerTime = this.pickerTime.toString();
+              if(this.pickerTime!=null){
+                  this.form.datePickerTime = this.pickerTime.toString();
+              }else{
+                this.form.datePickerTime = "";
+              }
             }
-            updateRule(this.form).then(response => {
-              this.msgSuccess("修改成功");
-            });
-          } else {
-            let datepicker = this.form.datePicker;
-            if(datepicker=="1"){
-              this.form.datePickerTime=this.collectClickWorkDay.toString();
-            }else if(datepicker=="2"){
-              this.form.datePickerTime=this.collectClickCalendar.toString();
+            let itemsDetail =this.form.itemsDetail;
+            let flag= true;
+            if(itemsDetail!=null&&itemsDetail.length>1){
+              for (var i = 0; i < itemsDetail.length; i++) {
+                  for (var j = i + 1; j < itemsDetail.length; j++) {
+                    if (itemsDetail[i].oilName == itemsDetail[j].oilName) { 
+                      if(itemsDetail[i].gread==itemsDetail[j].gread){
+                        flag=false;
+                        break;
+                      }else if(itemsDetail[i].gread!=itemsDetail[j].gread){
+                        if(itemsDetail[i].gread=="所有人"){
+                          flag=false;
+                          break;
+                        }else if(itemsDetail[j].gread=="所有人"){
+                          flag=false;
+                          break;
+                        }
+                      }
+                    }
+                  }
+                  if (!flag){
+                    break;  
+                  } 
+              }
+            }
+            if(flag){
+              updateRule(this.form).then(response => {
+                this.msgSuccess("修改成功");
+              });
             }else{
-              this.form.datePickerTime = this.pickerTime.toString();
+               this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
             }
-            if(this.form.notOilList!=null&&this.form.notOilList.length>0||this.form.notOilList[0].hasOwnProperty(saleAmt)){
-              if(this.form.notOilList[0].saleAmt==""||this.form.notOilList[0].saleAmt=="0" ||this.form.notOilList[0].saleAmt=="undefined"){
-                this.form.notOilList=[];
+          } else {
+            if(this.num===0){
+                let datepicker = this.form.datePicker;
+              if(datepicker=="1"){
+                if(this.collectClickWorkDay!=null&&this.collectClickWorkDay.length>0){
+                  let discountTime=null;
+                  for(let i =0;i<this.collectClickWorkDay.length;i++){
+                    if(!isNaN(this.collectClickWorkDay[i]) && this.collectClickWorkDay[i]!="NaN"){
+                      if( discountTime!=null){
+                        discountTime =discountTime+","+this.collectClickWorkDay[i];
+                      }else{
+                        discountTime =this.collectClickWorkDay[i];
+                      }
+                    }else{
+                      discountTime =discountTime;
+                    }
+                  }
+                  this.form.datePickerTime=discountTime; 
+                  discountTime=null;
+                }else{
+                    this.form.datePickerTime=""; 
+                }  
+              }else if(datepicker=="2"){
+                if(this.collectClickCalendar!=null&&this.collectClickCalendar.length>0){
+                  let discountTime=null;
+                  for(let i =0;i<this.collectClickCalendar.length;i++){
+                    if(!isNaN(this.collectClickCalendar[i]) && this.collectClickCalendar[i]!="NaN"){
+                      if( discountTime!=null){
+                        discountTime =discountTime+","+this.collectClickCalendar[i];
+                      }else{
+                        discountTime =this.collectClickCalendar[i];
+                      }
+                    }else{
+                      discountTime =discountTime;
+                    }
+                  }
+                  this.form.datePickerTime=discountTime; 
+                  discountTime=null;
+                } else{
+                    this.form.datePickerTime=""; 
+                }
+              }else{
+                if(this.pickerTime!=null){
+                    this.form.datePickerTime = this.pickerTime.toString();
+                }else{
+                  this.form.datePickerTime = "";
+                }
               }
+              let itemsDetail =this.form.itemsDetail;
+              let flag= true;
+              if(itemsDetail!=null&&itemsDetail.length>0){
+                for (var i = 0; i < itemsDetail.length; i++) {
+                    for (var j = i + 1; j < itemsDetail.length; j++) {
+                      if (itemsDetail[i].ruleType == itemsDetail[j].ruleType &&itemsDetail[i].oilName == itemsDetail[j].oilName&& itemsDetail[i].gread==itemsDetail[j].gread) { 
+                        flag=false;
+                        break;
+                      }
+                    }
+                    if (flag) break;
+                }
+              }
+              if(flag){
+                addRule(this.form).then(response => {
+                  this.msgSuccess("新增成功");
+                });
+              }else{
+                this.msgSuccess("添加的规则明细有重复的,请再次确实积分规则");
+              }
+              this.num=this.num+1;
+            }else{
+                this.msgSuccess("已新增成功!如需修改请刷新页面");
             }
-            addRule(this.form).then(response => {
-              this.msgSuccess("新增成功");
-            });
           }
         }
       });
+      if (this.ruleForm.payId != null) {
+        updatePay(this.ruleForm).then(response => {
+        });
+      }  
     },
     // 取消按钮
     cancel() {
@@ -554,7 +733,6 @@ name: "ruleDetail",
       } else if (this.collectClickWorkDay.indexOf(index) > -1) {
         this.deleteWorkDayFromArr(index)
       }
-      console.log('当前收集的下标:', this.collectClickWorkDay)
     },
     datePickerChang(){
       if(this.form.datePicker == "1"){

+ 29 - 59
src/views/integral/wares/index.vue

@@ -13,8 +13,8 @@
 
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
+        <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
       </el-form-item>
     </el-form>
 
@@ -57,13 +57,6 @@
             @click="handleUpdate(scope.row)"
             v-hasPermi="['integral:wares:edit']"
           >修改</el-button>
-          <!-- <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['integral:wares:remove']"
-          >删除</el-button> -->
         </template>
       </el-table-column>
     </el-table>
@@ -80,7 +73,6 @@
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="商品图片" prop="waresPic">
-<!--          <el-input v-model="form.waresPic" placeholder="请输入商品图片" />-->
           <el-upload
             class="avatar-uploader"
             :action="addressUrl"
@@ -90,36 +82,18 @@
             :before-upload="beforeAvatarUpload">
             <img v-if="form.waresPic" :src="form.waresPic" style="width:150px;height: 150px;" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+            <div class="el-upload__tip" slot="tip">点击图片重新上传,只能上传jpg/png文件,图片大小不超过2M</div>
           </el-upload>
         </el-form-item>
         <el-form-item label="商品名称" prop="waresName">
           <el-input v-model="form.waresName" placeholder="请输入商品名称" />
         </el-form-item>
         <el-form-item label="商品详情" prop="waresDetail">
-          <el-input v-model="form.waresDetail" placeholder="请输入商品详情" />
+          <textarea v-model="form.waresDetail" placeholder="请输入商品详情" rows="4" cols="50"></textarea>
         </el-form-item>
         <el-form-item label="消费积分" prop="saleIntegral">
           <el-input-number v-model="form.saleIntegral" :min="0" placeholder="请输入消费积分" />
         </el-form-item>
-        <el-form-item label="油站名称" prop="stationId" >
-          <el-select
-            v-model="form.stationId"
-            placeholder="请选择油站"
-            clearable
-            size="small"
-            @change="onInstitutionChang"
-          >
-            <el-option
-              v-for="item in stationOptions"
-              :key="item.deptId"
-              :label="item.deptName"
-              :value="item.deptId"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="油站名称" v-show="false" prop="stationName">
-          <el-input v-model="form.stationName" placeholder="请输入油站名称" />
-        </el-form-item>
         <el-form-item label="库存"  prop="waresCount">
           <el-input-number v-model="form.waresCount" :min="0" placeholder="请输入库存数量" />
         </el-form-item>
@@ -135,8 +109,7 @@
 <script>
 import { listWares, getWares, delWares, addWares, updateWares, exportWares } from "@/api/integral/wares";
 import {getToken} from "@/utils/auth";
-import {stationinfo} from "@/api/station/gun";
-
+import { getDept } from "@/api/system/dept";
 export default {
   name: "Wares",
   data() {
@@ -174,6 +147,8 @@ export default {
         updateName: null,
         stationId: null
       },
+      deptInfo:{},
+      deptId: null,
       // 表单参数
       form: {},
       // 表单校验
@@ -186,9 +161,7 @@ export default {
   },
   created() {
     this.getList();
-    stationinfo().then(response => {
-      this.stationOptions = response.rows;
-    });
+    
   },
   methods: {
     waresStatusFotmat(row, column) {
@@ -198,17 +171,14 @@ export default {
         return '已下架'
       }
     },
-    onInstitutionChang(e){
-      let obj = {};
-      obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
-        return item.deptId === e;//筛选出匹配数据
-      })
-      this.form.stationName=obj.deptName;
-    },
+   
     /** 查询【请填写功能名称】列表 */
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+     if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listWares(this.queryParams).then(response => {
         this.waresList = response.rows;
         this.total = response.total;
@@ -261,8 +231,21 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.title = "添加商品信息";
+      this.deptId=this.$store.selectDeptId;
+      if(this.deptId==null || this.deptId==""){
+        this.deptId =this.$store.state.user.deptId;
+      }
+      getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+            this.open = true;
+            this.title = "添加商品信息";
+            this.form.stationId=this.deptInfo.deptId;
+            this.form.stationName=this.deptInfo.deptName;
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+      });
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -310,20 +293,7 @@ export default {
         }
       });
     },
-    // /** 删除按钮操作 */
-    // handleDelete(row) {
-    //   const ids = row.id || this.ids;
-    //   this.$confirm('是否确认删除商品编号为"' + ids + '"的数据项?', "警告", {
-    //       confirmButtonText: "确定",
-    //       cancelButtonText: "取消",
-    //       type: "warning"
-    //     }).then(function() {
-    //       return delWares(ids);
-    //     }).then(() => {
-    //       this.getList();
-    //       this.msgSuccess("删除成功");
-    //     })
-    // },
+    
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;
@@ -343,7 +313,7 @@ export default {
       this.form.waresPic = imgurl;
     },
     beforeAvatarUpload(file) {
-      const isJPG = file.type === 'image/jpeg';
+      const isJPG = file.type === 'image/jpeg'|| 'image/png';
       const isLt2M = file.size / 1024 / 1024 < 2;
       if (!isJPG) {
         this.$message.error('上传头像图片只能是 JPG 格式!');

+ 2 - 2
src/views/login.vue

@@ -65,8 +65,8 @@ export default {
       codeUrl: "",
       cookiePassword: "",
       loginForm: {
-        username: "admin",
-        password: "admin123",
+        username: "",
+        password: "",
         rememberMe: false,
         code: "",
         uuid: ""

+ 249 - 106
src/views/market/plan/index.vue

@@ -1,12 +1,34 @@
 <template>
   <div class="app-container">
-    <el-form :model="zjParams" ref="zjParams" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="130px">
+      <el-form-item label="当前执行优惠方案" >
+        <el-input v-model="fangan" :disabled="true" style="width:200px;"/>
+      </el-form-item>
+      <el-form-item label="优惠方案" >
+        <el-select
+          v-model="ruleForm.discountSetting"
+          placeholder="请选择优惠方案"
+          clearable
+          size="small"
+          @change="discountSettingChang"
+        >
+          <el-option
+            v-for="item in discountSettingOptions"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          ></el-option>
+        </el-select>
+        <el-button  size="mini" @click="save"  type="primary">确定执行该优惠方案</el-button>
+      </el-form-item>
+    </el-form>  
+    <el-form :model="zjParams" ref="zjParams" :inline="true" v-show="showZJ" label-width="68px">
       <div>
         <span  style="color:#ff9955;font-size:25px;" >|</span><span style="font-size:25px;">直降方案</span>
         <el-button icon="el-icon-plus" size="mini" @click="handleAddZJ" style="float:right" type="warning" v-hasPermi="['market:plan:add']" >添加直降信息</el-button>
       </div>
     </el-form>
-    <el-table v-loading="loading" :data="ZJplanList" >
+    <el-table v-loading="loading" :data="ZJplanList"  v-show="showZJ">
       <el-table-column label="id" align="center" prop="id" v-if="false" />
       <el-table-column label="方案名称" align="center" prop="grade" />
       <el-table-column label="油品名称" align="center" prop="oilName" />
@@ -14,7 +36,7 @@
       <el-table-column label="优惠条件" align="center" :formatter="planFormat"/>
       <el-table-column label="优惠条件金额" v-if="false" align="center" prop="discountAmt" />
       <el-table-column label="优惠金额" v-if="false"  align="center" prop="gasoilDiscountAmt" />
-      <el-table-column label="会员优惠是否叠加" align="center" prop="vipDiscountyPlus" :formatter="vipDiscountyPlusFotmat" />
+      <el-table-column label="等级优惠是否叠加" align="center" prop="vipDiscountyPlus" :formatter="vipDiscountyPlusFotmat" />
       <el-table-column label="可否叠加劵" align="center" prop="couponPlus" :formatter="couponPlusFotmat"
       />
       <el-table-column label="优惠方案类型" v-if="false" align="center" prop="discountPlanType" />
@@ -42,32 +64,13 @@
         <el-form-item label="方案名称" prop="grade">
           <el-input v-model="zjform.grade" placeholder="请输入方案名称" />
         </el-form-item>
-        <el-form-item label="油站名称" prop="stationId" >
-          <el-select
-            v-model="zjform.stationId"
-            placeholder="请选择油站"
-            clearable
-            size="small"
-            @change="onInstitutionChang"
-          >
-            <el-option
-              v-for="item in stationOptions"
-              :key="item.deptId"
-              :label="item.deptName"
-              :value="item.deptId"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="油站名称" v-show="false" prop="personnelName">
-          <el-input v-model="zjform.stationName" placeholder="请输入油站名称" />
-        </el-form-item>
         <el-form-item label="油品名称" prop="oilName">
           <el-select v-model="zjform.oilName" placeholder="油品名称" clearable size="small">
             <el-option
-              v-for="dict in oilNameOptions"
-              :key="dict.dictLabel"
-              :label="dict.dictLabel"
-              :value="dict.dictLabel"
+              v-for="dict in oilNameOptionsZJ"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
             />
           </el-select>
         </el-form-item>
@@ -88,7 +91,7 @@
             <el-input-number v-model="zjform.gasoilDiscountAmt"   size="mini" :min="0" />元
           </div>
         </el-form-item>
-        <el-form-item label="会员优惠是否叠加" prop="vipDiscountyPlus">
+        <el-form-item label="等级优惠是否叠加" prop="vipDiscountyPlus">
           <el-radio-group v-model="zjform.vipDiscountyPlus">
             <el-radio
               v-for="dict in vipDiscountyPlusOptions"
@@ -96,6 +99,7 @@
               :label="dict.dictValue"
             >{{dict.dictLabel}}</el-radio>
           </el-radio-group>
+           <span style="margin-left:20px;color:red;">注:"否" 客户只享受直降优惠</span>
         </el-form-item>
         <el-form-item label="可否叠加劵" prop="couponPlus">
           <el-radio-group v-model="zjform.couponPlus">
@@ -105,6 +109,7 @@
               :label="dict.dictValue"
             >{{dict.dictLabel}}</el-radio>
           </el-radio-group>
+           <span style="margin-left:20px;color:red;">注:"否" 客户只享受直降优惠</span>
         </el-form-item>
         <el-form-item v-show="false" label="优惠方案类型" prop="discountPlanType">
           <el-select v-model="zjform.discountPlanType" placeholder="请选择优惠方案类型">
@@ -118,13 +123,13 @@
       </div>
     </el-dialog>
     <!--满减方案-->
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showMJ" label-width="68px">
       <div>
         <span  style="color:#ff9955;font-size:25px;" >|</span><span style="font-size:25px;">满减方案</span>
         <el-button icon="el-icon-plus" size="mini" @click="handleAdd" style="float:right" type="warning" v-hasPermi="['market:plan:add']" >添加满减信息</el-button>
       </div>
     </el-form>
-    <el-table v-loading="loading" :data="planList" >
+    <el-table v-loading="loading" :data="planList" v-show="showMJ">
       <el-table-column label="id" align="center" prop="id" v-if="false" />
       <el-table-column label="方案名称" align="center" prop="grade" />
       <el-table-column label="油品名称" align="center" prop="oilName" />
@@ -135,7 +140,7 @@
       </el-table-column>
       <el-table-column label="优惠条件金额" v-if="false" align="center" prop="discountAmt" />
       <el-table-column label="优惠金额" v-if="false"  align="center" prop="gasoilDiscountAmt" />
-      <el-table-column label="会员优惠是否叠加" align="center" prop="vipDiscountyPlus" :formatter="vipDiscountyPlusFotmat" />
+      <el-table-column label="等级优惠是否叠加" align="center" prop="vipDiscountyPlus" :formatter="vipDiscountyPlusFotmat" />
       <el-table-column label="可否叠加劵" align="center" prop="couponPlus" :formatter="couponPlusFotmat"
       />
       <el-table-column label="优惠方案类型" v-if="false" align="center" prop="discountPlanType" />
@@ -164,32 +169,13 @@
         <el-form-item label="方案名称" prop="grade">
           <el-input v-model="form.grade" placeholder="请输入等级名称" />
         </el-form-item>
-        <el-form-item label="油站名称" prop="stationId" >
-          <el-select
-            v-model="form.stationId"
-            placeholder="请选择油站"
-            clearable
-            size="small"
-            @change="onInstitutionChang"
-          >
-            <el-option
-              v-for="item in stationOptions"
-              :key="item.deptId"
-              :label="item.deptName"
-              :value="item.deptId"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="油站名称" v-show="false" prop="personnelName">
-          <el-input v-model="form.stationName" placeholder="请输入油站名称" />
-        </el-form-item>
         <el-form-item label="油品名称" prop="oilName">
           <el-select v-model="form.oilName" placeholder="油品名称" clearable size="small">
             <el-option
               v-for="dict in oilNameOptions"
-              :key="dict.dictLabel"
-              :label="dict.dictLabel"
-              :value="dict.dictLabel"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
             />
           </el-select>
         </el-form-item>
@@ -199,7 +185,7 @@
              元 减
             <el-input-number v-model="form.gasoilDiscountAmt"   size="mini" :min="0" /> 元
         </el-form-item>
-        <el-form-item label="会员优惠是否叠加" prop="vipDiscountyPlus">
+        <el-form-item label="等级优惠是否叠加" prop="vipDiscountyPlus">
           <el-radio-group v-model="form.vipDiscountyPlus">
             <el-radio
               v-for="dict in vipDiscountyPlusOptions"
@@ -207,6 +193,7 @@
               :label="dict.dictValue"
             >{{dict.dictLabel}}</el-radio>
           </el-radio-group>
+          <span style="margin-left:20px;color:red;">注:"否" 客户只享受满减优惠</span>
         </el-form-item>
         <el-form-item label="可否叠加劵" prop="couponPlus">
           <el-radio-group v-model="form.couponPlus">
@@ -216,6 +203,7 @@
               :label="dict.dictValue"
             >{{dict.dictLabel}}</el-radio>
           </el-radio-group>
+           <span style="margin-left:20px;color:red;">注:"否" 客户只享受满减优惠</span>
         </el-form-item>
         <el-form-item v-show="false" label="优惠方案类型" prop="discountPlanType">
           <el-select v-model="form.discountPlanType" placeholder="请选择优惠方案类型">
@@ -229,11 +217,11 @@
       </div>
     </el-dialog>
     <!--立减方案-->
-    <el-form :model="selectParams" ref="selectFrom" :inline="true" v-show="showSearch" label-width="68px" style="margin-top: 25px;">
+    <el-form :model="selectParams" ref="selectFrom" :inline="true" v-show="showLJ" label-width="68px" style="margin-top: 25px;">
       <span  style="color:#ff9955;font-size:25px;" >|</span><span style="font-size:25px;">立减方案</span>
       <el-button icon="el-icon-plus" size="mini" @click="handleAddDT" style="float:right"  type="warning" v-hasPermi="['market:plan:add']" >添加立减方案</el-button>
     </el-form>
-    <el-table v-loading="loading" :data="DTplanList" >
+    <el-table v-loading="loading" :data="DTplanList" v-show="showLJ" >
       <el-table-column label="id" align="center" prop="id" v-if="false" />
       <el-table-column label="方案名称" align="center" prop="grade" />
       <el-table-column label="油品名称" align="center" prop="oilName" />
@@ -244,7 +232,7 @@
       </el-table-column>
       <el-table-column label="优惠条件金额" v-if="false" align="center" prop="discountAmt" />
       <el-table-column label="优惠金额" v-if="false"align="center" prop="gasoilDiscountAmt" />
-      <el-table-column label="会员优惠是否叠加" align="center" prop="vipDiscountyPlus" :formatter="vipDiscountyPlusFotmat" />
+      <el-table-column label="等级优惠是否叠加" align="center" prop="vipDiscountyPlus" :formatter="vipDiscountyPlusFotmat" />
       <el-table-column label="可否叠加劵" align="center" prop="couponPlus" :formatter="couponPlusFotmat" />
       <el-table-column label="优惠方案类型" v-if="false" align="center" prop="discountPlanType" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -272,32 +260,13 @@
         <el-form-item label="方案名称" prop="grade">
           <el-input v-model="dtform.grade" placeholder="请输入等级名称" />
         </el-form-item>
-        <el-form-item label="油站名称" prop="stationId" >
-          <el-select
-            v-model="dtform.stationId"
-            placeholder="请选择油站"
-            clearable
-            size="small"
-            @change="onInstitutionChang1"
-          >
-            <el-option
-              v-for="item in stationOptions"
-              :key="item.deptId"
-              :label="item.deptName"
-              :value="item.deptId"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="油站名称" v-show="false" prop="personnelName">
-          <el-input v-model="dtform.stationName" placeholder="请输入油站名称" />
-        </el-form-item>
         <el-form-item label="油品名称" prop="oilName">
           <el-select v-model="dtform.oilName" placeholder="油品名称" clearable size="small">
             <el-option
-              v-for="dict in oilNameOptions"
-              :key="dict.dictLabel"
-              :label="dict.dictLabel"
-              :value="dict.dictLabel"
+              v-for="dict in oilNameOptionsDT"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
             />
           </el-select>
         </el-form-item>
@@ -308,10 +277,7 @@
           <el-input-number v-model="dtform.gasoilDiscountAmt"   size="mini" :min="0" />
         </el-form-item>
-<!--        <el-form-item label="柴油优惠金额" prop="dieseloilDiscountAmt">
-          <el-input v-model="dtform.dieseloilDiscountAmt" placeholder="请输入柴油优惠金额" />
-        </el-form-item>-->
-        <el-form-item label="会员优惠是否叠加"  prop="vipDiscountyPlus">
+        <el-form-item label="等级优惠是否叠加"  prop="vipDiscountyPlus">
           <el-radio-group v-model="dtform.vipDiscountyPlus">
             <el-radio
               v-for="dict in vipDiscountyPlusOptions"
@@ -319,6 +285,7 @@
               :label="dict.dictValue"
             >{{dict.dictLabel}}</el-radio>
           </el-radio-group>
+          <span style="margin-left:20px;color:red;">注:"否" 客户只享受立减优惠</span>
         </el-form-item>
         <el-form-item label="可否叠加劵" prop="couponPlus">
           <el-radio-group v-model="dtform.couponPlus">
@@ -328,6 +295,7 @@
               :label="dict.dictValue"
             >{{dict.dictLabel}}</el-radio>
           </el-radio-group>
+          <span style="margin-left:20px;color:red;">注:"否" 客户只享受立减优惠</span>
         </el-form-item>
         <el-form-item label="优惠方案类型" v-show="false" prop="discountPlanType">
           <el-select v-model="dtform.discountPlanType" placeholder="请选择优惠方案类型">
@@ -345,7 +313,9 @@
 
 <script>
   import { listPlan, getPlan, delPlan, addPlan, updatePlan, exportPlan } from "@/api/market/plan";
-  import {stationinfo} from "@/api/station/gun";
+  import {getStationPay,updatePay} from "@/api/station/pay";
+  import { getDept } from "@/api/system/dept";
+  import { listPrice } from "@/api/station/price";
   export default {
     name: "Setting",
     data() {
@@ -368,18 +338,25 @@
         ZJplanList: [],
         couponPlusOptions:[],
         vipDiscountyPlusOptions:[],
+        discountSettingOptions:[],
         stationOptions:[],
         oilNameOptions:[],
+        oilNameOptionsDT:[],
+        oilNameOptionsZJ:[],
         discountTermOptions:[],
         // 弹出层标题
         title: "",
         titlezj: "",
+        fangan:"",
         // 是否显示弹出层
         open: false,
         yuan: true,
         laters: false,
         opendt: false,
         openzj: false,
+        showZJ:false,
+        showMJ:false,
+        showLJ:false,
         // 查询参数
         queryParams: {
           pageNum: 1,
@@ -433,10 +410,15 @@
         form: {},
         dtform: {},
         zjform: {},
-        ruleForm: {},
+        ruleForm:{
+          imgFileList:[]
+        },
         query:{
           deptId: null
         },
+        queryRule:{
+          stationId: null
+        },
         // 表单校验
         rules: {
         },
@@ -446,7 +428,13 @@
           discountTerm: [
             { required: true, message: "选择优惠执行规则", trigger: "blur" }
           ]
-        }
+        },
+        queryInfo:{
+          stationId: null
+        },
+        deptId:null,
+        deptInfo:{}
+
       };
     },
     created() {
@@ -462,24 +450,110 @@
       this.getDicts("vip_discounty_plus").then(response => {
         this.vipDiscountyPlusOptions = response.data;
       });
-      //油品名称
-      this.getDicts("oil_name").then(response => {
-        this.oilNameOptions = response.data;
+      //查看当前优惠设置
+      this.queryRule.stationId= this.$store.selectDeptId;
+      if(this.queryRule.stationId==null || this.queryRule.stationId==""){
+        this.queryRule.stationId =this.$store.state.user.deptId;
+      }
+      getStationPay(this.queryRule).then(response => {
+        this.ruleForm = response.data;
+        let e= this.ruleForm.discountSetting;
+        if(e=="1"){
+          this.showZJ=false;
+          this.showMJ=false;
+          this.showLJ=false;
+          this.fangan="不执行优惠";
+        }else if(e=="2"){
+          this.showZJ=false;
+          this.showMJ=true;
+          this.showLJ=false;
+           this.fangan="满减";
+        }else if(e=="3"){
+          this.showZJ=false;
+          this.showMJ=false;
+          this.showLJ=true;
+          this.fangan="立减";
+        }else if(e=="4"){
+          this.showZJ=true;
+          this.showMJ=false;
+          this.showLJ=false;
+          this.fangan="直降";
+        }
       });
-      this.query.deptId =this.$store.selectDeptId;
-      stationinfo(this.query).then(response => {
-        this.stationOptions = response.rows;
+      this.getDicts("discount_setting").then(response => {
+        this.discountSettingOptions = response.data;
       });
     },
     methods: {
+      save(){
+        this.$refs["ruleForm"].validate(valid => {
+          if (valid) {
+            if (this.ruleForm.payId != null) {
+              let e= this.ruleForm.discountSetting;
+              if(e=="1"){
+                updatePay(this.ruleForm).then(response => {
+                  this.fangan="不执行优惠";
+                  this.msgSuccess("优惠方案设置成功");
+                });
+              }else if(e=="2"){
+                if(this.planList!=null&&this.planList.length>0){
+                  updatePay(this.ruleForm).then(response => {
+                    this.fangan="满减";
+                    this.msgSuccess("优惠方案设置成功");
+                  });
+                }else{
+                  this.msgSuccess("满减规则下无方案");
+                }
+              }else if(e=="3"){
+                if(this.DTplanList!=null&&this.DTplanList.length>0){
+                  updatePay(this.ruleForm).then(response => {
+                    this.fangan="立减";
+                    this.msgSuccess("优惠方案设置成功");
+                  });
+                }else{
+                  this.msgSuccess("立减规则下无方案");
+                }
+              }else if(e=="4"){
+                if(this.ZJplanList!=null&&this.ZJplanList.length>0){
+                  updatePay(this.ruleForm).then(response => {
+                    this.fangan="直降";
+                    this.msgSuccess("优惠方案设置成功");
+                  });
+                }else{
+                  this.msgSuccess("直降规则下无方案");
+                }
+              }
+            }
+          }
+        });
+      },
+      discountSettingChang(e){
+        if(e=="1"){
+          this.showZJ=false;
+          this.showMJ=false;
+          this.showLJ=false;
+        }else if(e=="2"){
+          this.showZJ=false;
+          this.showMJ=true;
+          this.showLJ=false;
+        }else if(e=="3"){
+          this.showZJ=false;
+          this.showMJ=false;
+          this.showLJ=true;
+        }else if(e=="4"){
+          this.showZJ=true;
+          this.showMJ=false;
+          this.showLJ=false;
+        }
+      },
       changeHandler(value) {
         if(value=="2"){
-          this.yuan=false;
-          this.laters=true;
-          this.zjform.discountTerm="2";
-        }else if(value=="1"){
           this.laters=false;
           this.yuan=true;
+          this.zjform.discountTerm="2";
+        }else if(value=="1"){
+          this.yuan=false;
+          this.laters=true;
           this.zjform.discountTerm="1";
         }
       },
@@ -501,6 +575,9 @@
       getList() {
         this.queryParams.discountPlanType="1";
         this.queryParams.stationId= this.$store.selectDeptId;
+        if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+          this.queryParams.stationId =this.$store.state.user.deptId;
+        }
         this.loading = true;
         listPlan(this.queryParams).then(response => {
           this.planList = response.rows;
@@ -511,6 +588,9 @@
       getList2() {
         this.selectParams.discountPlanType="2";
         this.selectParams.stationId= this.$store.selectDeptId;
+        if(this.selectParams.stationId==null || this.selectParams.stationId==""){
+          this.selectParams.stationId =this.$store.state.user.deptId;
+        }
         this.loading = true;
         listPlan(this.selectParams).then(response => {
           this.DTplanList = response.rows;
@@ -522,6 +602,9 @@
       getList3() {
         this.zjParams.discountPlanType="3";
         this.zjParams.stationId= this.$store.selectDeptId;
+        if(this.zjParams.stationId==null || this.zjParams.stationId==""){
+          this.zjParams.stationId =this.$store.state.user.deptId;
+        }
         this.loading = true;
         listPlan(this.zjParams).then(response => {
           if(response.hasOwnProperty('rows')){
@@ -574,6 +657,8 @@
           dieseloilGrowthValue: null,
           growthValue: null,
           date: null,
+          stationId:null,
+          stationName:null,
           deductionGrowthValue: null
         };
         this.resetForm("form");
@@ -591,6 +676,8 @@
           dieseloilConsume: null,
           dieseloilGrowthValue: null,
           growthValue: null,
+          stationId:null,
+          stationName:null,
           date: null,
           deductionGrowthValue: null
         };
@@ -610,6 +697,8 @@
           dieseloilGrowthValue: null,
           growthValue: null,
           date: null,
+          stationId:null,
+          stationName:null,
           deductionGrowthValue: null
         };
         this.resetForm("zjform");
@@ -618,8 +707,25 @@
       /** 新增按钮操作 */
       handleAdd() {
         this.reset();
-        this.open = true;
-        this.title = "添加满减优惠";
+        this.deptId=this.$store.selectDeptId;
+        if(this.deptId==null || this.deptId==""){
+          this.deptId =this.$store.state.user.deptId;
+        }
+        getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+            this.open = true;
+            this.title = "添加满减优惠";
+            this.form.stationId=this.deptInfo.deptId;
+            this.form.stationName=this.deptInfo.deptName;
+            this.queryInfo.stationId=this.deptInfo.deptId;
+            listPrice(this.queryInfo).then(response => {
+              this.oilNameOptions = response.rows;
+            });
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+        }); 
       },
       /** 修改按钮操作 */
       handleUpdate(row) {
@@ -634,8 +740,25 @@
       /** 新增按钮操作 */
       handleAddDT() {
         this.resetDT();
-        this.opendt = true;
-        this.title = "添加立减优惠";
+        this.deptId=this.$store.selectDeptId;
+        if(this.deptId==null || this.deptId==""){
+          this.deptId =this.$store.state.user.deptId;
+        }
+        getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+            this.opendt = true;
+            this.title = "添加立减优惠";
+            this.dtform.stationId=this.deptInfo.deptId;
+            this.dtform.stationName=this.deptInfo.deptName;
+            this.queryInfo.stationId=this.deptInfo.deptId;
+            listPrice(this.queryInfo).then(response => {
+              this.oilNameOptionsDT = response.rows;
+            });
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+        }); 
       },
       /** 修改按钮操作 */
       handleUpdateDT(row) {
@@ -650,9 +773,26 @@
       /** 新增按钮操作 */
       handleAddZJ() {
         this.resetZJ();
-        this.openzj = true;
-        //this.zjform.discountTerm="1";
-        this.titlezj = "添加直降优惠";
+        this.deptId=this.$store.selectDeptId;
+        if(this.deptId==null || this.deptId==""){
+          this.deptId =this.$store.state.user.deptId;
+        }
+        getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+            this.openzj = true;
+            //this.zjform.discountTerm="1";
+            this.titlezj = "添加直降优惠";
+            this.zjform.stationId=this.deptInfo.deptId;
+            this.zjform.stationName=this.deptInfo.deptName;
+            this.queryInfo.stationId=this.deptInfo.deptId;
+            listPrice(this.queryInfo).then(response => {
+              this.oilNameOptionsZJ = response.rows;
+            });
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+        }); 
       },
       /** 修改按钮操作 */
       handleUpdateZJ(row) {
@@ -738,7 +878,7 @@
       /** 删除按钮操作 */
       handleDelete(row) {
         const ids = row.id || this.ids;
-        this.$confirm('是否确认删除满减优惠编号为"' + ids + '"的数据项?', "警告", {
+        this.$confirm('是否确认删除满减优惠方案?', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
@@ -752,7 +892,7 @@
       /** 删除按钮操作 */
       handleDeleteDT(row) {
         const ids = row.id || this.ids;
-        this.$confirm('是否确认删除立减优惠编号为"' + ids + '"的数据项?', "警告", {
+        this.$confirm('是否确认删除立减优惠方案?', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
@@ -766,7 +906,7 @@
       /** 删除按钮操作 */
       handleDeleteZJ(row) {
         const ids = row.id || this.ids;
-        this.$confirm('是否确认删除直降优惠编号为"' + ids + '"的数据项?', "警告", {
+        this.$confirm('是否确认删除直降优惠方案?', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
@@ -780,6 +920,9 @@
       /** 导出按钮操作 */
       handleExport() {
         const queryParams = this.queryParams;
+         if(queryParams.stationId==null || queryParams.stationId==""){
+          queryParams.stationId =this.$store.state.user.deptId;
+        }
         this.$confirm('是否确认导出所有优惠设置数据项?', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",

+ 3 - 0
src/views/station/adjust/index.vue

@@ -84,6 +84,9 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listAdjust(this.queryParams).then(response => {
         this.adjustList = response.rows;
         this.total = response.total;

+ 95 - 47
src/views/station/gun/index.vue

@@ -20,7 +20,6 @@
           <span>{{ parseTime(scope.row.date, '{y}-{m}-{d}') }}</span>
         </template>
       </el-table-column>
-      <el-table-column prop="status" label="油枪状态" :formatter="statusFormat"></el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -40,7 +39,6 @@
         </template>
       </el-table-column>
     </el-table>
-
     <pagination
       v-show="total>0"
       :total="total"
@@ -48,7 +46,6 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
-
     <!-- 添加或修改油枪管理对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="90px">
@@ -56,48 +53,20 @@
           <el-input v-model="form.oilGunNo" placeholder="请输入油枪号" style="width: 150px"/>
         </el-form-item>
         <el-form-item label="油品名称" prop="oilName">
-          <el-select v-model="form.oilName" placeholder="油品名称" clearable size="small">
+          <el-select v-model="form.oilName" placeholder="油品名称" clearable size="small" @change="onOilNameChang">
             <el-option
               v-for="dict in oilNameOptions"
-              :key="dict.dictLabel"
-              :label="dict.dictLabel"
-              :value="dict.dictLabel"
+              :key="dict.oilName"
+              :label="dict.oilName"
+              :value="dict.oilName"
             />
-          </el-select>
+          </el-select> 
         </el-form-item>
-        <el-form-item label="单价" prop="oilPrice">
-          <el-input-number v-model="form.oilPrice" :precision="2" :step="0.1" ></el-input-number>
+        <el-form-item label="单价" prop="oilPrice" >
+          <el-input-number v-model="form.oilPrice"  :precision="2" :disabled="flage" :step="1" style="width:150px;" ></el-input-number>元
         </el-form-item>
-        <el-form-item label="油站名称" prop="stationId" >
-            <el-select
-              v-model="form.stationId"
-              placeholder="请选择油站"
-              clearable
-              size="small"
-              @change="onInstitutionChang"
-            >
-              <el-option
-                v-for="item in stationOptions"
-                :key="item.deptId"
-                :label="item.deptName"
-                :value="item.deptId"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-        <el-form-item v-show="false" label="油站名称" prop="stationName">
-          <el-input v-model="form.stationName"  placeholder="请输入油站名称" />
-        </el-form-item>
-        <el-form-item label="油枪状态">
-          <el-radio-group v-model="form.status">
-            <el-radio
-              v-for="dict in statusOptions"
-              :key="dict.dictValue"
-              :label="dict.dictValue"
-            >{{dict.dictLabel}}</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="油枪类型">
-          <el-radio-group v-model="form.oilGunType">
+        <el-form-item label="油枪类型" v-show="false">
+          <el-radio-group v-model="form.oilGunType" >
             <el-radio
               v-for="dict in oilGunTypeOptions"
               :key="dict.dictValue"
@@ -116,7 +85,8 @@
 
 <script>
 import { listGun, getGun, delGun, addGun, updateGun, exportGun,stationinfo } from "@/api/station/gun";
-
+import { listPrice,getPrice} from "@/api/station/price";
+import { getDept } from "@/api/system/dept";
 export default {
   name: "Gun",
   data() {
@@ -144,6 +114,7 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      flage:true,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -155,11 +126,16 @@ export default {
         date: null,
         status: null
       },
+      queryInfo:{
+        stationId: null
+      },    
+      detpId:null,
       query:{
         deptId: null
       },
       // 表单参数
       form: {},
+      deptInfo:{},
       // 表单校验
       rules: {
       }
@@ -168,24 +144,37 @@ export default {
   created() {
     this.getList();
     this.query.deptId =this.$store.selectDeptId;
+    if(this.query.deptId==null || this.query.deptId==""){
+        this.query.deptId =this.$store.state.user.deptId;
+      }
     stationinfo(this.query).then(response => {
       this.stationOptions = response.rows;
     });
     this.getDicts("station_gun_status").then(response => {
       this.statusOptions = response.data;
     });
-    this.getDicts("oil_name").then(response => {
-      this.oilNameOptions = response.data;
-    });
+   
     this.getDicts("oil_gun_type").then(response => {
       this.oilGunTypeOptions = response.data;
     });
   },
   methods: {
+    async queryPrice(queryInfo ){
+       const response = await listPrice(queryInfo);
+       this.oilNameOptions = response.rows;
+    },
+    async queryOilPrice(oilPriceId ){
+       const response = await getPrice(oilPriceId);
+       this.form.oilPrice = response.data.oilPrice;
+    },
+  
     /** 查询油枪管理列表 */
     getList() {
       this.loading = true;
       this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listGun(this.queryParams).then(response => {
         this.gunList = response.rows;
         this.total = response.total;
@@ -209,6 +198,8 @@ export default {
         status: "0"
       };
       this.resetForm("form");
+      this.oilNameOptions.length=0;
+      this.oilNameOptions = [];
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -229,8 +220,26 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.title = "添加油枪管理";
+      //判断当前登陆人下拉油站是否是油站
+      this.deptId=this.$store.selectDeptId;
+      if(this.deptId==null || this.deptId==""){
+        this.deptId =this.$store.state.user.deptId;
+      }
+      getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+            this.open = true;
+            this.form.oilGunType ="1";
+            this.title = "添加油枪管理";
+            this.form.stationId=this.deptInfo.deptId;
+            this.form.stationName=this.deptInfo.deptName;
+            this.queryInfo.stationId=this.deptInfo.deptId;
+            this.queryPrice(this.queryInfo);
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+      });
+     
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -238,6 +247,12 @@ export default {
       const oilGunId = row.oilGunId || this.ids
       getGun(oilGunId).then(response => {
         this.form = response.data;
+        if(this.form.stationId!=null && this.form.stationId!=""){
+          this.queryInfo.stationId=this.form.stationId;
+          listPrice(this.queryInfo).then(response => {
+            this.oilNameOptions = response.rows;
+          });
+        }
         this.open = true;
         this.title = "修改油枪管理";
       });
@@ -268,11 +283,44 @@ export default {
           return item.deptId === e;//筛选出匹配数据
         })
       this.form.stationName=obj.deptName;
+      //根据油站查询对应的油站内的所有油枪
+      this.queryInfo.stationId=obj.deptId;
+      listPrice(this.queryInfo).then(response => { 
+        this.oilNameOptions = response.rows;
+      });
+    },
+    onOilNameChang(e){
+      let obj = {};
+      if(e!=null &&e !=""){
+        console.log("e",e);
+        obj = this.oilNameOptions.find((item)=>{//这里的userList就是上面遍历的数据源
+          return item.oilName === e;//筛选出匹配数据
+        });
+         console.log("obj",obj);
+        if(obj.hasOwnProperty('oilName')){
+          if(obj.oilName==="非油品"){
+            this.form.oilGunType ="2";
+          }else{
+            this.form.oilGunType ="1";
+          }
+          if(obj.hasOwnProperty('oilPriceId')){
+            // getPrice(obj.oilPriceId).then(response => {
+            //    console.log("objoilPriceId",response);
+            //   this.form.oilPrice = response.data.oilPrice;
+            // });
+            this.queryOilPrice(obj.oilPriceId);
+          }else{
+            this.form.oilPrice ="0";
+          }
+        }
+      }else{
+        this.form.oilPrice ="0";
+      }
     },
     /** 删除按钮操作 */
     handleDelete(row) {
       const oilGunIds = row.oilGunId || this.ids;
-      this.$confirm('是否确认删除油枪管理编号为"' + oilGunIds + '"的数据项?', "警告", {
+      this.$confirm('是否确认删除油枪', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"

+ 6 - 6
src/views/station/info/index.vue

@@ -4,8 +4,7 @@
       <el-table-column v-if="false" label="自增主键id" align="center"  prop="deptId" />
       <el-table-column label="油站名称" align="center" prop="deptName" />
       <el-table-column label="油站地址" align="center" prop="deptAddress" />
-      <el-table-column label="油枪数量" align="center" prop="oilGunNum" />
-      <el-table-column label="联系人" align="center" prop="contacts" />
+      <el-table-column label="联系人" align="center" prop="leader" />
       <el-table-column label="电话" align="center" prop="phone" />
       <el-table-column v-if="false" label="集团id"  align="center" prop="stationGroupId" />
       <el-table-column v-if="false" label="集团名称" align="center" prop="stationGroupName" />
@@ -47,6 +46,7 @@
             :before-upload="beforeAvatarUpload">
             <img v-if="form.stationPic" :src="form.stationPic" style="width:150px;height: 150px;" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+            <div class="el-upload__tip" slot="tip">点击图片重新上传,只能上传jpg/png文件,图片大小不超过2M</div>
           </el-upload>
         </el-form-item>
         <el-form-item label="油站名称" prop="deptName">
@@ -55,9 +55,6 @@
         <el-form-item label="油站地址" prop="deptAddress">
           <el-input v-model="form.deptAddress" placeholder="请输入油站地址" />
         </el-form-item>
-        <el-form-item label="油枪数量" prop="oilGunNum">
-          <el-input v-model="form.oilGunNum" placeholder="请输入油枪数量" />
-        </el-form-item>
         <el-form-item label="联系人" prop="leader">
           <el-input v-model="form.leader" placeholder="请输入联系人" />
         </el-form-item>
@@ -155,6 +152,9 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.deptId= this.$store.selectDeptId;
+      if(this.queryParams.deptId==null || this.queryParams.deptId==""){
+        this.queryParams.deptId =this.$store.state.user.deptId;
+      }
       listInfo(this.queryParams).then(response => {
         this.infoList = response.rows;
         this.total = response.total;
@@ -246,7 +246,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const stationIds = row.deptId || this.ids;
-      this.$confirm('是否确认删除油站信息编号为"' + stationIds + '"的数据项?', "警告", {
+      this.$confirm('是否确认删除油站信息', "警告", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"

+ 38 - 33
src/views/station/manage/index.vue

@@ -24,8 +24,8 @@
 
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
+        <el-button type="info"  icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
       </el-form-item>
     </el-form>
 
@@ -96,25 +96,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="油站名称" prop="stationId" >
-          <el-select
-            v-model="form.stationId"
-            placeholder="请选择油站"
-            clearable
-            size="small"
-            @change="onInstitutionChang"
-          >
-            <el-option
-              v-for="item in stationOptions"
-              :key="item.deptId"
-              :label="item.deptName"
-              :value="item.deptId"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="油站名称" v-show="false" prop="stationName">
-          <el-input v-model="form.stationName" placeholder="请输入油站名称" />
-        </el-form-item>
+      
         <el-form-item label="绑定油枪号" prop="gunNo">
           <el-checkbox-group v-model="gunNoList">
             <el-checkbox
@@ -151,8 +133,8 @@
 
 <script>
 import { listManage, getManage, delManage, addManage, updateManage, exportManage,changeManageStatus } from "@/api/station/manage";
-import{stationinfo,selectGun,listGun} from "@/api/station/gun";
-
+import{listGun} from "@/api/station/gun";
+import { getDept } from "@/api/system/dept";
 export default {
   name: "Manage",
   data() {
@@ -197,9 +179,14 @@ export default {
         deviceStatus: null,
         deviceFactory: null
       },
+      deptId:null,
+      queryInfo:{
+        stationId:null
+      },
       // 查询参数
-      queryInfo: {
-        stationId: null
+      deptInfo: {},
+      query:{
+        deptId:null
       },
       // 表单参数
       form: {},
@@ -218,16 +205,16 @@ export default {
     this.getDicts("device_type").then(response => {
       this.deviceTypeOptions = response.data;
     });
-    this.query.deptId =this.$store.selectDeptId;
-    stationinfo(this.query).then(response => {
-      this.stationOptions = response.rows;
-    });
+
   },
   methods: {
     /** 查询油站设备管理列表 */
     getList() {
       this.loading = true;
       this.queryParams.stationId = this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listManage(this.queryParams).then(response => {
         this.manageList = response.rows;
         this.total = response.total;
@@ -282,8 +269,26 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.title = "添加油站设备管理";
+      this.deptId=this.$store.selectDeptId;
+      if(this.deptId==null || this.deptId==""){
+        this.deptId =this.$store.state.user.deptId;
+      }
+      getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+            this.open = true;
+            this.title = "添加油站设备管理";
+            this.form.stationId=this.deptInfo.deptId;
+            this.form.stationName=this.deptInfo.deptName;
+            this.queryInfo.stationId=this.deptInfo.deptId;
+            listGun(this.queryInfo).then(response => {
+              this.checkList = response.rows;
+            });
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+      });
+     
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -294,7 +299,7 @@ export default {
         if(this.form.gunNo!=null &&this.form.gunNo!="" ){
           this.gunNoList=this.form.gunNo.split(",");
         }
-        this.queryInfo.stationId=row.stationId;
+        this.queryInfo.stationId=this.form.stationId;
         listGun(this.queryInfo).then(response => {
           this.checkList = response.rows;
         });
@@ -343,7 +348,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const deviceIds = row.deviceId || this.ids;
-      this.$confirm('是否确认删除油站设备管理编号为"' + deviceIds + '"的数据项?', "警告", {
+      this.$confirm('是否确认删除油站设备管理', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"

+ 18 - 15
src/views/station/order/index.vue

@@ -20,15 +20,6 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="车牌号" prop="orderNo">
-        <el-input
-          v-model="queryParams.likeCarNo"
-          placeholder="请输入订单号"
-          clearable
-          size="small"
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
       <el-form-item label="油品名称" prop="oilName">
         <el-select v-model="queryParams.oilName" placeholder="油品名称" clearable size="small">
           <el-option
@@ -69,8 +60,8 @@
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button icon="el-icon-download" size="mini" @click="handleExport"  v-hasPermi="['station:order:export']">导出</el-button>
+        <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"  v-hasPermi="['station:order:export']">导出</el-button>
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="orderList" >
@@ -82,7 +73,7 @@
       <el-table-column label="应付金额" align="center" prop="receivableAmt" />
       <el-table-column label="实付金额" align="center" prop="amt" />
       <el-table-column label="优惠金额" align="center" prop="discountAmt" />
-      <el-table-column label="消费者" width="120" align="center" prop="consumer" />
+      <el-table-column label="客户姓名" width="120" align="center" prop="consumer" />
       <el-table-column label="加油员" width="120" align="center" prop="oilPersonnel" />
       <el-table-column label="加油枪号" align="center" prop="oilGun" />
       <el-table-column label="支付类型" align="center" prop="payType" :formatter="payTypeFotmat"/>
@@ -202,12 +193,21 @@
         if(row.payType === 'wx'){
           return '微信支付'
         }else if(row.payType === 'zfb'){
-          return '支付宝'
+          return '支付宝支付'
         }else if(row.payType === 'xj'){
-          return '现金'
-        }else if(row.payType === 'POS'){
+          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 '卡包支付'
+        }
       },
       payWayFotmat(row, column){
         if(row.payWay === '02'){
@@ -236,6 +236,9 @@
       getList() {
         this.loading = true;
         this.queryParams.stationId= this.$store.selectDeptId;
+        if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+          this.queryParams.stationId =this.$store.state.user.deptId;
+        }
         listOrder(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
           this.orderList = response.rows;
           this.total = response.total;

+ 19 - 22
src/views/station/order/notOil.vue

@@ -20,21 +20,6 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <!-- <el-form-item label="油站名称" prop="stationId">
-        <el-select
-          v-model="queryParams.stationId"
-          placeholder="请选择油站"
-          clearable
-          size="small"
-        >
-          <el-option
-            v-for="item in stationOptions"
-            :key="item.deptId"
-            :label="item.deptName"
-            :value="item.deptId"
-          ></el-option>
-        </el-select> -->
-      </el-form-item>
       <el-form-item label="创建时间" prop="createdDate">
         <el-date-picker style="width: 350px"
                         v-model="dateRangeCreatedDate" size="mini" value-format="yyyy-MM-dd HH:mm:ss"
@@ -46,8 +31,8 @@
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-        <el-button icon="el-icon-download" size="mini" @click="handleExport"  v-hasPermi="['station:order:export']">导出</el-button>
+        <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <!-- <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport"  v-hasPermi="['station:order:export']">导出</el-button> -->
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="orderList" >
@@ -55,7 +40,7 @@
       <el-table-column label="订单号"  width="200" align="center" prop="orderNo" />
       <el-table-column label="应付金额" align="center" prop="receivableAmt" />
       <el-table-column label="实付金额" align="center" prop="amt" />
-      <el-table-column label="消费者" width="120" align="center" prop="consumer" />
+      <el-table-column label="客户姓名" width="120" align="center" prop="consumer" />
       <el-table-column label="加油员" width="120" align="center" prop="oilPersonnel" />
 
       <el-table-column label="支付类型" align="center" prop="payType" :formatter="payTypeFotmat"/>
@@ -173,16 +158,25 @@
       });
     },
     methods: {
-      payTypeFotmat(row, column){
+       payTypeFotmat(row, column){
         if(row.payType === 'wx'){
           return '微信支付'
         }else if(row.payType === 'zfb'){
-          return '支付宝'
+          return '支付宝支付'
         }else if(row.payType === 'xj'){
-          return '现金'
-        }else if(row.payType === 'POS'){
+          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 '卡包支付'
+        }
       },
       payWayFotmat(row, column){
         if(row.payWay === '02'){
@@ -211,6 +205,9 @@
       getList() {
         this.loading = true;
         this.queryParams.stationId= this.$store.selectDeptId;
+        if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+          this.queryParams.stationId =this.$store.state.user.deptId;
+        }
         listOrder(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
           this.orderList = response.rows;
           this.total = response.total;

+ 43 - 64
src/views/station/pay/index.vue

@@ -1,29 +1,8 @@
 <template>
   <div class="app-container">
-    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px">
-      <el-form-item label="支付模板"  prop="payMode">
-        <el-upload
-          class="avatar-uploader"
-          :action="addressUrl"
-          :headers="headers"
-          multiple
-          list-type="picture-card"
-          :limit='5'
-          :file-list="ruleForm.imgFileList"
-          accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
-          :before-upload="beforeAvatarUpload"
-          :on-remove="handleRemove"
-          :on-success="handlepaymentSuccess"
-          :auto-upload="true">
-          <i class="el-icon-plus"></i>
-          <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,最多上传5张且单张图片不超过1M</div>
-        </el-upload>
-        <el-dialog :visible.sync="dialogVisible" append-to-body>
-          <img width="100%" :src="dialogImageUrl" alt="" />
-        </el-dialog>
-      </el-form-item>
-      <el-form-item label="油站名称" >
-        <el-select
+    <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="130px">
+     <el-form-item label="油站名称" >
+        <el-select disabled="disabled" 
           v-model="ruleForm.stationId"
           placeholder="请选择油站"
           clearable
@@ -38,10 +17,7 @@
           ></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="油站名称" v-show="false" prop="stationName">
-        <el-input v-model="ruleForm.stationName" placeholder="请输入油站名称" />
-      </el-form-item>
-      <el-form-item label="支付页面形象照" >
+       <el-form-item label="支付页面形象照" >
         <el-radio-group v-model="ruleForm.imagePhotosFlag">
           <el-radio
             v-for="dict in imagePhotosFlagOptions"
@@ -50,9 +26,31 @@
           >{{dict.dictLabel}}</el-radio>
         </el-radio-group>
       </el-form-item>
-      
+      <el-form-item label="油站名称"  prop="stationName" v-show="false">
+        <el-input v-model="ruleForm.stationName" placeholder="请输入油站名称" />
+      </el-form-item>
+      <el-form-item label="支付模板"  prop="payMode">
+        <el-upload
+          class="avatar-uploader"
+          :action="addressUrl"
+          :headers="headers"
+          multiple
+          list-type="picture-card"
+          :limit='5'
+          :file-list="ruleForm.imgFileList"
+          accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
+          :before-upload="beforeAvatarUpload"
+          :on-remove="handleRemove"
+          :on-success="handlepaymentSuccess"
+          :auto-upload="true">
+          <i class="el-icon-plus"></i>
+          <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,单张图片不超过1M</div>
+        </el-upload>
+        <el-dialog :visible.sync="dialogVisible" append-to-body>
+          <img width="100%" :src="dialogImageUrl" alt="" />
+        </el-dialog>
+      </el-form-item>
       <el-form-item label="公告信息" prop="notice" >
-          <!-- <el-input v-model="ruleForm.notice" placeholder="请输入公告信息" /> -->
           <textarea cols="40" rows="3" v-model="ruleForm.notice"  placeholder="请输入公告信息"></textarea>
         </el-form-item>
       <el-form-item label="电子会员卡">
@@ -64,10 +62,6 @@
           >{{dict.dictLabel}}</el-radio>
         </el-radio-group>
       </el-form-item>
-      <el-form-item label="支付回调"  prop="payCallbackPage">
-        <el-input v-model="ruleForm.payCallbackPage" placeholder="请输入支付回调页面配置" style="width: 200px"/>
-        <el-button>前往配置</el-button>
-      </el-form-item>
       <el-form-item label="打印张数"  prop="payPrintNum">
         <el-input-number size="small" :min="0" v-model="ruleForm.payPrintNum" />
         <span> 张 </span>
@@ -90,25 +84,7 @@
           >{{dict.dictLabel}}</el-radio>
         </el-radio-group>
       </el-form-item>
-      <el-form-item label="优惠方案" >
-        <el-radio-group v-model="ruleForm.discountSetting">
-          <el-radio
-            v-for="dict in discountSettingOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
-        </el-radio-group>
-      </el-form-item>
-      <el-form-item label="开启非油品" >
-        <el-radio-group v-model="ruleForm.isNoOil">
-          <el-radio
-            v-for="dict in isNoOilOptions"
-            :key="dict.dictValue"
-            :label="dict.dictValue"
-          >{{dict.dictLabel}}</el-radio>
-        </el-radio-group>
-      </el-form-item>
-      <el-form-item label="打印积分小票" >
+      <el-form-item label="兑换积分小票打印" >
         <el-radio-group v-model="ruleForm.integralPrintFlag">
           <el-radio
             v-for="dict in integralPrintFlagOptions"
@@ -229,11 +205,19 @@ export default {
     /** 进入信息 */
     look() {
       this.queryParams.stationId= this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       getStationPay(this.queryParams).then(response => {
-        this.ruleForm = response.data;
-        if(response.data.imgFileList==null){
-          this.ruleForm.imgFileList=[];
-        }
+        console.log("response",response);
+         this.ruleForm = response.data;
+          if(response.data.imgFileList==null){
+            this.ruleForm.imgFileList=[];
+          }
+          if(response.data.stationId==null){
+            this.ruleForm.stationId=this.$store.state.user.deptId;
+          }
+        
       });
     },
     /** 提交按钮 */
@@ -247,17 +231,12 @@ export default {
             });
           } else {
             addPay(this.ruleForm).then(response => {
-              this.msgSuccess("新增成功");
+              this.msgSuccess("添加成功");
               this.look();
             });
           }
         }
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
+      });  
     }
   }
 };

+ 45 - 36
src/views/station/personnel/index.vue

@@ -2,8 +2,8 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item style="float:right;">
-        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-plus" size="mini" @click="handleAdd">添加</el-button>
+        <!-- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> -->
+        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加</el-button>
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="personnelList" @selection-change="handleSelectionChange">
@@ -12,14 +12,14 @@
       <el-table-column label="负责枪号" align="center" prop="gunNo" />
       <el-table-column label="加油站id"  v-if="false" align="center" prop="stationId" />
       <el-table-column label="加油站名称" align="center" prop="stationName" />
-      <el-table-column label="二维码" align="center" prop="qrCode" />
+      <!-- <el-table-column label="二维码" align="center" prop="qrCode" /> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
+          <!-- <el-button
             size="mini"
             type="text"
             icon="el-icon-plus"
-          >微信绑定</el-button>
+          >微信绑定</el-button> -->
           <el-button
             size="mini"
             type="text"
@@ -41,30 +41,10 @@
     <!-- 添加或修改油站员工信息对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="油站名称" prop="stationId" >
-          <el-select
-            v-model="form.stationId"
-            placeholder="请选择油站"
-            clearable
-            size="small"
-            @change="onInstitutionChang"
-          >
-            <el-option
-              v-for="item in stationOptions"
-              :key="item.deptId"
-              :label="item.deptName"
-              :value="item.deptId"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="油站名称" v-show="false" prop="personnelName">
-          <el-input v-model="form.stationName" placeholder="请输入油站名称" />
-        </el-form-item>
         <el-form-item label="姓名" prop="personnelName">
           <el-input v-model="form.personnelName" placeholder="请输入员工姓名" />
         </el-form-item>
         <el-form-item label="负责枪号" prop="gunNo">
-<!--          <el-input v-model="form.gunNo" placeholder="请输入员工负责枪号" />-->
           <el-checkbox-group v-model="gunNoList">
             <el-checkbox
               v-for = "item in checkList"
@@ -76,10 +56,6 @@
             </el-checkbox>
           </el-checkbox-group>
         </el-form-item>
-
-<!--        <el-form-item label="二维码" prop="qrCode">
-          <el-input v-model="form.qrCode" placeholder="请输入二维码" />
-        </el-form-item>-->
         <el-form-item label="手机号" prop="personnelPhone">
           <el-input v-model="form.personnelPhone" placeholder="请输入员工手机号" />
         </el-form-item>
@@ -94,8 +70,8 @@
 
 <script>
 import { listPersonnel, getPersonnel, delPersonnel, addPersonnel, updatePersonnel, exportPersonnel } from "@/api/station/personnel";
-import {stationinfo,selectGun,listGun} from "@/api/station/gun";
-
+import {stationinfo,listGun} from "@/api/station/gun";
+import { getDept } from "@/api/system/dept";
 export default {
   name: "Personnel",
   data() {
@@ -149,6 +125,9 @@ export default {
   created() {
     this.getList();
     this.query.deptId =this.$store.selectDeptId;
+    if(this.query.deptId ==null || this.query.deptId ==""){
+      this.query.deptId  =this.$store.state.user.deptId;
+    }
     stationinfo(this.query).then(response => {
       this.stationOptions = response.rows;
     });
@@ -158,6 +137,9 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listPersonnel(this.queryParams).then(response => {
         this.queryParams.stationId=null;
         this.personnelList = response.rows;
@@ -215,8 +197,26 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.title = "添加油站员工信息";
+      this.deptId=this.$store.selectDeptId;
+      if(this.deptId==null || this.deptId==""){
+        this.deptId =this.$store.state.user.deptId;
+      }
+      getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          if(this.deptInfo.jiBie==2){
+             this.open = true;
+            this.title = "添加油站员工信息";
+            this.form.stationId=this.deptInfo.deptId;
+            this.form.stationName=this.deptInfo.deptName;
+            this.queryInfo.stationId=this.deptInfo.deptId;
+            listGun(this.queryInfo).then(response => {
+              this.checkList = response.rows;
+            });
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+      });
+     
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -224,7 +224,6 @@ export default {
       const personnelId = row.personnelId || this.ids
       getPersonnel(personnelId).then(response => {
         this.form = response.data;
-      //  this.gunNoList=this.form.gunNo.split(",").map(Number);
         if(this.form.gunNo!=null &&this.form.gunNo!="" ){
           this.gunNoList=this.form.gunNo.split(",");
         }
@@ -241,7 +240,17 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if(this.gunNoList !=null && this.gunNoList.length>0){
-            this.form.gunNo=this.gunNoList.toString();
+            //判断
+            let list=[];
+            for(let i=0;i<this.gunNoList.length;i++){
+              for(let j=0;j<this.checkList.length;j++){
+                if(this.gunNoList[i]==this.checkList[j].oilGunNo){
+                  list.push(this.checkList[j].oilGunNo);
+                }
+              }
+            }
+          
+            this.form.gunNo=list.toString();
           }
           if (this.form.personnelId != null) {
             updatePersonnel(this.form).then(response => {
@@ -262,7 +271,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const personnelIds = row.personnelId || this.ids;
-      this.$confirm('是否确认删除油站员工信息编号为"' + personnelIds + '"的数据项?', "警告", {
+      this.$confirm('是否确认删除油站员工信息', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"

+ 62 - 38
src/views/station/price/index.vue

@@ -3,8 +3,8 @@
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
 
       <el-form-item>
-        <el-button type="cyan" icon="el-icon-plus" size="mini" @click="handleAdd">添加油品</el-button>
-        <el-button icon="el-icon-edit" size="mini"  @click="handleAddAdjust"  v-hasPermi="['station:adjust:add']">调价</el-button>
+        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">添加油品</el-button>
+        <el-button  type="success" icon="el-icon-edit" size="mini"  @click="handleAddAdjust"  v-hasPermi="['station:adjust:add']">调价</el-button>
       </el-form-item>
     </el-form>
     <el-table v-loading="loading" :data="priceList"  ref = "multipleTable"  @selection-change="handleSelectionChange">
@@ -39,8 +39,8 @@
     <!-- 添加或修改油品价格对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form"  label-width="90px">
-        <el-form-item label="油品名称" prop="oilName">
-          <el-select v-model="form.oilName" placeholder="油品名称" clearable size="small">
+        <el-form-item label="油品名称" prop="oilName" >
+          <el-select v-model="form.oilName" placeholder="油品名称" clearable size="small"  @change="onOilNameChang">
             <el-option
               v-for="dict in oilNameOptions"
               :key="dict.dictLabel"
@@ -50,27 +50,9 @@
           </el-select>
         </el-form-item>
         <el-form-item label="油品价格" prop="oilPrice">
-          <el-input-number v-model="form.oilPrice" :precision="2" :step="0.1" ></el-input-number>
-        </el-form-item>
-        <el-form-item label="油站名称" prop="stationId" >
-          <el-select
-            v-model="form.stationId"
-            placeholder="请选择油站"
-            clearable
-            size="small"
-            @change="onInstitutionChang"
-          >
-            <el-option
-              v-for="item in stationOptions"
-              :key="item.deptId"
-              :label="item.deptName"
-              :value="item.deptId"
-            ></el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="油站名称" v-show="false" prop="stationNanme">
-          <el-input v-model="form.stationNanme" placeholder="请输入油站名称" />
+          <el-input-number v-model="form.oilPrice" :disabled="editInfo" :precision="2" :min="0" :step="1" ></el-input-number>
         </el-form-item>
+       
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -81,7 +63,7 @@
     <el-dialog :title="titleAdjust" :visible.sync="open1" :rules="rules" width="500px" append-to-body>
       <el-form ref="form1" :model="form1"  label-width="80px">
         <el-form-item label="油品名称" prop="oilName" >
-          <el-select disabled="disabled" v-model="form1.oilName" placeholder="油品名称" clearable size="small">
+          <el-select :disabled="disabled" v-model="form1.oilName" placeholder="油品名称" clearable size="small">
             <el-option
               v-for="dict in oilNameOptions"
               :key="dict.dictLabel"
@@ -91,7 +73,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="调整价格" prop="oilAdjustPrice">
-          <el-input-number v-model="form1.oilAdjustPrice" :precision="2" :min="0" :step="0.1" ></el-input-number>
+          <el-input-number v-model="form1.oilAdjustPrice" :precision="2" :min="0" :step="1" style="width:150px;"/>元
         </el-form-item>
         <el-form-item label="生效状态" prop="takeEffectStatus">
           <el-radio-group v-model="form1.takeEffectStatus">
@@ -109,8 +91,7 @@
                           placeholder="选择生效时间">
           </el-date-picker>
         </el-form-item>
-
-        <el-form-item label="油站名称"  prop="stationId">
+        <el-form-item label="油站名称"  prop="stationId"  >
           <el-select disabled="disabled"
             v-model="form1.stationId"
             placeholder="请选择油站"
@@ -127,7 +108,7 @@
           </el-select>
         </el-form-item>
 
-        <el-form-item label="油站名称" v-show="false" prop="stationName" >
+        <el-form-item label="油站名称" prop="stationName" v-show="false" >
           <el-input v-model="form1.stationName" placeholder="请输入油站名称" />
         </el-form-item>
         <el-form-item label="油品价格id" v-show="false" prop="oilPriceId" >
@@ -144,8 +125,9 @@
 
 <script>
 import { listPrice, delPrice, addPrice, updatePrice, exportPrice } from "@/api/station/price";
-import {stationinfo} from "@/api/station/gun";
 import {  addAdjust, updateAdjust } from "@/api/station/adjust";
+import { getDept } from "@/api/system/dept";
+import {stationinfo} from "@/api/station/gun";
 export default {
   name: "Price",
   data() {
@@ -158,6 +140,7 @@ export default {
       single: true,
       // 非多个禁用
       multiple: true,
+      editInfo:false,
       // 显示搜索条件
       showSearch: true,
       // 总条数
@@ -172,6 +155,7 @@ export default {
       // 是否显示弹出层
       open: false,
       open1: false,
+      deptId:null,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -202,22 +186,30 @@ export default {
   },
   created() {
     this.getList();
-    this.query.deptId =this.$store.selectDeptId;
-    stationinfo(this.query).then(response => {
-      this.stationOptions = response.rows;
-    });
     this.getDicts("take_effect_status").then(response => {
       this.takeEffectStatusOptions = response.data;
     });
     this.getDicts("oil_name").then(response => {
       this.oilNameOptions = response.data;
     });
+    this.query.deptId =this.$store.selectDeptId;
+    if(this.query.deptId==null || this.query.deptId==""){
+      this.query.deptId =this.$store.state.user.deptId;
+    }
+    stationinfo(this.query).then(response => {
+      this.stationOptions = response.rows;
+    });
+    
   },
   methods: {
     /** 查询油品价格列表 */
     getList() {
       this.loading = true;
       this.queryParams.stationId= this.$store.selectDeptId;
+      this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listPrice(this.queryParams).then(response => {
         this.priceList = response.rows;
         this.total = response.total;
@@ -255,10 +247,39 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.title = "添加油品价格";
+      this.deptId=this.$store.selectDeptId;
+      if(this.deptId==null || this.deptId==""){
+        this.deptId =this.$store.state.user.deptId;
+      }
+      getDept(this.deptId).then(response => {
+          this.deptInfo = response.data;
+          console.log("deptInfo",this.deptInfo);
+          if(this.deptInfo.jiBie==2){
+            this.open = true;
+            this.title = "添加油品价格";
+            this.form.stationId=this.deptInfo.deptId;
+            this.form.stationNanme=this.deptInfo.deptName;
+          }else{
+              this.msgSuccess("请选择油站");
+          }
+      });
+      
+    },
+	  onOilNameChang(e){
+      let obj = {};
+      obj = this.oilNameOptions.find((item)=>{//这里的userList就是上面遍历的数据源
+        return item.dictLabel === e;//筛选出匹配数据
+      });
+     if(obj !=null &&obj.hasOwnProperty('dictLabel')){
+        if(obj.dictLabel==="非油品"){
+          this.editInfo = true;
+          this.form.oilPrice=0;
+        }else{
+          this.editInfo = false;
+        }
+      }
+     
     },
-
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -270,6 +291,7 @@ export default {
               this.getList();
             });
           } else {
+            console.log("form",this.form);
             addPrice(this.form).then(response => {
               this.msgSuccess("新增成功");
               this.open = false;
@@ -293,6 +315,8 @@ export default {
         this.form1.stationName=sss[0].stationNanme;
         this.form1.oilName=sss[0].oilName;
         this.form1.oilPriceId=sss[0].oilPriceId;
+        this.form1.oilAdjustPrice=sss[0].oilPrice;
+        this.form1.takeEffectStatus='1';
         this.open1= true;
         this.titleAdjust = "添加油品调价信息";
       }else if(this.ids.length==0){
@@ -360,7 +384,7 @@ export default {
     handleDelete(row) {
       const oilPriceIds = row.oilPriceId || this.ids;
 
-      this.$confirm('是否确认删除油品价格编号为"' + oilPriceIds + '"的数据项?', "警告", {
+      this.$confirm('是否确认删除油品价格', "警告", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"

+ 7 - 4
src/views/station/structure/index.vue

@@ -4,10 +4,9 @@
       <el-form-item  prop="carNumber">开班时间:{{opo.classStartDate}} 班结人:{{opo.classStructureMan}}
       </el-form-item>
       <el-form-item>
-        <el-button icon="el-icon-plus" v-if="isclose" size="mini" v-hasPermi="['station:structure:add']" @click="handleAdd">添加班结</el-button>
+        <el-button icon="el-icon-plus" type="primary" v-if="isclose" size="mini" v-hasPermi="['station:structure:add']" @click="handleAdd">添加班结</el-button>
       </el-form-item>
     </el-form>
-
     <!--按员工汇总-->
     <span  style="color:#ff9955;font-size:25px;" >|</span><span style="font-size:25px;">按员工汇总</span>
     <el-table v-loading="loading" show-summary :data="structureList"   :summary-method="getTotal">
@@ -403,8 +402,12 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.title = "添加班结管理";
+      if(this.structureList3 == null&&this.structureList1==null&& this.structureList2==null){
+        this.msgSuccess("没有要班结的数据");
+      }else{
+        this.open = true;
+        this.title = "添加班结管理";
+      }
     },
     getClassInfo(){
       listClass(this.queryParams).then(response => {

+ 312 - 15
src/views/station/summary/index.vue

@@ -30,27 +30,21 @@
       </el-form-item>
       <el-form-item>
         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="info" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
 
     <el-table v-loading="loading" :data="summaryList" >
       <el-table-column label="班结主键id" align="center" prop="id" v-if="false" />
       <el-table-column label="班次号" align="center" prop="classesNo" />
-      <el-table-column label="班次开始时间" align="center" prop="startDate" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
-        </template>
+      <el-table-column label="班次开始时间" align="center" prop="startDate" width="150">
       </el-table-column>
-      <el-table-column label="班次结束时间" align="center" prop="endDate" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
-        </template>
+      <el-table-column label="班次结束时间" align="center" prop="endDate" width="150">
       </el-table-column>
       <el-table-column label="油站id" align="center" prop="stationId" v-if="false" />
       <el-table-column label="油站名称" align="center" prop="stationName" />
       <el-table-column label="订单数" align="center" prop="orderNum" />
-      <el-table-column label="小票数量" align="center" prop="printNum" />
+      <el-table-column label="小票数量" align="center" prop="printNum" width="50"/>
       <el-table-column label="销量L" align="center" prop="saleLiters" />
       <el-table-column label="应收金额" align="center" prop="saleAmt" />
       <el-table-column label="实收金额" align="center" prop="amt" />
@@ -77,7 +71,6 @@
         </template>
       </el-table-column>
     </el-table>
-
     <pagination
       v-show="total>0"
       :total="total"
@@ -85,13 +78,54 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+    <!-- 查看班结数据 -->
+    <el-dialog :title="title" :visible.sync="open"  append-to-body class="uncon">
+      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="true" label-width="68px">
+        <el-form-item  prop="carNumber">
+          开班时间:{{opo.classStartDate}} 班结时间:{{opo.classStructureDate}}班结人:{{opo.classStructureMan}}
+        </el-form-item>
+      </el-form>
+      <!--按员工汇总-->
+      <span  style="color:#ff9955;font-size:15px;" >|</span><span style="font-size:15px;">按员工汇总</span>
+      <el-table v-loading="loading" show-summary :data="structureList"   :summary-method="getTotal">
+        <el-table-column label="员工姓名" align="center" prop="oilPersonnel" />
+        <el-table-column label="负责枪号" align="center" prop="oilGun" />
+        <el-table-column label="销量" align="center" prop="orderLiters" />
+        <el-table-column label="销额" align="center" prop="amt" />
+        <el-table-column label="销售笔数" align="center" prop="orderNo" />
+      </el-table>
+      <!--按油品汇总-->
+      <span  style="color:#ff9955;font-size:15px;" >|</span><span style="font-size:15px;">按油品汇总</span>
+      <el-table v-loading="loading" :data="structureList1"  show-summary   :summary-method="getTotal2" >
+        <el-table-column label="油品" align="center" prop="oilName"  />
+        <el-table-column label="负责枪号" align="center" prop="oilGun" />
+        <el-table-column label="销量" align="center" prop="orderLiters" />
+        <el-table-column label="销额" align="center" prop="amt" />
+        <el-table-column label="销售笔数" align="center" prop="orderNo" />
+      </el-table>
+      <!--按员工/支付方式汇总:    -->
+      <span  style="color:#ff9955;font-size:15px;" >|</span><span style="font-size:15px;">按员工/支付方式汇总</span>
+      <el-table v-loading="loading" :data="structureList3"  show-summary :summary-method="getTotal3" max-height="h-180">
+        <el-table-column label="员工姓名" align="center" prop="oilPersonnel"  />
+        <el-table-column label="负责枪号" align="center" prop="oilGun" />
+        <el-table-column label="微信笔数" align="center" prop="wxNum" />
+        <el-table-column label="支付宝笔数" align="center" prop="zfbNum" />
+        <el-table-column label="现金笔数" align="center" prop="xjNum" />
+        <el-table-column label="优惠" align="center" prop="discountAmt" />
+        <el-table-column label="优惠劵" align="center" prop="discountCouponAmt" />
+        <el-table-column label="微信金额" align="center" prop="wxAmt" />
+        <el-table-column label="支付宝金额" align="center" prop="zfbAmt" />
+        <el-table-column label="现金金额" align="center" prop="xjAmt" />
+        <el-table-column label="会员卡支付" align="center" prop="memberAmt"/>
+      </el-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { listSummary } from "@/api/station/summary";
 import { exportStructure } from "@/api/station/structure";
-import { stationinfo } from "@/api/station/gun";
+import { listPersonnelPayStructure,listClass,listPersonnelStructure,listOilStructure} from "@/api/station/structure";
 export default {
   name: "Summary",
   data() {
@@ -182,7 +216,16 @@ export default {
       form: {},
       // 表单校验
       rules: {
-      }
+      },
+      structureList: [],
+      structureList1: [],
+      structureList3: [],
+      opo:{
+        classStartDate:null,
+        classStructureMan:null,
+        classStructureDate:null,
+        classStructureNo:null
+      },
     };
   },
   created() {
@@ -193,8 +236,12 @@ export default {
     getList() {
       this.loading = true;
       this.queryParams.stationId=this.$store.selectDeptId;
+      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
+        this.queryParams.stationId =this.$store.state.user.deptId;
+      }
       listSummary(this.addDateRange(this.queryParams, this.dateRangeCreatedDate)).then(response => {
         this.summaryList = response.rows;
+        console.log("summaryList",this.summaryList);
         this.total = response.total;
         this.loading = false;
       });
@@ -237,13 +284,241 @@ export default {
       this.handleQuery();
     },
     handlelook(row){
-      this.$router.push({path:'/station/structure',query:{classesNo:row.classesNo,stationId:row.stationId,name:row.classesMan}});
+      //this.$router.push({path:'/station/structure',query:{classesNo:row.classesNo,stationId:row.stationId,name:row.classesMan}});
+      this.open = true;
+      this.title = "查看班结明细";
+       this.queryParams.classStructureMan=row.classesMan;
+      this.queryParams.classStructureNo=row.classesNo;
+      this.queryParams.stationId=row.stationId;
+      listClass(this.queryParams).then(response => {
+        this.opo = response.data;
+        this.getStructureList();
+        this.getStructureList2();
+        this.getStructureList3();
+      });
+    },
+    /** 查询班结管理列表 */
+    getStructureList() {
+      this.loading = true;
+      listPersonnelStructure(this.queryParams).then(response => {
+        this.structureList = response.rows;
+        this.loading = false;
+      });
+    },
+    getStructureList2() {
+      this.loading = true;
+      listOilStructure(this.queryParams).then(response => {
+        this.structureList1 = response.rows;
+        this.loading = false;
+      });
+    },
+    getStructureList3() {
+      this.loading = true;
+      listPersonnelPayStructure(this.queryParams).then(response => {
+        this.structureList3 = response.rows;
+        this.loading = false;
+      });
+    },
+    getTotal(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计';
+          return;
+        }
+        const values = data.map(item => Number(item[column.property]));
+        if (column.property === 'orderLiters') {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'amt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'orderNo'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(0);
+        } else {
+          sums[index] = '';
+        }
+      });
+      return sums;
+    },
+    getTotal2(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计';
+          return;
+        }
+        const values = data.map(item => Number(item[column.property]));
+        if (column.property === 'orderLiters') {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'amt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'orderNo'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(0);
+        } else {
+          sums[index] = '';
+        }
+      });
+      return sums;
+    },
+    getTotal3(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计';
+          return;
+        }
+        const values = data.map(item => Number(item[column.property]));
+        if (column.property === 'wxNum') {
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(0);
+        }else if(column.property === 'zfbNum'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(0);
+        }else if(column.property === 'xjNum'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(0);
+        }else if(column.property === 'discountAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        }else if(column.property === 'discountCouponAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        } else if(column.property === 'wxAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        } else if(column.property === 'zfbAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        } else if(column.property === 'xjAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        } else if(column.property === 'memberAmt'){
+          sums[index] = values.reduce((prev, curr) => {
+            const value = Number(curr);
+            if (!isNaN(value)) {
+              return prev + curr;
+            } else {
+              return prev;
+            }
+          }, 0);
+          sums[index]=sums[index].toFixed(2);
+        } else {
+          sums[index] = '';
+        }
+      });
+      return sums;
     },
     /** 导出按钮操作 */
     handleExport(row) {
       const classesNo = row.classesNo;
       this.queryParam.classStructureNo=classesNo;
-      this.queryParam.stationId=this.$store.selectDeptId;
+      this.queryParam.stationId =row.stationId;
       const queryParams = this.queryParam;
       this.$confirm('是否确认导出所有班结数据项?', "警告", {
         confirmButtonText: "确定",
@@ -258,3 +533,25 @@ export default {
   }
 };
 </script>
+<style lang="scss">
+.uncon {
+  .el-table {
+    overflow: auto;
+  }
+  .el-table--scrollable-x .el-table__body-wrapper {
+    overflow-x: visible;
+  }
+  .el-table__body-wrapper {
+    overflow: visible;
+  }
+  .el-table__header-wrapper {
+    overflow: visible;
+  }
+  .el-table__footer-wrapper {
+    overflow: visible;
+  }
+  .el-table::after {
+    position: relative !important;
+  }
+}
+</style>

+ 2 - 1
vue.config.js

@@ -19,7 +19,8 @@ module.exports = {
   // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
   publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
   // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
-  outputDir: 'dist',
+  //outputDir: 'dist',
+  outputDir: 'demo',
   // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
   assetsDir: 'static',
   // 是否开启eslint保存检测,有效值:ture | false | 'error'