浏览代码

调价单现金、返利钱包

howie 3 年之前
父节点
当前提交
9f5028f712

+ 256 - 146
src/views/basic_data/material/components/modify_list-apply.vue

@@ -74,15 +74,25 @@
         </el-row>
       </el-form>
     </div>
-    <!-- <div class="btn-group clearfix"> <el-upload
-                    class="import-btn"
-                    :action="baseURL + 'student/import'"
-                    :http-request="handleImport"
-                    :file-list="importFileList"
-                    :show-file-list="false"
-                  >
-                    <el-button size="small">导入价格表</el-button>
-                  </el-upload></div> -->
+    <div class="btn-group clearfixs" v-if="!cid">
+      <el-upload
+        class="import-btn"
+        :action="baseURL + 'student/import'"
+        :http-request="handleImport"
+        :file-list="importFileList"
+        :show-file-list="false"
+      >
+        <el-button
+          type="primary"
+          size="small"
+        >导入调价单</el-button>
+      </el-upload>
+      <el-button
+        type="primary"
+        size="small"
+        @click="hanleDownloadFiles"
+      >下载模板</el-button>
+    </div>
     <div class="mymain-container">
       <!-- 列表 -->
       <div class="table">
@@ -100,6 +110,7 @@
               align="center"
               label="操作类型"
               prop="nname"
+              fixed="right"
               min-width="160"
               show-overflow-tooltip
             >
@@ -223,7 +234,7 @@
             >
               <template slot-scope="scope">
                 <el-form-item>
-                  <el-input v-model="scope.row.batchPrice" placeholder="请输入批发价"/>
+                  <el-input v-model="scope.row.batchPrice" placeholder="请输入批发价" />
                 </el-form-item>
               </template>
             </el-table-column>
@@ -235,7 +246,7 @@
               show-overflow-tooltip
             ><template slot-scope="scope">
               <el-form-item>
-                <el-input v-model="scope.row.discAmount" placeholder="请输入格力折扣"/>
+                <el-input v-model="scope.row.discAmount" placeholder="请输入格力折扣" />
               </el-form-item>
             </template>
             </el-table-column>
@@ -329,7 +340,7 @@
               show-overflow-tooltip
             ><template slot-scope="scope">
               <el-form-item>
-                <el-input v-model="scope.row.qty"   placeholder="请输入数量"/>
+                <el-input v-model="scope.row.qty" placeholder="请输入数量" />
               </el-form-item>
             </template>
             </el-table-column>
@@ -438,17 +449,17 @@
               <template slot-scope="scope">
                 <el-form-item>
 
-                    <el-select
-                      v-model="scope.row.saleTypeId"
-                      placeholder="请选择销售类型"
-                      @change="handleSale($event, scope.$index, scope.row.id)"
-                    >
-                      <el-option
-                        v-for="item in typeList"
-                        :label="item.saleName"
-                        :value="item.id"
-                      />
-                    </el-select>
+                  <el-select
+                    v-model="scope.row.saleTypeId"
+                    placeholder="请选择销售类型"
+                    @change="handleSale($event, scope.$index, scope.row.id)"
+                  >
+                    <el-option
+                      v-for="item in typeList"
+                      :label="item.saleName"
+                      :value="item.id"
+                    />
+                  </el-select>
 
                 </el-form-item>
               </template>
@@ -900,7 +911,9 @@ import {
   getWalletList,
   handleEdit
 } from '@/api/basic_data/material'
-import { handleImport } from '@/utils/util'
+
+import { downloadFiles, handleImport } from '@/utils/util'
+
 import Mixin from '@/mixin/index'
 
 export default {
@@ -985,71 +998,68 @@ export default {
     },
     // xua
     handelWallets(e, index, row) {
-      console.log(row, 'kjkj4545')
-      const id = row.cid || row.updPriceBillId
-      if (e && e.length) {
-        for (let i = 0; i < e.length; i++) {
-          if (!this.wall1.includes(e[e.length - 1])) {
-            this.$set(row, 'wallets', [
-              ...row.wallets,
-              {
-                type: 'COMMONLY',
-                id: '',
-                updPriceBillId: id,
-                updPriceBillItemId: id,
-                walletId: e[e.length - 1]
-              }
-            ])
-            this.wall1.push(e[e.length - 1])
-          }
-        }
-      }
+      // const id = row.cid || row.updPriceBillId
+      // // if (e && e.length) {
+      //   for (let i = 0; i < e.length; i++) {
+      //     // if (!this.wall1.includes(e[e.length - 1])) {
+      //       this.$set(row, 'wallets', [
+      //         ...row.wallets,
+      //         {
+      //           type: 'COMMONLY',REBATE
+      //           id: '',
+      //           updPriceBillId: id,
+      //           updPriceBillItemId: id,
+      //           walletId: e[e.length - 1]
+      //         }
+      //       ])
+      //       // this.wall1.push(e[e.length - 1])
+      //     }
+      //   // }
+      // // }
+    },
+    handelRebateList(e, index, row) {
+      // const id = row.cid || row.updPriceBillId
+      // if (e && e.length) {
+      //   for (let i = 0; i < e.length; i++) {
+      //     if (!this.wall2.includes(e[e.length - 1])) {
+      //       console.log(44544)
+      //       this.$set(row, 'wallets', [
+      //         ...row.wallets,
+      //         {
+      //           type: 'REBATE',
+      //           id: '',
+      //           updPriceBillId: id,
+      //           updPriceBillItemId: id,
+      //           walletId: e[e.length - 1]
+      //         }
+      //       ])
+      //       this.wall2.push(e[e.length - 1])
+      //     }
+      //   }
+      // }
     },
     handleRemove(e, index, row) {
-      console.log(e)
-      const copxyWall = JSON.parse(JSON.stringify(row.wallets))
-      if (row.wallets[0].walletId === e){
-        copxyWall.splice(0, 1)
-      }
-      for (let i = 0; i < row.wallets.length; i++) {
-        if (this.wall1.includes(e) && row.wallets[i].walletId  === e) {
-          this.wall1.splice(i, 1)
-          copxyWall.splice(i, 1)
-        }
-      }
-      this.$set(row, 'wallets', copxyWall)
+      // const copxyWall = JSON.parse(JSON.stringify(row.wallets))
+      // if (row.wallets[0].walletId === e) {
+      //   copxyWall.splice(0, 1)
+      // }
+      // for (let i = 0; i < row.wallets.length; i++) {
+      //   if (this.wall1.includes(e) && row.wallets[i].walletId === e) {
+      //     this.wall1.splice(i, 1)
+      //     copxyWall.splice(i, 1)
+      //   }
+      // }
+      // this.$set(row, 'wallets', copxyWall)
     },
     handleRemove2(e, index, row) {
-      const copxyWall = JSON.parse(JSON.stringify(row.wallets))
-      for (let i = 0; i < row.wallets.length; i++) {
-        if (this.wall2.includes(e) && row.wallets[i].walletId == e) {
-          copxyWall.splice(i, 1)
-          this.wall2.splice(i, 1)
-        }
-      }
-      this.$set(row, 'wallets', copxyWall)
-    },
-    handelRebateList(e, index, row) {
-      const id = row.cid || row.updPriceBillId
-      if (e && e.length) {
-        for (let i = 0; i < e.length; i++) {
-          if (!this.wall2.includes(e[e.length - 1])) {
-            console.log(44544)
-            this.$set(row, 'wallets', [
-              ...row.wallets,
-              {
-                type: 'REBATE',
-                id: '',
-                updPriceBillId: id,
-                updPriceBillItemId: id,
-                walletId: e[e.length - 1]
-              }
-            ])
-            this.wall2.push(e[e.length - 1])
-          }
-          console.log(row.wallets)
-        }
-      }
+      // const copxyWall = JSON.parse(JSON.stringify(row.wallets))
+      // for (let i = 0; i < row.wallets.length; i++) {
+      //   if (this.wall2.includes(e) && row.wallets[i].walletId == e) {
+      //     copxyWall.splice(i, 1)
+      //     this.wall2.splice(i, 1)
+      //   }
+      // }
+      // this.$set(row, 'wallets', copxyWall)
     },
     handleUser(e) {
       const adminCompany = this.userList.filter((k) => {
@@ -1092,9 +1102,6 @@ export default {
               this.dataList[j].disabled = true
             }
           }
-
-
-          console.log(this.selectData[i].wallets,'4444  ' )
           this.items.push({
             baseUnitId: '',
             batchPrice: '',
@@ -1119,18 +1126,10 @@ export default {
             saleTypeId: '',
             specification: this.selectData[i].specification,
             startDate: this.selectData[i].startDate,
-            wallets: [
-              {
-                type: 'COMMONLY',
-                id: '',
-                updPriceBillId: this.selectData[i].baseUnitId,
-                updPriceBillItemId: this.selectData[i].baseUnitId,
-                walletId:this.selectData[i].wallets[0].id
-              }
-            ],
+            wallets: [],
             rebateWallets: [],
             rebateList: [],
-            walletsId:[this.selectData[i].wallets[0].id],
+            walletsId: [this.selectData[i].wallets[0].id],
             walleList: this.selectData[i].wallets,
             isPublishArr: [
               {
@@ -1267,12 +1266,11 @@ export default {
                 bool: false
               }
             ]
-
+            res.data.items[i].wallets = []
             res.data.items[i].walletsId = []
             res.data.items[i].walletRebateId = []
             res.data.items[i].rebateWallets = []
-            res.data.items[i].wallets = []
-            console.log(res.data.items[i].wallets2,'8878')
+
             for (let p = 0; p < res.data.items[i].wallets2.length; p++) {
               if (res.data.items[i].wallets2[p].type === 'COMMONLY') {
                 walletIds.push(res.data.items[i].wallets2[p].walletId)
@@ -1281,26 +1279,26 @@ export default {
                   {
                     type: 'COMMONLY',
                     id: '',
-                    updPriceBillId:  res.data.items[i].updPriceBillId,
-                    updPriceBillItemId:  res.data.items[i].updPriceBillId,
-                    walletId:  res.data.items[i].wallets2[p].walletId
+                    updPriceBillId: res.data.items[i].updPriceBillId,
+                    updPriceBillItemId: res.data.items[i].updPriceBillId,
+                    walletId: res.data.items[i].wallets2[p].walletId
                   }
                 ])
               } else if (res.data.items[i].wallets2[p].type === 'REBATE') {
                 walletRebateIds.push(res.data.items[i].wallets2[p].walletId)
-                console.log(walletRebateIds)
-                this.$set(res.data.items[i], 'rebateWallets', [
-                  ...res.data.items[i].rebateWallets,
+                this.$set(res.data.items[i], 'wallets', [
+                  ...res.data.items[i].wallets,
                   {
                     type: 'REBATE',
                     id: '',
-                    updPriceBillId:  res.data.items[i].updPriceBillId,
-                    updPriceBillItemId:  res.data.items[i].updPriceBillId,
-                    walletId:  res.data.items[i].wallets2[p].walletId
+                    updPriceBillId: res.data.items[i].updPriceBillId,
+                    updPriceBillItemId: res.data.items[i].updPriceBillId,
+                    walletId: res.data.items[i].wallets2[p].walletId
                   }
                 ])
               }
             }
+            console.log(res.data.items[i].wallets)
             this.rebateList.forEach((k) => {
               k.saleTypes.forEach((j) => {
                 if (
@@ -1316,17 +1314,16 @@ export default {
                 }
               })
             })
-            if (this.dataList.length){
+            if (this.dataList.length) {
               for (let j = 0; j < res.data.items.length; j++) {
                 for (let k = 0; k < this.dataList.length; k++) {
-                  if (res.data.items[j].materialId === this.dataList[k].id){
+                  if (res.data.items[j].materialId === this.dataList[k].id) {
                     this.dataList[k].disabled = true
                   }
                 }
               }
               // console.log(this.dataList)
             }
-
             this.$set(res.data.items[i], 'walletsId', walletIds)
             this.$set(res.data.items[i], 'walletRebateId', walletRebateIds)
             res.data.items[i].walleList = this.walleList
@@ -1361,19 +1358,7 @@ export default {
       // 如果没有返回值则默认返回false(全部无法选中)
     },
     hanleSbumit() {
-      console.log(this.items, 45454)
-      // for (let i = 0; i < this.items.length; i++) {
-      //   this.items[i].wallets = [
-      //     ...this.items[i].rebateWallets,
-      //     ...this.items[i].wallets,
-      //   ];
-
-      //   if (!this.items[i].mainId) {
-      //     this.$errorMsg("请选择销售类型");
-      //     return;
-      //   }
-      // }
-
+      this.filterWallets(this.items)
       const params = {
         ...this.base,
         items: this.items,
@@ -1390,20 +1375,7 @@ export default {
       })
     },
     hanleSave() {
-      // for (let i = 0; i < this.items.length; i++) {
-      //     //   const  wallets = []
-      //     //     if (this.items[i].wallets.length) {
-      //     //        wallets = [...wallets,...this.items[i].wallets]
-      //     //     }else if(this.items[i].rebateWallets.length){
-      //     //       console.log(444);
-      //     //         wallets = [...wallets,...this.items[i].rebateWallets]
-      //     //     }
-      //     // this.items[i].wallets = wallets
-      //               console.log(this.items[i]);
-
-      // }
-      console.log(this.items)
-      return
+      this.filterWallets(this.items)
       handleEdit({
         ...this.base,
         items: this.items,
@@ -1440,24 +1412,156 @@ export default {
     async handleImport(param) {
       this.importLoading = true
       const file = param.file
-      console.log(file, 123)
       const formData = new FormData()
       formData.append('file', file)
-      // formData.append("policyId", this.searchForm.code);
-      // formData.append("mainId", this.searchForm.mainId);
-      const result = await handleImport('/policy/material/import', formData)
+
+      const result = await handleImport('/product-upd-price/material/import', formData)
       this.importLoading = false
       this.importFileList = []
-      if (result.code == 200) {
+      if (result.code === 200) {
         this.$alert(result.message, '导入成功', {
           confirmButtonText: '确定'
         })
-        this.handletwoList()
+
+        for (let i = 0; i < result.data.length; i++) {
+          const linshi = []
+          const rebateList = []
+          const walletIds = []
+          const walletRebateIds = []
+          result.data[i].isPublishArr = [
+            {
+              value: '是',
+              bool: true
+            },
+            {
+              value: '否',
+              bool: false
+            }
+          ]
+          result.data[i].isPromoteArr = [
+            {
+              value: '是',
+              bool: true
+            },
+            {
+              value: '否',
+              bool: false
+            }
+          ]
+          result.data[i].wallets = []
+          result.data[i].walletsId = []
+          result.data[i].walletRebateId = []
+          result.data[i].rebateWallets = []
+          result.data[i].saleTypes = this.typeList
+          result.data[i].mainId = result.data[i].saleTypeId
+          for (let p = 0; p < result.data[i].wallets2.length; p++) {
+            if (result.data[i].wallets2[p].type === 'COMMONLY') {
+              walletIds.push(result.data[i].wallets2[p].walletId)
+              this.$set(result.data[i], 'wallets', [
+                ...result.data[i].wallets,
+                {
+                  type: 'COMMONLY',
+                  id: '',
+                  updPriceBillId: result.data[i].updPriceBillId,
+                  updPriceBillItemId: result.data[i].updPriceBillId,
+                  walletId: result.data[i].wallets2[p].walletId
+                }
+              ])
+            } else if (result.data[i].wallets2[p].type === 'REBATE') {
+              walletRebateIds.push(result.data[i].wallets2[p].walletId)
+              this.$set(result.data[i], 'wallets', [
+                ...result.data[i].wallets,
+                {
+                  type: 'REBATE',
+                  id: '',
+                  updPriceBillId: result.data[i].updPriceBillId,
+                  updPriceBillItemId: result.data[i].updPriceBillId,
+                  walletId: result.data[i].wallets2[p].walletId
+                }
+              ])
+            }
+          }
+
+          this.rebateList.forEach((k) => {
+            k.saleTypes.forEach((j) => {
+              if (
+                !linshi.includes(j.saleTypeId) &&
+                j.saleTypeId === result.data[i].saleTypeId
+              ) {
+                for (let w = 0; w < walletRebateIds.length; w++) {
+                  if (walletRebateIds[w] !== k.walletRebateId) {
+                    // walletRebateIds.splice(w, 1)
+                  }
+                }
+
+                rebateList.push(k)
+              }
+            })
+          })
+
+          this.$set(result.data[i], 'walletsId', walletIds)
+          this.$set(result.data[i], 'walletRebateId', walletRebateIds)
+          result.data[i].walleList = this.walleList
+          result.data[i].rebateList = rebateList
+          result.data[i].fang = false
+        }
+        if (this.dataList.length) {
+          for (let j = 0; j < result.data.length; j++) {
+            for (let k = 0; k < this.dataList.length; k++) {
+              if (result.data[j].materialId === this.dataList[k].id) {
+                this.dataList[k].disabled = true
+              }
+            }
+          }
+        }
+        function resArrs(arr1, arr2) {
+          return arr1.filter((v) => arr2.every((val) => val.materialId != v.id))
+        }
+        this.items = [...this.items,...resArrs(result.data,this.dataList)]
       } else {
         this.$alert(result.message, '导入失败', {
           confirmButtonText: '确定'
         })
       }
+    },
+    // 下载经销商模板
+    hanleDownloadFiles() {
+      downloadFiles('/product-upd-price/download')
+    },
+    filterWallets(array){
+      const wallets = []
+      for (let i = 0; i < array.length; i++) {
+        if (!array[i].walletsId.length) return
+        for (let j = 0; j < array[i].walleList.length; j++) {
+          for (let k = 0; k < array[i].walletsId.length; k++) {
+            if (array[i].walleList[j].id === array[i].walletsId[k]) {
+              wallets.push({
+                type: 'COMMONLY',
+                id: '',
+                updPriceBillId: array[i].cid || array[i].updPriceBillId,
+                updPriceBillItemId: array[i].cid || array[i].updPriceBillId,
+                walletId: array[i].walletsId[k]
+              })
+            }
+          }
+        }
+        for (let k = 0; k < array[i].rebateList.length; k++) {
+          if (!array[i].walletRebateId.length) return
+          for (let j = 0; j < array[i].walletRebateId.length; j++) {
+            if (array[i].rebateList[k].walletRebateId === array[i].walletRebateId[j]) {
+              wallets.push({
+                type: 'REBATE',
+                id: '',
+                updPriceBillId: array[i].cid || array[i].updPriceBillId,
+                updPriceBillItemId: array[i].cid || array[i].updPriceBillId,
+                walletId: array[i].walletRebateId[j]
+              })
+            }
+          }
+        }
+
+        array[i].wallets = wallets
+      }
     }
   }
 }
@@ -1470,4 +1574,10 @@ export default {
 .dia .el-select--normal {
   width: 100%;
 }
+.clearfixs{
+  display: flex;
+}
+.import-btn{
+  margin-right: 10px;
+}
 </style>

+ 1 - 0
src/views/basic_data/material/modify_list.vue

@@ -386,6 +386,7 @@
             <el-table-column
               align="center"
               label="操作"
+              fixed="right"
               min-width="160"
               show-overflow-tooltip
             >

+ 7 - 0
src/views/sales_policy/components/TabelTransfer.vue

@@ -34,6 +34,7 @@
           />
         </el-col>
         <el-col style="margin-left: 10px"><el-button size="small" @click="submitScreenForm">确定</el-button></el-col>
+        <el-col style="margin-left: 10px"><el-button size="small" @click="resetScreenForm">重置</el-button></el-col>
       </el-row>
     </slot>
     <el-row :gutter="20">
@@ -290,6 +291,12 @@ export default {
       this.currentPages = 1;
       this.getCrList();
     },
+    // 重置筛选表单
+    resetScreenForm() {
+      this.keyword = ''
+      this.currentPages = 1;
+      this.getCrList();
+    },
     // 去掉相同数据
     resArr(arr1, arr2) {
       return arr1.filter((v) => arr2.every((val) => val.id !== v.id))

+ 1 - 3
src/views/sales_policy/policy_list.vue

@@ -557,9 +557,6 @@ export default {
 .import-btn {
   margin: 0 10px;
 }
-</style>
-
-<style>
 .header {
   display: flex;
   height: 50px;
@@ -569,3 +566,4 @@ export default {
   margin: 20px 0;
 }
 </style>
+

+ 8 - 2
src/views/supply/policy/components/retail_form.vue

@@ -1400,7 +1400,7 @@ export default {
           this.mainForm.remark = data.remark
           this.mainForm.policyId = data.policyId
           this.policyId = data.policyId
-   
+
           this.mainForm.k3ServiceName = data.retailOrderItemList[0].wallets[0].serviceName
           this.mainForm.k3ServiceId = data.retailOrderItemList[0].wallets[0].serviceId
           data.retailOrderItemList.forEach((item) => {
@@ -1788,6 +1788,10 @@ export default {
 .table{
   background-color: rgb(237 237 237);
 }
+.page-footer .footer.hideSidebar{
+  margin-left: 0;
+  width: 100%;
+}
 .mybox {
   padding: 20px 0;
 
@@ -1837,5 +1841,7 @@ export default {
   text-overflow: ellipsis;
   white-space: nowrap;
 }
-
+.app-container{
+  margin-bottom: 80px;
+}
 </style>

+ 2 - 1
src/views/supply/policy/policy_list.vue

@@ -152,7 +152,7 @@
             stripe
             show-summary
             :summary-method="$getSummaries"
-            
+
           >
             <!-- <el-table-column
               align="center"
@@ -390,6 +390,7 @@
             <el-table-column
               align="center"
               label="操作"
+              
               width="220"
               fixed="right"
             >