chenrui 11 mesiacov pred
rodič
commit
15a2c59723

+ 18 - 11
src/views/power/role/menuModal.vue

@@ -74,22 +74,23 @@ export default {
   data () {
     return {
       spinning: false,
-      treeData: [], //
-      priceOptions: [],
+      treeData: [], // 功能权限列表数据
+      priceOptions: [], // 价格权限列表数据
       titleText: '', // 弹窗标题
-      expandedKeys: [],
-      autoExpandParent: true,
-      checkedKeys: [],
-      halfCheckedKeys: [],
-      checkedData: [],
-      authPriceData: [],
-      isshow: this.visible,
+      expandedKeys: [], // 展开指定的树节点
+      autoExpandParent: true, // 是否自动展开父节点
+      checkedKeys: [], // 选中节点数据
+      halfCheckedKeys: [], // 半选节点值
+      checkedData: [], // 所有已选节点值
+      authPriceData: [], // 价格权限值
+      isshow: this.visible, // 显示弹窗
+      // form 表单label布局
       formItemLayout: {
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
       },
-      authAllPrice: [],
-      leafNode: [],
+      authAllPrice: [], // 所有已选价格权限值
+      leafNode: [], // 子节点集合
       checkLeafNode: [], // 选中节点集合
       priceCheckNode: [], // 已选价格集合
       form: {}, // 提交参数
@@ -99,10 +100,12 @@ export default {
     }
   },
   methods: {
+    // 展开/收起节点
     onExpand (expandedKeys) {
       this.expandedKeys = expandedKeys
       // this.autoExpandParent = false
     },
+    // 点击复选框
     onCheck (checkedKeys, info) {
       // console.log(checkedKeys, info)
       this.halfCheckedKeys = info.halfCheckedKeys
@@ -149,6 +152,7 @@ export default {
         }
       }
     },
+    // 选择价格权限 change
     onPriceChange (val) {
       // 全选
       if (this.authAllPrice.length < val.length) {
@@ -198,6 +202,7 @@ export default {
         }
       })
     },
+    // 重置
     clear () {
       this.form.resetFields()
       this.titleText = ''
@@ -205,6 +210,7 @@ export default {
       this.checkedKeys = []
       this.expandedKeys = []
     },
+    // 是否是价格权限节点
     isPriceNode (node) {
       const a = node.code.split('_')
       const c = this.priceOptions.find(item => item.value == a[a.length - 1])
@@ -287,6 +293,7 @@ export default {
         }
       }
     },
+    // 初始化
     pageInit () {
       this.id = this.nowData.role.id
       this.titleText = (this.nowData.type == 1 ? '功能权限分配' : '价格权限分配') + '(' + this.nowData.role.name + ')'

+ 28 - 24
src/views/power/role/roleList.vue

@@ -2,7 +2,8 @@
   <div>
     <a-card size="small" :bordered="false" class="roleList-wrap searchBoxNormal">
       <div ref="tableSearch" class="table-page-search-wrapper">
-        <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <!-- 搜索条件 -->
+        <a-form layout="inline" id="roleList-form" @keyup.enter.native="$refs.table.refresh(true)">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-item label="角色名称">
@@ -29,10 +30,12 @@
       </div>
     </a-card>
     <a-card size="small" :bordered="false">
+      <!-- 操作按钮 -->
       <a-spin :spinning="spinning" tip="Loading...">
         <div class="table-operator">
           <a-button type="primary" v-if="$hasPermissions('B_power_role_add')" @click="openModal" id="roleList-openModal">新增</a-button>
         </div>
+        <!-- 列表 -->
         <s-table
           class="sTable fixPagination"
           ref="table"
@@ -51,7 +54,7 @@
               v-if="$hasPermissions('B_power_role_enable')"
               checkedChildren="启用"
               unCheckedChildren="禁用"
-              id="roleList-isEnable"
+              :id="'roleList-isEnable-btn'+record.id"
               v-model="record.isEnable"
               @change="changeFlagHandle(text, record)" />
             <span v-else>{{ record.isEnable==1?'已启用':'已禁用' }}</span>
@@ -66,6 +69,7 @@
               size="small"
               type="link"
               class="button-info"
+              :id="'roleList-usePower-btn'+record.id"
               v-if="$hasPermissions('M_power_role_menu')"
               @click="openMenuModal(record,1)"
             >
@@ -75,6 +79,7 @@
               size="small"
               type="link"
               class="button-info"
+              :id="'roleList-pricePower-btn'+record.id"
               v-if="$hasPermissions('M_power_role_menu')"
               @click="openMenuModal(record,0)"
             >
@@ -84,6 +89,7 @@
               size="small"
               type="link"
               class="button-info"
+              :id="'roleList-edit-btn'+record.id"
               v-if="$hasPermissions('B_power_role_edit')"
               @click="handleEdit(record)"
             >
@@ -93,6 +99,7 @@
               size="small"
               type="link"
               class="button-error"
+              :id="'roleList-del-btn'+record.id"
               v-if="!record.isEnable && $hasPermissions('B_power_role_del')"
               @click="delect(record)"
             >
@@ -102,7 +109,9 @@
           </span>
         </s-table>
       </a-spin>
+      <!-- 添加角色弹窗 -->
       <roleModal :visible="showModal" @refresh="$refs.table.refresh(true)" :nowData="itemData" @close="closeRole"></roleModal>
+      <!-- 价格权限、功能权限弹窗 -->
       <menuModal :visible="showMenuModal" @refresh="$refs.table.refresh(true)" :nowData="menuData" @close="showMenuModal = false"></menuModal>
     </a-card>
   </div>
@@ -110,40 +119,29 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import {
-  STable,
-  VSelect
-} from '@/components'
+// 组件
+import { STable, VSelect } from '@/components'
 import roleModal from './roleModal.vue'
 import menuModal from './menuModal.vue'
-import {
-  getPowerRoleList,
-  updateEnableStatus,
-  delectRolePower,
-  getMenuList
-} from '@/api/power-role.js'
+// 接口
+import { getPowerRoleList, updateEnableStatus, delectRolePower, getMenuList } from '@/api/power-role.js'
 export default {
   name: 'PowerRoleList',
   mixins: [commonMixin],
-  components: {
-    STable,
-    VSelect,
-    roleModal,
-    menuModal
-  },
+  components: { STable, VSelect, roleModal, menuModal },
   data () {
     return {
       spinning: false,
-      tableHeight: 0,
+      tableHeight: 0, // 表格高度
       // 查询参数
       queryParam: {
-        name: '',
-        isEnable: ''
+        name: '', // 角色名称
+        isEnable: ''// 状态
       },
-      showModal: false,
-      showMenuModal: false,
+      showModal: false, // 角色弹窗
+      showMenuModal: false, // 权限弹窗
       itemData: {}, // 编辑行数据
-      menuData: {},
+      menuData: {}, // 角色列表
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
@@ -156,10 +154,12 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.spinning = true
+        // 获取列表数据 有分页
         return getPowerRoleList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
+            // 计算表格序号
             const no = (data.pageNo - 1) * data.pageSize
             for (let i = 0; i < data.list.length; i++) {
               const _item = data.list[i]
@@ -180,6 +180,7 @@ export default {
     })
   },
   methods: {
+    // 关闭角色弹窗
     closeRole () {
       this.showModal = false
       this.itemData = {}
@@ -239,6 +240,7 @@ export default {
         }
       })
     },
+    // 编辑
     handleEdit (row) {
       this.showModal = true
       this.itemData = row
@@ -261,12 +263,14 @@ export default {
         }
       })
     },
+    // 初始化
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
     },
+    // 计算表格高度
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 236

+ 18 - 15
src/views/power/role/roleModal.vue

@@ -16,8 +16,7 @@
           :model="form"
           :rules="rules"
           :label-col="formItemLayout.labelCol"
-          :wrapper-col="formItemLayout.wrapperCol"
-        >
+          :wrapper-col="formItemLayout.wrapperCol" >
           <!-- 用户名称 -->
           <a-form-model-item label="角色名称" prop="name">
             <a-input
@@ -30,9 +29,9 @@
           </a-form-model-item>
           <!-- 状态 -->
           <a-form-model-item label="状态" prop="isEnable">
-            <a-radio-group name="radioGroup" v-model="form.isEnable" placeholder="请选择状态">
-              <a-radio :value="1">启用</a-radio>
-              <a-radio :value="0">禁用</a-radio>
+            <a-radio-group id="roleEdit-isEnable" name="radioGroup" v-model="form.isEnable" placeholder="请选择状态">
+              <a-radio :value="1" id="roleEdit-isEnable1">启用</a-radio>
+              <a-radio :value="0" id="roleEdit-isEnable0">禁用</a-radio>
             </a-radio-group>
           </a-form-model-item>
           <a-form-model-item label="角色描述" prop="remarks">
@@ -44,8 +43,8 @@
               placeholder="请输入描述(最多500个字符)"/>
           </a-form-model-item>
           <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
-            <a-button :style="{ marginRight: '10px' }" @click="isshow=false">取消</a-button>
-            <a-button type="primary" @click="handleSubmit()">保存</a-button>
+            <a-button id="roleEdit-cancel" :style="{ marginRight: '10px' }" @click="isshow=false">取消</a-button>
+            <a-button id="roleEdit-save" type="primary" @click="handleSubmit()">保存</a-button>
           </a-form-model-item>
         </a-form-model>
       </a-spin>
@@ -55,14 +54,14 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+// 组件
 import { STable, VSelect } from '@/components'
+// 接口
 import { saveRolePower } from '@/api/power-role.js'
 export default {
   name: 'RoleModal',
   mixins: [commonMixin],
-  components: {
-    STable, VSelect
-  },
+  components: { STable, VSelect },
   props: {
     visible: {
       type: Boolean,
@@ -77,18 +76,21 @@ export default {
   },
   data () {
     return {
-      titleText: '添加角色',
-      isshow: this.visible,
+      titleText: '添加角色', // 弹窗标题
+      isshow: this.visible, // 打开关闭弹窗
       spinning: false,
+      // form表单label布局
       formItemLayout: {
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
       },
+      // 提交参数
       form: {
-        name: '',
-        isEnable: undefined,
-        remarks: ''
+        name: '', // 角色名称
+        isEnable: undefined, // 状态
+        remarks: ''// 备注
       },
+      // 表单验证规则
       rules: {
         name: [ { required: true, message: '请输入角色名称', trigger: 'blur' }, { pattern: '^[^<|>]{1,30}$', message: '请输入不含<或>的字符,最多30个字符' } ],
         isEnable: [ { required: true, message: '请选择状态', trigger: 'change' } ]
@@ -130,6 +132,7 @@ export default {
         }
       })
     },
+    // 重置
     resetForm () {
       this.$refs.ruleForm.resetFields()
       this.form.name = ''

+ 12 - 13
src/views/promotionRulesManagement/dealerPromotions/list.vue

@@ -82,8 +82,7 @@
           ref="table"
           :style="{ height: tableHeight+70+'px' }"
           size="small"
-          :rowKey="(record) => record.sparePartsReturnNo"
-          rowKeyName="sparePartsReturnNo"
+          :rowKey="(record) => record.id"
           :columns="columns"
           :data="loadData"
           :scroll="{ y: tableHeight }"
@@ -91,7 +90,7 @@
           bordered>
           <!-- 促销名称 -->
           <template slot="promotionName" slot-scope="text, record">
-            <div :id="'promotionList-info-'+record.sparePartsReturnNo" v-if="$hasPermissions('B_dealerPromotionDetail')" class="link-bule nameBox text-overflows2" @click="handleDetail(record)">{{ record.title }}</div>
+            <div :id="'promotionList-info-'+record.id" v-if="$hasPermissions('B_dealerPromotionDetail')" class="link-bule nameBox text-overflows2" @click="handleDetail(record)">{{ record.title }}</div>
             <div v-else class="nameBox text-overflows2">{{ record.title }}</div>
           </template>
           <!-- 促销时间-->
@@ -100,15 +99,15 @@
           </template>
           <!-- 参与客户 -->
           <template slot="joinCustomers" slot-scope="text, record">
-            <span class="joinCustomer" :id="'promotionList-customers-'+record.sparePartsReturnNo" v-if="record.dealerScope ==='ALL_DEALER'" @click="handleCustomers(record)">全部客户</span>
-            <span class="joinCustomer" :id="'promotionList-customers-'+record.sparePartsReturnNo" v-else @click="handleCustomers(record)">共有<span style="color:#39f;vertical-align:top;">{{ record.dealerQty ||0 }}</span>个客户</span>
+            <span class="joinCustomer" :id="'promotionList-customers-'+record.id" v-if="record.dealerScope ==='ALL_DEALER'" @click="handleCustomers(record)">全部客户</span>
+            <span class="joinCustomer" :id="'promotionList-customers-'+record.id" v-else @click="handleCustomers(record)">共有<span style="color:#39f;vertical-align:top;">{{ record.dealerQty ||0 }}</span>个客户</span>
             <a-badge count="审" v-show="record.dealerAuditFlag == 1 &&(record.state==='NOT_START'||record.state==='RUNNING') " :number-style="{ backgroundColor: '#F5222D', zoom:'80%' }" />
           </template>
           <!-- 发布状态 -->
           <template slot="releaseStatus" slot-scope="text, record">
             <a-switch
               v-if="$hasPermissions('B_dealerPromotionStatus')"
-              :id="'promotionList-enable-'+record.sparePartsReturnNo"
+              :id="'promotionList-enable-'+record.id"
               @change="changeStatus(record)"
               :disabled="record.state!='NOT_START' && record.state!='RUNNING'"
               :checked="record.enabledFlag == 1 ? true : false"></a-switch>
@@ -123,49 +122,49 @@
               class="button-warning"
               @click="handleSetRules(record)"
               v-if="$hasPermissions('B_dealerPromotionRules')&&(record.state =='WAIT_SUBMIT'||record.state == 'AUDIT_REJECT')"
-              :id="'promotionList-examine-btn'+record.sparePartsReturnNo">规则设置</a-button>
+              :id="'promotionList-examine-btn'+record.id">规则设置</a-button>
             <a-button
               size="small"
               type="link"
               v-if="$hasPermissions('B_dealerPromotionEdit')&&(record.state == 'WAIT_SUBMIT' ||record.state == 'AUDIT_REJECT')"
               @click="handleEdit(record)"
               class="button-info"
-              :id="'promotionList-edit-btn'+record.sparePartsReturnNo">编辑</a-button>
+              :id="'promotionList-edit-btn'+record.id">编辑</a-button>
             <a-button
               size="small"
               type="link"
               v-if="$hasPermissions('B_dealerPromotionAudit')&&record.state == 'WAIT_AUDIT'"
               @click="handleCheck(record)"
               class="button-info"
-              :id="'promotionList-audit-btn'+record.sparePartsReturnNo">审核</a-button>
+              :id="'promotionList-audit-btn'+record.id">审核</a-button>
             <a-button
               size="small"
               type="link"
               v-if="$hasPermissions('B_editTime')&&(record.state == 'NOT_START' || record.state=='RUNNING' ||record.state == 'IS_OVER')"
               @click="handleTime(record)"
               class="button-info"
-              :id="'promotionList-editTime-btn'+record.sparePartsReturnNo">时间变更</a-button>
+              :id="'promotionList-editTime-btn'+record.id">时间变更</a-button>
             <a-button
               size="small"
               type="link"
               v-if="$hasPermissions('B_overActive')&&(record.state == 'NO_START' || record.state=='RUNNING')"
               @click="handleEnd(record)"
               class="button-info"
-              :id="'promotionList-edit-btn'+record.sparePartsReturnNo">终止</a-button>
+              :id="'promotionList-edit-btn'+record.id">终止</a-button>
             <a-button
               size="small"
               type="link"
               v-if="$hasPermissions('B_dealerPromotionDel')&&(record.state == 'WAIT_SUBMIT'||record.state == 'AUDIT_REJECT')"
               @click="handleDel(record)"
               class="button-error"
-              :id="'promotionList-del-btn'+record.sparePartsReturnNo">删除</a-button>
+              :id="'promotionList-del-btn'+record.id">删除</a-button>
             <a-button
               size="small"
               type="link"
               v-if="record.state != 'AUDIT_REJECT' &&$hasPermissions('B_dealerPromotionCopy')"
               @click="handleCopyModal(record)"
               class="button-info"
-              :id="'promotionList-copy-btn'+record.sparePartsReturnNo">复制</a-button>
+              :id="'promotionList-copy-btn'+record.id">复制</a-button>
           </template>
         </s-table>
       </a-spin>

+ 95 - 48
src/views/promotionRulesManagement/dealerPromotions/sendProductsModal.vue

@@ -1,7 +1,7 @@
 <template>
   <a-modal
     centered
-    class="promotionList-basicInfo-modal"
+    class="promotionList-modal"
     :footer="null"
     :maskClosable="false"
     title="规则设置"
@@ -10,7 +10,7 @@
     width="70%">
     <a-spin :spinning="spinning" tip="Loading...">
       <a-form-model
-        id="promotionList-basicInfo-form"
+        id="promotionList-form"
         ref="ruleForm"
         :model="form"
         :rules="rules"
@@ -27,11 +27,11 @@
         </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
           <div class="fixWidthBox">
-            <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="changeGateFlag">
-              <a-radio-button value="1">
+            <a-radio-group v-model="form.gateFlag" id="promotionList-gateFlag" button-style="solid" size="small" @change="changeGateFlag">
+              <a-radio-button value="1" id="promotionList-gateFlag1">
               </a-radio-button>
-              <a-radio-button value="0">
+              <a-radio-button value="0" id="promotionList-gateFlag0">
               </a-radio-button>
             </a-radio-group>
@@ -47,19 +47,43 @@
               @change="changeGateTypeFlag"
               allowClear></v-select>
             <div v-if="form.gateType==='RATIO_AMOUNT'">
-              购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="99999999" :precision="2" size="small"/> %作为配额
+              购买门槛产品金额 <a-input-number
+                v-model="form.gateValue"
+                id="promotionList-gateValue"
+                :min="0"
+                :max="99999999"
+                :precision="2"
+                size="small"/> %作为配额
               <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买正价产品,根据门槛金额动态调整配额">
                 <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :min="0" :max="99999999" :precision="2" size="small"/>元,不限制配额。
+              购买门槛产品满最低金额 <a-input-number
+                id="promotionList-gateValue1"
+                v-model="form.gateValue"
+                :min="0"
+                :max="99999999"
+                :precision="2"
+                size="small"/>元,不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买满
-              <a-input-number v-model="form.gateValue" :min="0" :max="99999999" :precision="2" size="small"/>
+              <a-input-number
+                id="promotionList-gateValue2"
+                v-model="form.gateValue"
+                :min="0"
+                :max="99999999"
+                :precision="2"
+                size="small"/>
               元门槛产品,可使用
-              <a-input-number v-model="form.quotaAmount" :min="0" :max="99999999" :precision="2" size="small"/>
+              <a-input-number
+                id="promotionList-quotaAmount"
+                v-model="form.quotaAmount"
+                :min="0"
+                :max="99999999"
+                :precision="2"
+                size="small"/>
               元配额,采购规则中的正价商品(配额算销售额)
             </div>
           </div>
@@ -69,6 +93,7 @@
             <div class="ruleDescList" v-for="(con,i) in fullGiftRuleList" :key="i">
               <span v-if="fullGiftRuleList.length>1">{{ i*1+1 }}、</span>
               <a-select
+                id="promotionList-regularSameFlag"
                 default-value="1"
                 :disabled="i!=0"
                 v-model="form.regularSameFlag"
@@ -76,37 +101,40 @@
                 size="small"
                 @change="handleFullGift"
                 allowClear>
-                <a-select-option value="1">
+                <a-select-option value="1" id="promotionList-regularSameFlag1">
                   同款
                 </a-select-option>
-                <a-select-option value="0">
+                <a-select-option value="0" id="promotionList-regularSameFlag0">
                   不同款
                 </a-select-option>
               </a-select>
               产品购买满
               <a-input-number
                 v-model="con.regularValue"
+                id="promotionList-regularValue"
                 :min="i!=0?fullGiftRuleList[i-1].regularValue:0"
                 :step="1"
                 :max="99999999"
                 :precision="form.regularUnit==='YUAN'?2:0"
                 size="small"/>
               <a-select
+                id="promotionList-regularUnit"
                 default-value="GE"
                 :disabled="i!=0"
                 v-model="form.regularUnit"
                 style="width: 50px;margin-left:5px;"
                 size="small"
                 @change="handleChangeUnit">
-                <a-select-option value="GE">
+                <a-select-option value="GE" id="promotionList-regularUnit-ge">
                 </a-select-option>
-                <a-select-option value="YUAN">
+                <a-select-option value="YUAN" id="promotionList-regularUnit-yuan">
                 </a-select-option>
               </a-select>
               正价产品,送
               <a-input-number
+                id="promotionList-promotionValue"
                 v-model="con.promotionValue"
                 :min="0"
                 :step="1"
@@ -114,12 +142,12 @@
                 :max="99999999"
                 size="small"/>
               个促销产品
-              <a-button type="link" v-if="i==0&&fullGiftRuleList&&fullGiftRuleList.length<5" class="button-info" @click="addFullGiftRule">+新增</a-button>
-              <a-button type="link" v-if="i!=0" class="button-error" @click="delFullGiftRule(con.id)">删除</a-button>
+              <a-button type="link" id="promotionList-add" v-if="i==0&&fullGiftRuleList&&fullGiftRuleList.length<5" class="button-info" @click="addFullGiftRule">+新增</a-button>
+              <a-button type="link" id="promotionList-del" v-if="i!=0" class="button-error" @click="delFullGiftRule(con.id)">删除</a-button>
             </div>
           </div>
           <div class="ruleDescList">
-            <a-checkbox :checked="form.restrictFlag === '1'" size="small" @change="onChange">
+            <a-checkbox id="promotionList-restrictFlag" :checked="form.restrictFlag === '1'" size="small" @change="onChange">
               限制正价产品款数
             </a-checkbox>
             <a-input-number
@@ -130,18 +158,19 @@
               :max="99999999"
               :precision="0"
               size="small"
+              id="promotionList-restrictCategory"
               style="margin-right:10px;"/>
-            <a-checkbox :checked="form.convertExpenseFlag==='1'" size="small" @change="onChangeConvert">
+            <a-checkbox id="promotionList-convertExpenseFlag" :checked="form.convertExpenseFlag==='1'" size="small" @change="onChangeConvert">
               可转费用报销单
             </a-checkbox>
           </div>
         </a-form-model-item>
         <a-form-model-item label="数量叠加" prop="accrualFlag">
-          <a-radio-group v-model="form.accrualFlag" button-style="solid" size="small">
-            <a-radio value="1">
+          <a-radio-group id="promotionList-accrualFlag" v-model="form.accrualFlag" button-style="solid" size="small">
+            <a-radio value="1" id="promotionList-accrualFlag1">
             </a-radio>
-            <a-radio value="0">
+            <a-radio value="0" id="promotionList-accrualFlag0">
             </a-radio>
           </a-radio-group>
@@ -149,11 +178,17 @@
         </a-form-model-item>
         <a-form-model-item label="促销品与正品一致" prop="regularPromotionSameFlag">
           <div class="fixWidthBox">
-            <a-radio-group v-model="form.regularPromotionSameFlag" button-style="solid" size="small" :disabled="form.regularSameFlag==0" @change="handleSameFlag">
-              <a-radio-button value="1">
+            <a-radio-group
+              id="promotionList-regularPromotionSameFlag"
+              v-model="form.regularPromotionSameFlag"
+              button-style="solid"
+              size="small"
+              :disabled="form.regularSameFlag==0"
+              @change="handleSameFlag">
+              <a-radio-button value="1" id="promotionList-regularPromotionSameFlag1">
               </a-radio-button>
-              <a-radio-button value="0">
+              <a-radio-button value="0" id="promotionList-regularPromotionSameFlag0">
               </a-radio-button>
             </a-radio-group>
@@ -162,14 +197,14 @@
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
         <div class="flex" style="margin-bottom:10px;">
-          <a-radio-group v-model="chooseVal" button-style="solid" @change="onChooseVal">
-            <a-radio-button value="a" v-show="form.gateFlag==='1'">
+          <a-radio-group id="promotionList-chooseVal" v-model="chooseVal" button-style="solid" @change="onChooseVal">
+            <a-radio-button value="a" id="promotionList-chooseVal-a" v-show="form.gateFlag==='1'">
               门槛产品
             </a-radio-button>
-            <a-radio-button value="b">
+            <a-radio-button value="b" id="promotionList-chooseVal-b">
               正价产品
             </a-radio-button>
-            <a-radio-button :value="'c'+item.id" v-for="(item,i) in fullGiftRuleList" :key="i" v-show="form.regularPromotionSameFlag==='0'">
+            <a-radio-button :id="'promotionList-chooseVal-c'+item.id" :value="'c'+item.id" v-for="(item,i) in fullGiftRuleList" :key="i" v-show="form.regularPromotionSameFlag==='0'">
               {{ fullGiftRuleList.length>1?'促销产品('+'阶梯'+(i*1+1)+')':'促销产品' }}
             </a-radio-button>
           </a-radio-group>
@@ -179,8 +214,8 @@
               type="link"
               class="button-info"
               @click="openGuideModal=true"
-              id="promotionList-edit-btn">+导入产品</a-button>
-            <a-button type="link" class="button-error" @click="handlePreview">预览</a-button>
+              id="promotionList-import">+导入产品</a-button>
+            <a-button type="link" id="promotionList-preview" class="button-error" @click="handlePreview">预览</a-button>
           </div>
         </div>
         <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
@@ -188,8 +223,8 @@
         <div v-show="chooseVal==('c'+item.id)" v-for="(item,i) in fullGiftRuleList" :key="item.id"><tableType1 :unitTypeList="unitTypeDataList" :ref="'offerProduct'+i"></tableType1></div>
       </a-card>
       <div class="btn-cont">
-        <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
-        <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" :loading="loadingSave" @click="handleSave">确定</a-button>
+        <a-button id="promotionList-cancel" @click="isShow = false">取消</a-button>
+        <a-button style="margin-left: 15px;" type="primary" id="promotionList-save" :loading="loadingSave" @click="handleSave">确定</a-button>
       </div>
     </a-spin>
     <!-- 导入产品 -->
@@ -201,12 +236,14 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+// 组件
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
-import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
 import ImportGuideModal from './importGuideModal.vue'
-import { getLookUpData } from '@/api/data'
 import productPreviewModal from './productPreviewModal'
+// 接口
+import { getLookUpData } from '@/api/data'
+import { promotionSave, getRuleDetail, getNewScopeSn } from '@/api/promotion'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -229,32 +266,34 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       spinning: false,
+      // form表单  label布局
       formItemLayout: {
         labelCol: { span: 4 },
         wrapperCol: { span: 17 }
       },
-      fullGiftRuleList: [],
+      fullGiftRuleList: [], // 促销产品数据
       form: {
         giveRuleType: 'RATIO', // 满赠规则类型: SUM_MONEY[金额叠加] / RATIO[按比例]   满产品送产品写死为: 按比例
         promotionRuleType: 'BUY_PROD_GIVE_PROD', // 买产品送产品
         description: '', // 简称
         gateFlag: '0', // 门槛
-        gateType: undefined,
-        gateValue: undefined,
-        quotaAmount: undefined,
+        gateType: undefined, // 选择门槛类型
+        gateValue: undefined, // 门槛值
+        quotaAmount: undefined, // 门槛配额
         regularSameFlag: '1', // 满赠规则  同款不同款商品
-        regularUnit: 'GE',
+        regularUnit: 'GE', // 单位
         restrictFlag: '0', // 限制正价产品款数
         convertExpenseFlag: '0', // 转费用报销标记
-        restrictCategory: '',
+        restrictCategory: '', // 正价产品款数
         accrualFlag: '1', // 数量叠加
-        regularPromotionSameFlag: '1',
-        giftProductMap: {},
-        gateInfo: undefined,
-        ruleInfo: undefined,
-        gateUnit: undefined,
-        quotaUnit: undefined
+        regularPromotionSameFlag: '1', // 促销品与正品是否一致
+        giftProductMap: {}, // 阶梯促销产品集合
+        gateInfo: undefined, // 门槛产品规则描述
+        ruleInfo: undefined, // 正价产品规则描述
+        gateUnit: undefined, // 门槛产品单位
+        quotaUnit: undefined// 门槛配额单位
       },
+      // 表单验证规则
       rules: {
         description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
@@ -262,12 +301,12 @@ export default {
         accrualFlag: [{ required: true, message: '请选择数量是否叠加', trigger: 'change' }],
         regularPromotionSameFlag: [{ required: true, message: '请选择促销品与正品是否一致', trigger: 'change' }]
       },
-      chooseVal: 'a',
+      chooseVal: 'a', // a门槛产品 b正价产品 c 或者c+id促销产品  促销阶梯产品
       openGuideModal: false, // 导入弹窗
       id: null,
       code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
-      unitTypeDataList: [],
-      loadingSave: false,
+      unitTypeDataList: [], // 起订量数据
+      loadingSave: false, // 提交按钮加载状态
       openProductModal: false, // 预览弹窗
       previewList: []// 预览值
     }
@@ -315,6 +354,7 @@ export default {
     closeGuideModel () {
       this.openGuideModal = false
     },
+    // 导入成功
     hanldeOk (arr) {
       if (this.chooseVal == 'a') {
         this.$refs['cillProduct'].importRow(arr)
@@ -332,6 +372,7 @@ export default {
     onChange (e) {
       this.form.restrictFlag = e.target.checked ? '1' : '0'
     },
+    // 可转费用报销单
     onChangeConvert (e) {
       this.form.convertExpenseFlag = e.target.checked ? '1' : '0'
     },
@@ -346,11 +387,13 @@ export default {
         this.chooseVal = 'a'
       }
     },
+    // 促销品与正品一致
     handleSameFlag (e) {
       if (e.target.value != '0') {
         this.chooseVal = this.form.gateFlag == '1' ? 'a' : 'b'
       }
     },
+    // 门槛与配额设置要求
     changeGateTypeFlag (val) {
       this.form.gateType = val
       this.form.gateValue = undefined
@@ -613,6 +656,7 @@ export default {
         _this.spinning = false
       })
     },
+    // 重组所需回显数据
     newData (list) {
       list.forEach(con => {
         // 品牌
@@ -668,6 +712,7 @@ export default {
       })
       return list
     },
+    // 重组起订量等数据
     getUnitTypeList () {
       const _this = this
       getLookUpData({
@@ -747,10 +792,12 @@ export default {
         }
       }
     },
+    // 关闭选择产品弹窗
     closeProductModal () {
       this.previewList = []
       this.openProductModal = false
     },
+    // 选择显示产品类型
     onChooseVal (e) {
       this.chooseVal = e.target.value
     }

+ 86 - 35
src/views/promotionRulesManagement/dealerPromotions/specialOfferModal.vue

@@ -27,11 +27,11 @@
         </a-form-model-item>
         <a-form-model-item label="规则门槛" prop="gateFlag">
           <div class="fixWidthBox">
-            <a-radio-group v-model="form.gateFlag" button-style="solid" size="small" @change="handleChange">
-              <a-radio-button value="1">
+            <a-radio-group id="promotionList-gateFlag" v-model="form.gateFlag" button-style="solid" size="small" @change="handleChange">
+              <a-radio-button value="1" id="promotionList-gateFlag1">
               </a-radio-button>
-              <a-radio-button value="0">
+              <a-radio-button value="0" id="promotionList-gateFlag0">
               </a-radio-button>
             </a-radio-group>
@@ -47,33 +47,64 @@
               @change="changeGateTypeFlag"
               allowClear></v-select>
             <div v-if="form.gateType==='RATIO_AMOUNT'">
-              购买门槛产品金额 <a-input-number v-model="form.gateValue" :min="0" :max="99999999" :precision="2" size="small"/> %作为配额
+              购买门槛产品金额 <a-input-number
+                id="promotionList-gateValue"
+                v-model="form.gateValue"
+                :min="0"
+                :max="99999999"
+                :precision="2"
+                size="small"/> %作为配额
               <a-tooltip title="如:填写100%,则购买10000元门槛产品,可享受10000配额购买特价产品,根据门槛金额动态调整配额">
                 <a-icon type="question-circle" theme="filled" :style="{ fontSize: '14px', color: 'gray' }"/>
               </a-tooltip>
             </div>
             <div v-if="form.gateType==='MIN_AMOUNT'">
-              购买门槛产品满最低金额 <a-input-number v-model="form.gateValue" :min="0" :max="99999999" :precision="2" size="small"/>元,不限制配额。
+              购买门槛产品满最低金额 <a-input-number
+                id="promotionList-gateValue"
+                v-model="form.gateValue"
+                :min="0"
+                :max="99999999"
+                :precision="2"
+                size="small"/>元,不限制配额。
             </div>
             <div class="ruleDescList" v-if="form.gateType==='FIXED_AMOUNT'">
               购买每满
-              <a-input-number v-model="form.gateValue" :max="99999999" :min="0" :precision="form.gateUnit=='YUAN'?2:0" size="small"/>
-              <a-select default-value="GE" v-model="form.gateUnit" style="width: 50px;margin-left:5px;" size="small" @change="handleUnit">
-                <a-select-option value="GE">
+              <a-input-number
+                v-model="form.gateValue"
+                id="promotionList-gateValue"
+                :max="99999999"
+                :min="0"
+                :precision="form.gateUnit=='YUAN'?2:0"
+                size="small"/>
+              <a-select
+                default-value="GE"
+                id="promotionList-gateUnit"
+                v-model="form.gateUnit"
+                style="width: 50px;margin-left:5px;"
+                size="small"
+                @change="handleUnit">
+                <a-select-option value="GE" id="promotionList-gateUnit-ge">
                 </a-select-option>
-                <a-select-option value="YUAN">
+                <a-select-option value="YUAN" id="promotionList-gateUnit-yuan">
                 </a-select-option>
               </a-select>
               门槛产品,可采购
-              <a-input-number v-model="form.quotaAmount" :max="99999999" :min="0" :precision="0" size="small"/>
+              <a-input-number
+                v-model="form.quotaAmount"
+                id="promotionList-quotaAmount"
+                :max="99999999"
+                :min="0"
+                :precision="0"
+                size="small"/>
               个特价产品(配额算销售额)
             </div>
           </div>
         </a-form-model-item>
         <a-form-model-item label="特价规则" prop="discountType">
           <a-select
+            id="promotionList-discountType"
             default-value="0"
             v-model="form.discountType"
             placeholder="请选择"
@@ -81,13 +112,13 @@
             size="small"
             @change="handleDiscountType"
             allowClear>
-            <a-select-option value="0">
+            <a-select-option value="0" id="promotionList-discountType0">
               手动输入特价
             </a-select-option>
-            <a-select-option value="1">
+            <a-select-option value="1" id="promotionList-discountType1">
               各级别价打折
             </a-select-option>
-            <a-select-option value="2">
+            <a-select-option value="2" id="promotionList-discountType2">
               各级别价直降
             </a-select-option>
           </a-select>
@@ -105,6 +136,7 @@
             <template slot="provinceDiscount" slot-scope="text, record">
               <a-input-number
                 size="small"
+                :id="'promotionList-provinceDiscount'+record.id"
                 v-model="record.provinceValue"
                 :min="0"
                 :step="1"
@@ -115,6 +147,7 @@
             <template slot="cityDiscount" slot-scope="text, record">
               <a-input-number
                 size="small"
+                :id="'promotionList-cityValue'+record.id"
                 v-model="record.cityValue"
                 :min="record.provinceValue||0"
                 :step="1"
@@ -125,6 +158,7 @@
             <template slot="specialDiscount" slot-scope="text, record">
               <a-input-number
                 size="small"
+                :id="'promotionList-specialValue'+record.id"
                 v-model="record.specialValue"
                 :min="record.cityValue ||0"
                 :step="1"
@@ -136,6 +170,7 @@
               <a-input-number
                 size="small"
                 :value="record.provinceValue"
+                :id="'promotionList-provinceValue'+record.id"
                 :min="0"
                 :step="1"
                 :precision="2"
@@ -147,6 +182,7 @@
               <a-input-number
                 size="small"
                 :value="record.cityValue"
+                :id="'promotionList-cityValue'+record.id"
                 :min="0"
                 :step="1"
                 :precision="2"
@@ -158,6 +194,7 @@
               <a-input-number
                 size="small"
                 :value="record.specialValue"
+                :id="'promotionList-specialValue'+record.id"
                 :min="0"
                 :step="1"
                 :precision="2"
@@ -170,11 +207,11 @@
       </a-form-model>
       <a-card size="small" :bordered="false" class="pages-wrap">
         <div class="flex" style="margin-bottom:10px;">
-          <a-radio-group v-model="chooseVal" button-style="solid">
-            <a-radio-button value="a" v-show="form.gateFlag==='1'">
+          <a-radio-group id="promotionList-chooseVal" v-model="chooseVal" button-style="solid">
+            <a-radio-button value="a" v-show="form.gateFlag==='1'" id="promotionList-chooseVal-a">
               门槛产品
             </a-radio-button>
-            <a-radio-button value="d">
+            <a-radio-button value="d" id="promotionList-chooseVal-d">
               特价产品
             </a-radio-button>
           </a-radio-group>
@@ -183,7 +220,7 @@
               size="small"
               type="link"
               class="button-info"
-              id="promotionList-edit-btn"
+              id="promotionList-import-btn"
               @click="openGuideModal=true"
             >+导入产品</a-button>
             <a-button
@@ -192,17 +229,17 @@
               size="small"
               type="link"
               class="button-info"
-              id="promotionList-edit-btn"
+              id="promotionList-add-btn"
               @click="addProducts">+新增产品</a-button>
-            <a-button type="link" class="button-error" @click="handlePreview">预览</a-button>
+            <a-button type="link" id="promotionList-preview-btn" class="button-error" @click="handlePreview">预览</a-button>
           </div>
         </div>
         <div v-show="chooseVal=='a'"><tableType1 :unitTypeList="unitTypeDataList" ref="cillProduct"></tableType1></div>
         <div v-show="chooseVal=='d'"><tableType3 :setData="setTableData" :rulesType="form.discountType" :unitTypeList="unitTypeDataList" ref="specialProduct"></tableType3></div>
       </a-card>
       <div class="btn-cont">
-        <a-button id="promotionList-basicInfo-modal-back" @click="isShow = false">取消</a-button>
-        <a-button style="margin-left: 15px;" type="primary" id="promotionList-modal-save" @click="handleSave">确定</a-button>
+        <a-button id="promotionList-cancel-btn" @click="isShow = false">取消</a-button>
+        <a-button style="margin-left: 15px;" type="primary" id="promotionList-save-btn" @click="handleSave">确定</a-button>
       </div>
     </a-spin>
     <!-- 选择产品 -->
@@ -222,14 +259,16 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
+// 组件
 import { VSelect } from '@/components'
 import tableType1 from './tableType1.vue'
 import tableType3 from './tableType3.vue'
-import { promotionSave, getRuleDetail } from '@/api/promotion'
 import chooseProductsModal from './chooseProductsModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
-import { getLookUpData } from '@/api/data'
 import productPreviewModal from './productPreviewModal'
+// 接口
+import { getLookUpData } from '@/api/data'
+import { promotionSave, getRuleDetail } from '@/api/promotion'
 export default {
   name: 'PromotionListBasicInfoModal',
   mixins: [commonMixin],
@@ -252,35 +291,38 @@ export default {
     return {
       isShow: this.openModal, //  是否打开弹框
       spinning: false,
+      // form表单label布局
       formItemLayout: {
         labelCol: { span: 4 },
         wrapperCol: { span: 17 }
       },
+      // 提交参数
       form: {
         promotionRuleType: 'PROMO_PROD', // 特价产品
         description: '', // 规则简称
         gateFlag: '0', // 门槛
-        gateType: undefined,
-        gateValue: undefined,
-        gateUnit: 'GE',
-        quotaUnit: undefined,
-        quotaAmount: undefined,
+        gateType: undefined, // 门槛产品类型
+        gateValue: undefined, // 门槛产品配额值、满最低金额值、最低门槛金额和最低个数值
+        gateUnit: 'GE', // 门槛产品单位
+        quotaUnit: undefined, // 赠特价产品单位
+        quotaAmount: undefined, // 赠特价产品金额
         discountType: '0', // 特价规则
-        gateInfo: undefined,
-        ruleInfo: undefined
+        gateInfo: undefined, // 门槛产品规则描述
+        ruleInfo: undefined// 特价产品规则描述
       },
+      // 表单验证规则
       rules: {
         description: [ { required: true, message: '请输入规则简称', trigger: 'blur' } ],
         gateFlag: [ { required: true, message: '请选择规则门槛', trigger: 'change' } ],
         discountType: [{ required: true, message: '请选择特价规则', trigger: 'change' }]
       },
-      setTableData: null,
-      chooseVal: 'a',
-      openProductsModal: false,
-      chooseProducts: [],
+      setTableData: null, // 特价表格规则
+      chooseVal: 'a', // 显示规则类型 a门槛产品  d特价产品
+      openProductsModal: false, // 打开选择产品弹窗
+      chooseProducts: [], // 已选产品集合
       openGuideModal: false, // 导入弹窗
       code: 'SCOPE_UNIT_TYPE', // 起订类型数据字典
-      unitTypeDataList: [],
+      unitTypeDataList: [], // 起订量集合
       openProductModal: false, // 预览弹窗
       previewList: []// 预览值
     }
@@ -311,12 +353,15 @@ export default {
       this.form.gateUnit = val
       this.form.gateValue = undefined
     },
+    // 省价 change
     handleProvincePrice (e) {
       this.setTableData[0].provinceValue = Number(e.target.value)
     },
+    // 市价 change
     handleCityPrice (e) {
       this.setTableData[0].cityValue = Number(e.target.value)
     },
+    // 特约价 change
     handleSpecialPrice (e) {
       this.setTableData[0].specialValue = Number(e.target.value)
     },
@@ -345,6 +390,7 @@ export default {
         this.form.quotaAmount = undefined
       }
     },
+    // 门槛与配额设置要求
     changeGateTypeFlag (val) {
       this.form.gateType = val
       this.form.gateValue = undefined
@@ -480,6 +526,7 @@ export default {
         }
       })
     },
+    // 判断是否为空
     isNumEmpty (dataList) {
       const arr = []
       const arr1 = []
@@ -576,6 +623,7 @@ export default {
         _this.spinning = false
       })
     },
+    // 重组所需数据格式
     newData (list) {
       list.forEach(con => {
         // 品牌
@@ -713,6 +761,7 @@ export default {
       })
       return snArr
     },
+    // 添加产品 重组回显数据
     handleProductsAdd (con) {
       const newArr = []
       const newConArr = []
@@ -810,6 +859,7 @@ export default {
         _this.$refs.specialProduct.setSourceData(chooseProductsList)
       })
     },
+    // 获取起订类型数据字典
     getUnitTypeList () {
       const _this = this
       getLookUpData({
@@ -865,6 +915,7 @@ export default {
         this.openProductModal = true
       })
     },
+    // 关闭产品弹窗
     closeProductModal () {
       this.previewList = []
       this.openProductModal = false