lilei 1 年之前
父节点
当前提交
e9c76a9604

+ 11 - 4
src/api/salesDetailNew.js

@@ -123,7 +123,14 @@ export const salesDisablePromo = params => {
       method: 'post'
     })
   }
- 
+ // 更换活动
+ export const salesChangePromo = params => {
+  return axios({
+    url: '/salesn/detail/changePromo',
+    data: params,
+    method: 'post'
+  })
+}
 // 修改销售明细取消数量
 export const salesDetailUpdateCancelQty = (params) => {
   return axios({
@@ -144,7 +151,7 @@ export const insertBatchOfWaitDispatch = (params) => {
 
 // 缺货明细
 export const salesStockoutDetail = (params) => {
-  const url = `/sales/detail/queryPageStock`
+  const url = `/salesn/detail/queryPageStock`
   delete params.pageNo
   delete params.pageSize
   return axios({
@@ -156,7 +163,7 @@ export const salesStockoutDetail = (params) => {
  
 // 导出缺货明细
 export const exportStockout = params => {
-  const url = `/sales/detail/exportStockout`
+  const url = `/salesn/detail/exportStockout`
   delete params.priceType
   return axios.request({
     url: url,
@@ -167,7 +174,7 @@ export const exportStockout = params => {
 }
 // 导出分组缺货明细
 export const exportGroupStockout = params => {
-  const url = `/sales/detail/exportGroupStockout`
+  const url = `/salesn/detail/exportGroupStockout`
   delete params.priceType
   return axios.request({
     url: url,

+ 14 - 2
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -147,12 +147,24 @@
                         款数:<strong>{record.total&&record.total.totalCategory||'--'}</strong>;
                         数量:<strong>{record.total&&record.total.totalQty||'--'}</strong>;
                         {_this.$hasPermissions('B_salesEdit_salesPrice') ? (<span>总金额:<strong>{record.total&&record.total.totalAmount||'--'}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>优惠金额:<strong>{record.total.lossAmount||'--'}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>采购额结余:<strong>{_this.toThousands(Number(record.total.totalPromoGiftsAmount) - Number(record.total.totalUsePromoGiftsAmount))}</strong>;</span>):('')}
+                        {_this.$hasPermissions('B_salesEdit_salesPrice')&&record.promo&&record.total ? (<span>采购额超出:<strong>{_this.toThousands(Number(record.total.totalUsePromoGiftsAmount) - Number(record.total.totalPromoGiftsAmount))}</strong>;</span>):('')}
+                        {record.expenseAccountFlagDictValue||''}
                     </div>
                   </div>
                 ):(<span>{data}</span>)}
               </div>
             )
           }
+          // 显示折扣价
+          const discountPriceFormat = function(record,data,h) {
+            if(record.promotionFlag == 'GIFT' || record.promotionFlag == 'DISCOUNT'){
+              return _this.toThousands(record.discountedPrice) + '(' + _this.toThousands(data) + ')'
+            }
+            return _this.toThousands(data)
+          }
+
           let arr= [
                 { title: '序号', field: 'no',key: "a", width: 50, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return noFormat(row,row[column.field],h)} },
                 { title: '产品编码', field: 'productCode',key: "b", width: 150, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return codeFormat(row,row[column.field],h)} },
@@ -181,12 +193,12 @@
                 arr.push({ title: '市级价', field: 'cityPrice', width: 80,key: "j", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
                 if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
                   this.colspanNums = this.colspanNums + 1
-                    arr.push({ title: '销售价', field: 'price', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+                    arr.push({ title: '销售价', field: 'price', width: 80,key: "k", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row,row[column.field],h)} })
                 }
             } else {
                 if (this.$hasPermissions(this.authCode + '_salesPrice')) { //  售价权限
                   this.colspanNums = this.colspanNums + 1
-                    arr.push({ title: '销售价', field: 'price', width: 80,key: "l", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return priceFormat(row[column.field])} })
+                    arr.push({ title: '销售价', field: 'price', width: 80,key: "l", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row,row[column.field],h)} })
                 }
             }
 

+ 19 - 23
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -261,7 +261,17 @@
   import chooseWarehouse from '@/views/common/chooseWarehouse'
   import ProductBrand from '@/views/common/productBrand.js'
   import productTypeAll from '@/views/common/productTypeAll.js'
-  import { salesDetailList, salesPromoDetailCount, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, deleteAll, updateWarehouse, salesBatchInsert } from '@/api/salesDetailNew'
+  import { 
+    salesDetailList, 
+    salesPromoDetailCount, 
+    salesDetailInsert, 
+    salesDetailUpdateQty, 
+    salesDetailDel, 
+    salesDetailBatchDel, 
+    deleteAll, 
+    updateWarehouse, 
+    salesBatchInsert,
+     } from '@/api/salesDetailNew'
   export default {
     name: 'ProductList',
     mixins: [commonMixin],
@@ -610,33 +620,19 @@
       },
       // 确定更换促销活动
       async upActiveOk(data, editRow){
-        console.log(data)
-        console.log(editRow)
         this.spinning = true
-        // 先删除当前活动
-        const delRet = await salesDetailDel({ 
+        const params = { 
           salesBillDetailSn: editRow.salesBillDetailSn, 
           salesBillSn: this.salesBillSn, 
-          salesPromoSn: this.promo.salesPromoSn 
-        })
-        // 当删除成功且不是”不参与活动“时
-        if(delRet.status == 200){
-          // 刷下当前活动列表
-          this.resetSearchForm()
-          // 再添加到其它活动
-          if(data != 0){
-            editRow.productPackQty = editRow.packQty
-            editRow.lastStockCost = editRow.showCost
-            editRow.productPrice = editRow.price
-            editRow.salesNums = editRow.qty
-            this.$emit("upActive",editRow, data)
-          }else{
-            // 刷下正常产品列表
-            this.$emit('insterOk', 'promo')
-          }
+          oldSalesPromoSn: this.promo.salesPromoSn
         }
-        this.openUpActiveModal = false
+        // 更换活动
+        this.$emit("upActive",this.promo, data, params)
+      },
+      upAcitveSuccess(){
         this.spinning = false
+        this.openUpActiveModal = false
+        this.resetSearchForm()
       },
       // 添加产品
       insterProduct (row, promotionFlag, promoProductClz) {

+ 22 - 5
src/views/salesManagement/salesQueryNew/edit.vue

@@ -142,7 +142,7 @@ import productList from './comps/productList.vue'
 import productNormalList from './comps/productNormalList.vue'
 import chooseProduct from './comps/chooseProduct.vue'
 import setPriceModal from './setPriceModal.vue'
-import { salesDisablePromo } from '@/api/salesDetailNew'
+import { salesDisablePromo, salesChangePromo } from '@/api/salesDetailNew'
 import { salesDetailBySn,salesPromoQueryCount, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo,salesPromoValidaSubmit } from '@/api/salesNew'
 export default {
   name: 'SalesNewEdit',
@@ -291,11 +291,28 @@ export default {
         this.$refs[this.cpCurRefId][0].insterProduct(row, promotionFlag, type)
       }
     },
-    // 更换活动promoRuleSn
-    upActive(row,data){
-      console.log(row,data)
+    // 更换活动
+    upActive(oldPromo,data,params){
       const promo = data.split('-')
-      this.$refs['productList-'+promo[1]][0].insterProduct(row, 0, promo[2])
+      const newSn = this.activeList.find(item => item.promoRuleSn == promo[1])
+      const newSalesPromoSn = newSn && newSn.salesPromoSn || ''
+      salesChangePromo({
+        salesPromoSn: data != 0 ? newSalesPromoSn : '',
+        promoRuleSn: promo[1],
+        promotionFlag: promo[2]||'',
+        ...params
+      }).then(res => {
+        if(res.status == 200){
+          // 刷新新参与活动
+          if(data != 0){
+            this.$refs['productList-'+promo[1]][0].resetSearchForm()
+          }
+          // 刷新正常活动
+          this.$refs.productNormalList.resetSearchForm()
+          // 刷新当前活动
+          this.$refs['productList-'+oldPromo.promoRuleSn][0].upAcitveSuccess()
+        }
+      })
     },
     // 选择价格类型  并更新
     updatePrice (type) {

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.111/ocs-admin',
+        target: 'http://192.168.2.113:8660/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
+        // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {