zhangqi 1 rok temu
rodzic
commit
348b12d459

+ 13 - 1
src/DRP/HDrpManagement/programme/index.vue

@@ -61,7 +61,10 @@
           </a-col>
         </a-row>
       </a-tab-pane>
-      <a-tab-pane key="2" tab="不参与返利商品" force-render>
+      <a-tab-pane key="2" tab="参与返利商品" force-render>
+        <inAct :programData="programData"></inAct>
+      </a-tab-pane>
+      <a-tab-pane key="3" tab="不参与返利商品" force-render>
         <normalTable ref="prodTable" rowKey="itemid" v-if="programData.sa_rebateschemeid" size="small" :columns="utils.TBLayout('productTable')" tableName="productTable" :param="{id:20230627111003,content:{pageSize:20,pageNumber:1,sa_rebateschemeid:programData.sa_rebateschemeid,where:{}}}" @onSelect="onProdSelect">
           <template #operation>
             <a-space class="mt-10" >
@@ -85,6 +88,7 @@
 <script setup>
 import normalTable from '@/template/normalTable/index.vue'
 import selectProduct from '@/template/selectProduct/index.vue'
+import inAct from './modules/inAct.vue'
 import importExcel from '@/components/tableImport/index.vue'
 import { UploadOutlined,SwapOutlined,SwapRightOutlined,SwapLeftOutlined,ExclamationCircleOutlined,SortAscendingOutlined,SortDescendingOutlined } from '@ant-design/icons-vue';
 import { Modal } from 'ant-design-vue'
@@ -220,6 +224,14 @@ const changeDataStructure = (data) => {
       label:'创建时间',
       value:data.createdate
     },
+    {
+      label:'最近修改人',
+      value:data.changeby
+    },
+    {
+      label:'最近修改时间',
+      value:data.changedate
+    },
   ]
 }
 const classTable = ref()

+ 97 - 0
src/DRP/HDrpManagement/programme/modules/inAct.vue

@@ -0,0 +1,97 @@
+<template>
+<div class=''>
+  <normalTable ref="prodTable" rowKey="itemid" v-if="programData.sa_rebateschemeid" size="small" :columns="utils.TBLayout('productTable')" tableName="productTable" :param="{id:20240722145503,content:{pageSize:20,pageNumber:1,sa_rebateschemeid:programData.sa_rebateschemeid,where:{}}}" @onSelect="onProdSelect">
+    <template #operation>
+      <a-space class="mt-10" >
+        <selectProduct :disabled="programData.isused == 1" :columns="utils.TBLayout('productTable')" :param="{id:20240722145303,content:{pageSize:20,pageNumber:1,sa_rebateschemeid:programData.sa_rebateschemeid,where:{}}}" @onSelectChange="onAddConfirm"/>
+        <a-button :disabled="prodSelectArray.length == 0 || programData.isused == 1" type="primary" @click="deleteProd">删除商品</a-button>
+      </a-space>
+    </template>
+    <template #more>
+      <a-tooltip v-if="prodTable && prodTable.data.length > 0">
+        <template #title>已存在不参与返利的商品,请先删除后再进行导入!</template>
+        <UploadOutlined style="color:grey"></UploadOutlined>
+      </a-tooltip>
+      <importExcel v-else type="icon" :bindData="{ownerid:programData.sa_rebateschemeid,ownertable:'sa_rebatescheme',usetype:'default'}" :failedData="failedData" :modeParam="{id:2024062609542503,content:{}}" @uploadSuccess="importSuccess"></importExcel>
+    </template>
+  </normalTable>
+</div>
+</template>
+<script setup>
+import {ref,defineProps,createVNode} from 'vue'
+import normalTable from '@/template/normalTable/index.vue'
+import selectProduct from '@/template/selectProduct/index.vue'
+import importExcel from '@/components/tableImport/index.vue'
+import { UploadOutlined,SwapOutlined,SwapRightOutlined,SwapLeftOutlined,ExclamationCircleOutlined,SortAscendingOutlined,SortDescendingOutlined } from '@ant-design/icons-vue';
+import { Modal } from 'ant-design-vue'
+
+import Api from '@/api/api'
+import utils from '@/utils/utils'
+const props = defineProps(['programData'])
+const prodSelectArray = ref([])
+const onProdSelect = (val)=>{
+  prodSelectArray.value = val
+}
+const prodTable = ref()
+const onAddConfirm = async (val) =>{
+  const res = await Api.requested({
+    "id": "20240722145403",
+    "content": {
+      "sa_rebateschemeid":props.programData.sa_rebateschemeid,
+      "iteminfos":val.map(e=>{
+        return {
+          sa_rebateunproductsid:0,
+          itemid:e.itemid
+        }
+      })
+    }
+  })
+  utils.message(res,'添加成功',()=>{
+    prodTable.value.listData()
+  })
+}
+const deleteProd = ()=>{
+  Modal.confirm({
+    title: '删除商品',
+    icon: createVNode(ExclamationCircleOutlined),
+    content: `当前选中${prodSelectArray.value.length}个商品,删除${prodSelectArray.value.length}个商品!`,
+    okText: '确认',
+    cancelText: '取消',
+    async onOk() {
+      const res = await Api.requested({
+        id:20240722145603,
+        content:{
+          sa_rebateunjoinproductsids:prodSelectArray.value.map(e=>e.sa_rebateunjoinproductsid)
+        }
+      })
+      utils.message(res,'删除成功',()=>{
+        prodTable.value.reloadSelect()
+        prodSelectArray.value = []
+        prodTable.value.listData()
+      })
+    },
+    onCancel() {},
+  })
+}
+const failedData = ref(null)
+const importSuccess = async (res)=>{
+  const rs = await Api.requested({
+    id:20240722145703,
+    content:{
+      sa_rebateschemeid:props.programData.sa_rebateschemeid,
+      attachmentid:res.data.attachmentids[0]
+    }
+  })
+  if (rs.code == 0) {
+    failedData.value = rs.msg
+  } else {
+    utils.message(rs,'导入成功',()=>{
+      failedData.value = null
+      mianData()
+    })
+    prodTable.value.listData()
+  }
+}
+</script>
+<style scoped >
+</style>