فهرست منبع

Merge branch 'develop_cuxiao' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_cuxiao

chenrui 1 سال پیش
والد
کامیت
4825fec34d

+ 16 - 1
src/api/salesDetailNew.js

@@ -123,7 +123,22 @@ export const salesDisablePromo = params => {
       method: 'post'
     })
   }
- 
+ // 更换活动
+ export const salesChangePromo = params => {
+  return axios({
+    url: '/salesn/detail/changePromo',
+    data: params,
+    method: 'post'
+  })
+}
+// 新活动是否参与
+export const salesDetailAddPromo = (params) => {
+  return axios({
+    url: '/salesn/detail/addPromo',
+    data: params,
+    method: 'post'
+  })
+}
 // 修改销售明细取消数量
 export const salesDetailUpdateCancelQty = (params) => {
   return axios({

+ 2 - 2
src/views/promotionRulesManagement/dealerPromotions/detailModal.vue

@@ -171,8 +171,8 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       spinning: false,
       formItemLayout: {
-        labelCol: { span: 5 },
-        wrapperCol: { span: 16 }
+        labelCol: { span: 4 },
+        wrapperCol: { span: 20 }
       },
       form: {
         promotionRuleType: undefined,

+ 33 - 6
src/views/salesManagement/salesQueryNew/comps/detailProductList.vue

@@ -18,17 +18,20 @@
             :column-width-resize-option="columnWidthResizeOption"
           />
         <div v-show="showEmpty" class="empty-data">暂无数据</div>
+        <!-- 活动规则详情 -->
+        <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     </a-spin>
   </template>
   
   <script>
     import { commonMixin } from '@/utils/mixin'
+    import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detailModal.vue'
     import { salesPromoQueryList } from '@/api/salesNew'
     import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
     export default {
       name: 'DetailProductList',
       mixins: [commonMixin],
-      components: { },
+      components: { detailModal },
       props: {
         newLoading: Boolean,
         detailData: {
@@ -71,6 +74,8 @@
       data () {
         return {
           spinning: false,
+          openDetailModal: false,
+          detailSn: null,
           activeList: [], // 活动列表
           dataSource: [],
           tableHeight: this.maxHeight,
@@ -138,7 +143,7 @@
                     {record.promo?(
                       <div>
                         <strong style="margin-right:10px;font-size:14px;">{record.promo.promotion.title} ({record.promo.promotionRule.description})</strong>
-                        <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick={()=>_this.showDesc(record)}>
+                        <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick={()=>_this.showDesc(record.promo)}>
                           <a-icon title="查看活动详情" type="eye"/> 活动详情
                         </span>
                       </div>
@@ -147,12 +152,28 @@
                         款数:<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.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
                     </div>
                   </div>
                 ):(<span>{data}</span>)}
               </div>
             )
           }
+          // 显示折扣价
+          const discountPriceFormat = function(record,data,h) {
+            return (
+              <div>
+                {_this.toThousands(data)}
+                {record.promotionFlag == 'GIFT' || record.promotionFlag == 'DISCOUNT' ? (
+                  <span style="color:#f5222d;" title="原价">({ _this.toThousands(record.origPrice)})</span>
+                ):''}
+              </div>
+            )
+          }
+
           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 +202,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: 120,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: 120,key: "l", align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return discountPriceFormat(row,row[column.field],h)} })
                 }
             }
 
@@ -212,6 +233,11 @@
         }
       },
       methods: {
+        // 关闭详情弹窗
+        closeDetailModal () {
+          this.detailSn = null
+          this.openDetailModal = false
+        },
          // 合并活动分类单元格
         bodyCellSpan({ row, column, rowIndex }) {
           if (row.id.indexOf('promo-')>=0) {
@@ -229,8 +255,9 @@
           }
         },
          // 查看活动详情
-        showDesc(e,item){
-
+        showDesc(row){
+          this.detailSn = row.promoRuleSn
+          this.openDetailModal = true
         },
         // 获取销售单参与的活动列表
         pageInit(){

+ 20 - 24
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],
@@ -363,7 +373,7 @@
       columns () {
         const arr = [
           { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-          { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center', sorter: true },
+          { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center' },
           { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '20%', align: 'left' },
           // { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
           { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '8%', align: 'center' },
@@ -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) {

+ 1 - 9
src/views/salesManagement/salesQueryNew/detail.vue

@@ -239,7 +239,6 @@ export default {
       spinningAudit: false,
       auditText: null,
       fromRouter: null,
-      activeList: [],
       warehouseSn: undefined
     }
   },
@@ -292,14 +291,7 @@ export default {
     },
     // 打开缺货明细
     openStockOut () {
-      const showMoad = false
-      this.activeList.map(item => {
-        if(!showMoad){
-          showMoad = this.$refs['active-'+item.promoRuleSn][0].outStockStr != ''
-        }
-      })
-
-      if (this.$refs.normalProduct.outStockStr != ''||showMoad) {
+      if (this.$refs.productList.outStockStr != '') {
         this.showStockOut = true
       } else {
         this.$info({

+ 37 - 7
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, salesDetailAddPromo } from '@/api/salesDetailNew'
 import { salesDetailBySn,salesPromoQueryCount, salesWriteSubmit, submitCheck, updateBatch, salesPromoQueryList, salesQueryUnPartPromo,salesPromoValidaSubmit } from '@/api/salesNew'
 export default {
   name: 'SalesNewEdit',
@@ -157,6 +157,7 @@ export default {
     return {
       spinning: false,
       activeList:[], // 活动列表
+      newActiveList: [], // 新活动列表
       activeDesKey: {},
       salesBillSn: null, // 销售单sn
       detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
@@ -217,7 +218,7 @@ export default {
     // 获取销售单参与的活动列表
     async getActiveList(){
       const hasNewActive = await salesQueryUnPartPromo({ salesBillSn: this.$route.params.sn }).then(res => res.data)
-      console.log(hasNewActive)
+      this.newActiveList = hasNewActive
       // 有新活动
       if(hasNewActive.length){
         this.showNewActiveModal(hasNewActive)
@@ -230,9 +231,12 @@ export default {
     },
     // 新活动确认弹框
     showNewActiveModal(data){
+      const _this = this
       let arr = []
+      let promoSnList = []
       data.map(item => {
         arr.push(item.title)
+        promoSnList.push(item.promotionSn)
       })
       this.$confirm({
         title: '新活动提醒',
@@ -248,7 +252,16 @@ export default {
           </div>
         </div>,
         onOk() {
-           
+          salesDetailAddPromo({
+            "salesBillSn": _this.salesBillSn,
+            "promoSnList": promoSnList
+          }).then(res => {
+            if(res.status == 200){
+              _this.pageInit()
+            }else{
+              _this.showNewActiveModal(_this.newActiveList)
+            }
+          })
         },
         onCancel() {},
       });
@@ -291,11 +304,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) {

+ 7 - 2
src/views/salesManagement/salesQueryNew/stockOutDetailModal.vue

@@ -26,6 +26,11 @@
         :showPagination="false"
         :defaultLoadData="false"
         bordered>
+        <template slot="productCode" slot-scope="text, record">
+          <span style="padding-right: 15px;">{{ text }}</span>
+          <a-badge count="促" v-if="record.promotionFlag=='GIFT'" :number-style="{ backgroundColor: '#52c41a', zoom:'80%' }"></a-badge>
+          <a-badge count="特" v-if="record.promotionFlag=='DISCOUNT'" :number-style="{ backgroundColor: '#faad14', zoom:'80%' }"></a-badge>
+        </template>
       </s-table>
       <div class="btn-cont" style="padding:20px 20px 0;text-align: center;">
         <!-- <a-button @click="isShow=false">关闭</a-button> -->
@@ -50,7 +55,7 @@
 <script>
 import { STable } from '@/components'
 import { commonMixin } from '@/utils/mixin'
-import { salesStockoutDetail, exportStockout, exportGroupStockout } from '@/api/salesDetail'
+import { salesStockoutDetail, exportStockout, exportGroupStockout } from '@/api/salesDetailNew'
 import { hdExportExcel } from '@/libs/exportExcel'
 export default {
   name: 'StockOutDetail',
@@ -107,7 +112,7 @@ export default {
       const _this = this
       const arr = [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productEntity.code', width: '15%', align: 'center', scopedSlots: { customRender: 'productCode' } },
         { title: '产品名称', dataIndex: 'productEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'productEntity.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productEntity.unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },

+ 23 - 10
src/views/salesManagement/waitDispatchNew/queryPart.vue

@@ -96,6 +96,8 @@
               :checkbox-option="checkboxOption"
             />
         <div v-show="showEmpty" class="empty-data">暂无数据</div>
+        <!-- 活动规则详情 -->
+        <detailModal :openModal="openDetailModal" :itemSn="detailSn" @close="closeDetailModal"></detailModal>
     </a-spin>
 
   </div>
@@ -104,13 +106,14 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { salesPromoQueryList } from '@/api/salesNew'
+import detailModal from '@/views/promotionRulesManagement/dealerPromotions/detailModal.vue'
 import { salesDetailAllList, salesPromoDetailCount, salesDetaiCount } from '@/api/salesDetailNew'
 import { STable, VSelect } from '@/components'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 export default {
   name: 'QueryPart',
   mixins: [commonMixin],
-  components: { STable, VSelect, chooseWarehouse },
+  components: { STable, VSelect, chooseWarehouse, detailModal },
   props: {
     newLoading: {
         type: Boolean,
@@ -128,6 +131,8 @@ export default {
   data () {
     return {
       advanced: true, // 高级搜索 展开/关闭
+      openDetailModal: false,
+      detailSn: null,
       productType: [],
       salesBillSn: '',
       detailData: null,
@@ -261,15 +266,19 @@ export default {
                 {record.promo?(
                   <div>
                     <strong style="margin-right:10px;font-size:14px;">{record.promo.promotion.title} ({record.promo.promotionRule.description})</strong>
-                    <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick={()=>_this.showDesc(record)}>
+                    <span style="margin-left:10px;color:#00aaff;cursor: pointer;" onClick={()=>_this.showDesc(record.promo)}>
                       <a-icon title="查看活动详情" type="eye"/> 活动详情
                     </span>
                   </div>
                 ):(<div></div>)}
                 <div>
-                    款数:<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>):('')}
+                  款数:<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.expenseAccountFlag!='WAIT' ? record.expenseAccountFlagDictValue : ''}
                 </div>
               </div>
             ):(<span>{data}</span>)}
@@ -310,11 +319,15 @@ export default {
     }
   },
   methods: {
-    //  产品分类  change
-    changeProductType (val, opt) {
-      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
-      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
-      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    // 查看活动详情
+    showDesc(row){
+      this.detailSn = row.promoRuleSn
+      this.openDetailModal = true
+    },
+    // 关闭详情弹窗
+    closeDetailModal () {
+      this.detailSn = null
+      this.openDetailModal = false
     },
     // 合并活动分类单元格
     bodyCellSpan({ row, column, rowIndex }) {

+ 1 - 1
vue.config.js

@@ -108,7 +108,7 @@ 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', //  预发布
         ws: false,