Browse Source

修改bug、

web100 2 years ago
parent
commit
3e57e77db4

+ 9 - 4
src/api/tirePartsMall/salesManagement/saleOrder.js

@@ -39,12 +39,17 @@ export const generateShipTask = (data) => {
   })
 }
 
-export const tradingBox = (id) => {
+export const tradingBox = (data) => {
   return request({
     url: '/api/blade-sales-part/shipItems/update',
     method: 'post',
-    data: {
-      id
-    }
+    data: data
+  })
+}
+export const delOrderItem = (data) => {
+  return request({
+    url: '/api/blade-sales-part/orderItems/remove',
+    method: 'get',
+    params: data
   })
 }

+ 9 - 1
src/views/businessManagement/salesOrder/configuration/customerContact.json

@@ -240,7 +240,15 @@
         }
       ]
     },
-
+    {
+      "label": "返利价格",
+      "prop": "purchaseRebatePrice",
+      "index": 12,
+      "width": 100,
+      "cell": false,
+      "slot": true,
+      "overHidden": true
+    },
     {
       "label": "采购价格",
       "prop": "purchaseAmount",

+ 27 - 12
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -255,6 +255,14 @@
               <span v-else>{{row.storageQuantity}}</span>
             </template>-->
 
+            <template slot="purchaseRebatePrice" slot-scope="{ row }">
+              <el-input v-if="false" v-model="row.purchaseRebatePrice" @focus="getPurchasePrice(row)" allow-create
+                filterable v-input-limit="2" default-first-option>
+                <el-option v-for="(item, index) in purchasePriceOption" :key="index" :label="item.purchaseRebatePrice"
+                  :value="item.purchaseRebatePrice"></el-option>
+              </el-input>
+              <span v-else>{{ row.purchaseRebatePrice }}</span>
+            </template>
             <template slot="purchaseAmount" slot-scope="{ row }">
               <el-input v-if="row.$cellEdit" v-model="row.purchaseAmount" @focus="getPurchasePrice(row)" allow-create
                 filterable v-input-limit="2" default-first-option>
@@ -1723,6 +1731,7 @@ export default {
       console.log("采购金额获取:" + row);
       getPurchasePrice({ code: row.code }).then(res => {
         this.purchasePriceOption = res.data.data
+
       })
     },
     // 销售金额获取
@@ -2697,6 +2706,7 @@ export default {
           this.$set(list[item], 'sort', this.maxGoodsNum + 1)
           console.log(list[item])
           this.$set(list[item], 'purchaseAmount', list[item].purchasePrice)
+
           // 积分
           this.$set(list[item], 'integralMultiples', 0)
           this.$set(list[item], 'integral', 0)
@@ -2711,6 +2721,8 @@ export default {
             this.$set(buyFree[item], 'cname', list[item].productCategory)
             this.$set(buyFree[item], 'sort', this.maxGoodsNum + 2)
             this.$set(buyFree[item], 'purchaseAmount', list[item].purchasePrice)
+            this.$set(buyFree[item], 'purchaseRebatePrice', list[item].purchaseRebatePrice)
+
             // 积分
             this.$set(buyFree[item], 'integralMultiples', 0)
             this.$set(buyFree[item], 'integral', 0)
@@ -2739,25 +2751,28 @@ export default {
           getPurchasePrice({ code: list[item].code }).then(rest => {
             if (rest.data.data.length > 0) {
               console.log('rest>>>1', rest);
-              // this.$refs.crudContact.list[item].purchaseRebatePrice =  rest.data.data[0].purchaseRebatePrice
-              // this.$set(this.$refs.crudContact.list[this.$refs.crudContact.list.length-1],'purchaseRebatePrice',rest.data.data[0].purchaseRebatePrice)
+              // list[item].purchaseRebatePrice =  rest.data.data[0].purchaseRebatePrice
+              // this.purchasePriceOption = rest.data.data
               this.$set(list[item], 'purchaseRebatePrice', rest.data.data[0].purchaseRebatePrice)
-
-              console.log('>>>', list);
+              // this.$set(this.$refs.crudContact.list[this.$refs.crudContact.list.length-1],'purchaseRebatePrice',rest.data.data[0].purchaseRebatePrice)
+              // this.$set(list[item], 'purchaseRebatePrice', rest.data.data[0].purchaseRebatePrice)
+              console.log(list[item].purchaseRebatePrice);
+              // for (let i = 0; i < this.$refs.crudContact.list.length; i++) {
+              //   this.$refs.crudContact.list[i].purchaseRebatePrice = rest.data.data[0].purchaseRebatePrice;
+              // }
+              this.$refs.crudContact.rowCellAdd(list[item]);
             } else {
               console.log('rest>>>2', rest);
               this.$set(this.$refs.crudContact.list[this.$refs.crudContact.list.length - 1], 'purchaseRebatePrice', 0)
               // this.$refs.crudContact.list[item].purchaseRebatePrice = 0
-
+              this.$refs.crudContact.rowCellAdd(list[item]);
             }
+          }).catch(err=>{
+            this.$refs.crudContact.rowCellAdd(list[item]);
           })
-          this.$refs.crudContact.rowCellAdd(list[item]);
-          console.log('rest>>>', this.$refs.crudContact);
-
-
-          console.log('rest>>>3', item);
-
-          console.log(this.$refs.crudContact);
+          console.log(list[item].purchaseAmount);
+            // this.$refs.crudContact.rowCellAdd(list[item]);
+            console.log('rest>>>', this.$refs.crudContact);
           this.$nextTick(() => {
             this.quantityChange(list[item])
           })

+ 4 - 9
src/views/tirePartsMall/basicData/accountManagement/detailsPage.vue

@@ -49,16 +49,11 @@ export default {
           label: '账户类型',
           prop: "accountType",
           type: 'select',
-          dicData: [
-            {
-              label: "人民币",
-              value:"人民币",
-            },
-            {
-              label: "外币",
-              value: "外币",
+          dicUrl: "/api/blade-system/dict-biz/dictionary?code=accountType",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
             }
-          ],
         }, {
           label: '开户银行',
           prop: "bankDeposit"

+ 6 - 3
src/views/tirePartsMall/salesManagement/outboundTask/index.vue

@@ -160,7 +160,7 @@ export default {
         },
         {
           label: '发货数量',
-          prop: "goodsTotalShipNum",
+          prop: "sendTotalNum",
           width: 100,
           overHidden: true,
         },
@@ -222,11 +222,12 @@ export default {
       this.option.searchMenuPosition = "right";
     }
     this.option.selectable = (row, index) => {
-      return row.statusName === "待处理";
+      return Number(row.sendTotalNum) !== Number(row.goodsTotalNum);
     }
   },
   methods: {
     selectionChange(list) {
+      console.log(list);
       this.selectionList = list
     },
     dispatching() {
@@ -333,6 +334,8 @@ export default {
        * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
        */
       const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      // this.option = await this.getColumnData(this.getColumnName(271), this.optionList);
+
       if (inSave) {
         this.$message.success("保存成功");
         //关闭窗口
@@ -343,7 +346,7 @@ export default {
     async resetColumnTwo(ref, option, optionBack, code) {
       console.log(this[option]);
       console.log(this[optionBack]);
-      // this[option] = this[optionBack];
+      this[option] = this[optionBack];
       const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
       if (inSave) {
         this.$message.success("重置成功");

+ 1 - 1
src/views/tirePartsMall/salesManagement/outboundWorkOrder/detailsPage.vue

@@ -10,7 +10,7 @@
         <!--        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
         <!--                   @click="confirmEditing">编辑-->
         <!--        </el-button>-->
-        <el-button class="el-button--small-yh" type="warning" size="small" v-if="form.statusName !== '已出库'"
+        <el-button class="el-button--small-yh" type="warning" size="small" v-if="form.statusName == '已出库'"
           @click="revoke">撤销出库
         </el-button>
         <el-button class="el-button--small-yh" type="primary" size="small" @click="editCustomer" v-if="form.statusName !== '已出库'">保存数据

+ 149 - 47
src/views/tirePartsMall/salesManagement/saleOrder/detailsPage.vue

@@ -7,19 +7,52 @@
                 </el-button>
             </div>
             <div class="add-customer-btn">
-                <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"
-                            @click="confirmEditing">编
+                <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small"
+                    v-if="!editButton" @click="confirmEditing">编 
                 </el-button>
-                <el-button class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据
+                <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
+                    @click="editCustomer">保 存
                 </el-button>
-                <el-button class="el-button--small-yh" type="primary" size="small" v-if="form.status !== '已发货'"
-                    @click="generateOutbound">生成出库任务
+                <el-button class="el-button--small-yh" style="margin-left: 6px;" type="success" size="small"
+                    v-if="form.generateTask !== '已生成'" @click="generateOutbound">生成任务
                 </el-button>
+                <el-dropdown style="padding: 0 6px;line-height: 0">
+                    <el-button type="danger" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
+                        售 后<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                        <el-dropdown-item @click.native="applySettlement('申请')">申请退款
+                        </el-dropdown-item>
+                        <el-dropdown-item @click.native="applySettlement('确认')">确认退款
+                        </el-dropdown-item>
+                    </el-dropdown-menu>
+                </el-dropdown>
+                <el-dropdown style="line-height: 0">
+                    <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
+                        审 批<i class="el-icon-arrow-down el-icon--right"></i>
+                    </el-button>
+                    <el-dropdown-menu slot="dropdown">
+                        <el-dropdown-item @click.native="applySettlement('审批')">审批
+                        </el-dropdown-item>
+                        <el-dropdown-item @click.native="applySettlement('请核')">请核进度
+                        </el-dropdown-item>
+                        <el-dropdown-item @click.native="applySettlement('撤销')">撤销请核
+                        </el-dropdown-item>
+
+                    </el-dropdown-menu>
+                </el-dropdown>
             </div>
         </div>
         <div style="margin-top: 50px">
             <trade-card title="基础信息">
-                <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
+                <avue-form :option="optionForm" v-model="form" ref="form">
+                    <template slot-scope="{row,index}" slot="contacts">
+                        <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" filterable
+                            @change="contactsChange($event)">
+                            <el-option v-for="item in contactsOption" :key="item.id" :label="item.contacts"
+                                :value="item.contacts" />
+                        </el-select>
+                    </template></avue-form>
             </trade-card>
             <trade-card title="明细信息">
                 <el-tabs v-model="activeName" type="card">
@@ -37,8 +70,8 @@
                                     :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                                     @click="$refs.formContacts.rowEdit(row, index)">编辑
                                 </el-button>
-                                <el-button icon="el-icon-delete" :size="size" :disabled="disabled  || isDisabled" :type="type"
-                                    @click="rowDelBox(row, index, 'orderItemsList')">删除
+                                <el-button icon="el-icon-delete" :size="size" :disabled="disabled || isDisabled"
+                                    :type="type" @click="rowDelBox(row, index, 'orderItemsList')">删除
                                 </el-button>
                             </template>
                         </avue-crud>
@@ -83,7 +116,8 @@
 </template>
 
 <script>
-import { getDetails, submit, generateShipTask, tradingBox } from "@/api/tirePartsMall/salesManagement/saleOrder";
+import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
+import { getDetails, submit, generateShipTask, tradingBox,delOrderItem } from "@/api/tirePartsMall/salesManagement/saleOrder";
 import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
 import reportDialog from "@/components/report-dialog/main";
 
@@ -92,6 +126,7 @@ export default {
     data() {
         return {
             isDisabled: false,
+            contactsOption: [],
             switchDialog: false,
             activeName: "sale_detail",
             disabled: false,
@@ -107,7 +142,7 @@ export default {
                 column: [{
                     label: '客户',
                     prop: "customerId",
-                    disabled: true,
+                    disabled: false,
                     type: 'select',
                     props: {
                         label: 'cname',
@@ -115,13 +150,30 @@ export default {
                     },
                     cascader: ['recAddress'],
                     change: (data) => {
-                        if (this.$refs.form.DIC.customerId || data.value) {
-                            for (let item of this.$refs.form.DIC.customerId) {
-                                if (item.id == data.value) {
-                                    //   后端返回数据暂无联系人、地址等数据,无法下拉默认
-                                }
-                            }
+                        console.log(data.value);
+                        if (data.value) {
+                            getCustom({ id: data.value }).then(res => {
+                                console.log(res.data.data);
+                                this.form.storageId = res.data.data.deliveryWarehouseId
+                                this.form.contacts = res.data.data.corpsAttnList[0].cname
+                                this.form.phone = res.data.data.corpsAttnList[0].tel
+                                this.contactsOption = res.data.data.corpsAddrList
+                                this.form.recAddress = res.data.data.corpsAddrList[0].id
+
+                            })
                         }
+
+                        // if (this.$refs.form.DIC.customerId || data.value) {
+                        //     for (let item of this.$refs.form.DIC.customerId) {
+                        //         if (item.id == data.value) {
+                        //             console.log(data);
+                        //             console.log(this.$refs.form);
+                        //             console.log(item);
+                        //             //   后端返回数据暂无联系人、地址等数据,无法下拉默认
+                        //             this.form.phone = item.tel
+                        //         }
+                        //     }
+                        // }
                     },
                     dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
                     rules: [{
@@ -167,7 +219,13 @@ export default {
                     value: '网络支付'
                 }, {
                     label: '联系人',
+                    type: "select",
                     prop: "contacts",
+                    props: {
+                        label: 'address',
+                        value: 'id'
+                    },
+                    dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
                 }, {
                     label: '电话',
                     prop: "phone",
@@ -175,17 +233,12 @@ export default {
                     label: '收货地址',
                     prop: "recAddress",
                     type: 'select',
-                    disabled:true,
+                    disabled: true,
                     props: {
                         label: 'address',
                         value: 'id'
                     },
-                    dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}',
-                    rules: [{
-                        required: true,
-                        message: " ",
-                        trigger: "blur"
-                    }]
+                    dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
                 }, {
                     label: '配送方式',
                     type: 'select',
@@ -348,7 +401,7 @@ export default {
                     disabled: false,
                     overHidden: true,
                     width: 100
-                }, 
+                },
                 {
                     label: '单位',
                     prop: 'units',
@@ -383,7 +436,7 @@ export default {
                     disabled: false,
                     width: 100
                 },
-    
+
                 {
                     label: '价格',
                     prop: 'price',
@@ -391,13 +444,15 @@ export default {
                     width: 100,
                     disabled: false,
                 },
-             
+
                 {
                     label: '发货数量',
                     prop: 'sendNum',
                     disabled: false,
                     overHidden: true,
-                    width: 100
+                    width: 100,
+                    disabled: true
+
                 },
                 // {
                 //     label: '利润',
@@ -409,8 +464,9 @@ export default {
                     label: '小计',
                     prop: 'subTotalMoney',
                     overHidden: true,
-                    width: 100
-                }, 
+                    width: 100,
+                    disabled: true
+                },
                 // {
                 //     label: '返利',
                 //     prop: 'thisAmount',
@@ -421,13 +477,16 @@ export default {
                     label: '成本',
                     prop: 'costprie',
                     overHidden: true,
-                    width: 100
+                    width: 100,
+                    disabled: true
                 },
                 {
                     label: '毛利',
                     prop: 'grossProfit',
                     overHidden: true,
-                    width: 100
+                    width: 100,
+                    disabled: true
+
                 },
                 {
                     label: '备注',
@@ -510,8 +569,35 @@ export default {
         detailData: Object
     },
     async created() {
+        this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
+            console.log('走i在');
+            if (this.formContacts.goodsId !== value) {
+                goodsDetail({ id: value }).then(res => {
+                    this.formContacts.goodsNo = res.data.data.code
+                    this.formContacts.brandId = res.data.data.brandId
+                    this.formContacts.propertyName = res.data.data.specificationAndModel
+                    this.formContacts.pattern = res.data.data.brandItem
+                    this.formContacts.goodsDescription = res.data.data.goodsDescription
+                    this.formContacts.units = res.data.data.unit
+                    if (res.data.data.whether == 0) {
+                        this.findObject(this.optionContactsBack.column, "dot").disabled = true
+                    } else {
+                        this.findObject(this.optionContactsBack.column, "dot").disabled = false
+                        dotList({
+                            storageId: this.form.storageId,
+                            goodsId: this.formContacts.goodsId
+                        }).then(res => {
+                            this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
+                        })
+                    }
+                })
+            }
+        }
+        console.log(1);
         this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
+        console.log('this.optionContacts.column',this.optionContacts.column);
         this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
+            console.log('走i在');
             if (this.formContacts.goodsId !== value) {
                 goodsDetail({ id: value }).then(res => {
                     this.formContacts.goodsNo = res.data.data.code
@@ -538,19 +624,20 @@ export default {
         this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
         this.key++
         if (this.onLoad.id && this.detailData.id) {
+            console.log(1);
             this.refresh(this.onLoad.id, true)
         } else if (this.onLoad.id) {
+            console.log(2);
             this.refresh(this.onLoad.id, true)
         }
 
     },
     methods: {
         generateOutbound() {
-            this.$confirm(`${this.form.status === "待发货" ? '已生成是否重新生成?' : '是否确认生成'}`, '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(() => {
+            if(this.form.orderItemsList.length <=0){
+                this.$message.error('请录入明细');
+            
+            }else{
                 this.$refs["form"].validate((valid, done) => {
                     done();
                     if (valid) {
@@ -568,7 +655,20 @@ export default {
                         });
                     }
                 })
-            })
+            }
+        },
+
+        //联系人change
+        contactsChange(e) {
+            console.log(e);
+            console.log(this.contactsOption);
+
+            // 假设this.contactsOption是你的数组对象
+            let matchedContact = this.contactsOption.find(item => item.contacts == e);
+            // 判断是否找到匹配的对象
+            this.$set(this.form,'phone',matchedContact.tel)
+            this.$set(this.form,'recAddress',matchedContact.belongtoarea + matchedContact.detailedAddress)
+
         },
         //修改提交触发
         editCustomer() {
@@ -607,8 +707,8 @@ export default {
                 console.log('res', res);
                 this.form = res.data.data
                 // console.log(this.form.businessSource);
-                this.form.orderItemsList.forEach((items)=>{
-                    if(!items.subTotalMoney){
+                this.form.orderItemsList.forEach((items) => {
+                    if (!items.subTotalMoney) {
                         items.subTotalMoney = items.goodsNum * items.price
                         items.grossProfit = items.subTotalMoney - items.costprie
                     }
@@ -620,11 +720,11 @@ export default {
                     //不能录入不能删除
                     this.$set(this.optionContactsBack, "addBtn", false)
                     this.isDisabled = true
-                    this.$set(this.form,'shipType','物流')
-                    this.$set(this.form,'receivableType','网络支付')
+                    this.$set(this.form, 'shipType', '物流')
+                    this.$set(this.form, 'receivableType', '网络支付')
                     this.optionContactsBack.column.forEach(item => {
                         this.$set(item, 'disabled', true)
-                        if(item.label == '批次号' || item.label == '备注'){
+                        if (item.label == '批次号' || item.label == '备注') {
                             item.disabled = false
                         }
                     })
@@ -639,13 +739,13 @@ export default {
                     })
 
                 } else {
-                    this.$set(this.form,'shipType','物流')
-                    this.$set(this.form,'receivableType','现金')
+                    this.$set(this.form, 'shipType', '物流')
+                    this.$set(this.form, 'receivableType', '现金')
                     this.optionContactsBack.column.forEach(item => {
                         this.$set(item, 'disabled', false)
                     })
                     this.optionContactsBack.column.forEach(item => {
-                        if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '商品描述' || item.label === '批次号') {
+                        if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '商品描述') {
                             item.disabled = true;
                         }
                     })
@@ -665,8 +765,10 @@ export default {
                 type: "warning"
             }).then(() => {
                 if (row.id) {
-                    tradingBox(row.id).then(res => {
-                        this.form.contactsList.splice(index, 1);
+                    console.log(index);
+                    console.log(this.form.orderItemsList);
+                    delOrderItem({ids:row.id}).then(res => {
+                        this.form.orderItemsList.splice(index, 1);
                         this.$message.success("操作成功!");
                     });
                 } else {