Browse Source

配件精灵8月2号修改内容

caojunjie 2 years ago
parent
commit
47ae07d8ef

+ 11 - 0
src/api/basicData/salesOrder.js

@@ -114,6 +114,7 @@ export function getAllgoods() {
     method: 'get',
   })
 }
+// 确认收款
 export function collectPayment(data) {
   return request({
     url: '/api/blade-purchase-sales/appParts/collectPayment',
@@ -158,3 +159,13 @@ export const delivery = (data) => {
       data: data
   })
 }
+
+// 根据产品ID和客户id获取产品单价
+export const obtainPrice = (data) => {
+  return request({
+    url: '/api/blade-client/goodsDescParts/obtainPrice',
+    method: 'get',
+    params: data
+  })
+}
+

+ 18 - 0
src/api/financialManagement/financialManagement.js

@@ -92,3 +92,21 @@ export const consumptionRecords = (data) => {
     params: data
   })
 }
+
+// 积分获取明细记录
+export const integralRecord = (data) => {
+  return request({
+    url: '/api/blade-purchase-sales/appParts/integralRecord',
+    method: 'get',
+    params: data
+  })
+}
+
+// 积分总换明细记录
+export const integralExchangeRecord = (data) => {
+  return request({
+    url: '/api/blade-purchase-sales/appParts/integralExchangeRecord',
+    method: 'get',
+    params: data
+  })
+}

+ 183 - 33
src/views/client/detailsInfo.vue

@@ -167,7 +167,7 @@
                 <el-tab-pane label="充值明细" name="czmx">
                     <avue-crud :option="czoption"
                                :data="dataList"
-                               ref="crud"
+                               ref="crudczmx"
                                v-model="czform"
                                :page.sync="czmxpage"
                                :search.sync="czmxsearch"
@@ -184,18 +184,49 @@
                 <el-tab-pane label="会员卡金额消费记录" name="jexfjl">
                     <avue-crud :option="hykoption"
                                :data="hykdataList"
-                               ref="crud"
+                               ref="crudhyk"
                                v-model="hykform"
                                :page.sync="hykmxpage"
                                :search.sync="hykmxsearch"
                                :table-loading="hykmxloading"
-                               @search-change="czmxsearchChange"
-                               @size-change="czmxsizeChange"
-                               @refresh-change="czmxrefreshChange"
-                               @saveColumn="czmxsaveColumn"
-                               @resetColumn="czmxresetColumn"
+                               @search-change="hyksearchChange"
+                               @size-change="hyksizeChange"
+                               @refresh-change="hykrefreshChange"
+                               @saveColumn="hyksaveColumn"
+                               @resetColumn="hykresetColumn"
                                @on-load="hykmxonLoad"
                                @search-criteria-switch="searchCriteriaSwitch">
+                        <template slot-scope="{ row, index }" slot="sysNo">
+                            <span style="color: #409EFF;cursor: pointer" @click.stop="editOrder(row)">{{ row.sysNo}}</span>
+                        </template>
+                    </avue-crud>
+                </el-tab-pane>
+                <el-tab-pane label="积分获取明细" name="jifenhuoqu">
+                    <avue-crud :option="jfhqmxoption"
+                               :data="jfhqjldataList"
+                               ref="crudjfhqmx"
+                               v-model="jfhqjlform"
+                               :page.sync="jfhqjlpage"
+                               :search.sync="jfhqjlsearch"
+                               :table-loading="jfhqjlloading"
+                               @refresh-change="jfhqmxrefreshChange"
+                               @saveColumn="jfhqmxsaveColumn"
+                               @resetColumn="jfhqmxresetColumn"
+                               @on-load="jfhqmxonLoad">
+                    </avue-crud>
+                </el-tab-pane>
+                <el-tab-pane label="积分总换明细" name="jfzhmx">
+                    <avue-crud :option="jfzhmxoption"
+                               :data="jfzhmxdataList"
+                               ref="crudjfzhmx"
+                               v-model="jfzhmxform"
+                               :page.sync="jfzhmxpage"
+                               :search.sync="jfzhmxsearch"
+                               :table-loading="jfzhmxloading"
+                               @refresh-change="jfzhmxrefreshChange"
+                               @saveColumn="jfzhmxsaveColumn"
+                               @resetColumn="jfzhmxresetColumn"
+                               @on-load="jfzhmxonLoad">
                     </avue-crud>
                 </el-tab-pane>
             </el-tabs>
@@ -204,11 +235,11 @@
 </template>
 
 <script>
-import { optionList, sellOption, capitalOption, czoption,hykoption } from "./js/optionList";
+import { optionList, sellOption, capitalOption, czoption,hykoption,jfhqmxoption,jfzhmxoption } from "./js/optionList";
 import { getList, getCorpsAll, gainUser, getCorpType, getAllgoods } from "@/api/basicData/salesOrder";
 import { getDetails, getSellList } from "@/api/basicData/client";
 import { validatenull } from "@/util/validate";
-import {consumptionRecords, corpscechargerecordList} from "@/api/financialManagement/financialManagement";
+import {consumptionRecords, corpscechargerecordList, integralRecord, integralExchangeRecord} from "@/api/financialManagement/financialManagement";
 
 export default {
     name: "index",
@@ -260,16 +291,51 @@ export default {
             hykdataList:[],
             // 会员卡绑定的值
             hykform:{},
-            // 页码
+            // 会员卡页码
             hykmxpage: {
                 pageSize: 10,
                 pagerCount: 1,
                 total: 0,
             },
-            // 表单搜索的变量对象
+            // 会员卡表单搜索的变量对象
             hykmxsearch:{},
             hykmxloading:false,
 
+
+            // 积分获取明细金额消费记录配置
+            jfhqmxoption:jfhqmxoption,
+            // 积分获取明细的数据
+            jfhqjldataList:[],
+            // 积分获取明细绑定的值
+            jfhqjlform:{},
+            // 积分获取明细页码
+            jfhqjlpage: {
+                pageSize: 10,
+                pagerCount: 1,
+                total: 0,
+            },
+            // 积分获取明细表单搜索的变量对象
+            jfhqjlsearch:{},
+            jfhqjlloading:false,
+
+
+            // 积分总换明细
+            jfzhmxoption:jfzhmxoption,
+            // 积分获取明细的数据
+            jfzhmxdataList:[],
+            // 积分获取明细绑定的值
+            jfzhmxform:{},
+            // 积分获取明细页码
+            jfzhmxpage: {
+                pageSize: 10,
+                pagerCount: 1,
+                total: 0,
+            },
+            // 积分获取明细表单搜索的变量对象
+            jfzhmxsearch:{},
+            jfzhmxloading:false,
+
+
             sellOption: {},
             capitalOption: {},
             sellList: [],
@@ -380,9 +446,25 @@ export default {
         czmxrefreshChange(params) {
             this.czmxonLoad(this.czmxpage,params)
         },
+        // 会员卡点击刷新
+        hykrefreshChange(params) {
+            this.czmxonLoad(this.hykmxpage,params)
+        },
+        // 积分获取点击刷新
+        jfhqmxrefreshChange(params) {
+            this.jfhqmxonLoad(this.jfhqjlpage,params)
+        },
+        // 积分总换点击刷新
+        jfzhmxrefreshChange(params) {
+            this.jfzhmxonLoad(this.jfzhmxpage,params)
+        },
         // 充值明细点击每页多少条
         czmxsizeChange() {
-            console.log('点击每页多少条')
+            console.log('充值明细点击每页多少条')
+        },
+        // 会员卡点击每页多少条
+        hyksizeChange(){
+            console.log('会员卡点击每页多少条')
         },
         // 充值明细点击搜索按钮触发
         czmxsearchChange(params, done) {
@@ -390,6 +472,12 @@ export default {
             this.czmxonLoad(this.czmxpage, params);
             done()
         },
+        // 会员卡点击搜索按钮触发
+        hyksearchChange(params, done) {
+            this.hykmxpage.currentPage = 1;
+            this.czmxonLoad(this.hykmxpage, params);
+            done()
+        },
         // 充值明细的数据请求
         czmxonLoad(page, params){
             corpscechargerecordList({
@@ -409,29 +497,30 @@ export default {
             })
         },
         // 充值明细列保存触发
-        async czmxsaveColumn() {
-            const inSave = await this.saveColumnData(
-                this.getColumnName(64),
-                this.option
-            );
-            if (inSave) {
-                this.$message.success("保存成功");
-                //关闭窗口
-                this.$refs.crud.$refs.dialogColumn.columnBox = false;
-            }
+         czmxsaveColumn() {
+            this.$message.success("保存成功");
+            //关闭窗口
+            this.$refs.crudczmx.$refs.dialogColumn.columnBox = false;
         },
         // 充值明细重置列
-        async czmxresetColumn() {
-            const inSave = await this.delColumnData(
-                this.getColumnName(64),
-                option
-            );
-            if (inSave) {
-                this.$message.success("重置成功");
-                this.option = option;
-                //关闭窗口
-                this.$refs.crud.$refs.dialogColumn.columnBox = false;
-            }
+         czmxresetColumn() {
+            this.$message.success("重置成功");
+            this.option = czoption;
+            //关闭窗口
+            this.$refs.crudczmx.$refs.dialogColumn.columnBox = false;
+        },
+        // 会员卡列保存触发
+         hyksaveColumn() {
+             this.$message.success("保存成功");
+             //关闭窗口
+             this.$refs.crudhyk.$refs.dialogColumn.columnBox = false;
+        },
+        // 会员卡消费金额重置列
+         hykresetColumn() {
+            this.$message.success("重置成功");
+            this.option = hykoption;
+            //关闭窗口
+            this.$refs.crudhyk.$refs.dialogColumn.columnBox = false;
         },
         // 会员卡消费记录
         hykmxonLoad(page,params){
@@ -450,6 +539,67 @@ export default {
                 this.czloading = false
             })
         },
+        // 积分获取明细列保存触发
+        jfhqmxsaveColumn() {
+            this.$message.success("保存成功");
+            //关闭窗口
+            this.$refs.crudjfhqmx.$refs.dialogColumn.columnBox = false;
+        },
+        // 积分获取明细消费金额重置列
+        jfhqmxresetColumn() {
+            this.$message.success("重置成功");
+            this.option = jfhqmxoption;
+            //关闭窗口
+            this.$refs.crudjfhqmx.$refs.dialogColumn.columnBox = false;
+        },
+        // 积分总换明细
+        jfhqmxonLoad(page,params){
+            integralRecord({
+                current:page.currentPage,
+                size:page.pageSize,
+                corpId:this.detailData.id,
+                ...params
+            }).then(res =>{
+                this.jfhqjldataList = res.data.data.records
+                this.jfhqjlpage.total = res.data.data.total
+                if (this.jfhqjlpage.total) {
+                    this.jfhqmxoption.height = window.innerHeight - 240;
+                }
+            }).finally(()=>{
+                this.czloading = false
+            })
+        },
+
+        // 积分总换明细列保存触发
+        jfzhmxsaveColumn() {
+            this.$message.success("保存成功");
+            //关闭窗口
+            this.$refs.crudjfzhmx.$refs.dialogColumn.columnBox = false;
+        },
+        // 积分获取明细消费金额重置列
+        jfzhmxresetColumn() {
+            this.$message.success("重置成功");
+            this.option = jfzhmxoption;
+            //关闭窗口
+            this.$refs.crudjfzhmx.$refs.dialogColumn.columnBox = false;
+        },
+        // 积分总换明细
+        jfzhmxonLoad(page,params){
+            integralExchangeRecord({
+                current:page.currentPage,
+                size:page.pageSize,
+                corpId:this.detailData.id,
+                ...params
+            }).then(res =>{
+                this.jfzhmxdataList = res.data.data.records
+                this.jfzhmxpage.total = res.data.data.total
+                if (this.jfzhmxpage.total) {
+                    this.jfzhmxoption.height = window.innerHeight - 240;
+                }
+            }).finally(()=>{
+                this.czloading = false
+            })
+        },
 
         getAllWorkDicts() {
             gainUser().then(res => {

+ 67 - 5
src/views/client/js/optionList.js

@@ -716,11 +716,11 @@ export const hykoption = {
   menu:false,
   "column": [
     {
-      "label": "销售单号",
-      "prop": "sysNo",
-      "overHidden": true,
-      "editDisplay": false,
-      "addDisplay": false
+      label: "销售单号",
+      prop: "sysNo",
+      overHidden: true,
+      editDisplay: false,
+      addDisplay: false
     },
     {
       "label": "事件",
@@ -746,3 +746,65 @@ export const hykoption = {
     }
   ]
 }
+
+// 积分获取明细
+export const jfhqmxoption = {
+  "width": 150,
+  "delBtn": false,
+  "editBtn": false,
+  addBtn: false,
+  "border": true,
+  "resizable": true,
+  "selection": true,
+  menu:false,
+  "column": [
+    {
+      label: "商品名称",
+      prop: "goodsName",
+      overHidden: true,
+      editDisplay: false,
+      addDisplay: false
+    },
+    {
+      label: "日期",
+      prop: "businesDate",
+      overHidden: true,
+    },
+    {
+      label: "积分",
+      prop: "integral",
+      overHidden: true,
+    }
+  ]
+}
+
+// 积分总换明细
+export const jfzhmxoption = {
+  "width": 150,
+  "delBtn": false,
+  "editBtn": false,
+  addBtn: false,
+  "border": true,
+  "resizable": true,
+  "selection": true,
+  menu:false,
+  "column": [
+    {
+      label: "商品名称",
+      prop: "goodsName",
+      overHidden: true,
+      editDisplay: false,
+      addDisplay: false
+    },
+    {
+      label: "日期",
+      prop: "businesDate",
+      overHidden: true,
+    },
+    {
+      label: "积分",
+      prop: "integral",
+      overHidden: true,
+    }
+  ]
+}

+ 7 - 0
src/views/financialManagement/paymentSettle/configuration/detailsPage.json

@@ -69,6 +69,13 @@
       "index": 7
     },
     {
+      "label": "会员卡金额",
+      "prop": "memberBalance",
+      "overHidden": true,
+      "width": 240,
+      "index": 7
+    },
+    {
       "label": "本次金额",
       "prop": "thisAmount",
       "overHidden": true,

+ 6 - 3
src/views/financialManagement/paymentSettle/paymentSettle.vue

@@ -133,7 +133,8 @@
       addReceipt(row){
         this.detailData = {
           id: row.id,
-          status: 1
+          status: 1,
+            corpId:row.corpId
         };
         this.show = false;
         this.$store.commit("PAY_IN_DETAIL");
@@ -150,7 +151,8 @@
           if (res.data.code == 200) {
             this.detailData = {
               disabled: true,
-              id: row.id
+              id: row.id,
+                corpId:row.corpId
             };
             this.show = false;
             this.$store.commit("PAY_IN_DETAIL");
@@ -158,7 +160,8 @@
         }).catch(error => {
           this.detailData = {
             disabled: true,
-            id: row.id
+            id: row.id,
+              corpId:row.corpId
           };
           this.show = false;
           this.$store.commit("PAY_IN_DETAIL");

+ 81 - 6
src/views/financialManagement/paymentSettle/paymentSettleDetailsPage.vue

@@ -42,6 +42,12 @@
               </el-option>
             </el-select>
           </template>
+            <template slot="memberBalance">
+                <el-input-number v-model="form.memberBalance" disabled
+                                 placeholder="请输入" size="small" :controls="false">
+                </el-input-number>
+                <span style="margin-left: 10px">余额:{{balanceAmounts}}</span>
+            </template>
           <template slot="remark">
             <el-input type="textarea" v-model="form.remark" size="small" rows="2" autocomplete="off" placeholder="">
             </el-input>
@@ -79,10 +85,27 @@
             </el-select>
             <span v-else>{{ row.currency }}</span>
           </template>
+            <template slot-scope="{ row }" slot="memberBalance">
+                <span v-if="row.$cellEdit" class="required_fields">*</span>
+                <el-input
+                    v-if="row.$cellEdit"
+                    v-model="row.memberBalance"
+                    style="width: 50%"
+                    placeholder="请输入"
+                    size="small"
+                    @input="memberinput(row)"
+                    @blur="memberblur(row)"
+                    oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+                ></el-input>
+                <span v-if="row.$cellEdit" style="margin-left: 10px">余额:{{balanceAmounts}}</span>
+                <span v-else>{{ row.memberBalance }}</span>
+            </template>
           <template slot="thisAmount" slot-scope="{ row }">
             <span v-if="row.$cellEdit" class="required_fields">*</span>
-            <el-input v-if="row.$cellEdit" v-model="row.thisAmount" style="width: 90%" placeholder="请输入" size="small"
+            <el-input v-if="row.$cellEdit" v-model="row.thisAmount"
+                      style="width: 90%" placeholder="请输入" size="small"
               @input="thisAmountVerify(row)"
+              @blur="thisAmountBlur(row)"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'></el-input>
             <span v-else>{{ row.thisAmount }}</span>
           </template>
@@ -118,6 +141,7 @@ import { getUserInfo } from "@/api/system/user";
 import { getCorpDetail } from "@/api/maintenance/overpayment";
 import reportDialog from "@/components/report-dialog/main.vue";
 import {dateFormat} from "@/util/date";
+import {getCorpDetails} from "@/api/basicData/salesOrder";
 
 export default {
   name: "paymentDetailsPage",
@@ -339,6 +363,11 @@ export default {
               }
             ]
           },
+            {
+                label: '会员卡金额',
+                prop: 'memberBalance',
+                span:8,
+            },
           {
             label: '备注',
             prop: 'remark',
@@ -367,6 +396,8 @@ export default {
       category: '',
       allAmount: 0,
       editDisable: false,
+        // 会员卡余额
+        balanceAmounts:0
     }
   },
   components: {
@@ -403,6 +434,10 @@ export default {
       }).finally(() => {
         this.buttonLoading = false
       })
+        // 获取会员卡余额
+        getCorpDetails({ id: this.detailData.corpId }).then(res => {
+            this.balanceAmounts = res.data.data.balanceAmounts
+        })
     } else {
       this.form.financeStatus = "待结算"
       this.oldForm.financeStatus = "待结算"
@@ -446,6 +481,10 @@ export default {
           this.$set(this.form, "bankList", res.data)
         })
       }
+        // 获取会员卡余额
+        getCorpDetails({ id: corpValue.id }).then(res => {
+            this.balanceAmounts = res.data.data.balanceAmounts
+        })
 
       // 溢付款余额获取
       if (this.category == 2) {
@@ -473,13 +512,48 @@ export default {
         }
       })
     },
+      // 会员卡的验证
+      memberinput(row) {
+          if(parseFloat(row.thisAmount) + parseFloat(row.memberBalance) > (parseFloat(row.amount) - parseFloat(row.settlementAmount))){
+              this.$message.warning('本次金额加上会员卡金额不得大于金额!')
+              this.$set(row,'memberBalance','')
+          }
+      },
+      // 会员卡失教触发
+      memberblur(row){
+          this.form.memberBalance = this.form.memberBalance?this.form.memberBalance:0
+          let sum = 0
+          this.dataList.map(item=>{
+              item.memberBalance = item.memberBalance?item.memberBalance:0
+              sum += Number(item.memberBalance)
+          })
+          if(Number(this.form.memberBalance) >= Number(this.balanceAmounts)){
+              this.$message.warning('会员卡金额不能大于会员卡余额')
+              row.memberBalance = 0
+              sum = 0
+              this.dataList.map(item=>{
+                  sum += Number(item.memberBalance)
+              })
+          }
+          this.form.memberBalance = sum
+      },
     //本次金额验证
     thisAmountVerify(row) {
-      if (parseFloat(row.thisAmount) > parseFloat(row.amount)) {
-        this.$message.warning('本次金额不得大于金额!')
-        this.$set(row, 'thisAmount', '')
-      }
+        row.memberBalance = row.memberBalance?row.memberBalance:0
+        if(parseFloat(row.thisAmount) + parseFloat(row.memberBalance) > (parseFloat(row.amount) - parseFloat(row.settlementAmount))){
+            this.$message.warning('本次金额加上会员卡金额不得大于金额!')
+            this.$set(row,'thisAmount','')
+        }
     },
+      // 本次金额的失焦
+      thisAmountBlur(row){
+          this.form.thisAmount = this.form.thisAmount?this.form.thisAmount:0
+          let sum = 0
+          this.dataList.map(item=>{
+              sum += Number(item.thisAmount)
+          })
+          this.form.amount = sum
+      },
     selectPurchase() {
       if (!this.form.corpId) {
         this.$message.warning("请先选择客户!")
@@ -623,7 +697,8 @@ export default {
             ...this.form,
             billType: "付费",
             itemsList: this.dataList,
-            settlementType: 1
+            settlementType: 1,
+              whetherIntegral:0
           }
           // 如果有id解锁,没有跳过
           //             this.form.id && this.unLock({moduleName: 'ff',tableName: 'finance_settlement', billId: this.form.id})

+ 7 - 0
src/views/financialManagement/receiptSettle/configuration/detailsPage.json

@@ -69,6 +69,13 @@
       "index": 7
     },
     {
+      "label": "会员卡金额",
+      "prop": "memberBalance",
+      "overHidden": true,
+      "width": 240,
+      "index": 7
+    },
+    {
       "label": "本次金额",
       "prop": "thisAmount",
       "overHidden": true,

+ 6 - 3
src/views/financialManagement/receiptSettle/receiptSettle.vue

@@ -132,7 +132,8 @@
       addReceipt(row){
         this.detailData = {
           id: row.id,
-          status: 1
+          status: 1,
+            corpId:row.corpId,
         };
         this.show = false;
       },
@@ -148,14 +149,16 @@
           if (res.data.code == 200) {
             this.detailData = {
               disabled: true,
-              id: row.id
+              id: row.id,
+              corpId:row.corpId,
             };
             this.show = false;
           }
         }).catch(error => {
           this.detailData = {
             disabled: true,
-            id: row.id
+            id: row.id,
+              corpId:row.corpId,
           };
           this.show = false;
         })

+ 76 - 3
src/views/financialManagement/receiptSettle/receiptSettleDetailsPage.vue

@@ -86,6 +86,12 @@
               :disabled="dataList.length == 0 || !financeDisabled || editDisable"
             ></el-input>
           </template>
+            <template slot="memberBalance">
+                <el-input-number v-model="form.memberBalance" disabled
+                                 placeholder="请输入" size="small" :controls="false">
+                </el-input-number>
+                <span style="margin-left: 10px">余额:{{balanceAmounts}}</span>
+            </template>
           <template slot="remark">
             <el-input type="textarea"
                       v-model="form.remark"
@@ -134,6 +140,21 @@
             </el-select>
             <span v-else>{{ row.currency }}</span>
           </template>
+            <template slot-scope="{ row }" slot="memberBalance">
+                <span v-if="row.$cellEdit" class="required_fields">*</span>
+                <el-input
+                    v-if="row.$cellEdit"
+                    v-model="row.memberBalance"
+                    style="width: 50%"
+                    placeholder="请输入"
+                    size="small"
+                    @input="memberinput(row)"
+                    @blur="memberblur(row)"
+                    oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
+                ></el-input>
+                <span v-if="row.$cellEdit" style="margin-left: 10px">余额:{{balanceAmounts}}</span>
+                <span v-else>{{ row.memberBalance }}</span>
+            </template>
           <template slot="thisAmount" slot-scope="{ row }">
             <span v-if="row.$cellEdit" class="required_fields">*</span>
             <el-input
@@ -143,6 +164,7 @@
               placeholder="请输入"
               size="small"
               @input="thisAmountVerify(row)"
+              @blur="thisAmountBlur"
               oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
             ></el-input>
             <span v-else>{{ row.thisAmount }}</span>
@@ -218,6 +240,7 @@
   import { getlistBankBy as GYSGetBank } from "@/api/basicData/configuration"
   import reportDialog from "@/components/report-dialog/main";
   import {dateFormat} from "@/util/date";
+  import {getCorpDetails} from "@/api/basicData/salesOrder";
 
   export default {
     name: "receiptDetailsPage",
@@ -364,6 +387,7 @@
               label: '人民币金额',
               prop: 'amount',
               span: 8,
+              disabled:true,
               rules: [
                 {
                   pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
@@ -431,6 +455,11 @@
                 }
               ]
             },
+              {
+                  label: '会员卡金额',
+                  prop: 'memberBalance',
+                  span:8,
+              },
             {
               label: '备注',
               prop: 'remark',
@@ -475,6 +504,8 @@
         editDisable: false, //编辑状态禁用
         switchDialog: false,
         statementData: {},
+          // 会员卡余额
+          balanceAmounts:0
       }
     },
     created() {
@@ -508,6 +539,10 @@
         }).finally(()=>{
           this.buttonLoading = false
         })
+          // 获取会员卡余额
+          getCorpDetails({ id: this.detailData.corpId }).then(res => {
+              this.balanceAmounts = res.data.data.balanceAmounts
+          })
       }else{
         this.form.financeStatus = "待结算"
         this.oldForm.financeStatus = "待结算"
@@ -526,6 +561,10 @@
             this.$set(this.form,"bankList",res.data)
           })
         }
+        // 获取会员卡余额
+          getCorpDetails({ id: corpValue.id }).then(res => {
+              this.balanceAmounts = res.data.data.balanceAmounts
+          })
 
         // 溢付款余额获取
         if (this.category == 2) {
@@ -553,13 +592,46 @@
           }
         })
       },
+        // 会员卡的验证
+        memberinput(row) {
+            if(parseFloat(row.thisAmount) + parseFloat(row.memberBalance) > (parseFloat(row.amount) - parseFloat(row.settlementAmount))){
+                this.$message.warning('本次金额加上会员卡金额不得大于金额!')
+                this.$set(row,'memberBalance','')
+            }
+        },
+        // 会员卡失焦触发
+        memberblur(row){
+            this.form.memberBalance = this.form.memberBalance?this.form.memberBalance:0
+            let sum = 0
+            this.dataList.map(item=>{
+                sum += Number(item.memberBalance)
+            })
+            if(Number(this.form.memberBalance) >= Number(this.balanceAmounts)){
+                this.$message.warning('会员卡金额不能大于会员卡余额')
+                row.memberBalance = 0
+                sum = 0
+                this.dataList.map(item=>{
+                    sum += Number(item.memberBalance)
+                })
+            }
+            this.form.memberBalance = sum
+        },
       //本次金额验证
       thisAmountVerify(row){
-        if(parseFloat(row.thisAmount) > parseFloat(row.amount)){
-          this.$message.warning('本次金额不得大于金额!')
+          row.memberBalance = row.memberBalance?row.memberBalance:0
+        if(parseFloat(row.thisAmount) + parseFloat(row.memberBalance) > (parseFloat(row.amount) - parseFloat(row.settlementAmount))){
+          this.$message.warning('本次金额加上会员卡金额不得大于金额!')
           this.$set(row,'thisAmount','')
         }
       },
+        // 本次金额的失焦
+        thisAmountBlur(){
+            let sum = 0
+            this.dataList.map(item=>{
+                sum += Number(item.thisAmount)
+            })
+            this.form.amount = sum
+        },
       selectRecipt(){
         if(!this.form.corpId){
           this.$message.warning("请先选择客户!")
@@ -717,7 +789,8 @@
               ...this.form,
               billType:"收费",
               itemsList:this.dataList,
-              settlementType:1
+              settlementType:1,
+                whetherIntegral:0
             }
 
             // 如果有id解锁,没有跳过

+ 5 - 5
src/views/product/detailsPage.vue

@@ -44,17 +44,17 @@
       <trade-card title="库存管理" v-loading="loadingBtn">
         <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
                    @resetColumn="resetColumn" :cell-style="cellStyle" @row-update="rowUpdate"  @row-save="rowSave">
-          <template slot="headerSerial">
-            <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
-                       :disabled="detailData.status == 1" circle></el-button>
-          </template>
+          <!--<template slot="headerSerial">-->
+          <!--  <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"-->
+          <!--             :disabled="detailData.status == 1" circle></el-button>-->
+          <!--</template>-->
           <template slot="storageIdHeader" slot-scope="{column}">
             <span style="color: #409EFF;cursor: pointer" @click.stop="storageVisible = true">仓库</span>
           </template>
           <template slot="menu" slot-scope="{ row, index }">
             <el-button size="small" type="text" @click="rowCell(row, index)">{{ row.$cellEdit ? "保存" : "修改" }}
             </el-button>
-            <el-button size="small" type="text" @click="rowDel(row, index)">删除</el-button>
+            <!--<el-button size="small" type="text" @click="rowDel(row, index)">删除</el-button>-->
           </template>
         </avue-crud>
       </trade-card>

+ 6 - 4
src/views/product/js/optionList.js

@@ -187,7 +187,8 @@ export const optionList = {
       },
       dicData:[],
       filterable:true,
-      cell: true,
+      // cell: true,
+      disabled:true,
       // overHidden: true,
       rules: [
         {
@@ -202,7 +203,8 @@ export const optionList = {
       prop: "balanceQuantity",
       type: 'number',
       controls: false,
-      cell: true,
+      // cell: true,
+      disabled:true,
       // overHidden: true,
       rules: [
         {
@@ -215,7 +217,7 @@ export const optionList = {
     {
       label: "批次号",
       prop: "lotNo",
-      cell: true,
+      // cell: true,
       hide:true,
       showColumn:false,
       overHidden: true
@@ -225,7 +227,7 @@ export const optionList = {
       prop: "balanceAmount",
       type: 'number',
       controls: false,
-      cell: true,
+      // cell: true,
       overHidden: true
     },
     {

+ 190 - 13
src/views/salesOrder/detailsPage.vue

@@ -12,6 +12,10 @@
                      @click.stop="openCheckDialog">
             审批
           </el-button>
+            <!--<el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="newAddfun">新建销售单-->
+            <!--</el-button>-->
+            <el-button type="warning" size="small" v-if="form.confirmStatus == 1" @click.stop="clickPayment">付款
+            </el-button>
           <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
           </el-button>
           <el-button type="primary" size="small" v-if="detailData.status == 1 && form.confirmStatus == 0"
@@ -51,15 +55,18 @@
         </avue-form>
       </trade-card>
       <trade-card title="商品信息" v-loading="loadingBtn">
-        <avue-form class="trading-form" v-model="form" :option="option2">
+        <avue-form ref="option2form" class="trading-form" v-model="form" :option="option2">
           <template slot="thisUsedProfit">
-            <el-input-number v-model="form.thisUsedProfit" :disabled="detailData.status == 1" @change="amountChange"
-              placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
+            <el-input-number v-model="form.thisUsedProfit" :disabled="detailData.status == 1"
+              placeholder="请输入" size="small" :controls="false" style="width:100%;"
+                             @change="thisUsedchange" ></el-input-number>
+              <!--@change="amountChange"-->
           </template>
             <template slot="memberBalance">
                 <el-input-number v-model="form.memberBalance" :disabled="detailData.status == 1"
-                                 placeholder="请输入" size="small" :controls="false"></el-input-number>
-                <span style="margin-left: 10px">{{balanceAmounts}}</span>
+                                 placeholder="请输入" size="small" :controls="false"
+                                 @change="memberchange"></el-input-number>
+                <span style="margin-left: 10px">余额:{{balanceAmounts}}</span>
             </template>
         </avue-form>
         <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
@@ -140,6 +147,39 @@
       <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
       </check>
     </el-dialog>
+
+      <!--付款的弹窗-->
+      <!--<el-dialog-->
+      <!--    title="付款"-->
+      <!--    :visible.sync="paymentVisible"-->
+      <!--    append-to-body-->
+      <!--    :close-on-click-modal="false"-->
+      <!--    :destroy-on-close="true"-->
+      <!--    :close-on-press-escape="false"-->
+      <!--    v-dialog-drag-->
+      <!--    width="40%"-->
+      <!--    :before-close="paymentClose">-->
+      <!--    <div>-->
+      <!--        <el-form ref="form" label-width="100px" size="mini">-->
+      <!--            <el-form-item label="总支付金额">-->
+      <!--                {{form.purchaseAmount}}-->
+      <!--            </el-form-item>-->
+      <!--            <el-form-item label="会员卡余额">-->
+      <!--                {{balanceAmounts}}-->
+      <!--            </el-form-item>-->
+      <!--            <el-form-item label="会员卡支付金额">-->
+      <!--                <el-input type="number" v-model="form.memberBalance" @change="memberBalancechange"></el-input>-->
+      <!--            </el-form-item>-->
+      <!--            <el-form-item label="现金支付金额">-->
+      <!--                <el-input type="number" v-model="form.wechatpayAmount"></el-input>-->
+      <!--            </el-form-item>-->
+      <!--        </el-form>-->
+      <!--    </div>-->
+      <!--    <span slot="footer" class="dialog-footer">-->
+      <!--        <el-button @click="paymentVisible = false">取 消</el-button>-->
+      <!--        <el-button type="primary" @click="paymentVisible = false">确 定</el-button>-->
+      <!--    </span>-->
+      <!--</el-dialog>-->
   </div>
 </template>
 
@@ -156,7 +196,8 @@ import {
   revoke,
   collectPayment,
   getStoragelist,
-  offset
+  offset,
+    obtainPrice
 } from "@/api/basicData/salesOrder";
 import feeInfo from "./components/feeInfo.vue";
 import reportDialog from "@/components/report-dialog/main";
@@ -167,6 +208,8 @@ export default {
   name: "index",
   data() {
     return {
+        // 付款的弹窗开启和关闭
+        paymentVisible:false,
       checkDialog: false,
       checkData: {},
       switchDialog: false,
@@ -176,9 +219,7 @@ export default {
       addressVisible: false,
       form: {},
       form2: {},
-      form3: {
-
-      },
+      form3: {},
       data: [],
       option: {
         menuBtn: false,
@@ -476,7 +517,7 @@ export default {
       orderFilesList: [],
       storageoptions: [],
         // 会员卡余额
-        balanceAmounts:0
+        balanceAmounts:0,
     };
   },
   props: {
@@ -504,10 +545,104 @@ export default {
     }
     this.getAllWorkDicts()
     getAllgoods().then(res => {
-      this.goodsoptions = res.data.data
+        this.goodsoptions = []
+        res.data.data.map(item=>{
+            if(item.status != 1) {
+                this.goodsoptions.push(item)
+            }
+        })
+      // this.goodsoptions = res.data.data
     });
   },
   methods: {
+      // // 会员卡支付金额的监听
+      // memberBalancechange(){
+      //     if (Number(this.form.memberBalance) < 0) {
+      //         this.form.memberBalance = 0
+      //     }
+      //     this.form.wechatpayAmount = this.form.purchaseAmount - this.form.memberBalance
+      // },
+      // 优惠金额的监听
+      thisUsedchange(){
+          this.form.memberBalance = this.form.memberBalance?this.form.memberBalance:0
+          if(Number(this.form.thisUsedProfit) < 0) {
+              this.$nextTick(()=>{
+                  this.form.thisUsedProfit = 0
+              })
+          }
+          if (Number(this.form.thisUsedProfit) > Number(this.form.purchaseAmount)) {
+              this.$nextTick(()=>{
+                  this.form.thisUsedProfit = Number(this.form.purchaseAmount)
+                  this.form.memberBalance = 0
+                  this.form.currentAmount = 0
+              })
+          }
+          let sum = Number(this.form.purchaseAmount) - Number(this.form.memberBalance)
+          if (Number(this.form.thisUsedProfit) > sum){
+              this.$nextTick(()=>{
+                  console.log(this.form.thisUsedProfit)
+                  this.form.thisUsedProfit = sum
+                  this.form.currentAmount = 0
+              })
+          }
+
+          this.$nextTick(()=>{
+              console.log(sum - this.form.thisUsedProfit)
+              this.form.currentAmount = sum - this.form.thisUsedProfit
+          })
+      },
+      // 会员卡金额的监听
+      memberchange(){
+          // change事件发生后触发了dom更新,
+          // 而数据更改变化是在dom更新之后,
+          // 这就导致了dom当中挂载的数据值还是更新之前的值,
+          // 并且此后无刷新控制dom重新渲染的指令,使得chhange方法失效。
+          // 用$nextTick函数对绑定值进行更改,
+          // 即在dom初次完成渲染挂载后,修改其值再次触发dom渲染挂载。
+          this.form.thisUsedProfit = this.form.thisUsedProfit?this.form.thisUsedProfit:0
+          if (this.form.memberBalance < 0) {
+              this.$nextTick(()=>{
+                  this.form.memberBalance = 0
+              })
+          }
+          if (this.form.memberBalance > Number(this.balanceAmounts)) {
+              this.$nextTick(()=>{
+                  this.form.memberBalance = Number(this.balanceAmounts)
+              })
+          }
+          let sum = Number(this.form.purchaseAmount) - Number(this.form.thisUsedProfit)
+          if (this.form.memberBalance > sum) {
+              this.$nextTick(()=>{
+                  this.form.memberBalance = sum
+              })
+          }
+          this.$nextTick(()=>{
+              console.log(sum - this.form.memberBalance)
+              this.form.currentAmount = sum - this.form.memberBalance
+          })
+      },
+      // 付款点击事件
+      clickPayment(){
+          // 和删除一样的接口 显示要付款的现金
+          this.$confirm(`本次付款需要支付金额为${this.form.currentAmount}`, '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+          }).then(()=>{
+              let form = {
+                  ...this.form,
+                  orderFilesList: this.orderFilesList
+              }
+              collectPayment(form).then(res=>{
+                  console.log(res,632)
+              })
+          })
+          // this.paymentVisible = true
+      },
+      // // 付款弹窗的关闭
+      // paymentClose(){
+      //     this.paymentVisible = false
+      // },
     //打开审核
     openCheckDialog() {
       this.checkData = this.detailData.check;
@@ -537,18 +672,27 @@ export default {
       return "padding:0;height:40px;";
     },
     cnameChange(row) {
+        console.log(row,668)
       if (row.cname) {
         this.goodsoptions.forEach(e => {
           if (e.cname == row.cname) {
             row.itemId = e.id
             row.unit = e.unit
-            row.price = e.standardPrice
+            // row.price = e.standardPrice
             row.storageInQuantity = 1
             row.amount = e.standardPrice
             row.purchasePrice = e.purchasePrice
             row.storageAmount = e.purchasePrice
           }
         })
+          // 根据产品ID和客户id获取产品单价
+          obtainPrice({
+              corpId:this.form.corpId,
+              goodsId:row.itemId
+          }).then(res=>{
+              row.price = res.data.data.salesPrice
+          })
+
       } else {
         row.itemId = null
         row.unit = null
@@ -560,6 +704,7 @@ export default {
       }
       this.countChange(row)
     },
+      // 之前的优惠金额的监听
     amountChange() {
       let val = 0
       this.data.forEach(e => {
@@ -597,7 +742,6 @@ export default {
         this.form.corpsName = row.cname
         this.form.corpTel = row.tel
         getCorpDetails({ id: row.id }).then(res => {
-            console.log(res.data.data.balanceAmounts,598)
             this.balanceAmounts = res.data.data.balanceAmounts
           this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
         })
@@ -670,6 +814,39 @@ export default {
       // this.settlementList = row.settlementList
       this.getDetail(row.id);
     },
+      // 新建销售单
+      newAddfun(){
+          // delete this.form.id
+          this.$refs.form.resetFields()
+          this.form = {}
+          this.$nextTick(() => {
+              this.$refs.option2form.resetFields()
+          });
+          this.data = [];
+
+
+          this.form.confirmStatus = null
+          this.detailData = []
+          this.detailData.status = 2
+
+          this.settlementList = [];
+          this.orderFilesList = [];
+          this.balanceAmount = 0
+
+          this.option.disabled = false;
+          this.option2.disabled = false;
+          this.$refs.crud.refreshTable();
+          this.$refs.feeInfo.refreshTable();
+
+
+          // // this.$refs.option2form.resetFields()这个做法其实是重置表单到初始值,不是清空表单,
+          // // 当表单第一次在页面中渲染时所用的数据就是初始数据,如果修改对象的表单赋值没有放在nextTick中,
+          // // 就会在表单渲染时就会将这个修改对象作为初始值,
+          // // 所以出现无效了。
+          // // 使用nextTick保证表单在第一次渲染时是空值就可以了。
+          // this.xinjianfasle = true
+          this.$forceUpdate()
+      },
     //修改提交触发
     editCustomer() {
       this.$refs["form"].validate((valid, done) => {

+ 7 - 1
src/views/salesOrder/js/optionList.js

@@ -252,7 +252,7 @@ export const optionList = {
       prop: "actualQuantity",
       type: 'number',
       controls: false,
-      cell: true,
+      // cell: true,
       overHidden: true
     },
     {
@@ -295,6 +295,12 @@ export const feeOption = {
       overHidden: true
     },
     {
+      label: "会员卡金额",
+      prop: "memberBalance",
+      cell: true,
+      overHidden: true
+    },
+    {
       label: "收款金额",
       prop: "amount",
       cell: true,