浏览代码

接口调试

lilei 2 年之前
父节点
当前提交
46ca481c9a

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1678064788970
+  "version": 1678081077776
 }

+ 1 - 1
src/api/sales.js

@@ -110,7 +110,7 @@ export const salesSave = (params) => {
 //  销售 删除
 export const salesDel = (params) => {
   return axios({
-    url: `/sales/delete/${params.id}`,
+    url: `/sales/delete`,
     data: params,
     method: 'post'
   })

+ 9 - 0
src/api/salesDetail.js

@@ -11,6 +11,15 @@ export const salesDetailList = (params) => {
     method: 'post'
   })
 }
+
+// 查询已经添加的产品sn数组
+export const queryCheckedList = (params) => {
+  return axios({
+    url: `/salesDetail/queryProductSnListBySalesBillSn/${params.salesBillSn}`,
+    method: 'post'
+  })
+}
+
 //  销售详情 新增配件
 export const salesDetailInsert = (params) => {
   return axios({

+ 10 - 1
src/views/salesManagement/salesQueryNew/chooseProductModal.vue

@@ -181,11 +181,13 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button
+          <span style="color:#999;" v-if="hasChecked(record)">已添加</span>
+          <a-button
           size="small"
           type="link"
           class="button-primary"
           @click="handleAdd(record)"
+          v-else
           id="productInfoList-edit-btn">添加</a-button>
         <a-button
           size="small"
@@ -242,6 +244,10 @@ export default {
     },
     newLoading: {
       type: Boolean
+    },
+    checkedList: {
+      type: Array,
+      default:() => []
     }
   },
   watch: {
@@ -406,6 +412,9 @@ export default {
     }
   },
   methods: {
+    hasChecked(item){
+      return this.checkedList.includes(item.productSn)
+    },
     // 查询
     searchForm () {
       if (this.hasVaild) {

+ 21 - 57
src/views/salesManagement/salesQueryNew/edit.vue

@@ -277,6 +277,7 @@
     <chooseProductModal
       ref="partQuery"
       :showModal="openChooseProduct"
+      :checkedList = "checkedProductList"
       @viewRecord="hanldSalesRecord" 
       @close="openChooseProduct=false"
       @add="insterProduct"
@@ -306,7 +307,7 @@ import productSalesRecordModal from './productSalesRecordModal.vue'
 import { stockByProductSn } from '@/api/stock'
 import { queryByCustomerSn } from '@/api/shelf'
 import { salesDetail, salesWriteSubmit, salesWriteDiscount, salesDetailPrint, salesDetailExport, salesDel } from '@/api/sales'
-import { salesDetailList, salesDetailInsert, salesDetailInsertBatch, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll, salesDetailInsertImport } from '@/api/salesDetail'
+import { salesDetailList, salesDetailInsert, salesDetailInsertBatch, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll, salesDetailInsertImport, queryCheckedList } from '@/api/salesDetail'
 import outInDetialModal from './outInDetialModal.vue'
 import chooseShelfProduct from './chooseShelfProduct.vue'
 import PrintPanel from '@/views/common/printPanel.vue'
@@ -335,6 +336,7 @@ export default {
       openSettleModal: false, // 打开收款弹框
       enableFundAccount: false, // 是否开启资金账户管理
       showShelfModal: false, // 货架产品弹框
+      checkedProductList: [], // 已选所有产品
       delLoading: false,
       detailData: { discountAmount: 0, id: null, salesBillSn: '' }, // 订单基础数据
       dataSource: [],
@@ -352,7 +354,7 @@ export default {
         this.disabled = true
         this.spinning = true
         this.productForm.salesBillSn = this.$route.params.sn
-        console.log(111)
+        this.getChoosedList({salesBillSn: this.$route.params.sn})
         return salesDetailList(Object.assign(parameter, this.productForm)).then(res => {
           let data
           if (res.status == 200) {
@@ -424,11 +426,11 @@ export default {
       if(e.key == 3){
         this.showShelfModal=true
       }
-      if(e.key == 2){
+      if(e.key == 2){ // 清空列表
         this.delSalerOrder()
       }
-      if(e.key == 1){
-        this.delJijian()
+      if(e.key == 1){ // 删除急件
+        this.delSalerOrder(1)
       }
     },
     // 打印预览/快捷打印
@@ -468,6 +470,12 @@ export default {
       this.openSalesRecordModal = true
       this.$refs.salseRecord.getDetail(this.detailData.buyerSn, row.productSn, row)
     },
+    // 查询已选所以产品
+    getChoosedList(params){
+      queryCheckedList(params).then(res => {
+        this.checkedProductList = res.data || []
+      })
+    },
     // 更新产品列表
     updateData (priceType) {
       // 价格类型变更
@@ -597,68 +605,23 @@ export default {
         }
       })
     },
-    // 删除急件
-    delJijian(){
+    // 清空已选产品
+    delSalerOrder (oosFlag) {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '确认要删除所有急件吗?删除后不可恢复。',
+        content: oosFlag==1?'确认要删除所有急件吗?删除后不可恢复。':'确认要清空已选产品列表吗?',
         centered: true,
         closable: true,
         onOk () {
           _this.spinning = true
-          salesDel({ id: _this.orderId }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.handleBack()
-            }
-            _this.spinning = false
-          })
-        }
-      })
-    },
-    // 删除销售单
-    delSalerOrder () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要清空已选产品列表吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.spinning = true
-          salesDel({ id: _this.orderId }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.handleBack()
-            }
-            _this.spinning = false
-          })
-        }
-      })
-    },
-    // 删除已选产品
-    delSalerDetailAll () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要整单删除吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          _this.delLoading = true
-          _this.spinning = true
-          salesDetailDelAll({ salesBillSn: _this.detailData.salesBillSn }).then(res => {
+          let params = { id: _this.orderId, oosFlag: oosFlag==1 ? 1 : undefined }
+          console.log(params,oosFlag==1)
+          salesDel(params).then(res => {
             if (res.status == 200) {
               _this.getOrderDetail(true)
-              _this.productForm = {
-                productName: '',
-                productCode: '',
-                orderBy: 'sales_bill_detail.CREATE_DATE desc'
-              }
+              _this.$message.success(res.message)
             }
-            _this.$message.info(res.message)
-            _this.delLoading = false
             _this.spinning = false
           })
         }
@@ -808,6 +771,7 @@ export default {
               vm.resetForm()
             }else{
               vm.spinning = false
+              vm.checkedProductList = []
             }
             // 查询关联的客户货架信息
             if (vm.detailData && vm.detailData.buyerSn) {

+ 1 - 1
src/views/salesManagement/salesQueryNew/list.vue

@@ -444,7 +444,7 @@ export default {
         closable: true,
         onOk () {
           _this.spinning = true
-          salesDel({ id: row.id }).then(res => {
+          salesDel({ id: row.id, mainFlag: 1 }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()

+ 2 - 2
vue.config.js

@@ -211,8 +211,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.0.103/qpls-md',
-        target: 'http://p.iscm.360arrow.com/qpls-md',
+        target: 'http://192.168.0.183/qpls-md',
+        // target: 'http://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,
         changeOrigin: true,