Selaa lähdekoodia

完善成本收款账单word

yuanrf 1 vuosi sitten
vanhempi
commit
7eb04962a0
1 muutettua tiedostoa jossa 382 lisäystä ja 6 poistoa
  1. 382 6
      src/components/Finance/Cost.vue

+ 382 - 6
src/components/Finance/Cost.vue

@@ -21,9 +21,9 @@
                     </div>
                     <div class="ser-btn-li">
                         <el-button type="primary">导入收款账单</el-button>
-                        <el-button type="primary">生成收款账单</el-button>
+                        <el-button type="primary" @click="GetPriceCheckWord">生成收款账单</el-button>
                         <el-button type="primary">导出客户报表</el-button>
-                        <el-button type="primary">导出成本</el-button>
+                        <el-button type="primary" @click="GetGroupCostExcel">导出成本</el-button>
                         <el-button type="primary" @click="save">保存设置</el-button>
                         <el-button type="primary">一键复制</el-button>
                         <el-button type="primary" @click="GroupIsShare">成本通知</el-button>
@@ -343,7 +343,7 @@
                         <div style="width: 2%;" v-show="costTypevalue != 'A'"></div>
                         <div style="width: 49%;" v-show="costTypevalue != 'A'">
                             <div v-for="(   sheetitem, index   ) in    sheetDatal   " :key="index">
-                                <div class="biaoge"
+                                <div class="biaogeB"
                                     v-if="CheckBoxListSelect.filter(item => item.cbType == 'Left')[0].cbValues.includes(sheetitem.label)">
                                     <el-table :data="[{ a: 1 }]" border style="width: 100%"
                                         :class="{ 'hiddenElement': (sheetitem.EnLabel == 'visa' || sheetitem.EnLabel == 'bx') ? true : false }">
@@ -443,7 +443,7 @@
                         <div style="width: 2%;" v-show="costTypevalue != 'A'"></div>
                         <div style="width: 49%;" v-show="costTypevalue != 'A'">
                             <div v-for="(   cabinitem, index   ) in    BcabinDatal   " :key="index">
-                                <div class="biaoge"
+                                <div class="biaogeB"
                                     v-if="CheckBoxListSelect.filter(item => item.cbType == 'Right')[0].cbValues.includes(cabinitem.label)">
                                     <div style="    color: rgb(96, 98, 102);font-size: 15px;font-weight: 600;">{{
                                         cabinitem.label }}
@@ -537,6 +537,8 @@
     </div>
 </template>
 <script>
+import { C } from '@fullcalendar/core/internal-common';
+
 export default {
     data() {
         return {
@@ -3575,8 +3577,381 @@ export default {
                     this.$message.error('操作失败!' + resp.data.msg);
                 }
             })
-        }
+        },
+        GetPriceCheckWord() {
+            var that = this;
+
+            var airs = [
+
+            ];
+
+            var sgrfilter = this.costTypeHotelNumbers.filter(x => {
+                return x.type == 'Default'
+            })
+            let Bsgrfilter = {};
+
+            if (this.costTypevalue == 'B') {
+                sgrfilter = this.costTypeHotelNumbers.filter(x => {
+                    return x.type == 'A'
+                })
+
+                Bsgrfilter = this.costTypeHotelNumbers.filter(x => {
+                    return x.type == 'B'
+                })
+
+                Bsgrfilter = Bsgrfilter[0];
+            }
+
+            sgrfilter = sgrfilter[0];
+
+            let hotelRooms = {
+                "SGR": sgrfilter.sgr,
+                "TBR": sgrfilter.tbr,
+                "JSES": sgrfilter.jses,
+                "SUITE": sgrfilter.suite
+            };
+
+            let flights = {
+                "经济舱": this.AGroupCostParameter.jjcrs,
+                "公务舱": this.AGroupCostParameter.gwcrs
+            };
+
+            let result = {};
+            for (let flight of ["经济舱", "公务舱"]) {
+                if (flight === "经济舱") {
+                    this.matchRooms(hotelRooms, flights, ["SGR", "TBR", "JSES", "SUITE"], flight, result);
+                } else if (flight === "公务舱") {
+                    this.matchRooms(hotelRooms, flights, ["SUITE", "JSES", "SGR", "TBR"], flight, result);
+                }
+            }
+
+            if (this.costTypevalue == 'B') {
+
+                let BhotelRooms = {
+                    "SGR": Bsgrfilter.sgr,
+                    "TBR": Bsgrfilter.tbr,
+                    "JSES": Bsgrfilter.jses,
+                    "SUITE": Bsgrfilter.suite
+                };
+
+                let Bflights = {
+                    "经济舱": this.BGroupCostParameter.jjcrs,
+                    "公务舱": this.BGroupCostParameter.gwcrs
+                };
+
+                let Bresult = {};
+                for (let flight of ["经济舱", "公务舱"]) {
+                    if (flight === "经济舱") {
+                        this.matchRooms(BhotelRooms, Bflights, ["SGR", "TBR", "JSES", "SUITE"], flight, Bresult);
+                    } else if (flight === "公务舱") {
+                        this.matchRooms(BhotelRooms, Bflights, ["SUITE", "JSES", "SGR", "TBR"], flight, Bresult);
+                    }
+                }
+
+                var BtxtJJCSGRRS = (Bresult.hasOwnProperty("经济舱SGR") ? Bresult["经济舱SGR"] : 0)
+                var BlblGWCSGRRS = (Bresult.hasOwnProperty("公务舱SGR") ? Bresult["公务舱SGR"] : 0)
+                var BtxtJJCTBRRS = (Bresult.hasOwnProperty("经济舱TBR") ? Bresult["经济舱TBR"] * 2 : 0)
+                var BtxtGWCJSESRS = (Bresult.hasOwnProperty("公务舱JSES") ? Bresult["公务舱JSES"] : 0)
+                var BJJCSUITERS = (Bresult.hasOwnProperty("经济舱SUITE") ? Bresult["经济舱SUITE"] : 0)
+                var BtxtGWCSUITERS = (Bresult.hasOwnProperty("公务舱SUITE") ? Bresult["公务舱SUITE"] : 0)
+
+                var BrightSum = 0;
+                this.OtherCostPropertyBJ.forEach((x) => {
+                    BrightSum += Number(that.BcalculateDRBJ(x));
+                })
+
+                let BJJCSGRDRBJ = BrightSum + Number(that.BcalculateDRBJ('jjc')) + Number(that.BcalculateDRBJ('sgr'));
+                let BJJCTBRDRBJ = BrightSum + Number(that.BcalculateDRBJ('tbr')) + Number(that.BcalculateDRBJ('jjc'));
+                let BJJCSUITEDRBJ = BrightSum + Number(that.BcalculateDRBJ('suite')) + Number(that.BcalculateDRBJ('jjc'));
+                let BGWCSUITEDRBJ = BrightSum + Number(that.BcalculateDRBJ('suite')) + Number(that.BcalculateDRBJ('gwc'));
+                let BGWCSGRDRBJ = BrightSum + Number(that.BcalculateDRBJ('sgr')) + Number(that.BcalculateDRBJ('gwc'));
+                let BGWCJSESDRBJ = BrightSum + Number(that.BcalculateDRBJ('jses')) + Number(that.BcalculateDRBJ('gwc'));
+
+                airs.push({
+                    "code": "JJCTBR",
+                    "number": BtxtJJCTBRRS,
+                    "price": BJJCTBRDRBJ,
+                    "costType": "B"
+                });
+
+                airs.push({
+                    "code": "JJCSGR",
+                    "number": BtxtJJCSGRRS,
+                    "price": BJJCSGRDRBJ,
+                    "costType": "B"
+                });
+
+                airs.push({
+                    "code": "GWCSGR",
+                    "number": BlblGWCSGRRS,
+                    "price": BGWCSGRDRBJ,
+                    "costType": "B"
+                });
+
+                airs.push({
+                    "code": "GWCJSES",
+                    "number": BtxtGWCJSESRS,
+                    "price": BGWCJSESDRBJ,
+                    "costType": "B"
+                });
+
+                airs.push({
+                    "code": "GWCSUITE",
+                    "number": BtxtGWCSUITERS,
+                    "price": BGWCSUITEDRBJ,
+                    "costType": "B"
+                });
 
+                airs.push({
+                    "code": "JJCSUITE",
+                    "number": BJJCSUITERS,
+                    "price": BJJCSUITEDRBJ,
+                    "costType": "B"
+                });
+
+            }
+
+            var txtJJCSGRRS = (result.hasOwnProperty("经济舱SGR") ? result["经济舱SGR"] : 0)
+            var lblGWCSGRRS = (result.hasOwnProperty("公务舱SGR") ? result["公务舱SGR"] : 0)
+            var txtJJCTBRRS = (result.hasOwnProperty("经济舱TBR") ? result["经济舱TBR"] * 2 : 0)
+            var txtGWCJSESRS = (result.hasOwnProperty("公务舱JSES") ? result["公务舱JSES"] : 0)
+            var JJCSUITERS = (result.hasOwnProperty("经济舱SUITE") ? result["经济舱SUITE"] : 0)
+            var txtGWCSUITERS = (result.hasOwnProperty("公务舱SUITE") ? result["公务舱SUITE"] : 0)
+
+            var rightSum = 0;
+            this.OtherCostPropertyBJ.forEach((x) => {
+                rightSum += Number(that.calculateDRBJ(x));
+            })
+
+            let JJCSGRDRBJ = (rightSum + Number(that.calculateDRBJ('jjc')) + Number(that.calculateDRBJ('sgr'))).toFixed(2);
+            let JJCTBRDRBJ = (rightSum + Number(that.calculateDRBJ('tbr')) + Number(that.calculateDRBJ('jjc'))).toFixed(2);
+            let JJCSUITEDRBJ = (rightSum + Number(that.calculateDRBJ('suite')) + Number(that.calculateDRBJ('jjc'))).toFixed(2);
+            let GWCSUITEDRBJ = (rightSum + Number(that.calculateDRBJ('suite')) + Number(that.calculateDRBJ('gwc'))).toFixed(2);
+            let GWCSGRDRBJ = (rightSum + Number(that.calculateDRBJ('sgr')) + Number(that.calculateDRBJ('gwc'))).toFixed(2);
+            let GWCJSESDRBJ = (rightSum + Number(that.calculateDRBJ('jses')) + Number(that.calculateDRBJ('gwc'))).toFixed(2);
+
+            airs.push({
+                "code": "JJCTBR",
+                "number": txtJJCTBRRS,
+                "price": JJCTBRDRBJ,
+                "costType": "A"
+            });
+
+            airs.push({
+                "code": "JJCSGR",
+                "number": txtJJCSGRRS,
+                "price": JJCSGRDRBJ,
+                "costType": "A"
+            });
+
+            airs.push({
+                "code": "GWCSGR",
+                "number": lblGWCSGRRS,
+                "price": GWCSGRDRBJ,
+                "costType": "A"
+            });
+
+            airs.push({
+                "code": "GWCJSES",
+                "number": txtGWCJSESRS,
+                "price": GWCJSESDRBJ,
+                "costType": "A"
+            });
+
+            airs.push({
+                "code": "GWCSUITE",
+                "number": txtGWCSUITERS,
+                "price": GWCSUITEDRBJ,
+                "costType": "A"
+            });
+
+            airs.push({
+                "code": "JJCSUITE",
+                "number": JJCSUITERS,
+                "price": JJCSUITEDRBJ,
+                "costType": "A"
+            });
+
+
+            var that = this;
+            this.$axios.post('/api/Groups/ExportPriceCheckWordFile', { diid: this.diid, airs: airs }, {
+                headers: {
+                    'Authorization': this.token,
+                }
+            }).then(resp => {
+                console.log(resp, '------------------------------------');
+                try {
+                    if (resp.data.code != 200) {
+                        throw false;
+                    }
+                    var file = resp.data.data;
+                    that.fileDownload(file.data, file.strFileName);
+                } catch (error) {
+                    this.$message.error('操作失败!' + error.message);
+                }
+            })
+
+
+        },
+        fileDownload(data, filename) {
+            let blob = this.base64toBlob(data);
+            let link = document.createElement('a');
+            link.href = window.URL.createObjectURL(blob);
+            link.download = filename;
+            link.click();
+        },
+        base64toBlob(base64, type = 'application/octet-stream') {
+            const bstr = atob(base64);
+            let n = bstr.length;
+            const u8arr = new Uint8Array(n);
+            while (n--) {
+                u8arr[n] = bstr.charCodeAt(n);
+            }
+            return new Blob([u8arr], { type });
+        },
+        GetGroupCostExcel() {
+
+            var that = this;
+            var group = this.options.filter(function (x) {
+                return x.id == that.diid
+            })
+
+            if (group.length == 0) {
+                this.$message.error('请选择团组!' + resp.data.msg);
+                return;
+            }
+
+            var data = {
+                diid: this.diid,
+                title: {
+                    groupNumber: Number(this.grouptitleinfo.visitPNumber),
+                    teamName: group[0].groupName,
+                    tax: this.AGroupCostParameter.tax,
+                    currency: this.AGroupCostParameter.currency,
+                    rate: this.AGroupCostParameter.rate
+                },
+                leftInfo: {
+
+                },
+                rightInfo: {
+
+                }
+            };
+            var leftObject = this.GetDomLeftValue();
+            var rightObject = this.GetDomRightValue();
+            data.leftInfo = leftObject;
+            data.rightInfo = rightObject;
+
+            console.log(data);
+
+            this.$axios.post('/api/Groups/ExportGroupCostExcelFile', data, {
+                headers: {
+                    'Authorization': this.token,
+                }
+            }).then(resp => {
+                console.log(resp, '------------------------------------');
+
+            })
+
+
+        },
+        GetDomLeftValue() {
+            var AllResult = [];
+            var boxDoms = document.querySelectorAll(".sheet-box .biaoge");
+            var titleClassName = 'el-table__header-wrapper';
+            var bodyClassName = 'el-table__body-wrapper';
+            var result = [];
+            for (var i = 0; i < boxDoms.length; i++) {
+                var chiBoxs = boxDoms[i].children[0].children;
+                var info = {};
+                info.index = i;
+                for (var j = 0; j < chiBoxs.length; j++) {
+                    if (chiBoxs[j].className.indexOf(titleClassName) != -1) {
+                        info.title = chiBoxs[j].querySelectorAll('thead tr th')[0].innerText;
+                    } else if (chiBoxs[j].className.indexOf(bodyClassName) != -1) {
+                        info.cb = chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('input').value : '0';
+                        info.rs = chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input').value : '0';
+                        info.xs = chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('input').value : '0';
+                    }
+                }
+                result.push(info)
+            }
+            AllResult.push({ type: "A", leftinfoNumber: result })
+
+            if (this.costTypevalue == 'B') {
+                var boxDoms = document.querySelectorAll(".sheet-box .biaogeB");
+                var result = [];
+                for (var i = 0; i < boxDoms.length; i++) {
+                    var chiBoxs = boxDoms[i].children[0].children;
+                    var info = {};
+                    info.index = i;
+                    for (var j = 0; j < chiBoxs.length; j++) {
+                        if (chiBoxs[j].className.indexOf(titleClassName) != -1) {
+                            info.title = chiBoxs[j].querySelectorAll('thead tr th')[0].innerText;
+                        } else if (chiBoxs[j].className.indexOf(bodyClassName) != -1) {
+                            info.cb = chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('input').value : '0';
+                            info.rs = chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input').value : '0';
+                            info.xs = chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('input').value : '0';
+                        }
+                    }
+                    result.push(info)
+                }
+                AllResult.push({ type: "B", leftinfoNumber: result })
+            }
+
+            return AllResult;
+        },
+        GetDomRightValue() {
+            var AllResult = [];
+            var boxDoms = document.querySelectorAll(".cabin-li .biaoge");
+            var titleClassName = 'el-table__header-wrapper';
+            var bodyClassName = 'el-table__body-wrapper';
+            var result = [];
+            for (var i = 0; i < boxDoms.length - 1; i++) {
+                var chiBoxs = boxDoms[i].children[1].children;
+                var info = {};
+                info.index = i;
+                for (var j = 0; j < chiBoxs.length; j++) {
+                    if (chiBoxs[j].className.indexOf(titleClassName) != -1) {
+                        info.title = boxDoms[i].children[0].innerText + chiBoxs[j].querySelectorAll('thead tr th')[0].innerText;
+                    } else if (chiBoxs[j].className.indexOf(bodyClassName) != -1) {
+                        info.cb = chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('span') ? chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('span').innerText : '0';
+                        info.rs = chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input').value : '0';
+                        info.xs = chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('span') ? chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('span').innerText : '0';
+                        info.bj = chiBoxs[j].querySelectorAll('tbody tr td')[3].querySelector('span') ? chiBoxs[j].querySelectorAll('tbody tr td')[3].querySelector('span').innerText : '0';
+                    }
+                }
+                result.push(info)
+            }
+
+            AllResult.push({ type: "A", rightInfoNumber: result })
+
+            if (this.costTypevalue == 'B') {
+                var boxDoms = document.querySelectorAll(".cabin-li .biaogeB");
+                var result = [];
+                for (var i = 0; i < boxDoms.length; i++) {
+                    var chiBoxs = boxDoms[i].children[1].children;
+                    var info = {};
+                    info.index = i;
+                    for (var j = 0; j < chiBoxs.length; j++) {
+                        if (chiBoxs[j].className.indexOf(titleClassName) != -1) {
+                            info.title = boxDoms[i].children[0].innerText + chiBoxs[j].querySelectorAll('thead tr th')[0].innerText;
+                        } else if (chiBoxs[j].className.indexOf(bodyClassName) != -1) {
+                            info.cb = chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('span') ? chiBoxs[j].querySelectorAll('tbody tr td')[0].querySelector('span').innerText : '0';
+                            info.rs = chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input') ? chiBoxs[j].querySelectorAll('tbody tr td')[1].querySelector('input').value : '0';
+                            info.xs = chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('span') ? chiBoxs[j].querySelectorAll('tbody tr td')[2].querySelector('span').innerText : '0';
+                            info.bj = chiBoxs[j].querySelectorAll('tbody tr td')[3].querySelector('span') ? chiBoxs[j].querySelectorAll('tbody tr td')[3].querySelector('span').innerText : '0';
+                        }
+                    }
+                    result.push(info)
+                }
+                AllResult.push({ type: "B", rightInfoNumber: result })
+            }
+
+
+
+            return AllResult;
+        }
 
     },
     mounted() {
@@ -3673,7 +4048,8 @@ export default {
     margin-top: 30px;
 }
 
-.biaoge {
+.biaoge,
+.biaogeB {
     margin-bottom: 30px;
 }